Repository navigation
Split RPC command processing into focused helpers - #8562
Merged
Amaury Chamayou (achamayou) merged 7 commits intoOct 16, 2026
Merged
Conversation
Extract backpressure, redirect/forward and commit completion blocks without changing retry control, transaction ownership or exception handling. Add regression coverage for local commit callbacks, receipt fields and replication failure. Measured cognitive complexity drops from 90 to 44; all helpers remain below 50. Ref #7358. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use uint8_t for the private Done/Retry enum and include cstdint directly, matching the existing endpoint enum convention. Fix performance-enum-size under the required clang-tidy configuration without changing values, retry semantics, or suppressions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The extraction preserves existing behavior, no unresolved findings remain, and CI succeeded for the repaired head.
0 open findings
What changed in this PR
Refactors RPC command processing into focused helpers, advancing #7358 without changing request behavior.
Changes:
- Extracts backpressure, routing, and commit-completion logic.
- Removes the cognitive-complexity suppression.
- Adds regression coverage for callbacks, receipts, exceptions, and replication failure.
Custom instructions used
Applied the supplied guidance for .github/copilot-instructions.md and .github/instructions/reviewing.instructions.md; local copies were unavailable.
| File | Description |
|---|---|
| src/node/rpc/test/frontend_test.cpp | Adds commit-completion and replication-failure regression tests. |
| src/node/rpc/frontend.h | Extracts processing helpers while preserving retry and completion behavior. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This was referenced Oct 12, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Max (maxtropets)
approved these changes
Oct 16, 2026
Amaury Chamayou (achamayou)
enabled auto-merge (squash)
October 16, 2026 12:04
Amaury Chamayou (achamayou)
deleted the
achamayou-rpc-processing-extraction
branch
October 16, 2026 12:17
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.
Motivation
RpcFrontend::process_command_innerscores 90 onreadability-function-cognitive-complexity, against a threshold of 50, and carries a baseline suppression. This PR splits it so the suppression can be removed without changing behaviour.Related to #7358. The remaining suppressions are handled in #8560 and #8561.
Implementation summary
Extract three private helpers from the per-attempt loop body, moving the statements verbatim:
check_backpressure: the consensus backpressure check, still run before thetry.redirect_or_forward: redirection-config lookup,check_redirect, and theForwardingRequiredswitch.commit_transaction: write-set observer setup,tx.commit, the locally-committed callback and its fallbacks,respond_on_commitpopulation, and signature emission. It returnsCommitAction::DoneforSUCCESSandFAIL_NO_REPLICATE, andRetryforFAIL_CONFLICT, so the caller's loop and all sevencatchclauses are unchanged.Add
frontend_testcases for local-commit callback order relative to signature emission,respond_on_commitreceipt fields, standard and non-standard exceptions from the local-commit callback, and replication failure completing without retry or commit callbacks.Measured with clang-tidy 21.1.8 and
IgnoreMacros=true; the repository threshold stays at 50:process_command_innercommit_transactionredirect_or_forwardcheck_backpressureSafety and compatibility
Internal refactor with no API, ledger-format, or mixed-version impact. A token comparison against
mainshows the only differences are the helper signatures, their call sites, andreturnbecomingreturn CommitAction::Done. Routing and authorization order, transaction ownership, retry outcomes, receipt capture, and every error status, code, and message are unchanged.CommitActionisuint8_tto satisfyperformance-enum-size.Validation:
frontend_testandnode_frontend_testand ran both; all cases pass, including the new ones.scripts/ci-checks.shpassed without auto-fix.CLANG_TIDY=ONbuild with the suppression removed. Required CI must pass again on the current head.