Repository navigation
fix(cargo-target-janitor): page queue_claims by keyset, not offset (#6790) - #6793
Merged
Merged
Conversation
Issue #6790: offset pagination over the live claimed set is unstable — PostgREST re-evaluates offset against the current filtered set per request, so a task leaving the set mid-read shifted later rows forward and the next page skipped a still-claimed task, dropping its target from the never-delete set. Page by keyset instead (order=id.asc, id=gt. largest seen): churn behind the cursor cannot shift rows ahead of it. The #6618 fail-closed page cap is unchanged. The test stub now honours id=gt. and a churn regression test (task 1 completes after page 1 of 1500) asserts the full set, task 1001 included. 21/21 janitor tests pass.
|
Warning Review limit reachedYou'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 37 minutes. View limit details
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. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes issue #6790:
queue_claimsin the cargo-target janitor read the pilot queue's claimed task IDs — its never-delete set — withlimit/offsetpaging and noorder=. PostgREST re-evaluates offset against the current filtered set on every request, and the claimed set is live: when a task left the set mid-read, every later row shifted one position forward and the next offset page skipped exactly one still-claimed task. That task's cargo target lost its never-delete protection at both call sites (the plan-time read and the apply-loop re-check use the same function). #6618 made the read complete-or-fail-closed for a static set; this closes the changing-set axis.Change
infra/cargo-target-janitor/bin/cargo_target_janitor.py—queue_claimsnow uses keyset pagination:order=id.ascplusid=gt.<largest id seen>per page. Rows leaving the set behind the cursor cannot shift rows ahead of it; rows ahead are read exactly once, in order. The cargo-target-janitor: both deletion-safety liveness reads are single-page — queue_claims caps at 1000 rows and open_pr_branches at 500 PRs, so a claimed task or open-PR worktree past the page silently loses its never-delete protection #6618MAX_CLAIM_PAGESfail-closed bound is unchanged, as is the client-side row filter.infra/cargo-target-janitor/tests/test_cargo_target_janitor.py— the PostgREST stub now also honoursid=gt.(keyset, id-ordered); new regression testtest_queue_claims_survives_churn_behind_the_cursor: 1,500 claimed tasks, task 1 completes after page 1 is served, and the read still returns every claimed id — including task 1001, the row the filing's probe showed being skipped — and no issued query usesoffset=.Verification
python3 -m unittest tests.test_cargo_target_janitor: 21 tests, OK (1 new; the cargo-target-janitor: both deletion-safety liveness reads are single-page — queue_claims caps at 1000 rows and open_pr_branches at 500 PRs, so a claimed task or open-PR worktree past the page silently loses its never-delete protection #6618 pagination tests — pages past 1000, cap boundary, fail-closed on never-ending pages — all still pass under keyset paging).Fixes #6790.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.