Repository navigation
Take kv and service out of the source dependency cycle - #8463
Merged
Amaury Chamayou (achamayou) merged 6 commits intoSep 29, 2026
Merged
Amaury Chamayou (achamayou) merged 6 commits into
Amaury Chamayou (achamayou) merged 6 commits into
Conversation
Steps 0 and 1 from the dependency analysis on #3517, reducing the cyclic core of the source component graph from {consensus, endpoints, js, kv, node, service} to {consensus, endpoints, js, node}. - Move the helpers and types kv needs out of node and service: - claims.h moves from node/rpc to kv. - The internal table names the KV inspects on deserialisation move to kv/internal_table_names.h. - split_net_address() and make_net_address() move to the new public header ccf/ds/net_address.h, still included by ccf/service/node_info_network.h. - COSESignaturesConfig and ReconfigurationType move to the new public headers ccf/cose_signatures_config.h and ccf/reconfiguration_type.h. The old headers are kept as deprecated shims, to be removed in 8.0. - Drop stale includes from kv/kv_types.h and consensus/aft/raft_types.h. - Move null_encryptor.h out of kv/test, since node_state.h includes it under USE_NULL_ENCRYPTOR and test directories are not installed. - Add source dependency policies for kv, service and rust so that new upward edges are caught by check-source-dependencies.py. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Amaury Chamayou (achamayou)
September 28, 2026 22:09
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The closing reference would prematurely close #3517 despite the remaining dependency-cycle steps.
Review effort: Balanced
Findings: 1
What changed in this PR
Refactors dependencies so kv and service leave the cyclic source core while preserving public API compatibility.
Changes:
- Relocates KV helpers, table names, and the null encryptor to appropriate KV-owned headers.
- Moves shared public types and network-address helpers to lower-level headers with deprecated forwarding shims.
- Adds dependency policies and updates direct includes, tests, and release notes.
Custom instructions used
.github/copilot-instructions.md.github/instructions/reviewing.instructions.md.github/instructions/changelog.instructions.md
| File | Description |
|---|---|
CHANGELOG.md |
Documents moved and deprecated APIs. |
include/ccf/cose_signatures_config.h |
Adds the relocated COSE configuration type. |
include/ccf/cose_signatures_config_interface.h |
Uses the new COSE header. |
include/ccf/ds/net_address.h |
Adds relocated network-address helpers. |
include/ccf/node/configuration.h |
Uses the new COSE header. |
include/ccf/node/cose_signatures_config.h |
Becomes a deprecated forwarding shim. |
include/ccf/reconfiguration_type.h |
Adds the relocated reconfiguration enum. |
include/ccf/service/node_info_network.h |
Forwards network helpers through the DS header. |
include/ccf/service/reconfiguration_type.h |
Becomes a deprecated forwarding shim. |
include/ccf/service/service_config.h |
Uses the new reconfiguration header. |
scripts/headers-are-included.sh |
Excludes compatibility-only shims. |
scripts/source-dependencies.json |
Adds KV, service, and Rust policies. |
src/consensus/aft/raft.h |
Uses the lower-level reconfiguration header. |
src/consensus/aft/raft_types.h |
Removes a stale node dependency. |
src/consensus/aft/test/view_straddling_common.h |
Updates the null-encryptor include. |
src/endpoints/endpoint_registry.cpp |
Removes the obsolete claims include. |
src/indexing/test/common.h |
Updates the null-encryptor include. |
src/js/test/js.cpp |
Updates the null-encryptor include. |
src/kv/claims.h |
Relocates and makes claims helpers inline. |
src/kv/committable_tx.h |
Removes the node claims dependency. |
src/kv/deserialise.h |
Uses KV-owned claims and table names. |
src/kv/generic_serialise_wrapper.h |
Uses the relocated claims header. |
src/kv/internal_table_names.h |
Centralizes KV-inspected table names. |
src/kv/kv_types.h |
Replaces upward dependencies with direct includes. |
src/kv/null_encryptor.h |
Relocates the debug encryptor outside tests. |
src/kv/snapshot.h |
Includes KV claims directly. |
src/kv/store.h |
Includes KV claims directly. |
src/kv/test/kv_contention.cpp |
Updates the null-encryptor include. |
src/kv/test/kv_dynamic_tables.cpp |
Updates the null-encryptor include. |
src/kv/test/kv_serialisation.cpp |
Updates the null-encryptor include. |
src/kv/test/kv_snapshot.cpp |
Updates the null-encryptor include. |
src/kv/test/kv_test.cpp |
Updates relocated KV helper includes. |
src/kv/test/null_tx_history.h |
Uses the new COSE header. |
src/node/hooks.h |
Uses the new reconfiguration header. |
src/node/identity.h |
Uses the new COSE header. |
src/node/internal_tables_access.h |
Adds its direct host-data dependency. |
src/node/node_state.h |
Uses relocated public and KV headers. |
src/node/rpc/node_call_types.h |
Adds direct configuration dependencies. |
src/node/rpc/node_frontend.h |
Uses the new reconfiguration header. |
src/node/rpc/node_operation_interface.h |
Uses the new COSE header. |
src/node/rpc/test/frontend_test.cpp |
Updates the null-encryptor include. |
src/node/rpc/test/frontend_test_infra.h |
Updates the null-encryptor include. |
src/node/rpc/test/internal_tables_access_test.cpp |
Updates the null-encryptor include. |
src/node/rpc/test/node_frontend_test.cpp |
Updates the null-encryptor include. |
src/node/test/historical_queries.cpp |
Updates the null-encryptor include. |
src/node/test/history.cpp |
Updates the null-encryptor include. |
src/node/test/jwt_key_auto_refresh.cpp |
Updates the null-encryptor include. |
src/node/test/ledger_secrets.cpp |
Updates the null-encryptor include. |
src/node/test/network_identity_subsystem.cpp |
Updates the null-encryptor include. |
src/node/test/node_info_json.cpp |
Includes network helpers directly. |
src/node/test/open_service.cpp |
Updates the null-encryptor include. |
src/node/test/snapshot.cpp |
Updates relocated KV helper includes. |
src/node/test/snapshotter.cpp |
Updates the null-encryptor include. |
src/node/tx_receipt_impl.h |
Includes KV claims directly. |
src/service/tables/config.h |
Uses the new reconfiguration header. |
src/service/tables/shares.h |
Reuses KV-owned table names. |
src/service/tables/signatures.h |
Reuses KV-owned table names. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Resolving the CHANGELOG conflict when merging main left the #8459 entry at the end of the new Deprecated section. It describes a behaviour change, so restore it to its position under Changed, as on main. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Max (maxtropets)
approved these changes
Sep 29, 2026
Amaury Chamayou (achamayou)
deleted the
achamayou-clarify-framework-component-dependencies
branch
September 29, 2026 13:14
This was referenced Sep 30, 2026
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.

