JSON RPC 2.0 Batch support + fix broken Streamable HTTP transport#56
JSON RPC 2.0 Batch support + fix broken Streamable HTTP transport#56RomanEmreis wants to merge 8 commits intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ec251d795
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33756e8b8e
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b7698cb817
ℹ️ 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".
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
Implements JSON-RPC 2.0 batch request/response support (spec §6) on both the server and client sides of
Neva, plus a complete
examples/batch/workspace demonstrating the feature.What Changed
Core Types (
neva/src/types.rs)MessageBatch— a non-empty wrapper aroundVec<MessageEnvelope>enforcing the spec's "batch must contain at least one object" rule atconstruction and deserialization
Message::Batch(MessageBatch)variant with#[serde(untagged)]ordering:Batchis last so single-message deserialization is tried firstMessageBatchimplementsIntoIteratorfor ergonomic iteration over envelopesServer (
neva/src/app.rs)Message::Batchby processing each request concurrently and collecting responses into a single batch replyClient Handler (
neva/src/client/handler.rs)Message::Batch: iterates envelopes and dispatches eachResponseto its waiting channel viapending.complete(resp);non-response envelopes in a batch (protocol violations per spec) are silently ignored for robustness
send_batch— registers pending slots for all requests, sends the batch atomically, and cleans up slots on send failure to prevent leakstimeout()/pending()accessors needed byClient::call_batchClient (
neva/src/client.rs+ newneva/src/client/batch.rs)Client::call_batch(items: Vec<MessageEnvelope>) -> Result<Vec<Response>>— sends a batch and awaits all responses concurrently usingtry_join_all(short-circuits on first error)
Client::batch() -> BatchBuilder<'_>— entry point for the fluent builder APIBatchBuilder<'a>with 9 builder methods:list_tools()tools/listrequestcall_tool(name, args)tools/callrequest (setsmetafor progress tracking)list_resources()resources/listrequestread_resource(uri)resources/readrequestlist_resource_templates()resources/templates/listrequestlist_prompts()prompts/listrequestget_prompt(name, args)prompts/getrequest (setsmetafor progress tracking)ping()pingrequestnotify(method, params)send()Example (
examples/batch/)A self-contained workspace (
client+server) demonstrating batch in action:addtool, agreetingprompt, and three notes resources (daily,weekly,monthly)list_tools,list_resources,list_prompts,call_tool,read_resource × 2,get_prompt,ping— then parses and logs each responseOther
CONTRIBUTING.md,CODE_OF_CONDUCT.md,SECURITY.md, issue/PR templates, cleaned-up.gitignoreneva/Cargo.toml,neva_macros/Cargo.toml)Test Coverage
handler.rs:batch_responses_are_distributed_individually— verifies mixed-envelope batch (Response + Request + Response) dispatches only the tworesponses to their pending channels
client.rs:call_batch_returns_error_when_disconnected— verifies early error when no handler is attachedRunning the Example