Skip to content

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

Open
orangeCatDeveloper wants to merge 2 commits into
apache:mainfrom
orangeCatDeveloper:chore/dead-code-sweep-2026-09
Open

chore(cleanup): drop verified dead exports and unused types#4938
orangeCatDeveloper wants to merge 2 commits 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 (123).

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 123
workspace test runner (--concurrency=3)       → core/mcp/eval/computer-use/cli/ui/website/desktop/storage: 0 failures;
                                                runtime: 5, runtime-host: 1 live-sandbox failures, reproduced
                                                identically with unmodified main sources checked out in the same
                                                tree — environmental on this machine (macOS sandbox), matches the
                                                runtime-host ENOENT failure noted in earlier rounds
npx knip --workspace apps/desktop             → clean
npx knip --workspace packages/ui              → clean
npx knip (plain, root + all)                  → reports only the five intentional duplicate alias pairs; the
                                                scoped exceptions land in #4942

Review follow-ups addressed (four 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 (123). Five files main touched since the original base were re-checked to still carry the intended deletions.

  • Known follow-up, preserved here per review: the deleted FilesystemTargetDescriptor carried a security-rationale comment (a discriminated union making "the target has no identity to compare" an explicit missing case, closing the "no identity → CAS passes" regression class). That hardening was never landed: file-stable-write.ts still skips the compare-and-delete when the captured identity is absent. A tracked issue should restore the decision record and land the union in file-stable-write.ts.

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
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 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 辅助源码及整合核对,没有重新跑全仓测试。

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