Skip to content

fix(mcpx): docs-twins trailing value flag is a usage error, not a panic - #16406

Merged
dezren39 merged 1 commit into
mainfrom
xaltha/16401-docs-twins-trailing-flag
Nov 28, 2026
Merged

dezren39 merged 1 commit into
mainfrom
xaltha/16401-docs-twins-trailing-flag

Conversation

@dezren39

@dezren39 dezren39 commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Closes #16401

docs-twins parseFlags did i++; cfg.X = args[i] for --docs, --agents, --out and --history-bin with no bounds check, so a trailing value-taking flag panicked with a Go runtime stack trace — the #3312 class in the tool the #3353 inventory missed.

Fix: bounds-check in parseFlags and return "<flag> requires a value"; main already prints parse errors to stderr and exits 2, matching the tool's own unknown argument %q convention and the #3352 operator-script argument contract. All valid invocations parse exactly as before.

Regression test TestParseFlagsTrailingValueFlagIsUsageError covers each value-taking flag in trailing position (alone and after valid flags) and asserts valid parsing is unchanged.

Verification: remote dispatch only (fleet-command), conclusion recorded on this PR; no CI logs read.

{
  "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:42:03Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": "/home/hatch",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/hatch",
      "repo": "developing-today/code",
      "branch": "main",
      "sha": "bbfc8aa3a3b4f3e3d399b7e76beb6962c0daa5b9"
    },
    "auth_subject": "xaltha",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

parseFlags indexed args[i] after i++ with no bounds check for --docs,
--agents, --out and --history-bin, so a trailing value-taking flag
panicked with a Go stack trace. Bounds-check and return
'<flag> requires a value', which main already prints to stderr with
exit 2. Regression test covers each value-taking flag in trailing
position and valid parsing unchanged.

Closes #16401
@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a3c4c697-8080-46e9-b483-d8de8ed22671
Commits

Reviewing files that changed from the base of the PR and between 511ea15 and 8231e91.

Files selected for processing: 2

  • pkgs/mcpx/tools/docs-twins/main.go
  • pkgs/mcpx/tools/docs-twins/main_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39

Copy link
Copy Markdown
Member Author

Verification (lane 2037-A-F, metadata only, no CI logs read): fleet-command run 46099376833 (developing-today/fleet) dispatched on ref xaltha/16401-docs-twins-trailing-flag, command cd pkgs/mcpx && go test ./tools/docs-twins/..., completed SUCCESS at 2026-11-28T03:00:24Z. PR re-verified OPEN/non-draft/MERGEABLE/CLEAN at exact head 8231e91, claim-again pass (no competing claim on #16401). Merging (merge commit).

@dezren39
dezren39 merged commit fe1ca2a into main Nov 28, 2026
2 checks passed
@dezren39
dezren39 deleted the xaltha/16401-docs-twins-trailing-flag branch November 28, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcpx(docs-twins): trailing value flag panics parseFlags — the #3312 class in the tool the #3353 inventory missed

1 participant