Repository navigation
Conversation
The palette marks the tab it is drawing after every render, so `seen.mark`
has to settle. Past the record's 300-id cap it did not: the write kept the
newest 300 while the caller handed over the whole tab, so the ids the write
dropped read back as new on the next call. `set({})` then re-rendered the
palette inside `flushSync`, which marked again, forever -- a session with
about 900 changed files froze the web UI the moment the diff tab was clicked.
Count and mark now share one tracked slice -- `seen.tracked`, the first cap
of the tab's list -- so a badge only reports ids the record can retire.
`mark` keeps the caller's order, so marking that slice writes it back
unchanged and a second call answers false; a single item read from outside
the slice is left alone instead of evicting one inside it. The record also
keeps the marked value in memory until the next reload, so a storage write
refused in private mode cannot make the next read report the same ids again.
gloryfromca
left a comment
There was a problem hiding this comment.
No blockers; suggestions only, and they are marked inline.
The cap fix now settles repeated marks, keeps badge counting bounded to what can be retired, and preserves progress when session storage rejects a write. I found one narrow over-cap follow-up in the deliverables ordering and marked it inline; it does not outweigh the freeze this change removes.
Covered: AGENTS.md/CLAUDE.md and Web UI context rules; the full diff; palette, desk, workspace, deliveries, tasks, persistence, and session callers; relevant history and blame; backward compatibility and storage-failure behavior; test changes for weakening; and the Web UI store/domain architecture.
Verification: npm test passed 168 files / 2,848 tests; the focused desk run passed 87 tests; npm run type-check passed. The full run emitted happy-dom abort/network teardown diagnostics but exited 0 with no failed tests.
Windows compatibility review —
|
Summary
Clicking the diff tab of the desk palette froze the web UI in a session with a large diff. The cause is a mark that never settled:
DeskPalettecallsdesk.seeTab(state.tab)from an effect with no dependency list, so it runs after every render, andseeTabpublishes a store write wheneverseen.markreports news.markstores at mostCAP(300) ids per tab, butunseenandseeTabcompared it against the whole tab. Past 300 ids the write dropped ids that were still in the list, so the next call read them as new again:markreturned true forever,set({})re-rendered the palette insideflushSync, and the effect marked again. A session with 25 delegated tasks and 907 changed-file rows reproduced it as soon as the diff tab was clicked.The fix gives the count and the mark one bounded source of truth.
seen.tracked(ids)is the firstCAPids of a tab's list, the end its newest items sit on;unseencounts only that slice andseeTabmarks only that slice, so a badge never reports ids the record cannot retire.marknow keeps the caller's order instead of appending, so marking the slice writes exactly that slice back and a second call of the same list changes nothing. A single item opened from outside the slice is left alone rather than evicting one inside it.markalso keeps the marked value in memory until the next reload. A storage write refused in private mode, or by quota, previously read back the old record, which made every mark report news again even for a one-item tab; the in-memory copy keeps the answer independent of a successful write. Storage remains the across-reload record.Type
Verification
Relevant tests pass locally
Relevant lint / type checks pass locally
User-facing docs or screenshots are updated when needed (not needed: the freeze is gone and no other visible behavior is intended)
vitest run src/features/desk->9 files, 287 passed(+5 in the newseen.test.ts, +2 instore.test.ts)vitest run(fullui-web) at the fix head ->314 files, 5460 passedvitest run(fullui-web) atorigin/main(a6399354) on the same machine ->313 files, 5453 passed; the delta is exactly the 7 new teststsc --noEmit -p tsconfig.json-> exit 0;--listFilesnames the changed files inside this worktreeeslint src/features/desk/seen.ts src/features/desk/store.ts src/features/desk/seen.test.ts src/features/desk/store.test.ts-> exit 0scripts/check_commit_messages.py origin/main..HEAD-> exit 0; the commit message is pure ASCIIscripts/check_source_language.py origin/main..HEAD-> exit 0Mutation checks, each reverted separately: the old append rule -> the two cap tests fail; counting and marking the whole tab -> the settle test and the past-slice test fail; the past-slice guard in
readItem-> its test fails; the in-memory copy -> the storage-refusal test failsServed page rebuilt from this branch (
python ui-web/build.py) and driven in headless Chromium against a session with 907 changed-file rows: after opening the session and the desk, clicking Deliverables then Diff left the diff tab current with 907 rows, a 25 ms main-thread interval kept ticking (27 -> 88 ticks across the sequence), and the console stayed cleanControl on the same page and session with the pre-fix build: clicking Diff never returned, and the run ended at the 6 s click timeout -- the freeze the report described
One full-suite run on this machine produced collection failures in six unrelated files under load; those files pass serially (
244 passed) and the next full run at the same head is green, which matches this box's known ui-web load sensitivity. Theorigin/maincontrol and the final head run were clean.Risk
CAPitems now reports at mostCAPunseen ids, and ids beyond that slice are not counted; this is the stated limit of the bounded record. An item opened from outside the slice is not recorded as read; it is not counted either, so the badge is unchanged.Related Issues
None.