refactor: remove dead code, orphan modules, and two unused dependencies

Merged
WA
2mo ago
+3-3750

−3,729 lines. Every symbol was classified per reference hit — own declaration / barrel re-export / vi.mock stub / real production caller — and only those with zero real callers are removed.

Orphan modules

LinesModuleEvidence
148scheduled-tasks/components/schedule-calendar/ (11 files)zero references repo-wide, not even a barrel line
118terminal/components/filter-popover/barrel-only; FilterPopover used nowhere
7926 iso-marks primitivesmothership.tsx imports only the four Iso*Illustrations, which don't use these
8014 copilot user-input hooksbarrel line only; their six live siblings stay
51lib/workflows/application/duplicate-workflow.tsorphaned use case — see below

The duplicate-workflow one is a name collision worth spelling out: lib/workflows/persistence/duplicate.ts exports a same-named duplicateWorkflow, and all 23 apparent references are to that one. Nothing imports the application path.

Dead exports

  • lib/compare/data/feature-catalog.ts — SIM_FEATURES, 939 lines, one unshipped feature-comparison catalog. The SimFeature type, FeatureCategory union, and featuresByCategory/featuresByTag helpers went with it; nothing else used them.
  • createExecutionCallbacks — declaration only, zero other hits.

Stale vi.mock targets

Seven vi.mock() calls name modules that no longer exist. They are silent no-ops that make a test look protected when it isn't. Removal is provably inert: if the module doesn't exist, nothing can import it.

The clearest one is app/api/files/parse/route.test.ts, which mocks the dead @/lib/uploads/setup.server on line 106 and the real @/lib/uploads/core/setup.server on line 107.

Dependencies

three and @types/three. Zero imports anywhere; absent from every config, script, workflow, Dockerfile and chart; no peer requires them; "types": ["node"] means @types/three isn't auto-loaded. Both arrived with the speech-to-speech voice mode, since removed.

Two things deliberately NOT removed

  • build-chat-animation/ reads as a textbook orphan, but build-callout.tsx:8 documents it as "parked here unwired, kept for reuse." Intentional.
  • The copilot panel user-input/ subtree (3,334 lines) looked entirely orphaned and I staged it for deletion. bun run type-check proved it live: home/components/user-input imports from it. My grep had excluded importing files whose own path also contained components/user-input/. Only the four hooks with zero references by name are removed.

Verification

bun run type-check — back to the 11 pre-existing errors, none new. bun run check:audits — all 33 pass. Tests: 344 across lib/workflows/executor, lib/compare, home/components/user-input, blocks/blocks/logs, lib/uploads/providers, plus the five suites whose stale mocks were removed (136) — all green.