Skip to content

refactor(web): delete unmounted components carrying real logic (TASK-2632) - #1163

Merged
xarmian merged 1 commit into
mainfrom
refactor/2632-dead-component-sweep
Aug 19, 2026
Merged

refactor(web): delete unmounted components carrying real logic (TASK-2632)#1163
xarmian merged 1 commit into
mainfrom
refactor/2632-dead-component-sweep

Conversation

@xarmian

@xarmian xarmian commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Closes TASK-2632.

A one-shot dead-code sweep. Two dead components had been found incidentally in one week, each discovered only because someone was about to change behaviour it appeared to depend on — VersionHistory during BUG-2608 (its apparent liveness would have blocked a default history limit), and EditorToolbar before it. One is an oddity; two is a pattern.

Instrument

Two passes over all 110 components under web/src/lib/components:

  1. Plain substring grep of each basename across web/src + web/e2e → 4 zero-hit. This pass counts comments as liveness, so it under-reports deadness — conservative in the safe direction.
  2. Import/mount-only regex (a from-import of the .svelte path, a dynamic import() of it, or a <Name element) → 6 zero-hit. The two extras were exactly the comment-shadowed cases pass 1 could not see.

Controls. A known-live component (BacklinksPanel) resolves to its single consumer under both passes. Each of the six candidates then took a repo-wide plain grep with no include filters and no scope beyond node_modules/.git/.svelte-kit/build, and every surviving hit was read individually. Pass 2's one known blind spot — a component referenced only by vi.mock(path) — was checked by enumerating every vi.mock target ending in .svelte; all are .svelte.ts store/service modules except CommentEditor, which is independently imported. None of the six is in that set.

Deleted (6 dead + 2 cascade orphans)

File Why it is dead
activity/ActivityFeed.svelte A live /activity route page and TimelineActivityCard both exist; neither touches it.
charts/LineChart.svelte From the TASK-1632 LayerCake library; only BarChart reached the insights pages.
charts/layers/Lines.svelte Cascade — exactly one consumer, LineChart. AxisX/AxisY stay: shared with BarChart.
charts/Sparkline.svelte TASK-1638. Its only repo-wide reference was a prose comment recording that PLAN-1542 chose not to show it. Zero mounts.
editor/MermaidRenderer.svelte Superseded by the MermaidCodeBlock NodeView in Editor.svelte, which owns the render queue, toggle and error state.
versions/VersionHistory.svelte The BUG-2608 find (620 lines). The live path is ItemTimelineTimelineVersionCardDiffView; DiffView stays.
attachments/fixtures/LightboxStub.svelte Its last consumer was removed by the TASK-2489 atomic cutover — orphaned, not born dead.
attachments/fixtures/lightboxStub.ts Cascade — the stub's recording surface; the pair referenced only each other.

Nothing was reclassified live-but-obscure, so no import-site comments were owed.

Docs

Two edits so no artifact points at a deleted file: the web/README.md component tree drops the activity/ line, and the UserOverviewTab comment now says the Sparkline component was deleted here and is recoverable from history — otherwise a future reader greping that decision record finds nothing.

Gates

  • npx vite build — exit 0
  • make lint — 0 issues
  • go test ./... — exit 0, 25 packages ok
  • make test-pgnot applicable: zero Go files and zero store SQL in the diff
  • npm run check — 0 errors, 6 warnings (all pre-existing, in files this diff does not touch)
  • npm run test — 95 files, 1706 tests passed
  • Codex CLI — CLEAN on round 1, with independent verification of vi.mock / dynamic imports / component registries / Go embeds / Playwright + build config / JSON / Markdown / generated web/build

Git history is the archive; anything worth resurrecting is one revert away.

https://claude.ai/code/session_017jD6t1zjxGSq47SQpZfp1V

…2632)

A one-shot sweep, not a standing process. Two dead components had been found
incidentally in one week, each discovered only because someone was about to
change behaviour it appeared to depend on -- VersionHistory during BUG-2608
(its apparent liveness would have blocked a default history limit) and
EditorToolbar before it. Retired UI left in-tree costs every future reader who
greps for a component, finds a plausible implementation, and reasons about
behaviour nobody mounts; it also silently constrains fixes.

Instrument, two passes over all 110 components under web/src/lib/components:

1. Plain substring grep of each basename across web/src + web/e2e. Four
   zero-hit. This pass counts COMMENTS as liveness, so it under-reports
   deadness -- conservative in the safe direction.
2. Import/mount-only regex (a from-import of the .svelte path, a dynamic
   import of it, or a <Name element). Six zero-hit; the two extras were
   exactly the comment-shadowed cases pass 1 could not see.

Controls: a known-live component (BacklinksPanel) resolves to its single
consumer under both passes; each of the six candidates then took a repo-wide
plain grep with no include filters, and every surviving hit was read. Pass 2's
one known blind spot -- a component referenced only by vi.mock(path) -- was
checked by enumerating every vi.mock target ending in .svelte; all are
.svelte.ts store/service modules except CommentEditor, which is independently
imported. None of the six is in that set.

Deleted (six dead, two cascade orphans):

- activity/ActivityFeed.svelte -- a live /activity route page and
  TimelineActivityCard both exist; neither touches it.
- charts/LineChart.svelte and charts/layers/Lines.svelte -- from the TASK-1632
  LayerCake library; only BarChart reached the insights pages. Lines had
  exactly one consumer (LineChart), so it falls with it. AxisX/AxisY stay:
  shared with BarChart.
- charts/Sparkline.svelte (TASK-1638) -- its only repo-wide reference was a
  prose comment recording that PLAN-1542 chose not to show it. Zero mounts.
- editor/MermaidRenderer.svelte -- superseded by the MermaidCodeBlock NodeView
  in Editor.svelte, which owns the render queue, toggle and error state.
- versions/VersionHistory.svelte -- the BUG-2608 find. The live path is
  ItemTimeline to TimelineVersionCard to DiffView; DiffView stays.
- attachments/fixtures/LightboxStub.svelte and fixtures/lightboxStub.ts -- a
  pair that referenced only each other. Their last consumer was removed by the
  TASK-2489 atomic cutover, so they were orphaned rather than born dead.

Nothing was reclassified live-but-obscure, so no import-site comments were
owed. Two docs updated so no artifact points at a deleted file: the web README
component tree drops the activity/ line, and the UserOverviewTab comment now
says the Sparkline component was deleted here and is recoverable from history,
rather than leaving a dangling decision record.

Git history is the archive; anything worth resurrecting is one revert away.

Claude-Session: https://claude.ai/code/session_017jD6t1zjxGSq47SQpZfp1V
@xarmian
xarmian merged commit d24df55 into main Aug 19, 2026
7 checks passed
@xarmian
xarmian deleted the refactor/2632-dead-component-sweep branch August 19, 2026 15:39
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