Skip to content

Fixes 34944: faster Playwright pipeline (plan alongside build, narrower fixture key, node_modules cache) - #34946

Closed
ayush-shah wants to merge 5 commits into
mainfrom
ayush-shah/ci-faster-browser-tests
Closed

ayush-shah wants to merge 5 commits into
mainfrom
ayush-shah/ci-faster-browser-tests

Conversation

@ayush-shah

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #34944

Shortens the Playwright critical path and removes repeated setup without changing which tests run. Measured: ~26 min passes before any playwright-ci shard starts (build 0.6→6.7, plan 6.8→9.3, fixture restore 9.4→10.0, prepare 10.0→25.9, medians), and the fixture cache hits only ~35% of the time.

Type of change:

  • Improvement

High-level design:

One commit per change:

  1. Plan in parallel with the build. plan-playwright now needs only detect-changes. It uses only the checkout, the playwright-selection artifact and detect-changes outputs; prepare and the shards still need build. This saves ~3 min of critical path on a fixture-cache hit.
  2. Narrower ingestion-image fingerprint (playwright_cache_fingerprint.py). The key now follows what ingestion/Dockerfile.ci actually copies (spec JSON schemas, ANTLR grammars, ingestion/ sources). The new file set is a strict subset of the old one. A test fails if any Dockerfile COPY source is not fingerprinted. Replaying 1,601 main commits, invalidation drops from 23.8% to 20.3%; the rest are real ingestion/src changes. Populate and readers compute the key in the same reusable job.
  3. node_modules cache for shards. populate-playwright-caches.yml (main only, the existing single writer) saves node_modules, keyed on OS/arch/Node/yarn.lock. Shards restore it read-only and check it with yarn check --integrity; a miss or mismatch falls back to the normal install. Expected ~30–40 s per shard.
  4. Opt-in golden-fixture path for the visual suite. playwright-visual.yml gets a workflow_dispatch input setup_mode (default full-docker, so PR and queue runs are unchanged). postgres-fixture restores the golden fixture and starts the fast environment (~21 → ~7.5 min of setup). It is opt-in because the baselines were captured on the MySQL seed and may need re-capturing; one dispatch run will tell.
  5. One knowledge-graph run per PR event. playwright-knowledge-graph-postgresql-e2e.yml drops pull_request_target + labeled and the fork-label plumbing, following ci: Python integration tests and Playwright E2E only in the merge queue #34740. Fork PRs are covered by the merge queue, as with the Postgres E2E workflow.

Not done, follow-ups:

  • A prebuilt shard image (GHCR) would remove the rest of the per-shard install, but needs package-write permission.
  • Shard bundle-smoke is kept: it takes 8 s, and on a fixture-cache hit it is the only boot check of the new bundle.

Tests:

