Skip to content

fix(parser): a dated line that opens no directive is one error, as in beancount (#2979) - #2985

Merged
robcohen merged 13 commits into
mainfrom
fix/dated-line-no-directive
Nov 15, 2026
Merged

robcohen merged 13 commits into
mainfrom
fix/dated-line-no-directive

Conversation

@robcohen

@robcohen robcohen commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

What

A column-0 dated line whose second token opens no directive is now one error, as in bean-check 3.2.3. The second token can be a number, an account, a currency, an invalid date, and so on (2024-01-02 123 * "n"). rledger also reported every indented line under it as an orphan unexpected input.

Line 4 (after two opens and a blank line), then two postings bean-check 3.2.3 main this PR
2024-01-02 2024-01-03 * "n" L4 L4 L5 L6 L4 L5 L6 (not changed, see below)
2024-01-02 2024-01-03 "n" L4 L4 L5 L6 L4
2024-01-02 123 * "n" L4 L4 L5 L6 L4
2024-01-02 Assets:A * "n" L4 L4 L5 L6 L4
2024-01-02 USD * "n" L4 L4 L5 L6 L4
2024-01-02 2024-13-45 "n" L4 (the date only) L4 (twice) L5 L6 L4

Why and how

identify_directive opens no node for such a line, so the indented lines after it were orphans, each reported. beancount reads the date, fails at the token after it, and bison's recovery reports no syntax error until it has shifted three tokens again.

That is the recovery quiet_after_line_start_bom_lines (#2984, for #2956) models after a line a mid-file BOM starts. This PR generalizes that pass rather than copying it, and renames it quiet_after_failed_line_starts. Its walk now also starts after a column-0 ERROR_NODE line that starts with a valid date followed by a blank and a token: a dated line.

A BOM line's window is untouched. From a line a BOM starts until #2984's window ends, every rule here is off, so behavior there is identical to the baseline. A line a BOM starts inside a dated line's window starts its own window there, under #2984's rules. Line-grammar controls with BOM lines (88,000 inputs over three seeds) are byte-identical to the baseline.

In a dated line's window:

  1. The lines after the failed line. They keep only the lexer's errors (invalid tokens such as k:, invalid dates, and a number beancount's lexer rejects, 1,50, 1,0, 1,000,0, for which the line's error stands) until the recovery would report again (fix(parser): count a line-start BOM as beancount does, and keep the lines after it quiet #2984's token count).

  2. A failed dated line, or a date alone on its line or glued to anything but a flag (2024/1/3:, 2024-01-03,), inside the window. Its date is a token bison shifts. So when that date is the last token owed (after a skipped comment line), the line is reported and starts a window of its own. A date counts as alone with nothing after it but blanks or a comment, including a glued one (2024-01-02;c, 2024-01-02%x).

  3. A declaration bison would shift ends the recovery. That is a dated header (a flag, txn, a lone capital such as T, or a directive keyword after the date). The date may come after a blank or glued after punctuation beancount lexes as a token of its own (, : | ~ @ { } ( ) + - /). It may also be an undated declaration's keyword (option, include, plugin, pushtag, poptag, pushmeta, popmeta, also glued to punctuation as in ~,option), found by first_resync_point. bison builds that declaration, which is not modeled:

    • a dated line holding one starts no window;
    • a later line holding one at column 0 ends the window before it and keeps its errors;
    • on an indented line, the line is quiet and the window ends after it, because beancount reports the line after it.

    A line holding a lone capital glued to punctuation (T", X(), which beancount reads as the start of an invalid run, is treated the same way: such a dated line starts no window, and such a line ends a window before it.

    This is why the issue's first row, 2024-01-02 2024-01-03 * "n", is not changed.

Outside the window:

  1. An invalid date right after a dated line's date is where the grammar fails, so the date's error is the line's one error (2024-01-02 2024-02-30: 1, was 2). This is applied in the pass, only to dated lines outside a BOM window, and not:
    • when the line holds a declaration bison shifts;
    • when the line before has an error of its own, because beancount reports some of those on the next line: a date alone, a flag-only posting !, an open with no account;
    • when a lone capital is glued to the line's end (T\r, T at the end of the input) or to punctuation (T"), which beancount reads as an invalid token of its own;
    • when the line holds a number beancount's lexer rejects (1,2024), for which the line's error stands.
  2. A date with nothing after it but blanks or a comment starts no window. beancount fails there at the line's end and reports that on the next line, which is not modeled.

The walk lexes each line after a failed line at most once. There are no scans past a line.

What this does not touch: only error lists change. The CST and identify_directive are untouched, so every directive built is identical.

Caches

  • WASM: CACHE_VERSION 118 → 119. Both payloads archive parse errors. The note ends "(v118 was taken by fix(parser): count a line-start BOM as beancount does, and keep the lines after it quiet #2984.)".
  • Loader: stays at 75. It saves only error-free loads. Every changed source holds a failed dated line, which keeps an error of its own, so it has a parse error before and after, and parsed directives do not move.
  • Validation: findings from rledger check --format json were identical on main and the branch for 3,000 sampled differential inputs (round 0; directives are unchanged since).

Parser corpus baseline

One real-ledger output hash moves: parser-lima/examples_data_full.beancount.

  • Before and after: its source is unchanged, and it has parse errors on 13 lines on both sides.
  • What changed: line 107, 2023-05-31 'Z "Z Energy ;" "Rather expensive" #petrol, is a dated line that opens no directive ('Z is an invalid token). So the posting lines under it are quiet. Line 108 keeps its lexer error ('B), and line 109, ! Expenses:Car:Fuel, is no longer reported.
  • Against beancount: bean-check reports lines 107 and 108, while main also reported 109.
  • Directives: they do not change.
  • Checks: tests/baselines/parser-corpus.manifest was updated for that line only. It was checked against the corpus scripts/fetch-compat-test-files.sh fetches, as CI does; the parity manifest needs no update against it.

Parity corpus (pinned fuzz 9bc79f4, BOM matrix, tracked, compat)

main (#2984 head, 61225a7) this PR
all 79,558 / 111,323 82,645
matrix 50,938 54,022
fuzz 27,750 27,753

Against main, 3,087 inputs newly match and none stop matching. The manifest was updated with --update, and --check passes.

Generated differentials (baseline: main with #2984, 61225a7)

Line grammar. These are sequences of 2 to 7 lines:

Code Line type Examples
F failed dated line 25 shapes, including invalid second dates before a declaration
L date alone on its line 6 shapes, glued comments included
B line a BOM starts 8 shapes
P indented line 16 shapes, indented declarations included
E blank or comment line
D directive

Half have two opens first, 15% are CRLF, 20% have no final newline, and 10% start with a file BOM. Controls use no F or L lines.

Both generators now also cover:

  • lone capitals glued to ", (, #, CRLF line ends and the end of the file;
  • dates glued after each punctuation token;
  • quote lines that close a string a later line opened;
  • mis-grouped numbers (1,50, 1,0, 1,2024, 1,000,0, 1234,567);
  • column-0 dates glued to punctuation or letters (2024/1/3:, 2024-01-03,, 2024-01-03:x, 2024-01-03*).
Seed Inputs (exp + ctl) Gained Closer Regressed Further Sideways Controls
21 120,843 + 29,157 6,248 5,784 0 1 0 only gains or closer
22 120,554 + 29,446 6,373 5,666 0 0 0 only gains or closer
23 120,589 + 29,411 6,393 5,636 0 0 0 only gains or closer

The controls hold 2024-01-02 t "n", itself a failed dated line, so they change, always toward beancount. Their BOM windows stay identical to the baseline.

Body generator (from earlier rounds). A failed dated line with 77 kinds of second token, a body of 0 to 4 lines (BOM lines and lone dates included), a tail and an optional line before; controls use a directive-opening second token.

Seed Gained Closer Regressed Further Sideways
11 18,338 (+610 ctl) 21,443 (+1,400 ctl) 0 2 1
12 18,504 (+636 ctl) 21,452 (+1,365 ctl) 0 0 0
13 18,388 (+632 ctl) 21,436 (+1,379 ctl) 0 0 1

"0 regressions" holds for these generators, as run here. Each review round has found shapes they lacked, so it is a measurement over these inputs, not a proof.

Families: every further and sideways input (5 in 900,000 inputs over six seeds, under 1 per 100,000)

Family Further Sideways Rate What
I, an indented line holding a declaration bison shifts, which beancount reports ( 2024-01-04 * "x" right below the failed line, or one line further) 3 2 about 0.6 per 100,000 Rule 3 quiets it. beancount does not report one after a date alone on its line, and telling the two apart needs bison's exact token accounting (#2872). Each is off by one, on that one line.
Q, a lone capital glued to a quote (T") followed by quote lines 0 0 none here (2 in round 6) beancount reads T" as an invalid token, while rledger's lexer opens a string there, so later quotes pair differently (pre-existing lexer difference).
S, a string opened right after an account on an indented line ( Assets:"10) that closes on the next line, followed there by an invalid token 15 per-line (in 163,000 inputs of the targeted round-7 check) 0 about 9 per 100,000 in that targeted set Found by the targeted check of the round-7 fixes, present since an earlier round. 2024-01-01 ,\n Assets:"10\n k: "-5"\n is bean-check [1,2,3], main [1,2,3], this PR [1,3]: the quiet window silences line 2. Each is off by one on that one line; it does not happen with Assets:A "10 or after a valid header.

The round-7 review measured its generator at about 9,000 gains per 100,000 inputs, with I-type leftovers its only remainder after these fixes.

None drops a directive. The round-5 review's two token-accounting shapes now match bean-check: 2024-01-02 2024-13-45 ( 1,0002024 'x (bean-check 3, main 3, PR 3) holds a mis-grouped number, which the invalid-second-date rule now leaves alone; 2024-01-02 x 2023-02-29 @@2024-01-02 ? / @@ $x pad 2024 commodity gives bean-check's {1:2, 2:2} too.

The round-7 reviewer's shapes (rebuilt as probes)

Shape bean-check main PR
two opens, blank line, 2024-01-02 123 * "n" / Assets:A 1,50 EUR {4, 5} {4, 5} {4, 5}
2024-1-2 y / 1,0 {1, 2} {1, 2} {1, 2}
2024-1-3 2024-0-0 1,2024 {1:2} {1:2} {1:2}
2024-1-3 c / blank line / 2024/1/3: (also 2024-01-03,) {1, 3} {1, 3} {1, 3}
2024-01-02 Assets:A * "n" / ; note / 2024-01-03:x {1, 3:2} {1, 3:2} {1, 3:2}
2024-01-02 @2024-01-03 * / #x (also { } ( ) + - /) {3, 4} {3, 4} {3, 4}
2024-01-02 123 / X( 1 / Assets:A 1 USD {1, 2} {1, 2, 3} {1, 2, 3} (main's; the window ends before X()

The round-6 reviewer's shapes (rebuilt as probes)

Shape (after 2024-01-01 open Assets:A and a blank line where it applies) bean-check main PR
2024-01-02 ,2024-01-03 * / #x (also :...txn then USD, ` ...T "n", 2024-01-03:2024-01-04 *, ~`, CRLF) {3, 4} {3, 4}
2024-01-02 2024-13-45 T" 1 USD / ; c / Assets:A 1 USD / 2024-01-02 t "n" {3:2, 6} {3:2, 6} {3:2, 6}
2024-01-02 2024-13-45 T" / " (also P"a / b") {1:2, 2} {1:2} {1:2} (main's)

The round-5 reviewer's shapes (rebuilt as probes)

Shape (after 2024-01-01 open Assets:A and a blank line where it applies) bean-check main PR
2024-01-02 2024-01-03 T / #x (also P, T "n", T ; c) {3, 4} {3, 4} {3, 4}
2024-01-02 2024-01-03 T / ;c / Assets:A 1 USD {3, 5} {3, 5} {3, 5}
2024-01-02 2024-13-45 T (CRLF, or at the end of the input) {3:2} {3:2} {3:2}
2024-01-02 2024-13-45 : 2024-00-10 T (CRLF or EOF) {1:3} {1:3} {1:3}
2023-12-31 2024-13-45 USD T (CRLF, after a balance) {3:2} {3:2} {3:2}
2024-01-02 2024-01-03 T then postings {3} {3, 4, 5} {3, 4, 5} (main's)

The round-4 reviewer's shapes (rebuilt as probes)

Shape bean-check main PR
; a / <BOM>x / blank line / 2024-01-02 2024-13-45 include "x" (also ;c for the blank, popmeta k:) {2, 4} {2, 4} {2, 4}
; a / <BOM>x / ;c / 2024-01-02 $x pushmeta k: 1 / ;c / #comment {2, 4:2} {2, 4:2} {2, 4:2}
; a / <BOM>x / ;c / 2024-01-02 'x / 2024-01-02 / ~,option "a" "b" {2, 4} {2, 4} {2, 4}
2024-01-02 'x / 2024-01-02 / ~,option "a" "b" {1} {1, 2, 3} {1}
2024-01-02 123 / ;c / 2024-01-02;c (also %x) {1, 3} {1, 3} {1, 3}
2024-01-02 / 2024-01-02 2024-13-45 (also 2024-01-02 ; c) {2:2} {1, 2:2} {1, 2:2} (main's)

The reviewer's shapes from rounds 1 to 3 also give main's count, or beancount's where main differed.

Speed

Linear on adversarial inputs at 20k/40k/80k repetitions, in seconds (main's numbers from round 2):

Shape main this PR
2024-01-02 2024-01-03 * "n\" 0.03 / 0.07 / 0.14 0.04 / 0.07 / 0.15
many failed lines with a posting 0.08 / 0.17 / 0.28 0.05 / 0.10 / 0.21
many resync lines with a body 0.11 / 0.20 / 0.38 0.10 / 0.23 / 0.42
a quiet line holding a declaration, repeated 0.05 / 0.10 / 0.20 0.06 / 0.12 / 0.25
glued ~,option lines 0.08 / 0.15 / 0.30 0.09 / 0.19 / 0.35
one failed line over a long body 0.03 / 0.07 / 0.15 0.03 / 0.05 / 0.12
a chain of dated lines 0.03 / 0.06 / 0.12 0.03 / 0.05 / 0.10
bad-date lines with 50 invalid tokens each 1.62 / 3.37 / 6.73 1.84 / 3.59 / 7.84

Not changed (documented)

  • A dated line holding a declaration bison shifts (2024-01-02 2024-01-03 * "n" and postings: bean-check L4, main and PR L4 L5 L6). beancount builds that declaration, and modeling it is Parse-error recovery differences from bean-check around invalid dates and column-0 markers #2872's general recovery.
  • holds_a_misgrouped_number is slightly stricter than beancount on two lexer corner cases that changed no count in a 163,000-input check: beancount accepts one leading digit, a double comma, then three digits (1,,000 lexes as 1000), which the predicate calls misgrouped; and the predicate lexes past a stray \r inside a ; comment, where beancount's comment runs to \n.
  • A date-only line: 2024-01-02 then postings is bean-check L5, main and PR L4 L5 L6.
  • An error beancount places on the next line (an open with no account, a flag-only posting, a lone date) before a dated line: counts as main.
  • 2024-01-02 pushtag #a then poptag #a: beancount pushes the tag, which the whole parse does not see. Main is the same.

How to test

cargo test -p rustledger-parser --test dated_line_no_directive
cargo test -p rustledger-parser            # includes the BOM combination matrix
cargo test -p rustledger-wasm --lib cache

Every expected count in dated_line_no_directive.rs was checked against bean-check 3.2.3.

#2984 is merged (de17d7d), and main is merged in, so this diff holds only #2985's changes.

Fixes most of #2979 (all rows but the first; see "Not changed").

🤖 Generated with Claude Code

robcohen and others added 4 commits November 14, 2026 16:19
…ines after it quiet (#2956)

A mid-file BOM at the start of a line is beancount's invalid token, so the
statement it starts or breaks into fails there and bison's recovery reports
nothing more until it has shifted three tokens. Each indented line after it
was an orphan `unexpected input` here, and a transaction the line broke into
was kept with a balance residual beancount never reports.

- quiet_after_line_start_bom_lines: the lines after a line a BOM starts keep
  only the lexer's errors until a column-0 directive, two blank or skipped
  lines, or a dated header ends the quiet.
- The lexer: a line-start BOM glued to a comment start, a line start
  beancount skips, or a run holding a quote or `;` is one invalid token with
  it, so the rest of the line is read; one before a `:` account takes in
  that account.
- transaction_holds_invalid_token also answers for a transaction a BOM line
  breaks into, so the validator reports no residual for it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, parity manifest and BOM matrix data regenerated

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t does

A line a mid-file BOM starts after a transaction discards the transaction in
beancount only when the BOMs are its invalid token. Where its lexer reads
them into an account (<BOM>Assets:A, <BOM>assets:A, a run of BOMs before
one), its grammar reduces the transaction first and fails at the account,
so the transaction is kept and its residual reported. The new branch of
transaction_holds_invalid_token now asks bom_led_account for that.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… beancount (#2979)

When the token after a column-0 line's date is no directive keyword and no
transaction flag (`2024-01-02 123 * "n"`, a second date, an account, a
currency), each indented line under it was an orphan error too. beancount
reads the date, fails at the next token, and stays quiet until its grammar
has read three tokens again.

Generalize the BOM-line recovery pass (now `quiet_after_failed_line_starts`)
to start after such a dated line too. When the line holds a transaction's
header after a blank, beancount builds that transaction, so its body takes
the errors a parse of that transaction gives. A failed dated line in a quiet
window is reported when its date is the last token owed. An invalid date
right after the line's date is the line's one error.

WASM cache v119; loader cache unchanged (every changed source has a parse
error before and after; directives do not move). Parity corpus 79,558 ->
82,650 matching, none lost; manifest updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@robcohen
robcohen requested a review from a team as a code owner November 14, 2026 23:47
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

Shape rustledger beancount Speedup RSS (rledger / beancount)
simple 53.8ms ± 1.3ms 861.6ms ± 8.3ms 16.0x 45.2 MB / 51.1 MB
investment 83.1ms ± 2.5ms 3152.6ms ± 21.9ms 37.9x 47.2 MB / 59.1 MB
fifo 78.5ms ± 2.0ms 16059.5ms ± 129.0ms 204.5x 49.2 MB / 59.0 MB

vs base, measured in this run

Shape base this PR Change RSS base → PR
simple 53.4ms ± 1.3ms 53.8ms ± 1.3ms +0.7% ✅ within noise 45.2 MB → 45.2 MB (-0.0%)
investment 82.5ms ± 2.8ms 83.1ms ± 2.5ms +0.7% ✅ within noise 47.0 MB → 47.2 MB (+0.3%)
fifo 78.0ms ± 1.7ms 78.5ms ± 2.0ms +0.6% ✅ within noise 49.4 MB → 49.2 MB (-0.3%)

A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: simple 0.8ms, investment 1.7ms, fifo 1.2ms), and is at least 5%.
10,000 transactions per shape · 20 runs, 3 warmup · hyperfine

What do these numbers mean?
  • simple — Two-posting transfers, one currency. The historical workload — keep as the floor, not as the benchmark.
  • investment — Cost specs, per-unit prices and lot reductions. Exercises booking and inventory, which simple leaves at 0.3%.
  • fifo — Bare {} reductions against a FIFO account — how FIFO sells are normally written. The other four shapes reach the ordered-selection path twice in 2k transactions between them, so it was effectively unprofiled until it turned out to be quadratic (plan_ordered scans every lot per reduction: FIFO ledgers are quadratic (8.8s at 20k transactions) #2083).
  • vs base: the PR and the base-branch commit it is built on, built and measured in the same job
  • RSS: peak resident set size, a single sample — reported without a verdict because there is no spread to test it against
  • A shape with no beancount column is one bean-check reports errors on; it is timed for rledger only

@codecov

codecov Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.94872% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/rustledger-parser/src/cst/convert.rs 97.94% 4 Missing ⚠️

📢 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% (raw 93%, 179 masked)
Full AST Match 100%
Total Files 826
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 and others added 9 commits November 14, 2026 18:25
#2979 review)

Round-1 review of #2985:

- A declaration bison's recovery shifts after a blank on the failed line or
  on a quiet line (a dated header, or `option` / `include` / `plugin` /
  `pushtag` / `poptag` / `pushmeta` / `popmeta`) ends the recovery there:
  it and its block take the errors a parse of them gives, its own line's
  grammar errors only from its fourth token (counted again after a lexer
  error), as bison is still recovering until then.
- That block's end follows a string that runs over line ends; a quote that
  never closes opens no string.
- The pushtag/pushmeta state stays the whole file's.
- A date with nothing after it but blanks or a comment starts no window
  (beancount reports it on the next line, not modeled).

BOM matrix: one known row moves closer; 7 rows relabelled (same counts).
Parity corpus 79,558 -> 82,649 against the #2984 head, none lost.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hout modeling it (#2979 review)

Round-2 review of #2985: drop the separate parse of a resynchronized
declaration and the fourth-token rule. Where bison's recovery would shift
a declaration (a dated header after a blank, or an undated declaration's
keyword, also glued to punctuation), a dated line starts no quiet window
and a line ends one before it, keeping the errors main gives there. The
invalid-second-date rule applies only to a line with no such declaration.
BOM windows are as #2984 has them again (matrix data restored). Linear: no
scans past a line (the escaped-quote shape was quadratic).

Generated differential: 3 seeds x 150k, no regressions; the one family
left is an `open` with no account on the line before (pre-existing).
Parity corpus 79,558 -> 82,649, none lost.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lone date (#2979 review)

Round-3 review of #2985:

- A line a BOM starts inside a dated line's window starts its own window
  there under #2956's rules; the dated walk no longer runs over it.
- A date alone on its line where the window owes its last token ends a
  dated line's window (the line keeps its error), as one with a token after
  the date does; in a BOM window only the latter, as before.

Generated differential (now with BOM lines under a failed dated line and
lone dates): 5 seeds x 150k, no regressions. Corpus unchanged (82,649).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ow (#2979 review)

Round-4 review of #2985:

- Inside a BOM line's window none of the new rules apply (the lone-date and
  dated-line breaks, the resync break); its behavior is the baseline's.
- The invalid-second-date rule moves into the quiet pass: only for a dated
  line walked there (so never inside a BOM window), and not after a line
  with an error of its own, which beancount may report on the dated line.
- A declaration on an indented line in a dated window is quiet and ends the
  window after it; only a column-0 one ends it before the line.
- A date with a comment glued to it (`2024-01-02;c`, `%x`) is a lone date.

Line-grammar differential (3 seeds x 150k): no regressions, no further or
sideways, controls unchanged. Body generator (3 x 150k): no regressions,
30 documented further/sideways. Corpus unchanged (82,649).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…#2979 review)

Round-5 review of #2985:

- `first_dated_header` takes a lone capital (`T`, `P`, `X`, lexed as a
  currency) after a date as a transaction's flag, as beancount shifts it,
  after a dated line only (a BOM line's window keeps #2956's reading).
- The invalid-second-date rule does not apply when a lone capital glued to
  the line's end (`T\r`, `T` at EOF) is an invalid token of its own.

Both generators now cover lone capitals: 6 seeds x 150k, no regressions;
line grammar has no further or sideways. Corpus unchanged (82,649).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, end the model (#2979 review)

Round-6 review of #2985:

- After a dated line, `first_dated_header` takes a date glued after
  punctuation beancount lexes as its own token (`,` `:` `|` `~` `@` `{` `}`
  `(` `)` `+` `-` `/`) as after a blank (a BOM window keeps #2956's reading).
- A lone capital glued to punctuation (`T"`, `X(`) is the start of an
  invalid run to beancount: a dated line holding one starts no window, a
  line holding one ends a dated window before it, and the invalid-second-date
  rule does not apply to it.

Generators now cover both: 6 seeds x 150k, no regressions, 16 documented
further/sideways. Corpus 79,558 -> 82,645, none lost.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… glued date is shifted (#2979 review)

Round-7 review of #2985:

- `holds_a_misgrouped_number`: a digits-and-commas run whose commas are not
  thousands groups (`1,50`, `1,0`, `1,000,0`) is beancount's lexer error.
  On a quiet line after a dated line its line error stands for it and is
  kept; the invalid-second-date rule leaves such a line alone.
- A column-0 date glued to anything but a flag (`2024/1/3:`, `2024-01-03,`)
  counts as a dated line for the owed-1 break (it still opens no window).
- Tests for the `open`-without-account exception, the other glued
  punctuation (`@ { } ( ) + - /`) and a later `  X(` line ending a window.

Generators now cover both: 6 seeds x 150k, no regressions, 5 family-I
inputs. Corpus unchanged (82,645).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#2984 landed as de17d7d (same tree as its head 61225a7, which
this branch was built on); conflicts resolved to this branch's side; the
WASM cache note now says v118 was taken by #2984.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a_full (#2979)

The file's parser output moved toward bean-check 3.2.3. Line 107,
`2023-05-31 'Z "Z Energy ;" "Rather expensive" #petrol`, is a dated line
that opens no directive (`'Z` is an invalid token), so the posting lines
under it are quiet: line 108 keeps its lexer error (`'B`), and line 109,
`  ! Expenses:Car:Fuel`, is no longer reported. bean-check reports lines
107 and 108 there; main also reported 109.

The file had parse errors before and after (13 lines on both sides), the
pass only filters errors, and directives do not change, so no cache moves.
Only this file's output hash changes (source hash unchanged), checked
against the corpus fetched by scripts/fetch-compat-test-files.sh as in CI;
the parse-error parity manifest needs no update against that corpus.

Co-Authored-By: Claude Opus 5.5 <[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