Skip to content

fix(jsonrpc): keep id as null in error responses - #1880

Merged
bmuddha merged 3 commits into
magicblock-labs:masterfrom
Bruce039:error-response-null-id
Nov 5, 2026
Merged

bmuddha merged 3 commits into
magicblock-labs:masterfrom
Bruce039:error-response-null-id

Conversation

@Bruce039

@Bruce039 Bruce039 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

When the request id can't be read, for example on a malformed body over HTTP or WebSocket, the error response leaves out id entirely because ResponseErrorPayload skips it when it is None. JSON-RPC 2.0 requires id on every response and says it must be null in that case, and Agave sends "id":null. The fallback body in server/http/dispatch.rs already does this, so only the normal path disagreed.

Dropping the skip_serializing_if makes None serialize as null; responses with a known id are unchanged. Added test_parse_error_response_has_null_id in aperture/tests/batches.rs, which posts { and checks the response has "id": null.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

You'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 38 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1e88ac3 and 0a86716.

Files selected for processing: 1

  • aperture/src/requests/payload.rs

No actionable comments were generated in the recent review.

Walkthrough

Error response payloads now serialize an absent request ID as null instead of omitting the field. Tests check responses with absent and numeric request IDs.

Changes: Error response ID serialization

Layer / File(s) Summary
Serialize error response IDs
aperture/src/requests/payload.rs
The payload includes id: null when the request ID is absent. Tests check this behavior and verify that a numeric ID is preserved.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Possibly related PRs

Suggested reviewers: bmuddha

Merge Risk: Minimal · previous review 1e88a

The change addresses null-ID error responses and preserves known IDs.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preserving a JSON-RPC error response id as null.
Description check Passed The description directly explains the id serialization issue, the JSON-RPC requirement, the implementation change, and the added test.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 0f21b78 and 1e88ac3.

Files selected for processing: 1

  • aperture/src/requests/payload.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@bmuddha bmuddha left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace the full RPC integration test with a focused encoder unit test.

Comment thread aperture/tests/batches.rs Resolved
@bmuddha
bmuddha merged commit 232a0ac into magicblock-labs:master Nov 5, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants