Skip to content

Fresh debt audit: delete six unreferenced exports - #958

Merged
selfcontained merged 1 commit into
mainfrom
debt/audit-dead-exports-2026-08-14
Aug 14, 2026
Merged

Fresh debt audit: delete six unreferenced exports#958
selfcontained merged 1 commit into
mainfrom
debt/audit-dead-exports-2026-08-14

Conversation

@selfcontained

Copy link
Copy Markdown
Owner

First broad tech-debt audit since 2026-07-21 (PR #807). Scoped per the Brain's
standing guidance to two categories — unreferenced exports and duplicated
helpers / name collisions
— skipping the TODO/FIXME, any-cast, and
unused-dependency sweeps, which four consecutive audits have found empty.

What this PR changes

Pure deletion: +0 / -61 across 6 files, no behavior change. Every symbol was
verified against a repo-wide identifier-frequency map built over all tracked
files (so e2e/, bin/, scripts/, tests, config, and markdown are covered),
then spot-checked with a direct grep.

File Deleted Why
apps/server/src/observability/service-resources.ts isSubsystemDegraded Only occurrence in the repo is its own declaration.
apps/server/src/agents/telemetry.ts AgentHistoryResult, AgentHistoryEntry AgentHistoryResult was dead; its only consumer-of-AgentHistoryEntry status made that type dead too (orphan chain). No history function lives in this module — the sibling ActivitySummaryResult / FeedbackSummaryResult types are return types and stay.
apps/server/src/applied-migrations-store.ts export { appliedStorePath as APPLIED_MIGRATIONS_STORE_PATH_FN } Zero importers. appliedStorePath itself stays — used twice in-file.
apps/server/src/templates/store.ts the arg-parser import block, export type { … as ParsedArg } Neither parseTemplateArgs, substituteArgs, nor ParsedArg was referenced in the file body, and ParsedArg has zero importers.
apps/web/src/hooks/use-jobs.ts JobRunTriggerSource Zero references.
apps/web/src/hooks/use-release-stream.ts AssistedRequiredCheck + the RequiredCheckName type-only import Zero references; removing it orphaned the import.

Why this qualifies as tech debt

Dead exports are load-bearing-looking code: they make a module's public surface
read wider than it is, they survive greps, and they keep otherwise-removable
types alive behind them (the AgentHistoryEntry chain here). Deletion-only PRs
are the safest way to clear them — nothing can regress behavior.

Deliberate exclusions (do not re-litigate)

Several things the scan flagged are not debt and were left alone:

  • templates/store.ts:14export { parseTemplateArgs, substituteArgs } from "./arg-parser.js" stays. Both names have real importers through store.js (routes/templates.ts, jobs/service.ts). Only the redundant local import and the ParsedArg alias went.
  • formatBytes in apps/web/src/components/app/service-resources-format.ts vs shared/lib/format-bytes.ts — a name collision, not a duplicate. The web copy takes number | null (→ "—"), has a TB tier, and switches precision at ≥10 ("10 KB" vs "1.0 KB"). Both have tests asserting their own outputs. Rename candidate later; merging would change rendered output.
  • mergeElements in server/mcp-whiteboard-handlers.ts vs web/whiteboard-tab.tsx — same name, genuinely different behavior (server merges with delete-ids and change tracking; web unions local/remote). Both file-private.
  • toWriteAck in shared/mcp/brain-tools.ts vs crud-tools.ts — different shapes (typed brain-object ack vs duck-typed CRUD ack). Both file-private.
  • resolveRepoRoot ×3 — shared/git/git-context.ts exports a genuinely different common-dir resolver; the worktree.ts and pr.ts copies are near-identical but throw different domain error classes. Backlogged, not swept here.
  • shadcn re-exports (DialogTrigger, DialogClose, SelectGroup, SelectLabel, SelectSeparator) — settled policy from PR Settle the dead design-system surface policy #944, kept on purpose and annotated in-file.

Validation

pnpm run check · pnpm run finalize:web · pnpm run test:e2e (180 passed) ·
server Vitest (2733 passed) · web Vitest (875 passed) — all green.

Queued for the next run

The audit's headline finding is a third copy of the icon-color palette:
VALID_ICON_COLORS (apps/server/src/server/static-theme.ts:7),
ICON_COLORS (apps/web/src/hooks/use-icon-color.ts:4), and the hex table in
scripts/generate-icon-colors.ts — three places to edit to add one colour, with
ICON_COLOR_OPTIONS re-typing the same hexes web-side. That is next.

Behind it, a fresh cluster of server↔web wire-type duplication: service-resources
(~120 mirrored lines), the three-way reviews types, brain store, agent history,
agent diff, release info, and messages.

🤖 Generated with Claude Code

Pure deletion, no behavior change. Every symbol was verified with a
repo-wide grep covering e2e/, bin/, scripts/, tests, config, and markdown.

- observability/service-resources.ts: isSubsystemDegraded — zero callers
- agents/telemetry.ts: AgentHistoryResult, and AgentHistoryEntry which it
  orphaned (no history function lives in this module)
- applied-migrations-store.ts: the APPLIED_MIGRATIONS_STORE_PATH_FN
  re-export alias — zero importers; appliedStorePath stays, used in-file
- templates/store.ts: the unused arg-parser value/type import block and
  the ParsedArg re-export — zero importers. The line-14 `export ... from`
  stays; both of its names have importers.
- web use-jobs.ts: JobRunTriggerSource
- web use-release-stream.ts: AssistedRequiredCheck and the RequiredCheckName
  type-only import it orphaned

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@selfcontained
selfcontained merged commit a897911 into main Aug 14, 2026
1 check passed
@selfcontained
selfcontained deleted the debt/audit-dead-exports-2026-08-14 branch August 14, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant