refactor(acp-nats): typed subjects enforce correct transport at compile time#76
refactor(acp-nats): typed subjects enforce correct transport at compile time#76
Conversation
PR SummaryMedium Risk Overview Updates agent/client proxy code (including the Hardens prompt-response waiter handling by propagating mutex-poisoning as a Written by Cursor Bugbot for commit b493fb1. This will update automatically on new commits. Configure here. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (70)
WalkthroughThis PR refactors NATS subject construction from string-based helpers to typed Subject structs implementing marker traits. It introduces a new structured subject module hierarchy, adds Changes
Sequence Diagram(s)The changes primarily involve refactoring existing APIs and data flow patterns without introducing new multi-component interaction sequences. Subject construction, handler invocation, and NATS messaging patterns remain functionally equivalent, so a sequence diagram would not provide additional clarity beyond the existing code logic. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ 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: b493fb1 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
4f5a90e to
c0eeef1
Compare
4bc1d90 to
12a58bb
Compare
f446336 to
dfdba45
Compare
c98326c to
156ea8b
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
9b35a1e to
2225087
Compare
Each NATS subject is its own struct with typed parameters (AcpPrefix, AcpSessionId). Marker traits (Requestable, Publishable, SessionCommand, Subscribable, ClientRequestable) enforce correct transport at compile time — passing a CancelSubject to request_with_timeout is a compile error, not a runtime bug. Also removes all production .unwrap() calls: - publish_session_ready: gracefully handles invalid session IDs - PendingSessionPromptResponseWaiters: returns Result for poison errors Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
2225087 to
b493fb1
Compare

Summary
RequestSubject,PublishSubject, andJetStreamSubjectnewtypes that encode the transport at the type levelinitialize()returnsRequestSubject,prompt()returnsJetStreamSubject,cancel()returnsPublishSubjectnats::request_with_timeout,nats::publish,bridge.session_request) only accept the correct type — misuse is a compile error