Use cases covered

  • Queue/nightly Playwright run: same plan and shards, plan overlaps build.
  • Ingestion change outside the Docker image inputs (e.g. ingestion/tests/**) no longer invalidates the fixture.
  • Shard with a node_modules cache hit skips yarn install; a corrupted or mismatched cache reinstalls.
  • Visual suite unchanged unless dispatched with setup_mode=postgres-fixture.

Unit tests

  • Updated/added: test_playwright_cache_assets.py (fingerprint classification, Dockerfile COPY coverage, plan dependencies) and test_playwright_merge_group_validation.py.
  • .github/scripts suite: only pre-existing failures remain; test_retry_policy_is_one_everywhere_during_the_flake_week fails identically on origin/main.
  • actionlint: no new findings (the 9 existing jobs.X.result warnings in the reusable workflow are unchanged). shellcheck clean on changed scripts.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (CI wiring only). playwright.config.ts has a one-line change: visual-regression uses entityDependencies, which is identical unless preseeded.

Manual testing performed

Static validation only. The visual fixture path needs one workflow_dispatch run with setup_mode=postgres-fixture before flipping the default.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • I have added tests around the new logic.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Oct 8, 2026
plan-playwright waited for `build` although it consumes nothing the build
produces: it reads the checkout, the playwright-selection artifact uploaded
by detect-changes and detect-changes' outputs. The distribution artifact is
downloaded only by prepare-playwright-fixture and the shards, and both still
declare `build` in their own `needs`.

Medians over Sep 25 - Oct 8 put build at 0.6 -> 6.7 min and plan at
6.8 -> 9.3 min, with restore-playwright-fixture (needs plan) at 9.4 -> 10.0.
Running plan and the restore alongside the build takes both off the critical
path, so on a fixture-cache hit the shards can start ~3 min earlier; on a
miss prepare-playwright-fixture still starts as soon as the build finishes.

A test pins the planner to detect-changes and checks that every consumer of
the distribution still waits for the build.
The ingestion-image key hashed all of openmetadata-spec/ and ingestion/, so
Java model edits, search mappings, type stubs, lint baselines and the
operator Dockerfiles each discarded a ~1.3 GB image whose bytes they never
touch. The key now follows ingestion/Dockerfile.ci: of openmetadata-spec it
reads only the JSON schemas (datamodel_generation.py) and ANTLR grammars,
and it drops COPY'd-but-unused paths (tests, docs, stubs, operators/, the
non-CI Dockerfile, Makefile/nox/lint configs, airflow-apis tests and
development/). Root pom.xml and the server Dockerfile were never build
inputs. ingestion/scripts/ stays because the Dockerfile runs a script from
it, and markdown under ingestion/src stays because package data ships it.

Replaying 1601 first-parent main commits (Aug 8 - Oct 8 2026), the share
that invalidates the image falls from 23.8% to 20.3%; what remains changes
ingestion/src, which the image installs. The new selection is a strict
subset of the old one, and populate-playwright-caches.yml computes its key
through the same reusable cache-keys job, so writer and readers stay
identical.

Tests pin both directions: every real build input still changes the key,
every excluded path does not, and every COPY source in Dockerfile.ci must be
fingerprinted.
Every playwright-ci shard restored the ~700 MB yarn package cache and ran
yarn install: 25 s + 30 s median across the 52 shards of two merge-queue
runs on Oct 8 2026, the largest per-shard setup cost after the environment
itself. With `--ignore-scripts`, node_modules is a pure function of
yarn.lock, the Node ABI and the runner platform (the one `link:` dependency
is a symlink into the checkout), so it can be cached as a tree.

populate-playwright-caches.yml, already the single main-scoped writer, now
saves node_modules right after its yarn warm succeeds, keyed on OS, arch,
the resolved Node version and the yarn.lock hash. Shards restore it
read-only; the yarn package cache restore runs only on a miss. The install
step still runs on a hit and executes `yarn check --integrity
--ignore-scripts`, which compares .yarn-integrity with yarn.lock, the flags
and the Node ABI offline; on any mismatch it falls through to the normal
retrying install, so a stale or foreign tree can never be used.

The other per-shard steps were checked and left alone: the browser cache
and the apt-deps cache already hit (1 s + 4 s + 5 s medians), and the 8 s
bundle-smoke is not a duplicate. On a fixture-cache hit the fixture job
skips its own bundle-smoke, so the shard's run is the only check that this
run's freshly built bundle boots against the restored environment.
playwright-visual takes ~25 min per run, ~21 of it in the full
run_local_docker MySQL build-and-seed, for ~2 min of screenshot tests. The
E2E shards boot the same server in ~1.5 min (median) from a distribution
plus the golden PostgreSQL fixture that populate-playwright-caches.yml keeps
warm on main.

This adds that path behind a workflow_dispatch input, `setup_mode`, whose
default `full-docker` keeps every pull_request and merge_group run on the
existing MySQL bootstrap. `postgres-fixture` restores the golden fixture
(restore-only, the same key the reusable pipeline reads), builds the
distribution, and starts it in fast mode; a cache miss or failed validation
falls back to the full-docker setup. The suite then runs with
PW_PRESEEDED_STATE and the fixture's runtime directory mounted into the
Playwright container, since the seeded auth/entity state is symlinked from
there.

It is opt-in because the baselines were captured against the MySQL seed and
could not be re-validated here: the fixture's data differs, and any page
that renders seeded data may need its snapshot re-captured. Once a dispatch
run passes, flipping the default (or the PR/queue condition) saves roughly
13 min per run: ~21 min of setup becomes the ~6 min distribution build
plus ~1.5 min fast start.

The visual-regression project's dependencies now use entityDependencies,
which is ['setup', 'entity-data-setup'] unless PW_PRESEEDED_STATE is true,
so the default path runs exactly the same projects as before.
playwright-knowledge-graph-postgresql-e2e.yml triggered on both
pull_request and pull_request_target, each including `labeled`, so every
PR event started two workflow runs: one did the work and the other only ran
its gate to decide it should skip. Labelling a PR started two more.

Following #34740, which made the same move for playwright-postgresql-e2e:
drop pull_request_target and the `labeled` type. Same-repo PRs still run the
suite under pull_request. Fork PRs cannot read the connector secrets there,
so the gate skips them and the merge queue (which always runs the suite)
is where fork code is tested, matching the Postgres E2E workflow. The fork
label-reconciliation steps, the head-SHA checkout override and the
pull_request_target cache-poisoning guards go with the trigger.

With no sibling run, an early green skip can no longer satisfy branch
protection before the real run finishes, so the summary always publishes
the required `Playwright RDF (Knowledge Graph + Ontology)` name; a skipped
gate (draft or fork PR) reports it green and a gate failure still fails it.
cancel-in-progress is now unconditional, since the label special cases no
longer exist.

A test pins the trigger set, the summary name and the gate decision.
@ayush-shah
ayush-shah force-pushed the ayush-shah/ci-faster-browser-tests branch from f5036fd to 8155096 Compare October 12, 2026 04:55
@gitar-bot

gitar-bot Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Narrowing ingestion cache fingerprints and moving fork checks to merge queues could reuse stale images or delay knowledge-graph coverage.

Optimizes the Playwright CI pipeline by planning shards in parallel with the build, narrowing the ingestion-image fingerprint to only Dockerfile inputs, caching node_modules across shards, adding an opt-in golden-fixture path for the visual suite, and consolidating knowledge-graph runs to one per PR event. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

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

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: cut runner time and merge-queue churn without removing test coverage

1 participant