Repository navigation
fix(plugin)!: native validation plugins report as beancount's do - #2594
Merged
Merged
Conversation
The plugins rledger has both natively and in Python reported the same ledger differently depending on which ran. The native check_commodity, leafonly, coherent_cost, onecommodity, unique_prices, commodity_attr and noduplicates now match beancount 3: its messages, as errors, at the entries beancount names. check_commodity is an error, not a warning, and reads the config ignore map; leafonly reports each parent once at its open; coherent_cost catches a currency held with and without cost; onecommodity reads its config, opt-out, costs and balances; unique_prices allows agreeing repeats; commodity_attr reads tuples. The python: built-ins match too. A conformance case holds each pair to bean-check's output. Deliberate divergences, documented: leafonly ignores a note, document, close or custom on a parent; noduplicates names the duplicate instead of printing Python reprs; set-joined lists are in a stable order. Closes #2539 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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?
|
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
Member
Author
Review loop
The loop converged. The required checks are green on 7001360. |
This was referenced Oct 11, 2026
Closed
Closed
Member
Author
|
Decisions (robcohen):
🤖 Generated with Claude Code |
…hon-alignment # Conflicts: # CHANGELOG.md # crates/rustledger/tests/plugin_conformance.rs
NoteData gained tags and links in #2588. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
robcohen
added a commit
that referenced
this pull request
Oct 11, 2026
…rance-rounding CHANGELOG: main's file plus this PR's entries. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
This was referenced Oct 13, 2026
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
The issue asked to list every plugin that exists both natively and in Python, diff their output, and align them on beancount's text and severity.
The pairs. There are two
python:built-ins:check_commodityandleafonly. Beancount 3's own plugin modules that run unchanged under the compat layer arecheck_commodity,close_tree,coherent_cost,commodity_attr,onecommodityandunique_prices, plusleafonlyandnoduplicatesonce #2592 lands. I checked each against bean-check, the native plugin and the Python versions on the same fixtures. Every native one differed exceptclose_tree(same inserted closes, no diagnostics).check_commoditycommodity 'USD' used but not declared; noopen/price-annotation currencies, no configMissing Commodity directive for 'USD' in 'Assets:Bank', beancount's occurrence rules and{account-re: currency-re}configleafonlyPosting to non-leaf account ... - has child accounts, unlocatedopen,Non-leaf account '...' has postings on it, tree order; apadcountscoherent_cost1 HOOLbeside1 HOOL {5 USD}Currency 'HOOL' is used both with and without cost, at the first without-cost txnonecommodityonecommodity: FALSE, multi-currencyopen, costs, balancesMore than one currency in account 'X': EUR,USD, and the cost-currency variant), at beancount's entry, all of those honoredunique_pricesDisagreeing price entries, located as beancount doescommodity_attrMissing attribute .../Invalid value ... valid options: ..., located;NoneornullnoduplicatesDuplicate transaction: ..., unlocatedDuplicate entry: <date> "<narration>"at the later copyThe
python:check_commoditybuilt-in now reads the config, andpython:leafonlycounts pads and uses tree order, so both agree with the native plugins.Severity change →
### Breaking:check_commodityis now an error, sorledger checkexits 1 on an undeclared commodity, as bean-check does. The old test pinning it as a warning came from a coverage matrix (#1038), not from a recorded decision.Deliberate divergences (commented at both implementations, in the docs and in the CHANGELOG):
leafonlyalso reports a parent account named only by anote,document,closeorcustom(its realization counts them), which I confirmed with bean-check. None of those posts anything, so rledger does not report them. This is the one place where correctness and beancount's text pull apart; flagging those would be a one-line change if you prefer compat.noduplicates: beancount prints both entries' Pythonrepr, so rledger keeps theDuplicate entry:prefix and names the duplicate instead. It also still compares transactions only, where beancount compares every directive type; that is a possible follow-up.onecommodity's currencies,commodity_attr's options) in an order that changes between runs. rledger sorts the currencies and keeps the options in config order.How tested (fail without the fix)
plugin_conformance::native_and_python_implementations_agree:check_commodity(also with a config) andleafonly(also with a pad), native vspython:built-in, compared line for line and against bean-check's text and location; the five other pairs held to bean-check's exact text and line. Every expected line was taken from bean-check on the same ledger. Without the fix it fails withwarning[PLUGIN]: commodity 'USD' used but not declared.native_plugins_test: 7 new alignment tests (config, occurrence rules, locations, opt-outs, tuples, agreeing duplicates) plus 4 updated ones. 12 fail without the fix.RLEDGER_REQUIRE_*: rustledger-plugin, -ops, -loader, -lsp, -wasm and rustledger. clippy (workspace, all features), fmt andcargo doc -D warningsare clean. Release-config clippy has only thewasm_plugins_dirdead-code error, which main already has and fix(cli): name the build with plugin runtimes when one is missing; plugin conformance on macOS and Windows #2593 fixes.Plugins with both implementations whose beancount module does not run under the compat layer yet (it needs
inventory,account_types,numberorloader):auto_accounts,check_average_cost,check_closing,check_drained,currency_accounts,implicit_prices,nounused,pedantic,sellgains. These are not compared here; a possible follow-up.Closes #2539
🤖 Generated with Claude Code
https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr