Surfaced by a real reddening on PR #13415, worked around inside that PR's own diff without deciding the general question. Filing the question itself, unassigned. Related but distinct from #13450: that card is about which diffs select the gate; this one is about what the gate counts.
The measurement
scripts/isystem-census.mjs classifies test code by path only, and publishes that rule verbatim on content/docs/permissions/system-context.mdx:299:
// scripts/isystem-census.mjs:135-137
/** A file counts as a test by PATH, the same rule the page publishes. */
export function isTestPath(relPath) {
return /\.(test|spec)\./.test(relPath) || /(^|\/)(tests|__tests__|qa)\//.test(relPath);
}
.testkit.ts matches neither arm. So a .testkit.ts file sitting beside its suite is in the census population, while the identical code in the .test.ts next to it is out.
How it showed up
PR #13415 extracted a recording double out of a .test.ts into a sibling .testkit.ts so two suites could share it. The double carries isSystem: opts?.context?.isSystem === true. That single move — no behaviour change, no new code — took the census from 109 → 110 sites and 45 → 46 files, and demanded a hand-written page row plus eight declared-count bumps, one of which (ruling-sites) is #4707's premise quoted on the page as a live count.
That is the wrong bill for that change, and I told the PR's author not to pay it. The repair taken instead: the file moved under packages/core/src/security/__tests__/, one of the page's own published exclusion segments, with repo precedent (133 files already live under __tests__/, including non-suite scaffolding such as packages/cli/src/utils/__tests__/server-body.ts). Census restored to its exact baseline, page bytes untouched. That fix is correct for that one file and settles nothing here.
Why it has never bitten before
Repo-wide there are 9 .testkit.ts files. Only one other mentions isSystem — plugin-sharing/src/exec-context-seam.testkit.ts — and it carries a comment plus a declaration (isSystem: false), not an elevation read. So main is green today with testkits in-population, and #13415's would have been the first testkit elevation read in the census's history. There is no evidence anyone ever decided testkits belong in that population; it reads as never having come up.
Options
A — add .testkit. to the census path rule. The convention means "test input" regardless of directory, and the census header scopes itself to non-test sources. ⚠️ Not free: it also moves the existing declarations count, because plugin-sharing's testkit declaration leaves the population — a page change outside any one card's diff, which is exactly the kind of edit no ordinary PR should be made to carry.
B — keep the path-only rule; require testkits with elevation reads to live under __tests__/. Already satisfied for the only affected file. Costs nothing today, but it is an unwritten convention enforced by a gate that names a different rule, so the next person meets it as a surprise red rather than as a rule.
C — keep the rule and hand-write page rows for testkit elevation reads as they appear. Makes each occurrence a docs edit with count bumps. On the #13415 evidence that bill is ~8 count changes for a file move, and it puts a ruling's quoted premise in the blast radius of routine refactors.
The agent that measured this recommends A, on the grounds that the convention's meaning is "test input" regardless of directory. I am not ruling on it: A changes a published population by touching a count no card's diff explains, which is the gate owner's call to make deliberately rather than a side effect of unblocking a PR.
Not blocking anything
PR #13415 is unblocked by the file move; nothing waits on this ruling. It is filed so the question is answered once, deliberately, rather than re-litigated by whoever next writes a .testkit.ts that reads isSystem.
Surfaced by a real reddening on PR #13415, worked around inside that PR's own diff without deciding the general question. Filing the question itself, unassigned. Related but distinct from #13450: that card is about which diffs select the gate; this one is about what the gate counts.
The measurement
scripts/isystem-census.mjsclassifies test code by path only, and publishes that rule verbatim oncontent/docs/permissions/system-context.mdx:299:.testkit.tsmatches neither arm. So a.testkit.tsfile sitting beside its suite is in the census population, while the identical code in the.test.tsnext to it is out.How it showed up
PR #13415 extracted a recording double out of a
.test.tsinto a sibling.testkit.tsso two suites could share it. The double carriesisSystem: opts?.context?.isSystem === true. That single move — no behaviour change, no new code — took the census from 109 → 110 sites and 45 → 46 files, and demanded a hand-written page row plus eight declared-count bumps, one of which (ruling-sites) is #4707's premise quoted on the page as a live count.That is the wrong bill for that change, and I told the PR's author not to pay it. The repair taken instead: the file moved under
packages/core/src/security/__tests__/, one of the page's own published exclusion segments, with repo precedent (133 files already live under__tests__/, including non-suite scaffolding such aspackages/cli/src/utils/__tests__/server-body.ts). Census restored to its exact baseline, page bytes untouched. That fix is correct for that one file and settles nothing here.Why it has never bitten before
Repo-wide there are 9
.testkit.tsfiles. Only one other mentionsisSystem—plugin-sharing/src/exec-context-seam.testkit.ts— and it carries a comment plus a declaration (isSystem: false), not an elevation read. Somainis green today with testkits in-population, and #13415's would have been the first testkit elevation read in the census's history. There is no evidence anyone ever decided testkits belong in that population; it reads as never having come up.Options
A — add⚠️ Not free: it also moves the existing declarations count, because
.testkit.to the census path rule. The convention means "test input" regardless of directory, and the census header scopes itself to non-test sources.plugin-sharing's testkit declaration leaves the population — a page change outside any one card's diff, which is exactly the kind of edit no ordinary PR should be made to carry.B — keep the path-only rule; require testkits with elevation reads to live under
__tests__/. Already satisfied for the only affected file. Costs nothing today, but it is an unwritten convention enforced by a gate that names a different rule, so the next person meets it as a surprise red rather than as a rule.C — keep the rule and hand-write page rows for testkit elevation reads as they appear. Makes each occurrence a docs edit with count bumps. On the #13415 evidence that bill is ~8 count changes for a file move, and it puts a ruling's quoted premise in the blast radius of routine refactors.
The agent that measured this recommends A, on the grounds that the convention's meaning is "test input" regardless of directory. I am not ruling on it: A changes a published population by touching a count no card's diff explains, which is the gate owner's call to make deliberately rather than a side effect of unblocking a PR.
Not blocking anything
PR #13415 is unblocked by the file move; nothing waits on this ruling. It is filed so the question is answered once, deliberately, rather than re-litigated by whoever next writes a
.testkit.tsthat readsisSystem.