Repository navigation
fix(notifications): read the rows plainly on each arrival so a ring fill stays linear - #32154
Conversation
7ccd14e to
48c337d
Compare
|
[operator: bolichen97] Rebased: main moved in the line-budget and platform collect-ignore tests (fixed on main by #32252 and #32209) since this head went red (18d7308 -> f58c3cf); CI re-running. The patch is unchanged; the changed vitest file and tsc pass locally, and local GPT and Opus reviews of ab22aff passed. AI-assisted, posted on behalf of bolichen97 |
48c337d to
ab22aff
Compare
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The change reuses the [DESIGN-REVIEWED] ab22aff Description read[DESCRIPTION-READ] 74f79b92c03e91bcec011b8ee28f0ddc6ca0f52a79734316eb0f2b398a0cbfd1 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The diff only changes how the notifications reducer reads its rows and adds a unit test. It adds or changes no label, control, state or layout, so the missing blind read leaves no gap. [UX-REVIEWED] ab22aff Description read[DESCRIPTION-READ] ff7f1eee01301597241bc19e46d6e25191ec8d99d06ff51c859f762c6a1e1b2b That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (2 items) — 2 justifiedIntent: stop the notifications interleavings test from timing out on busy CI runners by making a burst of arriving notifications cheap to process (#31888). FIX.
[FIRST-PRINCIPLES-REVIEWED] ab22aff Description read[DESCRIPTION-READ] 539d8632ee7571a8071c41212dbd2e704c1926968de4a1a8a19da670dc323dae That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: addNotification reads the original rows instead of the draft proxy, so filling the notification ring stays linear; same result, with a test.
…ill stays linear (#32154) Co-authored-by: w <w@k.local> (cherry picked from commit 977e620) Backport note: addNotification on release has no keyed-note replacement (feat #23267 is not on release), so only the plain read of the rows through original() is taken; the keyed loop and filter are left out.
Problem / Motivation
Goal: Stop the notifications interleavings test from timing out on a busy CI runner by making a burst of arriving notifications cheap.
src/test/notificationsSlice.test.ts> "holds across 500 seeded interleavings of presses, end frames, snapshots, clears, ring fills and settles" timed out at its 15000 ms limit on Linux Frontend Tests shards on unrelated pull requests.Why it matters
The red lands on whatever pull request shares the shard, so authors rerun CI for a change that never touched notifications, and the same flake keeps recurring.
Not a goal
What changed (motivation → approach → change)
Each ring-fill step in the test sends 200 notifications, one
addNotificationat a time. That reducer read the rows through the Immer draft on every pass per arrival (the duplicate check, the keyed-note replacement, the cap filter and the stamp prunes), and each pass makes a proxy for every row, so one burst cost the cap squared in proxies. On an idle machine the test took about 5.1 s; pinned to one core with three other copies it took about 22 s and timed out.addNotificationinwebsite/src/store/notificationsSlice.tsnow reads the rows from the draft's base (original), the same wayreplaceRowsalready does, and writes the capped list back once. The rows are never touched through the draft, so a burst is linear. The result is the same list: an arrival with a knowntsis still ignored, a keyed note still replaces the earlier note with its source and key (with the same withdrawn marks and stamps), and a row with a decision in flight still survives the cap.Backwards compatibility
Compatible: the reducer returns the same items, order and stamps for every action; only how it reads the rows changed.
Removes nothing: no action, field or behavior is taken away.
Tests
website/src/test/notificationsSlice.test.ts"a repeated arrival is ignored, also in a full ring": a repeatedtsleaves the state unchanged, before and after the ring is full, and the oldest row stays first.taskset -c 0): on the parent (main) all four copies time out at 15 s (21.9-22.3 s); with the fix all four pass in 7.0-7.4 s.--maxWorkers=2 --sequence.shuffle, seeds 1-50. The interleavings test takes about 1.55 s with the fix and 5.1 s on the parent on an idle machine.Proof: not provable -- frontend test (prove.py runs Python only)
Manual verification
N/A — unit coverage drives the real reducer; the change has no UI.
Related Issues
Fixes #31888
Sibling sweep
Swept: git grep -nE "state.items.(some|find|filter|map)(" -- website/src/store/notificationsSlice.ts
Sibling: website/src/store/notificationsSlice.ts -- not affected -- the other reducers handle one row per action from a user or socket event, never a burst of arrivals
Pattern harvest
Not generalizable: the cost came from one reducer called hundreds of times in a row; other reducers act once per user or socket event.
Checklist