← Back to Pull requests

feat(renovate): throttle Renovate and ccf-bump sync for plugin batches #110

Closed
unknown closed this pull request without merging on Oct 13, 2026 17:58 UTC
View on GitHub
unknown unknown commented on Oct 13, 2026 17:35 UTC
Author

Gets Renovate and the ccf-bump sync ready for the plugin batches: once batch 1 (later 2 and 3) is active, a run must not flood the org (the plan's target is about 15 PRs an hour), and a batch must be checkable with a dry run before it is switched on.

Renovate throttle: shards of at most 15 repos, one per run

prHourlyLimit is per repo, so with 37 active repos even 1 allows 37 PRs an hour. Renovate 44.145.1 (the pinned version) has one global limit, the self-hosted prCommitsPerRunLimit. I didn't use it:

  • it counts commits per run, not PRs per hour, and vulnerability fixes and rebases count too;

  • once it is reached, lib/workers/global/index.ts stops processing the remaining repos for that run. Those repos then get no vulnerability fixes and no auto-merges that run, and the repos at the head of the list always go first.
  • Instead:

  • A live run (dry_run: off) works on one shard of at most 15 repos (renovate.MaxLiveRepos). Repo i of the active repos goes to shard i mod n, with n = ceil(repos / 15). The run takes shard slot mod n, where slot is the workflow's run number (github.run_number). The workflow passes the same slot to both list (the token's scope) and config, and a re-run keeps its number and its shard.

  • renovate.yml runs hourly (17 , was daily at 06:17), and the shards take turns per run: each run takes the next shard, so each repo is visited every n runs (every n hours when runs are on time).

  • Why the run number and not the clock hour: GitHub starts scheduled workflows best-effort (Renovate's daily 06:17 cron on main ran at 12:53, 14:14 and 15:29). With the clock hour, a dropped run never advanced the rotation and runs bunched into one hour repeated a shard. With the run number, a late or dropped run only slows the rotation and never skips a shard. A dispatch takes a run number too: a live dispatch on every active repo is just the next step, while a dry run (or a live run with repos set) leaves its shard for the next rotation.

  • The preset's prHourlyLimit goes from 4 to 1.

  • Vulnerability PRs keep flowing. Renovate exempts them from prHourlyLimit, prCommitsPerRunLimit and schedule (its docs, and lib/workers/global/limits.ts and lib/workers/repository/update/branch/index.ts), so each visit opens every fix a repo needs. They wait at most one rotation for their repo's shard.

  • Dry runs aren't sharded.
  • Worst case for non-vulnerability PRs across the org (repos.yaml: 7 core repos; batch 1 has 30, batch 2 27, batch 3 10):

    | Active batches | Active repos | Shards | PRs in one run | Two runs close together | Each repo visited every |
    | --- | --- | --- | --- | --- | --- |
    | none (today) | 7 | 1 | 7 | 7 (14 across the top of the hour) | 1 run |
    | 1 | 37 | 3 | 13 | 25 | 3 runs |
    | 1, 2 | 64 | 5 | 13 | 26 | 5 runs |
    | 1, 2, 3 | 74 | 5 | 15 | 30 | 5 runs |

    One run opens at most about 15, and a repo at most one per clock hour (prHourlyLimit). Runs never overlap (the renovate concurrency group queues the next one), but GitHub can start two close together (a late run then an on-time one, or a manual live dispatch next to a scheduled run). They take different shards, so a short window can see about two shards' worth, ~30 with every batch active. Vulnerability PRs come on top of these and are deliberately not capped. A side effect: Renovate's merge lag drops from up to a day to at most one rotation (5 runs, about 5 hours when runs are on time).

    ccf-bump sync: --batch 10 alone wasn't acceptable, so it changed

    Ten PRs an hour is within the target, but with batches active the old single job would fail:

  • after 10 PRs it waits about an hour, and the app token minted at the job's start expires after one hour, so the 11th PR onwards fails. Batch 1 alone has 33 release: true repos;

  • with all three batches (70 repos), its six one-hour waits outlive timeout-minutes: 300.
  • Now:

  • a select job runs ccf-bump list --chunk 10;

  • one sync matrix job runs per chunk (max-parallel: 1, fail-fast: false), each with its own token scoped to its chunk;

  • unless it is the last chunk, a live chunk waits until an hour after its start before the next chunk begins. It skips the wait only when it knows it pushed nothing: ccf-bump sync now writes prs=<N> to $GITHUB_OUTPUT.
  • Worst case is 10 PRs an hour for any number of batches. Live runs take about 3.5 h (batch 1), 5.5 h (1 and 2) or 6.5 h (all three) when every repo gets a PR. ccf-bump-sync.yml also gains the repos dispatch input it lacked.

    Dry run before activation

  • renovate-config list|config passes --dry-run to renovate.SelectRepos, which calls manifest.Select(names, dryRun != "off").

  • ccf-bump passes --dry-run to selectRepos, which calls manifest.Select(names, dryRun). Inactive repos stay in stage order: they are ordered on a copy of the manifest with their batch switched on.

  • Live runs still reject inactive repos, and the default selection is still the active repos.

  • Tests cover both paths:

  • - internal/renovate/batches_test.go and cmd/ccf-bump/batches_test.go: the selection tables;
    - cmd/renovate-config/main_test.go: TestRunDryRunInactive, plus live rejections in TestRunErrors;
    - cmd/ccf-bump/batches_test.go: TestRunDryRunInactive, where list/sync/merge/--repo without --dry-run reject inactive repos.
  • docs/manifest.md "Switching a batch on" gains step 5: dispatch both workflows as dry runs with the batch's repos, read the plans, then open the activation PR.
  • Verified locally

  • go test -race ./... on macOS, and in a golang:1.26 container with bash 5, jq and yq (no skipped step tests);

  • go vet ./... and gofmt -l . (clean);

  • actionlint v1.7.12;

  • go run ./cmd/manifest on repos.yaml and repos.mock.yaml;

  • TestShard checks that any n consecutive run numbers take every shard exactly once, so each repo is visited exactly once per n runs, for 7, 37, 64 and 74 repos;

  • I ran the workflows' commands by hand on repos.yaml. The batch 1 dry-run list splits into 3 chunks, the live list rejects batch 1, and the live Renovate list is today's 7 repos.
  • I didn't run Renovate, ccf-bump or any workflow.

    Open questions for reviewers

  • Renovate now runs 24 times a day instead of once. Actions minutes are free here, and a run of at most 15 repos stays well inside the ccf-release-bot installation's API rate limit, but the extra runs show up in the Actions tab.

  • ccf-bump-sync's select job reads vars.CCF_BUMP_SYNC_LIVE outside the release environment. The docs call it a repo variable, so nothing changes. If it were only an environment variable, scheduled runs would stay dry runs, which fails safe.
  • Task: W3-S4-T01 (local-dev/docs/release-automation/workstream-3-plugins-in-train.md)

    🤖 Generated with Claude Code

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: gusfcarvalho Review duration: 23m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #110"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%