Uh oh!
There was an error while loading. Please reload this page.
fix(devx): give affected-docs' route walk a PATH, not a basename (#11866) - #12002
Merged
Merged
Conversation
`scanRouteSurface`'s walk handed `isTestFile` `e.name`, so the `__tests__` / `__mocks__` / `__fixtures__` arms -- which require a `/` -- could never match there. Only the `*.test.*` / `*.spec.*` arm did any work, and the directory exclusion the function documents was not happening for either consumer of that walk: the bridge's own registrar discovery, or the #11178 ceiling population it fills in the same pass. Split the walk out as `walkSourceFiles(root, readDir)` and test the walk-relative path. Measured as a strict tightening rather than assumed: of the 4625 `.ts` files under `packages/**` on d63b014, 3 were admitted by the basename test and are excluded by the path test, and ZERO go the other way -- the file arms are anchored `(^|/)`, so a basename they match is matched inside a path too. The self-test could not see this: it pins `isTestFile` with full paths, and the predicate was never the broken half. The new cases walk a fake tree through the call site, with fixtures chosen for non-vacuity -- the live population is zero, so a pin built from real paths would pass just as green with the bug in place. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ahemw8RcTgqtxrj15PEZx
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-steve
marked this pull request as ready for review
August 25, 2026 04:34
os-steve
enabled auto-merge
August 25, 2026 04:35
Uh oh!
There was an error while loading. Please reload this page.
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#11866
scanRouteSurface's walk handedisTestFilee.name— a basename — so the__tests__/__mocks__/__fixtures__arm, which requires a/, could never matchthere. Only the
*.test.*/*.spec.*arm did any work, and the directory exclusion thefunction documents was not happening for either consumer of that walk: the bridge's
own registrar discovery, or the #11178 ceiling population filled in the same pass.
The remedy, and the question the card declined to rule
The card explicitly left open "whether the walk should exclude these directories at
all — the ceiling in PR #11865 arguably wants the widest possible population."
Resolved: exclude, from both consumers. Not on taste — on what the ceiling's verdict
means. A row counted
remediable by discoveryis a claim that widening the filenameconvention would reach it, and no widening of that convention may legitimately admit a
test double. A witness under
__tests__/would therefore move a row intoremediableagainst a remedy nobody can take — precisely the conflation
bridgeCoverageFrom's splitexists to end ("it aimed a whole card at widening a recognizer that was never the
constraint"). Two supporting measurements:
narrow together and
reachablestill cannot exceed the ceiling.check-affected-docs.mjsexits non-zero onbrokenScanalone —the 45/221 ratio and the 82-tail ceiling are reported, never gated. There is no
shrink-only number here to move down.
Route (a) from triage — pass the walk-relative path — over route (b) (basename against
the file arms, joined path against the directory arms):
isTestFileis defined over apath, its docblock says so, and all 14 of its existing self-test cases pass one. (b)
would enshrine a two-convention contract that nothing pins.
Measurements
The card's "0 live" claim, re-measured on
d63b01436(it was taken on589758d22,before #11865 landed): still exactly 3 files, still 0 matching
REGISTRAR_FILE_REorLEDGER_FILE_RE—hono/src/__mocks__/runtime.ts,cli/src/utils/__tests__/server-body.ts,service-datasource/src/__tests__/entitled-caller.fixture.ts. Latent, not live: confirmed.And the half the card did not measure — the ceiling.
sourceFilesadmits any file, notjust convention-matched ones, so a test-dir file declaring a
path:would inflate theceiling without ever matching
REGISTRAR_FILE_RE. Measured directly:--bridge-coverageand
--bridge-coverage --jsonare byte-identical across this change (12 registrarfiles · 43 tails · 82-tail ceiling · 45/177 reach · 14/56/107 causes). The dormant-hole
framing holds for both halves.
"Passing
relis safe" — falsified in the loose direction, and it holds. Of the 4625.tsfiles underpackages/**: 3 excluded-by-path-but-not-by-basename, 0 the otherway. The file arms are anchored
(^|/), so a basename they match is matched inside a pathtoo — reordering
relahead of the test is a strict tightening of this walk.The other callers of
isTestFile, swept (the card did not): it is module-local, neverexported, and the script is only ever spawned. Three call sites — the walk (basename,
broken), the
--self-testcases (full paths, correct), and the changed-file loop overgit diff --name-onlyoutput (full paths, correct). Only the broken one is touched, sothe fix cannot break a caller that was already passing a path.
The pin, and why it is not vacuous
green with the bug in place and pin nothing. The fixtures are therefore chosen to be
files the basename test admits and the path test excludes —
__tests__/x-route.tscarries no
.test./.spec.infix, so under the old call site it was walked, matchedREGISTRAR_FILE_RE, and a test double contributed production route tails.The walk is split out as
walkSourceFiles(root, readDir)—readDirinjectable for thesame reason
packageRootOf'shasPackageJsonis — so the pin walks the call siteagainst a fake tree, not the predicate. That matters: the existing self-test pins
isTestFilewith full paths and is green either way; the function was never the brokenhalf.
Red before, green after, observed on disk in both directions. The one call-site
argument was mutated back to
e.nameunder atrap … EXIT INT TERM, with the mutationconfirmed by anchored
grep -con both the injected and the removed text (the firstattempt was a silent no-op — a
perl\Q…\Eanchor with pre-escaped parens matchednothing and exited 0; the on-disk check caught it, and that reading was discarded):
--self-testgit statusclean✓ 451 cases pass.--bridge-coverageunder the mutation is identical to the pre-fix baseline, which is thesame zero-live fact from the other side.
#11857 — checked for collision, and there is none
#11857 is the sibling gap in the same function (the patterns:
isTestFileexcludesneither
test/fixtures/*.tsnor*.bench.ts, plus a larger evidence-based admissionroute). Not fixed here. The two are disjoint on today's tree — measured: all three
files #11857 enumerates are admitted both before and after this change. They are also
complementary, in one direction:
test/fixtures/*.tsis itself a path-shaped pattern,so adding it to
isTestFilewhile this call site still passed a basename would produceanother dead arm — the identical failure. This PR is a prerequisite for #11857's cheaper
half, never a competitor to it. Textually, #11857 would edit the predicate body and may
extend
walkSourceFiles; that is a rebase touch, not a semantic conflict.Verification
Run at
ad9307722, the branch head.node scripts/docs-audit/affected-docs.mjs --self-test→✓ affected-docs self-test: 451 cases pass.node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack(no hand-written path list — it reads the change set off the merge base itself), pluscheck:nul-bytes, green. Their own verdict lines, not bare exit codes:✓ check-affected-docs→451 cases pass.·✓ check-drift-comment: 56 cases pass across 5 fixture diff(s).✓ check-self-test-wired: every one of the 127 script(s) CI runs that ship a --self-test has that self-test run by CI.✓ check:entry-guard: 156 scripts/ file(s)·✓ check:parse-guard: 155 scripts/ file(s)✓ check-governed-merges --self-test: 129 assertions·✓ check-pnpm-filter-targets --self-test: 40 assertions✓ check-agent-test-spelling: 0 violations·✓ docs-accuracy-audit scope is in syncOK: all 96 declared cross-package glob(s)…·OK: 16 package(s) read outside themselves…check-nul-bytes: OK (scanned 6661 text file(s) … no raw ASCII control bytes)pnpm lint(eslint . --no-inline-config) run in full, not narrowed — clean, 55s under the shared verify lock.No changeset: this edits a CI-internal script and releases nothing — the case
lint.ymlnames as textbookskip-changeset. Label applied and read back.Generated by Claude Code