fix: make manual friend creation durable - #34
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82dbdcdbe9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| try await accountService.syncFriends( | ||
| accountEmail: session.account.email.lowercased(), | ||
| friends: friends + [newFriend] | ||
| ) |
There was a problem hiding this comment.
Fence the friend sync to the initiating account
When a user signs out or switches accounts while this await is running, ConvexAccountService.syncFriends sends one authenticated friends:upsert mutation per element in this full snapshot. This task is not tracked by friendSyncTask, and the account/data-epoch check happens only after every mutation completes; because the backend derives ownership from the current authentication rather than accountEmail, later mutations can write the previous user's friends into the newly authenticated account. Use an account-fenced single-friend upsert or revalidate/cancel between mutations instead of sending the whole snapshot.
AGENTS.md reference: AGENTS.md:L802-L805
Useful? React with 👍 / 👎.
Summary
Verification
bun run ci: 573 backend tests passed; web build/checks passed