Repository navigation
test(compat): table every check beancount reports, and guard it against drift - #3054
Merged
Merged
Conversation
Contributor
📊 Benchmark Results
vs base, measured in this run
A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: What do these numbers mean?
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
robcohen
force-pushed
the
feat/upstream-check-coverage
branch
from
November 27, 2026 03:45
9c179fb to
e602f48
Compare
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
robcohen
force-pushed
the
feat/upstream-check-coverage
branch
from
November 27, 2026 04:59
8838253 to
8c697b4
Compare
…st drift
ops/validation.py one function at a time. This does that walk for every
module and leaves a guard behind.
- crates/rustledger/tests/fixtures/upstream-checks/enumerate.py lists every
check the installed beancount can report, from its source (ast): each
error-tuple construction (module.function + message template), each raise
in ops/parser/plugins/loader, each plugin module, each deprecated option.
126 for beancount 3.2.3, plus one manual row (gpg decryption).
- checks.toml gives each a status: 96 covered, 2 deliberate deviations,
24 not applicable (dead code, unreachable, beancount tooling), 5 missing.
- Each covered row names a small ledger in cases/. upstream_checks_test runs
it through rledger check and bean-check and asserts the lines each tool
reports the row's code/message on, so "covered" means the same lines, or
the row's note says how they differ. Missing and deviation rows are pinned
the same way, so a fix cannot leave the table stale.
- The drift guard compares enumerate.py's output with the table's ids, both
ways, so a beancount upgrade that adds, removes or rewords a check goes
red and names it. It introspects rather than hashing the scanned files: a
hash goes red on any docstring edit and does not say which check changed.
- The Python half runs in the python-gated-cargo-tests job (skip marker
already in its grep); the rledger half runs in every cargo test.
- compatibility.md gains section 20: AVERAGE booking and {*} merging, which
beancount 3.2.3 refuses and rledger implements (ADR 0007).
- docs/reference/upstream-checks.md documents the table and how to update it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…parity manifest
The case ledgers are tracked .beancount files, so the parse-error-parity job
compares them. All match but grammar-duplicate-merge ({*, *}, a missing row,
bc-only until the follow-up fix). beancount's deprecation error for
allow_deprecated_none_for_tags_and_links joins NOT_PARSE_ERRORS beside
allow_pipe_separator's: rledger reports option errors when it loads.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t the Python runtime The slim release build (no default features) reports a Python module name as E8005, runtime not compiled in, where the default build reports E8004. A row's code may now list alternatives (E8004|E8005); each is still an exact assertion on the line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rface differences #3055's corpus includes crates/rustledger/tests, so it runs the upstream-check cases. Five hit existing classes (no disk for document roots, a file map's own words for a load error, the LSP's E8006 for an unsupported plugin), and one is new and OPEN: a check_closing balance is at <check_closing>, 0 in check and in the ledger file on every other surface. Co-Authored-By: Claude Opus 5.5 <[email protected]>
robcohen
force-pushed
the
feat/upstream-check-coverage
branch
from
November 27, 2026 05:59
8c697b4 to
ba20d50
Compare
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.
What
A coverage table for every check beancount 3.2.3 can report, with a mechanism that keeps it complete.
crates/rustledger/tests/fixtures/upstream-checks/enumerate.pylists the checks in the installed beancount by reading its source withast. That covers every error-tuple construction incore/ ops/ parser/ plugins/ loader.py(keyedmodule.function:message template), everyraiseinops/ parser/ plugins/ loader.py(option converters, plugin config), every plugin module, and every deprecated option. That is 126 ids, plus one manual row for gpg decryption, which the scan cannot see.checks.tomlgives each id a status, the rledger code and function, and the test or case that pins it:{*}merging; new compatibility.md section 20)if False, functions nothing calls, branches the sorted pipeline cannot reach, beancount's test and tooling helpers)upstream_checks_test.rshas four tests:rledger check: the row's code appears on exactly the row's lines;bean-check: the row's message appears on exactly the row's lines;enumerate.py's ids and the table's ids are the same set. A beancount upgrade that adds, removes or rewords a check fails it and names the check."Covered" therefore means both tools report on the same line, unless the row's
notesays how they differ (beancount's<load>:0against rledger's include line, or a booking error on the transaction line against one on the posting line). Themissinganddeviationrows are pinned the same way, so a fix that changes behavior has to update its row.The two Python tests are added to
python-gated-cargo-tests. They print the existingSkipping: Python beancount not availablemarker, which that job already fails on. The rledger half runs in everycargo test.Why introspection rather than a hash of the scanned files: a hash goes red on any edit to those files, a docstring or a refactor included, and does not say which check changed. Keying on error sites goes red only when a check is added, removed or reworded, and the failure names it.
Why
#3044 and #3045 were checks nobody had ported. They were found by reading
ops/validation.pyby hand. This does that walk for every module in scope (validation, balance, pad, documents, options, grammar builder, booking, interpolation, loader, all plugins) and keeps it done.Missing rows (left for follow-up)
Duplicate merge-cost spec({*, *}is accepted silently)Amount is zero(a zero-unit posting held at cost is accepted)plugin "beancount.plugins.auto"(no native counterpart)allow_deprecated_none_for_tags_and_links(reported as an unknown option, E7001, rather than as deprecated)Cannot infer price for postings with units held at cost: a bare@ USDbeside a cost is deliberately inert in rledger (fix(booking): answer a bare price sigil instead of ignoring it #1919). This one needs a maintainer decision.The fixes for the first four are in #3057, stacked on this PR.
The case ledgers are tracked
.beancountfiles, so they are pinned intests/baselines/parse-error-parity.manifest(second commit). All of them arematchexceptgrammar-duplicate-merge, which staysbc-onlyuntil #3057.Allowing None for tags and linkjoinsNOT_PARSE_ERRORS, next to the pipe-separator deprecation.How to test
To see the guard fail, rename any row's
idinchecks.toml: the test lists the id as untracked on one side and stale on the other.🤖 Generated with Claude Code