Skip to content

chore(cleanup): drop verified dead exports and unused types - #4938

Merged
Astro-Han merged 1 commit into
apache:mainfrom
orangeCatDeveloper:chore/dead-code-sweep-2026-09
Sep 8, 2026
Merged

chore(cleanup): drop verified dead exports and unused types#4938
Astro-Han merged 1 commit into
apache:mainfrom
orangeCatDeveloper:chore/dead-code-sweep-2026-09

Conversation

@orangeCatDeveloper

@orangeCatDeveloper orangeCatDeveloper commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes the dead code that a knip sweep across every workspace and the repository root surfaced, with each symbol verified consumer-free by a repo-wide grep spanning .ts, .tsx, .mjs, .ps1, .py and workflow files: 28 files, +15/−371 (rebased onto current main).

  • unused exported functions, types and helpers in runtime (context-budget-helpers, model-history's text-only projection subtree, agent-run-inspect, stream-graph-supervisor-tools, runtime-event-backfill, model-adapter, workspace-executor, compaction-boundary, memory-extraction-proposal, filesystem-authority, plugin-runtime's alias), runtime-host (agent-graph-coordinator, host-kernel, client-capability-coordinator's type re-export, peer-mesh), storage (workspace-version-authority-internal's orphan plus a fixture's unused helper), cli (workspace-root's type re-exports, an unused wrapper, an unused union) and core (the computer-use action-type alias);
  • the storage readHead registration plumbing that only fed the deleted readWorkspaceHeadInternal (the live store method and its tests stay);
  • two dead root-script exports and two ambient .d.mts declarations that no module resolution reaches;
  • two project-catalog path-limit constants unexported, declared as a compatible extension at the current epoch (133).

Kept deliberately: the decode/encode and PAGE/RANGE codec alias pairs whose both names have live consumers stay as plain aliases, so the page/range bound coupling and the result-frame wire-shape symmetry remain true by construction. Their knip duplicates finding is accepted with a file-scoped ignoreIssues entry for the three alias files, shipped in the gate PR #4942 (probe-verified there: an injected unused export in artifact.ts is still reported and the full npx knip run is clean). The wire contract stays recorded in the operations spec tables. The website keeps its exact cookie@2.0.1 pin: astro's prerenderer resolves it through the website root.

The scan configuration that surfaced these and the CI wiring for the gate live in the follow-up draft #4942 (stacked); this PR is deletions only.

No behaviour change.

Verification

npm run format:check                          → clean
npm run lint                                  → clean
npm run build:test (clean rebuild)            → clean
apps/desktop typecheck (4 tsconfigs)          → 0 errors
protocol-epoch-check --base origin/main       → declared compatible extension at epoch 133
workspace test runner (--concurrency=3)       → core/mcp/eval/computer-use/cli/ui/website/desktop/storage: 0 failures;
                                                runtime: 9, runtime-host: 1 sandbox/filesystem-worker failures.
                                                Environmental on this machine: ripgrep is not installed, so every
                                                runtime failure is `spawn rg ENOENT`, and the runtime-host one is
                                                the macOS-sandbox ENOENT noted in earlier rounds. None touches a
                                                deleted symbol.
deleted-symbol re-grep on the new base        → all 34 removed exports still consumer-free across
                                                .ts/.tsx/.mjs/.ps1/.py and workflow files
npx knip --workspace apps/desktop             → clean
npx knip --workspace packages/ui              → clean
npx knip (plain, root + all)                  → the only finding attributable to this PR is the five intentional
                                                duplicate alias pairs; the remaining unlisted-binary/dependency and
                                                LIFECYCLE_LABELS reports are configuration the gate PR #4942 adds