Partially addresses #3517: this implements steps 0 and 1 from the latest analysis.
Result
Against current
main, the source component graph drops from 86 to 84 edges between 25 components. The strongly connected core shrinks from {consensus, endpoints, js, kv, node, service} to {consensus, endpoints, js, node}.kvandserviceare no longer part of any cycle.kvnow depends directly only onccf-api,cryptoandds, andserviceonly on those andkv.The diagram shows every direct dependency among the six components that formed the cycle. Each edge is labelled with the number of
#includedirectives behind it.graph LR subgraph core["remaining cycle"] consensus -- 5 --> node node -- 9 --> consensus endpoints -- 6 --> node node -- 4 --> endpoints js -- 9 --> node node -- 14 --> js js -- 7 --> endpoints end consensus -- 4 --> service endpoints -- 12 --> service js -- 4 --> service node -- 105 --> service consensus -- 5 --> kv endpoints -- 1 --> kv js -- 4 --> kv node -- 26 --> kv service -- 9 --> kvScope of the check
check-source-dependencies.pyonly counts direct includes fromsrc/. It attributes public headers underinclude/ccf/<dir>to<dir>, but does not follow their own includes. Following includes transitively, two older paths through public headers remain:kv→ccf/crypto/sha256_hash.h→ccf/service/map.h.sha256_hash.honly needsmap.hfor itsBlitSerialiser<Sha256Hash>specialisation.service/network_tables.h→ccf/endpoint.h→ccf/endpoint_context.h→ccf/endpoints/authentication/authentication_types.h.Neither path reaches any file in
consensus,js,nodeorsrc/endpoints. The transitive includes ofsrc/kvdrop from 109 files, including 4 innodeand 17 inservice, to 88 files, with none innodeand 1 inservice. Those ofsrc/serviceused to reach 4 files innode, and now reach none. Removing the two remaining paths, and making the check follow public headers, are follow-ups for #3517.Changes
Step 0: housekeeping
scripts/source-dependencies.jsonpolicies forkv,serviceandrust.check-source-dependencies.pywill now reject any new upward edge from them. Each allowed dependency is necessary: removing any one of them makes the check fail. The checker itself is unchanged.consensus/aft/raft_types.hno longer includesnode/rpc/rpc_handler.h.kv/kv_types.hno longer includesccf/node/configuration.horccf/service/consensus_type.h. It now includes what it uses directly.src/kv/test/null_encryptor.htosrc/kv/null_encryptor.h. It is not only used by tests:node_state.hincludes it when CCF is built with the debug-onlyUSE_NULL_ENCRYPTORoption.Step 1: make kv a leaf of the core
Move
node/rpc/claims.htokv/claims.h(staticbecomesinline). Includers now include it directly instead of relying on transitive includes.Move the four table names the KV inspects on deserialisation to
kv/internal_table_names.h:SIGNATURESCOSE_SIGNATURESSERIALISED_MERKLE_TREEENCRYPTED_PAST_LEDGER_SECRETservice/tables/{signatures,shares}.hinclude it, soccf::Tables::*is unchanged for all users.Move
ccf::split_net_address()andccf::make_net_address()fromccf/service/node_info_network.hto the new public headerccf/ds/net_address.h.Move
ccf::COSESignaturesConfigandccf::ReconfigurationTypeto the new public headersccf/cose_signatures_config.handccf/reconfiguration_type.h.Public API impact
No breaking API changes:
ccf/service/node_info_network.hstill includesccf/ds/net_address.h, so the functions stay available to existing includers. Their signatures are equivalent, sinceNodeInfoNetwork::NetAddressisstd::string.ccf/node/cose_signatures_config.handccf/service/reconfiguration_type.hremain as deprecated forwarding shims, to be removed in 8.0.#warning, following the precedent ofccf/pal/locking.h(Break the crypto, ds, and pal dependency cycle #8265). As with that header, builds using-Werrorwill fail on the warning unless they add-Wno-error=#warningsor switch to the new headers.headers-are-included.shin the same way.CHANGELOG.mdhas entries underChangedand a newDeprecatedsection.Validation
Local, on WSL with clang 21, RelWithDebInfo, before
mainwas merged in:ctest -L unit: 63/63 passed, plusraft_scenario_test.-fsyntax-onlyofsrc/enclave/main.cppwith-DUSE_NULL_ENCRYPTOR.schema_test(which validates the OpenAPI forReconfigurationTypeand related types) ande2e_logging(which includestest_cose_config) pass.-DCLANG_TIDY=ONbuild is the authoritative check.After merging
main(#8459 and #8454; onlyCHANGELOG.mdconflicted), these checks pass on the merged tree, and the graph numbers above are measured on it:check-source-dependencies.py,includes-checks.sh,headers-are-included.shascii-checks.sh,copyright-checks.sh,todo-checks.sh,extract-release-notes.py