Skip to content

ci: shard e2e, gate it, run in the merge queue and never cancel main - #141

Merged
8 commits merged into
mainfrom
ci/sharded-e2e-merge-queue
Nov 22, 2026
Merged

8 commits merged into
mainfrom
ci/sharded-e2e-merge-queue

Conversation

@HMarzban

@HMarzban HMarzban commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

PR 2 of the CI split. Draft: held for the Bun CI review plan. PR 1 (no-cancel on main and merge_group) is #143. That part is repeated here until #143 lands; this branch will then merge origin/main.

  • main runs are never cancelled. cancel-in-progress is now ${{ github.event_name == 'pull_request' }}. Runs on main queue in commit order, and each one finishes and can deploy. Before this change a merge cancelled the previous commit's run, so 29f6faf and e64ae84 never deployed. GitHub keeps one waiting run per group, so a third push while one is running drops the middle waiting run. The newest commit still deploys and includes it. The concurrency group stays per ref, not per SHA, so an older commit can never deploy after a newer one.
  • Merge queue support. CI runs on merge_group. The owner turns the queue on once; the steps are in docs/operations/deploy-runbook.md → CI checks and the merge queue. Queue runs never deploy: their event is merge_group on a gh-readonly-queue/... branch, and Deploy acts only on push runs on main.
  • Sharded e2e. The chromium project runs as Playwright shard 1/3, 2/3 and 3/3, each with --retries=1 and fail-fast: false. perf runs in its own job, Playwright perf (typing budget), on its own runner, using --no-deps and one worker.
  • The required check keeps its name. Playwright (Chromium) is now an always-run gate job that needs every shard and perf. It merges their blob reports (github and html reporters), so a failure is annotated at its file and line and the HTML report is uploaded. It passes only if every shard and perf passed.
  • Path gating. A Changed files job lists the PR's paths. If every path is under docs/ or is a *.md file, and none is under desktop/, the shards and perf are skipped and the gate passes with a notice. Pushes, the merge queue and manual runs always run everything.
  • No merge=union. It was tried here and dropped (chore: merge CHANGELOG.md with the union driver #145): GitHub's merge check ignores merge drivers, and a local union merge silently keeps both versions of a line that both sides edited.
  • Tests: tests/unit/ci/ci-workflow.test.ts pins this shape. It checks both required names on exactly one job each, the shards, --no-deps, the gate's if: always() and needs, and runs the real Decide and Verdict scripts against a table of cases. workflow-permissions.test.ts now also requires explicit read-only permissions on every job of a pull_request or merge_group workflow.

Required checks (unchanged names)

  • Lint, typecheck, unit tests, build
  • Playwright (Chromium)

Do not require the shard, perf or Changed files jobs.

Timing

Wall time
Before: last five green main runs (ed2a7cd, 08b7663, 1ed981e, f9cfc3a, 6841489) 19.7, 28.1, 26.7, 31.6, 25.7 min, median 26.7 min
After: workflow_dispatch run 44999283346 7.5 min

Per job in the after run:

Job Time Tests
Changed files 2 s
Lint, typecheck, unit tests, build 2m50s
Playwright perf (typing budget) 4m58s 4 tests
Playwright shard 1/3 6m22s 183 passed
Playwright shard 2/3 6m21s 175 passed
Playwright shard 3/3 5m51s 176 passed
Playwright (Chromium) gate 12 s, after about 46 s waiting for a runner merged 4 blob reports: 538 passed, 22 skipped, same as before

The critical path is now the slowest shard. Each shard spends about 1 min on setup: install, Chromium, make dev and warm-up. A 4th shard would save about 1.5 min but cost another runner.

Docs-only skip, shown on throwaway #142 (CHANGELOG.md only, now closed):

  • Changed files passed;
  • the three shards and perf were skipped;
  • Playwright (Chromium) passed.

Cosmetic: a skipped matrix job shows its unexpanded name (Playwright shard ${{ matrix.shard }}/3). It is not a required check.

Owner steps (once, after merge)

See the runbook section. In short: in ruleset Protect main, add Require merge queue with these settings:

  • merge commit;
  • build concurrency 3, merge 1–5 PRs at a time, 5 min wait;
  • all green, 60 min timeout.

Keep the two required checks as they are. A gh api one-liner is in the runbook.

Test plan

  • workflow_dispatch run on this branch: 3 shards, perf and the gate all pass, in 7.5 min.
  • This draft PR's run: the same.
  • Throwaway docs-only draft PR test: throwaway docs-only PR (do not merge) #142: the shards and perf were skipped and Playwright (Chromium) passed.
  • bun test tests/unit/ci passes (81 tests).

🤖 Generated with Claude Code

- The chromium project runs in three shards and perf on its own runner
  (--no-deps, one worker); "Playwright (Chromium)" now always runs, merges
  the blob reports and passes only if every shard and perf passed.
- Pull requests that change only docs/** or Markdown (not desktop/**) skip
  the browser suites; the gate still reports them as passing.
- A merge_group trigger lets the main ruleset require the merge queue.
- Only pull request runs are cancelled by a newer push, so a started run
  on main always finishes and can deploy.
Parallel pull requests each add an Unreleased entry; merging origin/main
into a branch now keeps both instead of conflicting.
GitHub's merge check ignores merge drivers, and a local union merge keeps
both versions of a line edited on both sides without a conflict, so a
visible conflict is safer.
…queue

# Conflicts:
#	.github/workflows/ci.yml
#	AGENTS.md
#	CHANGELOG.md
#	docs/operations/deploy-runbook.md
#	tests/TESTING.md
#	tests/unit/ci/ci-workflow.test.ts
@HMarzban
HMarzban marked this pull request as ready for review November 22, 2026 08:52
@HMarzban
HMarzban enabled auto-merge November 22, 2026 10:20
@HMarzban
HMarzban added this pull request to the merge queue Nov 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 22, 2026
@github-merge-queue github-merge-queue Bot closed this pull request by merging all changes into main in 8232f90 Nov 22, 2026
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