Repository navigation
test(tla): behavior replay for MultiCurrency, AccountStateMachine, PriceDB - #1695
Merged
Merged
Conversation
…iceDB Extends the replay family from 7 to 10 corpora (+27,028 behaviors at CI bounds), reaching two subsystems beyond the core inventory for the first time. Interpreters are distributed by abstraction target (crate deps force this — validate/query depend on core): - MultiCurrency (10,116 behaviors, core): per-currency Conservation over a multi-commodity Inventory; every currency asserted after every step, so cross-commodity unit leaks fail. - AccountStateMachine (16,222, validate): each model-legal open/close/post/ transfer lifecycle converts to directives and must validate() with zero errors — the E1001/E1002/E1003 state machine's enabledness obligation. - PriceDB (690, query): every model-set (base, quote) reads back via PriceDatabase::get_latest_price; model-unset entries not asserted (the implementation legitimately derives inverse rates). Generator: three delta-derives (function-valued states; PriceDB handles the same-value-overwrite transition where only opCount moves). Coverage lint: single replay file generalized to the per-crate list. Escalation table: entries for all three (the drift guard demands them); verified at escalated bounds too — 374,860 / 51,752 / 2,710 behaviors, all conforming. DoubleEntry and Interpolation are deliberately NOT replayed — reasoned exclusions documented in RUST_MAPPING.md (by-construction invariant / highest-effort mapping deferred). 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
Expands the TLA+ behavior-replay conformance test suite from inventory-only coverage into additional crates, adding validator lifecycle and query price-database model conformance, plus updating the associated replay/generation/coverage-check tooling.
Changes:
- Added new replay corpora coverage for
MultiCurrency,AccountStateMachine, andPriceDB, with per-crate replay interpreters inrustledger-core,rustledger-validate, andrustledger-query. - Extended the behavior-corpus generator (
scripts/tla-behaviors.py) with derives for the three new specs, and added escalated-bounds entries for weekly deep replay. - Generalized the coverage lint to accept replay interpreters distributed across crates; added
serde_jsonas needed for new test harnesses.
Reviewed changes
Copilot reviewed 9 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| spec/tla/RUST_MAPPING.md | Documents the three new replayed specs and (now) their crate-local replay targets. |
| scripts/tla-escalated-replay.py | Adds escalated replay bounds entries for the three new corpora. |
| scripts/tla-coverage-check.py | Updates coverage lint to treat crates/*/tests/tla_behavior_replay.rs as valid replay locations. |
| scripts/tla-behaviors.py | Adds corpus-derivation logic + registry entries for MultiCurrency, AccountStateMachine, and PriceDB. |
| crates/rustledger-validate/tests/tla_behavior_replay.rs | New validator-enabledness replay suite for AccountStateMachine. |
| crates/rustledger-validate/Cargo.toml | Adds serde_json dev-dependency for the new replay test. |
| crates/rustledger-query/tests/tla_behavior_replay.rs | New PriceDatabase replay suite for PriceDB. |
| crates/rustledger-query/Cargo.toml | Adds serde_json dev-dependency for the new replay test. |
| crates/rustledger-core/tests/tla_behavior_replay.rs | Adds MultiCurrency replay suite targeting Inventory per-currency units. |
| Cargo.lock | Records new dev-dependency edges (serde_json) for validate/query crates. |
💡 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: the replay family grows 7 → 10 corpora (+27,028 behaviors at CI bounds) and reaches beyond the core inventory for the first time — the validator and the price database now have model-conformance suites.
Inventory; every currency asserted after every step — cross-commodity leaks failrustledger-validate: every model-legal open/close/post/transfer lifecycle → directives →validate()must return zero errors (E1001/E1002/E1003 enabledness)rustledger-query: model-set(base, quote)pairs read back viaget_latest_price; unset pairs unasserted (impl legitimately derives inverses)Machinery
opCountmoves).DoubleEntry/Interpolation: reasoned exclusions documented in RUST_MAPPING.md (by-construction invariant; highest-effort mapping deferred).All verified locally incl. escalated bounds; lint green (10 corpora, all cross-references intact); clippy
-D warnings+ fmt clean.🤖 Generated with Claude Code