Skip to content

ci: run only changed E2E specs on pull requests - #11834

Merged
nwparker merged 1 commit into
mainfrom
nwparker/e2e-tests-triggers
Jul 31, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/e2e-tests-triggers

Conversation

@nwparker

Copy link
Copy Markdown
Contributor

Summary

  • run only modified tests/e2e/**/*.spec.ts files on PRs, using one runner
  • reserve the full 10-shard suite and SSH Docker E2E for scheduled, release, and manual runs
  • remove PR triggers from dedicated golden, Wayland, IME, Windows crash-survival, and Windows restart E2E workflows
  • keep computer-use native/unit PR smoke coverage but remove its PR desktop E2E steps

Validation

  • pnpm exec vitest run --config config/vitest.config.ts config/scripts/pr-e2e-gate-contract.test.mjs config/scripts/computer-e2e-workflow.test.mjs config/scripts/terminal-ime-e2e-workflow.test.mjs config/scripts/win-crash-survival-e2e.test.mjs config/scripts/package-electron-runtime-contract.test.mjs config/scripts/release-e2e-dispatch-contract.test.mjs
  • all workflow YAML parsed locally
  • changed-file Playwright selection verified against PR fix: preserve live agent PTYs through graph hydration #11789 (1 file, 1 test)

@nwparker
nwparker merged commit 676964b into main Jul 31, 2026
6 of 47 checks passed
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dfc11840-1ca4-4e9b-8e97-c6784c311a11

📥 Commits

Reviewing files that changed from the base of the PR and between f56e6ad and debf722.

📒 Files selected for processing (13)
  • .github/workflows/computer-e2e.yml
  • .github/workflows/e2e.yml
  • .github/workflows/golden-e2e-experiment.yml
  • .github/workflows/linux-wayland-gpu-sandbox.yml
  • .github/workflows/pr.yml
  • .github/workflows/terminal-ime-e2e.yml
  • .github/workflows/win-crash-survival-e2e.yml
  • .github/workflows/windows-terminal-restart-e2e.yml
  • config/scripts/computer-e2e-workflow.test.mjs
  • config/scripts/package-electron-runtime-contract.test.mjs
  • config/scripts/pr-e2e-gate-contract.test.mjs
  • config/scripts/terminal-ime-e2e-workflow.test.mjs
  • config/scripts/win-crash-survival-e2e.test.mjs

📝 Walkthrough

Walkthrough

The pull-request workflow now detects changed tests/e2e/*.spec.ts files and passes them to a reusable E2E workflow. Changed specifications run serially, while full runs retain sharding. Computer E2E tests no longer run in PR native smoke jobs. Several dedicated E2E workflows now run only on schedules or manual dispatch. Workflow contract tests were updated to verify these trigger and execution rules.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 31, 2026

Copy link
Copy Markdown

Greptile Summary

This PR restructures PR CI to run only the changed tests/e2e/**/*.spec.ts files on a single runner, replacing the previous full 10-shard E2E suite triggered by broad path filters. Dedicated specialty E2E workflows (golden, Wayland, IME, Windows crash-survival, Windows restart) lose their pull_request triggers entirely and become schedule/dispatch-only.

  • The new changed-e2e job in e2e.yml receives a JSON array of changed spec files via test_files input, expands it with mapfile/jq, and runs pnpm run test:e2e \"${TEST_FILES[@]}\" --workers=1; the full 10-shard job and the SSH-Docker isolation job are gated to run only when test_files == '' (i.e., scheduled/release runs).
  • The e2e-paths detector in pr.yml now narrows detection from any tests/e2e/ or tests/playwright.* change to only files matching ^tests/e2e/.*\\.spec\\.ts$ with --diff-filter=AMCR, and propagates the spec list as a JSON output instead of just a boolean.
  • Contract tests are updated to assert the new split (changed-e2e vs full shards), the removal of PR triggers from dedicated workflows, and the absence of computer-use E2E desktop steps from the PR native-smoke job.

Confidence Score: 4/5

Safe to merge — the CI restructuring is well-contained and the new contract tests lock in the intended behavior.

The changes are CI-only with no production code impact. The changed-e2e job correctly receives and expands the spec list, the full 10-shard suite and SSH-Docker job are properly gated behind test_files == '', and the if: should_run == 'true' guard in pr.yml ensures the workflow is never invoked with an empty spec list from the PR path. Two tradeoffs are worth noting: a latent empty-JSON-array case in changed-e2e that cannot currently be triggered but could affect future callers, and the deliberate drop in helper/config change detection on PRs. Both are acknowledged by the design and tested via contract tests.

