From bc8e2181be0268486a1fa1c2ca852bed0ad12ed3 Mon Sep 17 00:00:00 2001 From: garrytan Date: Sat, 3 Oct 2026 22:33:09 +0000 Subject: [PATCH] test-of-test ratchet: a repo script or setup read by path counts as product code codex-invocation-sites (runs scripts/gen-skill-docs.ts), gstack-config-gbrain-refresh (copies bin/ through a variable) and setup-cso-windows-probe (reads setup and scripts/build-cso-windows.ps1) exercise product code the detector could not see. --- test/test-of-test-ratchet.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test-of-test-ratchet.test.ts b/test/test-of-test-ratchet.test.ts index 111b67986..eb5c704e0 100644 --- a/test/test-of-test-ratchet.test.ts +++ b/test/test-of-test-ratchet.test.ts @@ -210,7 +210,9 @@ function testsOnlyTestCode(file: string): { counted: boolean; helper?: string } const targets = directSpecifiers(source).map(specifier => resolveRepoSpecifier(ROOT, file, specifier)).filter(Boolean) as string[]; if (targets.some(target => !target.startsWith('test/') && !target.startsWith('node_modules/'))) return { counted: false }; if (/(['"`])[^'"`\n]*(?:\bbin\/|SKILL\.md|CLAUDE\.md|\.tmpl)[^'"`\n]*\1/.test(source)) return { counted: false }; - if (/(['"`])(?:\.\/)?\.github\b[^'"`\n]*\1|(['"`])bin\2\s*,\s*(['"`])[\w.-]+\3/.test(source)) return { counted: false }; + if (/(['"`])(?:\.\/)?\.github\b[^'"`\n]*\1|(['"`])bin\2\s*,\s*(?:(['"`])[\w.-]+\3|[A-Za-z_$])/.test(source)) return { counted: false }; + // A repo script run or read by path (`scripts/gen-skill-docs.ts`, `path.join(ROOT, 'setup')`) is product code too. + if (/(['"`])(?:\.\/)?scripts\/[\w./-]+\1|ROOT\s*,\s*(['"`])setup\2/.test(source)) return { counted: false }; return { counted: true, helper: targets.find(target => target.startsWith('test/helpers/') && !target.endsWith('.test.ts')) }; }