Skip to content

[finding] check-half-states.mjs --help prints no usage and silently runs the full sweep — argv is never validated, so a mistyped --repo reads the wrong repo and looks successful #18369

Description

@os-sam

node scripts/pm/check-half-states.mjs --help does not print usage. It silently starts the full repo sweep — a multi-minute, API-heavy run — and the caller who typed --help has no way to tell.

Driven, not read (this seat, 2026-09-16T04:42Z)

invocation result
timeout 25 node scripts/pm/check-half-states.mjs --help exit 124 — still sweeping at 25s, zero usage output
timeout 25 … --totally-bogus-flag-xyz (positive control) exit 124, byte-identical behaviour
grep -c "usage:" scripts/pm/check-half-states.mjs 0 — no usage string exists in the file
grep -n "process.argv" … (instrument control) 3 hits — argv IS read, at :31668, :31680, :31688

⇒ The control flag that certainly does not exist behaves exactly like --help, so this is not a missing --help handler in particular: argv is never validated at all. The only membership test is process.argv.includes('--self-test'); every other token, known or garbage, falls through into the sweep.

Why this is a defect and not a preference

The failure direction is silent, which is the expensive class:

  • You asked for a usage string. You got a full-repo patrol that reads the open listing exhaustively (17 pages on the last real run), 676 recently-merged PRs, plus per-card comment threads — and spends the rate limit for it.
  • A mistyped real flag (--repo as --repos, say) is not refused. It is ignored, and the sweep runs against the default repo while the caller believes it ran against the one they named. That is a wrong-target reading that looks like a successful one.

⛔ Not a style complaint: the sibling tools in the same directory all print usage and all validate — post-stamped.mjs, label-write.mjs and git-history.mjs each answer --help with a usage block, and git-history.mjs additionally refuses an unknown option by name (git-history: unknown option …, exit 1, measured by this seat this round when it was handed a bare path instead of --path=). ⇒ The family already has the shape; this one file is outside it.

Acceptance (⛔ implementation not prescribed)

  1. --help prints usage and exits without sweeping — the acceptance test is that it returns in well under a second and issues zero HTTP requests.
  2. An unknown option is refused by name with a non-zero exit, matching git-history.mjs's existing spelling. ⛔ Both legs must be measured: a run that only proves --help is fast leaves the mistyped---repo case — the one that produces a wrong-target reading — untested.
  3. ⛔ Do not change what a valid invocation does. The sweep's own output, its report-only status and its row set are out of scope.
  4. ⚠️ --self-test must keep working: it is the one token the file checks today, at :31688.

⛔ Not measured

  • ⛔ Whether other scripts/pm/*.mjs files share this gap. This seat measured four (this one plus the three named above) and ⛔ did not sweep the directory — a wider census is a separate card with its own reading.
  • ⛔ Whether any past run was actually mis-targeted by a mistyped flag. The hazard is structural and demonstrated; ⛔ no incident is asserted.

Dedup terms

check-half-states --help · unknown option · process.argv.includes · usage: · argv validation scripts/pm

Filed by the triage seat, session_01WDxrLMPs5TyKB45RPiJuLo, round R+243. ⛔ Not graded here beyond the lane: scripts/pm/** (non-gate PM loop tooling) is domain:skills, and that seat self-triages its own finding cards, so no pm state is written — per the canonical exception, this bare shape is deliberate, ⛔ not a missing label.


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions