Repository navigation
spec(tla): pad-directive model + behavior replay against process_pads - #1696
Merged
Merged
Conversation
New PadCorrect.tla (161 states, TLC-checked): a pad directive arms a pending pad; the next balance assertion absorbs the difference by synthesizing a padding transaction (pad amount = asserted - actual); a newer pad replaces a pending one. Single account/currency; the implementation's sub-account summing semantic is out of model scope (pinned by integration tests). Replay (rustledger-booking/tests/, 1,044 behaviors; 4,082 at escalated bounds): model-legal pad/txn/balance sequences run through the real process_pads. Conformance: synthesized pad amounts exactly match the model, final balance matches, and — two semantics the replay surfaced and now pins: - a behavior ending with an ARMED pad must produce exactly the implementation's unused-pad error (beancount-aligned), nothing else; - process_pads only tracks inventories for Open-ed accounts (postings to unopened accounts are silently ignored — the validator owns that error class), so the replay opens accounts first as any real ledger would. Wired through all four layers: generator derive (with TLA boolean normalization — "FALSE" is truthy in Python), corpus, replay-file list in the coverage lint, escalation-table entry, RUST_MAPPING row, tla.yml model-check loop. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contributor
📊 Benchmark Results
vs main branch (2026-07-02)
What do these numbers mean?
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new TLA+ spec and exhaustive behavior-replay suite for Beancount-style pad directive semantics, wiring it into the existing FV toolchain (generator, corpora, coverage lint, escalated replay, and CI model-check loop) and into rustledger-booking tests to validate process_pads conformance.
Changes:
- Introduces
PadCorrectTLA+ model + TLC config for pad lifecycle semantics (single account/currency). - Adds a new
rustledger-bookingbehavior-replay integration test that replays thePadCorrectcorpus againstprocess_pads. - Wires
PadCorrectthrough the FV scripts and CI workflow (coverage lint list, behavior derivation, escalated bounds, model-check loop) and adds required test dependencies.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/tla/RUST_MAPPING.md | Documents PadCorrect corpus coverage and replay target |
| spec/tla/PadCorrect.tla | New TLA+ spec modeling pad arming and balance absorption semantics |
| spec/tla/PadCorrect.cfg | TLC config/bounds and invariant for PadCorrect |
| scripts/tla-escalated-replay.py | Adds escalated bounds for PadCorrect |
| scripts/tla-coverage-check.py | Includes booking replay test file in coverage lint inputs |
| scripts/tla-behaviors.py | Adds step derivation logic and registry entry for PadCorrect |
| crates/rustledger-booking/tests/tla_behavior_replay.rs | New corpus replay test validating process_pads behavior |
| crates/rustledger-booking/Cargo.toml | Adds serde_json for the new replay test |
| Cargo.lock | Locks the added serde_json dependency in booking dev-deps |
| .github/workflows/tla.yml | Ensures PadCorrect is included in CI model-check loop |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
FV backlog (roadmap "Next" item): the pad directive — beancount's subtlest directive — gets a TLA+ model and full behavior-replay conformance.
Model
PadCorrect.tla(161 states, TLC-checked): pad arms → next balance absorbs the difference (pad = asserted − actual) → newer pads replace pending ones. Single account/currency; sub-account summing deliberately out of scope (integration-tested).Replay — 1,044 behaviors (4,082 escalated) against the real
process_padsSynthesized pad amounts must match the model exactly; final balances must match. Building it surfaced two implementation semantics the suite now pins:
process_padssilently ignores postings to unopened accounts (the validator owns that error class) — the replay opens accounts first, as any real ledger would; the precondition is documented in the test.Wiring (all four layers, enforced by the coverage lint)
Generator derive (with TLA boolean normalization —
"FALSE"is truthy in Python, a trap now documented) · corpus · lint replay-file list · escalation entry · RUST_MAPPING row · tla.yml model-check loop. This PR triggers the TLA workflow: lint + 17-spec model check + corpora lockstep + trace validation all run on it.Verified locally: TLC clean · both corpus scales green · clippy
-D warnings+ fmt clean.🤖 Generated with Claude Code