feat(a2a-nats): json-rpc codec, error codes, and protocol constants - #300
Conversation
yordis
commented
Jun 17, 2026
- Lands the wire-level codec every A2A request/response handler will reach for: the JSON-RPC id type and request-id extractor, the spec-defined error codes (TASK_NOT_FOUND, TASK_NOT_CANCELABLE, …), and the protocol-level constants (default prefix, env-var names, timeout defaults) so later slices share a single canonical source instead of duplicating these in every server/client module.
- Kept narrow so reviewers can vet the wire contract (id parsing, error code numbers, timeout defaults) without wading through the consumer code that will land in subsequent PRs; config.rs is deferred until the push subsystem lands because it carries push-DLQ knobs that depend on types that don't exist yet.
Adds the wire codec the protocol's request/response handlers need: the JSON-RPC id type and request-id extractor, A2A spec error codes (TASK_NOT_FOUND, TASK_NOT_CANCELABLE, …), and the protocol-level constants (default prefix, env-var names, timeout defaults) so later slices can build on a single canonical source. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
PR SummaryLow Risk Overview Adds Reviewed by Cursor Bugbot for commit dfdd2d3. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Warning Review limit reached
More reviews will be available in 55 minutes and 13 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe Changesa2a-nats crate expansion
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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: dfdd2d3 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
CI clippy denies unwrap_used at crate level for a2a-nats (matching trogon-decider-runtime's pattern). Add the standard cfg_attr(test, ...) allow attribute so test code can use .unwrap() / .expect() / panic! freely without losing the production-code restriction. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Uuid::now_v7().simple() emits 32 hex chars; NatsToken validation accepts that pattern unconditionally. clippy::expect_used is denied on this crate in CI even though it isn't surfaced by local cached builds — annotate the two production-code expect() sites instead of weakening the lint. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rsworkspace/crates/a2a-nats/src/constants.rs`:
- Around line 50-52: The documentation comment on lines 50-52 contains intra-doc
links to crate::push::HttpPushDispatcher,
crate::push::NatsPublishPushDispatcher, and
crate::push::JetStreamPublishPushDispatcher, but the push module does not exist
in this crate. Remove the intra-doc link brackets (the square brackets) around
these crate::push references in the comment, or remove the references entirely
if the push module is not available, to prevent broken intra-doc links that may
fail documentation builds.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c28ba4bc-142e-4db5-8159-7b8e21321af2
⛔ Files ignored due to path filters (1)
rsworkspace/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (5)
rsworkspace/crates/a2a-nats/Cargo.tomlrsworkspace/crates/a2a-nats/src/constants.rsrsworkspace/crates/a2a-nats/src/error.rsrsworkspace/crates/a2a-nats/src/jsonrpc.rsrsworkspace/crates/a2a-nats/src/lib.rs
…300) Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>