refactor(node): W1b-5 — seam dig_rpc, RpcDispatch trait/handle carve (#1285)#70
Merged
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
…(#1285, #1298) Carves the core JSON-RPC dispatch (the 665-line handle_rpc match over dig-rpc-protocol's Method enum) into the RpcDispatch trait (seam 4's public surface), implemented by Node with the EXISTING dispatch body relocated byte-identical into seams/dig_rpc/dispatch.rs. STRUCTURAL carve only — the dig-rpc-protocol crate ADOPTION (replacing the hand-rolled match) is W3, out of scope here. The crate-root handle_rpc/handle_rpc_json free functions — the STABLE entry point every external caller uses (dig-node-service's server.rs/control.rs/ rpc.rs/meta.rs, dig-runtime's FFI bridge, peer.rs's peer-RPC server, the openrpc_drift_guard conformance suite) — now thinly delegate to RpcDispatch::dispatch. Their signatures are UNCHANGED, so this is the lowest-blast-radius carve of the sequence: NO external caller needed any change at all. async_trait-boxed (matching the other seam traits) so it stays dyn-compatible for the future Arc<dyn RpcDispatch> handle (W1c). Depends on W1b-4 (merged, #1285). Co-Authored-By: Claude <noreply@anthropic.com>
MichaelTaylor3d
marked this pull request as ready for review
July 20, 2026 22:47
MichaelTaylor3d
commented
Jul 20, 2026
MichaelTaylor3d
left a comment
Contributor
Author
There was a problem hiding this comment.
PASS — single correctness gate (fresh context), W1b-5 seam dig_rpc RpcDispatch carve.
Verified (read-only, no rebuild):
- Behaviour-preserving / byte-identical body. The 664-line dispatch body in
seams/dig_rpc/dispatch.rs(RpcDispatch::dispatch) is whitespace-insensitive IDENTICAL to the pre-carvehandle_rpcbody (base lib.rs:2064-2727).diff -w= clean; the only real change is the addedlet node = self;alias (dispatch.rs:41). The exact-diff noise is pure indentation shift (free-fn -> impl-method scope, the #1302 whitespace). No match arm added/removed/reordered/altered. - Signature-preserving delegation.
handle_rpcnow delegatesRpcDispatch::dispatch(node, req).awaitwith an UNCHANGED signature (lib.rs:2072-2074);handle_rpc_jsonunchanged. The PR touches exactly 7 files — dig-node-service, dig-runtime FFI, peer.rs and openrpc_drift_guard are NOT in the change set (zero external caller edits, as claimed). - Objective invariant GREEN.
crates/dig-node-service/tests/openrpc_drift_guard.rsran under Test + coverage = pass — the JSON-RPC surface did not drift. Clippy/Rustfmt/CodeQL/version-increment/commitlint all green. - Version bumps agree: core 0.13.6->0.13.7, binary 0.47.6->0.47.7.
- 0 unresolved review threads.
- No dig-constants concern (structural carve, no new/shared constants). Cross-seam reaches via
use crate::*are expected until W1c, not a violation.
Note: platform packaging builds (.deb/.msi/.pkg) still pending at review time — not correctness gates; merge when green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
W1b-5 (6th of the 7 W1b sub-PRs, #1285): carve the RPC dispatch `impl Node` methods into
an `RpcDispatch` trait + handle under `seams/dig_rpc/`. STRUCTURAL carve only — the
`dig-rpc-protocol` crate ADOPTION is W3, not this pass; the existing hand-rolled dispatch
logic is relocated byte-identical behind the trait.
Depends on W1b-4 (merged, origin/main @ 8319345).
Closes nothing yet (tracking #1285).