Skip to content

ci(tla): restore the TLC counterexample → Rust-test converter; check all specs per run - #1684

Merged
robcohen merged 1 commit into
mainfrom
feat/tla-trace-to-test
Jul 2, 2026
Merged

robcohen merged 1 commit into
mainfrom
feat/tla-trace-to-test

Conversation

@robcohen

@robcohen robcohen commented Jul 2, 2026

Copy link
Copy Markdown
Member

Second of two formal-verification PRs (companion to #1683) — implements the roadmap's "Now" item: "Restore the TLA+ trace → Rust-test converter". The old converter was deleted in spring cleaning; the workflow itself carries a comment documenting the resulting dead step.

scripts/tla-trace-to-test.py

Parses TLC error traces (porting the retired tla_trace_to_json.py value parser: sets, sequences, records, functions) and emits Rust regression-test skeletons:

  • Inventory/booking spec family (inventory/totalAdded/… vars): consecutive states are diffed into concrete Inventory::add/reduce calls, in the exact style of the hand-made tla_fifo_bug_test.rs.
  • Any other spec: the full trace is pinned as comments around an #[ignore]d skeleton.
  • --self-test with canned traces (runs in CI before converting).

tla.yml improvements (validated, not just moved)

  • The 16 uniform TLC steps become one loop that checks every spec per run — previously fail-fast masked later spec failures.
  • Each TLC output is teed to tlc-logs/; on failure, every counterexample becomes a Rust test skeleton in the job summary + artifact.
  • Fixes a stale trigger path: crates/rustledger-core/src/inventory.rs predates inventory/ becoming a directory — meaning inventory changes stopped triggering the models at all (the fix(core): failed reductions must not mutate inventory + booking property tests #1677 reduction fix wouldn't have run TLC). Now inventory/** + the converter + the workflow itself.

This PR touches tla.yml, so the full 16-spec model check runs on this PR as its own verification.

🤖 Generated with Claude Code

… all specs per run

Restores the formal-verification roadmap's 'Now' item (the workflow that once
produced tla_fifo_bug_test.rs, whose converter was deleted in spring cleaning
and documented in-workflow as 'removed pending someone porting it').

- scripts/tla-trace-to-test.py: parses TLC error traces (ports the retired
  tla_trace_to_json.py value parser) and emits Rust regression-test skeletons —
  concrete Inventory calls for the inventory/booking spec family (state diffs
  -> Add/Reduce), a pinned-trace #[ignore] skeleton for other specs. --self-test
  with canned traces.
- tla.yml: the 16 uniform TLC steps become one loop that checks EVERY spec per
  run (fail-fast previously masked later spec failures), tees each output to
  tlc-logs/, and on failure converts every counterexample into a test skeleton
  in the job summary + artifact.
- Fixes a stale trigger path: 'crates/rustledger-core/src/inventory.rs'
  predates inventory/ becoming a directory, so inventory changes (e.g. the
  #1677 reduction fix) stopped triggering the models entirely. Now
  inventory/**, plus the converter and the workflow itself.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI review requested due to automatic review settings July 2, 2026 03:32
@robcohen
robcohen requested a review from a team as a code owner July 2, 2026 03:32
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

Pull request overview

Restores the TLC counterexample → Rust regression-test converter and updates the TLA+ CI workflow to run all specs in one pass while capturing per-spec logs for counterexample conversion.

Changes:

  • Added scripts/tla-trace-to-test.py to parse TLC error traces and emit Rust test skeletons (inventory-family inference + generic pinned-trace fallback).
  • Refactored .github/workflows/tla.yml to loop over all specs per run, tee each TLC output into tlc-logs/, and convert counterexamples into Rust skeletons on failure.
  • Fixed workflow trigger paths so inventory changes under crates/rustledger-core/src/inventory/** correctly trigger model checking again.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
scripts/tla-trace-to-test.py Adds the TLC trace parser + Rust test skeleton emitter for counterexample-driven regression pinning.
.github/workflows/tla.yml Runs all specs in a loop, persists TLC logs, converts counterexamples to Rust skeletons, and fixes triggering paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/tla-trace-to-test.py Resolved
Comment thread .github/workflows/tla.yml Resolved
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

✅ Compatibility Test Results

Metric Result
Check Compatibility 100%
BQL Compatibility 100%
Full AST Match 100%
Total Files 792
What's tested
  • Check: Exit codes and error counts match bean-check
  • BQL: Query results match bean-query
  • Files: ~800 test files downloaded from 10+ beancount repositories

Full results available in workflow artifacts

@robcohen
robcohen merged commit 20ce9f7 into main Jul 2, 2026
39 checks passed
@robcohen
robcohen deleted the feat/tla-trace-to-test branch July 2, 2026 03:54
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.

2 participants