sweep the dead code in section 8

Each item re-verified before deleting; three of the ten entries were stale
and are corrected in place rather than silently fixed.

- WorkspaceLayout's isMobile/mobilePanelId/onMobileBack: none of its ten
  callers set them, so the mobile collapse they fed was permanently off in
  that renderer. WorkspaceView passes the same props to WorkspaceRenderer
  itself, where they are live.
- fixedHeight on AppRegistryEntry, and getFixedHeight with it: no app has
  ever declared one, so it only contributed undefined. The flex-column
  branch it shared with fitContent stays, keyed on fitContent alone.
- getDefaults: getAllDashboardState already folds the defaults row into the
  one payload the client fetches, which is why it never got a caller.
- upsertScreen's terminals/hostTerminals: never read is right, never
  written was not — it inserted them, which is why all 15 rows hold {}.
  The columns are left in place; dropping them needs a db:push, and this
  tree holds another agent's uncommitted schema file.
- SELECTED_DASHBOARD_KEY: H2 (01365cb) replaced it with ?selected= four
  months ago and it has had no reader since.
- ui/sidebar.tsx and the stray ui/hooks/ beside it. use-mobile was not
  orphaned as claimed — the sidebar imported it — and the use-toast in
  there was a near-identical copy of the live one.
- findChildById's unreachable duplicate condition, and the doc comment that
  described the wrong behaviour rather than the code being wrong.

