Validate C++ disaster recovery traces with Lean - #8282
Validate C++ disaster recovery traces with Lean#8282Amaury Chamayou (achamayou) wants to merge 34 commits into
Conversation
a443db8 to
89872d7
Compare
89872d7 to
7721ba2
Compare
7721ba2 to
b49f888
Compare
b49f888 to
d772ae2
Compare
1eaf0c0 to
a5d2879
Compare
eedf71b to
5298374
Compare
5298374 to
a66bd00
Compare
a66bd00 to
62efec2
Compare
62efec2 to
af3ec5a
Compare
Co-authored-by: Copilot <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>
Co-authored-by: Copilot <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>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep protocol definitions and explicit system properties on the human-review surface. Move proof implementations to checked helper lemmas and use standard Lake build, axiom lint, and import coverage checks. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed9f1e31-297c-4592-a089-2d37c49c2434
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed9f1e31-297c-4592-a089-2d37c49c2434
Use file-aligned Protocol and Proofs namespaces, expose the reviewed theorems under DisasterRecovery.Properties, and update dependent names and documentation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove temporal and liveness definitions and proofs, retain local transition safety under Proofs.Model, and rename TxID.PrefixOf to TxID.EarlierThan. Co-authored-by: Copilot <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>
Co-authored-by: Copilot <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>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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 App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed9f1e31-297c-4592-a089-2d37c49c2434
Request host restart only from the committed JOINING state hook so aborted recovery transactions cannot trigger a restart. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Gate versioned RDP_TRACE records behind CCF_RECOVERY_TRACE and publish receive, timeout, effect, and retry-send events only at their required commit boundaries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replay strict version 1 recovery traces against the canonical model through a local package dependency, with focused rejection tests, no-sorry checks, documentation, and a shallow workflow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Validate trace identity, per-node sequences, message IDs, and causal edges before producing a deterministic NDJSON linearization for the isolated Lean validator. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Build the isolated validator in Milan and Genoa trace-enabled jobs, validate quorum, failover, and repeated-timeout recoveries, and retain generated NDJSON artifacts on failure. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Exercise the focused Python extraction and causal-ordering suite in the dedicated trace workflow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Consolidate the trace checks into the shared Lean workflow and replace the handwritten sorry scan with the standard axiom audit. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed9f1e31-297c-4592-a089-2d37c49c2434
Update trace parsing, replay, and tests for the canonical model namespace introduced lower in the stack. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
af3ec5a to
bca9e9f
Compare
| - Corrected the OpenAPI schema name for `ccf::ds::SizeString` from `TimeString` to `SizeString` (#8261). | ||
| - A transaction in a JavaScript application endpoint which conflicts with compaction is now re-executed, rather than returning `500 Internal Server Error` (#8289). | ||
| - A `Range` header requesting a suffix longer than the file is now clamped to the whole file, per RFC 9110. Ranges which select no bytes, such as `bytes=-0`, are now rejected with `400 Bad Request` (#8299). | ||
| - Recovery-decision-protocol nodes now request host restart only after the `JOINING` state transaction commits, preventing restart for an aborted transaction. (#8282) |
There was a problem hiding this comment.
Umm,... this PR shouldn't make meaningful changes to the behavior of CCF, just add DR tracing
There was a problem hiding this comment.
Let's discuss with cjen1-msft, we can split it, but the currently implementation is otherwise dangerous, and the TV does not match the model with this bug that allows rollback. If this feature was stable and used, I would feel differently, but here I think we ought to fix before we TV (I am happy to split).
There was a problem hiding this comment.
I'd like to do as little trace manipulation in python as possible. We did this before due to the constraints of TLA+ but Lean is more flexible
There was a problem hiding this comment.
Agreed, let me try.
There was a problem hiding this comment.
Maybe I'm just sloppy but I don't think we need unit tests for our test infra, the test is the trace validation in the CI. The only testing for trace validation I'm concerned about is ensuring the trace validation isn't too relaxed
There was a problem hiding this comment.
I think versioning traces in unnecessary
There was a problem hiding this comment.
So long as they're a CI concern, agreed, certainly. Eventually though, we'd like to get traces from production deployments, and then versioning will be quite useful if we ever decide to make changes.
Keep Ubuntu 26.04 runners and pull-request-only Lean validation while retaining the trace-validator job and recovery path filters. Move the recovery restart fix to the upcoming 7.0.16 release notes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Include the JavaScript wrapped-value ownership fix merged while recovery-trace validation was running. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Part 4/4 of the replacement stack for #8241. This PR validates real C++ recovery-decision-protocol executions against the permanent Lean model introduced below it.
Stack:
This PR depends on draft deletion PR #8280 and must remain gated until the lower layers are ready.
Approach
JOININGstate transaction globally commits in both default and trace-enabled builds. In trace-enabled builds, the committedjoin_restartobservation is emitted before restart is requested. This is a commit-before-restart guarantee, not an exactly-once guarantee.CCF_RECOVERY_TRACEoption, a commit-aware trace table, versionedRDP_TRACErecords, per-node sequences, message IDs, causal IDs, exact ordered retry-send batches, accepted receives, committed timeouts, and one-shot effects.lean/disaster-recovery-trace/. It depends locally on../disaster-recoveryand imports onlyDisasterRecovery.Protocol.Model; no trace modules or targets are added to the canonical package.ccf.recovery_decision_protocol.trace/1NDJSON contract. The validator rejects the shortest incompatible prefix and checks parser/replay behavior without treating synthetic tests as implementation evidence.*.recovery.ndjson, and invokes the isolated validator..github/workflows/lean.yml; there is no separate Lean workflow. The job usesmk_all --check, warnings-as-errors, and the same standard axiom audit as the canonical package.Evidence and isolation
Real captured C++ SNP traces are the implementation conformance evidence. Small in-memory Lean and Python tests cover rejection, extraction, and ordering only.
lean/disaster-recovery/remains byte-for-byte unchanged. This PR does not recreatelean/disaster-recovery-migration/ortla/disaster-recovery/, and contains no migration, Rust, or Stateright code.Validation
node_frontend_testwithCCF_RECOVERY_TRACEboth OFF and ON.node_frontend_testthrough each build'stests.shwrapper.lake exe cache get,lake exe mk_all --check --lib DisasterRecoveryTrace,lake build --wfail,lake lint, andlake exe trace-checksfor the isolated package under Lean 4.33.1. The axiom audit checked 317 trace declarations, all within thepropext,Classical.choice, andQuot.soundallowlist.scripts/ci-checks.sh -fsuccessfully on the original trace layer; the rebased workflow and package metadata pass Prettier and stale-reference checks.Gates
Keep this PR in draft while #8280 remains gated. Native stack #8283 preserves the order #8277 -> #8279 -> #8280 -> #8282.