Repository navigation
fix(mobile): a thread shared while open holds a new writer's message for its author - #875
Conversation
…for its author Mobile knew a thread was shared only from its cached author record, which says shared once an author is recorded. A thread shared while open could show the first collaborator's message raw, drawn as the reader's, until the record refreshed. Mobile now reads and subscribes to who reaches the thread, as web does, and holds a message nobody is recorded for while more than one person writes. The scope-people atoms and the rule (mayBeSharedConversation) move into client-runtime, shared with web. Closes #871 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
This review includes 10 billable files and costs up to $2.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 10 minutes for your next included review. View limit details
|
Jacksondr5
left a comment
There was a problem hiding this comment.
Combined review: reviewer-opus and reviewer-sol (Claude Opus 5.5 and GPT Sol 6.1), head 0f54cdd
Both of us reviewed the PR independently. Neither found anything that blocks merge.
- The rule.
mayBeSharedConversationis web's expression line for line:record.shared,writers > 1,readsOthers, and the read that hasn't answered yet. Apeopleofnullbecomes[]inside, as web's?? []did. Its tests cover each case: initial, failed, unshared, first owner, Viewer and several writers. - The atoms.
scopePeopleandscopePeopleChangesmove intocreateSharingEnvironmentAtomswith the same labels, tags andstaleTimeMs. Web'ssharingManagenow points at the same family. - Mobile.
useThreadPeoplereads the people and refreshes when the revision moves, as web'suseScopePeopledoes. Sharing a thread moves that revision, so a thread shared while open reads as shared before the new writer's first message arrives. That closes the limitation #859 documented, and the new feed test reproduces exactly that case. - Parity note. When two Owners hold server scope,
writers > 1holds in every thread, so mobile now holds new messages until their author is read, as web already does.
53 shared and 51 mobile focused tests pass.
The panel has no open code findings. Before merge it still needs the tester's run and green J5 CI.
Computing who may be shared through the shared mayBeSharedConversation before the timeline's state hook stopped the React Compiler memoizing the entries it returns; ConversationTimeline derives state from them in render and hit React's re-render limit on every thread. The call now runs after the hook, so the entries keep their identity while nothing they read changes, and a browser test holds that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jacksondr5
left a comment
There was a problem hiding this comment.
Combined review: reviewer-opus and reviewer-sol, head 25e43af
Fixed: the web regression the tester found. In useSharedConversationEntries, the pure mayBeSharedConversation(...) call moves after the useState and setStored block, with the same inputs and the same result. The React Compiler memoizes the entries again, so ConversationTimeline no longer re-renders forever.
- Test.
sharedTimeline.browser.test.tsxchecks that the entries keep their identity across a rerender. reviewer-sol ran it against 0f54cdd'ssharedTimeline.ts, and it fails there on exactly that identity assertion. It passes on this head. It follows the repository's browser-test rules: a disposable render, a fresh element on each rerender,router: falsewith a reason, and fixtures that are never changed. Its module mocks pull in no Shiki or diff workers. - Mobile.
useSharedConversationFeedalready runs in the order this fix restores, with its people hook before the state hook and the presentation after it. Native'sThreadFeedalso doesn't derive state from the feed during render.
The panel has no open code findings. Before merge it still needs the tester's re-run and green J5 CI.
Problem
Mobile knew a thread was shared only from its cached author record, which counts a thread as shared once an author is recorded. So a thread that was shared while open on the phone could show the first collaborator's message raw: the platform's note and
[Message from …]line, drawn as the reader's own words. It stayed that way until the record refreshed (#859's documented gap). Closes #871.What changed
Mobile now reads who reaches the thread, and subscribes to changes to it, as web does. Sharing a thread moves that read's change counter, so the phone knows the thread is shared before anyone else writes. A message nobody is recorded for is then held until its author's record answers, the same "pending" path a message already takes before the first read. A thread only one person writes to is unaffected, so nothing is held back for a round trip there (Jackson's Checkpoint 1 decision).
Shared code, so web and mobile follow one rule:
scopePeopleandscopePeopleChangesmove from web'ssharingManageinto client-runtime'screateSharingEnvironmentAtoms.useSharedConversationEntriesintomayBeSharedConversationin client-runtimej5/sharedConversation.ts. A thread may be shared when:Web's behaviour is unchanged, and its sharing tests pass.
UI changes
Android 16 emulator, 1080×2400 in the light theme: the same person (Taylor Base), first message, thread title and viewport on both sides. Each side needs its own thread that starts private, so the history above the shared message differs. Before is base
c2b7939de8, after is25e43af51a.The first message from a newly added collaborator, with the thread open on the phone.
<j5_shared_conversation>note.Before, the raw message showing until it corrects itself (about 16 seconds in):
android-first-share-before.mp4
After, the message arrives clean (reviewed frame by frame at 0.5s):
android-first-share-after.mp4
Web, the same shared thread: it renders on base, and on the fixed head.
A follow-up message in the already-shared thread, after: still drawn as in #859.
Live testing
The crew's tester ran Android 16 and web on an isolated test server, with real Claude Haiku turns, the Test owner and a collaborator, Taylor Base: pass at
25e43af51a.Regression found and fixed during testing. At
0f54cdd941every web thread hit "Too many re-renders"; base didn't. The new shared call ran before the timeline hook's state, and that stopped the React Compiler memoizing the entries the hook returns.ConversationTimelinederives state from those entries during render, so it looped.25e43af51amoves the call after the hook. A browser test (sharedTimeline.browser.test.tsx), which fails on0f54cdd941, holds the entries stable. The tester confirmed the web tabs that had looped now render, for the owner and for the collaborator.Not exercised: iOS (deferred to the checkpoint), and slow links beyond the emulator's.
Upstream impact
None new. The upstream files involved are unchanged; FORK.md case 99's text now names the people read.
Checklist
sharedConversationFeed.test.ts(a thread shared after its record was read), client-runtimesharedConversation.test.ts(mayBeSharedConversation), and websharedTimeline.browser.test.tsx(stable entries)Claude Opus 5.5 in J5 Code (Claude Code harness).
🤖 Generated with Claude Code