Skip to content

fix(unread): preserve catch-up evidence across pending saves - #2852

Open
kalvinnchau wants to merge 1 commit into
mainfrom
fix/unread-catchup-arrivals
Open

kalvinnchau wants to merge 1 commit into
mainfrom
fix/unread-catchup-arrivals

Conversation

@kalvinnchau

@kalvinnchau kalvinnchau commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Bottom catch-up can mark a newly arrived mention read without its own viewing dwell. It captures the channel's mutable evidence array, awaits its frontier write, then scans that same array for mentions/broadcasts. A live arrival with an older timestamp can be appended during the await and included in the older operation.

Snapshot the evidence array before the write. Existing permission, lease, message identity and manual-unread guards remain intact. No relay reads or notification-policy changes are added.

Validation:

  • The new real-session regression holds the frontier storage write, delivers a late mention, releases the write, and checks that the mention remains unread. It failed on the original code at the final unread assertion and passes with the fix.
  • All 163 unread owner tests and 34 reading tests passed. Independent review found no blockers and separately passed all five bottom catch-up tests.
  • The original notifications journey passed in Chromium and WebKit on this tree (2 cases, 16.6 seconds). No browser cases were added or removed. Ten unchanged local WebKit runs passed before this repair, so browser reruns alone do not establish the race is fixed.
  • Biome and diff checks passed. Production diff: one changed line; test diff: 24 added lines. No full local suite; hooks bypassed with the author's requested --no-verify workflow.

This is separate from #2843 as requested. The storage ordering reproduces the early-read symptom seen in the notification CI failure; attributing that exact trace to this race remains an inference. Hosted CI and human acceptance remain pending; no native/live-account validation is claimed.

Rebased onto main at ed5b3ac99 after #2843 merged. All five bottom catch-up tests passed again on rebased head 728e63bf3. Hosted CI must validate this updated head.

@kalvinnchau
kalvinnchau marked this pull request as ready for review November 6, 2026 17:50
@kalvinnchau
kalvinnchau requested a review from a team as a code owner November 6, 2026 17:50
snapshot channel evidence before awaiting the frontier write so late mentions retain their own reading dwell.

Co-authored-by: OpenAI Codex <[email protected]>
Signed-off-by: Kalvin Chau <[email protected]>
@kalvinnchau
kalvinnchau force-pushed the fix/unread-catchup-arrivals branch from 3255afb to 728e63b Compare November 6, 2026 17:52
@tellaho

tellaho commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Drip design review: no must-fix items. Mentions arriving during a pending catch-up save stay unread for a later viewing observation; this is a contained launch bug fix.

Source reviewed at 728e63bf36d14be7141aaf3e41799b46f2e38e1d: src/features/relay/unread.ts:2347 and the storage-gated regression at src/features/relay/unread.test.ts:2258, against the reading contract in docs/unread.md. Existing reading guards remain intact.

No screenshots supplied. Tests, live/native behavior, themes, window widths, enlarged text and keyboard/focus interactions were not exercised.

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Star Lord’s automated source review via Wes’s account.

No actionable findings at head 728e63bf36d14be7141aaf3e41799b46f2e38e1d, against base ed5b3ac997c34cc4ce8846d63ba0754864d7828e.

The array snapshot fixes the demonstrated race: a mention or broadcast delivered while the frontier save is pending cannot join that earlier catch-up’s per-message marks. Existing lease, access, message-identity and manual-unread guards remain in place. The regression controls the storage boundary and checks the late mention after catch-up completes.

Source-only team review covering evidence lifetime, async ordering, reading callers and regression structure. No tests, builds or app execution performed; author-reported validation and the suspected connection to the notification CI failure were not independently reproduced. This is a COMMENT review, not approval or runtime acceptance.

@tellaho

tellaho commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

🤖 Design follow-up: no design review needed.

This supersedes the design classification in my earlier review. Any engineering findings there remain with code review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants