An open source design system that's fully customizable and agent ready
TypeScript
ci: the stale-head hint runs only after a plan that succeeded, and escapes a commit subject once (#10495)
Cindy Zhangc4ccda5a5b31
diff --git a/.github/scripts/ci-interaction-webkit.test.mjs b/.github/scripts/ci-interaction-webkit.test.mjsindex 71df541f1e..685d9ea638 100644--- a/.github/scripts/ci-interaction-webkit.test.mjs+++ b/.github/scripts/ci-interaction-webkit.test.mjs@@ -135,12 +135,17 @@ describe('WebKit interaction proof routing', () => {for (const [index, candidate] of webkit.steps.entries()) {if (index < 2 || guards.has(candidate.name)) continue;const gate = index <= counted ? applies : `${applies} && ${share}`;- // A leg whose plan holds no spec file runs no proofs.- expect(candidate.if, candidate.name ?? candidate.uses).toMatch(- new RegExp(- `^((always|failure)\\(\\) && )?${gate.replace(/[.()|]/g, '\\$&')}( && steps\\.plan\\.outputs\\.files != '0')?$`,- ),- );+ // Only the hint and the evidence upload run after a failed step, and+ // only the proofs and the hint wait for a plan with a spec file in it.+ const planned = "steps.plan.outputs.files != '0'";+ let expected = gate;+ if (candidate.name === 'Run WebKit interaction proofs')+ expected = `${gate} && ${planned}`;+ if (candidate.name === 'Explain a failure on an older head')+ expected = `failure() && ${gate} && steps.plan.outcome == 'success' && ${planned}`;+ if (candidate.name === 'Upload WebKit interaction evidence')+ expected = `always() && ${gate}`;+ expect(candidate.if, candidate.name ?? candidate.uses).toBe(expected);}expect(step(webkit, 'Leave the proofs to the other legs').if).toBe(`${applies} && steps.legs.outputs.runs != 'true'`,diff --git a/.github/scripts/ci-interaction.test.mjs b/.github/scripts/ci-interaction.test.mjsindex 08557da740..d524aaeef5 100644--- a/.github/scripts/ci-interaction.test.mjs+++ b/.github/scripts/ci-interaction.test.mjs@@ -78,12 +78,17 @@ describe('interaction proof routing', () => {index <= counted? applies: `${applies} && steps.legs.outputs.runs == 'true'`;- // A leg whose plan holds no spec file runs no proofs.- expect(candidate.if, candidate.name ?? candidate.uses).toMatch(- new RegExp(- `^((always|failure)\\(\\) && )?${gate.replace(/[.()|]/g, '\\$&')}( && steps\\.plan\\.outputs\\.files != '0')?$`,- ),- );+ // Only the hint and the evidence upload run after a failed step, and+ // only the proofs and the hint wait for a plan with a spec file in it.+ const planned = "steps.plan.outputs.files != '0'";+ let expected = gate;+ if (candidate.name === 'Run interaction proofs')+ expected = `${gate} && ${planned}`;+ if (candidate.name === 'Explain a failure on an older head')+ expected = `failure() && ${gate} && steps.plan.outcome == 'success' && ${planned}`;+ if (candidate.name === 'Upload interaction evidence')+ expected = `always() && ${gate}`;+ expect(candidate.if, candidate.name ?? candidate.uses).toBe(expected);}expect(step(proofs, 'Leave the proofs to the other legs').if).toBe(`${applies} && steps.legs.outputs.runs != 'true'`,diff --git a/.github/scripts/ci-stale-head-hint.test.mjs b/.github/scripts/ci-stale-head-hint.test.mjsindex ad6a0bb69c..2856d579cc 100644--- a/.github/scripts/ci-stale-head-hint.test.mjs+++ b/.github/scripts/ci-stale-head-hint.test.mjs@@ -41,8 +41,9 @@ describe('the stale-head hint in the interaction legs', () => {it(`${id} explains a failure after its proofs, without failing the leg further`, () => {const job = ci.jobs[id];const hint = step(job, NAME);+ // Only after a plan that succeeded: a failed plan leaves no list.expect(hint.if).toBe(- `failure() && ${gate} && steps.plan.outputs.files != '0'`,+ `failure() && ${gate} && steps.plan.outcome == 'success' && steps.plan.outputs.files != '0'`,);expect(hint['continue-on-error']).toBe(true);// The base branch's tip at step time, not the run's merge commit, so a@@ -125,7 +126,12 @@ describe('the stale-head hint in the interaction legs', () => {git(work, 'checkout', '-q', '-b', 'topic');const head = commit(work, {'packages/core/src/Row/Row.tsx': 'x'}, 'head');git(work, 'checkout', '-q', 'main');- fixed = commit(work, {[spec]: 'v2'}, 'test(Row): the release reads 100%');+ // One commit changes two specs the leg ran; its subject holds a "%".+ fixed = commit(+ work,+ {[spec]: 'v2', [other]: 'v2'},+ 'test(Row): the release reads 100%',+ );commit(work, {'README.md': 'v2'}, 'docs: readme');commit(work,@@ -190,9 +196,11 @@ describe('the stale-head hint in the interaction legs', () => {.split('\n').filter(line => line.startsWith('::warning'));// Newest first, as git log lists them; the first landed after the run's- // merge commit, so the hint reads main's tip.+ // merge commit, so the hint reads main's tip. The subject's "%" is+ // escaped once on each line of a commit that changed two specs.expect(warnings).toEqual([`::warning title=Update your branch before debugging::internal/interaction-harness/src/busy.ts changed on main in ${later.slice(0, 7)} (fix(harness): a later fix), which this head does not have. Update the branch onto main and re-run: a test whose file changed on main gets an update, not a retry.`,+ `::warning title=Update your branch before debugging::${other} changed on main in ${fixed.slice(0, 7)} (test(Row): the release reads 100%25), which this head does not have. Update the branch onto main and re-run: a test whose file changed on main gets an update, not a retry.`,`::warning title=Update your branch before debugging::${spec} changed on main in ${fixed.slice(0, 7)} (test(Row): the release reads 100%25), which this head does not have. Update the branch onto main and re-run: a test whose file changed on main gets an update, not a retry.`,]);});diff --git a/.github/scripts/stale-head-hint.sh b/.github/scripts/stale-head-hint.shindex 663146a35c..5e4244db3e 100755--- a/.github/scripts/stale-head-hint.sh+++ b/.github/scripts/stale-head-hint.sh@@ -38,9 +38,10 @@ if ! awk '/^commit /{c=1;next} c&&NF{f=1} END{exit !f}' <<< "$newer"; thenexit 0fiawk -v base="$base_ref" '- /^commit / { sha = $2; $1 = ""; $2 = ""; subject = substr($0, 3); next }+ # A workflow command reads "%" as an escape, so the subject is escaped once+ # for the commit, not again for each file it changed.+ /^commit / { sha = $2; $1 = ""; $2 = ""; subject = substr($0, 3); gsub(/%/, "%25", subject); next }NF && shown < 5 {- gsub(/%/, "%25", subject)printf "::warning title=Update your branch before debugging::%s changed on %s in %s (%s), which this head does not have. Update the branch onto %s and re-run: a test whose file changed on %s gets an update, not a retry.\n", $0, base, sha, subject, base, baseshown++}diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex f6181e4233..28309b130e 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -2698,9 +2698,10 @@ jobs:# A proof that fails on a head older than main may fail for a reason# main already fixed. Name each newer main commit that changed a spec# this leg ran, or the harness, so the fix is to update the branch and- # not to retry or debug it.+ # not to retry or debug it. It runs only after this leg's plan+ # succeeded: a failed plan leaves no spec list to read.- name: Explain a failure on an older head- if: failure() && steps.scope.outputs.applies == 'true' && steps.legs.outputs.runs == 'true' && steps.plan.outputs.files != '0'+ if: failure() && steps.scope.outputs.applies == 'true' && steps.legs.outputs.runs == 'true' && steps.plan.outcome == 'success' && steps.plan.outputs.files != '0'continue-on-error: trueenv:BASE_REF: ${{ github.event.pull_request.base.ref }}@@ -2720,12 +2721,15 @@ jobs:# of every iOS browser, for the code where WebKit and Chromium differ on# touch: the gesture host and recognizers, the motion runtime, the touch and# press helpers, the menu press model and the pager, plus the harness and the- # shared setup that runs them (spec:AST-030 FR13). The run is limited to the specs- # whose bundles reach only that same code, so a WebKit break elsewhere never- # turns an unrelated pull request red; the motion adopters spec renders- # Storybook components and stays with the Chromium proofs. Out of scope every step after the scope step skips and- # the job reports success, so the `test` join reads it without a new- # required context. Specs that need Chromium-only evidence skip themselves+ # shared setup that runs them (spec:AST-030 FR13). A pull request runs the+ # specs whose bundles reach only that same code, the interaction specs it+ # changes, and the specs in the folder of any component code it changes, so+ # a WebKit break elsewhere never turns an unrelated pull request red; the+ # motion adopters spec renders Storybook components and stays with the+ # Chromium proofs. A release interaction check (an `interaction-check/`+ # branch from the release tooling) runs every spec (spec:AST-030 FR28).+ # Out of scope every step after the scope step skips and the job reports+ # success, so the `test` join reads it without a new required context. Specs that need Chromium-only evidence skip themselves# in WebKit.pr-interaction-webkit:name: pr-interaction-webkit (${{ matrix.leg }}/${{ strategy.job-total }})@@ -3005,9 +3009,10 @@ jobs:# A proof that fails on a head older than main may fail for a reason# main already fixed. Name each newer main commit that changed a spec# this leg ran, or the harness, so the fix is to update the branch and- # not to retry or debug it.+ # not to retry or debug it. It runs only after this leg's plan+ # succeeded: a failed plan leaves no spec list to read.- name: Explain a failure on an older head- if: failure() && steps.scope.outputs.applies == 'true' && steps.legs.outputs.runs == 'true' && steps.plan.outputs.files != '0'+ if: failure() && steps.scope.outputs.applies == 'true' && steps.legs.outputs.runs == 'true' && steps.plan.outcome == 'success' && steps.plan.outputs.files != '0'continue-on-error: trueenv:BASE_REF: ${{ github.event.pull_request.base.ref }}