Skip to content

fix(cargo-target-janitor): paginate both deletion-safety liveness reads (#6618) - #6724

Merged
dezren39 merged 1 commit into
mainfrom
queue/fallback-6618-janitor-pagination
Nov 7, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/fallback-6618-janitor-pagination

Conversation

@dezren39

@dezren39 dezren39 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Fixes #6618

Both of the janitor's deletion-safety liveness reads were single-page reads with a silent cap, so a truncated source was indistinguishable from a complete one — the one degraded shape that did not stop cleanup:

  • queue_claims now offset-paginates (limit=1000&offset=N) until a short page, and raises SafetyError if the read would need more than 100 pages — a possibly-truncated claimed set fails closed.
  • open_pr_branches now pages the REST pulls endpoint (per_page=100&page=N via gh api) until a short page, raising SafetyError past 200 pages. Invalid/non-list responses still raise SafetyError as before. The plan-time read and the apply-loop re-check both call this one function (and queue_claims) — no second, weaker copy.
  • queue_task_states dispositioned by construction: its locally-built ID set is chunked at 500 IDs per query with limit=1000, so no chunk's page can ever truncate its answer (previously one limit=1000 read over the whole set).
  • README safety policy now states the contract: both reads are paginated to completion, and a read that cannot complete within its bound stops cleanup like an unavailable source.

Tests (infra/cargo-target-janitor/tests/test_cargo_target_janitor.py, stub PostgREST module honouring limit/offset and stub gh honouring per_page/page): over-page cases for both reads (1005 claimed, 600 PRs), at-cap boundaries (exactly 1000 claimed / 500 PRs), fail-closed when pages never end (both reads), and chunking past 1000 IDs for queue_task_states (3 queries, all 1200 states). 20/20 pass on the laptop (13 existing + 7 new). Venue note per the filing: the janitor's tests still run in no workflow — #5952 tracks that gap; these were run on the laptop.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 7, 2026 03:20
@coderabbitai

coderabbitai Bot commented Nov 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 96dc5ed4-ee3c-4ec0-be7d-30c51bc8c7e3
Commits

Reviewing files that changed from the base of the PR and between e8492d8 and 1faba0d.

Files selected for processing: 3

  • infra/cargo-target-janitor/README.md
  • infra/cargo-target-janitor/bin/cargo_target_janitor.py
  • infra/cargo-target-janitor/tests/test_cargo_target_janitor.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T03:22:25.668320Z 1faba0d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Labels

None yet

Projects

None yet

1 participant