Review follow-ups addressed (five review rounds)

  • readWorkspaceHeadInternal and the readHead registration plumbing that only fed it are deleted; the live readWorkspaceHead store method and its direct tests are untouched.

  • Unused readFile and STORAGE_ROOT_MARKER_FILE imports removed from the control-directory-hygiene fixture; orphaned section banners and JSDoc removed from model-history.ts (including the leftover stripSteeringMessages block).

  • The LIFECYCLE_LABELS export is restored: the nightly issue-pr-lifecycle workflow loads this module through an actions/github-script with: script, which knip's plugin does not see. The workflow is unaffected and the module is registered as a gate entry in chore(ci): run the knip dead-code gate for the repository root and every workspace #4942.

  • The two ambient .d.mts declarations are restored (TS module resolution consumes sibling declarations without an import statement); the root project glob excludes **/*.d.mts in chore(ci): run the knip dead-code gate for the repository root and every workspace #4942.

  • Round 4: the three protocol alias files (artifact.ts, session-transcript.ts, usage-pricing.ts) are restored to plain aliases per review (no wrapper functions, no duplicate-bound test, no protocol-codec-encode-wrappers.json compatibility declaration); the scoped knip duplicates exception for them ships in chore(ci): run the knip dead-code gate for the repository root and every workspace #4942 instead. Rebased onto current main; the remaining compatible-change declaration is synced to the current epoch (125). Five files main touched since the original base were re-checked to still carry the intended deletions.

  • Round 5: rebased onto current main (93a8dd785) with no conflicts; the epoch-sync commit from the previous round folded away, so the branch is a single commit again. project-catalog-path-limit-unexport.json is re-pinned from 123 to 133 and its reason re-checked against the protocol as it now stands: both constants are still referenced only inside project-catalog.ts. Every deleted symbol was re-grepped against the new base.

AI use

  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code — the scan/verification loop, the removals, the rebase and epoch sync, the review-follow-up rework, and this description. Every deletion was verified consumer-free by grep before removal; pre-commit gates (biome, ASF headers, protocol epoch) pass on the tree.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally
  • Commit carries Generated-by: Claude Code

Does this PR entail a change in behavior?

  • Yes
  • No

@github-actions github-actions Bot added the effort/M Under 500 readable lines label Sep 6, 2026
@orangeCatDeveloper
orangeCatDeveloper force-pushed the chore/dead-code-sweep-2026-09 branch 6 times, most recently from 38becc1 to 5a0e2b5 Compare September 7, 2026 00:08

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup. Two fresh deep reviewers checked the deletion consumers and protocol semantics at 5a0e2b5cad84e85cf23555dd344bcc07e9383a9d; no additional correctness defect survived cross-checking. One optional simplification is noted inline. Separately, the compatible-change declarations still use epoch 121: when updating this branch onto current main, synchronize them with its current epoch (123 at review time) and rerun the gate. Existing green checks use the earlier base. This review was AI-assisted and cross-checked by the coordinating AI reviewer.

中文

谢谢清理。两位独立深审检查了删除项的消费者和协议语义,未确认新增正确性缺陷;行内提出一条可选精简意见。另外,兼容声明仍为 epoch 121,更新到当前 main 时需同步当时的 epoch(本次检查时为 123)并重跑门禁;已有绿灯基于较早的基线。本次由 AI 协助审查并由主审 AI 交叉验证。

Comment thread packages/runtime-host/src/protocol/session-transcript.ts Outdated
@orangeCatDeveloper
orangeCatDeveloper force-pushed the chore/dead-code-sweep-2026-09 branch from 5a0e2b5 to cd60f4b Compare September 7, 2026 10:58
@orangeCatDeveloper orangeCatDeveloper changed the title chore(cleanup): drop verified dead exports, duplicate aliases and unused types chore(cleanup): drop verified dead exports and unused types Sep 7, 2026

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup. The reviewed removals remain consumer-free, and the unnecessary codec wrapper changes have been removed. I synchronized the branch with current main and re-pinned the compatible-change declaration from 123 to 125: the synthetic merge failed this guard before the adjustment and passes afterward. No product logic was changed by this integration fix.

Approving head 77a8ed5d8a6d20604cc4af850db958b046ea1cfe; merging remains conditional on the new required checks. The earlier independent reviews covered deletion consumers and protocol semantics. This follow-up was AI-assisted source/integration review, not a fresh full-suite run.

中文

感谢清理。已审查的删除项仍无消费者,不必要的 codec wrapper 改动已移除。我同步了当前 main,并将兼容声明从 123 调整到 125;调整前合并结果的协议门禁失败,调整后通过,本次整合未改变产品逻辑。

批准上述 head,合并仍等待新的必要检查。此前独立评审覆盖了删除消费者与协议语义;本轮为 AI 辅助源码及整合核对,没有重新跑全仓测试。

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integration refresh: the head is still the previously reviewed 77a8ed5d8, but main has moved to 8b3655a17 (epoch 133). Git merges this cleanly; the protocol guard does not. I checked the synthetic merge tree with the repository's guard, which rejects project-catalog-path-limit-unexport.json because it still declares epoch 125.

Please synchronize with current main and re-pin that declaration to the resulting epoch after rechecking its reason. The unexport-only change still needs no protocol behavior change or extra codec wrapper. The earlier green CI/approval should not be treated as validation of today's merge result.

AI-assisted source/integration verification; no tracked files changed.

中文

整合复核:head 仍是已评审的 77a8ed5,但 main 已到 8b3655a、epoch 133。Git 能干净合并,协议 guard 却会因兼容声明仍写 125 失败;已用仓库原脚本对合成合并树实测。

请同步当前 main,重新核对理由后把该声明绑定到合并后的 epoch。不需要改变协议行为或加回 codec wrapper。旧 CI/Approve 不代表今天的合并结果已验证。本轮为 AI 辅助源码/整合检查,未改仓库文件。

Remove the dead code that the knip sweep across every workspace and the
repository root surfaced, with each symbol verified consumer-free by a
repo-wide grep spanning .ts, .tsx, .mjs, .ps1, .py and workflow files:

- unused exported functions, types and helpers in runtime
  (context-budget-helpers, model-history's text-only projection subtree,
  agent-run-inspect, stream-graph-supervisor-tools,
  runtime-event-backfill, model-adapter, workspace-executor,
  compaction-boundary, memory-extraction-proposal, filesystem-authority,
  plugin-runtime's alias), runtime-host (agent-graph-coordinator,
  host-kernel, client-capability-coordinator's type re-export,
  peer-mesh), storage (workspace-version-authority-internal, a fixture's
  unused helper), cli (workspace-root's type re-exports, an unused
  wrapper, an unused union) and core (the computer-use action-type
  alias);
- the storage readHead registration plumbing that only fed the deleted
  readWorkspaceHeadInternal (the live store method and its tests stay);
- two dead root-script exports and two ambient .d.mts declarations that
  no module resolution reaches;
- two project-catalog path-limit constants unexported, declared as a
  compatible extension at the current epoch (123, rebased onto main).

Kept deliberately: the decode/encode and PAGE/RANGE codec alias pairs
whose both names have live consumers stay as plain aliases so the page
and range bounds and the wire contract remain true by construction.
Their knip duplicates finding is handled by a scoped ignoreIssues
exception for the three alias files in the follow-up gate PR instead of
restructuring the declarations. The website keeps its exact cookie@2.0.1
pin: astro's prerenderer resolves it through the website root.

The scan configuration that surfaced these (knip.json workspaces) and
the CI wiring live in the follow-up gate PR; this PR is deletions only.

No behaviour change.

Generated-by: Claude Code
@orangeCatDeveloper
orangeCatDeveloper force-pushed the chore/dead-code-sweep-2026-09 branch from 77a8ed5 to 77654b3 Compare September 8, 2026 07:51

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for rebasing. Reviewed 77654b3: no P0–P3 findings. The previously reviewed removal patch is preserved; the compatibility declaration now correctly uses epoch 133. An independent reviewer rechecked remaining consumers, and the protocol guard passes on the synthetic merge with current main. Current-head checks pass. This is internal dead-code cleanup with no UI/UX change. AI-assisted review; no additional local workspace suite was run in this incremental pass.

中文

感谢 rebase。增量复核无 P0–P3,原有清理内容保持一致,兼容声明已修正为 epoch 133。独立 reviewer 核对了剩余消费者,主审在当前 main 的合成合并上运行协议检查通过,当前 head 检查通过。属于内部死代码清理,无 UI/UX 变化。本轮为 AI 辅助增量审查,未额外重跑 workspace 套件。

@Astro-Han
Astro-Han merged commit 0af82fb into apache:main Sep 8, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/M Under 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants