Summary
scripts/check_bounty_issue_states.py and scripts/check_live_bounty_closing_refs.py each use a required mutually-exclusive --input/--repo source selection, but both still branch on string truthiness at runtime:
check_bounty_issue_states.py
data = _load_input(args.input) if args.input else load_live_data(args.repo, args.api_host)
if args.fix:
if args.input:
check_live_bounty_closing_refs.py
data = _load_input(args.input) if args.input else load_live_data(args.repo, args.api_host, args.state, args.pr)
That means empty-string or whitespace-only source values can satisfy argparse's required source group, then still select the wrong runtime path or defer validation until a raw traceback / gh error.
Why it is useful
These two scripts are public bounty hygiene checks used around live MergeWork issue/PR maintenance:
check_bounty_issue_states.py verifies that open public bounty rows still point at open GitHub issues, and can optionally --fix by reopening issues
check_live_bounty_closing_refs.py checks PR bodies for Closes #... / similar references against still-open bounty issues
Malformed source arguments in those tools should fail early and predictably with bounded CLI errors, not rely on implicit falsy-string branch selection.
This is a narrow, low-risk maintainability hardening slice that complements the earlier source-validation proposals without duplicating their scope.
Smallest useful scope
- reject empty or whitespace-only
--input values in both scripts with a clear argparse-facing error
- reject empty or whitespace-only
--repo values in both scripts before any gh invocation
- choose fixture/live mode using explicit presence checks (
is not None) after validation instead of string truthiness
- preserve existing valid fixture mode, valid live mode, and valid
--fix behavior
Acceptance criteria
scripts/check_bounty_issue_states.py rejects --input "", --input " ", and --repo " " with clear CLI validation and no Python traceback
scripts/check_bounty_issue_states.py --fix continues to require a valid live --repo source and does not accept malformed empty source values
scripts/check_live_bounty_closing_refs.py rejects --input "", --input " ", and --repo " " with clear CLI validation and no Python traceback
- valid fixture mode still works for both scripts
- valid live
--repo owner/name mode still works for both scripts
- focused tests cover invalid empty/whitespace source values and at least one valid branch per script
Evidence
Current main source still shows the unfixed truthiness pattern:
These are the same narrow failure shape already recognized in adjacent scripts, but for a different pair of bounty-check helpers.
Duplicate search
Checked existing open proposed-work issues and related submissions around:
check_bounty_issue_states
check_live_bounty_closing_refs
- source validation
- empty
--input
- whitespace
--repo
Related but distinct:
#801 covers scripts/review_bounty_candidates.py
#805 covers scripts/submission_quality_gate.py
#807 covers the remaining report-script slice: scripts/proposed_work_triage.py, scripts/claim_inventory.py, and scripts/pr_queue_health.py
#1104 covers wiring the closing-reference checker into PR readiness/CI, not its CLI source validation
I did not find an existing proposed-work issue specifically for source-argument hardening in check_bounty_issue_states.py and check_live_bounty_closing_refs.py.
Out of scope
- no change to bounty classification logic, closing-reference parsing, reopen policy, or live API semantics
- no payment execution, treasury mutation, wallet custody, bridge/exchange/off-ramp, or MRWK price behavior
- no claim that this proposed-work issue is itself an implementation bounty
Summary
scripts/check_bounty_issue_states.pyandscripts/check_live_bounty_closing_refs.pyeach use a required mutually-exclusive--input/--reposource selection, but both still branch on string truthiness at runtime:check_bounty_issue_states.pydata = _load_input(args.input) if args.input else load_live_data(args.repo, args.api_host)if args.fix:if args.input:check_live_bounty_closing_refs.pydata = _load_input(args.input) if args.input else load_live_data(args.repo, args.api_host, args.state, args.pr)That means empty-string or whitespace-only source values can satisfy argparse's required source group, then still select the wrong runtime path or defer validation until a raw traceback /
gherror.Why it is useful
These two scripts are public bounty hygiene checks used around live MergeWork issue/PR maintenance:
check_bounty_issue_states.pyverifies that open public bounty rows still point at open GitHub issues, and can optionally--fixby reopening issuescheck_live_bounty_closing_refs.pychecks PR bodies forCloses #.../ similar references against still-open bounty issuesMalformed source arguments in those tools should fail early and predictably with bounded CLI errors, not rely on implicit falsy-string branch selection.
This is a narrow, low-risk maintainability hardening slice that complements the earlier source-validation proposals without duplicating their scope.
Smallest useful scope
--inputvalues in both scripts with a clear argparse-facing error--repovalues in both scripts before anyghinvocationis not None) after validation instead of string truthiness--fixbehaviorAcceptance criteria
scripts/check_bounty_issue_states.pyrejects--input "",--input " ", and--repo " "with clear CLI validation and no Python tracebackscripts/check_bounty_issue_states.py --fixcontinues to require a valid live--reposource and does not accept malformed empty source valuesscripts/check_live_bounty_closing_refs.pyrejects--input "",--input " ", and--repo " "with clear CLI validation and no Python traceback--repo owner/namemode still works for both scriptsEvidence
Current
mainsource still shows the unfixed truthiness pattern:scripts/check_bounty_issue_states.pysource.add_argument("--input", ...)andsource.add_argument("--repo", ...)_load_input(args.input) if args.input else load_live_data(args.repo, args.api_host)--fixgate still checksif args.inputscripts/check_live_bounty_closing_refs.pysource.add_argument("--input", ...)andsource.add_argument("--repo", ...)_load_input(args.input) if args.input else load_live_data(args.repo, args.api_host, args.state, args.pr)These are the same narrow failure shape already recognized in adjacent scripts, but for a different pair of bounty-check helpers.
Duplicate search
Checked existing open proposed-work issues and related submissions around:
check_bounty_issue_statescheck_live_bounty_closing_refs--input--repoRelated but distinct:
#801coversscripts/review_bounty_candidates.py#805coversscripts/submission_quality_gate.py#807covers the remaining report-script slice:scripts/proposed_work_triage.py,scripts/claim_inventory.py, andscripts/pr_queue_health.py#1104covers wiring the closing-reference checker into PR readiness/CI, not its CLI source validationI did not find an existing proposed-work issue specifically for source-argument hardening in
check_bounty_issue_states.pyandcheck_live_bounty_closing_refs.py.Out of scope