fix(web): folded second mates stay folded after a trip through Settings - #167
Conversation
The fleet tree kept its folds in the Sidebar component. Settings swaps that component out, so pressing Back reopened every second mate. After a project icon edit, the firstmate second mate's settled workers filled the list and pushed sheppi out of view. The folds now live in a small store for the app session, so they survive Settings and project edits. They are still not saved across restarts.
|
Code review, two axes. Each finding has a confidence and an estimated severity. StandardsStandards review: PR 167The PR breaks no documented standard. I found six judgement calls. Four are in the test file and two are in the new store. The commit title follows the conventional format. The PR has one concern. The
|
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
Second mate folds now live in uiStateStore as fleetRepoExpandedById, next to projectExpandedById, and are saved the same way. They survive Settings, project edits and a restart, like project folds. The session store fleetFolds.ts and its test are removed. Sidebar.tsx builds the fleet rows in useFleetTreeRows. Sidebar.fleetTree.test.tsx renders that hook: a folded second mate stays folded after a remount and an icon change, and a second mate and its workers take a project's new colour at once. uiStateStore gains resetUiStateForTests.
|
This round, per review finding. Commit Standards
Spec
|
Only the store action uses it, as with setPullRequestMergeMethod, so the unused code check no longer flags it.
After a project icon edit, the firstmate second mate's branch in the fleet tree opened by itself and filled the sidebar with its workers. That pushed sheppi out of view, so it looked like sheppi had vanished.
Cause
The fleet tree kept its folds in
useStateinsideSidebar.tsx. A project icon is edited in Settings. On any/settingsroute,AppSidebarLayout.tsxswaps the thread sidebar out for the settings nav, soSidebarunmounts. Pressing Back mounts a freshSidebarwith no folds, and every second mate opens again.Evidence. I ran a production web build of
0.0.43-ap.7(the installed version) from the server, against a copy of the user's database. I folded the agos, firstmate and t3code second mates, opened sheppi's second mate, changed sheppi's icon colour in Settings, and pressed Back. The sidebar went from 13 rows to 55. sheppi's second mate went from visible at y=419 to off screen at y=2328. Every fold arrow read "Hide workers" again.Fix
Second mate folds are now a saved sidebar setting, next to project folds.
uiStateStore.tsgainsfleetRepoExpandedByIdbesideprojectExpandedById, keyed by fleet repository. A repository with no entry shows its workers. It loads and saves with the other sidebar settings, and has asetFleetRepoExpandedaction.Sidebar.tsxbuilds the fleet rows in an exporteduseFleetTreeRowshook. The hook reads the folds fromuiStateStore, so they survive Settings, any project edit, and a restart, the same as project folds.Downgrade
The saved settings gain one optional key,
fleetRepoExpandedById. An older build ignores it when it loads. It drops the key the next time it saves, so after a downgrade every second mate shows its workers again. Nothing else in the saved settings changes, and nothing is read wrongly.Colour update: did not reproduce
Expected: the second mate, its workers and every tag for the project take the new colour at once. They already do on
main. I tried:Each time, the second mate's sailboat and "Second mate" word and the worker's pickaxe and "Worker" word had the new computed colour on the next check. For example, green was
oklch(0.627 0.194 149.214)and blue wasoklch(0.546 0.245 262.881). The row's project icon changed too. No colour code is changed.Tests
Sidebar.fleetTree.test.tsxrendersuseFleetTreeRowsfromSidebar.tsx, the code the sidebar runs. It uses two second mates, firstmate with two workers and sheppi with one.Each test resets the shared store first with the new
resetUiStateForTests().uiStateStore.test.tsgains a test that a fold survives a save and reload, and that an old save with no folds loads as none.How each test fails
Folds. I put
main's fold back intoSidebar.tsx:useStateinside the hook in place of theuiStateStoreread. The fold test failed:The hook does not exist on
main, so this ismain's fold code in the same code path.Colour. I dropped
projectByKeyfrom the hook's memo dependencies, so rows keep the old project. The colour test failed:With the change as pushed, both pass.
Screenshots
They show the user's real thread titles, so they are kept locally and not attached.
ap.7: agos's workers fill the view, then firstmate's settled workers. sheppi is far below.fork-features.json
The
fm-fleet-sidebar-treeentry dropsfleetFolds.tsand its test. It listsuiStateStore.ts,uiStateStore.test.tsandSidebar.fleetTree.test.tsx. The keep line namesuseFleetTreeRowsinSidebar.tsx. InuiStateStore.tsit names thefleetRepoExpandedByIdfield with its load and save lines,setFleetRepoExpandedandresetUiStateForTests. InuiStateStore.test.tsit names thefleetRepoExpandedByIdlines and the folded second mates test. The description says the fold is saved like a project fold.Checks
cd apps/web && vp run typecheck- exit 0, no errors.vp lint --report-unused-disable-directives apps/web/src/components/Sidebar.tsx apps/web/src/components/Sidebar.fleetTree.test.tsx apps/web/src/uiStateStore.ts apps/web/src/uiStateStore.test.ts- exit 0, 26 warnings, all inSidebar.tsx.mainshows the same 26 forSidebar.tsx.vp fmt --check apps/web/src/components/Sidebar.tsx apps/web/src/components/Sidebar.fleetTree.test.tsx apps/web/src/uiStateStore.ts apps/web/src/uiStateStore.test.ts fork-features.json:cd apps/web && vp test run --passWithNoTests --project unit:node scripts/check-fork-features.ts- exit 1:All 11 failures are in
scripts/build-desktop-artifact.test.ts, which this change does not touch. The same file fails the same way onmain(c0ed528ff6) on this Windows machine:Surfaces
Web and desktop share this sidebar. The mobile sidebar has no fleet tree.