Repository navigation
fix(scripts): the UI evidence harness refuses a value that belongs to no flag, and prefers UI_TOKEN over --token - #1775
Merged
Conversation
… no flag, and prefers UI_TOKEN over --token Two follow-ups Vera read out of the harness after #1770 (70101, corrected in 70102): - `--width 390 400` passed: the `400` belonged to no flag and the parser skipped it with `continue`, so the capture ran with 390 and never said so. A value that belongs to no flag is now refused with exit 2 and named, in the same message that already lists the known flags. Argument parsing moved to `scripts/lib/ui-evidence-args.js` — it imports nothing, so the argument contract has a witness that needs no browser, and Playwright is now imported after validation (a usage error no longer requires a browser to be installed). - `--token <jwt>` puts the seat's JWT in the process table and in shell history. `UI_TOKEN` carries the same value through a channel that shows in neither, so both the runbook and the script's usage block now lead with the environment form and keep `--token` as the explicit fallback. Docs: the table's "an unknown flag is refused" row now covers stray values as well — the sentence was accurate as written (it said *flag*), which is why the gap was in the tool rather than in the claim.
samxu01
force-pushed
the
kai/harness-arg-guards
branch
from
September 19, 2026 18:23
1f256eb to
cd5f7e0
Compare
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.
What
Two follow-ups Vera read out of the harness while clearing #1770, neither a hold (70101, her own correction in 70102).
1. A value that belongs to no flag was skipped without a word.
--width 390 400ran with 390 and never mentioned the 400, because the parser didcontinueon anything not starting with--. That is the same silent-input class as rule 27's unimplemented flag, one step over: the tool accepted input it did not act on. It is now refused with exit 2, naming the value and listing the known flags — the shape the unknown-flag refusal already had.Argument parsing moved to
scripts/lib/ui-evidence-args.js(a module that imports nothing), so the argument contract has a witness that needs no browser, and Playwright is imported after validation —--widht 390now says so whether or not a browser is installed.2.
--token <jwt>leaks the JWT through two channels it does not need to. The process table (ps) and shell history.UI_TOKENcarries the same value through neither, so the runbook and the script's usage block lead with the environment form (UI_TOKEN="$TOK" node scripts/ui-evidence-shot.mjs …) and keep--tokenas the explicit fallback. The flag still works; the doc no longer recommends it.Doc note: Vera's correction was right and worth recording — the runbook's sentence says an unknown flag is refused, so it was accurate, and the gap was in the tool. The row now covers both inputs.
Evidence
backend/__tests__/unit/scripts/uiEvidenceShotArgs.test.js— 8 tests, all passing: the stray value refused and named, a route passed positionally refused rather than ignored,--flag valueand--flag=valueboth parsed as the same flag,--clickalone a boolean, the unknown flag refused with the known list printed, both mistakes reported in one message, and a fully known invocation not refused.--width 390 400→unexpected value(s): 400 …exit 2;--widht 390→unknown flag(s): --widht …exit 2;--width=390px→ the 200–4000 range message, exit 2. All three exit before the browser is needed.--flag=valuebranch → the joined-form test; drop the boolean branch → the bare-flag test.Scope
scripts/ui-evidence-shot.mjs,scripts/lib/ui-evidence-args.js(new),docs/runbooks/local-ui-render-harness.md, one backend test. No version slot —scripts/,docs/andbackend/__tests__are outside what the release ladder guards. Cut on2ae3e00e(#1770, merged).