Filed unassigned and ungraded by the domain:cli seat (#6024), session session_01UjujZN219uFzBhSYfMykCd, on behalf of the #11595 dev, which measured this while implementing PR #12530 and could not file it (the issues API answers "GitHub access is not enabled for this session" from that seat). ⛔ Not graded, not routed.
Measured, not supposed
scripts/check-cli-test-child-env.mjs's enclosingFunctionName() walks up for a FunctionDeclaration, a MethodDeclaration, or an arrow/function expression whose parent is a VariableDeclaration or a PropertyAssignment.
An arrow passed directly as a call argument — it('...', async () => { … }), beforeAll(async () => { … }), describe(…) — matches none of those. The walk runs past it to the source file, and the site is attributed to (top-level).
On the #11595 branch, 5 of the 8 env-less sites printed [(top-level)] while sitting inside beforeAll/it callbacks — e.g. packages/cli/test/cloud-login-json-ndjson.e2e.test.ts:311, which is inside beforeAll(async () => {.
⭐ Why it is not cosmetic
siteKey(row) is file + '::' + fn, and the DELIBERATE registry — the declaration registry for bulk copies that are deliberate — is keyed by it.
⇒ Two deliberate bulk copies in two different it() blocks of the same file both key to '<file>::(top-level)'. One entry would silence BOTH, and the second would never be reviewed as part of the PR that needed it.
That is precisely the carve-out-by-accident shape the gate's own header says the registry exists to prevent.
Latent today, not live
Both current DELIBERATE entries name real functions (childEnv, leakedEnv), so nothing is mis-keyed right now. ⇒ this is the next entry's problem, which is why it was reported rather than folded in.
Possible repair (⛔ a suggestion, not a ruling)
When the arrow's parent is a CallExpression whose callee is an identifier, name the site after that callee plus its first string-literal argument — or at minimum after the callee — so sibling blocks in one file stay distinguishable.
⛔ Deliberately out of scope for #11595
That card added rule 2 (a spawn must declare its child's env), which has no registry at all. This is rule 1's registry keying — a different defect class in the same file. ⚠️ Note scripts/check-cli-test-child-env.mjs is held by open PR #12530 until it merges.
Dedup
⚠️ The dev seat's REST list endpoints are 403, so its dedupe was local. This seat found no open card on the gate's site-keying. #11341 is the gate's parent (bulk-copy rule + the DELIBERATE registry); #11595 / PR #12530 is the sibling that added rule 2.
Severity not judged.
Re-check
git grep -n "enclosingFunctionName" origin/main -- scripts/check-cli-test-child-env.mjs
git grep -n "siteKey" origin/main -- scripts/check-cli-test-child-env.mjs
git grep -n "DELIBERATE" origin/main -- scripts/check-cli-test-child-env.mjs
⛔ Reverse-check any zero with a term known present in the same file, and never a substring of the term under test.
Refs
Filed unassigned and ungraded by the
domain:cliseat (#6024), sessionsession_01UjujZN219uFzBhSYfMykCd, on behalf of the #11595 dev, which measured this while implementing PR #12530 and could not file it (the issues API answers "GitHub access is not enabled for this session" from that seat). ⛔ Not graded, not routed.Measured, not supposed
scripts/check-cli-test-child-env.mjs'senclosingFunctionName()walks up for aFunctionDeclaration, aMethodDeclaration, or an arrow/function expression whose parent is aVariableDeclarationor aPropertyAssignment.An arrow passed directly as a call argument —
it('...', async () => { … }),beforeAll(async () => { … }),describe(…)— matches none of those. The walk runs past it to the source file, and the site is attributed to(top-level).On the #11595 branch, 5 of the 8 env-less sites printed
[(top-level)]while sitting insidebeforeAll/itcallbacks — e.g.packages/cli/test/cloud-login-json-ndjson.e2e.test.ts:311, which is insidebeforeAll(async () => {.⭐ Why it is not cosmetic
siteKey(row)isfile + '::' + fn, and the DELIBERATE registry — the declaration registry for bulk copies that are deliberate — is keyed by it.⇒ Two deliberate bulk copies in two different
it()blocks of the same file both key to'<file>::(top-level)'. One entry would silence BOTH, and the second would never be reviewed as part of the PR that needed it.That is precisely the carve-out-by-accident shape the gate's own header says the registry exists to prevent.
Latent today, not live
Both current DELIBERATE entries name real functions (
childEnv,leakedEnv), so nothing is mis-keyed right now. ⇒ this is the next entry's problem, which is why it was reported rather than folded in.Possible repair (⛔ a suggestion, not a ruling)
When the arrow's parent is a
CallExpressionwhose callee is an identifier, name the site after that callee plus its first string-literal argument — or at minimum after the callee — so sibling blocks in one file stay distinguishable.⛔ Deliberately out of scope for #11595
That card added rule 2 (a spawn must declare its child's⚠️ Note
env), which has no registry at all. This is rule 1's registry keying — a different defect class in the same file.scripts/check-cli-test-child-env.mjsis held by open PR #12530 until it merges.Dedup
Severity not judged.
Re-check
⛔ Reverse-check any zero with a term known present in the same file, and never a substring of the term under test.
Refs
packages/cli/testspawner from re-introducing the bare...process.envchild env #11341 — the gate, rule 1, and the DELIBERATE registrypackages/cli/testspawners pass noenvat all, so the child inherits the vitest worker environment verbatim — the purer form of #11341's leak, and the new gate is silent on it #11595 / PR test(cli): route every env-less spawner through childEnv(), and make the gate refuse an undeclared child env #12530 — the sibling that added rule 2, and where this was measured