Skip to content

Remove dead code: unreferenced files and unused exports - #807

Merged
selfcontained merged 1 commit into
mainfrom
tech-debt/remove-dead-code-3f0e0211
Jul 21, 2026
Merged

Remove dead code: unreferenced files and unused exports#807
selfcontained merged 1 commit into
mainfrom
tech-debt/remove-dead-code-3f0e0211

Conversation

@selfcontained

Copy link
Copy Markdown
Owner

What

A repo-wide dead-code scan (dead code / duplication / oversized-file audit — the backlog was empty, so this run started fresh). This PR is the pure-deletion slice: 243 lines removed, zero behavior change.

Deleted files (zero importers anywhere in apps/, e2e/, bin/, scripts/, tests):

  • apps/web/src/lib/hotkeys/format.ts (91 lines) — nothing imports hotkeys/format; its five exports (formatCombo, formatComboParts, formatHotkey, formatHotkeyParts, formatHotkeyForKbd) only referenced each other.
  • apps/web/src/components/app/dashboard-navigation.ts — sole export openAgentFromJobs was never called.

Removed unused exports (only occurrence in the repo was the export site):

SymbolFile
DocsPane + DocsPanePropsapps/web/src/components/app/docs-pane.tsx
SettingsPanePropsapps/web/src/components/app/settings-pane.tsx
useBrainObject, useAgentBrainActivity, BrainAgentActivityapps/web/src/hooks/use-brain.ts
reviewVerdictLabel, ReviewVerdictapps/web/src/components/app/agent-event-utils.ts
ReleaseJobTypeapps/web/src/hooks/use-release-stream.ts
isMcpRouteapps/server/src/auth.ts
ASSISTED_UPDATE_STORE_PATHapps/server/src/assisted-update-store.ts
PinInputapps/server/src/shared/mcp/server.ts

Notes on two of these:

  • docs-pane.tsxis imported — but only for DocsContent / DOCS_SECTION_NAV by settings-pane.tsx. The DocsPane dialog wrapper itself is never rendered; removing it also orphaned the @radix-ui/react-dialog and X imports.
  • ASSISTED_UPDATE_STORE_PATH was self-described in a comment as a back-compat alias "for callers that imported the constant" — there are none, and it eagerly resolved the home directory at module load.
  • isScopedMcpRoute (the sibling that is used) is untouched.

Why this is tech debt

Unreferenced modules and exports are surface area that has to be read, type-checked, and reasoned about on every pass through these files, and they make future dead-code scans noisier. Nothing here changes runtime behavior — every deletion was verified to have no remaining reference.

Explicitly out of scope

  • Unused vendored shadcn primitives (components/ui/sheet.tsx, DialogTrigger, DialogClose, SelectGroup, SelectLabel, SelectSeparator) and the five unused tokens in lib/glass.ts. These are design-system surface area, not dead application code — removing them is a judgement call, so they're queued in the backlog instead.
  • recordError in lib/energy-metrics.ts — dead, but removing it also orphans the errors field on the EnergyMetrics shape; needs its own pass.

Validation

  • pnpm run check — pass
  • pnpm run finalize:web — pass
  • pnpm run test — 131 + 24 + 8 files pass, 2604 tests
  • pnpm run test:e2e — 169 passed, 12 skipped

Queued for the next run

The audit also produced 24 verified duplication findings that seeded the backlog. Top of the queue: four byte-identical server helpers (isUniqueViolation ×3, sleep ×2, isAgentLatestEventType ×2, escapeLike ×2) to consolidate into apps/server/src/shared/lib/, then shortPath ×4 in web, then the ~180-line review-feedback card duplicated between diff-annotations.tsx and reviews-sidebar.tsx.

🤖 Generated with Claude Code

A repo-wide dead-code scan found two modules with zero importers and a
handful of exports whose only occurrence in the repo is the export site.
All are pure deletions — no call sites, no behavior change.
Deleted files:
- apps/web/src/lib/hotkeys/format.ts (91 lines) — nothing imports
`hotkeys/format`; its five exports only referenced each other.
- apps/web/src/components/app/dashboard-navigation.ts — sole export
`openAgentFromJobs` was never called.
Removed unused exports:
- `DocsPane` (docs-pane.tsx) — the file is imported only for
`DocsContent`/`DOCS_SECTION_NAV`; the dialog wrapper is never rendered.
Its `DocsPaneProps` type and the now-orphaned radix/lucide imports go
with it.
- `SettingsPaneProps` (settings-pane.tsx) — leftover from a component
that no longer exists.
- `useBrainObject`, `useAgentBrainActivity` and the orphaned
`BrainAgentActivity` type (use-brain.ts).
- `reviewVerdictLabel` + `ReviewVerdict` (agent-event-utils.ts).
- `ReleaseJobType` (use-release-stream.ts).
- `isMcpRoute` (auth.ts) — `isScopedMcpRoute` is the one in use.
- `ASSISTED_UPDATE_STORE_PATH` (assisted-update-store.ts) — self-described
as a back-compat alias for callers that no longer exist, and it resolved
the home directory at module load.
- `PinInput` type (shared/mcp/server.ts).
Deliberately out of scope: unused vendored shadcn primitives
(components/ui/sheet.tsx, DialogTrigger, SelectGroup, …) and the five
unused tokens in lib/glass.ts — those are design-system surface area
rather than dead application code, and are queued for a separate call.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@selfcontained
selfcontained merged commit 18cda14 into mainJul 21, 2026
1 check passed
@selfcontained
selfcontained deleted the tech-debt/remove-dead-code-3f0e0211 branch July 21, 2026 09:19
selfcontained added a commit that referenced this pull request Aug 12, 2026
Three buckets of unreferenced design-system code have been deferred twice
(PR #807, PR #934) because they are a judgement call rather than clear-cut
dead application code. This settles the policy and applies it.
Delete what is dead weight:
- apps/web/src/components/ui/sheet.tsx (134 lines, zero importers)
- five unused tokens in lib/glass.ts (glassDivider, glassHover, glassActive,
glassBadgeBg, primaryGlow)
Keep, and say so in a comment, what is a deliberately complete vendored
API surface: DialogTrigger/DialogClose in ui/dialog.tsx and
SelectGroup/SelectLabel/SelectSeparator in ui/select.tsx.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for freeto 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

@selfcontained