Skip to content

fix(fleet-dispatch-test): paginate scan lists — runs/jobs/workflows/forks read completely (#6605) - #6729

Merged
dezren39 merged 2 commits into
mainfrom
queue/fallback-6605-dispatch-pagination
Nov 7, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/fallback-6605-dispatch-pagination

Conversation

@dezren39

@dezren39 dezren39 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Fixes #6605.

Claimed and worked in FALLBACK MODE (queue backend down — PostgREST 503 PGRST002; claim/heartbeat markers on #6605 per doc/fleet/queue-fallback-mode.md, posted via gh because the installed fleet 0.1.0 binary has no fallback verb — that gap is filed as #6728).

Problem

fleet dispatch-test scan fetched every GitHub list once with per_page=100 and no page parameter: in-progress runs, per-run jobs, workflows, and forks past item 100 were silently invisible, so active was a lower bound presented as exact and a saturated home could be chosen as free.

Change (pkgs/fleet/crates/fleet-dispatch-test/src/lib.rs only)

  • New pure page-driver fetch_all_pages(fetch): requests pages until a short page, merges them into one body shaped like a single-page response (object bodies keep their shape; total_count is rewritten to the merged length so it can never again describe only page 1). Past a loud cap (100 pages × 100) it errors rather than presenting a truncated count as exact; a mid-walk transport error fails the scan.
  • Github::get_paginated wires the driver to the real transport.
  • scan_repo: in-progress runs, per-run jobs, and workflows now read via get_paginated. The queued-runs term deliberately keeps its single GET + total_count (a count-only term; total_count is complete on page 1 — the documented queued-run approximation is unchanged).
  • discover_scopes: forks read via get_paginated, so copies past page 1 become scopes.

Tests (cargo test -p fleet-dispatch-test → 20 passed, laptop)

New: 150 runs over 2 pages all visited + total_count corrected; a 250-job run counts active jobs from pages 2–3 (180); pilot workflow on page 2 is present; 101 forks over 2 pages all discovered; full-page-then-empty stops the walk; page-2 transport error propagates. Existing counting tests unchanged and green. Changed lines are rustfmt-clean (the file has pre-existing fmt drift in unrelated regions, left untouched).


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:30
@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 1 minute.

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: 012a9825-71e7-43e4-a455-7c89f53e823a
Commits

Reviewing files that changed from the base of the PR and between bcc0901 and 90b7fe6.

Files selected for processing: 1

  • pkgs/fleet/crates/fleet-dispatch-test/src/lib.rs
  • 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:39:07.291581Z 90b7fe6 New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fcdfca5680

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1261 to +1262
#[test]
fn paginated_runs_merge_all_pages() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add property coverage for the pagination state machine

The new paginator has meaningful invariants—preserving item order and contents across page boundaries, stopping at the first short page, and rejecting walks beyond the cap—but its coverage consists entirely of fixed examples. The root AGENTS.md testing doctrine explicitly requires property tests for meaningful invariants and says examples do not replace them. Add generated page-sequence tests using concatenation and expected request sequences as oracles.

AGENTS.md reference: AGENTS.md:L41-L45

Useful? React with 👍 / 👎.

@dezren39 dezren39 Nov 7, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 90b7fe6 — added pagination_property_generated_page_sequences: a dependency-free xorshift generator drives 200 generated page sequences (0–450 items, bare-array and object bodies) through fetch_all_pages, checking the invariants against named oracles — concatenation (merged items equal the model list, order preserved) and the expected request sequence computed from the model (stop at first short page; exactly one extra empty fetch after an exactly-full final page; total_count corrected to the merged length). The cap invariant is pinned too: an endless full-page list errors after exactly MAX_PAGES requests. cargo test -p fleet-dispatch-test → 21 passed.

@dezren39
dezren39 merged commit c86d831 into main Nov 7, 2026
3 checks passed
@dezren39
dezren39 deleted the queue/fallback-6605-dispatch-pagination branch November 7, 2026 03:43
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