Skip to content

test(tla): weekly bounds-escalated corpus replay - #1694

Merged
robcohen merged 1 commit into
mainfrom
feat/tla-escalated-bounds
Jul 2, 2026
Merged

robcohen merged 1 commit into
mainfrom
feat/tla-escalated-bounds

Conversation

@robcohen

@robcohen robcohen commented Jul 2, 2026

Copy link
Copy Markdown
Member

FV backlog: scheduled depth beyond the committed corpora's small CI bounds — 903,210 behaviors across all 7 specs replay green in ~12s at escalated bounds, without committing the large files.

Spec Escalated coverage
AVERAGE 221,613 value-checked behaviors (63k states)
FIFO / LIFO / HIFO 221,060 each (111k states)
NONE 10,360 · Conservation

Pieces

  • scripts/tla-escalated-replay.py — regenerates every corpus at a per-spec ESCALATED bounds table (respecting derive/replay assumptions: STRICT keeps MaxUnits=1/MaxCurrency=2). Drift guard: a committed corpus without an escalation entry fails fast — otherwise the replay's graceful corpus-skip would turn the gap into a vacuous green (hazard found while building this, by watching exactly that happen).
  • tla_behavior_replay.rs — RUSTLEDGER_TLA_BEHAVIORS_DIR override; the corpus-completeness guard becomes the exact invariant (behaviors == declared count) after the old transitions×90% heuristic false-positived at scale (STRICT's canonical dedup legitimately collapses more transitions at larger bounds).
  • .github/workflows/tla-escalated.yml — weekly (Sun 04:30 UTC) + workflow_dispatch, with per-spec coverage in the job summary.

Verified locally end to end with real TLC; committed corpora stay green; clippy -D warnings + fmt clean.

🤖 Generated with Claude Code

The committed corpora cover each spec's small CI bounds exhaustively; this
adds scheduled depth beyond them without committing large files:

- scripts/tla-escalated-replay.py: regenerates every corpus at larger bounds
  (per-spec ESCALATED table respecting derive/replay assumptions —
  STRICTCorrect keeps MaxUnits=1 and MaxCurrency=2) into a scratch dir. A
  drift guard fails fast if a committed corpus lacks an escalation entry, so
  a new spec cannot silently skip escalated coverage (the replay's graceful
  corpus-skip would otherwise turn the gap into a vacuous green).
- tla_behavior_replay.rs: RUSTLEDGER_TLA_BEHAVIORS_DIR points the replay at
  an alternative corpus directory. The corpus-completeness guard is now the
  exact invariant (behaviors == the corpus's declared count, non-zero) — the
  old transitions*90% heuristic false-positived at escalated bounds, where
  canonical dedup legitimately collapses more STRICT transitions.
- .github/workflows/tla-escalated.yml: weekly (Sun 04:30 UTC) + manual
  dispatch — generate escalated corpora, replay, summarize coverage.

Proven locally end to end: 903,210 escalated behaviors across all 7 specs
replay green in ~12s (AVERAGE: 221,613 value-checked behaviors at 63k
states; FIFO/LIFO/HIFO: 221k each), and the committed corpora stay green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@robcohen
robcohen requested a review from a team as a code owner July 2, 2026 18:35
Copilot AI review requested due to automatic review settings July 2, 2026 18:35
@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!

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

Tool Time Memory
rustledger 35.8ms ± 0.9ms 23.8 MB
beancount 806.1ms ± 3.9ms 50.6 MB
Comparison 22.5x faster 2.1x less

vs main branch (2026-07-02)

Metric main this PR Change
Time 39.8ms 35.8ms -10.1% 🟢
10K transactions · 5 runs, 2 warmup · hyperfine
What do these numbers mean?
  • Time: Wall-clock time to parse and validate the ledger (± std dev)
  • Memory: Peak resident set size (RSS)
  • vs main: Compared to latest nightly benchmark on main branch

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

Adds a scheduled “bounds-escalated” TLA+ behavior-corpus regeneration + replay path so the repo can regularly validate conformance beyond the small committed CI corpora, without committing the large escalated JSON files.

Changes:

  • Introduces scripts/tla-escalated-replay.py to regenerate all committed behavior corpora at per-spec escalated bounds into a scratch directory, with a drift guard to ensure coverage isn’t silently skipped.
  • Updates tla_behavior_replay.rs to support RUSTLEDGER_TLA_BEHAVIORS_DIR overrides and to tighten the corpus completeness check to an exact behaviors == declared invariant.
  • Adds a weekly + manual GitHub Actions workflow to run the escalated regeneration + replay and publish per-spec coverage in the job summary.

Reviewed changes

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

File Description
scripts/tla-escalated-replay.py New script to regenerate escalated corpora (without committing them) and enforce an escalation-entry drift guard.
crates/rustledger-core/tests/tla_behavior_replay.rs Adds corpus directory override and changes the completeness invariant to match declared behavior counts.
.github/workflows/tla-escalated.yml New weekly workflow to generate escalated corpora, replay them, and emit coverage summary output.
Comments suppressed due to low confidence (1)

crates/rustledger-core/tests/tla_behavior_replay.rs:53

  • When RUSTLEDGER_TLA_BEHAVIORS_DIR is set but the corpus file is missing (wrong dir, empty env var, partial generation), the test currently does a graceful skip and can become vacuously green. Treat an explicit override as required input: fail if the file isn’t found; keep the graceful skip only for the default committed-corpus path (published-crate builds).
    let path = match std::env::var("RUSTLEDGER_TLA_BEHAVIORS_DIR") {
        Ok(dir) => std::path::PathBuf::from(dir).join(format!("{spec}.json")),
        Err(_) => std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
            .join(format!("../../spec/tla/behaviors/{spec}.json")),
    };
    // Graceful skip when spec/ isn't packaged (published-crate builds strip
    // it, and the Nix flake's source filter does too — the #1659 lesson).
    let Ok(raw) = std::fs::read_to_string(&path) else {
        eprintln!(
            "skipping: {} not present (published-crate build)",
            path.display()
        );
        return None;
    };

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

Comment thread scripts/tla-escalated-replay.py Resolved
Comment thread scripts/tla-escalated-replay.py Resolved
Comment thread scripts/tla-escalated-replay.py Resolved
Comment thread .github/workflows/tla-escalated.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 5d1cb96 into main Jul 2, 2026
46 checks passed
@robcohen
robcohen deleted the feat/tla-escalated-bounds branch July 2, 2026 18:57
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