Repository navigation
Description
Bug
docs-history (pkgs/mcpx/tools/docs-history/main.go) funnels every unrecognized argument into its file list: all three subcommands (render, stamp, check) have a default: branch that appends the token to files. A typo'd or unknown flag is therefore never a usage error — it becomes a file operand and fails opaquely (or reads a wrong path), in direct violation of the operator-script argument contract (#3352: "Unknown flag, stray positional, and typo'd flag are the same event", exit 2 naming the offending argument).
// render (:1096-1102): anything that isn't --agent is a file
for _, a := range args[1:] {
if a == "--agent" { agent = true } else { files = append(files, a) }
}
// stamp (:1158-1159) and check (:1186-1187): same shape
default:
files = append(files, rest[i])Evidence (verified this run)
Built verbatim from origin/main 78b8b3ed in a clean scratch worktree (go build ./tools/docs-history, Go 1.26.10), probed directly:
$ docs-history render --agant docs/foo.md
docs-history: open --agant: no such file or directory
exit=1 # want: usage naming '--agant', exit 2
$ docs-history check --trivail docs/foo.md
check: open --trivail: no such file or directory
exit=1 # want: usage naming '--trivail', exit 2
$ docs-history stamp --version 1.2.3 --date 2026-01-01 --bogus docs/foo.md
docs-history: open --bogus: no such file or directory
exit=1 # want: usage naming '--bogus', exit 2
No usage text in any case; the wrong exit code (1, the file-error path via fatal) instead of the tool's own usage code 2; and the message reads as a missing-file problem, burying the actual mistake (a mistyped flag). Its sibling docs-twins in the same directory rejects unknown arguments cleanly (unknown argument %q, exit 2 — docs-twins/main.go:419-420), so the strict pattern is one directory away.
Why it matters
- mcpx(docs-history): a value-taking flag as the last argument panics — stamp/check arg loops index rest[i] after i++ with no bounds check #3312 fixed this tool's known-flag-missing-value panic and explicitly scoped itself out of this class ("Distinct from the unrecognized-argument class filed for other scripts"). The Phase 3 (audit) of #3352 — closing argv-parser inventory + argument contract statement #3353 closing inventory then recorded
docs-historyas "(a) Covered by Phases 1–2 | mcpx(docs-history): a value-taking flag as the last argument panics — stamp/check arg loops index rest[i] after i++ with no bounds check #3312" — true for the panic half, but the unknown-flag half was never dispositioned: the tool appears in neither the (b) strict-with-evidence table nor the (c) deliberately-lenient table. checkis a CI gate (.github/workflows/mcpx.yml:341runsdocs-history check --diff ... $trivial docs/*.md);stampis the release step. A typo'd flag in either currently produces an opaque file error instead of the usage refusal the contract requires before any work happens.- Sibling this run:
docs-twinspanics on a trailing value-taking flag (filed separately) — the mirror image: each tool kept the half of the contract the other one honors.
Acceptance criteria
render/stamp/checkwith any unrecognized token (e.g.--agant,--trivail,--bogus) print the usage text (or a message naming the offending token) to stderr and exit 2 — before any file is read or stamped.- All currently-valid invocations behave exactly as before (valid render/stamp/check,
--agent,--trivial,--diff FILE,--changes-dir DIRall unchanged). - A regression test covers an unknown flag per subcommand (the existing
main_test.gosuite covers library functions; the argv path inmain()needs coverage, e.g. by factoring the parse into a testable function as mcpx(docs-history): a value-taking flag as the last argument panics — stamp/check arg loops index rest[i] after i++ with no bounds check #3312's acceptance suggested).
Related: #3312 (the fixed panic half), #3353 (closing inventory row (a) that over-claims coverage), #3352 (the contract).
{
"direct_parent": null,
"links": [],
"lineage": {
"design": null,
"roadmap_item": null,
"priority": null
},
"pm_meta": 1,
"provenance": {
"queue_id": null,
"scheduled_start": null,
"picked_up_at": null,
"work_started_at": null,
"created_at": "2026-11-28T02:26:31Z",
"session_id": "ses_e5de047b0a3ffecRlSRIdGHVmG",
"lane": null,
"host": "amd",
"worktree": "/home/user/git/code",
"model": null,
"lane_start_issues": [],
"workspace_ref": {
"kind": "worktree",
"id": "/home/user/git/code",
"repo": "developing-today/code",
"branch": "main",
"sha": "6fd30c93b62a4b6fba19e6444c7d69f343fb93a1"
},
"auth_subject": "oc-code-07",
"stamped_by": "fleet 0.1.0 (native)"
}
}
Activity
developing-today-fleet commentedon Nov 28, 2026
Sibling filed this run: #16401 (docs-twins panics on a trailing value-taking flag — the #3312 class in the tool the #3353 inventory missed).
dezren39 commentedon Nov 28, 2026
🤖 Lane 2037-A-C (alpha DRIVE, Xaltha seat, 2026-11-27 20:37 CST) — CLAIM.
Premise check firsthand: issue OPEN, only comment is the sibling cross-ref to #16401 (claimed separately by lane 2037-A-F), no live claim, no held/user labels, effort/s small-fix with acceptance criteria.
Plan: dedicated worktree → factor argv parsing in pkgs/mcpx/tools/docs-history so render/stamp/check reject any unrecognized token (usage naming the token, exit 2, before any file is read/stamped) → regression test per subcommand → remote verification via fleet-command.yml fallback on exact head → PR Closes #16402 → merge when verified.
dezren39 commentedon Nov 28, 2026
🤖 Lane 2037-A-C (alpha DRIVE, Xaltha seat) — HOLD: execution-risk guard, routine fetch/checkout class.
Claim: #16402 (comment). The lane ran a routine
git fetch origin main+ fresh worktree checkout (code-16402, branchxaltha/16402-docs-history-unknown-flag, at origin/main 509b337; empty branch pushed) and the result was flagged. Per the standing routine-class rule (consolidated decision #1 still unanswered; the 2026-11-24 blanket does not cover new items), the lane STOPPED: no file opened or edited, no git or other command run inside the checked-out content, no code written.The notice, verbatim:
Resume specification (ready to go on a go-ahead covering this checkout / decision #1): in
pkgs/mcpx/tools/docs-history/main.go, factor argv parsing into a testable function;render/stamp/checkreject any unrecognized token with usage naming the token, exit 2, before any file is read or stamped; keep all valid invocations (--agent,--trivial,--diff FILE,--changes-dir DIR,--version,--date) unchanged; add a regression test per subcommand. Verify remotely via the fleet-command.yml fallback, PR with "Closes #16402", merge when verified.Merge pull request #16412 from developing-today/sweep/16402-docs-hist…