Uh oh!
There was an error while loading. Please reload this page.
fix(spec): share one fence-closer predicate between check-skill-examples's walk and extraction - #12175
Merged
Merged
Conversation
…les's walk and extraction fenceOwners() already computed each top-level fence's close line with an indent/run-length-aware regex; extraction re-derived a body end with a second, looser `^```\s*$` (exactly three backticks, column 0) that disagreed with it in both directions — an indented or four-or-more-backtick closing line closed the walk's span but not extraction's, and a CR-trailing one (a CRLF file) closed extraction's but not the walk's. fenceOwners() now returns each opener's closeLine alongside owners, and extraction reads it directly instead of re-deriving one. Adds four self-test fixtures pinning the previously-divergent closing-line spellings: indented, four-or-more-backtick, the two combined, and CR-trailing.
Contributor
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
os-litant
marked this pull request as ready for review
August 25, 2026 13:47
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 25, 2026
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 freeto 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.
Fixes#11690
The bug
check-skill-examples.ts'sfenceOwners()walk and itsextractFromFile()extractionloop disagreed about where a fenced block's body ends. The walk used an
indent/run-length-aware closer (
^ {0,3}\{run,}[ \t]$); extraction re-derived a body end with a second, looser^```\s$` (exactly three backticks, column 0). The two diverged inboth directions:
not extraction's — extraction's body ran past the real close to the next bare column-0
fence (or to EOF), swallowing whatever followed.
walk's — the walk read the fence as unclosed, which (per CommonMark) silently suppressed
extraction and orphan-reporting for every later block in the file.
Latent, no occurrence in the real corpus (confirmed again in this PR: 0 files with a raw
CR byte across all 878 scanned files).
The fix
One shared closer predicate, per the issue's own suggested shape and the
fenceOwners()precedent already used correctly by the sibling gate
scripts/check-role-word.mjs.fenceOwners()now returns each opener'scloseLinealongsideowners, andextractFromFilereads it directly instead of re-deriving a body end with its own regex.The old
FENCE_CLOSE_REis removed — there is exactly one closer now, not two that candrift apart.
Self-tests
Four new fixtures pin the divergent closing-line spellings the issue enumerates, each
verified both ways (reverse-verified: committed the fix, temporarily reverted just the
closer logic while keeping these fixtures, confirmed all four fail with the expected
messages, then restored the fix):
regex's
{0,3}/{run,}quantifiers must both clear togetherreported a short, plausible body; the walk had already decided the fence never closed);
now both loops agree the fence is unclosed, so extraction's reported body honestly
matches what the walk believes this span contains instead of masking the mismatch
Corpus before/after (mechanism assumption #2)
check:skill-examples's real-corpus run is identical before and after, across all 5 realsource roots (
skills/,content/docs/,packages/spec/src,packages/client-react/src,packages/client/src):0 divergences anywhere in the real corpus; the only behavior changes are on the four
synthetic fixtures above.
Tests
All at
90d510d.Scope
File surface is exactly
packages/spec/scripts/check-skill-examples.ts(+ its ownself-tests), per the dispatch's serial-ordering note: #12051 and #12048 share this file on
a different defect class each and hold until this lands.
No changeset — pure internal dev-tooling/CI-script bugfix, no published-package or
user-facing behavior change (
packages/spec/scripts/**is not in the package's publishfilesallowlist, confirmed bycheck:published-filesabove).Generated by Claude Code
Generated by Claude Code