From d24df5567060efea62cfef40cb5c2d84f34dfd54 Mon Sep 17 00:00:00 2001 From: xarmian Date: Wed, 19 Aug 2026 11:39:39 -0400 Subject: [PATCH] refactor(web): delete unmounted components carrying real logic (TASK-2632) (#1163) 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 - import type { Activity } from '$lib/types'; - import { relativeTime } from '$lib/utils/markdown'; - - let { activities }: { activities: Activity[] } = $props(); - - function actionLabel(action: string): string { - const labels: Record = { - created: 'created', updated: 'updated', archived: 'archived', - restored: 'restored', read: 'read', searched: 'searched', - }; - return labels[action] ?? action; - } - - function actorIcon(actor: string): string { - return actor === 'agent' ? '๐Ÿค–' : '๐Ÿ‘ค'; - } - - function actorLabel(a: Activity): string { - if (a.actor === 'agent') return 'Agent'; - if (a.actor_name) return a.actor_name; - return 'You'; - } - - function sourceLabel(source: string): string { - const labels: Record = { - cli: 'CLI', web: 'Web', skill: 'Skill', - }; - return labels[source] ?? source; - } - - -
- {#each activities as a} -
- {actorIcon(a.actor)} -
- - {actorLabel(a)} {actionLabel(a.action)} - {#if a.item_id} - a document - {/if} - - - via {sourceLabel(a.source)} ยท {relativeTime(a.created_at)} - -
-
- {:else} -

No recent activity.

- {/each} -
- - diff --git a/web/src/lib/components/admin/UserOverviewTab.svelte b/web/src/lib/components/admin/UserOverviewTab.svelte index 25341c8b..99c21251 100644 --- a/web/src/lib/components/admin/UserOverviewTab.svelte +++ b/web/src/lib/components/admin/UserOverviewTab.svelte @@ -2,8 +2,10 @@ Overview tab โ€” first thing an admin sees when opening a user modal. Vitals header + 3 engagement metric tiles + recent items list. - Sparkline deliberately omitted per PLAN-1542 decisions; api_requests_7d + A sparkline was deliberately omitted per PLAN-1542 decisions; api_requests_7d metric also omitted pending IDEA-1556. PLAN-1542 / TASK-1553. + (The Sparkline component this referred to was never mounted anywhere and was + deleted in TASK-2632; recover it from git history if the decision reverses.) Consumes: GET /admin/users/{id}/metrics (T1547) diff --git a/web/src/lib/components/attachments/fixtures/LightboxStub.svelte b/web/src/lib/components/attachments/fixtures/LightboxStub.svelte deleted file mode 100644 index b89c9d2c..00000000 --- a/web/src/lib/components/attachments/fixtures/LightboxStub.svelte +++ /dev/null @@ -1,29 +0,0 @@ - - - - diff --git a/web/src/lib/components/attachments/fixtures/lightboxStub.ts b/web/src/lib/components/attachments/fixtures/lightboxStub.ts deleted file mode 100644 index 0679da49..00000000 --- a/web/src/lib/components/attachments/fixtures/lightboxStub.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { LightboxImage } from '$lib/attachments/events'; - -/** - * Recording surface for `LightboxStub.svelte` (TASK-2428). - * - * Exists so a test can hold a viewer's `onClose` AFTER that viewer has been - * destroyed โ€” the only way to drive the stale-continuation case, since a click - * on a detached button never reaches Svelte's delegated root handler and so - * proves nothing (Codex round 4 found the click-based version vacuous). - */ -export interface LightboxStubCall { - /** - * The FULL records, not `{id}` (TASK-2431): the metadata a producer threads - * onto each image โ€” `mime_type` above all โ€” is part of what it must get - * right, and a narrower type here would make that unassertable. - */ - images: LightboxImage[]; - index: number; - wsSlug: string; - /** Threaded down by the host since TASK-2429; the viewer owns the restore. */ - invoker: HTMLElement | null; - onClose: () => void; -} - -export const lightboxStubCalls: LightboxStubCall[] = []; diff --git a/web/src/lib/components/charts/LineChart.svelte b/web/src/lib/components/charts/LineChart.svelte deleted file mode 100644 index 3975eed3..00000000 --- a/web/src/lib/components/charts/LineChart.svelte +++ /dev/null @@ -1,112 +0,0 @@ - - - - - diff --git a/web/src/lib/components/charts/Sparkline.svelte b/web/src/lib/components/charts/Sparkline.svelte deleted file mode 100644 index b2d0eb49..00000000 --- a/web/src/lib/components/charts/Sparkline.svelte +++ /dev/null @@ -1,82 +0,0 @@ - - -{#if values.length > 0} - - {summary} - - -{/if} - - diff --git a/web/src/lib/components/charts/layers/Lines.svelte b/web/src/lib/components/charts/layers/Lines.svelte deleted file mode 100644 index 5815c78c..00000000 --- a/web/src/lib/components/charts/layers/Lines.svelte +++ /dev/null @@ -1,35 +0,0 @@ - - - - {#each series as s (s.key)} - - {/each} - diff --git a/web/src/lib/components/editor/MermaidRenderer.svelte b/web/src/lib/components/editor/MermaidRenderer.svelte deleted file mode 100644 index e96bafc3..00000000 --- a/web/src/lib/components/editor/MermaidRenderer.svelte +++ /dev/null @@ -1,152 +0,0 @@ - - -{#if blocks.length > 0} -
-
Diagrams
- {#each blocks as block, i (i)} -
- {#if block.error} -
Could not render diagram
- {:else} -
{@html block.svg}
- {/if} -
- {/each} -
-{/if} - - diff --git a/web/src/lib/components/versions/VersionHistory.svelte b/web/src/lib/components/versions/VersionHistory.svelte deleted file mode 100644 index e4c8d0c2..00000000 --- a/web/src/lib/components/versions/VersionHistory.svelte +++ /dev/null @@ -1,620 +0,0 @@ - - -
-
-

History

- {#if onClose} - - {/if} -
- -
- {#if loading} -
- - Loading history... -
- {:else if error} -
{error}
- {:else if timeline.length === 0} - - {:else} -
- {#each timeline as entry, i (entry.id)} - {@const isSelected = selectedEntryId === entry.id} - {@const isVersion = entry.kind === 'version'} - {@const isConfirming = confirmingRestoreId === entry.id} - {@const isRestoring = restoringId === entry.id} - -
-
-
- {#if i < timeline.length - 1} -
- {/if} -
- -
- {#if isVersion} - - - {#if isSelected} -
-
- -
- -
- {#if isConfirming} -
- Restore to this version? -
- - -
-
- {:else} - - {/if} -
-
- {/if} - {:else} - -
- -

{entry.summary}

-
- {/if} -
-
- {/each} -
- {/if} -
-
- -