feat(acp-nats): add GLOBAL JetStream stream for global agent subjects#70
Conversation
PR SummaryMedium Risk Overview
Written by Cursor Bugbot for commit 3ded4c8. This will update automatically on new commits. Configure here. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughA new JetStream GLOBAL stream configuration and helpers were added; Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Code Coverage SummaryDetailsDiff against mainResults for commit: 3ded4c8 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
rsworkspace/crates/acp-nats/src/jetstream/streams.rs (1)
270-282: Consider enhancing overlap detection to handle wildcard semantics.The current test only checks for exact string duplicates. While the existing streams are designed with non-overlapping namespaces (session-scoped vs. global agent subjects), this wouldn't catch semantic overlaps if wildcards were introduced that could match the same concrete subjects.
For example, if a future change added
{prefix}.agent.>to one stream, it could overlap with{prefix}.agent.ext.>in GLOBAL. The current test would pass but JetStream would route messages to both streams.This is low priority since the current subject design is safe, but a more robust check could prevent accidental overlaps in future changes.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@rsworkspace/crates/acp-nats/src/jetstream/streams.rs` around lines 270 - 282, The test no_subject_overlaps_between_streams currently only checks exact string equality for subjects; update it to detect semantic overlaps under NATS wildcard rules by adding a helper (e.g., subject_matches(pattern: &str, concrete: &str) and patterns_overlap(a: &str, b: &str)) and use these in the test that iterates all_subjects to assert that no pair of patterns can match the same concrete subject (check both subject_matches(a,b) || subject_matches(b,a) or a dedicated patterns_overlap(a,b)). Locate the test and the all_subjects collection and replace the assert_ne! check with calls to the new helper(s) or use an existing nats wildmatch utility to ensure wildcard patterns like "foo.>" and "foo.bar.>" are detected as overlapping.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@rsworkspace/crates/acp-nats/src/jetstream/streams.rs`:
- Around line 270-282: The test no_subject_overlaps_between_streams currently
only checks exact string equality for subjects; update it to detect semantic
overlaps under NATS wildcard rules by adding a helper (e.g.,
subject_matches(pattern: &str, concrete: &str) and patterns_overlap(a: &str, b:
&str)) and use these in the test that iterates all_subjects to assert that no
pair of patterns can match the same concrete subject (check both
subject_matches(a,b) || subject_matches(b,a) or a dedicated
patterns_overlap(a,b)). Locate the test and the all_subjects collection and
replace the assert_ne! check with calls to the new helper(s) or use an existing
nats wildmatch utility to ensure wildcard patterns like "foo.>" and "foo.bar.>"
are detected as overlapping.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a4114f6f-e5e2-4ea9-a0d8-1c35f161d7c9
📒 Files selected for processing (2)
rsworkspace/crates/acp-nats/src/jetstream/provision.rsrsworkspace/crates/acp-nats/src/jetstream/streams.rs
Captures initialize, authenticate, session.new, and ext.> into JetStream for audit durability. session.list stays on Core NATS as a pure read with no replay value. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
c689960 to
3ded4c8
Compare
Summary
GLOBAL) capturing global agent subjects:initialize,authenticate,session.new, andext.>for audit durabilitysession.listremains on Core NATS only — pure read query with no replay valueagent.>) to excludesession.list, since JetStream does not support subject exclusions