Files Needing Attention: .github/workflows/e2e.yml — the changed-e2e job's mapfile expansion has a latent empty-array case. .github/workflows/pr.yml — the narrowed spec-only filter is the intentional coverage tradeoff to be aware of going forward.

Important Files Changed

Filename Overview
.github/workflows/pr.yml Narrows E2E detection to only *.spec.ts files and propagates a JSON file list to e2e.yml; the if: should_run == 'true' guard on the e2e job is preserved, so the workflow is never called with an empty spec list.
.github/workflows/e2e.yml Adds test_files workflow_call input; full 10-shard e2e job and ssh-docker-watcher-isolation are gated to test_files == ''; new changed-e2e job expands the JSON spec list with mapfile/jq and runs a single-worker Playwright pass.
.github/workflows/golden-e2e-experiment.yml PR trigger and the associated merge-ref checkout comment removed; now only runnable via workflow_dispatch.
.github/workflows/linux-wayland-gpu-sandbox.yml PR trigger, base-checkout repro step, and 'Require base reproduction' gate removed; only the positive workaround verification step remains, now only runnable on demand.
.github/workflows/terminal-ime-e2e.yml PR trigger and its long path list removed; workflow now only runs on schedule (daily 09:30) and workflow_dispatch.
.github/workflows/win-crash-survival-e2e.yml PR trigger and extensive path filter list removed; workflow_dispatch is the only remaining trigger for this expensive Windows packaging+crash proof.
.github/workflows/windows-terminal-restart-e2e.yml PR trigger and path list removed; workflow_dispatch-only now.
.github/workflows/computer-e2e.yml Desktop E2E steps (pnpm test:e2e:computer) removed from the PR native-smoke job; native unit/smoke steps remain, so coverage is not fully zeroed for computer-use on PRs.
config/scripts/pr-e2e-gate-contract.test.mjs Contract tests updated to assert new split (changed-e2e vs full shards), test_files propagation, --diff-filter=AMCR, and absence of PR triggers from dedicated workflows.
config/scripts/computer-e2e-workflow.test.mjs Updated to verify that desktop E2E steps are absent from PR native-smoke jobs and present only in scheduled jobs.
config/scripts/package-electron-runtime-contract.test.mjs Updated to assert pull_request is undefined on the golden workflow and workflow_dispatch is defined, replacing the old path-list assertions.
config/scripts/terminal-ime-e2e-workflow.test.mjs Updated to assert no PR trigger and that the only active triggers are schedule and workflow_dispatch.
config/scripts/win-crash-survival-e2e.test.mjs Updated to assert no PR trigger and the presence of workflow_dispatch; path-list assertions removed.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    PR[pull_request event] --> EPaths[e2e-paths\ndetect changed e2e specs]
    EPaths -->|should_run == false| Skip[e2e job skipped]
    EPaths -->|should_run == true\ntest_files = JSON array| E2EJob[e2e job in pr.yml]
    E2EJob -->|calls e2e.yml with test_files| E2EWorkflow[e2e.yml workflow_call]
    E2EWorkflow -->|test_files != empty| ChangedE2E[changed-e2e\nsingle runner\npnpm test:e2e files --workers=1]
    E2EWorkflow -->|test_files == empty| FullSuite[e2e 10 shards]
    E2EWorkflow -->|test_files == empty| SSHDocker[ssh-docker-watcher-isolation]
    Schedule[schedule or workflow_dispatch] --> E2EWorkflow
    Schedule --> Golden[golden-e2e-experiment\nno PR trigger]
    Schedule --> Wayland[linux-wayland-gpu-sandbox\nno PR trigger]
    Schedule --> IME[terminal-ime-e2e\nno PR trigger]
    Schedule --> WinCrash[win-crash-survival-e2e\nno PR trigger]
    Schedule --> WinRestart[windows-terminal-restart-e2e\nno PR trigger]
Loading

Reviews (1): Last reviewed commit: "ci: run only changed e2e specs on pull r..." | Re-trigger Greptile

Comment thread .github/workflows/e2e.yml
Comment on lines +194 to +237
if: inputs.test_files != ''
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ inputs.ref || github.ref }}

