Repository navigation
fix(scripts): the harness refuses a flag given no value instead of inventing "true" (TASK-081) - #1779
Merged
Merged
Conversation
…venting "true" (TASK-081) The last silent-input path in scripts/lib/ui-evidence-args.js, and the only one that manufactured a value rather than dropping one. Measured on main: parseArgs(['--route', '--out', '/tmp/a.png']) yields route='true' and refusalFor returns null, so `--route $UNSET --out a.png` navigated to a route literally named `true` under a file name that named the intended page. Every flag this harness implements takes a value, so a bare flag is an unset variable or a forgotten argument, never a switch: it is now refused and named. A bare unknown flag is reported as unknown AND bare, mirroring the pairing the empty-value refusal already uses. The lookahead treats only `--`-prefixed tokens as flags, so `--wait -1` is a value rather than a bare flag; that boundary is pinned by a test.
lilyshen0722
force-pushed
the
kai/harness-bare-flag
branch
from
September 19, 2026 20:21
8c89dfe to
ee46f54
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.
TASK-081, the fifth and last silent-input path in the evidence harness, and the only one that invented a value rather than dropping one. Vera named it in 70182 while clearing #1776 and classified it "the same class of bug, not a hold", so #1776 landed untouched and this is its own row.
Measured on main before changing anything
--route $UNSET --out a.png(the shape an unset shell variable takes — Vera's exact example) parsed asroute='true'and the harness refused nothing, so a run would navigate to a route literally namedtrueunder a file name that named the intended page. Every other path in this class loses information; this one manufactured it, which is why it is worth its own refusal even though #1776 had just landed four.The repair
A flag followed by nothing is refused and named, alongside the four refusals already there:
Every flag this harness implements takes a value, so there is no legitimate bare invocation — the refusal cannot reject a valid run. A bare unknown flag is reported as unknown and bare, mirroring the pairing #1776 established for an empty value, so a caller learns both mistakes at once.
The boundary, pinned
The lookahead treats only
---prefixed tokens as flags, so--wait -1is a value, not a bare flag. I asserted the opposite in the first draft, the test disagreed, and the correct behaviour is now pinned (--wait -1→ not bare;--wait --out x→ bare) so the edge of the new refusal is deliberate rather than discovered.Evidence
node scripts/ui-evidence-shot.mjs --route $UNSET --out /tmp/a.png→ exit 2, flag named, before the Playwright import. Same for the trailing form… --out x --route.backend/__tests__/unit/scripts= 16 suites / 117 tests green.docs/runbooks/local-ui-render-harness.md— the refusal table now names this fifth case and says what made it different: the one path that invented a value.No version slot:
scripts/,docs/and a backend test only.