Repository navigation
Separate KV semantics from trace validation - #8762
Merged
Amaury Chamayou (achamayou) merged 17 commits intoNov 18, 2026
Merged
Amaury Chamayou (achamayou) merged 17 commits into
Amaury Chamayou (achamayou) merged 17 commits into
Conversation
Keep trace schemas, lifecycle bookkeeping, diagnostics, and observation checks in the adapter. Expose an independent executable KV transition system and preserve checked semantic and replay properties through correspondence proofs.
Make the semantic model the canonical scope of KV safety claims and keep trace correspondence separate. Enforce safety dependency isolation through the full import graph, including external bridge modules.
Preserve disaster recovery's Records import of reusable replay definitions in its trace validation entrypoint. Keep model and safety isolation checks intact and cover the dependency in shared architecture tests.
Move replay projections into TraceValidation and proof-only reference programs into Proofs instead of introducing a Correspondence directory. Update imports, documentation, and shared architecture checks without changing safety properties.
Reuse the original proof modules and property order, removing redundant adapter proofs, the extra atomicity claim, and broader architecture changes. Preserve model/trace separation and all 37 original safety properties and witnesses.
Restore compatible property docstrings and the original README catalogue layout. Keep the original theorem and witness names while retaining semantic-model statements, avoiding optional naming and documentation churn.
Keep Model.State alongside trace-only recording metadata instead of embedding decorated stores and transactions. Execute the main model directly and remove state projection, reconstruction, the trace transition system, and correspondence proofs. Preserve existing safety claims and trace diagnostics.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Two minor wording issues remain in lean/kv/Kv/Properties.lean, where “actions” should be “records” in descriptions of snapshot capture and storing the acquired map view.
2 open issues
What changed in this PR
This PR separates CCF's executable Lean KV model from trace validation, allowing model execution and safety reasoning without recorded trace metadata.
Changes:
- Introduces model actions and computed outputs, with separate trace translation and recording bookkeeping.
- Moves safety statements and witnesses to model executions while preserving the property catalogue.
- Adds direct-model and adapter regression checks and clarifies rollback guarantees and validation boundaries.
Custom instructions used
Repository Copilot guidance supplied with the review; no additional instruction files were loaded.
| File | Description |
|---|---|
lean/kv/README.md |
Explains the separation, proof scope, and validation checks. |
lean/kv/Kv/TraceValidation/Types.lean |
Defines trace records and separate recording state. |
lean/kv/Kv/TraceValidation/Transitions.lean |
Checks trace protocols and executes model actions. |
lean/kv/Kv/TraceValidation/Records.lean |
Redirects decoding imports to trace validation. |
lean/kv/Kv/TraceValidation/Adapter.lean |
Translates events and compares reported outputs. |
lean/kv/Kv/TraceValidation.lean |
Uses recording metadata in stream diagnostics. |
lean/kv/Kv/Tests/Replay.lean |
Adds adapter and bookkeeping regression checks. |
lean/kv/Kv/Tests/Model.lean |
Adds executions independent of trace records. |
lean/kv/Kv/Properties/Programs.lean |
Adapts reference helpers to model types. |
lean/kv/Kv/Properties/Invariants.lean |
Defines model execution predicates and application projection. |
lean/kv/Kv/Properties.lean |
Restates the safety catalogue over the model. |
lean/kv/Kv/Proofs/Witnesses.lean |
Replaces trace-based witnesses with model executions. |
lean/kv/Kv/Proofs/Segment.lean |
Proves serializability for model execution segments. |
lean/kv/Kv/Model/Types.lean |
Removes trace metadata from model state. |
lean/kv/Kv/Model/Transitions.lean |
Computes state changes and outputs from model inputs. |
lean/kv/Kv/Model.lean |
Assembles the transition system over model actions. |
lean/kv/Kv.lean |
Imports the new model, proof, and adapter modules. |
lean/AGENT.md |
Documents model and trace-validation boundaries. |
doc/build_apps/kv/semantics.rst |
Clarifies model guarantees and mixed views across rollback. |
Review effort: Balanced
Corrected comment to clarify the behavior of acquiring a map. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Amaury Chamayou (achamayou)
approved these changes
Nov 17, 2026
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
An unresolved docstring nit at lean/kv/Kv/Properties.lean:278 calls for replacing “actions” with “records” to clarify that snapshot capture records the store’s head and term.
No open issues 🎉
2 resolved since last review
Review effort: Balanced
Replay rejected fixtures through model actions and reported-output checks without diagnostic guards, requiring the same failing record. Keep the two callback-visitation failures explicitly adapter-only and preserve existing diagnostics.\n\nRemove unused correspondence guidance and clarify how diagnostic checks are independently covered.
Remove discussion of mixed-view reads across rollback so the behavior and stronger snapshot-consistency properties can be investigated separately.
Heidi Howard (heidihoward)
enabled auto-merge
November 18, 2026 13:56
Eddy Ashton (eddyashton)
approved these changes
Nov 18, 2026
Amaury Chamayou (achamayou)
approved these changes
Nov 18, 2026
Amaury Chamayou (achamayou)
disabled auto-merge
November 18, 2026 14:06
Amaury Chamayou (achamayou)
deleted the
agents/kv-model-trace-separation
branch
November 18, 2026 14:21
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.

The KV specification mixed transactional semantics with trace schemas, test scopes, recording metadata, and validation diagnostics.
Separate the executable KV state, actions, and computed outputs from the trace checker so the model can be reviewed and executed independently of recorded traces.
The checker now holds
Model.Statedirectly alongside separate trace-onlyRecordingbookkeeping.It translates records into model actions, executes the main model, compares computed outputs with reported observations, and updates only recording metadata separately.
There are no decorated store/transaction types, model-state projection or reconstruction, separate trace transition system, or correspondence proofs.
Trace decoding, translation, and report checks remain part of the validation trust boundary.
All 37 original safety properties and their witnesses retain their original names and catalogue order, while their statements concern
Model.transitionSystemrather than trace-adapter reachability.Reuse the original property helper and proof modules, remove obsolete adapter-scoped proof copies, and retain original docstrings and catalogue layout wherever accurate.
The Lean agent guidance documents the model/recording boundary.
No shared-infrastructure changes remain in the PR.
Redundant uses of semantic have been removed from comments, documentation, diagnostics, and internal names without changing property statements or model behavior.
Validation and remaining checks
The KV warning-free build, trace-validation self-tests, all 72 replay fixtures, import/architecture checks, Lean lint, changed-file formatting, and ASCII/prose checks passed locally.
Tests are limited to trace validation; the standalone model test module has been removed.
Regressions cover independent callback bookkeeping across interleaved attempts and cleanup at lifecycle end.
Before the terminology cleanup, differential replay of the checker-state refactor against its predecessor produced identical exit codes and exact diagnostics for all 72 fixtures and 591 truncated prefixes.
The executable model and all safety statements are unchanged by this checker-state refactor.
The updated revision still requires its own CI results.
timeout 300 lake check --inadvisably-no-sandboxtimed out during independent kernel checking; CI kernel/axiom validation remains required.scripts/ci-checks.shis blocked locally by missinguv/uvxandcmake.sphinx-build --fail-on-warning -b html doc doc/htmlpassed locally, including generated API documentation and the trace viewer.