Repository navigation
test(cli): every bin that calls refuseUnknownFlags has a row in the unknown-flag table - #285
Merged
Merged
Conversation
…nknown-flag table What changed: cli.test.mjs's "every CLI refuses a flag it does not know" table gains measure.mjs, export-warc.mjs, artifact.mjs and panel.mjs, each with no arguments (measure and export-warc refuse before they look for a project; artifact with no subcommand names the flag and exits 2, the subcommand path's exit 3 being covered by artifact-cli.test.mjs; panel refuses before it listens), and a guard before the loop: every .mjs under bin/ whose source calls refuseUnknownFlags( must have a row, or the test fails naming the files. CHANGELOG Unreleased, one bullet. Rows and guard sit in the existing registration, so the inventory stays 1789. No file under bin/ or lib/ changed (#271). Why: four CLIs called refuseUnknownFlags and were never added to the table, so the one test that proves the refusal exists did not run them, and a fifth could be forgotten the same way; the guard turns the omission into a named red. The CLIs with their own refusal (collect-remote, disclosure, mcp-server, path-authority) are not matched by the guard and keep their own tests. What you verified: verified red first - with only the guard in place, `node research-kit/bin/selftest.mjs cli` from the repository root: 117 passed, 1 failed, "these CLIs refuse unknown flags but have no row in this table: artifact.mjs, export-warc.mjs, measure.mjs, panel.mjs" (Node 24.21.0 linux); verified with the four rows: 118 passed, 0 failed, 25.8 s; verified the full offline suite on Node 24.21.0 linux: 1789 passed, 0 failed, 0 unsupported, 202.4 s, exit 0; verified git diff --check clean, both files LF-only; untested when written: this commit's all-seven CI. What you got wrong: nothing to report. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gg4isLfN2Ng16zr5DwTnH9
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 free
to 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 #271.
What changed
Tests only. The "every CLI refuses a flag it does not know" table in
cli.test.mjsgainsmeasure.mjs,export-warc.mjs,artifact.mjsandpanel.mjs, and a guard before the loop: every.mjsunderbin/whose source callsrefuseUnknownFlags(must have a row, or the test fails naming the files. One CHANGELOG bullet. Inventory unchanged (1789): rows and guard sit in the existing registration. No file underbin/orlib/changed.measureandexport-warcrefuse before they look for a project, so no arguments are needed.artifactwith no subcommand names the unknown flag and exits 2; with a subcommand the refusal is exit 3 (BLOCKED), whichartifact-cli.test.mjsalready covers.panelrefuses before it listens on anything.collect-remote,disclosure,mcp-server,path-authority) are not matched by the guard and keep their own tests.Verified
selftest.mjs cli117 passed, 1 failed, naming exactlyartifact.mjs, export-warc.mjs, measure.mjs, panel.mjs.git diff --checkclean; both files LF-only.Untested
This PR's all-seven CI.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Gg4isLfN2Ng16zr5DwTnH9
Generated by Claude Code