Skip to content

Commit 9a47439

Browse files
Merge pull request #285 from StepenkoAnatoli/claude/unknown-flag-table-20261011
test(cli): every bin that calls refuseUnknownFlags has a row in the unknown-flag table
2 parents 080faef + 27dc190 commit 9a47439

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Each release of Research-Kit, newest first. The version is `KIT_VERSION` in
55

66
## Unreleased
77

8+
- The suite's "every CLI refuses a flag it does not know" table now covers `measure`,
9+
`export-warc`, `artifact` and `panel`, and fails by name when a file under `bin/` calls
10+
`refuseUnknownFlags` without a row (#271). Tests only; no CLI changed.
11+
812
- `doctor` reports Node 22.13.0 through 22.22.0 as a failing Node line (#282, ADR-0159):
913
those builds' `TextDecoder` reads `windows-1252` as Latin-1 (nodejs/node#60888), so a
1014
page's euro signs, curly quotes and dashes were captured as control characters with no

‎research-kit/test/cli.test.mjs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,20 @@ test('every CLI refuses a flag it does not know, before it does anything', () =>
965965
['evidence-context.mjs', ['--all']],
966966
['audit.mjs', []], ['brief.mjs', []], ['doctor.mjs', []], ['gate.mjs', []], ['handoff.mjs', []],
967967
['preflight.mjs', []], ['prior.mjs', []], ['research.mjs', ['--dry-run']], ['bundle.mjs', []],
968+
// Added 2026-10-11 (#271). measure and export-warc refuse before they look for a project.
969+
// artifact with no subcommand names the unknown flag and exits 2; with a subcommand the
970+
// refusal is exit 3 (BLOCKED) and artifact-cli.test.mjs covers it. panel refuses before
971+
// it listens on anything.
972+
['measure.mjs', []], ['export-warc.mjs', []], ['artifact.mjs', []], ['panel.mjs', []],
968973
];
974+
// Found 2026-10-11 (#271): four CLIs called refuseUnknownFlags and had no row here, so a new
975+
// CLI could be forgotten again. Every file under bin/ that refuses unknown flags by that name
976+
// must have a row; a CLI with its own refusal (collect-remote, disclosure, mcp-server,
977+
// path-authority) is covered by its own tests.
978+
const refusing = fs.readdirSync(path.join(KIT_ROOT, 'bin'))
979+
.filter((name) => name.endsWith('.mjs') && /refuseUnknownFlags\(/.test(fs.readFileSync(path.join(KIT_ROOT, 'bin', name), 'utf8')));
980+
const missing = refusing.filter((name) => !cases.some(([bin]) => bin === name));
981+
assert.deepEqual(missing, [], `these CLIs refuse unknown flags but have no row in this table: ${missing.join(', ')}`);
969982
for (const [bin, args] of cases) {
970983
const root = planned('flags');
971984
const r = run(bin, [...args, '--no-such-flag'], { root, env: { HOME: home, USERPROFILE: home, RESEARCH_KIT_CONFIG: path.join(home, 'c.json') } });

0 commit comments

Comments
 (0)