From 724fb6ddc01fa2c5f291ba2aea13105113b5aed7 Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Thu, 19 Nov 2026 02:12:32 -0500 Subject: [PATCH 1/2] test(ci): fail when ci-workflows raises a wait report-ci-status keeps ci-status calls report-ci-status without a wait input, so check-contract's and aggregate-results' rate-limit-wait-seconds stay at ci-workflows' defaults. A raise there would land with the next pin bump and silently outgrow the 435 s GH_READ_MARGIN_SECONDS that holds the composite's waits. The test reads, at the SHA ci-status pins, report-ci-status's action.yml and every same-repository action it runs, then asserts each rate-limit-wait-seconds is at most WAIT_BUDGET_SECONDS.step (the value rate-guard.mjs documents for these defaults) and that those waits plus aggregate-results' rerun-wait-seconds fit GH_READ_MARGIN_SECONDS. At 9c5bedfb (v0.76.3): 60 + 60 + 90 = 210 <= 435. It lives in callers.test.mjs, which already reads ci-workflows at pin and has yaml; affected-tests.sh selects it when pr-require-checks.yml (and so the pin) changes. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Vcupoo79EqmECYFZ4MTv6C --- .../actions/resolve-config/callers.test.mjs | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/actions/resolve-config/callers.test.mjs b/.github/actions/resolve-config/callers.test.mjs index d6c1112509d..09b2d608901 100644 --- a/.github/actions/resolve-config/callers.test.mjs +++ b/.github/actions/resolve-config/callers.test.mjs @@ -25,7 +25,7 @@ import { retryFetch } from "../../scripts/lib/retry-fetch.mjs"; import { DEFAULTS as CI_FIX_DEFAULTS, skipReason } from "../../scripts/pr-unblock/fix-ci-dispatch.mjs"; import { VERDICTS } from "../../scripts/pr-unblock/review-dependency.mjs"; import { stopSkip } from "../../scripts/pr-unblock/escalation-routes.mjs"; -import { contractAtPin } from "../../scripts/lib/ci-workflows-at-pin.mjs"; +import { contractAtPin, fetchAtPin } from "../../scripts/lib/ci-workflows-at-pin.mjs"; import { levelSettings } from "../../scripts/lib/lane-level-value.mjs"; import { main as checkTrustedTrigger } from "../check-trusted-trigger/check-trusted-trigger.mjs"; import { generate as generateCarrierKey } from "../open-lane-output/keygen.mjs"; @@ -2809,6 +2809,31 @@ test("every run-claude-cli step pin in this repo's workflows passes --permission } }); +test("report-ci-status's waits at ci-status's pin fit WAIT_BUDGET_SECONDS.step each and GH_READ_MARGIN_SECONDS together", async () => { + const job = workflow("pr-require-checks.yml").jobs["ci-status"]; + const composite = ".github/actions/pr-require-checks/report-ci-status"; + const [pin] = job.steps.map((step) => String(step.uses ?? "").match(new RegExp(`^melodic-software/ci-workflows/${composite}@([0-9a-f]{40})$`))?.[1]).filter(Boolean); + assert.ok(pin, "ci-status pins report-ci-status to a full SHA"); + const action = async (path) => parse(await fetchAtPin(pin, `${path}/action.yml`)); + const waits = {}; + let rerun = 0; + for (const step of (await action(composite)).runs.steps) { + if (!step.uses?.startsWith("$/")) continue; + const path = step.uses.slice(2); + const { inputs } = await action(path); + const value = (key) => Number(step.with?.[key] ?? inputs[key]?.default ?? 0); + if (inputs["rate-limit-wait-seconds"]) waits[path.split("/").pop()] = value("rate-limit-wait-seconds"); + rerun += value("rerun-wait-seconds"); + } + for (const name of ["check-contract", "aggregate-results"]) assert.ok(name in waits, `report-ci-status at ${pin} runs ${name} with a rate-limit-wait-seconds input`); + for (const [name, seconds] of Object.entries(waits)) { + assert.ok(seconds <= WAIT_BUDGET_SECONDS.step, `${name}'s rate-limit-wait-seconds at ${pin} is ${seconds}, over WAIT_BUDGET_SECONDS.step ${WAIT_BUDGET_SECONDS.step}`); + } + const margin = job.env.GH_READ_MARGIN_SECONDS; + const total = Object.values(waits).reduce((sum, seconds) => sum + seconds, rerun); + assert.ok(total <= margin, `report-ci-status's rate-limit waits ${JSON.stringify(waits)} and ${rerun} s rerun wait at ${pin} total ${total} s, over GH_READ_MARGIN_SECONDS ${margin}`); +}); + // Each launcher leg is followed by a check that the CLI's init message // reports the permission mode the base config asked for, or default for // dontAsk; any other mismatch, a missing init message or an empty mode fails From 70bba39e76ecae7af8a76e06396eb465da5fbb1a Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Thu, 19 Nov 2026 02:29:33 -0500 Subject: [PATCH 2/2] test(ci): count report-ci-status's fixed retries against the margin The sum compared only the input waits (210 s) with the whole 435 s GH_READ_MARGIN_SECONDS, though the margin's comment in pr-require-checks.yml also budgets 120 s of own-gate retries and 7 s of status writes, so a rerun-wait default of 250 passed and overflowed. The own-gate retries are now read at the pin from aggregate-results/run.sh (OWN_GATE_RETRY_DELAYS, summing to 120). The 7 s of status writes exists in no ci-workflows file as a value, so STATUS_WRITE_RETRY_SECONDS carries the margin comment's figure. At 9c5bedfb: 60 + 60 + 90 + 120 + 7 = 337 <= 435; with a 250 rerun wait, 497 > 435 fails. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Vcupoo79EqmECYFZ4MTv6C --- .github/actions/resolve-config/callers.test.mjs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/actions/resolve-config/callers.test.mjs b/.github/actions/resolve-config/callers.test.mjs index 09b2d608901..6a94de6e96a 100644 --- a/.github/actions/resolve-config/callers.test.mjs +++ b/.github/actions/resolve-config/callers.test.mjs @@ -2809,6 +2809,8 @@ test("every run-claude-cli step pin in this repo's workflows passes --permission } }); +const STATUS_WRITE_RETRY_SECONDS = 7; + test("report-ci-status's waits at ci-status's pin fit WAIT_BUDGET_SECONDS.step each and GH_READ_MARGIN_SECONDS together", async () => { const job = workflow("pr-require-checks.yml").jobs["ci-status"]; const composite = ".github/actions/pr-require-checks/report-ci-status"; @@ -2829,9 +2831,15 @@ test("report-ci-status's waits at ci-status's pin fit WAIT_BUDGET_SECONDS.step e for (const [name, seconds] of Object.entries(waits)) { assert.ok(seconds <= WAIT_BUDGET_SECONDS.step, `${name}'s rate-limit-wait-seconds at ${pin} is ${seconds}, over WAIT_BUDGET_SECONDS.step ${WAIT_BUDGET_SECONDS.step}`); } + const delays = (await fetchAtPin(pin, ".github/actions/pr-require-checks/aggregate-results/run.sh")).match(/^OWN_GATE_RETRY_DELAYS='([0-9 ]+)'$/m)?.[1]; + assert.ok(delays, `aggregate-results/run.sh at ${pin} sets OWN_GATE_RETRY_DELAYS`); + const ownGate = delays.split(" ").reduce((sum, seconds) => sum + Number(seconds), 0); const margin = job.env.GH_READ_MARGIN_SECONDS; - const total = Object.values(waits).reduce((sum, seconds) => sum + seconds, rerun); - assert.ok(total <= margin, `report-ci-status's rate-limit waits ${JSON.stringify(waits)} and ${rerun} s rerun wait at ${pin} total ${total} s, over GH_READ_MARGIN_SECONDS ${margin}`); + const total = Object.values(waits).reduce((sum, seconds) => sum + seconds, rerun + ownGate + STATUS_WRITE_RETRY_SECONDS); + assert.ok( + total <= margin, + `report-ci-status's rate-limit waits ${JSON.stringify(waits)}, ${rerun} s rerun wait, ${ownGate} s own-gate retries and ${STATUS_WRITE_RETRY_SECONDS} s status writes at ${pin} total ${total} s, over GH_READ_MARGIN_SECONDS ${margin}`, + ); }); // Each launcher leg is followed by a check that the CLI's init message