Skip to content

chore(compat): pin order-by-expression's render_commas gap as a Python divergence - #2359

Merged
robcohen merged 1 commit into
mainfrom
chore/bql-render-commas-pins
Sep 20, 2026
Merged

robcohen merged 1 commit into
mainfrom
chore/bql-render-commas-pins

Conversation

@robcohen

Copy link
Copy Markdown
Member

Three of the seven unmasked BQL mismatches (#2358) are the render_commas gap that is already registered for these same three fava-investor fixtures on a dozen other queries. This extends that block to order-by-expression.

The attribution was checked before pinning, because putting this in the wrong list would mask an rledger bug:

  • render_commas is a real beancount option (parser/options.py), default False.
  • beancount consumes it: parser/grammar.py calls self.dcontext.set_commas(self.options["render_commas"]).
  • beancount's own printer honors it.
  • render_commas appears nowhere in beanquery's source; its renderer never consults the ledger's dcontext for grouping.
  • All three upstream fixtures set option "render_commas" "True" on line 3.

So we honor a documented option the user set and bean-query is not wired to it, which is the existing block's conclusion and why it sits in KNOWN_PYTHON_DIVERGENCES. Our side stays pinned by render_commas_applies_to_every_column_kind and beancount_output_honors_render_commas_like_format.

The values agree once grouping is removed: SELECT number + 1 gives -1399999 / -19999 / -139999 from bean-query against -1,399,999 / -19,999 / -139,999 from us.

These pairs were unpinned only because order-by-expression postdates the block (added in #2215 for #2177), not because anyone judged them differently.

Verification

  • scripts/compat-bql-test.py --self-test passes (stale/dangling detection).
  • Loaded the module and asserted all three pairs are in KNOWN_PYTHON_DIVERGENCES and in neither KNOWN_RUST_DIVERGENCES, with a deliberately bogus pair checked absent so the membership test is shown able to report "missing".
  • The stale-mask gate cannot fire on these: both run 35506421038 (150 files) and run 35486145461 (673 files, full coverage) report them as mismatching.

Expected effect on the next compat run: Real mismatches goes 7 to 4. The remaining four stay unmasked on purpose, and #2358 tracks them: two files of upstream's 1e-7 plugin drift, and two trailing-zero scale differences pointing in opposite directions that are not characterized yet.

Refs #2358.

🤖 Generated with Claude Code

https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr

…n divergence

`order-by-expression` hits the same bean-query grouping gap already registered
for these three fava-investor fixtures on a dozen other queries: they set
`option "render_commas" "True"`, beancount consumes the option and we honor it,
and beanquery never reads it. `SELECT number + 1` returns `-1399999` from
bean-query against our `-1,399,999`, identical once the separators come out.

The pairs went unpinned only because the query postdates the block, having been
added in #2215 for #2177. These were three of the seven unmasked mismatches the
suite has been reporting at every coverage level (#2358); the remaining four are
two files of upstream's 1e-7 plugin drift and two uncharacterized scale
differences, which stay unmasked.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
@codecov

codecov Bot commented Sep 20, 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

Copy link
Copy Markdown
Contributor

✅ Compatibility Test Results

Metric Result
Check Compatibility 100%
BQL Compatibility 99% (raw 93%, 172 masked)
Full AST Match 100%
Total Files 813
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 merged commit d8c9f6b into main Sep 20, 2026
42 checks passed
@robcohen
robcohen deleted the chore/bql-render-commas-pins branch September 20, 2026 13:52
robcohen added a commit that referenced this pull request Sep 20, 2026
… causes (#2361)

All four remaining `order-by-expression` mismatches extend blocks that already
adjudicate the same mechanism on the same fixtures. Like #2359, they went
unpinned only because the query postdates those blocks.

Each cause was reproduced locally against beancount 3.2.3 and beanquery 0.2.0
with the corpus plugins at the commits CI pins, rather than read off the diff:

- `missing_prices`: `{{25.61 GBP}}` makes beancount re-derive the total through
  a division, so it reports `-25.61000000000000000000000000` where we report
  `-25.61`. Python list, with the existing `@@` re-multiplication note.
- `long_short`: upstream RECOMPUTES the gain as `(cost - price) * abs(units)`,
  and the authored `1.50` carries scale 2. Removing the plugin line shows
  beancount itself interpolating `-50` at scale 0, so the scale is the
  plugin's, not our interpolation's. Rust list, with the existing note.
- `cool_fund_example` and `some_fund_example`: the 1e-7 valuation drift of
  #2018, plus a second cause on the same pairs. Our valuation plugin computes
  the PnL amount that upstream leaves to interpolation, so it carries dust
  (`-25.00` against `-25.00000000000000000000000001`). Filed as #2360 and
  called out in the pin comment, because one pin now covers two causes.

Refs #2358.


Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr

Co-authored-by: Claude Opus 5 (1M context) <[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