This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
fix(scripts): read snippet imports from the AST in both gates - #7569
Merged
Merged
Conversation
`check-doc-snippet-types.mjs` and `check-skill-examples.mjs` each carried a private `importedSpecifiers(body)` that found module specifiers with three regexes over the raw block text. Documentation prose is part of that corpus, so the pattern matched text that is not an import: `content/docs/plugins/ plugin-markdown.mdx:195` is a `tsx` block whose body assigns a template literal holding a README sample, and the line `npm install project-name` inside that literal was reported as an import of `project-name`. Nothing in that block imports anything. Both copies are replaced by `moduleSpecifiersOfBlock`, exported from the shared harness — the parse and the AST walk `moduleSpecifiersOf` together, so the two gates cannot answer the question differently. Measured over the whole corpus, the readers disagree on exactly one block, the one above: 455 docs blocks, 121 skills fences under `--measure`, one regex-only specifier, zero AST-only. Neither consumer moves, and both survived the over-match by luck rather than by construction: - `--build-filter` is byte-identical for both gates. A false specifier joins the build filter only when it happens to equal a workspace package, and `project-name` is not one. The suite now pins the collision case over a throwaway tree, with the real-import control beside it. - The skills gate's `Unmapped specifiers` line is unchanged (`@playwright/test, vitest`). Since the root bound landed that line is the REPORT of what the bound refuses, and the bound has always walked the AST — a regex-derived report of an AST-derived refusal is two answers to one question. The suite pins that the two sets agree over this corpus, and that the line cannot name a specifier no fence imports. Both gates print byte-identical output before and after: same `Covered blocks`, same `Marked:`, same `Root bound:`, same `Semantic phase:`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019RfFHiRCSs3JXLK4cwcfox
…ces are marked The pin `agrees with the bound over the real corpus, specifier for specifier` closed with `expect(refused.size).toBeGreaterThan(0)`. That clause is not about the two readers it exists to compare — it asserts that the corpus still MARKS a fence importing a root-only specifier, and today that set is made of exactly the four marked fences in `skills/objectui/guides/testing.md`. A flight that unmarks them empties `refused`, leaves the equality true, and reds this pin over a change that has nothing to do with it. Measured, in this worktree, with `skills/objectui/guides/testing.md` taken from objectui#7557's head (`f7de6dc`) and nothing else changed: the old clause failed with `expected 0 to be greater than 0`. With the clause replaced it passes, and the only remaining reds are the two pre-existing pins on `MARKED_FLOOR` and `KNOWN_ROOT_DEVDEP_EXAMPLES` — that flight's own region, which its commit moves in the same change and which this diff does not touch. The non-vacuity clause now asserts what this pin actually owns: that the reader produced specifiers over the selected fences at all, so an equality between two sets nothing ever filled cannot pass for a measurement. Both readings are recorded in the pull request body. Also records, in the pin's own comment, why the equality is scoped to the SELECTED population and must not widen to `--measure`: measured over all 121 candidate fences the two sets legitimately differ, 12 names on the line against 6 refused, because a specifier that is unmapped and NOT root-declared belongs on the line and is correctly left in the program to fail there. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019RfFHiRCSs3JXLK4cwcfox
This was referenced Sep 3, 2026
os-steve
marked this pull request as ready for review
September 3, 2026 23:42
os-steve
pushed a commit
that referenced
this pull request
Sep 4, 2026
Brings in PR #7569 (objectui#7555), which moved both gates' import reading onto the harness's moduleSpecifiersOfBlock. One textual conflict, in the header docblock of scripts/check-skill-examples.mjs: both branches add a paragraph at the same position. Both paragraphs kept, and nothing else in the resolution. Order reads with the prose above it: #7569's paragraph about the report OF the refusals comes first, since the paragraph before it ends on the Unmapped specifiers line that paragraph is about; this branch's paragraph about a refused fence not being type-checked follows, in the updated form that records the four rows' retirement. The other side's copy of that second paragraph is the pre-edit original and is superseded, not dropped. Verified across the merge: KNOWN_ROOT_DEVDEP_EXAMPLES stays an empty Set, MARKED_FLOOR ts stays 13, skills/objectui/guides/testing.md is byte-identical to this branch's commit, and the moduleSpecifiersOfBlock import and both of its call sites from the other side survive. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019RfFHiRCSs3JXLK4cwcfox
This was referenced Sep 4, 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 free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 #7555
Both snippet gates carried a private
importedSpecifiers(body)that found modulespecifiers with three regexes over the raw block text. Documentation prose is part of
that corpus, so the pattern matched text that is not an import. Both copies are gone;
the one reader is now
moduleSpecifiersOfBlock, exported from the shared harness — theTSX parse plus the AST walk
moduleSpecifiersOfthat PR #7554 added — so the two gatescannot answer the question differently.
Verification head:
aa54aee(two commits: the reader swap9f1a2ad, then thecorpus-agreement pin patch
aa54aeeasked for in review). Written by Claude Code insession
session_019RfFHiRCSs3JXLK4cwcfox— attribution kept as prose here because thepull-request PATCH endpoint strips the footer block from this body (measured twice, see
the closing note).
The specimen, measured
content/docs/plugins/plugin-markdown.mdx:195is atsxblock whose body assigns atemplate literal holding a README sample. Inside that literal is the line
npm install project-name. Nothing in that block imports anything.["project-name"]moduleSpecifiersOfBlock(after)[]Over the whole corpus the two readers disagree on exactly that one block, and in one
direction only:
project-name)--measurets fencesPopulation and behaviour: nothing moved
Both gates print byte-identical output before (
e304a4e) and after (9f1a2ad) —diffover the full stdout of each run is empty. The lines the card and the triagename, quoted from both runs:
--build-filteris byte-identical for both gates too (26 workspace filter words for thedocs gate, 11 for the skills gate). No false specifier was moving it: a false name joins
the filter only when it happens to equal a workspace package, and
project-nameis notone — luck, not construction, which is why the collision case is now pinned over a
throwaway tree with the real-import control beside it.
The
Unmapped specifiersline is unchanged for the same reason in reverse: the falsename lives in the docs corpus, and that line is the skills gate's. What changed
is that the line and the refusals it reports are now one reader. Since PR #7554 the line
is the report of what the ROOT BOUND refuses, and the bound has always walked the AST —
a regex-derived report of an AST-derived refusal is two answers to one question, free to
name different sets over the same fences. The suite pins that the two sets agree over
this corpus, and that the line cannot name a specifier no fence imports.
What is pinned (3 new tests per suite)
scripts/__tests__/check-doc-snippet-types.test.ts(67 to 70 tests):plugin-markdown.mdx:195still holdsnpm install project-name,moduleSpecifiersOfBlockreports[]for it, and theretired regex (kept in the test file, and only there, as the contrast) reports
["project-name"]. Without the contrast the pin would hold for any block that importsnothing;
workspace package,
neededPackagesand the build filter stay empty and nounbuilt-packageprecondition is raised — with the real-import control beside it, soan empty result cannot come from a tree that was never scanned.
scripts/__tests__/check-skill-examples.test.ts(81 to 84 tests):moduleSpecifiersOfBlockmust be in the import block from the docs gate;unmappedSpecifiersandneededPackagesstay empty, with the real-import control namingsome-runner;Unmapped specifierssetequals the set the bound refuses, specifier for specifier.
Patched in review (
aa54aee). That last pin first closed withexpect(refused.size).toBeGreaterThan(0), which is not a fact about the two readers itcompares — it asserts the corpus still MARKS a fence importing a root-only specifier, and
today that set is exactly the four marked fences in
skills/objectui/guides/testing.md.PR #7568 (objectui#7557, governed, draft) unmarks them, so on the merge of both changes
refusedis empty, the equality still holds, and the clause would have red over a changethat is not about it. The clause is now
expect(read.size).toBeGreaterThan(0)— thespecifiers the reader actually produced over the selected fences, which is what this pin
owns. Nothing in that flight's region is touched (
KNOWN_ROOT_DEVDEP_EXAMPLES,MARKED_FLOOR,testing.md);git diffagainstmainfor those two identifiers isempty.
The pin's comment also now records, as a measurement, why the equality is scoped to the
SELECTED population and must not widen to
--measure: over all 121 candidate fences thetwo sets legitimately differ, 12 names on the line against 6 refused, because a specifier
that is unmapped and NOT root-declared belongs on the line and is correctly left in the
program to fail there.
The two readings the patch is proved by
Both taken in this worktree, exit captured before any pipe, restore proved by state.
(a)
skills/objectui/guides/testing.mdtaken from PR #7568's headf7de6dc, nothingelse changed — applied blob
74382b9...over HEAD blob0f68499..., os:check markers4 to 0:
9f1a2ad)aa54aee)agrees with the bound over the real corpusexpected 0 to be greater than 03 failed | 151 passed (154)2 failed | 152 passed (154)The two that stay red in both columns are pre-existing pins on
MARKED_FLOORandKNOWN_ROOT_DEVDEP_EXAMPLES— PR #7568's own region, which its commit moves in the samechange; only its guide was applied here, so they red by construction and neither is
touched by this branch.
Restored after each reading:
git hash-objectback to0f68499...= the HEAD blob,git status --porcelainempty, markers back to 4.(b) the real merge of both pull requests, built in a throwaway compare worktree at
f7de6dcwith this branch's diff applied on top.git merge-tree --write-treereportsONE conflict, in the
check-skill-examples.mjsheader docblock — both changes add aparagraph at the same place; resolved for the probe by keeping both paragraphs, which is
the whole resolution. On that merged tree, everything is green:
docblock paragraph and the resolution is to keep both.
Ablation
moduleSpecifiersOfBlock's body swapped back to the three regexes, at9f1a2ad, under atrap ... EXIT INT TERMrestore with absolute paths. No rebuild leg: both suites importtheir subject by relative path (
../check-doc-snippet-types.mjs), so the mutated sourceis what runs — no
dist, no packageexports, no vitest alias between them.Mutation proved on disk before any reading was taken: injected marker present (3
occurrences), removed anchor absent (0), and the file's
git hash-objectmoved from theHEAD blob
f1bb41e...toa0b7200....Three tests red, each naming itself and the false specifier; every control stayed green:
The agreement pin cannot red under this ablation and did not: it mutates both sides of
the comparison at once. It is the standing assertion, not the ablation's target.
Restored, proved by state rather than by exit code: on-disk
git hash-objectback tof1bb41e...(equal to the HEAD blob),git diff HEADempty,git status --porcelainempty, injected marker 0 occurrences.
Gates
All re-run at
aa54aee, exit captured before any pipe.pnpm check:doc-snippetsEvery covered documentation snippet compiles against the built types.pnpm check:skill-examplesEvery marked skill example the root bound could reach holds up against the built types — 4 declared row(s) in KNOWN_ROOT_DEVDEP_EXAMPLES were NOT reached, and this line does not speak for them.node scripts/check-skill-examples.mjs --self-test✓ check-skill-examples self-test: 52 cases pass (...)pnpm exec vitest run scripts/__tests__/check-doc-snippet-types.test.ts scripts/__tests__/check-skill-examples.test.tsTest Files 2 passed (2) · Tests 154 passed (154)pnpm check:doc-fences✅ check:doc-fences — every TypeScript block in 227 document(s) is fenced ts/tsx/typescript, except 80 declared file(s) carrying 90 block(s) ... (⛔ SHRINK-ONLY).pnpm check:control-bytes✅ check-control-bytes: OK (scanned 6237 tracked text file(s); skipped 85 binary).node scripts/check-changeset-presence.mjs✅ No source or published contract of a released package changed in this range, so no changeset is owed.pnpm type-check:scriptstsc -p tsconfig.scripts.jsoncleanpnpm lintTasks: 47 successful, 47 total— 0 errors; none of the four files appears in the outputDerived beyond the dispatched list, because the diff is
scripts/**:pnpm type-check:scripts(andtsc --listFilesconfirms both edited test files and bothedited
.mjsgates are in that program — 2 hits each, so "clean" really covers them),plus
check:esm-specifiers,check:pre-install-import-graph,lint:coverage,type-check:coverage,check:skills-paths— all exit 0. The union of every test filethat names either gate (13 files, found by
git grep) passes: 466 tests.No changeset:
check-changeset-presence.mjsdecides, and it says none is owed —scripts/**publishes nothing. Noskip-changesetlabel applied.Nothing under
content/docs/,skills/**or.claude/**is touched; the bound, thefloors and the declared rows are unchanged. Not a governed surface, so this stays draft
for the seat to review, flip ready and arm auto-merge.
Platform note, measured on this body.
create_pull_requeststored the footer blockand normalised it to the session-URL form. The PATCH behind
update_pull_requestthenDELETED it: the body sent without a footer and the body sent with one both stored at
exactly 12317 bytes with zero footers, so this is removal, not the recorded downgrade and
not the recorded append. Attribution is therefore carried as prose at the top of this
body, which is the shape the repo's own guidance says survives an edit; it is not
re-posted as a block, to avoid a retry loop against a sanitizer.