Skip to content

fix(cli): distinguish GitHub lookup failure from empty submissions (#1492)#1554

Merged
anderdc merged 1 commit into
entrius:testfrom
minion1227:minion_1492
Jul 2, 2026
Merged

fix(cli): distinguish GitHub lookup failure from empty submissions (#1492)#1554
anderdc merged 1 commit into
entrius:testfrom
minion1227:minion_1492

Conversation

@minion1227

Copy link
Copy Markdown
Contributor

Closes #1492

Problem

find_prs_for_issue collapsed the GraphQL failure sentinel (None from
_search_issue_referencing_prs_graphql on rate limit / network / GraphQL
errors / missing issue payload) into [] via return prs or []. Downstream,
gitt issues submissions --json emitted a successful response with
submission_count: 0 — indistinguishable from a genuinely empty list. Bounty
submitters and --json automation get a false negative when GitHub lookups
actually fail.

Fix

  • find_prs_for_issue now returns Optional[List[PRInfo]], propagating None
    on lookup failure (including the exception path), consistent with the
    solver_lookup_failed signaling in find_solver_from_closure_event /
    check_github_issue_closed. A falsy token still returns []
    (precondition-not-met, not a transient failure).
  • fetch_open_issue_pull_requests propagates the None sentinel.
  • issues submissions surfaces it via handle_exception as a
    github_lookup_failed error (JSON + human modes) instead of an empty list.
  • Typed handle_exception as NoReturn so callers narrow correctly.

Tests

  • None/exception lookup failures now assert None (not []).
  • Added CLI coverage for the JSON and human failure paths.
  • ruff clean, pyright 0 errors, 320 tests pass.

…ntrius#1492)

`find_prs_for_issue` collapsed the GraphQL failure sentinel (`None` from
`_search_issue_referencing_prs_graphql` on rate limit / network / GraphQL
errors / missing issue payload) into `[]` via `return prs or []`. Downstream,
`gitt issues submissions --json` then emitted a successful response with
`submission_count: 0`, indistinguishable from a genuinely empty list — a false
negative for bounty submitters and `--json` automation.

- `find_prs_for_issue` now returns `Optional[List[PRInfo]]`, propagating `None`
  on lookup failure (including the exception path), consistent with the
  `solver_lookup_failed` signaling in `find_solver_from_closure_event` /
  `check_github_issue_closed`. A falsy token still returns `[]`
  (precondition-not-met, not a transient failure).
- `fetch_open_issue_pull_requests` propagates the `None` sentinel.
- `issues submissions` surfaces it via `handle_exception` as a
  `github_lookup_failed` error (JSON and human modes) instead of reporting an
  empty submission list.
- Typed `handle_exception` as `NoReturn` (it always raises) so callers narrow
  correctly.
- Tests: `None`/exception lookup failures now assert `None` (not `[]`); added
  CLI coverage for the JSON and human failure paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label Jun 27, 2026
@minion1227

Copy link
Copy Markdown
Contributor Author

This closes #1492 by giving --json consumers a stable, machine-readable github_lookup_failed error type — the whole point of the issue is letting automation distinguish a failed lookup from a genuinely empty submission list, which a generic CLI error type can't do.

Beyond the shared find_prs_for_issue sentinel change, this PR also:

  • Covers the human-mode path — a failed lookup errors out instead of printing the misleading No open submissions available message used for a genuinely empty list.
  • Types handle_exception as NoReturn, so pyright narrows pull_requests correctly after the failure branch.
  • Handles the None sentinel at the command layer. fetch_open_issue_pull_requests has a single caller, so this adds no fan-out cost.

Tests cover both the JSON (error.type == github_lookup_failed, no submission_count) and human failure paths. ruff clean, pyright 0 errors, 320 tests pass.

@anderdc anderdc added the cli Command-line interface (gitt) changes label Jul 2, 2026

@anderdc anderdc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleanest fix for #1492: propagates the None failure sentinel and surfaces it as a typed github_lookup_failed error in both JSON and human modes. Verified the only caller path and tests.

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

Labels

bug Something isn't working cli Command-line interface (gitt) changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] find_prs_for_issue treats GraphQL lookup failures as zero submissions

2 participants