An open source design system that's fully customizable and agent ready
TypeScript
ci: interaction lanes start only the legs their plan gives a share (#10644)
Cindy Zhangb9ad7bf521a0
diff --git a/.github/actions/ci-admission/count.mjs b/.github/actions/ci-admission/count.mjsindex 2419c20000..ad10d1395b 100644--- a/.github/actions/ci-admission/count.mjs+++ b/.github/actions/ci-admission/count.mjs@@ -44,7 +44,7 @@ export const AT_LIMIT_SLACK_MS = 30_000;// One line per workflow: ci-admission.test.mjs reads each estimate from it.// prettier-ignoreconst ESTIMATE = {- '.github/workflows/ci.yml': run => (run.event === 'workflow_dispatch' ? 39 : 16),+ '.github/workflows/ci.yml': run => (run.event === 'workflow_dispatch' ? 39 : 17),'.github/workflows/deploy.yml': run => (run.event === 'push' ? 4 : 14),'.github/workflows/review-signal.yml': () => 2,};diff --git a/.github/scripts/ci-admission.test.mjs b/.github/scripts/ci-admission.test.mjsindex 0e38431ddb..6c3ba73da0 100644--- a/.github/scripts/ci-admission.test.mjs+++ b/.github/scripts/ci-admission.test.mjs@@ -212,6 +212,7 @@ describe('where runs wait', () => {expect(guarded.sort()).toEqual(['a11y-dependent-audits-plan','docsite-build',+ 'interaction-legs','pr-a11y-dependent-audits','pr-component-a11y-contracts','pr-interaction',diff --git a/.github/scripts/ci-heavy-deferral.test.mjs b/.github/scripts/ci-heavy-deferral.test.mjsindex 337ecf6a51..9ef230510b 100644--- a/.github/scripts/ci-heavy-deferral.test.mjs+++ b/.github/scripts/ci-heavy-deferral.test.mjs@@ -50,6 +50,7 @@ const HEAVY = ['run-labels','test-build','build-storybook',+ 'interaction-legs','pr-interaction','pr-interaction-webkit',];diff --git a/.github/scripts/ci-interaction-webkit.test.mjs b/.github/scripts/ci-interaction-webkit.test.mjsindex 685d9ea638..00da2d09a2 100644--- a/.github/scripts/ci-interaction-webkit.test.mjs+++ b/.github/scripts/ci-interaction-webkit.test.mjs@@ -95,6 +95,7 @@ describe('WebKit interaction proof routing', () => {'admission','heavy-ci','build-storybook',+ 'interaction-legs',]);});@@ -126,6 +127,7 @@ describe('WebKit interaction proof routing', () => {"Require this pull request's Storybook build",'Skip the WebKit proofs outside their scope','Leave the proofs to the other legs',+ 'Require a leg for every share',]);// Every step after the leg count also waits for this leg to have a share.const counted = webkit.steps.indexOf(@@ -150,6 +152,10 @@ describe('WebKit interaction proof routing', () => {expect(step(webkit, 'Leave the proofs to the other legs').if).toBe(`${applies} && steps.legs.outputs.runs != 'true'`,);+ // A leg whose own count needs more legs than started fails.+ expect(step(webkit, 'Require a leg for every share').if).toBe(+ "steps.scope.outputs.applies == 'true' && fromJSON(steps.legs.outputs.count || '0') > strategy.job-total",+ );});it('runs the interaction config in WebKit against the exact PR head', () => {diff --git a/.github/scripts/ci-interaction.test.mjs b/.github/scripts/ci-interaction.test.mjsindex d524aaeef5..d78f9316d5 100644--- a/.github/scripts/ci-interaction.test.mjs+++ b/.github/scripts/ci-interaction.test.mjs@@ -55,6 +55,7 @@ describe('interaction proof routing', () => {'admission','heavy-ci','build-storybook',+ 'interaction-legs',]);});@@ -69,6 +70,7 @@ describe('interaction proof routing', () => {"Require this pull request's Storybook build",'Skip the proofs outside their scope','Leave the proofs to the other legs',+ 'Require a leg for every share',]);// Every step after the leg count also waits for this leg to have a share.const counted = proofs.steps.indexOf(step(proofs, "Count this run's legs"));@@ -93,6 +95,10 @@ describe('interaction proof routing', () => {expect(step(proofs, 'Leave the proofs to the other legs').if).toBe(`${applies} && steps.legs.outputs.runs != 'true'`,);+ // A leg whose own count needs more legs than started fails.+ expect(step(proofs, 'Require a leg for every share').if).toBe(+ `${applies} && fromJSON(steps.legs.outputs.count || '0') > strategy.job-total`,+ );});it('fails closed when Storybook did not build for proofs that apply', () => {diff --git a/.github/scripts/ci-matrix.mjs b/.github/scripts/ci-matrix.mjsindex ee5b03ca2a..ab62ec9c08 100644--- a/.github/scripts/ci-matrix.mjs+++ b/.github/scripts/ci-matrix.mjs@@ -8,9 +8,14 @@* pull request through one expression,* `${{ fromJSON(github.event_name == 'workflow_dispatch' && '<JSON>' || '<JSON>') }}`* (spec:AST-030 FR23); this reads it the way GitHub evaluates it. A plain- * list is the same for every event.+ * list is the same for every event. A matrix an earlier job counts,+ * `${{ fromJSON(needs.<job>.outputs.<name> || '<JSON>') }}`, starts at most+ * its fallback list, so this reads that list as its widest matrix.*/+const COMPUTED =+ /^\$\{\{\s*fromJSON\(needs\.[\w-]+\.outputs\.[\w-]+ \|\| '([^']*)'\)\s*\}\}$/;+const BY_EVENT =/^\$\{\{\s*fromJSON\(github\.event_name == 'workflow_dispatch' && '([^']*)' \|\| '([^']*)'\)\s*\}\}$/;@@ -21,6 +26,8 @@ const BY_EVENT =*/export function matrixFor(value, event) {if (Array.isArray(value)) return value;+ const computed = COMPUTED.exec(typeof value === 'string' ? value : '');+ if (computed) return JSON.parse(computed[1]);const match = BY_EVENT.exec(typeof value === 'string' ? value : '');if (!match) throw new Error(`Unrecognized matrix expression: ${value}`);return JSON.parse(event === 'workflow_dispatch' ? match[1] : match[2]);diff --git a/.github/scripts/ci-test-routing.test.mjs b/.github/scripts/ci-test-routing.test.mjsindex f407d1239f..72778acae9 100644--- a/.github/scripts/ci-test-routing.test.mjs+++ b/.github/scripts/ci-test-routing.test.mjs@@ -884,6 +884,7 @@ describe('ci.yml interaction proofs', () => {'admission','heavy-ci','build-storybook',+ 'interaction-legs',]);const checkout = job.steps.find(candidate =>diff --git a/.github/scripts/playwright-legs.mjs b/.github/scripts/playwright-legs.mjsindex b0d541f625..59325ae181 100644--- a/.github/scripts/playwright-legs.mjs+++ b/.github/scripts/playwright-legs.mjs@@ -79,7 +79,7 @@ export function legsFitMessage({maxLegs,slackSeconds = 60,}) {- const needed = Math.ceil(seconds / (maxSeconds - setupSeconds));+ const needed = legsNeeded({seconds, setupSeconds, maxSeconds});const legs = legCount({seconds, setupSeconds, maxSeconds, maxLegs});const planned = planLegs(files, costs, legs);const longest = Math.max(0, ...planned.map(leg => leg.seconds));@@ -214,6 +214,14 @@ function meanTestSeconds(texts, project, strip) {return tests > 0 ? Math.round((seconds / tests) * 100) / 100 : undefined;}+/**+ * The legs whose share of the proofs, each beside its setup, fits+ * `maxSeconds`, with no ceiling.+ */+export function legsNeeded({seconds, setupSeconds, maxSeconds}) {+ return Math.ceil(seconds / (maxSeconds - setupSeconds));+}+/*** The fewest legs, at most `maxLegs`, in which each leg's setup and share of* the proofs fits `maxSeconds`. One leg while the whole estimate fits.@@ -225,7 +233,7 @@ export function legCount({seconds, setupSeconds, maxSeconds, maxLegs}) {throw new Error('a leg needs more time than its setup, and one leg at least',);- const needed = Math.ceil(seconds / (maxSeconds - setupSeconds));+ const needed = legsNeeded({seconds, setupSeconds, maxSeconds});return Math.min(maxLegs, Math.max(1, needed));}diff --git a/.github/scripts/playwright-legs.test.mjs b/.github/scripts/playwright-legs.test.mjsindex 89d903ea6d..8ba466ccfb 100644--- a/.github/scripts/playwright-legs.test.mjs+++ b/.github/scripts/playwright-legs.test.mjs@@ -22,6 +22,7 @@ import {selectProofs,testsReader,} from './playwright-legs.mjs';+import {matrixFor} from './ci-matrix.mjs';const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)),@@ -303,12 +304,103 @@ describe('the list reader and recordLog', () => {});});+describe('the interaction leg count job in ci.yml', () => {+ const counter = ci.jobs['interaction-legs'];+ const lanes = [+ {id: 'pr-interaction', key: 'chromium', count: "Count this run's legs", mine: 'Count the Chromium legs'},+ {id: 'pr-interaction-webkit', key: 'webkit', count: "Count this run's WebKit legs", mine: 'Count the WebKit legs'},+ ];++ it('runs beside the Storybook build, behind the gate the lanes share', () => {+ expect(counter.needs).toEqual(['room', 'admission', 'heavy-ci']);+ expect(counter.if).toBe(ci.jobs['pr-interaction'].if);+ expect(counter.if).toBe(ci.jobs['pr-interaction-webkit'].if);+ expect(counter.env).toEqual(ci.jobs['pr-interaction-webkit'].env);+ expect(counter.outputs).toEqual({+ chromium: '${{ steps.matrix.outputs.chromium }}',+ webkit: '${{ steps.matrix.outputs.webkit }}',+ });+ });++ it('checks out and keeps the planner exactly as each lane does', () => {+ // A file the lanes' planner needs but this job did not copy would fail+ // its count and send every run back to six legs.+ for (const lane of lanes) {+ const job = ci.jobs[lane.id];+ expect(counter.steps[0]).toEqual(job.steps[0]);+ const keep = "Keep the leg planner from the workflow's commit";+ expect(step(counter, keep).run).toBe(step(job, keep).run);+ }+ });++ for (const lane of lanes) {+ it(`counts the ${lane.key} lane the way its legs do`, () => {+ const job = ci.jobs[lane.id];+ const scope = step(job, "Decide this job's scope");+ const myScope = counter.steps.find(each => each.id === `scope-${lane.key}`);+ expect(myScope.uses).toBe(scope.uses);+ expect(myScope.with).toEqual(scope.with);+ const theirs = step(job, lane.count);+ const mine = step(counter, lane.mine);+ expect(mine.id).toBe(`count-${lane.key}`);+ expect(mine.if).toBe(`steps.scope-${lane.key}.outputs.applies == 'true'`);+ // A failed count falls back to six legs that each decide for themselves.+ expect(mine['continue-on-error']).toBe(true);+ expect(mine.env ?? {}).toEqual(+ JSON.parse(+ JSON.stringify(theirs.env ?? {}).replaceAll('steps.scope.', `steps.scope-${lane.key}.`),+ ),+ );+ expect(mine.run).toBe(theirs.run.replaceAll('${{ matrix.leg }}', '1'));+ expect(theirs.run).toContain('--max-legs 6');+ });+ }++ it('names each lane one leg out of scope, its count in scope, and six when the count failed', () => {+ const name = step(counter, "Name each lane's legs");+ expect(name.id).toBe('matrix');+ const outputs = (chromium, webkit) => {+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'interaction-legs-'));+ try {+ const output = path.join(dir, 'output.txt');+ fs.writeFileSync(output, '');+ execFileSync('bash', ['-e', '-c', name.run], {+ encoding: 'utf8',+ env: {+ ...process.env,+ GITHUB_OUTPUT: output,+ CHROMIUM_OUTCOME: chromium[0],+ CHROMIUM_COUNT: chromium[1],+ WEBKIT_OUTCOME: webkit[0],+ WEBKIT_COUNT: webkit[1],+ },+ });+ return fs.readFileSync(output, 'utf8');+ } finally {+ fs.rmSync(dir, {recursive: true, force: true});+ }+ };+ expect(outputs(['success', '3'], ['success', '0'])).toBe('chromium=[1, 2, 3]\nwebkit=[1]\n');+ expect(outputs(['skipped', ''], ['failure', ''])).toBe('chromium=[1]\nwebkit=[1, 2, 3, 4, 5, 6]\n');+ expect(outputs(['success', '9'], ['success', '6'])).toBe(+ 'chromium=[1, 2, 3, 4, 5, 6]\nwebkit=[1, 2, 3, 4, 5, 6]\n',+ );+ });++ it('reads a counted matrix as its fallback list, the most legs it starts', () => {+ expect(+ matrixFor("${{ fromJSON(needs.interaction-legs.outputs.webkit || '[1, 2, 3, 4, 5, 6]') }}", 'pull_request'),+ ).toEqual([1, 2, 3, 4, 5, 6]);+ });+});+describe('the interaction proof legs in ci.yml', () => {const lanes = [{id: 'pr-interaction',project: 'chromium',legs: [1, 2, 3, 4, 5, 6],+ matrix: 'chromium',run: 'Run interaction proofs',plan: "Plan this leg's interaction proofs",evidence: 'interaction-evidence-${{ matrix.leg }}',@@ -323,6 +415,7 @@ describe('the interaction proof legs in ci.yml', () => {id: 'pr-interaction-webkit',project: 'webkit',legs: [1, 2, 3, 4, 5, 6],+ matrix: 'webkit',run: 'Run WebKit interaction proofs',plan: "Plan this leg's WebKit interaction proofs",evidence: 'interaction-evidence-webkit-${{ matrix.leg }}',@@ -336,11 +429,13 @@ describe('the interaction proof legs in ci.yml', () => {];for (const lane of lanes) {- it(`${lane.id} runs as ${lane.legs.length} legs that each plan their share and run only it`, () => {+ it(`${lane.id} runs as the legs interaction-legs counts, at most ${lane.legs.length}, that each plan their share and run only it`, () => {const job = ci.jobs[lane.id];expect(job.strategy).toEqual({'fail-fast': false,- matrix: {leg: lane.legs},+ matrix: {+ leg: `\${{ fromJSON(needs.interaction-legs.outputs.${lane.matrix} || '${JSON.stringify(lane.legs).replaceAll(',', ', ')}') }}`,+ },});expect(job.name).toBe(`${lane.id} (\${{ matrix.leg }}/\${{ strategy.job-total }})`,@@ -431,7 +526,7 @@ describe('the interaction proof legs in ci.yml', () => {'--key interaction-webkit --fallback-key interaction-chromium','--durations "$RUNNER_TEMP/interaction-legs/.github/playwright-leg-durations.json"','--setup-seconds 90 --max-seconds 600',- '--leg ${{ matrix.leg }} --max-legs ${{ strategy.job-total }}',+ '--leg ${{ matrix.leg }} --max-legs 6',// Every spec file in the merge commit, recorded or not.'git -C .test-scope ls-tree -r --name-only HEAD > "$RUNNER_TEMP/interaction-legs/listed.txt"','--listed "$RUNNER_TEMP/interaction-legs/listed.txt" --source .test-scope',@@ -520,7 +615,7 @@ describe('the interaction proof legs in ci.yml', () => {.replaceAll('${{ matrix.leg }}', String(leg)).replaceAll('${{ strategy.job-total }}',- String(job.strategy.matrix.leg.length),+ '6',),],{@@ -810,7 +905,7 @@ describe('the interaction proof legs in ci.yml', () => {'--key interaction-chromium --fallback-key interaction-webkit','--durations "$RUNNER_TEMP/interaction-legs/.github/playwright-leg-durations.json"','--setup-seconds 90 --max-seconds 600',- '--leg ${{ matrix.leg }} --max-legs ${{ strategy.job-total }}',+ '--leg ${{ matrix.leg }} --max-legs 6',])expect(count.run).toContain(part);// No path filter: the Chromium lane counts every spec.diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex fbb8b26335..8a3db19173 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -146,7 +146,7 @@ jobs:timeout-minutes: ${{ github.event_name == 'workflow_dispatch' && 125 || 13 }}with:phase: room- peak: ${{ github.event_name == 'workflow_dispatch' && 39 || 16 }}+ peak: ${{ github.event_name == 'workflow_dispatch' && 39 || 17 }}main: ${{ github.event_name == 'workflow_dispatch' }}max-wait-minutes: ${{ github.event_name == 'workflow_dispatch' && 120 || 12 }}max-looks: ${{ github.event_name == 'workflow_dispatch' && 30 || 2 }}@@ -200,7 +200,7 @@ jobs:started: ${{ needs.room.outputs.started }}looks: ${{ needs.room.outputs.looks }}next: ${{ needs.room.outputs.next }}- peak: ${{ github.event_name == 'workflow_dispatch' && 39 || 16 }}+ peak: ${{ github.event_name == 'workflow_dispatch' && 39 || 17 }}main: ${{ github.event_name == 'workflow_dispatch' }}max-wait-minutes: ${{ github.event_name == 'workflow_dispatch' && 120 || 12 }}max-looks: ${{ github.event_name == 'workflow_dispatch' && 30 || 2 }}@@ -2535,20 +2535,182 @@ jobs:retention-days: 30delete-merged: true+ # How many legs each interaction lane starts. It counts each lane the way+ # its legs do (same scope, planner and recorded times, at most six legs),+ # so a lane starts only the legs that have a share. A leg fails when its+ # own count needs more legs than started.+ interaction-legs:+ name: interaction-legs+ needs: [room, admission, heavy-ci]+ if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft && (github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'ci:run'))) && (!cancelled() && needs.heavy-ci.outputs.deferred != 'true' && (github.event_name != 'workflow_dispatch' && always() && !cancelled() && needs.room.outputs.full != 'true' && needs.admission.outputs.full != 'true')) }}+ runs-on: ubuntu-latest+ timeout-minutes: 5+ permissions:+ contents: read+ pull-requests: read+ env:+ # The code where WebKit and Chromium differ on touch, and the lane's+ # shared setup. A change to it runs WEBKIT_SPEC_PATHS.+ WEBKIT_SHARED_PATHS: '^(packages/core/src/gestures/|packages/core/src/motion/|packages/core/src/internal/touch|packages/core/src/utils/(press|touch|primaryClick|isApplePlatform|flatTree|inputStream|clickGuard|selectionLock|coarsePointer|sharedResizeObserver|scrollView|nodeType|inputAge)|packages/core/src/privateAttributes/(hapticSwitch|reducedMotion)\.stylex\.ts$|packages/core/src/theme/tokenReferences\.ts$|packages/core/src/Layer/(inputHold|modalOutlet)\.ts$|packages/core/src/hooks/(useMenuPress|menuPress|useLongPress|usePressFeedback|isRtlElement|useIsomorphicLayoutEffect|useAttachment|usePager|__tests__/(usePager|pagerBundle))|internal/interaction-harness/|internal/a11y-spec/|playwright\.interaction\.config\.ts$|packages/themes/[^/]+/src/|apps/storybook/|\.github/workflows/ci\.yml$|package\.json$|pnpm-lock\.yaml$|\.github/scripts/(playwright-legs|a11y-pr-contracts|lane-environment)\.mjs$|\.github/scripts/(stale-head-hint|merge-base)\.sh$|scripts/lib/duration-split\.mjs$|\.github/(playwright-leg-durations|lane-environments)\.json$|\.github/actions/test-scope/|.*\.interaction\.browser\.spec\.ts$)'+ # The release interaction check's throwaway pull request runs every+ # interaction spec in WebKit: the release receipt needs the whole suite,+ # which the leg count spreads over the matrix. Only the release tooling+ # opens it: an interaction-check/ branch in this repository, opened by+ # the account the tooling uses. Any other pull request keeps the paths+ # below.+ WEBKIT_ALL_SPECS: ${{ startsWith(github.head_ref, 'interaction-check/') && github.event.pull_request.user.login == 'cixzhang' && github.event.pull_request.head.repo.full_name == github.repository }}+ # The specs a shared-code change runs. Besides them, a change runs each+ # interaction spec it edits, and every interaction spec in a component+ # folder whose code it changes (`playwright-legs.mjs select`).+ WEBKIT_SPEC_PATHS: >-+ packages/core/src/gestures/+ packages/core/src/motion/__tests__/animatedLayout.interaction+ packages/core/src/motion/__tests__/animator.interaction+ packages/core/src/hooks/__tests__/usePager.interaction+ internal/interaction-harness/+ outputs:+ chromium: ${{ steps.matrix.outputs.chromium }}+ webkit: ${{ steps.matrix.outputs.webkit }}+ steps:+ - name: Check out the scope action+ uses: actions/checkout@v7+ with:+ sparse-checkout: |+ .github/actions/test-scope+ .github/scripts+ scripts/lib+ path: .test-scope+ persist-credentials: false++ - name: Decide the Chromium proofs' scope+ id: scope-chromium+ uses: ./.test-scope/.github/actions/test-scope+ with:+ paths: '^(internal/interaction-harness/|internal/a11y-spec/|playwright\.interaction\.config\.ts$|packages/[^/]+/src/|packages/themes/[^/]+/src/|apps/storybook/|\.github/workflows/ci\.yml$|package\.json$|pnpm-lock\.yaml$|\.github/scripts/(playwright-legs|a11y-pr-contracts|lane-environment)\.mjs$|\.github/scripts/(stale-head-hint|merge-base)\.sh$|scripts/lib/duration-split\.mjs$|\.github/(playwright-leg-durations|lane-environments)\.json$|\.github/actions/test-scope/|.*\.interaction\.browser\.spec\.ts$)'+ outside-pull-request: skip+ requires-head-file: playwright.interaction.config.ts++ - name: Decide the WebKit proofs' scope+ id: scope-webkit+ uses: ./.test-scope/.github/actions/test-scope+ with:+ paths: '^(packages/[^/]+/src/[^/]+/|internal/interaction-harness/|internal/a11y-spec/|playwright\.interaction\.config\.ts$|packages/themes/[^/]+/src/|apps/storybook/|\.github/workflows/ci\.yml$|package\.json$|pnpm-lock\.yaml$|\.github/scripts/(playwright-legs|a11y-pr-contracts|lane-environment)\.mjs$|scripts/lib/duration-split\.mjs$|\.github/(playwright-leg-durations|lane-environments)\.json$|\.github/actions/test-scope/|.*\.interaction\.browser\.spec\.ts$|\.github/scripts/(stale-head-hint|merge-base)\.sh$)'+ outside-pull-request: skip+ requires-head-file: playwright.interaction.config.ts+ # Lists the changed files, so the planner adds a changed spec.+ component-audit: 'true'++ - name: Keep the leg planner from the workflow's commit+ if: steps.scope-chromium.outputs.applies == 'true' || steps.scope-webkit.outputs.applies == 'true'+ run: |+ mkdir -p "$RUNNER_TEMP/interaction-legs/.github/scripts" "$RUNNER_TEMP/interaction-legs/scripts/lib"+ cp .test-scope/.github/scripts/playwright-legs.mjs "$RUNNER_TEMP/interaction-legs/.github/scripts/"+ cp .test-scope/scripts/lib/duration-split.mjs "$RUNNER_TEMP/interaction-legs/scripts/lib/"+ cp .test-scope/.github/scripts/a11y-pr-contracts.mjs "$RUNNER_TEMP/interaction-legs/.github/scripts/"+ cp .test-scope/.github/playwright-leg-durations.json "$RUNNER_TEMP/interaction-legs/.github/"+ cp .test-scope/.github/scripts/lane-environment.mjs "$RUNNER_TEMP/interaction-legs/.github/scripts/"+ cp .test-scope/.github/scripts/stale-head-hint.sh "$RUNNER_TEMP/interaction-legs/.github/scripts/"+ cp .test-scope/.github/scripts/merge-base.sh "$RUNNER_TEMP/interaction-legs/.github/scripts/"+ cp .test-scope/.github/lane-environments.json "$RUNNER_TEMP/interaction-legs/.github/"++ - name: Count the Chromium legs+ id: count-chromium+ if: steps.scope-chromium.outputs.applies == 'true'+ continue-on-error: true+ run: |+ git -C .test-scope ls-tree -r --name-only HEAD > "$RUNNER_TEMP/interaction-legs/listed.txt"+ node "$RUNNER_TEMP/interaction-legs/.github/scripts/playwright-legs.mjs" legs \+ --listed "$RUNNER_TEMP/interaction-legs/listed.txt" --source .test-scope \+ --tests-out "$RUNNER_TEMP/interaction-legs/tests.json" \+ --key interaction-chromium --fallback-key interaction-webkit \+ --durations "$RUNNER_TEMP/interaction-legs/.github/playwright-leg-durations.json" \+ --setup-seconds 90 --max-seconds 600 \+ --leg 1 --max-legs 6++ - name: Count the WebKit legs+ id: count-webkit+ if: steps.scope-webkit.outputs.applies == 'true'+ continue-on-error: true+ env:+ CHANGED_FILES: ${{ steps.scope-webkit.outputs.changed_files_path }}+ run: |+ if [ "${WEBKIT_ALL_SPECS:-}" = true ]; then SPEC_PATHS=(packages/ internal/); else read -ra SPEC_PATHS <<< "$WEBKIT_SPEC_PATHS"; fi+ # With every spec planned, the changed files add nothing. Leave them+ # out, so a missing list cannot make each leg run the whole suite.+ CHANGED=(--changed "${CHANGED_FILES:-}")+ if [ "${WEBKIT_ALL_SPECS:-}" = true ]; then CHANGED=(); fi+ git -C .test-scope ls-tree -r --name-only HEAD > "$RUNNER_TEMP/interaction-legs/listed.txt"+ selected="$RUNNER_TEMP/interaction-legs/selected.txt"+ node "$RUNNER_TEMP/interaction-legs/.github/scripts/playwright-legs.mjs" select \+ --listed "$RUNNER_TEMP/interaction-legs/listed.txt" \+ "${CHANGED[@]}" \+ --shared "$WEBKIT_SHARED_PATHS" \+ -- "${SPEC_PATHS[@]}" > "$selected"+ if [ ! -s "$selected" ]; then+ echo "No WebKit interaction proof covers this change: it touches no shared touch code, no interaction spec, and no component folder that holds one."+ printf 'count=0\nruns=false\nleg=%s\n' "1" >> "$GITHUB_OUTPUT"+ exit 0+ fi+ echo "WebKit proofs for this change:"; sed 's/^/ /' "$selected"+ mapfile -t SELECTED < "$selected"+ node "$RUNNER_TEMP/interaction-legs/.github/scripts/playwright-legs.mjs" legs \+ --listed "$RUNNER_TEMP/interaction-legs/listed.txt" --source .test-scope \+ --tests-out "$RUNNER_TEMP/interaction-legs/tests.json" \+ --key interaction-webkit --fallback-key interaction-chromium \+ --durations "$RUNNER_TEMP/interaction-legs/.github/playwright-leg-durations.json" \+ "${CHANGED[@]}" \+ --setup-seconds 90 --max-seconds 600 \+ --leg 1 --max-legs 6 \+ -- "${SELECTED[@]}"++ # The matrix each lane starts: its counted legs, one leg (which skips)+ # outside its scope or with nothing to run, and all six when its count+ # failed, so each leg decides for itself as before.+ - name: Name each lane's legs+ id: matrix+ env:+ CHROMIUM_OUTCOME: ${{ steps.count-chromium.outcome }}+ CHROMIUM_COUNT: ${{ steps.count-chromium.outputs.count }}+ WEBKIT_OUTCOME: ${{ steps.count-webkit.outcome }}+ WEBKIT_COUNT: ${{ steps.count-webkit.outputs.count }}+ run: |+ legs() {+ local outcome="$1" count="$2"+ case "$outcome" in+ success) [ "${count:-0}" -ge 1 ] 2>/dev/null || count=1 ;;+ skipped) count=1 ;;+ *) count=6 ;;+ esac+ [ "$count" -le 6 ] || count=6+ local list=1 leg+ for ((leg = 2; leg <= count; leg++)); do list="$list, $leg"; done+ printf '[%s]' "$list"+ }+ echo "chromium=$(legs "$CHROMIUM_OUTCOME" "$CHROMIUM_COUNT")" >> "$GITHUB_OUTPUT"+ echo "webkit=$(legs "$WEBKIT_OUTCOME" "$WEBKIT_COUNT")" >> "$GITHUB_OUTPUT"+ for lane in "Chromium:$CHROMIUM_OUTCOME" "WebKit:$WEBKIT_OUTCOME"; do+ case "${lane#*:}" in+ success | skipped) ;;+ *) echo "::warning title=Leg count fell back to six::The ${lane%%:*} leg count failed, so its lane starts six legs that each decide for themselves." ;;+ esac+ done+ cat "$GITHUB_OUTPUT"+pr-interaction:name: pr-interaction (${{ matrix.leg }}/${{ strategy.job-total }})- needs: [room, admission, heavy-ci, build-storybook]+ needs: [room, admission, heavy-ci, build-storybook, interaction-legs]if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft && (github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'ci:run'))) && (!cancelled() && needs.heavy-ci.outputs.deferred != 'true' && (github.event_name != 'workflow_dispatch' && always() && !cancelled() && needs.room.outputs.full != 'true' && needs.admission.outputs.full != 'true')) }}# Frame evidence measures timing: four cores, one Playwright worker.# The legs share the spec files by their recorded times# (playwright-legs.mjs), as few legs as keep each leg's setup and proofs# within ten minutes, which leaves a third of the job's fifteen for a slow- # runner or checkout. A leg with no share passes. `test` reads the job's- # result, which is success only when every leg passed.+ # runner or checkout; interaction-legs starts only those legs, at most+ # six. `test` reads the job's result, which is success only when every+ # leg passed.strategy:fail-fast: falsematrix:- leg: [1, 2, 3, 4, 5, 6]+ leg: ${{ fromJSON(needs.interaction-legs.outputs.chromium || '[1, 2, 3, 4, 5, 6]') }}runs-on: ubuntu-latesttimeout-minutes: 15permissions:@@ -2624,7 +2786,13 @@ jobs:--key interaction-chromium --fallback-key interaction-webkit \--durations "$RUNNER_TEMP/interaction-legs/.github/playwright-leg-durations.json" \--setup-seconds 90 --max-seconds 600 \- --leg ${{ matrix.leg }} --max-legs ${{ strategy.job-total }}+ --leg ${{ matrix.leg }} --max-legs 6++ - name: Require a leg for every share+ if: steps.scope.outputs.applies == 'true' && fromJSON(steps.legs.outputs.count || '0') > strategy.job-total+ run: |+ echo "::error::This run's proofs need ${{ steps.legs.outputs.count }} legs, but only ${{ strategy.job-total }} started, so a share would run nowhere. Re-run all jobs."+ exit 1- name: Leave the proofs to the other legsif: steps.scope.outputs.applies == 'true' && steps.legs.outputs.runs != 'true'@@ -2751,16 +2919,16 @@ jobs:# in WebKit.pr-interaction-webkit:name: pr-interaction-webkit (${{ matrix.leg }}/${{ strategy.job-total }})- needs: [room, admission, heavy-ci, build-storybook]+ needs: [room, admission, heavy-ci, build-storybook, interaction-legs]if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft && (github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'ci:run'))) && (!cancelled() && needs.heavy-ci.outputs.deferred != 'true' && (github.event_name != 'workflow_dispatch' && always() && !cancelled() && needs.room.outputs.full != 'true' && needs.admission.outputs.full != 'true')) }}# Frame evidence measures timing: four cores, one Playwright worker.# The leg count plans as many legs as keep each one's setup and proofs- # within ten minutes, as the Chromium proofs' count does. The matrix is- # the ceiling, six legs as for Chromium; a leg with no share passes at once.+ # within ten minutes, as the Chromium proofs' count does, at most six;+ # interaction-legs starts only those legs.strategy:fail-fast: falsematrix:- leg: [1, 2, 3, 4, 5, 6]+ leg: ${{ fromJSON(needs.interaction-legs.outputs.webkit || '[1, 2, 3, 4, 5, 6]') }}runs-on: ubuntu-latesttimeout-minutes: 15# Playwright's own image for the version the lockfile resolves, with@@ -2893,9 +3061,15 @@ jobs:--durations "$RUNNER_TEMP/interaction-legs/.github/playwright-leg-durations.json" \"${CHANGED[@]}" \--setup-seconds 90 --max-seconds 600 \- --leg ${{ matrix.leg }} --max-legs ${{ strategy.job-total }} \+ --leg ${{ matrix.leg }} --max-legs 6 \-- "${SELECTED[@]}"+ - name: Require a leg for every share+ if: steps.scope.outputs.applies == 'true' && fromJSON(steps.legs.outputs.count || '0') > strategy.job-total+ run: |+ echo "::error::This run's proofs need ${{ steps.legs.outputs.count }} legs, but only ${{ strategy.job-total }} started, so a share would run nowhere. Re-run all jobs."+ exit 1+- name: Leave the proofs to the other legsif: steps.scope.outputs.applies == 'true' && steps.legs.outputs.runs != 'true'run: echo "This leg runs no WebKit proofs (${{ steps.legs.outputs.count }} leg(s) planned for this change)."