fix(ci-drift): paginate open issues to prevent duplicate [ci-drift] issues #2373
Reference in New Issue
Block a user
Delete Branch "fix/ci-drift-pagination"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes issue-403.
Problem
find_open_issue()only fetched one page of open issues (limit=50). When the existing[ci-drift]tracking issue fell beyond page 1, the caller POSTed a duplicate instead of updating the existing one.Fix
Loop over pages until the title is found or the result set is exhausted (page returns <50 items). API errors propagate loud via
ApiErroras before.Test plan
python3 -m pytest tests/test_ci_required_drift.py -v→ 24/24 passed (including 2 new pagination regression tests).Reviewed current head
953789d2. Merge-base diff is scoped to .gitea/scripts/ci-required-drift.py and tests/test_ci_required_drift.py only. find_open_issue now paginates open issues with limit=50/page until title match or a final partial page; ApiError/non-list responses propagate fail-closed rather than returning None; regression tests cover page-2 discovery and stopping at the last page. CI / all-required and Python tests are green; remaining combined red/pending contexts are governance/non-required/pilot status noise.APPROVED. Independent review on current head
953789d2. Merge-base diff is scoped to .gitea/scripts/ci-required-drift.py and tests/test_ci_required_drift.py. find_open_issue now paginates all open issues with limit=50&page=N, propagates ApiError from api() instead of treating search failure as no match, raises on non-list bodies, and stops only when a page has fewer than 50 results. Regression tests cover finding a match on page 2 and stopping at the last page. Local pytest could not be run in this container because pytest is not installed; live PR is mergeable, with combined red only from governance/review contexts pending approvals.953789d269to9c47108e02APPROVED on head
9c47108e02. Re-reviewed after no-op force-push: diff from prior approved head953789d269to current head is empty, so the code/test patch is identical. Merge-base diff remains scoped to .gitea/scripts/ci-required-drift.py and tests/test_ci_required_drift.py. Pagination loops all issue pages and propagates ApiError/non-list failures rather than treating truncated/unreadable search as no existing issue. Required contexts observed green on current head; combined failure is from non-required review/tier target checks.Re-reviewed current head
9c47108e02after no-op force-push. Confirmed merge-base diff remains scoped to .gitea/scripts/ci-required-drift.py and tests/test_ci_required_drift.py; diff from prior approved head953789d2to this head is empty. Verified find_open_issue pagination behavior remains intact, ApiError propagation is not swallowed, regression tests are present, and there is no stale-base collateral. Live PR is mergeable=true; latest CI / all-required is success, with combined failure only from non-required/superseded governance contexts. APPROVED.