Skip to content

fix(loader)!: read option values as beancount does, and make option "plugin" read-only - #2930

Merged
robcohen merged 7 commits into
mainfrom
fix/option-value-vocabulary
Nov 10, 2026
Merged

robcohen merged 7 commits into
mainfrom
fix/option-value-vocabulary

Conversation

@robcohen

@robcohen robcohen commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

What

Part 1 of #2925: rledger reads option values as beancount 3.2.3 does.

  • Booleans use beancount's two vocabularies. Options with the options_validate_boolean converter (render_commas, use_precise_interpolation, allow_pipe_separator, insert_pythonpath) read 1 / true / yes (any case) as true. infer_tolerance_from_cost has no converter, so grammar.option's bool branch reads it: true / on (any case) or 1. Any other word reads as false, as in beancount. rledger reports it as the new E7011 warning, so check passes as bean-check does. These are separate from parse_bool_word, which still serves render_commas: metadata, unchanged.
  • Tolerance maps: inferred_tolerance_default and display_precision share one parser, parse_tolerance_map. Like beancount's (.*):([\d\.]+), it splits at the last colon followed by a number, so A:B:0.01 is currency A:B, and it rejects a sign (USD:-0.01 is E7002).
  • tolerance_multiplier is read as beancount's D() reads it: empty is 0, commas and spaces are stripped, and a sign, an exponent and _ between digits are accepted. Downstream, 0 was already accepted ("0") and is a zero tolerance; booking and validate are untouched.
  • Dead options: experiment_explicit_tolerances and use_legacy_fixed_tolerances are removed from KNOWN_OPTIONS, so they are E7001, as beancount says "Invalid option". Their Options and CachedOptions fields are removed too.
  • option "plugin" is read-only (E7005, "may not be set") instead of deprecated (E7004). A read-only option in an included file now also gets E7005, not the E7009 warning, so plugin keeps failing the build from anywhere, as it does in beancount.
  • E7007 is dropped: a valid account_rounding gives no diagnostic. The option is inert in beancount 3.2.3 too, since fill_residual_posting is never called.
  • long_string_maxlines accepts any value with no diagnostic. beancount has no converter for it and never reads it.

Why

