Repository navigation
Conversation
Several cargo test suites compare rledger against Python beancount
directly (Command::new("bean-check")) and skip silently when the
binary is absent — which is every CI environment today. The
use-before-open silent-pass bug (#1742) sat on main behind exactly
that skip: test_account_lifecycle_consistency would have caught it,
but nothing ever ran it with bean-check on PATH.
Add a python-gated-cargo-tests job to the Compatibility workflow
(which already runs on push/PR/nightly and owns the python setup):
- pip install beancount, then ASSERT bean-check is runnable before
testing — if the binary breaks, the job goes red at the assert
instead of the tests green-skipping;
- run the two python-gated suites (rustledger integration_test,
rustledger-core synthetic_generation), with a comment pointing at
the grep that enumerates them;
- a final belt-and-braces step greps a rerun for the skip marker, so
a future availability-probe drift (different binary, container)
cannot reintroduce the silent skip.
Verified locally with bean-check available: the job catches exactly
the #1742 failure on current main (18 passed / 1 failed), so MERGE
ORDER MATTERS — land #1742 first or this job is red on arrival.
That red is the proof the gate works.
Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adds a dedicated CI job to the Compatibility workflow to ensure Rust integration tests that depend on Python Beancount tooling (notably bean-check) actually execute in CI instead of silently skipping when the binary isn’t present on PATH.
Changes:
- Introduces a new
python-gated-cargo-testsjob that installsbeancountvia pip and assertsbean-check --versionworks. - Runs the two Beancount-gated cargo test suites (
rustledgerintegration_testandrustledger-coresynthetic_generation). - Adds a “silent skip” guard intended to prevent future availability-probe drift from reintroducing false-green skipping.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # 2. run the python-gated suites. Keep this list in sync with | ||
| # `grep -rl 'Command::new("bean-' crates/*/tests`. |
There was a problem hiding this comment.
Good catch, and it surfaced a real gap: bean_price_compat.rs is a third python-gated suite this job wasn't running at all. Rather than narrowing the hint, d496e02 includes the suite (pip install beanprice, bean-price --version asserted) — the broad grep hint is now accurate.
| - name: Run python-gated test suites | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| run: | | ||
| cargo test -p rustledger --test integration_test -- --nocapture | ||
| cargo test -p rustledger-core --test synthetic_generation -- --nocapture | ||
| - name: Fail on silent skips | ||
| run: | | ||
| # Belt and braces: re-run and grep for the skip marker. The | ||
| # assert step above should make this unreachable, but if a test | ||
| # gains a new availability probe (a different binary, a | ||
| # container) this catches it green-skipping. | ||
| if cargo test -p rustledger --test integration_test -- --nocapture 2>&1 | grep -q "Skipping: Python beancount not available"; then | ||
| echo "::error::python-gated tests skipped despite bean-check being installed — availability probe drifted" | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
Both points fixed in d496e02 — the primary run tees to a log (set -o pipefail so tee can't mask a red cargo), and the skip check greps that log for every suite's actual skip marker (integration_test, synthetic_generation, bean_price_compat). No rerun, no masked failure, all suites covered.
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
…(review)
Two review catches, both real:
- The grep hint the job carried ('Command::new("bean-') matches the
bean_price_compat suite too — which turned out to be a third
python-gated suite the job wasn't running at all. Include it
(pip install beanprice, assert bean-price --version) rather than
narrowing the hint.
- The "Fail on silent skips" step re-ran only integration_test inside
an `if`, masking a failing rerun and covering one suite. The
primary run now tees to a log (set -o pipefail so tee can't mask a
red cargo), and the skip check greps that log for every suite's
actual skip marker.
Co-Authored-By: Claude Fable 5 <[email protected]>
What
Adds a
python-gated-cargo-testsjob to the Compatibility workflow so the cargo test suites that compare rledger against Python beancount actually run in CI — instead of silently skipping everywhere, forever.Why
Several cargo suites call
Command::new("bean-check")and skip with aneprintln!when it's missing — which is every CI environment today. The use-before-open silent-pass bug (#1742) sat on main behind exactly that skip:test_account_lifecycle_consistencyexisted, would have caught the bug, and never ran withbean-checkon PATH. This was the open question flagged in #1741/#1742.How
New job in
compat.yml(which already runs on push/PR/nightly and owns the Python setup convention):pip install beancount, then a dedicated step assertsbean-check --versionsucceeds — if the binary ever breaks, the job goes red at the assert rather than the tests green-skipping (a silent skip here would recreate the hole this job closes).rustledgerintegration_testandrustledger-coresynthetic_generation. A comment carries the grep (Command::new("bean-) that enumerates them, so the list is maintainable.Skipping: Python beancount not availablemarker — so a future availability-probe drift (renamed binary, container-based probe) can't quietly reintroduce the skip.Follows the existing job's conventions: same pinned action SHAs, same Python version, rust-cache omitted for the same license-check reason (comment cross-references it).
Land #1742 first. Verified locally with bean-check available: this job catches exactly the #1742 failure on current main (
integration_test: 18 passed / 1 failed —test_account_lifecycle_consistency;synthetic_generation: green). If this merges first, the job is red on arrival — which is the proof the gate works, but red main is red main.Also worth deciding: whether to add this job to branch protection as a required check (that's a repo-settings change only you can make).
🤖 Generated with Claude Code