Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/skills/formatting-and-linting/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Each command below is under `scripts/`. This table is a routing guide; the scrip
| `prettier-checks.sh` | TS, JS, Markdown, YAML, JSON (excluding `.github/**/*.md` and `tests/sandbox/`) | prettier | `-f` |
| `doc-newline-checks.sh` | Markdown and RST prose | Mid-sentence newline policy | `-f` |
| `builtin-maps-checks.sh` | Built-in map names in `include/` or `src/`, and `doc/audit/builtin_maps.rst` | Every `public:ccf.gov.*` and `public:ccf.internal.*` map is documented | No |
| `lean-coverage-masks-checks.sh` | `lean/COVERAGE_MAPPING.md`, `lean/<spec>/coverage_mask.json`, `scripts/lean_coverage_report.py`, or mapped C++ files | Validates coverage mask anchors, brace balance, cross-spec disjointness, and report script tests | No |
| `cmake-format-checks.sh` | CMake files | gersemi | `-f` |
| `release-notes-checks.sh` | `CHANGELOG.md`, `.changes/*.md` (also run prettier) | extract-release-notes.py | `-f` (changelog links only) |
| `shellcheck-checks.sh` | Shell scripts outside `3rdparty/` | shellcheck | No |
Expand Down
168 changes: 168 additions & 0 deletions lean/COVERAGE_MAPPING.md

Large diffs are not rendered by default.

