Skip to content

Separate KV semantics from trace validation - #8762

Merged
Amaury Chamayou (achamayou) merged 17 commits into
microsoft:mainfrom
heidihoward:agents/kv-model-trace-separation
Nov 18, 2026
Merged

Amaury Chamayou (achamayou) merged 17 commits into
microsoft:mainfrom
heidihoward:agents/kv-model-trace-separation

Conversation

@heidihoward

@heidihoward Heidi Howard (heidihoward) commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

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.State directly alongside separate trace-only Recording bookkeeping.
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.transitionSystem rather 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.

  • The preceding timeout 300 lake check --inadvisably-no-sandbox timed out during independent kernel checking; CI kernel/axiom validation remains required.
  • scripts/ci-checks.sh is blocked locally by missing uv/uvx and cmake.
  • sphinx-build --fail-on-warning -b html doc doc/html passed locally, including generated API documentation and the trace viewer.

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.
@heidihoward
Heidi Howard (heidihoward) marked this pull request as ready for review November 17, 2026 15:13
@heidihoward
Heidi Howard (heidihoward) requested a review from a team as a code owner November 17, 2026 15:13
Copilot AI balanced review requested due to automatic review settings November 17, 2026 15:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread lean/kv/Kv/Properties.lean Resolved
Comment thread lean/kv/Kv/Properties.lean Resolved
Corrected comment to clarify the behavior of acquiring a map.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@heidihoward Heidi Howard (heidihoward) changed the title lean: Separate KV semantics from trace validation Separate KV semantics from trace validation Nov 17, 2026
Comment thread doc/build_apps/kv/semantics.rst Resolved
Comment thread lean/AGENT.md Resolved
Comment thread lean/kv/Kv/Tests/Model.lean Resolved
Copilot AI balanced review requested due to automatic review settings November 18, 2026 09:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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

Copilot AI balanced review requested due to automatic review settings November 18, 2026 10:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The theorem docstring at lean/kv/Kv/Properties.lean:278 incorrectly uses “actions,” obscuring that the snapshot captures the store’s head and term.

No open issues 🎉

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.
Copilot AI balanced review requested due to automatic review settings November 18, 2026 11:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

An active wording nit remains at lean/kv/Kv/Properties.lean:278, where “actions” should be “records” to accurately describe the snapshot storing the head and term.

No open issues 🎉

Review effort: Balanced

Remove discussion of mixed-view reads across rollback so the behavior and stronger snapshot-consistency properties can be investigated separately.
Copilot AI balanced review requested due to automatic review settings November 18, 2026 13:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The docstring at lean/kv/Kv/Properties.lean:278 contains a wording error: actions should be records to accurately describe snapshot capture.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 18, 2026 13:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The snapshot-capture docstring at lean/kv/Kv/Properties.lean:278 incorrectly uses “actions” instead of “records” to describe retaining the store’s head and term.

No open issues 🎉

Review effort: Balanced

@achamayou
Amaury Chamayou (achamayou) added this pull request to the merge queue Nov 18, 2026
Merged via the queue into microsoft:main with commit 0831398 Nov 18, 2026
26 checks passed
@achamayou
Amaury Chamayou (achamayou) deleted the agents/kv-model-trace-separation branch November 18, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants