Skip to content

parser: a trailing ; on a clause no longer empties the whole test body (Refs #2161) - #2736

Merged
gHashTag merged 3 commits into
masterfrom
w699-testbody
Aug 27, 2026
Merged

parser: a trailing ; on a clause no longer empties the whole test body (Refs #2161)#2736
gHashTag merged 3 commits into
masterfrom
w699-testbody

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

A braceless clause may end with a semicolon:

test t
    given p = 0;
    assert g(1) == 999

Nothing consumed it, so the next loop turn met ; where it expects a clause head, read that as stopped mid-clause, and restored the fallback — discarding the whole block over one character. The identical body without the semicolon lowered fine, which is what kept it invisible: two spellings of one clause, one of them silently emptying every assertion after it, and gen_test_block emits the resulting empty test with no marker.

before after
discarded top-level tokens 35,224 35,070
specs that parse 620 620
t27c tests 1629 / 6 1629 / 6
RATCHET CLEAN

A second shape in this family is deliberately not here

A body that opens with var/const has no earlier clause to take a column from, so the statement arm is skipped. I wrote that fix and measured it recovering 1,914 tokens — and it regressed specs/memory/notebooklm.t27 from parsing to not parsing.

Seeding the column lets an earlier clause take the statement arm, and the parser then reaches const (notebook, err) = ... — a tuple destructure the arm cannot handle — in a state where the old path would have fallen back for the whole block. It dies with Expected identifier after 'const', got LParen instead.

Isolated by disabling one edit at a time rather than by reading: with the semicolon consumption alone the spec parses; with the column seeding alone it does not.

parse_bdd_clauses carries its own contract — "may only ADD assertions, never break a file" — and that version broke one. Filed as #2735 with the containment fix it actually needs.

Refs #2161

…ody (Refs #2161)

A braceless clause may end with a semicolon:

    test t
        given p = 0;
        assert g(1) == 999

Nothing consumed it, so the next loop turn met `;` where it expects a
clause head, read that as "stopped mid-clause", and restored the
fallback -- discarding the WHOLE block over one character. The identical
body without the semicolon lowered fine, which is what kept it invisible:
two spellings of one clause, one of them silently emptying every
assertion after it, and `gen_test_block` emits the resulting empty test
with no marker.

Measured over 746 tracked specs:

    discarded top-level tokens   35,224 -> 35,070
    specs that parse                620 -> 620
    t27c tests                   1629/6 -> 1629/6
    RATCHET                                 CLEAN

A SECOND shape in this family is NOT fixed here, deliberately. A body
that OPENS with `var`/`const` has no earlier clause to take a column
from, so `first_clause_col` is None and the statement arm is skipped. I
wrote that fix, measured it recovering 1,914 tokens -- and it regressed
specs/memory/notebooklm.t27 from parsing to not parsing.

The mechanism is worth recording: seeding the column lets an EARLIER
clause take the statement arm, and the parser then reaches
`const (notebook, err) = ...` -- a tuple destructure the arm cannot
handle -- in a state where the old path would have fallen back for the
whole block. It dies with "Expected identifier after 'const', got
LParen" instead. The arm's contract is that it may only ADD assertions
and never break a file; that version broke one, so it is not in this
commit. Filed separately.

Isolated by disabling one edit at a time rather than by reading: with the
semicolon consumption alone the spec parses, with the column seeding
alone it does not.

FROZEN_HASH resealed in the same commit (M5).
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-27 19:51:01 UTC

Summary

Status Count
Total Open PRs 9
PRs with Failing Checks 8
PRs with All Checks Green 1
READY 0
FAILING 8
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=024051760b49 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@gHashTag
gHashTag merged commit fe77ecf into master Aug 27, 2026
33 of 34 checks passed
@gHashTag
gHashTag deleted the w699-testbody branch August 27, 2026 20:01
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