Left deliberately: DragOverlay/LayoutEditor (gated on 5.3, an owner
decision) and the two chat-owned channels, whose docs are fixed here even
though the publishers are not mine to delete.
This commit is contained in:
2026-08-07 11:26:33 +00:00
parent f2ae10bd36
commit b419af32de
14 changed files with 88 additions and 907 deletions
+9 -4
View File
@@ -123,10 +123,15 @@ This is the primary surface to convert to URL-driven selection.
| settings `useGlobal(*_SELECTED)` | settings section | `/settings/:page/:section` | `SettingsPanel.tsx:56` (M6) |
| local `useState` selections | search / room / conversation / peer / open file / preview slug | respective nested routes | `SearchView`, `SoulseekRooms`, `SoulseekChat`, `SoulseekUsers`, `CodeEditor/useEditorState`, `PreviewProvider` |
**Excluded — event-bus / refresh signals, NOT selection:** `preview:refresh`, `files:refresh-signal`,
`SLSKD_REFRESH_CHANNEL`, `MUSIC_RESYNC_CHANNEL`, `chat:active-session` (embedded-chat signal).
**Excluded — event-bus / refresh signals, NOT selection:** `files:refresh-signal`,
`SLSKD_REFRESH_CHANNEL`, `MUSIC_RESYNC_CHANNEL`.
(`FILE_VIEWER_CHANNEL` was listed here too; it had no publisher and has been deleted — the file viewer
reads `?view=` from the URL.)
reads `?view=` from the URL. `preview:refresh` and `chat:active-session` were also listed, and
`preview:refresh` was cited above as the exemplar of a *legitimate* channel — but both have a publisher
in `ChatPanelWrapper` and **no subscriber at all**, and `preview:refresh`'s reader, `PreviewProvider`, is
no longer in the repo. They are declared in `officerdev/src/channels.ts` with that stated; deleting the
publishers means changing the chat panel, which is another agent's, so it is written up in
`COMMS/chat-agent-handoff-2026-08-07.md` instead. Use `files:refresh-signal` as the exemplar.)
---
@@ -177,7 +182,7 @@ reads `?view=` from the URL.)
### Phase 1 — Quick wins (routes already exist; mechanical, high value)
- [x] **H1** Jobs rows → `<Link to={`/jobs/${job.id}`}>` (`JobsPage.tsx`). Done — `46482f3`. (active-row highlight already keyed off `useParams().id`.)
- [x] **H2** Dashboards rows → `<Link>`; `SELECTED_DASHBOARD_KEY` global replaced by `?selected=` URL param across `DashboardListApp`/`DashboardsScreen`/`DashboardPreview`. Done — `01365cb`. **Needs runtime test.**
- [x] **H2** Dashboards rows → `<Link>`; `SELECTED_DASHBOARD_KEY` global replaced by `?selected=` URL param across `DashboardListApp`/`DashboardsScreen`/`DashboardPreview`. Done — `01365cb`. **Needs runtime test.** (The constant itself outlived its last reader by four months and has now been deleted; its siblings in `Dashboards/constants.ts` are dialog form state, not selection, and stay.)
- [x] **H3** Projects rows → `<Link>`; `SELECTED_PROJECT` global replaced by `?selected=` URL param across `ProjectListApp`/`ProjectListScreen`/`ProjectPreview`. Done — `2aaacc8`. **Needs runtime test.**
- [ ] **H4** Chat detail: read `sessionId` from `useParams`, retire `chat:selected-session` as source of truth (`ChatDetailPanel.tsx:136`) — **finishes the /chat fix**. *Deferred: overlaps the in-flight `sidecars-*` chat-comms work; do after that lands.*
- [ ] **H5** Email rows → `<Link>` driven by `useParams().emailId`; delete the state↔URL sync effects (`EmailList.tsx:336`, `EmailScreen.tsx:27-33`).
+44 -13
View File
@@ -836,23 +836,54 @@ _(move items here with the commit and a one-line resolution)_
Low priority, but each line here is a line someone will read and believe.
Swept 2026-08-07 (`__SWEEP__`). Every claim was re-checked against the code first; three were stale, and
they are marked below, because a dead-code list that is itself wrong is the worst kind.
- [ ] `DragOverlay.tsx` (99) + `LayoutEditor.tsx` (51) — imported by nothing. Gated on 5.3.
- [ ] `WorkspaceLayout`'s `isMobile`/`mobilePanelId`/`onMobileBack` props — no caller passes them.
- [ ] `fixedHeight` on `AppRegistryEntry` — declared, read at `WorkspaceRenderer.tsx:76`, set by **zero**
metas.
- [ ] `registerApp` (`useAppRegistry`) — zero callers.
- [ ] `getDefaults` (`queries/dashboards.ts:136`) — zero callers.
- [ ] `screens.terminals` / `screens.hostTerminals` columns — never written, never read.
- [ ] `SELECTED_DASHBOARD` constant — zero consumers.
**Deliberately left**: 5.3 is an owner decision ("decide, then act"), and deleting these makes it
for him.
- [x] `WorkspaceLayout`'s `isMobile`/`mobilePanelId`/`onMobileBack` props — no caller passes them.
Confirmed across all ten call sites; removed. `WorkspaceView` still passes the same props to
`WorkspaceRenderer`, where they are live — it was only the `WorkspaceLayout` pass-through that was
dead.
- [x] `fixedHeight` on `AppRegistryEntry` — declared, read at `WorkspaceRenderer.tsx:76`, set by **zero**
metas. Removed, along with `getFixedHeight` and the pixel-height branch it fed; the flex-column
layout it shared with `fitContent` stays, now keyed on `fitContent` alone.
- [x] `registerApp` (`useAppRegistry`) — zero callers. Already deleted in `9fcc9c2` (§5.6), with
`registerWidget`.
- [x] `getDefaults` (~~`queries/dashboards.ts:136`~~ `:195` — **line was stale**) — zero callers.
Removed. `getAllDashboardState` already folds the defaults row into the one state payload, which
is why the single-row getter never acquired one.
- [x] `screens.terminals` / `screens.hostTerminals` columns — never read (confirmed), **but "never
written" was stale**: `upsertScreen` accepted and inserted them, so all 15 rows hold the `{}` it
wrote. The dead parameters and inserts are gone. **The columns themselves are not dropped** — that
needs `bun db:push`, which diffs the *whole* schema, and this tree currently holds another agent's
uncommitted `schema/agent-panels.ts`. Drop them in a push of their own.
- [x] ~~`SELECTED_DASHBOARD`~~ **`SELECTED_DASHBOARD_KEY`** constant — zero consumers. The parenthetical
claiming `SELECTED_DASHBOARD_KEY` was the live one was **backwards**: `'SELECTED_DASHBOARD'` is the
string value, `SELECTED_DASHBOARD_KEY` the constant, and H2 (`01365cb`) took its last reader four
months ago. Deleted, with its two barrel re-exports. Its file-mates survive — they are dialog form
state, not selection.
- [ ] `preview:refresh` and `chat:active-session` channels — written by `ChatPanelWrapper.tsx:58-59`,
**read by nobody**. Note `preview:refresh` is the exemplar `docs/navigation-audit.md:126` cites as
the canonical _good_ channel; fix the doc too.
- [ ] `components/ui/hooks/use-mobile.tsx` + `ui/sidebar.tsx` (~720 lines) — a second `useIsMobile`
implementation, and a sidebar imported by nothing.
- [ ] `WorkspaceRenderer.tsx:84` — unreachable duplicate condition inside `findChildById`. While there:
**read by nobody**. **Deliberately left**: deleting the publishers changes the chat panel, which is
another agent's. Declared with the fact stated in `officerdev/src/channels.ts` and written up in
`COMMS/chat-agent-handoff-2026-08-07.md` §6. The doc half **is** done —
`docs/navigation-audit.md:126` and `CLAUDE.md` no longer offer `preview:refresh` as the exemplar
channel; `files:refresh-signal` is.
- [x] `components/ui/hooks/use-mobile.tsx` + `ui/sidebar.tsx` (~720 lines) — a second `useIsMobile`
implementation, and a sidebar imported by nothing. Both deleted. **Nuance the entry missed**:
`use-mobile.tsx` was not orphaned, it was imported by `sidebar.tsx` — dead only once the sidebar
went. The whole `ui/hooks/` directory turned out to be a stray shadcn copy, its `use-toast.ts` a
near-identical duplicate of the live `ui/use-toast.ts`, referenced by nothing; it went too.
_Noticed, not fixed:_ `ui/toaster.tsx` + `ui/use-toast.ts` are their own dead chain (the app uses
`sonner`), and `globals.css` carries eight `--sidebar-*` tokens now used by nothing.
- [x] `WorkspaceRenderer.tsx:84` — unreachable duplicate condition inside `findChildById`. While there:
the doc comment says "find a panel node by id anywhere in the tree", but it returns _the direct
child whose subtree contains the id_, which is what the mobile collapse needs. **The behaviour is
right and the description is wrong** — fix the comment, not the code.
right and the description is wrong** — fix the comment, not the code. Done exactly that. (Worth
recording: a reviewer sent at this function without the entry in hand reported the `return child`
as the bug and the dead line as incidental. The entry is right and it is the reason the code
survived review.)
---