Repository navigation
fix(id): scope received presence to group membership - #4541
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 5 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cddfaeb186
ℹ️ 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".
| return false; | ||
| } | ||
| }; | ||
| let projection = match log.projection() { |
There was a problem hiding this comment.
Cache the group projection outside the gossip receive hot path
With a large group history or frequent presence traffic, every authenticated heartbeat now synchronously reads and parses the entire groups log and rebuilds its projection. GroupLog::projection folds all recorded events, and this runs directly in the same run_gossip_loop receive task that processes peer-discovery announcements, delaying those announcements and potentially causing receiver lag. Even empty-channel heartbeats and expired signed replays incur this work because freshness is checked only later in PresenceTable::update_at. Cache the projection with invalidation when the log changes, and perform cheap heartbeat rejection before loading membership state.
Useful? React with 👍 / 👎.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
The serve receipt path now applies the membership filter before storing presence. A channel with no receiver-side group fold is not trusted.
Evidence
PresenceTable::update.cargo test --manifest-path pkgs/id/Cargo.toml --lib received_presence_keeps_only_channels_the_sender_belongs_to— 1 passed.cargo test --manifest-path pkgs/id/Cargo.toml --lib chat_presence— 10 passed.cargo test --manifest-path pkgs/id/Cargo.toml --lib commands::serve— 29 passed.git diff --check origin/main...HEAD— passed.cargo fmt --checkis blocked by existing formatting drift across unrelated files (including unrelatedserve.rssections); no unrelated formatting was applied.Merge Danger
Door: Two-way — reverting restores the old receipt behavior.
Blast Radius: Medium — presence heartbeats for channels absent from or unreadable in the receiver's groups log are now dropped; signature verification is unchanged.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.