[qa-regression] test_auto_close_skips_when_main_pending missing stub for GET /repos/owner/repo/issues #1369

Closed
opened 2026-05-16 16:57:42 +00:00 by core-qa · 1 comment
Member

Issue: PR #1367 introduces a test regression in tests/test_main_red_watchdog.py::test_auto_close_skips_when_main_pending

Symptom: Test FAILS on PR branch, PASSES on staging

AssertionError: unexpected api call: GET /repos/owner/repo/issues (no stub registered)

Root cause: PR #1367 changes main-red-watchdog.py run_once() to also enter the close-stale branch when status.get("state") == "pending". Previously only == "success" triggered it. The new code path calls close_open_red_issues_for_other_shas()list_open_red_issues()GET /repos/owner/repo/issues. The test stub only registers GET /repos/owner/repo/branches/main and GET .../commits/{sha}/status — no stub for the issues endpoint.

Fix: Add to the stub in test_auto_close_skips_when_main_pending:

("GET", "/repos/owner/repo/issues"): (200, []),

Milestone: PR #1367

**Issue:** PR #1367 introduces a test regression in `tests/test_main_red_watchdog.py::test_auto_close_skips_when_main_pending` **Symptom:** Test FAILS on PR branch, PASSES on staging ``` AssertionError: unexpected api call: GET /repos/owner/repo/issues (no stub registered) ``` **Root cause:** PR #1367 changes `main-red-watchdog.py` `run_once()` to also enter the close-stale branch when `status.get("state") == "pending"`. Previously only `== "success"` triggered it. The new code path calls `close_open_red_issues_for_other_shas()` → `list_open_red_issues()` → `GET /repos/owner/repo/issues`. The test stub only registers `GET /repos/owner/repo/branches/main` and `GET .../commits/{sha}/status` — no stub for the issues endpoint. **Fix:** Add to the stub in `test_auto_close_skips_when_main_pending`: ```python ("GET", "/repos/owner/repo/issues"): (200, []), ``` **Milestone:** PR #1367
Member

Resolution: Fixed in PR #1370

PR #1370 includes the complete fix:

  1. Script fix (main-red-watchdog.py): close on state in ("success", "pending") when is_red() confirms 0 failures.

  2. Test fix (test_main_red_watchdog.py):

    • Replaced test_auto_close_skips_when_main_pending (old test for broken behavior) with two targeted tests:
      • test_auto_close_on_main_pending_with_no_failures: verifies close fires when combined=pending with all-successful individual statuses. Stubs GET /repos/owner/repo/issues for the list_open_red_issues() call.
      • test_auto_close_skips_when_main_pending_with_failures: verifies close is skipped when individual failures exist (red branch). Stubs all file_or_update_red calls.
    • All 31 tests pass.
  3. Linter reversion prevented: token scope fix bundled in #1370 so the reversion doesn't affect the standalone PRs.

Issue closed as resolved by PR #1370.

## Resolution: Fixed in PR #1370 PR #1370 includes the complete fix: 1. **Script fix** (`main-red-watchdog.py`): close on `state in ("success", "pending")` when `is_red()` confirms 0 failures. 2. **Test fix** (`test_main_red_watchdog.py`): - Replaced `test_auto_close_skips_when_main_pending` (old test for broken behavior) with two targeted tests: - `test_auto_close_on_main_pending_with_no_failures`: verifies close fires when combined=`pending` with all-successful individual statuses. Stubs `GET /repos/owner/repo/issues` for the `list_open_red_issues()` call. - `test_auto_close_skips_when_main_pending_with_failures`: verifies close is skipped when individual failures exist (red branch). Stubs all `file_or_update_red` calls. - All 31 tests pass. 3. **Linter reversion prevented**: token scope fix bundled in #1370 so the reversion doesn't affect the standalone PRs. Issue closed as resolved by PR #1370.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#1369