| id | 2606171402 | |
|---|---|---|
| title | Parity parse-skip: migrate the Layer-0 fenced-code rules | |
| status | ✅ | |
| summary | Add a nil-AST path to the parity rules that read only a fenced code block's fence lines — MDS010 fenced-code-style, MDS011 fenced-code-language, MDS031 unclosed-code-block, MDS065 code-block-style, MDS066 commands-show-output — so each resolves to Layer 0, gated byte-identical to the AST across the corpus. | |
| model | sonnet | |
| depends-on |
|
Move the fenced-code parity rules onto the Layer-0 block scan, so they no longer force the parse.
The Layer-0 scanner emits a
BlockFencedCode span per fenced block, fence lines included. MDS015
blank-line-around-fenced-code already reads those spans on the nil-AST
path. The code-skip unblock
(PR #644) confirmed the scanner matches the AST on code-bearing files,
fences inside list items included.
These rules read only the fence lines — the fence character, its run length, and the info string — and the block body lines. None needs the inline tree.
| Rule | Name | Reads |
|---|---|---|
| MDS010 | fenced-code-style | fence char (backtick / tilde) |
| MDS011 | fenced-code-language | info string presence |
| MDS031 | unclosed-code-block | an unterminated opening fence |
| MDS065 | code-block-style | fenced vs indented form |
| MDS066 | commands-show-output | shell info string + body |
For each rule:
- Add the nil-AST path — a
CheckBlockoverBlockFencedCode(andBlockIndentedCodewhere the rule needs it), reusing the existing fence parsing. - Keep the diagnostic byte-identical: same line, column, message.
- Regenerate the walk audit and sync the embedded rulelayer copy.
- Add a
TestCheck_NilASTMatchesASTunit test with code-bearing inputs, including a fence inside a list item.
- MDS010 fenced-code-style:
CheckBlockreads the fence character from theBlockFencedCodespan's opening line;A-no-skipping, corpus gate green. - MDS011 fenced-code-language:
CheckBlockreads the info string from the opening line;A-no-skipping, corpus gate green. - MDS031 unclosed-code-block: added a
Closedbool to the fencedBlockSpan, set from theclosedflagtryFencealready computes;CheckBlockflags!span.Closed.A-no-skipping, corpus gate green, with a 10-case unit test for the closure edges the corpus barely exercises (lone fence, info-no-content, trailing blank). - MDS065 code-block-style: added
collectBlocksL0that readsBlockFencedCodeandBlockIndentedCodespans;Checkdispatches to the Layer-0 path whenf.AST == nil.A-no-skipping, corpus gate green, with aTestCheck_NilASTMatchesASTunit test covering 5 sources × 3 configured styles. - MDS066 commands-show-output: added
CheckBlock+allLinesArePromptsL0that reads body lines fromBlockFencedCodespans via 1-basedspan.Start/End, stripping fence indent as goldmark does. Audit classification:B-prose-only(the perturb-code probe scrambles body content, changing prompt-line detection; the rule is code-content-sensitive by design).TestCheck_NilASTMatchesASTadded with 7 source inputs; corpus gate green.
- Each rule resolves to Layer 0 or B-prose-only: MDS065 is
A-no-skipping; MDS066 isB-prose-only(code-content-sensitive, not eligible for staticA-no-skippingbut still nil-AST-safe). -
TestLayer0Gate_CorpusDiagnosticsEquivalencegreen with them on. -
go test ./...passes.