Repository navigation
fix(scripts): check-readme-exports names its population as TRACKED, plus the scripts/ population census - #7017
Merged
Conversation
Both of the gate's walks are `git ls-files -- packages/`, but its verdict line read "N README(s) under packages/" — a claim about the directory. A brand-new `packages/<pkg>/README.md` that has not been `git add`-ed is outside the population, so a local pre-flight run reports OK without ever opening it. Measured: planting an untracked `packages/census-probe-pkg/README.md` left `census.readmes` at 43 and produced a byte-identical verdict line. CI is unaffected — a committed tree has no untracked files — so this is purely local pre-flight legibility. The population is unchanged; only the sentence describing it. Found by a census of every `scripts/` gate enumerating with `git ls-files`: four use it as their judged population, and this was the only one that did not say so. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GgDDqh6YnkXqsnVTCa7wHk
This was referenced Aug 31, 2026
zhuangjianguo
marked this pull request as ready for review
August 31, 2026 13:06
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 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 #6545
What this is
The card's graded remedy — "make the population explicit in the gates' output" — was already in place on the two gates the card named, and had been since the commits that introduced them. So this PR is the other half the grading required: the census across
scripts/, plus the one gap it found.The stale premise, measured
tracked?check-control-bytesscanned N tracked text file(s)7c9a4e5e3, 2026-08-05 (the commit that introduced it)check-vi-mock-specifiersN tracked source file(s)e9e55524e, 2026-08-25 (the commit that introduced it)Neither file has been touched since the card was filed (2026-08-26 10:09Z) —
git log --sinceon both paths is empty. That is why the card's own evidence block already quotestrackedin both outputs: option 1 was satisfied before it was written.The census
Framed as the card's real question — can this gate be asked about a file it will not open, and does its output admit that? — rather than a grep for
git ls-files.Nine
scripts/files shell out to git. Four usegit ls-filesas their judged population:check-control-bytesN tracked text file(s)check-vi-mock-specifiersN tracked source file(s)check-vi-mock-inheritN tracked source file(s)check-readme-exportsN README(s) under packages/, a claim about the directoryNot in the population question, and why:
check-changeset-presence— already solved in the opposite direction: it runsgit ls-files --others --exclude-standardover.changeset/*.mdspecifically to see untracked changesets, so that writing one and running the gate before staging is not a false red. Documented in the script: "Empty in CI, where the checkout has no untracked files." Prior art for widening a population where the gate is asking "did you write X".check-skills-paths— reads the directory, notgit ls-files, and says so in its own docstring. Untracked files are inside its population.pm/check-half-states— usesgit ls-filesas a validation oracle for path tokens, not as a scan population. An unverifiable token is dropped by design, so the index under-reports rather than invents.check-changeset-presence,check-i18n-en-drift,check-changeset-overwrite,check-governed-queue-guard) has a sibling population question — a range cannot see an uncommitted edit — and both gates that print a census already name it:Compared the working tree with SHA (merge-base with origin/main)andNo en value changed in this range.readdirSync/ glob) have the inverse exposure, not this one: they see untracked files.The one gap, and the fix
check-readme-exportswalksgit ls-files -- packages/twice (READMEs, and package manifests) but reported43 README(s) under packages/. That phrasing is a filesystem claim, and as a filesystem claim it is false the moment an author writes a new README and has not staged it.Measured on this branch — planting a real, untracked
packages/census-probe-pkg/README.mdandpackage.json, then reading the gate's own census through its exportedscan():Byte-identical. The gate was green about a
README.mdsitting underpackages/that it never opened.The change is the sentence, not the population: the verdict now reads
43 tracked README(s) under packages/and... of 40 tracked package(s). Same walk, same counts, same exit codes. Plus a header section stating the blind spot, and the matching correction incontent/docs/guide/ci-cd-pipeline.md, which also said "for everyREADME.mdunderpackages/".⛔ Options 2 and 3 are not here
Widening the population to untracked files, or refusing to run on a dirty worktree, change what these gates mean. The census did not make either look right: the one gate where widening is genuinely correct (
check-changeset-presence) already does it, deliberately and locally. No recommendation to escalate.Tests
Union run on
728ddacb2, the branch head.pnpm exec vitest run --maxWorkers=2 scripts/__tests__/— 90 files, 2573 tests passed. The whole tree, not just the gate's own file:content/docs/guide/ci-cd-pipeline.mdis pinned byci-cd-pipeline-doc.test.ts,doc-version-claims,lint-workflow,merge-queue-reporting,dependabot-merge-gate,check-action-forward-parity,quick-reference-current-release-4143andscripts-type-check.check:control-bytes,check:entry-guard,check:doc-fences,check:vi-mock-specifiers,check:vi-mock-inherit,check:shell-escape-residue,check:skills-paths,check:changeset-presence,check:changeset-fixed,check:changeset-no-major,check:changeset-overwrite— allexit=0.pnpm run type-check:scripts— exit 0, andtsc --listFilesconfirms the edited test file is one of the 153 files in that program (not excluded).eslint --no-inline-config --format jsonon the two changed JS/TS files — 0 errors, 0 warnings. Narrowed, and the narrowing is measured: the file count is eslint's own (--format json, 2 records); the markdown file is reported by eslint itself as outside its population ("File ignored because no matching configuration was supplied"), so it is covered bycheck:doc-fencesinstead; andeslint.config.jsdeclares noparserOptions.project/projectService, so with type-aware linting off this diff cannot move the verdict on any file it does not touch.Reverse verification of the new pin — predicted direction RED, and RED is what happened. Reverting only the two wording changes in the committed
scripts/check-readme-exports.mjs(mutation confirmed on disk: removed-text count 0, blobeea2eacdvs HEAD19fe5855, re-confirmed still mutated after the run) fails exactly one test:The pre-existing census-shape pin stays green, which is correct — it pins the shape, not the population word. Restore leg proven by blob equality with
HEAD(19fe5855) plus an emptygit diff HEADand emptygit status --porcelain, not by an exit code. No build is involved: the test imports the.mjssource directly, so there is nodist/that could serve a stale copy.A first attempt at this ablation was void and is reported as such: the setup shell's
EXITtrap restored the file when that call ended, so the following call measured the unmutated tree and reported a green that looked like a passing ablation. Redone with mutation, run, and both proofs inside one invocation.Changeset:
.changeset/6545-gate-population-census.md, empty frontmatter — no package source, no published contract, no runtime behaviour changes.Generated by Claude Code