note the WorkspaceView tests and the TrafficLights defect in §9

This commit is contained in:
2026-08-07 14:38:19 +00:00
parent bfa99671ca
commit 7addb8f1e3
+25
View File
@@ -1010,6 +1010,31 @@ they are marked below, because a dead-code list that is itself wrong is the wors
now registered in `test-setup.ts`, where preload's lack of a file scope makes it global. Adding
one test file broke fourteen assertions in `DataTable.test.tsx` before both were understood.
- [x] **`WorkspaceView`, and the second consecutive bug a test found that review had not.** _(`bfa9967`,
branch `agent-coordination-mvp`)_ — 11 tests over the last untested mutator, driving the real
`WorkspaceView` through the real `WorkspaceRenderer` and `PanelSlot`, so the buttons under test
are the buttons. Two properties: every layout write is an *updater* rather than a computed tree
(two of the paths are deferred — the 500 ms resize debounce, and a window resize firing `onLayout`
on every group at once — so a computed tree silently undoes the write before it and resurrects an
older `config`); and `usePanelClose` fires on close *intent* only, never on the unmounts a drag,
a swap or a mobile switch cause.
Four of the eleven failed on the first run, all on one defect. `TrafficLights` took `onRemove`
**and** `isLastPanel` and used `isLastPanel` only to pick the tooltip: the red button read "Close
panel" and called `onClearApp` regardless, so closing a panel from its own chrome was impossible —
the panel stayed, emptied, and the context menu was the only path that worked. Introduced by
`25f5f74`. Cosmetic before identity lived in the layout; not now, because clearing the app drops
the `config` that named the panel's agent while the panel survives to be renamed by whatever is
put in it next. The pin is "a panel that is NOT the last is removed".
One hardening came out of the same pass, and it stands on its own merits: the ephemeral pane's
sizing effect now try/catches. `react-resizable-panels` **asserts** rather than no-ops when asked
to size a group it has not laid out yet, and an assert thrown from an effect aborts the commit —
trading a file preview's geometry for the whole dashboard. Also worth recording as method: the
assert fires in happy-dom (no layout, so the group's size array never populates) and **not** in a
real browser — measured, six panels on `/dashboards`, empty console — and a `ResizeObserver` +
`getBoundingClientRect` stub written to "fix the environment" turned out to fix nothing. The
try/catch was the whole difference, and the stub was deleted rather than left behind as a comment
claiming credit for it.
- [x] **A panel is told where it is, instead of being handed a key to reverse-engineer.** _(`dbe585f` +
`717580f` + `585f234`, branch `agent-coordination-mvp`)_ — the first three items of §5.9. The
context field `dashboardId: string` — which was never an id, always the whole `workspace.key` —