Repository navigation
test(parser): pin error recovery after a column-0 tag with a stray quote - #2800
Merged
Merged
Conversation
#2788 (end an unterminated quote at its own line) already fixed #2781: `#TODO buy 27" monitor` followed by two opens now reports one error on line 1 and keeps both opens, as beancount 3.2.3 does. Before #2788 the error ran to the end of the file and both opens were lost. Add a parse-level regression test for the tag shape and its variants (CRLF, a bare `#TODO "x`, a directive-looking tag line, the last line, and a later quote that closes the string across lines). Each case matches beancount 3.2.3's error line and surviving directives, and goes through the lossless and green/red agreement invariants. Closes #2781 Co-Authored-By: Claude Opus 5.5 <[email protected]>
robcohen
marked this pull request as ready for review
October 29, 2026 04:29
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 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 changed
Test only. Adds
test_parse_tag_line_with_a_stray_quote_keeps_the_following_directivestocrates/rustledger-parser/tests/unterminated_quote.rs. No parser code changes.Why
#2781 was filed before #2788 ("end an unterminated quote at its own line") merged. #2788 fixes it: the stray
"after a column-0#TODOtag now ends at its own line, so error recovery resyncs at the next line, as beancount does. Nothing pinned the tag shape, so this adds a regression test for it and its variants. Each case asserts the exact error span, the exact surviving directives, and the lossless + green/red agreement invariants (assert_invariants: lossless tokenize, CST round-trip,parsevsparse_red_onlydirectives and errors).Evidence
Repro from the issue:
#TODO "xthen an open#TODO 2024-01-01 open Assets:A "xthen two opens#TODO "xas the last line, no newlinenote ... "hello"andopen Assets:DThe last case is expected: a terminated string may span lines in beancount, so the
"on line 1 pairs with the first"on line 4 and both sides lose lines 2 to 4.The new test fails with
logos_lexer.rsreverted to its pre-#2788 version (left: [("parse error: unexpected input", 0, 72)],right: [(..., 0, 22)]) and passes on main.bean-check results come from beancount 3.2.3 in the dev-shell compat container (
parser.parse_file, listing error line numbers and surviving entries).Baseline impact
None: no parser code changes. The local strict
corpus_baselineandcst_baselinegates pass (STRICT_BASELINE=1).How to test
cargo test -p rustledger-parser --test unterminated_quoteAlso ran:
cargo test -p rustledger-parser --all-features,cargo test -p rustledger-loader(56test result: ok, 0 failed), clippy-D warnings --all-targetson rustledger-parser,cargo fmt --check,RUSTDOCFLAGS=-Dwarnings cargo doc -p rustledger-parser --no-deps.Draft so it lands after the #2758 baseline regeneration.
Closes #2781
🤖 Generated with Claude Code