Repository navigation
fix(scripts): the harness arg parser refuses its last three silent-input paths (TASK-080) - #1776
Merged
Merged
Conversation
…put paths (TASK-080) All three are inputs the parser accepted and then did something other than what was asked — the class review-checklist rule 27 names, in the module written to refuse it: - a value containing `=` was cut at the SECOND one, so `--route=/v2/x?a=1&b=2` ran as `/v2/x?a` and captured a different page under a file name that named the right one; - a repeated flag kept only its last value, silently, in either spelling (`--width 390 --width 900` and `--width 390 --width=900`); - a flag given an empty value (`--selector=`, the shape an unset shell variable takes) was treated as the flag being absent, so `--selector= "$SEL"` captured the full page while the caller believed the capture was scoped. `parseArgs` now splits at the first `=`, records repeated flags and empty values, and `refusalFor` reports them alongside the existing unknown-flag and stray-value refusals. An unknown flag given an empty value (`--widht=`) is reported as both, which is why the key is recorded in `values` as well as in the empty list. Three tests, and four mutations each reddening its own witness.
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.
Follow-up to #1775, from Vera's review of the cleared head (70134) plus a third of the same class I measured. She classified the first two as a follow-up rather than a hold, so
1f256eb3was not churned; the module only exists onmainafter #1775, which is why this cuts from08ddfd22.The class
Every one of these is an input the parser accepted and then did something other than what was asked. That is the defect rule 27 names, in the module written to refuse it.
1. A value containing
=was cut at the second one.--route=/v2/x?tab=aran as/v2/x?tab, and worse with two query params:--route=/v2/x?a=1&b=2ran as/v2/x?a(measured both). The capture is of a different page, under a file name that names the right one — the exact failure mode theviewport/authrun line exists to expose. Cause:arg.slice(2).split('=')destructured, which drops everything past the second separator. Repair: split at the first=(indexOf), so a value may contain=.2. A repeated flag kept only its last value.
--width 390 --width 900→ 900, silently, in either spelling of the same flag. Repair: refuse a repeated flag and name it. The first value was already accepted and the second contradicts it, so neither is trustworthy, and last-wins is a decision the caller did not make.3. A flag given an empty value was treated as absent.
--selector=sets'', which is falsy, so the script silently took the full-page path while the caller believed the capture was scoped. This is the shape an unset shell variable takes (--selector= "$SEL"), which is why it is worth refusing rather than defaulting.--route/--outwere already safe through their own falsy check; the other flags were not. Repair: refuse any--flag=with an empty value.An unknown flag given an empty value (
--widht=) is reported as both unknown and empty, which is why the key is recorded invaluesas well as in the empty list.Evidence
backend/__tests__/unit/scripts/uiEvidenceShotArgs.test.js— 11 tests, all passing; the script test directory as a whole is 16 suites / 114 tests green.--route=/v2/x?a=1&b=2 … --width 390 --width 900→repeated flag(s): --width …;--selector=→empty value(s): --selector= …;--width 390 400(the earlier repair) →unexpected value(s): 400 ….=→ thetoEqualon the route value;--flag=as empty → the empty-value test's first assertion (test-file line 99);values→ the same test's second assertion (line 102), the unknown-flag half — while the empty half at line 103 still passes, which is exactly what recording the key in both buckets buys.Scope
scripts/lib/ui-evidence-args.js,scripts/ui-evidence-shot.mjs(unchanged — it already passes the whole parse result torefusalFor),docs/runbooks/local-ui-render-harness.md, one backend test. No version slot:scripts/,docs/andbackend/__tests__are outside what the release ladder guards, same as #1775.