Skip to content

docs: document repeated-metadata strictness as deliberate difference P12 - #3091

Merged
robcohen merged 1 commit into
mainfrom
docs/duplicate-meta-stricter
Nov 29, 2026
Merged

robcohen merged 1 commit into
mainfrom
docs/duplicate-meta-stricter

Conversation

@robcohen

Copy link
Copy Markdown
Member

What

Records rledger's stricter handling of a repeated metadata key as a deliberate parse-error difference (new P12 in docs/reference/compatibility.md). Behavior does not change.

  • report_duplicate_metadata (cst/convert.rs): the inline "Stricter than Python" comment now describes beancount's behavior as observed from outside, and points to P12 and the pinning test.
  • test_parse_reports_a_repeat_with_an_identical_value_unlike_python (tests/metadata_shapes.rs) now also covers postings, an empty value (kk:), and a third line that repeats the first value.
  • CHANGELOG entry.

How beancount behaves (checked against beancount 3.2.3 with bean-check / parser.parse_string)

  • On a transaction or a posting, a key repeated with the same value as its first one gets no error when that value is TRUE/FALSE, an empty or one-character string, an account, a tag, or empty.
  • A repeat of a longer string, a currency, a number, a date, an amount or an expression is reported. So is any repeat whose value differs from the first, e.g. Assets:A followed by the string "Assets:A".
  • Each repeat is compared with the first value. "a", "b", "a" gives one error in beancount and two in rledger. TRUE, FALSE, TRUE behaves the same way.
  • Other directives (open, note, event, price, balance) report no repeat at all, in both beancount and rledger.

rledger reports every repeat. This follows the Python compatibility policy: the quirk can be fixed locally, and the maintainer decided not to copy it in #2897.

Harness

  • No oracle overlay. The repeat comes from a builder check, which the reconciler leaves standing.
  • No manifest change. None of the corpora contains this case. compat-parse-error-parity.py --check and compat-semantic-parity.py --check both pass on the unchanged manifests (semantic match rate 99.93%).

Testing

  • cargo test -p rustledger-parser
  • cargo test -p rustledger --test upstream_checks_test
  • cargo clippy -p rustledger-parser --all-features --all-targets -- -D warnings
  • both parity --check runs

🤖 Generated with Claude Code

@robcohen
robcohen requested a review from a team as a code owner November 28, 2026 23:48
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

Shape rustledger beancount Speedup RSS (rledger / beancount)
simple 41.3ms ± 2.5ms 578.6ms ± 7.5ms 14.0x 44.9 MB / 50.9 MB
investment 62.2ms ± 0.9ms 2113.6ms ± 4.3ms 34.0x 47.1 MB / 59.0 MB
fifo 60.6ms ± 0.7ms 11704.2ms ± 55.7ms 193.0x 49.1 MB / 58.9 MB

vs base, measured in this run

Shape base this PR Change RSS base → PR
simple 41.1ms ± 0.6ms 41.3ms ± 2.5ms +0.5% ✅ within noise 45.0 MB → 44.9 MB (-0.2%)
investment 61.8ms ± 0.6ms 62.2ms ± 0.9ms +0.7% ✅ within noise 47.0 MB → 47.1 MB (+0.0%)
fifo 60.3ms ± 0.7ms 60.6ms ± 0.7ms +0.6% ✅ within noise 49.0 MB → 49.1 MB (+0.1%)

A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: simple 1.1ms, investment 0.5ms, fifo 0.4ms), 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

@codecov

codecov Bot commented Nov 28, 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 Nov 29, 2026 •

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 828
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

@robcohen
robcohen force-pushed the docs/duplicate-meta-stricter branch from 296cf28 to 35f0e16 Compare November 29, 2026 00:40
…rror difference P12

beancount 3.2.3 stays silent on a transaction or posting metadata key
repeated with the same value as its first one when that value is TRUE /
FALSE, an empty or one-character string, an account, a tag or empty, and
compares each repeat with the first value. rledger reports every repeat
(#2897), on purpose. Document it as P12 in compatibility.md, restate the
inline comment at report_duplicate_metadata from black-box observation,
and extend the pinning test to postings, empty values and a repeat back
to the first value. No behavior change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@robcohen
robcohen force-pushed the docs/duplicate-meta-stricter branch from 35f0e16 to a212f18 Compare November 29, 2026 00:45
@robcohen
robcohen merged commit 9b45e2c into main Nov 29, 2026
66 of 68 checks passed
@robcohen
robcohen deleted the docs/duplicate-meta-stricter branch November 29, 2026 02:02
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