Repository navigation
fix(parser): push and pop take effect exactly where beancount builds them - #3096
Merged
Merged
Conversation
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?
|
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
robcohen
force-pushed
the
fix/pushpop-oracle-state
branch
from
November 29, 2026 01:16
f9ff33b to
93d7d43
Compare
…them A pushtag/poptag/pushmeta/popmeta its error recovery builds in the middle of a broken line (` poptag #trip` in a transaction body, `P popmeta k:`, `option "a" "b"pushtag #x`) now pushes or pops: the converter replays its tag and metadata stacks over the directives the error oracle records as built (`built_state_directives`), instead of re-deriving "a push or pop whose line has an error changes no state" (#2995). The full-trace reference is computed once and shared with the reconciliation. A semantic slot (beancount builder error, e.g. a pop of an absent tag) is now covered first by rledger standing builder error on the line, so a stray \r or a leftover syntax diagnostic no longer reports it twice. Parse-error parity: 122,378 -> 122,430 of 123,394 (52 pins dropped, no regressions). Loader cache v83, WASM cache v165. Co-Authored-By: Claude Opus 5.5 <[email protected]>
robcohen
force-pushed
the
fix/pushpop-oracle-state
branch
from
November 29, 2026 02:59
93d7d43 to
acda85b
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
What
A
pushtag,poptag,pushmetaorpopmetanow takes effect exactly where beancount 3.2.3's grammar builds it, around syntax errors too. The converter replays its tag and metadata stacks over the push/pop directives the error oracle records as built (oracle::beancount::built_state_directives, new), instead of re-deriving "a push or pop whose line has an error changes no state" (#2995) itself.Why
That rule missed the pushes and pops beancount's error recovery builds in the middle of a broken line:
bean-check: one error (
6: syntax error, unexpected POPTAG). The pop takes effect, so "second" has no tags. rledger reportedP0021 pushtag 'trip' was never poppedas well, and tagged "second" withtrip. LikewiseP popmeta where:(thePan invalid token) now pops, andoption "operating_currency" "USD"pushtag #xnow pushes: it reports the unbalanced tag and tags what follows, as bean-check does.How
cst/convert.rs: the push/pop arms only collect their nodes. After every error pass,push_pop_directivespicks the ones that take effect: all of them in a file with no error (beancount's grammar reads it whole, and the oracle is not run), otherwise the oracle's built ones. A built one with no node of its own in rledger's tree is read from its own text.replay_push_pop_statethen applies the stacks to each directive and reports absent pops and unclosed pushes.push_pop_header_failsand theinvalid_value_datehelper it alone used are removed.full_reference,reconcile_errors_with), so a file with errors pays for the oracle no more than before.cst/oracle/mod.rs::reconcile: a semantic slot (beancount's builder error, such as a pop of something never pushed) is now covered first by rledger's own standing builder error on that line. Before, a stray\r(P3) or a leftover syntax diagnostic could fill the slot as well, which reported the line twice once rledger's pop took effect.Docs: compatibility.md §3. Loader cache v83, WASM cache v165 (parser output moves; every affected source has a parse error, so the bump is only a safeguard). The parse-error manifest drops 52 inputs that now match: the
eofpins for unbalanced pushes, and theimpl-moreabsent-pop pins.Parity
Parse-error parity (123,394 inputs): 122,378 → 122,430 matches. 52 inputs newly match and none regress. Semantic parity
--checkpasses with the manifest unchanged.Testing
crates/rustledger-parser/tests/push_pop_built_by_recovery.rs(new) covers the three repros, the compat(parser): a pushtag, poptag or popmeta with an invalid date changes no state, and a pop error is on the pop's own line #2995 rule where beancount builds nothing, and the one-error-per-line cases for an absent pop that beancount builds.cargo test -p rustledger-parser; clippy-D warningson rustledger-parser, rustledger-loader and rustledger-wasm.scripts/compat-parse-error-parity.py --checkandscripts/compat-semantic-parity.py --check.🤖 Generated with Claude Code