ci: run the half-state sweeper's 1551-case self-test in the build job - #259
Merged
Merged
Conversation
`scripts/pm/check-half-states.mjs` declares `--self-test` and carries 1551 cases, and nothing in this repo ran them. The self-test registry cannot reach it: `tools/ci-scripts/run-self-tests.mjs` scans `.github/scripts` top level only, and that property is load-bearing — it is what lets `.github/scripts/lib/` exist without tripping the unregistered-self-test rule. So this lands as one step in the existing `build` job rather than as a registry entry, leaving the scan surface and gate topology untouched. Ablation, run on a throwaway copy so the pinned upstream file was never written: mutating `DEFAULT_SWEEP_REPO` reddens 2 of the 1551 cases and exits 1. The step is therefore a live drift detector for behaviour-changing edits to this verbatim copy — not a hash-pin, which needs a cross-repo credential and is a separate decision. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ChPQM8jamxLUfUAxwFpJ8S
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 #244
Adjudicated option B, transcribed: one step in the existing
buildjob of.github/workflows/ci.yml. No registry change, no scan-surface change, no partial hash-pin. Diff is 23 added lines in one file; nothing else in the tree is touched.Premise re-verified at
562b9e6— both legs hold, plus a third I checkedgrep -n 'check-half-states' .github/workflows/ci.yml→ 0 hits (grep exit 1). Control-probed rather than trusting a bare zero: the same pathspec yieldsbuild:at:46and named steps at:33,:42,:69,:91, so it reaches live content.pnpm turbo run test --forceprinted✓ 4 self-test(s) passed— not 5.check-half-statesoccurs 0 times anywhere in that run's output..github/workflows/half-state-patrol.ymlis a standing caller of the script, but of the live sweep, not of--self-test— its onlyself-testoccurrence is at:248, inside a JS comment string. Repo-wide, across all four workflows, nothing invokedcheck-half-states.mjs --self-test. Corroborating:turbo.json'stesttask lists$TURBO_ROOT$/.github/scripts/**as an input and does not listscripts/pm/**.Carve-outs honoured, verified mechanically rather than asserted
tools/ci-scripts/run-self-tests.mjsuntouched. Its top-level-only scan remains load-bearing (SCRIPTS = join(ROOT, '.github/scripts')at:73,readdirSyncwithoutrecursiveat:123, deliberate per its own comment at:95-96).git diff --name-only HEADover them is empty, and the pinned script's blob OID is9ffcdb7646c3b3aaceab2e81596f1c55c28a6984both before and after all verification work here — identical toHEAD:scripts/pm/check-half-states.mjs.pnpm turbo run teststill reports✓ 4 self-test(s) passed. The registry count being unchanged is the mechanical evidence that this landed as a step and not as a registry entry.The verdict line — observed LOCALLY, not in CI
This PR alters the very job that will execute the step, so CI's own execution can only be observed once this PR opens. What is reported below is a local run; it is not evidence that the CI step fired.
The step was extracted verbatim from the committed YAML (parsed, not retyped:
run=node scripts/pm/check-half-states.mjs --self-test,shell: bash) and executed from the repo root under the runner's own shell,bash --noprofile --norc -eo pipefail:Exit code 0, captured by redirect-then-capture, never through a pipe.
Ablation: the step is a live gate, not a permanently-green one
Run against a throwaway copy in scratch, so the pinned upstream file was never written — this removes the restore leg entirely rather than relying on it.
DEFAULT_SWEEP_REPOwas mutated in the copy; the mutation was confirmed on disk before running (removed text count 1 → 0, injected text 0 → 1, blob OID9ffcdb76→b922f997):Exit 1 — reproducing PR #237's documented 2-of-1551 result exactly. Re-run under the runner's shell, the same mutated copy exits 1, so a behaviour-changing edit to this copy fails the
buildjob.Placement and shape
The step sits after
pnpm install --frozen-lockfileand before the zh-Hant check. The script is zero-dependency (node builtins plus one relative import ofscripts/invoked-as.mjs) and takes about a second, so it belongs with the checks that need no build rather than behindturbo run build— the same ordering rationale the zh-Hant step's own comment states.shell: bashfollows this repo's existing convention for--self-teststeps (ci.yml:33,translations.yml:80); the command has no pipe, sopipefailis not what carries the exit code here — a barerun:does.Gates, each with its own conclusion, all at
d3bd9c6pnpm turbo run test --force✓ 4 self-test(s) passed;Tasks: 1 successful, 1 total✓ check-half-states self-test: 1551 cases pass.ci.ymlYAML parsebuildjob has 10 steps, the new one 5thNo changeset: this repo has no
packages/and no changeset flow.🤖 Generated with Claude Code
https://claude.ai/code/session_01ChPQM8jamxLUfUAxwFpJ8S
Generated by Claude Code