Add PR dashboard backfill cap#46
Conversation
89e3e95 to
b620f97
Compare
There was a problem hiding this comment.
Pull request overview
This PR replaces the dashboard's unbounded "full rebuild" for non-PR (scheduled/manual) runs with a bounded backfill path. Instead of refreshing every open PR in one write, a backfill lists open PRs, prunes stale cached entries, and refreshes at most DEFAULT_BACKFILL_MAX_PRS (100) open non-draft PRs one at a time — each as its own single-PR state-branch transaction — advancing a persisted cursor (backfill-state.json) in round-robin PR-number order. This keeps compare-and-swap retries cheap on large repos and avoids exhausting the dashboard GitHub App's hourly GraphQL quota. Documentation and workflow terminology are updated from "full rebuild" to "backfill".
Changes:
- Add
backfill-state.jsonstate with load/save/empty helpers and aSTATE_VERSIONcomment update instate.py. - Add capped, cursor-driven backfill orchestration in
dashboard.py(select_backfill_prs,round_robin_numbers,update_dashboard_for_pr,update_backfill_cursor,cleanup_dashboard_state,render_and_save_dashboard,update_capped_backfill_with_state) and route no-PR runs to it. - Update README/RATIONALE/WEBHOOK_SETUP and workflow comments to reflect "backfill" semantics and the per-repo PR cap.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
.github/scripts/pull-request-dashboard/dashboard.py |
Core backfill logic: selection, cursor round-robin, per-PR transactions, extracted render/save helper, dispatch of no-PR runs to backfill. |
.github/scripts/pull-request-dashboard/state.py |
Adds backfill-state.json path, empty/load/save helpers, and clarifies the state-version comment. |
.github/scripts/pull-request-dashboard/RATIONALE.md |
Documents backfill design, cursor, cap, and failure/cursor behavior. |
pull-request-dashboard/README.md |
Renames "Manual full run" → "Manual backfill run" and documents the PR cap. |
.github/workflows/pull-request-dashboard.yml |
Updates input description and comments to "backfill" terminology. |
.github/workflows/pull-request-dashboard-repo.yml |
Renames the shared classification cache step to "backfill". |
.github/scripts/pull-request-dashboard/WEBHOOK_SETUP.md |
Updates wording from "full rebuild" to "backfill". |
Notes: The cursor round-robin and CAS/cursor-advancement semantics are correct across the edge cases I checked (closed cursor PR, wrap-around, mid-run failure). Two minor maintainability nits are flagged inline. One side effect of the refactor is that compute_pr_results/update_dashboard are now only invoked with a concrete PR number, leaving the parallel full-rebuild branch (and DEFAULT_JOBS) unreachable.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1a95011 to
e3e27a3
Compare
(hopefully) resolves #40
Add a bounded PR dashboard backfill path for non-PR runs. Backfills process open non-draft PRs one at a time, persist progress in backfill-state.json, prune stale cached entries, and still publish accepted markdown when no PRs are selected, reducing repeated GitHub App GraphQL quota spend when large repositories hit state-branch CAS conflicts.