fix(tools/git): -h/--help now exits 0 across 7 wrappers #702

Merged
jason.woltje merged 1 commits from fix/701-git-wrapper-help-exit-code into main 2026-07-11 09:23:47 +00:00
Owner

usage() in issue-assign.sh, issue-create.sh, issue-list.sh,
milestone-create.sh, pr-create.sh, pr-list.sh, and pr-merge.sh
hard-coded exit 1, so every -h/--help invocation printed help but
exited nonzero — logging phantom isError:true records fleet-wide and
breaking set -e composition in callers.

Fix (per #701's proposed fix): usage() now takes an exit-code
argument defaulting to 1; each wrapper's -h|--help case calls
usage 0 so help exits cleanly. All other invocations of usage()
(unknown option, missing required arg) are unchanged and still
default to exit 1.

Scope: help/exit-code handling only. No merge, approval, auth, or
gate-enforcement logic was touched — verified via git diff --stat
(exactly 2 lines changed per file, 14 total) and confirmed by reading
the full diff of pr-merge.sh (squash-only enforcement, base-branch
check, CI queue-guard invocation, tea/API merge fallback all
untouched).

lane-brief.sh is intentionally excluded (separate deployed-only file,
follow-up per #701).

Added packages/mosaic/framework/tools/git/test-help-exit-code.sh, a
small regression harness matching the existing test-*.sh convention
in this directory: asserts --help and -h exit 0 with usage output for
all 7 wrappers, and that a genuine unknown flag still exits nonzero.
Passes 7/7.

Closes #701

usage() in issue-assign.sh, issue-create.sh, issue-list.sh, milestone-create.sh, pr-create.sh, pr-list.sh, and pr-merge.sh hard-coded exit 1, so every -h/--help invocation printed help but exited nonzero — logging phantom isError:true records fleet-wide and breaking set -e composition in callers. Fix (per #701's proposed fix): usage() now takes an exit-code argument defaulting to 1; each wrapper's -h|--help case calls usage 0 so help exits cleanly. All other invocations of usage() (unknown option, missing required arg) are unchanged and still default to exit 1. Scope: help/exit-code handling only. No merge, approval, auth, or gate-enforcement logic was touched — verified via `git diff --stat` (exactly 2 lines changed per file, 14 total) and confirmed by reading the full diff of pr-merge.sh (squash-only enforcement, base-branch check, CI queue-guard invocation, tea/API merge fallback all untouched). lane-brief.sh is intentionally excluded (separate deployed-only file, follow-up per #701). Added packages/mosaic/framework/tools/git/test-help-exit-code.sh, a small regression harness matching the existing test-*.sh convention in this directory: asserts --help and -h exit 0 with usage output for all 7 wrappers, and that a genuine unknown flag still exits nonzero. Passes 7/7. Closes #701
jason.woltje added 1 commit 2026-07-11 09:16:48 +00:00
fix(tools/git): -h/--help now exits 0 across 7 wrappers (#701)
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
ci/woodpecker/push/ci Pipeline was successful
ab643e70ff
usage() hard-coded exit 1, so every --help/-h invocation on
issue-assign, issue-create, issue-list, milestone-create, pr-create,
pr-list, and pr-merge exited nonzero, logging phantom isError records
across fleet lanes and breaking set -e composition. usage() now takes
an exit-code arg (default 1); the -h|--help case calls usage 0. All
other error paths are untouched.

Closes #701
jason.woltje merged commit a99aded26d into main 2026-07-11 09:23:47 +00:00
jason.woltje deleted branch fix/701-git-wrapper-help-exit-code 2026-07-11 09:23:48 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#702