Repository navigation
fix(validate): no balance finding for a statement beancount's grammar discards - #3064
Merged
Merged
Conversation
robcohen
force-pushed
the
feat/lalr-delete-recovery
branch
from
November 27, 2026 12:25
a28c9b4 to
cb6ff42
Compare
… discards Which statements beancount drops now comes from the error oracle's reduction trace: rustledger_parser::beancount_drops_directive (new, public) asks whether beancount's grammar builds a statement at a directive's first token. transaction_holds_invalid_token delegates to it, replacing its hand-kept rule (fails_inside, fails_the_statement's allow-list, line_leads_with_an_invalid_token, holds_a_misgrouped_number); it agrees with every case those tests pin. The late balance check drops its findings for a balance beancount discards. So `Assets:A 1,23 USD` no longer adds an E3001 residual to its transaction, and `balance Assets:A 1 USD ~ 0.1` no longer reports E2002: bean-check 3.2.3 reports each statement's parse error alone. Both are pinned on every surface by new surface-agreement cases. (A dropped transaction's postings still update inventories, so a later balance can still fail: casc3, which needs parse-error locations plumbed to the validator.) WASM cache v150. Co-Authored-By: Claude Opus 5.5 <[email protected]>
robcohen
force-pushed
the
feat/lalr-dropped-statements
branch
from
November 27, 2026 13:04
003ec88 to
8241eb4
Compare
Contributor
📊 Benchmark Results
vs base, measured in this run
A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: What do these numbers mean?
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
This was referenced Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on main (#3061, #3062, #3063 merged).
What
Phase 6, the dropped-statement part: the validator learns which statements beancount discards from the error oracle's reduction trace, instead of a hand-kept rule.
rustledger_parser::beancount_drops_directive(source)(new, public). It answers: does beancount's grammar build no statement starting atsource's first token? It reads the oracle's trace of beancount's own parse with no deliberate differences applied, because the question is what beancount builds.sourceis the directive's text plus the line after it, so an invalid token on the next line that fails the statement counts too.transaction_holds_invalid_tokennow delegates to it (after its "starts with a transaction" check). Its hand-kept rule goes:fails_inside,fails_the_statement's allow-list of error kinds,line_leads_with_an_invalid_tokenandholds_a_misgrouped_number. The oracle-backed answer agrees with every case those tests pin (txn_failed_statement,line_start_bom_recovery,bom_mid_line_run: 47 tests).balancecheck, once it has reported something, asksdropped_by_beancountfor the directive. If beancount discards the directive, the findings are dropped. The transaction residual path keeps using the predicate as before.The three known cases
Assets:A 1,23 USDin a transactionbalance Assets:A 1 USD ~ 0.1Assets:A 1 $ USDmid-posting, thenbalance Assets:A 0 USDcasc2 and casc4 are surface-agreement cases, so
rledger check, the LSP, WASM and the FFI surfaces are all held to them.casc3 remains. The false E2001 comes from the dropped transaction's postings updating inventories. That update runs for every transaction, so asking the predicate there would re-lex every transaction of every ledger. It needs the locations of parse errors handed from the loader to the validator, so that only transactions holding a parse error are asked. That reaches
SourceLines/ValidationOptionsand the loader. It's the next step.Measurements
--check, the BOM matrix and the corpus baselines pass unchanged on main, so nothing is re-pinned.Ledgerarchives its validation findings. The loader cache stays at v82: every source this touches has a parse error, which the loader's cache is never saved for.🤖 Generated with Claude Code