- name: Install native build and headless UI tools
run: sudo apt-get update && sudo apt-get install -y build-essential python3 xvfb

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: package.json

- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
run_install: false

- name: Use external node-gyp to avoid pnpm's bundled copy
run: |
npm install -g [email protected]
echo "npm_config_node_gyp=$(npm root -g)/node-gyp/bin/node-gyp.js" >> "$GITHUB_ENV"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Download E2E build output
uses: actions/download-artifact@v8
with:
name: e2e-build-out
path: out/

- name: Run changed E2E specs
env:
TEST_FILES_JSON: ${{ inputs.test_files }}
run: |
mapfile -t TEST_FILES < <(jq -r '.[]' <<<"$TEST_FILES_JSON")
xvfb-run --auto-servernum env SKIP_BUILD=1 ORCA_E2E_FORWARD_APP_LOGS=1 \
pnpm run test:e2e "${TEST_FILES[@]}" --workers=1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Empty JSON array bypasses the empty-string guard

The changed-e2e job activates when inputs.test_files != ''. An empty JSON array '[]' satisfies that condition, but jq -r '.[]' <<< '[]' emits no output, so mapfile populates TEST_FILES as an empty bash array. The command then expands to pnpm run test:e2e --workers=1 with no file arguments — which could run the entire suite on a single worker (or error, depending on how Playwright handles zero positional spec arguments).

This can't currently occur from pr.yml — the e2e job is gated by should_run == 'true', which only fires when TEST_FILES_JSON != '[]', and test_files is not exposed as a workflow_dispatch input. The risk is latent: any future workflow_call consumer that passes '[]' would hit this path silently. A guard like if [ "${#TEST_FILES[@]}" -eq 0 ]; then echo "No specs to run"; exit 0; fi after the mapfile line would close the gap without affecting the happy path.

Comment thread .github/workflows/pr.yml
Comment on lines +347 to 363
- name: Filter changed E2E specs
id: filter
run: |
set -euo pipefail
BASE="${{ github.event.pull_request.base.sha }}"
HEAD="${{ github.event.pull_request.head.sha }}"
# Why: capture first so a failed git diff does not look like "no matches"
# (pipeline status in `if` is not aborted by set -e). Merge-base limits the
# list to files this PR introduced, not base-branch drift.
CHANGED="$(git diff --name-only --merge-base "$BASE" "$HEAD")"
# Why: tests/playwright.config.ts sits beside tests/e2e/, not inside it, so
# it needs its own pattern — a bare `playwright.` prefix matches no tracked
# file and would silently skip E2E when the runner config changes.
if printf '%s\n' "$CHANGED" | grep -E '^(tests/e2e/|tests/playwright\.|\.github/workflows/e2e\.yml$)' >/dev/null; then
CHANGED="$(git diff --name-only --diff-filter=AMCR --merge-base "$BASE" "$HEAD")"
TEST_FILES="$(printf '%s\n' "$CHANGED" | grep -E '^tests/e2e/.*\.spec\.ts$' || true)"
TEST_FILES_JSON="$(printf '%s\n' "$TEST_FILES" | jq --raw-input --slurp --compact-output 'split("\n") | map(select(length > 0))')"
echo "test_files=$TEST_FILES_JSON" >> "$GITHUB_OUTPUT"
if [ "$TEST_FILES_JSON" != '[]' ]; then
echo "should_run=true" >> "$GITHUB_OUTPUT"
echo "E2E path changes detected"
echo "Changed E2E specs: $TEST_FILES_JSON"
else
echo "should_run=false" >> "$GITHUB_OUTPUT"
echo "No E2E path changes"
echo "No changed E2E specs"
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 E2E helper, config, and shared-fixture changes are now invisible to PR CI

The previous filter matched any file under tests/e2e/ or tests/playwright.*, so changes to shared helpers, global-setup.ts, global-teardown.ts, and tests/playwright.config.ts triggered a full shard run. The new regex ^tests/e2e/.*\.spec\.ts$ is spec-files-only, meaning a breaking change to tests/e2e/helpers/, Playwright config options, or the global setup/teardown will pass PR CI with no E2E validation at all. Failures would only surface on the next scheduled run. This tradeoff is consistent with the stated "PR E2E is advisory" policy and the existing comment that the suite is currently red on main, but it's worth keeping in mind that infrastructure-level regressions in the test harness itself won't be caught until a nightly run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant