Skip to content

docs: correct stale Decimal Precision section (#1240 resolved) - #1614

Merged
robcohen merged 2 commits into
mainfrom
docs/decimal-precision-status
Jun 27, 2026
Merged

robcohen merged 2 commits into
mainfrom
docs/decimal-precision-status

Conversation

@robcohen

Copy link
Copy Markdown
Member

What

CLAUDE.md's Known Limitations → Decimal Precision section still described rust_decimal's 28-digit ceiling as an open compatibility failure ("1 compat test failure", "Rust considers it balanced") with a TODO to migrate to bigdecimal. That is stale.

Why

main already resolves #1240 with a two-tier balance validator in rustledger-booking (calculate_residual → calculate_residual_precise). Verified on the affected fixture:

$ rledger check tests/compatibility/files/beancount-lazy-plugins/tests_data_output_some_fund_output.beancount
x Transaction does not balance: residual 2.187500000E-25 USD

So rledger now detects exactly the residual the doc claimed it missed. Decimal remains rust_decimal — the fix is the validator, not the type.

Changes (docs only)

  • Rewrite the section to describe the two-tier validator and the verified 2.1875E-25 USD detection.
  • Move over-precise residuals into the Fixable compatibility bucket; narrow the Not fixable note to over-precise literals (>~28–29 digits), which no real ledger contains.
  • Record that a per-posting side channel to recover such literals was prototyped and rejected (PR feat(core): exceed Beancount decimal precision via a zero-cost side channel #1613 — would need exact-aware tolerance, cost/price weights, and metadata egress filtering), so it isn't re-attempted.

No code changes.

🤖 Generated with Claude Code

CLAUDE.md still described rust_decimal's 28-digit ceiling as an open compat
failure with a TODO to migrate to bigdecimal. That's stale: `main` already
resolves #1240 with a two-tier balance validator (calculate_residual ->
calculate_residual_precise), and `rledger check` now reports the some_fund
2.1875E-25 USD residual. Decimal stays rust_decimal.

Rewrite the section to describe the two-tier validator, move the over-precise
residual case into the 'Fixable' compat bucket, narrow the 'Not fixable' note to
over-precise *literals* (a non-issue, no real ledger has them), and record that
the literal-recovery side channel was prototyped and rejected (PR #1613) so it
isn't re-attempted.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI review requested due to automatic review settings June 27, 2026 14:34
@robcohen
robcohen requested a review from a team as a code owner June 27, 2026 14:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates CLAUDE.md to remove stale guidance about rust_decimal precision being an unresolved compatibility failure, and to document the current two-tier balance validation approach that detects ultra-small residuals (closing #1240’s original symptom) while keeping rust_decimal for performance.

Changes:

  • Reclassifies “over-precise residuals” as fixable and documents the two-tier residual computation (fast Decimal, escalated BigDecimal).
  • Narrows the “not fixable” limitation to over-precise literals (>~28–29 significant digits) and notes the rejected side-channel prototype (PR #1613).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CLAUDE.md Resolved
Comment thread CLAUDE.md Resolved
@codecov

codecov Bot commented Jun 27, 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 100%
Full AST Match 100%
Total Files 792
What's tested
  • Check: Exit codes and error counts match bean-check
  • BQL: Query results match bean-query
  • Files: ~800 test files downloaded from 10+ beancount repositories

Full results available in workflow artifacts

Per Copilot review: the two-tier escalation logic lives in
rustledger-validate (validate_transaction_balance), not rustledger-booking
(which only provides calculate_residual / calculate_residual_precise); and align
the '28-digit ceiling' wording with the '~28-29 significant digits' phrasing
used in the section below.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@robcohen
robcohen merged commit 7a60b84 into main Jun 27, 2026
33 checks passed
@robcohen
robcohen deleted the docs/decimal-precision-status branch June 27, 2026 14:44
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.

Replace rust_decimal with arbitrary-precision decimal to close last Python compat divergence

2 participants