155 changes: 155 additions & 0 deletions lean/consensus/coverage_mask.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
{
"spec": "consensus",
"description": "Line-range masks selecting the C++ implementation sections modeled by lean/consensus. Mapped files default to fully included; listed ranges exclude mechanisms explicitly outside lean/consensus (periodic task registration, uncommitted-transaction and ledger-backlog backpressure, batch-size byte heuristics, periodic signature disposition, KV local-write role-lock permit accessors, recovery-only force_become_primary/remove_deleted_nodes/enable_all_domains, external RPC/snapshot view-history queries, diagnostic status queries, commit_observer callbacks, trace-capture helpers, the KV Store/Adaptor bridge, and std::formatter logging boilerplate). Aft::periodic (CheckQuorum and election dispatch), recv_message error arms, and ConfigurationChangeHook remain included.",
"files": {
"src/consensus/aft/cft.h": {
"exclude": [
{
"start": 245,
"end": 253,
"start_anchor": "void register_periodic_tasks(",
"end_anchor": "}",
"reason": "JobBoard periodic task registration is unmodeled (lean/consensus models no wall clock)"
},
{
"start": 291,
"end": 303,
"start_anchor": "bool should_apply_backpressure() override",
"end_anchor": "}",
"reason": "Ledger-backlog and uncommitted-transaction backpressure are unmodeled"
},
{
"start": 305,
"end": 317,
"start_anchor": "Consensus::SignatureDisposition get_signature_disposition() override",
"end_anchor": "}",
"reason": "Periodic signature scheduling (should_sign / SignatureDisposition) is unmodeled"
},
{
"start": 341,
"end": 349,
"start_anchor": "void trace_retired_committed_tx(",
"end_anchor": "}",
"reason": "Trace-capture-only helper emitting ccf.cft retired_committed_tx events is unmodeled"
},
{
"start": 351,
"end": 365,
"start_anchor": "ccf::kv::LocalWritePermit acquire_local_write_permit() override",
"end_anchor": "}",
"reason": "KV local-write role-lock permit accessors (acquire_local_write_permit, local_writes_enabled) are unmodeled concurrency plumbing"
},
{
"start": 402,
"end": 436,
"start_anchor": "void remove_deleted_nodes(",
"end_anchor": "}",
"reason": "Disaster-recovery node deletion without retirement and node-identity reuse are out of scope of lean/consensus"
},
{
"start": 472,
"end": 478,
"start_anchor": "void enable_all_domains() override",
"end_anchor": "}",
"reason": "Recovery-only public/private security-domain deserialisation toggle is unmodeled"
},
{
"start": 495,
"end": 517,
"start_anchor": "void force_become_primary(",
"end_anchor": "}",
"reason": "Disaster-recovery four-argument force_become_primary overload is unmodeled (bootstrap zero-argument overload remains included)"
},
{
"start": 571,
"end": 581,
"start_anchor": "std::vector<Index> get_view_history(Index idx) override",
"end_anchor": "}",
"reason": "External RPC/snapshot view-history query accessors are unused by consensus transitions"
},
{
"start": 676,
"end": 700,
"start_anchor": "ccf::kv::ConsensusDetails get_details() override",
"end_anchor": "}",
"reason": "Read-only diagnostic/telemetry status snapshot is unmodeled"
},
{
"start": 830,
"end": 841,
"start_anchor": "if (ledger->is_backlogged())",
"end_anchor": "}",
"reason": "Ledger I/O backlog message dropping is unmodeled (message loss is modeled non-deterministically by the network queue)"
},
{
"start": 1038,
"end": 1052,
"start_anchor": "void update_batch_size()",
"end_anchor": "}",
"reason": "Byte-size moving-window AppendEntries batching heuristic is unmodeled"
},
{
"start": 1071,
"end": 1076,
"start_anchor": "bool can_sign_unsafe()",
"end_anchor": "}",
"reason": "Helper used only by unmodeled get_signature_disposition"
},
{
"start": 2715,
"end": 2719,
"start_anchor": "if (commit_observer != nullptr)",
"end_anchor": "}",
"reason": "External CommitObserver callback notification is unmodeled"
},
{
"start": 2889,
"end": 2892,
"start_anchor": "const State& get_state_for_trace() const",
"end_anchor": "}",
"reason": "Trace-capture state accessor is unmodeled"
}
]
},
"src/consensus/aft/impl/state.h": {
"exclude": [
{
"start": 110,
"end": 125,
"start_anchor": "[[nodiscard]] std::vector<ccf::kv::Version> get_history_until(",
"end_anchor": "}",
"reason": "External RPC/snapshot view-history slice queries (get_history_until, get_history_since) are unused by consensus transitions"
}
]
},
"src/consensus/aft/cft_types.h": {
"exclude": [
{
"start": 24,
"end": 86,
"start_anchor": "class Store",
"end_anchor": "};",
"reason": "KV Store interface and weak-pointer Adaptor bridge are abstracted away by NodeState.log in lean/consensus"
},
{
"start": 267,
"end": 321,
"start_anchor": "template <>\nstruct std::formatter<aft::CftMsgType>",
"end_anchor": "};",
"reason": "std::formatter<aft::CftMsgType> logging formatter is unmodeled"
}
]
},
"src/node/hooks.h": {
"exclude": [
{
"start": 99,
"end": 102,
"start_anchor": "if (!retired_committed.empty())",
"end_anchor": "}",
"reason": "Trace-capture-only retired_committed_tx emission is unmodeled"
}
]
}
}
}
120 changes: 120 additions & 0 deletions lean/consistency/coverage_mask.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"spec": "consistency",
"description": "Positive whole-function include masks selecting the C++ implementation sections modeled by lean/consistency inside multi-purpose RPC and endpoint files (include/ccf/tx_status.h is included whole without a mask). Selects transaction status evaluation (/tx and get_status_for_txid_v1), initial x-ms-ccf-transaction-id header emission and default forwarding policies (endpoint_registry.cpp), and the RpcFrontend execution, forwarding, session-consistency, and commit/retry loop (frontend.h, including exception handlers).",
"files": {
"src/endpoints/base_endpoint_registry.cpp": {
"include": [
{
"start": 67,
"end": 89,
"start_anchor": "ApiResult BaseEndpointRegistry::get_status_for_txid_v1(",
"end_anchor": "}",
"reason": "Delegates transaction status evaluation to consensus (implements Event.status reporting)"
}
]
},
"src/endpoints/common_endpoint_registry.cpp": {
"include": [
{
"start": 36,
"end": 43,
"start_anchor": "struct GetTxStatus",
"end_anchor": "};",
"reason": "Response payload type for /tx status observations"
},
{
"start": 54,
"end": 57,
"start_anchor": "DECLARE_JSON_TYPE(GetTxStatus::Out);",
"end_anchor": "static constexpr auto tx_id_param_key = \"transaction_id\";",
"reason": "JSON serialisation and query-parameter key for /tx status observations"
},
{
"start": 234,
"end": 284,
"start_anchor": "auto get_tx_status = [this](auto& ctx, nlohmann::json&&) {",
"end_anchor": ".install();",
"reason": "/tx client endpoint handler and registration reporting Committed/Invalid/Pending/Unknown status"
}
]
},
"src/endpoints/endpoint_registry.cpp": {
"include": [
{
"start": 204,
"end": 274,
"start_anchor": "void default_locally_committed_func(",
"end_anchor": "}",
"reason": "Populates x-ms-ccf-transaction-id on initial responses and sets default ForwardingRequired policies for write, read-only, and command endpoints"
},
{
"start": 491,
"end": 531,
"start_anchor": "void EndpointRegistry::execute_command_endpoint(",
"end_anchor": "}",
"reason": "Executes endpoint handlers and locally committed TxID response callbacks"
},
{
"start": 594,
"end": 597,
"start_anchor": "void EndpointRegistry::set_consensus(ccf::kv::Consensus* c)",
"end_anchor": "}",
"reason": "Binds consensus instance used by status evaluation"
}
]
},
"src/node/rpc/frontend.h": {
"include": [
{
"start": 441,
"end": 476,
"start_anchor": "bool check_session_consistency(",
"end_anchor": "}",
"reason": "Pins session active view and aborts requests on view change to preserve session consistency"
},
{
"start": 553,
"end": 621,
"start_anchor": "void forward(",
"end_anchor": "}",
"reason": "Forwards backup requests to the primary, prevents daisy-chain forwarding, and marks sessions as forwarding"
},
{
"start": 759,
"end": 820,
"start_anchor": "bool redirect_or_forward(",
"end_anchor": "}",
"reason": "Dispatches backup forwarding according to endpoint ForwardingRequired policy and session forwarding state"
},
{
"start": 822,
"end": 942,
"start_anchor": "enum class CommitAction : uint8_t",
"end_anchor": "}",
"reason": "Commits transactions, invokes locally_committed_func to emit TxIDs, and handles conflict retry and replication failure"
},
{
"start": 944,
"end": 1161,
"start_anchor": "void process_command_inner(",
"end_anchor": "}",
"reason": "Main RPC execution, forwarding, session-consistency check, commit/retry loop, and error cleanup preventing false TxIDs"
},
{
"start": 1233,
"end": 1238,
"start_anchor": "void process(std::shared_ptr<ccf::RpcContextImpl> ctx) override",
"end_anchor": "}",
"reason": "Client request entrypoint"
},
{
"start": 1244,
"end": 1259,
"start_anchor": "void process_forwarded(std::shared_ptr<ccf::RpcContextImpl> ctx) override",
"end_anchor": "}",
"reason": "Forwarded request entrypoint enforcing single-hop forwarding invariants"
}
]
}
}
}
Loading