Each row was a difference from bean-check 3.2.3 (see #2925 and the verified plan in its last comment). Three of them changed a value, not just a diagnostic: render_commas "yes", infer_tolerance_from_cost "on" and A:B:0.01.

Deliberate deviations

  1. Unrecognized boolean word: false like beancount, plus a non-fatal E7011 warning (maintainer decision). bean-check reports nothing.

  2. Trailing text in a tolerance map (USD:0.01abc, which beancount reads as 0.01): still E7002 and not applied (maintainer decision). A Stricter than Python comment is on parse_tolerance_map, and test_parse_tolerance_map_trailing_text_is_rejected pins it.

  3. Not fixable locally: a value rust_decimal cannot hold exactly is E7002 here, though beancount accepts it. It is rejected, never rounded. This is commented on parse_beancount_decimal, parse_tolerance_map and exact_decimal, and pinned by test_set_tolerance_multiplier_non_finite_is_rejected, test_parse_beancount_decimal_unrepresentable_is_rejected and test_parse_tolerance_map_unrepresentable_number_is_rejected. It covers:

    • NaN, sNaN and Infinity in tolerance_multiplier;
    • a value outside rust_decimal's range (1e100, 1e-29), in tolerance_multiplier and in a tolerance map;
    • a value with more digits than rust_decimal holds, such as 0.0000000000000000000000000000001, which beancount holds as 1E-31;
    • non-ASCII digits in any numeric option value: "١" and "1" are 1 in beancount's tolerance_multiplier, and USD:١ is 1 in a tolerance map.
    • display_precision holds at most 28 decimal places, where beancount keeps any number of places;
    • dropping trailing zeros to fit 96 bits also lowers display_precision: USD:10000000000000000000000000000.0 reads as 0 places, while beancount reads 1.

    A zero significand is 0 at any exponent (0e100, 0E-50), as in beancount. The range is checked on the value, so 10e-29 and 0.1e29 are accepted.

Before / after

Each case is option "<key>" "<value>" followed by 2024-01-01 open Assets:A, run with bean-check 3.2.3 (nix develop .#bench) and with rledger check --no-cache from main (6afd960) and from this branch. The beancount value comes from loader.load_file(...)[2][key].

Option Value bean-check 3.2.3 (exit; value) rledger main rledger this PR
render_commas bogus 0, clean; False 1, E7002 0, E7011 (warning; reads false; deviation 1)
render_commas yes 0, clean; True 1, E7002 0, clean
render_commas YES 0, clean; True 1, E7002 0, clean
render_commas on 0, clean; False 1, E7002 0, E7011 (warning; reads false; deviation 1)
infer_tolerance_from_cost bogus 0, clean; False 1, E7002 0, E7011 (warning; reads false; deviation 1)
infer_tolerance_from_cost on 0, clean; True 1, E7002 0, clean
infer_tolerance_from_cost yes 0, clean; False 1, E7002 0, E7011 (warning; reads false; deviation 1)
infer_tolerance_from_cost 1 0, clean; True 0, clean 0, clean
use_precise_interpolation yes 0, clean; True 0, clean 0, clean
allow_pipe_separator yes 1, deprecated; True 1, E7004 1, E7004
insert_pythonpath yes 0, clean; True 0, clean 0, clean
allow_deprecated_none_for_tags_and_links TRUE 1, deprecated; True 1, E7001 1, E7001
long_string_maxlines abc 0, clean; 'abc' 1, E7002 0, clean
tolerance_multiplier (empty) 0, clean; Decimal('0') 1, E7002 0, clean
tolerance_multiplier 1,000 0, clean; Decimal('1000') 1, E7002 0, clean
tolerance_multiplier 1e-3 0, clean; Decimal('0.001') 0, clean 0, clean
tolerance_multiplier -0.5 0, clean; Decimal('-0.5') 0, clean 0, clean
tolerance_multiplier abc 1, Error for option; Decimal('0.5') 1, E7002 1, E7002
tolerance_multiplier NaN 0, clean; Decimal('NaN') 1, E7002 1, E7002 (deviation 3)
inferred_tolerance_default USD:-0.01 1, Error for option; {} 0, clean 1, E7002
inferred_tolerance_default A:B:0.01 0, clean; {'A:B': '0.01'} 1, E7002 0, clean
inferred_tolerance_default USD:0.01abc 0, clean; {'USD': '0.01'} 1, E7002 1, E7002 (deviation 2)
inferred_tolerance_default USD:.5 0, clean; {'USD': '0.5'} 0, clean 0, clean
inferred_tolerance_default USD 1, Error for option; {} 1, E7002 1, E7002
display_precision USD:-0.01 1, Error for option; {} 0, clean 1, E7002
display_precision A:B:0.01 0, clean; {'A:B': '0.01'} 1, E7002 0, clean
display_precision USD:0.01abc 0, clean; {'USD': '0.01'} 1, E7002 1, E7002 (deviation 2)
experiment_explicit_tolerances TRUE 1, Invalid option; '' 0, clean 1, E7001
use_legacy_fixed_tolerances TRUE 1, Invalid option; '' 0, clean 1, E7001
account_rounding Rounding 0, clean; 'Rounding' 1, E7007 0, clean
account_rounding bad-leaf 1, Error for option; None 1, E7002 1, E7002
plugin beancount.plugins.auto_accounts 1, may not be set; [] 1, E7004 1, E7005

Values on this branch: each is pinned by a unit test below. End to end, render_commas "yes" with a 1000.00 USD posting renders 1,000.00 USD in rledger query on this branch, and 1000.00 USD plus an E7002 on main.

Included-file rows (part 2, out of scope, unchanged except plugin):

Included file holds bean-check 3.2.3 rledger main rledger this PR
name_equity "capital", booking_method "fifo", render_commas "bogus" 1: two converter errors 0: 3x E7009 0: 3x E7009 (part 2)
name_equity "capital", booking_method "fifo", inferred_tolerance_default "USD:-0.01" 1: three converter errors 0: 3x E7009 0: 3x E7009 (part 2)
name_equity "Capital" + open Capital:Z 0: clean 1: E7009, E1005 1: E7009, E1005 (part 2)
option "plugin" "..." 1: may not be set 1: E7004, E7009 1: E7005

Canonical-function check

All option values still go through Options::set / set_scoped_at:

  • the loader;
  • the LSP (diagnostics.rs opts.set);
  • WASM options_from_raw and helpers.rs;
  • the FFI component (convert.rs, booking_method only).

Nothing outside options.rs parses option booleans or tolerance maps. A grep for parse_bool_word, split_once(':') and Decimal::from_str in wasm, ffi-wasi, ffi-component and lsp found no re-parsing. parse_bool_word now has one caller, meta_value_as_bool (metadata), and its doc says so. No BQL or other compat script registers any of these behaviors, so no KNOWN_ list changes.

Caches

CachedOptions loses two fields and the cached option values move, so:

How to test

cargo test -p rustledger-loader --lib options
cargo test -p rustledger-core bool_vocabulary

New tests in crates/rustledger-loader/src/options.rs: test_set_converter_boolean_options_read_like_beancount, test_set_infer_tolerance_from_cost_reads_like_grammar_option, test_set_unrecognized_boolean_word_is_false_with_a_warning (deviation 1), test_set_insert_pythonpath_unrecognized_word_warns, test_set_boolean_options_leave_metadata_vocabulary_alone, test_parse_tolerance_map_splits_on_last_colon_before_number, test_parse_tolerance_map_rejects_sign, test_parse_tolerance_map_trailing_text_is_rejected (deviation 2), test_parse_beancount_decimal_matches_d, test_set_tolerance_multiplier_empty_is_zero, test_set_tolerance_multiplier_non_finite_is_rejected (deviation 3), test_set_dead_tolerance_options_are_unknown, test_set_scoped_plugin_option_is_read_only_everywhere, test_set_account_rounding_valid_value_no_diagnostic, test_set_long_string_maxlines_accepts_any_value, plus the round-1 tests listed below. Updated: only_e7003_and_e7009_are_warnings (E7010, E7011 warnings; E7007 gone), the WASM both_paths_agree_for_every_option_code (E7011 case added), and core test_parse_bool_word_metadata_spellings (renamed; metadata vocabulary unchanged).

Review round 1

Commit 86413cd.

  1. tolerance_multiplier underscores (this was a regression against main): every _ is now dropped, as CPython's Decimal drops it. Only a value that is nothing but underscores is an error.
    • Checked against bean-check 3.2.3, which gives exit 0 for: _1 (1), ._5 (0.5), 1e_1 (10), 1__0 (10), 1_ (1), 1._5 (1.5).
    • _ gives exit 1 in both.
    • The test cases are flipped, and _1, ._5, 1e_1, 1_e1 and __ are added.
  2. CHANGELOG Breaking now covers three more changes:
    • an included option "filename" (E7009, exit 0, becomes E7005, exit 1);
    • exponent tolerance maps (USD:1e-2, clean on main, now E7002, deviation 2);
    • the moved codes (E7007 is gone; unrecognized booleans are E7011, not E7002).
  3. Deviation 3 is documented in full above, in errors.md and in the CHANGELOG.
    • 0e100, 0E-50 and -0e5 are 0 (bean-check: exit 0).
    • 1e100 and 1e-29 are E7002 (bean-check: exit 0, so they are part of deviation 3).
  4. Test gap closed: test_set_converter_boolean_options_read_like_beancount now has ("on", false) and ("off", false), with E7011 expected for those words. Adding on to the converter's true list now fails the test.
  5. parse_tolerance_map edge cases:
    • The colon must be on the value's first line, as (.*) does not cross a newline. "A\nB:0.5" is E7002, matching bean-check (exit 1, "Invalid value"). Pinned by test_parse_tolerance_map_colon_after_newline_is_rejected.
    • Unicode \d digits are not implemented; they are documented as part of deviation 3.
    • test_parse_tolerance_map_exponent_is_rejected pins USD:1e-2.
  6. rledger doctor list-options now prints the loader's known_options(), with option_value_kind() for the type and (read-only) from is_read_only_option(). All three are new public functions in rustledger-loader.
    • Only the one-line descriptions stay in the doctor.
    • test_option_description_covers_exactly_the_loader_options asserts that the listed names equal the loader's list, in order, and that insert_pythonpath is <bool>.
    • test_option_value_kind_covers_every_known_option asserts that every known option has a kind.

Gates were re-run, all exit 0:

  • fmt --check
  • clippy --all-features --all-targets -D warnings
  • RUSTDOCFLAGS=-Dwarnings cargo doc
  • cargo test --all-features --no-fail-fast for core, loader, rustledger, wasm, lsp, ffi-wasi, ffi-component and validate

Main has not moved, so the caches stay at loader 69 / WASM 92.

Review round 2

Commit 18fc58c.

  1. CHANGELOG Breaking now says what changed, option by option.
    • use_precise_interpolation and allow_pipe_separator read "1" and "yes" as silently false on main. Both are now true.
    • insert_pythonpath is still recorded as a string.
    • On those three options an unrecognized word was silent and is now E7011.
    • The Fixed E7011 entry now says the old E7002 applied only to render_commas and infer_tolerance_from_cost.
    • A newline in a tolerance map ("A\nB:0.5", exit 0 on main, now E7002 as in beancount) is listed under Breaking.
  2. New CHANGELOG "Added" section with:
    • rustledger_loader::{known_options, option_value_kind, is_read_only_option};
    • the rledger doctor list-options change: six more options, corrected types, and read-only markers.
  3. Deviation 3 is now scoped the same way in all four places (errors.md, CHANGELOG, this body, the code docs): non-ASCII digits in any numeric option value, and any value rust_decimal cannot hold exactly. Tested with "١" and "1".
  4. Exact or rejected. A new exact_decimal builds the value from its coefficient and scale with Decimal::try_from_i128_with_scale, and returns None when it cannot hold the value exactly. It replaces both the power > 28 cap and Decimal::from_str, which rounded silently.
    • 10e-29, 0.1e29 and the 29-digit 10000000000000000000000000000 are accepted. bean-check gives exit 0 for all three.
    • 0.0000000000000000000000000000001, as a multiplier or in a tolerance map, is E7002. bean-check gives exit 0, so this is deviation 3.
    • The written scale is kept where it fits, because display_precision reads it: USD:0.010 is still precision 3.
  5. Trailing whitespace in a tolerance map is accepted. "USD:0.5 " and "USD:0.5\n" give rledger exit 0 and bean-check exit 0. "USD:0.5 x" stays E7002 (deviation 2). Pinned by test_parse_tolerance_map_trailing_whitespace_is_accepted.
  6. option_value_kind drift: long_string_maxlines is now the any kind. test_option_value_kind_matches_what_set_accepts sets a value of each option's declared kind and asserts no diagnostic other than a deprecation, or E7005 for a read-only option.
  7. Docs table: docs/reference/options.md "All Options" adds use_precise_interpolation and insert_pythonpath, and long_string_maxlines is now typed any. A new crates/rustledger-loader/tests/options_docs_test.rs checks that the table lists exactly known_options().

Gates were re-run, all exit 0:

  • fmt --check
  • clippy --all-features --all-targets -D warnings
  • RUSTDOCFLAGS=-Dwarnings cargo doc
  • cargo test --all-features --no-fail-fast for core, loader, rustledger, wasm, lsp, ffi-wasi, ffi-component and validate

Main is unchanged, so the caches stay at loader 69 / WASM 92.

Review round 3

Commit 302c6fa.

  1. Quadratic exact_decimal, fixed. The function is now linear:

    • leading zeros are found once with position;
    • trailing zeros are counted once;
    • the trailing zeros to drop are computed (must_pop), not popped one rescan at a time.

    test_exact_decimal_is_linear_on_long_input runs a 160k-zeros-each-side value through both parsers and asserts it takes under 2 s. The old version took about 30 s. rledger check on the 320 KB display_precision repro now takes 0.03 s.

  2. Coefficients past 96 bits. A trailing zero is also dropped while the coefficient is past 2^96 - 1, and the written scale is kept otherwise.

    • These are accepted again, as a multiplier and in a tolerance map: 1000000000000000000000000000.00, 10000000000000000000000000000.0, 79228162514264337593543950335.0. bean-check gives exit 0 for each.
    • 79228162514264337593543950336 is still E7002.
    • Pinned by test_exact_decimal_drops_trailing_zeros_past_96_bits.
  3. CHANGELOG tolerance_multiplier.

    • New Breaking bullet: a value it cannot hold exactly was rounded silently and is now E7002.
    • The Fixed entry no longer says "stay".

Nits:

  • Breaking now lists "USD:0_5": clean on main, E7002 now (deviation 2), bean-check exit 0.
  • Tolerance-map Fixed entry reworded ("is an error"). It says USD:0.01abc was already an error and the exponent and underscore forms were clean before.
  • Fixed tolerance_multiplier entry mentions " 0.5" and "1 000". Both were E7002 on main and are now accepted; bean-check gives exit 0.
  • Zero exponents. A zero's final exponent must be within CPython's MIN_ETINY..MAX_EMAX.
    • 0e99999999999999999999 and 0e1000000000000000000 are E7002, matching bean-check (exit 1).
    • 0e999999999999999999 and 0e-1000000000000000000 are 0, matching bean-check (exit 0).
    • Pinned by test_parse_beancount_decimal_zero_exponent_bounds.
  • display_precision holds at most 28 places. This is now in deviation 3 in errors.md, the CHANGELOG, this body and the exact_decimal doc.
  • Whitespace is Python's str.isspace (Unicode White_Space plus U+001C to U+001F), through a new is_python_space. It applies to tolerance_multiplier's surrounding whitespace and after a tolerance map's number. Tested with \x0c, \xa0, \x1c and U+3000.
  • insert_pythonpath is now described as "Accepted for compatibility; no effect in rledger", in options.md and the doctor. The plugin runtime sets only a fixed PYTHONPATH=/lib and never reads the option.

Gates were re-run, all exit 0:

  • fmt --check
  • clippy --all-features --all-targets -D warnings
  • RUSTDOCFLAGS=-Dwarnings cargo doc
  • cargo test --all-features --no-fail-fast for core, loader, rustledger, wasm, lsp, ffi-wasi, ffi-component and validate

One test, python_plugin_wasi::ag_rledger_carries_the_runtime_download_and_compile_notices, failed once on an HTTP 500 while downloading the Python runtime, then passed on rerun.

Caches stay at loader 69 / WASM 92. main moved by #2927, but its caches are unchanged.

Review round 4

Commit bec84d3.

  1. Strip order. tolerance_multiplier is now read in beancount's order:

    • D() drops , and ASCII space;
    • then whitespace is trimmed with is_python_space;
    • then _ is dropped.

    Checked against bean-check 3.2.3:

    • "_\t1", "1\t_" and "1 _" (U+3000) give exit 1 in bean-check and are now E7002 here.
    • "_ 1" gives exit 0 in bean-check, not exit 1. D() removes the ASCII space first, leaving "_1", which is 1 (D("_ 1") returns 1 in Python). rledger reads it as 1 too.

    All four are in test_parse_beancount_decimal_strips_python_whitespace.

  2. The 96-bit pop loop is now tested. test_exact_decimal_drops_trailing_zeros_past_96_bits adds the 29-digit values that only the loop handles, each checked both as a multiplier and as USD:<value>:

    • 8000000000000000000000000000.0
    • 9999999999999999999999999999.0
    • 7922816251426433759354395034.0

    80000000000000000000000000000e-1 is checked as a multiplier only, because a tolerance map rejects exponents.

    With a bare option line, bean-check gives exit 0 for all four pop-loop rows (8000...0.0, 9999...9.0, 7922...4.0, 80000...0e-1) and for USD:8000000000000000000000000000.0, and this PR accepts all of them. (Corrected after round 5: an earlier version of this sentence misread the exit codes.) Disabling the loop (while false && ...) fails this test.

Nits:

  • MIN_ETINY edge. test_parse_beancount_decimal_zero_exponent_bounds now has 0e-1999999999999999997 (ok) and 0e-1999999999999999998 (err), matching bean-check (exit 0 and exit 1). Moving PYTHON_MIN_ETINY by +1 or by -1 fails the test.
  • Deviation 3 wording now reads "where beancount keeps any number of places" in all four places (errors.md, CHANGELOG, this body, the exact_decimal doc).
  • Deviation 3 adds the 96-bit trailing-zero effect on display_precision (USD:10000000000000000000000000000.0 reads as 0 places, while beancount reads 1).
  • sNaN is now listed in errors.md and the CHANGELOG.

Gates were re-run, all exit 0:

  • fmt --check
  • clippy --all-features --all-targets -D warnings
  • RUSTDOCFLAGS=-Dwarnings cargo doc
  • cargo test --all-features --no-fail-fast for core, loader, rustledger, wasm, lsp, ffi-wasi, ffi-component and validate

Main has not moved, and the caches stay at loader 69 / WASM 92.

Refs #2925 (part 2, options in included files and option locations, follows).

🤖 Generated with Claude Code

…plugin" read-only

Part 1 of #2925, checked against bean-check 3.2.3.

- Booleans use beancount's two vocabularies: the converter options
  (render_commas, use_precise_interpolation, allow_pipe_separator,
  insert_pythonpath) read 1/true/yes as true; infer_tolerance_from_cost,
  read by grammar.option, reads true/on/1. Any other word reads as false
  and is the new E7011 warning, so check passes as bean-check does.
  parse_bool_word keeps serving metadata unchanged.
- inferred_tolerance_default and display_precision share one parser that
  splits at the last colon followed by a number (A:B:0.01 is currency A:B)
  and rejects a sign (USD:-0.01). Text after the number stays E7002, a
  deliberate deviation.
- tolerance_multiplier is read as D(): empty is 0, commas are stripped,
  exponents are accepted. NaN and Infinity stay E7002 (not representable).
- experiment_explicit_tolerances and use_legacy_fixed_tolerances are
  unknown (E7001); their Options and CachedOptions fields are removed.
- option "plugin" is E7005 (may not be set) instead of E7004, from an
  included file too.
- E7007 is dropped: a valid account_rounding gives no diagnostic.
- long_string_maxlines accepts any value, as beancount has no converter.

Loader cache v69, WASM cache v92 (v91 is left to #2920).

BREAKING CHANGE: render_commas "yes", infer_tolerance_from_cost "on" and
tolerance maps like "A:B:0.01" now read as beancount reads them; the two
dead options are errors; Options loses two public fields.

Refs #2925

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@robcohen
robcohen requested a review from a team as a code owner November 10, 2026 15:38
@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.14040% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/rustledger-loader/src/options.rs 99.05% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown
Contributor

✅ Compatibility Test Results

Metric Result
Check Compatibility 100%
BQL Compatibility 100% (raw 93%, 179 masked)
Full AST Match 100%
Total Files 826
What's tested
  • Check: Exit codes and error counts match bean-check
  • BQL: Query results match bean-query
    The headline is the EFFECTIVE rate, after pairs where beanquery
    itself is wrong are masked. raw is the same run with nothing
    masked. A widening gap means the registry grew, not that rledger
    changed.
  • Files: ~800 test files downloaded from 10+ beancount repositories

Full results available in workflow artifacts

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

Shape rustledger beancount Speedup RSS (rledger / beancount)
simple 53.2ms ± 2.2ms 843.0ms ± 11.4ms 15.9x 45.2 MB / 50.9 MB
investment 81.4ms ± 2.1ms 3053.9ms ± 30.4ms 37.5x 47.1 MB / 59.1 MB
fifo 80.2ms ± 2.1ms 15688.4ms ± 341.7ms 195.6x 49.1 MB / 59.0 MB

vs base, measured in this run

Shape base this PR Change RSS base → PR
simple 52.1ms ± 0.8ms 53.2ms ± 2.2ms +2.1% ✅ within noise 45.0 MB → 45.2 MB (+0.5%)
investment 81.9ms ± 1.6ms 81.4ms ± 2.1ms -0.6% ✅ within noise 46.9 MB → 47.1 MB (+0.4%)
fifo 80.5ms ± 2.0ms 80.2ms ± 2.1ms -0.3% ✅ within noise 48.9 MB → 49.1 MB (+0.2%)

A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: simple 1.1ms, investment 1.2ms, fifo 1.3ms), and is at least 5%.
10,000 transactions per shape · 20 runs, 3 warmup · hyperfine

What do these numbers mean?
  • simple — Two-posting transfers, one currency. The historical workload — keep as the floor, not as the benchmark.
  • investment — Cost specs, per-unit prices and lot reductions. Exercises booking and inventory, which simple leaves at 0.3%.
  • fifo — Bare {} reductions against a FIFO account — how FIFO sells are normally written. The other four shapes reach the ordered-selection path twice in 2k transactions between them, so it was effectively unprofiled until it turned out to be quadratic (plan_ordered scans every lot per reduction: FIFO ledgers are quadratic (8.8s at 20k transactions) #2083).
  • vs base: the PR and the base-branch commit it is built on, built and measured in the same job
  • RSS: peak resident set size, a single sample — reported without a verdict because there is no spread to test it against
  • A shape with no beancount column is one bean-check reports errors on; it is timed for rledger only

- tolerance_multiplier drops every `_` as CPython's Decimal does (1__0,
  _1, 1._5, 1e_1), rejecting only an all-underscore value, and reads a
  zero significand as 0 at any exponent (0e100).
- Tolerance maps need the colon on the first line, as beancount's `.*`
  does not cross a newline.
- Deviation 3 is documented in full: values outside rust_decimal's range,
  and non-ASCII digits in a tolerance map, are E7002.
- The converter test pins that `on` and `off` are not its words.
- rledger doctor list-options prints the loader's known_options with
  option_value_kind, instead of a hand-written copy; a test keeps the
  descriptions in step.
- CHANGELOG Breaking lists the included `filename`, exponent tolerance
  maps and the moved diagnostic codes.

Refs #2925

Co-Authored-By: Claude Opus 5.5 <[email protected]>
robcohen and others added 5 commits November 10, 2026 11:28
- Numbers are read exactly or rejected: a value rust_decimal cannot hold
  exactly (out of range, or too many digits, e.g. 1E-31) is E7002 instead
  of silently rounded, in tolerance_multiplier and the tolerance maps. The
  range is checked on the value, so 10e-29 and 0.1e29 are accepted.
- Tolerance maps accept trailing whitespace, as beancount does; other
  trailing text stays E7002 (deviation 2).
- option_value_kind gives long_string_maxlines "any", and a drift guard
  sets a value of each declared kind and asserts `set` accepts it.
- docs/reference/options.md lists use_precise_interpolation and
  insert_pythonpath, and a test checks the table against known_options.
- CHANGELOG: Breaking says what changed per option; Added lists the new
  loader API and the doctor list-options change; deviation 3 covers
  non-ASCII digits in any numeric option and inexact values.

Refs #2925

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- exact_decimal is linear in its input: leading zeros are skipped once
  and the trailing zeros to drop are counted, not popped one rescan at a
  time. A 160k-digit display_precision value was quadratic (30 s).
- It also drops trailing zeros while the coefficient is past 96 bits, so
  79228162514264337593543950335.0 and 10000000000000000000000000000.0 are
  held again, as on main and in beancount.
- A zero's exponent is bounded by Python's MIN_ETINY / MAX_EMAX, so
  0e99999999999999999999 is an error as in bean-check.
- Whitespace is Python's str.isspace, in tolerance_multiplier and after a
  tolerance map's number.
- insert_pythonpath is described as accepted with no effect.
- CHANGELOG: tolerance_multiplier and USD:0_5 Breaking bullets, corrected
  Fixed wording, display_precision's 28-place limit under deviation 3.

Refs #2925

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keeps both sides' CHANGELOG entries; caches stay at loader 69 / WASM 92.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- tolerance_multiplier strips in beancount's order: D() drops commas and
  spaces, then Decimal strips whitespace, then drops `_`. So "_\t1",
  "1\t_" and "1<U+3000>_" are E7002, as in bean-check; "_ 1" stays 1.
- Tests pin the 96-bit pop loop with 29-digit coefficients and the
  MIN_ETINY edge for a zero's exponent.
- Deviation 3 says display_precision keeps at most 28 places where
  beancount keeps any number, that dropping a trailing zero to fit 96 bits
  lowers it, and lists sNaN.

Refs #2925

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

1 participant