From 6fd2ef50a50f48dacc89333525fb6161bc4f1f19 Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Wed, 18 Nov 2026 16:39:27 -0500 Subject: [PATCH 1/2] ci(pr-require-checks): run ci-status on the report-ci-status composite The ci-status job's check-contract step and its aggregate-results step become one report-ci-status step (ci-workflows v0.76.0), named "Aggregate lane results", followed by "Fail on the contract or draft policy". Draft policy stays allow, exempt-authors, treat-skipped-as, rerun-contract-only-siblings and the 600 s yield ceiling are unchanged. check-contract now runs after the hold steps, so its 60 s rate-limit wait falls inside gh_read's margin: GH_READ_MARGIN_SECONDS goes from 375 to 435. pr-verify's held-run recognition reads the new fail step and its log lines, and still accepts a run from before the composite. Refs: melodic-software/ci-workflows#1138 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Vcupoo79EqmECYFZ4MTv6C --- .github/scripts/pr-verify/resolve-pr.mjs | 34 ++++++-- .github/scripts/pr-verify/resolve-pr.test.mjs | 74 ++++++++++++---- .github/workflows/pr-require-checks.yml | 87 +++++++++++-------- docs/ci-runner-routing.md | 4 +- 4 files changed, 135 insertions(+), 64 deletions(-) diff --git a/.github/scripts/pr-verify/resolve-pr.mjs b/.github/scripts/pr-verify/resolve-pr.mjs index 5c48a170d97..cac9f2eca96 100644 --- a/.github/scripts/pr-verify/resolve-pr.mjs +++ b/.github/scripts/pr-verify/resolve-pr.mjs @@ -304,10 +304,20 @@ export const HOLD_STEP = "Fail a lanes App pull request on kill switch, hold pat const OLD_HOLD_STEP = "Fail a lanes App pull request its body or a member holds"; const HOLD_STEPS = [HOLD_STEP, OLD_HOLD_STEP]; export const AGGREGATE_STEP = "Aggregate lane results"; -// The ci-status step that runs ci-workflows' check-contract (title, -// `do-not-merge` label, issue linkage), and the one error line its run.sh -// writes for the label, whose name pr-require-checks.yml leaves the default. -export const CONTRACT_STEP = "Check the pull-request contract"; +/** + * The ci-status step that fails on ci-workflows' check-contract (title, + * `do-not-merge` label, issue linkage), its own error line, and the one error + * line check-contract's run.sh writes for the label, whose name + * pr-require-checks.yml leaves the default. check-contract runs inside the + * report-ci-status composite, which AGGREGATE_STEP names: that step still + * succeeds, but its log keeps check-contract's lines and exit. A run from + * before the composite reports OLD_CONTRACT_STEP, which ran check-contract + * itself. + */ +export const CONTRACT_STEP = "Fail on the contract or draft policy"; +export const CONTRACT_LINE = "ci-status: the pull-request contract or the draft policy failed; see the step above."; +const OLD_CONTRACT_STEP = "Check the pull-request contract"; +const CONTRACT_STEPS = [CONTRACT_STEP, OLD_CONTRACT_STEP]; export const DO_NOT_MERGE_LINE = "check-contract: this PR carries the 'do-not-merge' label; remove it to merge."; // What merge-holds.mjs `holds` writes after each hold an approving review of // the head lifts, and the line the runner adds for the step's failing exit. @@ -336,7 +346,9 @@ export const errorLines = (log) => // both, the lanes aggregate succeeded, and every error that job logged is one // of `number`'s holds an approval lifts (at least one when HOLD_STEP failed), // DO_NOT_MERGE_LINE (exactly once when CONTRACT_STEP failed, never otherwise) -// or a failed step's exit. ci-status still fails, so such a head never merges +// or a failed step's exit; CONTRACT_STEP adds CONTRACT_LINE and check-contract's +// exit inside the composite, once each, as a held run logs them +// (https://github.com/melodic-software/ci-workflows/actions/runs/44383672751). ci-status still fails, so such a head never merges // unapproved or labeled; the verdict a judgment writes lifts no hold path and // no label. A read that fails, a job or step list cut short, or any other // error is false. @@ -366,8 +378,9 @@ async function heldShape(read) { const names = failed.map((step) => step?.name); if ( failed.length === 0 || - failed.some((step) => step.conclusion !== "failure" || ![...HOLD_STEPS, CONTRACT_STEP].includes(step.name)) || + failed.some((step) => step.conclusion !== "failure" || ![...HOLD_STEPS, ...CONTRACT_STEPS].includes(step.name)) || new Set(names).size !== names.length || + names.filter((name) => CONTRACT_STEPS.includes(name)).length > 1 || !steps.some((step) => step?.name === AGGREGATE_STEP && step.conclusion === "success") ) { return null; @@ -384,11 +397,14 @@ async function heldOnly(readLog, { ciId, names }, number) { const reasons = errors.filter((line) => line !== STEP_EXIT); const person = reasons.filter((line) => personHoldLine(line, number)); const label = reasons.filter((line) => line === DO_NOT_MERGE_LINE); + const own = reasons.filter((line) => line === CONTRACT_LINE); + const composite = names.includes(CONTRACT_STEP) ? 1 : 0; return ( - errors.length - reasons.length === names.length && - person.length + label.length === reasons.length && + errors.length - reasons.length === names.length + composite && + person.length + label.length + own.length === reasons.length && (person.length > 0) === names.some((name) => HOLD_STEPS.includes(name)) && - label.length === (names.includes(CONTRACT_STEP) ? 1 : 0) + label.length === (names.some((name) => CONTRACT_STEPS.includes(name)) ? 1 : 0) && + own.length === composite ); } catch { return false; diff --git a/.github/scripts/pr-verify/resolve-pr.test.mjs b/.github/scripts/pr-verify/resolve-pr.test.mjs index 6cc457bd568..1e0c938694d 100644 --- a/.github/scripts/pr-verify/resolve-pr.test.mjs +++ b/.github/scripts/pr-verify/resolve-pr.test.mjs @@ -23,7 +23,7 @@ import { createHash } from "node:crypto"; import { createGitHub, GitHubError } from "../../actions/check-trusted-trigger/check-trusted-trigger.mjs"; import { createRateLimitLatch } from "../../actions/log-api-budget/rate-guard.mjs"; -import { CARRY_MAX, carryMain, closing, CONTRACT_STEP, DO_NOT_MERGE_LINE, DRAFT_STEP, failureAnnotation, HOLD_STEP, linkedIssues, main, packReads, ratedBy, RELINK_QUERY, resolvePull, SIBLINGS_MAX, siblingNumbers, takeReads, upstreamPages } from "./resolve-pr.mjs"; +import { CARRY_MAX, carryMain, closing, CONTRACT_LINE, CONTRACT_STEP, DO_NOT_MERGE_LINE, DRAFT_STEP, failureAnnotation, HOLD_STEP, linkedIssues, main, packReads, ratedBy, RELINK_QUERY, resolvePull, SIBLINGS_MAX, siblingNumbers, takeReads, upstreamPages } from "./resolve-pr.mjs"; import { KEPT_JOBS, keptJobs, shapeJobs } from "./upstream-jobs.mjs"; import { artifactName } from "./write-verdict.mjs"; import { bodyVersion, loadRules, REFINE_MARKER, splitItemsLine } from "../intake-triage/admit.mjs"; @@ -914,15 +914,22 @@ const COST_NAMED = holds("", [], [`infra/x${LIFT}.tf`], [])[0]; const OLD_WORDING = "#41: it changes plugins/x/scripts/risk.py, a hold path; an approving review of this head by a person on the trusted-actor list lifts it, and the approval carries over later merges of the base that leave its net change the same; then re-run ci-status."; const CI_STEPS = [ ["Set up job", "success"], - ["Check the pull-request contract", "success"], ["Note a draft", "skipped"], ["Fail a pull request carrying the human-gated label", "success"], ["Fail a head a pr-unblock lane stopped", "success"], ["Fail a lanes App pull request on kill switch, hold path, verifier or veto", "failure"], ["Check each skipped lane against scope", "success"], ["Aggregate lane results", "success"], + ["Fail on the contract or draft policy", "skipped"], ["Complete job", "success"], ]; +/** The steps before the report-ci-status composite, when ci-status ran check-contract as a step of its own. */ +const OLD_CONTRACT_STEP = "Check the pull-request contract"; +const OLD_CI_STEPS = [ + ["Set up job", "success"], + [OLD_CONTRACT_STEP, "success"], + ...CI_STEPS.slice(1).filter(([n]) => n !== CONTRACT_STEP), +]; const ciJob = (steps = CI_STEPS, conclusion = "failure") => ({ id: 9001, name: "ci-status", conclusion, steps: steps.map(([name, c]) => ({ name, conclusion: c })) }); const heldJobs = (ci = ciJob(), others = [{ id: 9002, name: "Lint Repo", conclusion: "success" }, { id: 9003, name: "pr-unblock / address-feedback", conclusion: "neutral" }]) => { const jobs = [...others, ci]; @@ -988,22 +995,42 @@ test("a run that failed on anything but a hold an approval lifts starts nothing" assert.equal(await reason({ run: upstream({ conclusion: "failure" }), jobs: heldJobs() }), "not-a-passing-run"); }); -// A session holds a pull request with `do-not-merge`, which fails -// check-contract's step of ci-status. Its log lines follow that action's -// run.sh: the label's `::error::` line, then the step's exit. -const contractLog = (...lines) => +/** + * A session holds a pull request with `do-not-merge`, which fails + * check-contract inside the report-ci-status composite. Its log lines follow + * a held run's: check-contract's run.sh writes the label's `::error::` line, + * then its exit, inside "Aggregate lane results", which still succeeds; then + * "Fail on the contract or draft policy" writes its own line and exit. + */ +const oldContractLog = (...lines) => [ '2026-10-28T16:21:30.0000000Z ##[group]Run bash "$GITHUB_ACTION_PATH/run.sh"', ...lines.map((line) => `2026-10-28T16:21:31.0000000Z ##[error]${line}`), "2026-10-28T16:21:31.0000001Z ##[error]Process completed with exit code 1.", ].join("\r\n"); +const failStep = [ + `2026-10-28T16:21:33.0000000Z ##[error]${CONTRACT_LINE}`, + "2026-10-28T16:21:33.0000001Z ##[error]Process completed with exit code 1.", +].join("\r\n"); +const contractLog = (...lines) => `${oldContractLog(...lines)}\r\n${failStep}`; const failing = (...names) => ({ jobs: heldJobs(ciJob(CI_STEPS.map(([n, c]) => [n, names.includes(n) ? "failure" : n === HOLD_STEP ? "success" : c]))), }); +const oldFailing = (...names) => ({ + jobs: heldJobs(ciJob(OLD_CI_STEPS.map(([n, c]) => [n, names.includes(n) ? "failure" : n === HOLD_STEP ? "success" : c]))), +}); test("a run that failed only on do-not-merge, alone or beside a hold an approval lifts, is judged", async () => { assert.equal(await held(contractLog(DO_NOT_MERGE_LINE), failing(CONTRACT_STEP)), "ok"); - assert.equal(await held(`${contractLog(DO_NOT_MERGE_LINE)}\r\n${logOf(PATH_HOLD)}`, failing(CONTRACT_STEP, HOLD_STEP)), "ok"); + assert.equal(await held(`${logOf(PATH_HOLD)}\r\n${contractLog(DO_NOT_MERGE_LINE)}`, failing(CONTRACT_STEP, HOLD_STEP)), "ok"); +}); + +/** A run reports its own commit's step names, so a held run from before the composite still reports check-contract's own step, with no fail step. */ +test("a held run from before the composite, with check-contract's own step, is judged the same way", async () => { + assert.equal(await held(oldContractLog(DO_NOT_MERGE_LINE), oldFailing(OLD_CONTRACT_STEP)), "ok"); + assert.equal(await held(`${oldContractLog(DO_NOT_MERGE_LINE)}\r\n${logOf(PATH_HOLD)}`, oldFailing(OLD_CONTRACT_STEP, HOLD_STEP)), "ok"); + assert.equal(await held(contractLog(DO_NOT_MERGE_LINE), oldFailing(OLD_CONTRACT_STEP)), "not-a-passing-run"); + assert.equal(await held(oldContractLog(DO_NOT_MERGE_LINE), failing(CONTRACT_STEP)), "not-a-passing-run"); }); // A run reports its own commit's step names, so a held run from before the @@ -1013,7 +1040,7 @@ test("a held run that still reports the hold step's earlier name is judged the s const jobs = heldJobs(ciJob(CI_STEPS.map(([n, c]) => [n === HOLD_STEP ? oldName : n, c]))); assert.equal(await held(logOf(PATH_HOLD), { jobs }), "ok"); assert.equal(await held(logOf(COST), { jobs }), "not-a-passing-run"); - assert.equal(await held(`${contractLog(DO_NOT_MERGE_LINE)}\r\n${logOf(PATH_HOLD)}`, { jobs: heldJobs(ciJob(CI_STEPS.map(([n, c]) => [n === HOLD_STEP ? oldName : n, n === CONTRACT_STEP ? "failure" : c]))) }), "ok"); + assert.equal(await held(`${logOf(PATH_HOLD)}\r\n${contractLog(DO_NOT_MERGE_LINE)}`, { jobs: heldJobs(ciJob(CI_STEPS.map(([n, c]) => [n === HOLD_STEP ? oldName : n, n === CONTRACT_STEP ? "failure" : c]))) }), "ok"); assert.equal(await held(logOf(), { jobs }), "not-a-passing-run"); }); @@ -1025,25 +1052,38 @@ test("a contract failure other than do-not-merge, or a label line its step does "no label line": [contractLog(), failing(CONTRACT_STEP)], "the label line twice": [contractLog(DO_NOT_MERGE_LINE, DO_NOT_MERGE_LINE), failing(CONTRACT_STEP)], "the label line with the label text changed": [contractLog(DO_NOT_MERGE_LINE.replace("do-not-merge", "hold")), failing(CONTRACT_STEP)], - "the label line while the contract step passed": [`${contractLog(DO_NOT_MERGE_LINE)}\r\n${logOf(PATH_HOLD)}`.replace(/\r\n[^\r\n]*exit code 1\.(?=\r\n)/, ""), failing(HOLD_STEP)], - "both steps failed with one exit": [`${contractLog(DO_NOT_MERGE_LINE)}\r\n${logOf(PATH_HOLD)}`.replace(/\r\n[^\r\n]*exit code 1\.(?=\r\n)/, ""), failing(CONTRACT_STEP, HOLD_STEP)], - "the hold step failed with only the label": [`${contractLog(DO_NOT_MERGE_LINE)}\r\n${logOf()}`, failing(CONTRACT_STEP, HOLD_STEP)], + "the label line while the contract step passed": [`${logOf(PATH_HOLD)}\r\n${oldContractLog(DO_NOT_MERGE_LINE)}`, failing(HOLD_STEP)], + "both steps failed with one exit": [`${logOf(PATH_HOLD)}\r\n${contractLog(DO_NOT_MERGE_LINE)}`.replace(/\r\n[^\r\n]*exit code 1\.(?=\r\n)/, ""), failing(CONTRACT_STEP, HOLD_STEP)], + "the hold step failed with only the label": [`${logOf()}\r\n${contractLog(DO_NOT_MERGE_LINE)}`, failing(CONTRACT_STEP, HOLD_STEP)], "the contract step cancelled": [contractLog(DO_NOT_MERGE_LINE), { jobs: heldJobs(ciJob(CI_STEPS.map(([n, c]) => [n, n === CONTRACT_STEP ? "cancelled" : n === HOLD_STEP ? "success" : c]))) }], + "the fail step's line missing": [`${oldContractLog(DO_NOT_MERGE_LINE)}\r\n2026-10-28T16:21:33.0000001Z ##[error]Process completed with exit code 1.`, failing(CONTRACT_STEP)], + "the fail step's line twice": [`${contractLog(DO_NOT_MERGE_LINE)}\r\n2026-10-28T16:21:33.0000002Z ##[error]${CONTRACT_LINE}`, failing(CONTRACT_STEP)], + "the fail step's line with no contract failure": [`${failStep}`, failing(CONTRACT_STEP)], + "the old and new contract steps both failed": [contractLog(DO_NOT_MERGE_LINE), { jobs: heldJobs(ciJob([[OLD_CONTRACT_STEP, "failure"], ...CI_STEPS.map(([n, c]) => [n, n === CONTRACT_STEP ? "failure" : n === HOLD_STEP ? "success" : c])])) }], }; for (const [name, [log, setup]] of Object.entries(cases)) { assert.equal(await held(log, setup), "not-a-passing-run", name); } }); -// Judging a held head loosens no hold: ci-status still fails on the label -// (check-contract, its default label name, no continue-on-error), and the -// merge queue's step still refuses a queued pull request that carries it. +/** + * Judging a held head loosens no hold: ci-status still fails on the label + * (check-contract in the report-ci-status composite, its default label name, + * and the fail step on the composite's contract output, with its own line), + * and the merge queue's step still refuses a queued pull request that carries it. + */ test("do-not-merge still fails ci-status and the merge queue", () => { const workflow = readFileSync(new URL("../../workflows/pr-require-checks.yml", import.meta.url), "utf8"); const step = (name) => new RegExp(`^ {6}- name: ${name}\\n((?: {8}.*\\n|\\n)*)`, "m").exec(workflow)?.[1] ?? ""; - const contract = step(CONTRACT_STEP); - assert.match(contract, /^ {8}uses: melodic-software\/ci-workflows\/\.github\/actions\/pr-require-checks\/check-contract@[0-9a-f]{40} /m); - assert.doesNotMatch(contract, /do-not-merge-label|continue-on-error|^ {8}if:/m); + const report = step("Aggregate lane results"); + assert.match(report, /^ {8}id: report$/m); + assert.match(report, /^ {8}uses: melodic-software\/ci-workflows\/\.github\/actions\/pr-require-checks\/report-ci-status@[0-9a-f]{40} /m); + assert.doesNotMatch(report, /do-not-merge-label|continue-on-error/m); + const fail = step(CONTRACT_STEP); + assert.match(fail, /^ {8}if: \$\{\{ !cancelled\(\) && \(steps\.report\.outputs\.contract != 'success' \|\| steps\.report\.outputs\.draft != 'success'\) \}\}$/m); + assert.ok(fail.includes(`echo "::error::${CONTRACT_LINE}"\n exit 1\n`), "the fail step writes CONTRACT_LINE and exits 1"); + assert.doesNotMatch(fail, /continue-on-error/m); + assert.doesNotMatch(workflow, /pr-require-checks\/check-contract@/); assert.match(step("Fail a queued pull request carrying a hold label"), /^ {8}if: github\.event_name == 'merge_group'$/m); assert.deepEqual(labelHolds([{ name: "do-not-merge" }], null, 41), [ "#41 carries the 'do-not-merge' label; the merge queue removes it. Remove the label and re-queue to merge.", diff --git a/.github/workflows/pr-require-checks.yml b/.github/workflows/pr-require-checks.yml index 1affe511131..bd55fb63e70 100644 --- a/.github/workflows/pr-require-checks.yml +++ b/.github/workflows/pr-require-checks.yml @@ -4329,13 +4329,16 @@ jobs: # gh_read's wait budget: a rate-limit wait must end by # GH_READ_JOB_SECONDS (timeout-minutes in seconds) less # GH_READ_MARGIN_SECONDS after the first step starts. The margin keeps - # 375 s for the job's setup and the steps after the wait: - # aggregate-results' 60 s rate-limit wait, 120 s of own-gate retries, 7 s - # of status writes and the 90 s rerun wait, plus retry sleeps. It does not + # 435 s for the job's setup and the steps after the wait, which include + # the report-ci-status composite + # (https://github.com/melodic-software/ci-workflows/blob/ebd0e3bed99ae1365fcb4ef47ce97cfa745fcf2f/.github/actions/pr-require-checks/report-ci-status/action.yml): + # check-contract's and aggregate-results' 60 s rate-limit waits, 120 s + # of own-gate retries, 7 s of status writes and the 90 s rerun wait, + # plus retry sleeps. It does not # hold the 600 s `yield-wait-seconds` hold of a contract-only run: a long # rate-limit wait before a long hold can reach the timeout, which fails. GH_READ_JOB_SECONDS: 1200 - GH_READ_MARGIN_SECONDS: 375 + GH_READ_MARGIN_SECONDS: 435 # The lanes App's bot account id, which the trust-hold, cost-hold and # lanes-hold steps match a pull request author against. Its one source is # the repository variable; each step that reads it fails closed or keeps @@ -5047,10 +5050,12 @@ jobs: } # END api-budget ci-status permissions: - # `yield-to-full-run` lists this workflow's runs on the head SHA, and - # `rerun-contract-only-siblings` re-runs the red contract-only ones once - # the full run records `success`. Under an explicit permissions block every - # unlisted scope defaults to none; write covers the read. + # The composite lists this workflow's runs on the head SHA (its fixed + # `yield-to-full-run`, + # https://github.com/melodic-software/ci-workflows/blob/ebd0e3bed99ae1365fcb4ef47ce97cfa745fcf2f/.github/actions/pr-require-checks/report-ci-status/action.yml#L128-L129), + # and `rerun-contract-only-siblings` re-runs the red contract-only ones + # once the full run records `success`. Under an explicit permissions + # block every unlisted scope defaults to none; write covers the read. actions: write # The cost-hold step reads the review lanes' hold notices from their # check-run annotations. @@ -5181,7 +5186,6 @@ jobs: # step read its own way; pr_read_forget drops every kept answer, and # every step that writes to the pull request runs it after its write # (the cost-hold step). - # check-contract writes before any step reads through this cache. pr_read() { local file out file=$(pr_read_file "$@") || file= @@ -5321,15 +5325,6 @@ jobs: echo "::notice title=cancelled-after-success::job=${job// /} tail_s=${tail// /}" fi done <<<"$rows" - - name: Check the pull-request contract - uses: melodic-software/ci-workflows/.github/actions/pr-require-checks/check-contract@24067add42f5fa04743c587c6a22aa7d4059e7b8 # v0.75.0 - with: - token: ${{ github.token }} - # Dependabot and the release App write generated bodies with no - # closing keyword or contract sections, so their logins skip the - # linkage check and their pull requests draw no advisory label or - # comment. Exact-login matches, never a `*[bot]` pattern. - exempt-authors: 'dependabot[bot],melodic-release[bot]' # A RESOLVE-CONFIG DEPENDENCY CHANGE NAMES ITS BROKER DEPLOY PULL REQUEST. # The lanes token broker in melodic-software/azure-iac loads resolve-config's # modules from main's tip, but imports ajv and yaml from its own deployed @@ -7351,12 +7346,20 @@ jobs: jq -r 'to_entries[] | "\(.key): \(.value.result)"' <<<"$LANES" echo "Results after the ordered-skip check: $results" echo "results=$results" >>"$GITHUB_OUTPUT" + # The contract, the draft policy and the aggregation in one step + # (https://github.com/melodic-software/ci-workflows/blob/ebd0e3bed99ae1365fcb4ef47ce97cfa745fcf2f/.github/actions/pr-require-checks/report-ci-status/README.md), + # under the aggregation step's old name, by which a contract-only run + # finds the writer step of the full run it carries forward. + # `!cancelled()` so a failed step above skips neither the contract check + # nor the `ci-lanes` status. Dependabot and the release App write + # generated bodies with no closing keyword or contract sections, so their + # logins skip the linkage check and draw no advisory label or comment + # (exact-login matches, never a `*[bot]` pattern). A draft passes (see + # `Note a draft`). - name: Aggregate lane results - # `!cancelled()` so a failing check-contract step does not skip the - # aggregation: the job still fails on the contract step's exit code, and - # the `ci-lanes` status is on the SHA for the next contract-only run. + id: report if: ${{ !cancelled() }} - uses: melodic-software/ci-workflows/.github/actions/pr-require-checks/aggregate-results@24067add42f5fa04743c587c6a22aa7d4059e7b8 # v0.75.0 + uses: melodic-software/ci-workflows/.github/actions/pr-require-checks/report-ci-status@ebd0e3bed99ae1365fcb4ef47ce97cfa745fcf2f # v0.76.0 with: # Every lane of the needs graph above — the single source of truth # for the lane list — through the ordered-skip check. Adding a lane @@ -7365,26 +7368,38 @@ jobs: # A `skipped` lane is red, except on a draft, where every lane skips # (see `Note a draft`). treat-skipped-as: ${{ github.event.pull_request.draft && 'pass' || 'fail' }} - # `carry-forward-wait-seconds: '0'` means no carry-forward wait. While - # a full run on the SHA is in flight the composite holds, up to - # `yield-wait-seconds`, with this check run in progress, then passes - # only on a `success` recorded since it started. The ceiling covers the full - # run's p95 (580 s, max 783 s of 148 runs, 2026-10-31). Past it the - # run fails with "superseded by full run ", and that run's newer - # ci-status decides the gate; once it records `success` it re-runs - # that red run. A contract-only run whose earlier step failed cannot - # pass, and a draft's lanes are skipped, so neither holds. A full - # run's value stays constant: it is what skips the rerun wait. + exempt-authors: 'dependabot[bot],melodic-release[bot]' + draft: allow + # The composite fixes yield-to-full-run: 'true' and + # carry-forward-wait-seconds: '0' + # (https://github.com/melodic-software/ci-workflows/blob/ebd0e3bed99ae1365fcb4ef47ce97cfa745fcf2f/.github/actions/pr-require-checks/report-ci-status/action.yml#L128-L129): + # no carry-forward wait. While a full run on the SHA is in flight a + # contract-only run holds, up to `yield-wait-seconds`, with this + # check run in progress, then passes only on a `success` recorded + # since it started. The ceiling covers the full run's p95 (580 s, + # max 783 s of 148 runs, 2026-10-31). Past it the run fails with + # "superseded by full run ", and that run's newer ci-status + # decides the gate; once it records `success` it re-runs that red + # run. A draft's lanes are skipped, so it does not hold, and the + # composite drops the hold to 0 on a contract-only run whose job, + # contract or draft step already failed, since it cannot pass. A + # full run's value stays constant: it is what skips the rerun wait. # Operator remedy: # docs/ci-runner-routing.md, section Contract-only ci-status. - yield-to-full-run: 'true' - yield-wait-seconds: ${{ ((job.status == 'failure' && github.event.pull_request.head.repo.full_name == github.repository && (contains(fromJSON('["labeled","unlabeled"]'), github.event.action) || (github.event.action == 'edited' && !github.event.changes.base))) || github.event.pull_request.draft) && '0' || '600' }} + yield-wait-seconds: ${{ github.event.pull_request.draft && '0' || '600' }} rerun-contract-only-siblings: ${{ github.event.pull_request.draft && 'false' || 'true' }} - carry-forward-wait-seconds: '0' # This step's own name, so the own-step lookup never depends on # how many steps of the job are in progress. step-name: Aggregate lane results - token: ${{ github.token }} + # The composite's step concludes on the lanes alone; the contract and + # draft results fail the job here + # (https://github.com/melodic-software/ci-workflows/blob/ebd0e3bed99ae1365fcb4ef47ce97cfa745fcf2f/.github/actions/pr-require-checks/report-ci-status/README.md#consumer-job). + # Anything but success fails, so an empty or renamed output fails closed. + - name: Fail on the contract or draft policy + if: ${{ !cancelled() && (steps.report.outputs.contract != 'success' || steps.report.outputs.draft != 'success') }} + run: | + echo "::error::ci-status: the pull-request contract or the draft policy failed; see the step above." + exit 1 # After the aggregate, so a contract-only run that holds for a full run # reaches this check once that run has finished; before it, a review # still running would fail the job in the window a yield happens, and diff --git a/docs/ci-runner-routing.md b/docs/ci-runner-routing.md index 4a38084f07b..9a14c97511d 100644 --- a/docs/ci-runner-routing.md +++ b/docs/ci-runner-routing.md @@ -154,8 +154,8 @@ are in the header of `scripts/affected-tests.sh`. A same-repo `edited` (without `changes.base`), `labeled`, or `unlabeled` event runs `ci` as contract-only: every lane job is gated off and `ci-status` reads the `ci-lanes` commit status on the head SHA, with no carry-forward wait -(`yield-to-full-run: 'true'`, `yield-wait-seconds: '600'` and -`carry-forward-wait-seconds: '0'` on the `aggregate-results` composite). It +(`yield-wait-seconds: '600'` on the `report-ci-status` composite, which fixes +`yield-to-full-run: 'true'` and `carry-forward-wait-seconds: '0'`). It passes only when the newest status the Actions bot wrote is `success`. A contract-only run waits only on a full run in flight on its SHA: From 9e4d473a2c46e4ac9b6414eeb0f403e06c46ef66 Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Thu, 19 Nov 2026 00:55:16 -0500 Subject: [PATCH 2/2] test(ci): check ci-status's composite, not two explicit waits, in ci-gh-read ci-gh-read.test.sh, added on main, required two explicit rate-limit-wait-seconds in ci-status. report-ci-status takes no wait input and runs check-contract and aggregate-results at their 60 s defaults, the same 120 s the timeout holds; the test now checks that ci-status calls the composite once and passes no wait input. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Vcupoo79EqmECYFZ4MTv6C --- scripts/ci-gh-read.test.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/ci-gh-read.test.sh b/scripts/ci-gh-read.test.sh index 30e44ce7316..0def30dd11f 100755 --- a/scripts/ci-gh-read.test.sh +++ b/scripts/ci-gh-read.test.sh @@ -60,11 +60,10 @@ if [[ "$got" -ge $((want - 5)) && "$got" -le "$want" ]]; then else fail "the step set the deadline '$got', want about '$want'" fi -composite_waits="$(sed -nE "s/^ rate-limit-wait-seconds: '([0-9]+)'$/\1/p" <<<"$job" | paste -sd+ -)" -if [[ "$(grep -c 'rate-limit-wait-seconds:' <<<"$job")" == 2 && -n "$composite_waits" && $((composite_waits)) -le 120 ]]; then - ok "the two pinned composites wait at most the 120 s ci-status's timeout holds for them" +if [[ "$(grep -c 'rate-limit-wait-seconds:' <<<"$job")" == 0 && "$(grep -c 'pr-require-checks/report-ci-status@' <<<"$job")" == 1 ]]; then + ok "ci-status runs report-ci-status once and leaves its two inner waits at their 60 s defaults, the 120 s its timeout holds" else - fail "ci-status passes its composites rate-limit-wait-seconds of '$composite_waits', over the 120 s its timeout holds, or not as two quoted numbers" + fail "ci-status passes a rate-limit-wait-seconds the composite does not take, or does not call report-ci-status exactly once" fi first="$(grep -m1 '^ - name: ' <<<"$job")" if [[ "$first" == " - name: Write the rate-limit-aware read helper" ]]; then