Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

ci: a failed interaction leg names the newer main commits to its specs or the harness, and asks for an updated branch (#10168)

Cindy Zhangec84130f57b3
diff --git a/.github/scripts/ci-interaction-webkit.test.mjs b/.github/scripts/ci-interaction-webkit.test.mjs
index a74e4f8c46..0a7edc9afb 100644
--- a/.github/scripts/ci-interaction-webkit.test.mjs
+++ b/.github/scripts/ci-interaction-webkit.test.mjs
@@ -109,7 +109,7 @@ describe('WebKit interaction proof routing', () => {
// A leg whose plan holds no spec file runs no proofs.
expect(candidate.if, candidate.name ?? candidate.uses).toMatch(
new RegExp(
- `^(always\\(\\) && )?${gate.replace(/[.()|]/g, '\\$&')}( && steps\\.plan\\.outputs\\.files != '0')?$`,
+ `^((always|failure)\\(\\) && )?${gate.replace(/[.()|]/g, '\\$&')}( && steps\\.plan\\.outputs\\.files != '0')?$`,
),
);
}
diff --git a/.github/scripts/ci-stale-head-hint.test.mjs b/.github/scripts/ci-stale-head-hint.test.mjs
new file mode 100644
index 0000000000..ad6a0bb69c
--- /dev/null
+++ b/.github/scripts/ci-stale-head-hint.test.mjs
@@ -0,0 +1,221 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file ci-stale-head-hint.test.mjs
+ * @description Proves that a failed interaction leg on a head older than main
+ * names each newer main commit that changed a spec the leg ran, or the
+ * harness, and asks for an updated branch.
+ * @input ci.yml's "Explain a failure on an older head" steps, run against a
+ * small local repository.
+ * @output Vitest assertions.
+ * @position .github/scripts tests.
+ */
+
+import {execFileSync, spawnSync} from 'node:child_process';
+import fs from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
+
+import {afterAll, beforeAll, describe, expect, it} from 'vitest';
+import yaml from 'yaml';
+
+const root = path.resolve(import.meta.dirname, '../..');
+const ci = yaml.parse(
+ fs.readFileSync(path.join(root, '.github/workflows/ci.yml'), 'utf8'),
+);
+const NAME = 'Explain a failure on an older head';
+const step = (job, name) => job.steps.find(each => each.name === name);
+const LANES = {
+ 'pr-interaction': {
+ gate: "steps.scope.outputs.applies == 'true' && steps.legs.outputs.runs == 'true'",
+ run: 'Run interaction proofs',
+ },
+ 'pr-interaction-webkit': {
+ gate: "steps.scope.outputs.applies == 'true' && steps.legs.outputs.runs == 'true'",
+ run: 'Run WebKit interaction proofs',
+ },
+};
+
+describe('the stale-head hint in the interaction legs', () => {
+ for (const [id, {gate, run}] of Object.entries(LANES)) {
+ it(`${id} explains a failure after its proofs, without failing the leg further`, () => {
+ const job = ci.jobs[id];
+ const hint = step(job, NAME);
+ expect(hint.if).toBe(
+ `failure() && ${gate} && 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
+ // re-run also sees a fix that landed after the run started.
+ expect(hint.env).toEqual({
+ BASE_REF: '${{ github.event.pull_request.base.ref }}',
+ });
+ // One script for both lanes, copied from the workflow's own commit
+ // with the merge-base helper it calls, and given this leg's own plan.
+ expect(hint.run).toBe(
+ 'bash "$RUNNER_TEMP/interaction-legs/.github/scripts/stale-head-hint.sh" "$BASE_REF" "$RUNNER_TEMP/interaction-leg.txt"',
+ );
+ const keep = step(job, "Keep the leg planner from the workflow's commit");
+ for (const script of ['stale-head-hint.sh', 'merge-base.sh'])
+ expect(keep.run).toContain(
+ `cp .test-scope/.github/scripts/${script} "$RUNNER_TEMP/interaction-legs/.github/scripts/"`,
+ );
+ const scope = new RegExp(
+ job.steps.find(each => each.id === 'scope').with.paths,
+ );
+ expect(scope.test('.github/scripts/stale-head-hint.sh')).toBe(true);
+ expect(scope.test('.github/scripts/merge-base.sh')).toBe(true);
+ const at = job.steps.indexOf(hint);
+ expect(at).toBe(job.steps.indexOf(step(job, run)) + 1);
+ expect(job.steps[at + 1].uses).toMatch(/^actions\/upload-artifact@/);
+ });
+ }
+
+ describe('run against a repository', () => {
+ let dir;
+ const spec =
+ 'packages/core/src/Row/__tests__/Row.interaction.browser.spec.ts';
+ const other =
+ 'packages/core/src/Other/__tests__/Other.interaction.browser.spec.ts';
+ let fixed;
+ let current;
+ let harnessSpecFix;
+ const harnessSpec =
+ 'internal/interaction-harness/src/harness.interaction.browser.spec.ts';
+ let later;
+
+ function git(cwd, ...args) {
+ return execFileSync('git', ['-C', cwd, ...args], {
+ encoding: 'utf8',
+ env: {
+ ...process.env,
+ GIT_AUTHOR_NAME: 't',
+ GIT_AUTHOR_EMAIL: '[email protected]',
+ GIT_COMMITTER_NAME: 't',
+ GIT_COMMITTER_EMAIL: '[email protected]',
+ },
+ }).trim();
+ }
+ function commit(cwd, files, message) {
+ for (const [file, text] of Object.entries(files)) {
+ fs.mkdirSync(path.join(cwd, path.dirname(file)), {recursive: true});
+ fs.writeFileSync(path.join(cwd, file), text);
+ }
+ git(cwd, 'add', '-A');
+ git(cwd, 'commit', '-qm', message, '--no-verify');
+ return git(cwd, 'rev-parse', 'HEAD');
+ }
+
+ beforeAll(() => {
+ dir = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'stale-')));
+ const work = path.join(dir, 'work');
+ fs.mkdirSync(work);
+ git(work, 'init', '-q', '-b', 'main');
+ const start = commit(
+ work,
+ {
+ [spec]: 'v1',
+ [other]: 'v1',
+ 'internal/interaction-harness/src/busy.ts': 'v1',
+ 'README.md': 'v1',
+ },
+ 'start',
+ );
+ // The head branches here and changes nothing main changes later.
+ 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%');
+ commit(work, {'README.md': 'v2'}, 'docs: readme');
+ commit(
+ work,
+ {'internal/interaction-harness/src/busy.test.ts': 'v2'},
+ 'test: a harness unit test',
+ );
+ commit(
+ work,
+ {'internal/interaction-harness/src/busy.lateblock.fixture.ts': 'v2'},
+ 'test: a harness unit-test fixture',
+ );
+ harnessSpecFix = commit(
+ work,
+ {[harnessSpec]: 'v2'},
+ "test(interaction-harness): the harness's own spec",
+ );
+ // The run's merge commit; main then moves on past it.
+ git(work, 'merge', '-q', '--no-ff', '--no-edit', 'topic');
+ later = commit(
+ work,
+ {'internal/interaction-harness/src/busy.ts': 'v3'},
+ 'fix(harness): a later fix',
+ );
+ // A head already on the newest main has nothing to explain.
+ git(work, 'checkout', '-q', '-b', 'current');
+ current = commit(work, {'packages/core/src/Row/Row.tsx': 'y'}, 'current');
+ git(work, 'config', 'uploadpack.allowFilter', 'true');
+ git(work, 'config', 'uploadpack.allowAnySHA1InWant', 'true');
+ fs.writeFileSync(path.join(dir, 'start.txt'), start);
+ fs.writeFileSync(path.join(dir, 'head.txt'), head);
+ });
+
+ afterAll(() => fs.rmSync(dir, {recursive: true, force: true}));
+
+ function explain(headSha, plan) {
+ const checkout = fs.mkdtempSync(path.join(dir, 'checkout-'));
+ git(checkout, 'init', '-q');
+ git(
+ checkout,
+ 'remote',
+ 'add',
+ 'origin',
+ `file://${path.join(dir, 'work')}`,
+ );
+ git(checkout, 'fetch', '-q', '--depth=1', 'origin', headSha);
+ git(checkout, 'checkout', '-q', 'FETCH_HEAD');
+ const temp = fs.mkdtempSync(path.join(dir, 'temp-'));
+ const list = path.join(temp, 'interaction-leg.txt');
+ fs.writeFileSync(list, plan.map(file => `${file}\n`).join(''));
+ return spawnSync(
+ 'bash',
+ [path.join(root, '.github/scripts/stale-head-hint.sh'), 'main', list],
+ {cwd: checkout, encoding: 'utf8'},
+ );
+ }
+
+ it('names the main commit that changed a spec the leg ran, and nothing else', () => {
+ const head = fs.readFileSync(path.join(dir, 'head.txt'), 'utf8');
+ const out = explain(head, [spec, other]);
+ expect(out.status).toBe(0);
+ const warnings = out.stdout
+ .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.
+ 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::${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.`,
+ ]);
+ });
+
+ it('names a harness spec only for a leg whose plan lists it', () => {
+ const head = fs.readFileSync(path.join(dir, 'head.txt'), 'utf8');
+ const out = explain(head, [harnessSpec]);
+ const warnings = out.stdout
+ .split('\n')
+ .filter(line => line.startsWith('::warning'));
+ expect(
+ warnings.map(line => line.split('::')[2].split(' changed')[0]),
+ ).toEqual(['internal/interaction-harness/src/busy.ts', harnessSpec]);
+ expect(warnings[1]).toContain(harnessSpecFix.slice(0, 7));
+ });
+
+ it('says nothing is newer for a head that already has main’s tip', () => {
+ const out = explain(current, [spec, other]);
+ expect(out.status).toBe(0);
+ expect(out.stdout).not.toContain('::warning');
+ expect(out.stdout).toContain(
+ "main has no newer change to this leg's specs or the harness.",
+ );
+ });
+ });
+});
diff --git a/.github/scripts/merge-base.sh b/.github/scripts/merge-base.sh
index 2d41d633b9..4f4c4ce25e 100755
--- a/.github/scripts/merge-base.sh
+++ b/.github/scripts/merge-base.sh
@@ -1,20 +1,36 @@
#!/usr/bin/env bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
-# Prints the pull request's merge base with origin/<base-ref>, deepening the
-# fetched history once when the shallow checkout does not reach it. Prints
+# Prints the pull request's merge base with origin/<base-ref>, fetching the
+# base and HEAD 200 commits deeper each time, up to <deepens> times (once by
+# default), when the shallow checkout does not reach it. Prints
# nothing, with a workflow warning, when it still cannot find one. Shared by
# the CI steps that compare a pull request with its merge base.
#
-# usage: merge-base.sh <base-ref> <what the caller skips without one>
+# usage: merge-base.sh <base-ref> <what the caller skips without one> [deepens]
set -uo pipefail
base_ref="$1"
skipped="$2"
-if ! sha=$(git merge-base "origin/$base_ref" HEAD 2>/dev/null); then
- git fetch --deepen=200 origin "$base_ref:refs/remotes/origin/$base_ref" >/dev/null 2>&1 || true
- if ! sha=$(git merge-base "origin/$base_ref" HEAD 2>/dev/null); then
- echo "::warning::no merge base within the fetched history; skipping $skipped" >&2
+deepens="${3:-1}"
+fetch_error=""
+for ((i = 0; i < deepens; i++)); do
+ if sha=$(git merge-base "origin/$base_ref" HEAD 2>/dev/null); then
+ echo "$sha"
exit 0
fi
+ # Each ref on its own fetch, 200 commits past what it already has: git 2.56
+ # deepened only HEAD when one --deepen fetch named both, and left the base
+ # at one commit.
+ have_base=$(git rev-list --count "origin/$base_ref" 2>/dev/null || echo 0)
+ have_head=$(git rev-list --count HEAD)
+ fetch_error=$(git fetch -q --depth=$((have_base + 200)) origin \
+ "$base_ref:refs/remotes/origin/$base_ref" 2>&1) || true
+ head_error=$(git fetch -q --depth=$((have_head + 200)) origin \
+ "$(git rev-parse HEAD)" 2>&1) ||
+ fetch_error="${fetch_error:+$fetch_error; }$head_error"
+done
+if ! sha=$(git merge-base "origin/$base_ref" HEAD 2>/dev/null); then
+ echo "::warning::no merge base within the fetched history; skipping $skipped${fetch_error:+ (last fetch: ${fetch_error//$'\n'/ })}" >&2
+ exit 0
fi
echo "$sha"
diff --git a/.github/scripts/merge-base.test.mjs b/.github/scripts/merge-base.test.mjs
index 79dcaee68b..efad29edb6 100644
--- a/.github/scripts/merge-base.test.mjs
+++ b/.github/scripts/merge-base.test.mjs
@@ -51,6 +51,60 @@ describe('merge-base.sh', () => {
expect(result.stdout.trim()).toBe(base);
});
+ it('deepens a shallow clone, base and HEAD, up to the times it is given', () => {
+ const {root, git} = repo();
+ git('config', 'uploadpack.allowAnySHA1InWant', 'true');
+ // The head branches here, then main moves 250 commits on.
+ git('checkout', '-q', '-b', 'feature');
+ git('commit', '-q', '--allow-empty', '-m', 'change');
+ const head = git('rev-parse', 'HEAD');
+ git('checkout', '-q', 'main');
+ const base = git('rev-parse', 'HEAD');
+ // 250 empty commits in one fast-import stream, dated after the base as
+ // real history is: git's merge base search trusts commit dates.
+ const now = Math.floor(Date.now() / 1000) + 60;
+ let stream = '';
+ for (let i = 1; i <= 250; i++) {
+ const message = `main ${i}`;
+ stream += `commit refs/heads/main\ncommitter t <t@t> ${now + i} +0000\ndata ${message.length}\n${message}\n${i === 1 ? `from ${base}\n` : ''}\n`;
+ }
+ execFileSync('git', ['fast-import', '--quiet'], {cwd: root, input: stream});
+ git('reset', '-q', '--hard', 'main');
+ // A shallow clone of the head and main, as CI's checkout is.
+ function shallowClone() {
+ const clone = fs.mkdtempSync(path.join(os.tmpdir(), 'merge-base-clone-'));
+ roots.push(clone);
+ const cg = (...args) =>
+ execFileSync('git', args, {cwd: clone, encoding: 'utf8'}).trim();
+ cg('init', '-q');
+ cg('remote', 'add', 'origin', `file://${root}`);
+ cg(
+ 'fetch',
+ '-q',
+ '--depth=1',
+ 'origin',
+ head,
+ 'main:refs/remotes/origin/main',
+ );
+ cg('checkout', '-q', head);
+ return {clone, cg};
+ }
+ const one = shallowClone();
+ const once = spawnSync('bash', [SCRIPT, 'main', 'the check'], {
+ cwd: one.clone,
+ encoding: 'utf8',
+ });
+ expect(once.stdout).toBe('');
+ expect(once.stderr).toContain('no merge base within the fetched history');
+ const three = shallowClone();
+ const thrice = spawnSync('bash', [SCRIPT, 'main', 'the check', '3'], {
+ cwd: three.clone,
+ encoding: 'utf8',
+ });
+ const fetched = `${thrice.stderr} (origin/main: ${three.cg('rev-list', '--count', 'origin/main')} commits; HEAD: ${three.cg('rev-list', '--count', 'HEAD')})`;
+ expect(thrice.stdout.trim(), fetched).toBe(base);
+ });
+
it('prints nothing and warns when there is no merge base', () => {
const {root} = repo();
const result = spawnSync(
diff --git a/.github/scripts/stale-head-hint.sh b/.github/scripts/stale-head-hint.sh
new file mode 100755
index 0000000000..663146a35c
--- /dev/null
+++ b/.github/scripts/stale-head-hint.sh
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+#
+# Explains a failed interaction leg on a head older than the base branch: it
+# names each base-branch commit since the merge base that changed a spec the
+# leg ran, the harness's sources or the interaction config, which the head
+# does not have. The base is the branch's tip now, not the run's merge
+# commit, so a re-run also sees a fix that landed after the run started.
+# Prints workflow warnings, or one line saying there is nothing newer.
+#
+# usage: stale-head-hint.sh <base-ref> <the leg's planned spec list>
+set -uo pipefail
+base_ref="$1"
+plan="$2"
+here="$(cd "$(dirname "$0")" && pwd)"
+
+git fetch -q --no-tags --filter=blob:none --depth=50 origin \
+ "$base_ref:refs/remotes/origin/$base_ref" "$(git rev-parse HEAD)" || true
+mb=$(bash "$here/merge-base.sh" "$base_ref" 'the stale-head hint' 10)
+if [ -z "$mb" ]; then
+ exit 0
+fi
+mapfile -t specs < "$plan"
+# A path counts when this leg's plan lists it, when it is the interaction
+# config, or when it is a harness source: not a unit test, a fixture, a doc or
+# a harness spec the plan does not list.
+newer=$(git log --format='commit %h %s' --name-only "$mb..origin/$base_ref" -- \
+ "${specs[@]}" internal/interaction-harness/src/ playwright.interaction.config.ts |
+ awk -v plan="$plan" '
+ BEGIN { while ((getline line < plan) > 0) if (line != "") planned[line] = 1 }
+ /^commit / { print; next }
+ $0 == "" { next }
+ planned[$0] || $0 == "playwright.interaction.config.ts" { print; next }
+ /^internal\/interaction-harness\/src\// && !/\.test\.ts$/ && !/\.fixture\.ts$/ && !/\.md$/ && !/\.browser\.spec\.ts$/ { print }
+ ')
+if ! awk '/^commit /{c=1;next} c&&NF{f=1} END{exit !f}' <<< "$newer"; then
+ echo "$base_ref has no newer change to this leg's specs or the harness."
+ exit 0
+fi
+awk -v base="$base_ref" '
+ /^commit / { sha = $2; $1 = ""; $2 = ""; subject = substr($0, 3); 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, base
+ shown++
+ }
+' <<< "$newer"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a931e0fbec..a9f010d8c3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -2508,7 +2508,7 @@ jobs:
id: scope
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$|scripts/lib/duration-split\.mjs$|\.github/(playwright-leg-durations|lane-environments)\.json$|\.github/actions/test-scope/|.*\.interaction\.browser\.spec\.ts$)'
+ 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
@@ -2535,6 +2535,8 @@ jobs:
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/"
# The legs this run needs: every spec file in the merge commit, which the
@@ -2642,6 +2644,17 @@ jobs:
--project chromium \
--output interaction-proof-output
+ # 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.
+ - 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'
+ continue-on-error: true
+ env:
+ BASE_REF: ${{ github.event.pull_request.base.ref }}
+ run: bash "$RUNNER_TEMP/interaction-legs/.github/scripts/stale-head-hint.sh" "$BASE_REF" "$RUNNER_TEMP/interaction-leg.txt"
+
# Storyboards (PNG contact sheets) and curve traces, for review.
- name: Upload interaction evidence
if: always() && steps.scope.outputs.applies == 'true' && steps.legs.outputs.runs == 'true'
@@ -2724,7 +2737,7 @@ jobs:
id: scope
uses: ./.test-scope/.github/actions/test-scope
with:
- 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$|scripts/lib/duration-split\.mjs$|\.github/(playwright-leg-durations|lane-environments)\.json$|\.github/actions/test-scope/|.*\.interaction\.browser\.spec\.ts$)'
+ 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$)'
outside-pull-request: skip
requires-head-file: playwright.interaction.config.ts
# Lists the changed files, so the planner adds a changed spec.
@@ -2753,6 +2766,8 @@ jobs:
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/"
# One leg runs every proof while its setup and the recorded times fit
@@ -2910,6 +2925,17 @@ jobs:
--project webkit \
--output interaction-proof-output-webkit
+ # 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.
+ - 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'
+ continue-on-error: true
+ env:
+ BASE_REF: ${{ github.event.pull_request.base.ref }}
+ run: bash "$RUNNER_TEMP/interaction-legs/.github/scripts/stale-head-hint.sh" "$BASE_REF" "$RUNNER_TEMP/interaction-leg.txt"
+
- name: Upload WebKit interaction evidence
if: always() && steps.scope.outputs.applies == 'true' && steps.legs.outputs.runs == 'true'
uses: actions/upload-artifact@v7