Skip to content

docs(migration): same-day lot pooling agrees with beancount since #2118 - #2488

Merged
robcohen merged 3 commits into
mainfrom
docs/stale-same-day-pooling-2392
Oct 8, 2026
Merged

robcohen merged 3 commits into
mainfrom
docs/stale-same-day-pooling-2392

Conversation

@robcohen

@robcohen robcohen commented Oct 7, 2026

Copy link
Copy Markdown
Member

What

#2118 was fixed in v0.23.0 (#2139): lots that agree on commodity, cost, date and label are now stored as one position, as Python beancount stores them. Two places still described it as an open divergence:

Verified

  • The guide's worked example on both engines today: rledger check and bean-check are both clean. Both leave 10 ACME {20.00 USD} and 5 ACME {10.00 USD} and book -150.00 USD to Income:Gains. The sale consumes -15 ACME {10.00 USD} on both.
  • compat-booking-fuzz.py --self-test: passed.
  • compat-booking-fuzz.py --runs 250 (seeds 0-249, the window CI runs on a PR) against current main: 250/250 agreed, 0 #2118-shaped divergence(s), 0 other unexplained divergence(s), exit 0.
  • The tripwire fires on a real regression. Against the v0.22.0 release binary (before fix(core): store interchangeable lots as one position #2139), seed 117 (one of the seeds the old waiver cited) prints [#2118 REGRESSION? ...] and exits 1. The current binary agrees on the same seed. Other old seeds can't be replayed against v0.22.0, because its query --format json predates positional rows (query -f json silently drops a column when two columns share a name #2178).

Closes #2392

🤖 Generated with Claude Code

https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr

The migration guide's "Repeated same-day lots" item and the booking
fuzzer's "expected" bucket still described #2118 as an open divergence.
It was fixed in v0.23.0 (#2139): interchangeable lots are stored as one
position, as Python beancount does.

- docs/migration/from-beancount.md: the worked example now books the same
  on both engines (checked: 10 ACME {20.00 USD} + 5 ACME {10.00 USD} left,
  -150.00 USD gain, bean-check clean). The item now says the engines
  agree since v0.23.0 and what older releases did.
- scripts/compat-booking-fuzz.py: the #2118 waiver is now a tripwire. A
  divergence on a ledger with a repeated lot identity within a date is
  labeled as a likely #2118 regression, counted on its own line, and
  fails the run. same_totals (only used by the waiver) is gone; a new
  classify() carries the verdict and has its own self-test cases.
- compat.yml: the step comment no longer says #2118 does not fail CI.

Verified: self-test passes; seeds 0-249 (the PR window) agree 250/250
with the current binary; the v0.22.0 release binary trips the tripwire
on seed 117 (exit 1).

Closes #2392

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
@robcohen
robcohen requested a review from a team as a code owner October 7, 2026 20:03
@github-actions

github-actions Bot commented Oct 7, 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 819
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

@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@robcohen

robcohen commented Oct 8, 2026 •

Copy link
Copy Markdown
Member Author

Review (adversarial pass): can the tripwire fire on a legitimate divergence?

The shape test. pooling_shape(days, costs, labels) is computed from the generator's own lots, not from the divergence. It is true only when some (cost, label) identity repeats non-contiguously within one acquisition date ([a, b, a] on one day). That is the one ordering where beancount's (currency, cost)-keyed pooling used to reorder consumption against rustledger's per-acquisition slots. It is false for contiguous repeats ([a, a, b]), repeats across different dates, and identities separated by labels. The self-test pins all five cases.

Why it adds no false-positive risk.

Measured.

  • Seeds 0–249 (the fixed PR window) contain 23 pooled-shape ledgers. Sweeps of 2000 seeds from 10000 and from 500000 contain 187 and 188.
  • All 4250 seeds agree with a binary built from this branch on a per-worktree target: 0 #2118-shaped, 0 other.
  • The tripwire does fire on the real regression: the v0.22.0 binary fails seed 117 with the [#2118 REGRESSION? …] tag.

No code changes from this pass.

Second pass: cross-PR

In a test merge onto main after #2496 and #2490, this PR conflicts only on the CHANGELOG.md ### Fixed top-insert. Keep both entries. There are no code conflicts.

Third pass

  • No dead code. The fuzzer no longer references same_totals, the expected verdict or the waiver. classify is the single verdict function, and the self-test covers it.
  • Ruff. It reports 2 findings, both in code this PR didn't add (ISC004 in the report list, RUF015 in the self-test). Main's copy of the script has 3.
  • Docs and CHANGELOG are accurate. The fix (fix(core): store interchangeable lots as one position #2139) first shipped in v0.23.0, and the guide's example books the same on both engines.

@robcohen
robcohen merged commit 7f7b90d into main Oct 8, 2026
44 checks passed
@robcohen
robcohen deleted the docs/stale-same-day-pooling-2392 branch October 8, 2026 05:20
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.

Docs and booking fuzzer still describe #2118 (same-day lot pooling) as an open divergence

1 participant