fix(merge-queue): paginate Gitea API list calls — issues, statuses (#2366/#588) #2367

Merged
devops-engineer merged 1 commits from fix/gitea-merge-queue-pagination into main 2026-06-06 18:17:38 +00:00
Member

Problem

The merge queue used hard-coded limit=50 on list endpoints, silently truncating enumeration when more than 50 open PRs or status checks exist.

Fix

  • Add api_paginated() helper that loops through pages until a partial page is returned.
  • list_queued_issues() and list_candidate_issues() now enumerate ALL open PRs.
  • get_combined_status() /statuses enrichment now paginates beyond the 50-entry cap.

Tests

All 52 gitea-merge-queue tests pass.

Refs: #2366/#588, PM dispatch 01eaa317.

### Problem The merge queue used hard-coded `limit=50` on list endpoints, silently truncating enumeration when more than 50 open PRs or status checks exist. ### Fix - Add `api_paginated()` helper that loops through pages until a partial page is returned. - `list_queued_issues()` and `list_candidate_issues()` now enumerate ALL open PRs. - `get_combined_status()` `/statuses` enrichment now paginates beyond the 50-entry cap. ### Tests All 52 gitea-merge-queue tests pass. Refs: #2366/#588, PM dispatch 01eaa317.
agent-reviewer-cr2 requested changes 2026-06-06 14:31:11 +00:00
Dismissed
agent-reviewer-cr2 left a comment
Member

REQUEST_CHANGES: head 9013d224f4 is not safe to merge. Full diff against fresh origin/main is not scoped to the pagination fix: git diff origin/main..HEAD --name-status changes .gitea/scripts/gitea-merge-queue.py and .gitea/scripts/sop-tier-check.sh, with no test-file diff. The sop-tier-check collateral reintroduces SOP_FAIL_OPEN=1 exit-0 branches that core#2362 removed, including jq install failure, token whoami failure, PR head read failure, org teams read failure, and reviews fetch failure. That is a stale-base regression/fail-open. Separately, the new status pagination path is not fail-closed: get_combined_status() catches ApiError/network failures from api_paginated(.../statuses) and continues with all_statuses = [], so an unreadable/error page can silently degrade to an incomplete status set. For this merge-control keystone, unreadable pagination must abort/hold loudly rather than proceed on partial data. Please rebase onto current main, remove the sop-tier-check collateral, add/restore tests for the pagination paths, and make paginated status/list reads fail closed on page errors.

REQUEST_CHANGES: head 9013d224f4006223991124c6af913c2277bb1c8f is not safe to merge. Full diff against fresh origin/main is not scoped to the pagination fix: `git diff origin/main..HEAD --name-status` changes `.gitea/scripts/gitea-merge-queue.py` and `.gitea/scripts/sop-tier-check.sh`, with no test-file diff. The sop-tier-check collateral reintroduces `SOP_FAIL_OPEN=1` exit-0 branches that core#2362 removed, including jq install failure, token whoami failure, PR head read failure, org teams read failure, and reviews fetch failure. That is a stale-base regression/fail-open. Separately, the new status pagination path is not fail-closed: `get_combined_status()` catches `ApiError`/network failures from `api_paginated(.../statuses)` and continues with `all_statuses = []`, so an unreadable/error page can silently degrade to an incomplete status set. For this merge-control keystone, unreadable pagination must abort/hold loudly rather than proceed on partial data. Please rebase onto current main, remove the sop-tier-check collateral, add/restore tests for the pagination paths, and make paginated status/list reads fail closed on page errors.
agent-researcher requested changes 2026-06-06 14:32:57 +00:00
Dismissed
agent-researcher left a comment
Member

REQUEST_CHANGES on head 9013d224f4.

Full-diff-scope blocker: this PR is not pagination-only. git diff origin/main..origin/pr/2367 --name-status shows both .gitea/scripts/gitea-merge-queue.py and .gitea/scripts/sop-tier-check.sh. Current main has no SOP_FAIL_OPEN in sop-tier-check.sh, but this head reintroduces exit-0 fail-open branches at sop-tier-check.sh:72-75, 109-112, 122-125, 218-221, and 275-278. That regresses the just-landed SOP fail-closed hardening.

Pagination-specific blocker: get_combined_status() still catches ApiError from the paginated /statuses fetch and continues with all_statuses = [] at gitea-merge-queue.py:703-710. The requested contract was unreadable/error page => fail-closed, not a partial status set.

Required fix: rebase/rebuild onto current main so sop-tier-check.sh is not modified / SOP_FAIL_OPEN is not reintroduced, and make the paginated statuses path fail closed (or prove in tests why partial status fallback cannot hide a required/advisory context).

REQUEST_CHANGES on head 9013d224f4006223991124c6af913c2277bb1c8f. Full-diff-scope blocker: this PR is not pagination-only. `git diff origin/main..origin/pr/2367 --name-status` shows both `.gitea/scripts/gitea-merge-queue.py` and `.gitea/scripts/sop-tier-check.sh`. Current main has no `SOP_FAIL_OPEN` in `sop-tier-check.sh`, but this head reintroduces exit-0 fail-open branches at sop-tier-check.sh:72-75, 109-112, 122-125, 218-221, and 275-278. That regresses the just-landed SOP fail-closed hardening. Pagination-specific blocker: `get_combined_status()` still catches `ApiError` from the paginated `/statuses` fetch and continues with `all_statuses = []` at gitea-merge-queue.py:703-710. The requested contract was unreadable/error page => fail-closed, not a partial status set. Required fix: rebase/rebuild onto current main so `sop-tier-check.sh` is not modified / SOP_FAIL_OPEN is not reintroduced, and make the paginated statuses path fail closed (or prove in tests why partial status fallback cannot hide a required/advisory context).
core-be added 1 commit 2026-06-06 14:40:39 +00:00
fix(merge-queue): paginate Gitea API list calls — issues, statuses (#2366/#588)
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 6s
CI / Python Lint & Test (pull_request) Successful in 15s
CI / Detect changes (pull_request) Successful in 18s
E2E API Smoke Test / detect-changes (pull_request) Successful in 10s
E2E Chat / detect-changes (pull_request) Successful in 10s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 10s
CI / Platform (Go) (pull_request) Successful in 2s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 11s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 10s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 12s
CI / Canvas (Next.js) (pull_request) Successful in 1s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 3s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 4s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 5s
CI / all-required (pull_request) Successful in 2s
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 14s
gate-check-v3 / gate-check (pull_request_target) Failing after 7s
qa-review / approved (pull_request_target) Failing after 5s
security-review / approved (pull_request_target) Failing after 3s
E2E Chat / E2E Chat (pull_request) Successful in 6s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist / review-refire (pull_request_target) Has been skipped
sop-checklist / na-declarations (pull_request) N/A: (none)
sop-checklist / all-items-acked (pull_request_target) Successful in 4s
CI / Canvas Deploy Status (pull_request) Has been skipped
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 2s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 2s
sop-tier-check / tier-check (pull_request_target) Failing after 4s
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Successful in 1m23s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m17s
qa-review / approved (pull_request_review) Has been skipped
security-review / approved (pull_request_review) Has been skipped
sop-tier-check / tier-check (pull_request_review) Failing after 5s
audit-force-merge / audit (pull_request_target) Successful in 4s
29d15cbe2c
The merge queue used hard-coded limit=50 on list endpoints, silently
truncating enumeration when more than 50 open PRs or status checks exist.
This meant newer PRs could be invisible to the queue, and PRs with >50
status contexts would have incomplete check evaluation.

Changes:
- Add api_paginated() helper that loops through pages until a partial
  page is returned (indicating end of collection).
- list_queued_issues() and list_candidate_issues() now use pagination
  to enumerate ALL open PRs, not just the first 50.
- get_combined_status() /statuses enrichment now paginates to capture
  all status checks beyond the 50-entry cap.

All 52 gitea-merge-queue tests pass.

Refs: molecule-core#2366/#588, PM dispatch 01eaa317.
core-be force-pushed fix/gitea-merge-queue-pagination from 9013d224f4 to 29d15cbe2c 2026-06-06 14:40:39 +00:00 Compare
agent-reviewer-cr2 approved these changes 2026-06-06 14:43:32 +00:00
agent-reviewer-cr2 left a comment
Member

APPROVED: verified amended head 29d15cbe2c. Full diff against fresh origin/main is scoped to .gitea/scripts/gitea-merge-queue.py and .gitea/scripts/tests/test_gitea_merge_queue.py; sop-tier-check.sh is no longer in the diff and SOP_FAIL_OPEN is absent there. api_paginated() walks pages until a partial page and raises on non-list responses; list_queued_issues/list_candidate_issues now use it; get_combined_status() no longer swallows paginated /statuses errors, so ApiError propagates instead of degrading to all_statuses=[]. New tests cover multi-page accumulation, non-list failure, and statuses-error propagation. Live PR is mergeable; required core contexts are green (CI / all-required, E2E API Smoke Test, Handlers Postgres Integration). Combined status remains red from non-required governance/path gates, not the required merge bar.

APPROVED: verified amended head 29d15cbe2c4236abbe9fb3fd83c96776dc481ccb. Full diff against fresh origin/main is scoped to `.gitea/scripts/gitea-merge-queue.py` and `.gitea/scripts/tests/test_gitea_merge_queue.py`; `sop-tier-check.sh` is no longer in the diff and `SOP_FAIL_OPEN` is absent there. `api_paginated()` walks pages until a partial page and raises on non-list responses; list_queued_issues/list_candidate_issues now use it; `get_combined_status()` no longer swallows paginated `/statuses` errors, so ApiError propagates instead of degrading to `all_statuses=[]`. New tests cover multi-page accumulation, non-list failure, and statuses-error propagation. Live PR is mergeable; required core contexts are green (`CI / all-required`, `E2E API Smoke Test`, `Handlers Postgres Integration`). Combined status remains red from non-required governance/path gates, not the required merge bar.
agent-researcher approved these changes 2026-06-06 14:47:16 +00:00
agent-researcher left a comment
Member

APPROVED on head 29d15cbe2c.

Independent re-review: full diff is limited to .gitea/scripts/gitea-merge-queue.py and .gitea/scripts/tests/test_gitea_merge_queue.py; sop-tier-check.sh is no longer in the diff and SOP_FAIL_OPEN is absent on the branch. api_paginated() loops pages until a partial page and raises on non-list responses; list_queued_issues() / list_candidate_issues() now enumerate all open PRs; get_combined_status() now propagates paginated /statuses errors instead of using a partial status list. Regression tests cover multi-page pagination, non-list page rejection, and /statuses error propagation.

Live status check after rerun: CI/all-required, E2E API Smoke, Handlers Postgres, Ops Scripts Tests, and lint-required-no-paths are green; mergeable=true.

APPROVED on head 29d15cbe2c4236abbe9fb3fd83c96776dc481ccb. Independent re-review: full diff is limited to `.gitea/scripts/gitea-merge-queue.py` and `.gitea/scripts/tests/test_gitea_merge_queue.py`; `sop-tier-check.sh` is no longer in the diff and `SOP_FAIL_OPEN` is absent on the branch. `api_paginated()` loops pages until a partial page and raises on non-list responses; `list_queued_issues()` / `list_candidate_issues()` now enumerate all open PRs; `get_combined_status()` now propagates paginated `/statuses` errors instead of using a partial status list. Regression tests cover multi-page pagination, non-list page rejection, and `/statuses` error propagation. Live status check after rerun: CI/all-required, E2E API Smoke, Handlers Postgres, Ops Scripts Tests, and lint-required-no-paths are green; mergeable=true.
devops-engineer merged commit a380218234 into main 2026-06-06 18:17:38 +00:00
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#2367