Skip to content

feat: JsonRpcEngineV2 #6176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 44 commits into
base: main
Choose a base branch
from
Draft

Conversation

rekmarks
Copy link
Member

Closes #6088

WIP.

Explanation

References

Changelog

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@rekmarks rekmarks force-pushed the rekm/json-rpc-engine-rewrite-next branch from f74dff2 to c393838 Compare July 23, 2025 18:10
rekmarks added 29 commits July 23, 2025 16:29
@rekmarks rekmarks force-pushed the rekm/json-rpc-engine-rewrite-next branch from eaa6840 to df353cf Compare July 23, 2025 23:31
rekmarks added 6 commits July 24, 2025 16:19
This function should never throw; any failures should be the exclusive
concern of the error handling layer. Dispatching this error to a remote
service also shouldn't hold up request handling.
@Gudahtt Gudahtt mentioned this pull request Jul 28, 2025
4 tasks
export type JsonRpcRequest<Params extends JsonRpcParams = JsonRpcParams> =
BaseJsonRpcRequest<Params>;

export type JsonRpcCall<Params extends JsonRpcParams = JsonRpcParams> =
Copy link
Member

Choose a reason for hiding this comment

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

Nit: "Call" is a bit of a confusing name for a data structure, because a "call" colloquially also refers to a function invocation.

Could we call this JsonRpcMessage instead?

Alternatively we could stick with the spec's definition, and call this JsonRpcRequest, and rename JsonRpcRequest to.... JsonRpcRequestWithId? NonNotificationJsonRpcRequest? JsonRpcRequestWithResponse? Those are all awful though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, Call isn't great, but Message seems like it should also include responses, which is of course not what we want here. (We use Message in this all-encompassing sense in the Ocap Kernel.)

Ultimately I think it's not unreasonable for "call" as in "remote procedure call" to refer to the message that actually results in some method invocation?

Copy link
Member

Choose a reason for hiding this comment

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

Even for the "call" in "remote procedure call", that refers to the invocation rather than the request itself. The "call" in "remote procedure call" would be the full interaction, request and response.

Copy link
Member Author

Choose a reason for hiding this comment

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

JsonRpcInboundMessage?

Copy link
Member

Choose a reason for hiding this comment

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

Good point about "message" being inclusive of responses though.

JsonRpcInboundMessage is not bad 🤔

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.

[json-rpc-engine] Rewrite JsonRpcEngine for safety, ergonomics, and debuggability
2 participants