Skip to content

ci: stop merge_group runs from writing caches under ephemeral queue refs - #33085

Merged
harshach merged 1 commit into
mainfrom
ci-gate-ephemeral-cache-writers
Sep 9, 2026
Merged

harshach merged 1 commit into
mainfrom
ci-gate-ephemeral-cache-writers

Conversation

@chirag-madlani

Copy link
Copy Markdown
Collaborator

Summary

Two workflow steps still saved GitHub Actions caches from merge_group runs. The queue's gh-readonly-queue/* ref dies the moment its entry merges or is dequeued — anything saved there is unreachable by every later run — but it stays charged against the repo's 10 GB LRU budget until evicted, and what it evicts is the main-scoped copies everyone else restores from.

This PR gates both writers off merge_group. Reads stay unconditional; pull_request and workflow_dispatch (refs that outlive the run) may still populate. It's the same rule playwright-e2e-reusable.yml already applies to every one of its own actions/cache/save steps.

What we measured (2026-09-09, 24h window)

Peak cache footprint 18 GB against a 10 GB budget
Buildkit blobs on one queue ref ~40 entries, 0–380 MB each
node-cache-*-yarn on dead queue refs (steady) 2.35 GB
Main-scoped fixture / distribution / ingestion-image entries 0 — all evicted, despite populate-playwright-caches.yml saving them on every push to main
merge_group Playwright runs that missed the golden fixture 231 / 235
Fixture rebuild cost per miss ~17 min on every shard's critical path
Fixture cache hit rate 2% merge_group · 27% PR

That fixture miss is the single largest fixed cost in the pipeline — prepare-playwright-fixture p50 is 16.9 min of a 56 min merge_group run.

The two writers

java-playwright-nightly.yml — docker/build-push-action cache-to: type=gha,mode=max

mode=max exports every layer. A queue ref that cold-builds the server image dumps dozens of buildkit-blob-* entries into the budget in one go — this is the spike vector behind the 18 GB reading. cache-from is unchanged, so queue runs still benefit from a PR- or dispatch-primed scope.

playwright-postgresql-e2e.yml — playwright-summary job, actions/setup-node cache: yarn

setup-node's built-in cache saves as a post-step under the current ref and has no restore-only mode. This is the only setup-node + cache writer on a merge_group trigger in the repo. ~1.2 GB per merge_group run, every run. Tradeoff: a cold yarn --ignore-scripts --frozen-lockfile on the summary job costs ~1 min; a missed golden fixture costs ~17 min per shard.

What the sweep found and deliberately left alone

I checked every merge_group-triggered workflow for cache writers. The remaining ~15 actions/cache@v6 steps (integration-tests-*, openmetadata-service-unit-tests, yarn-coverage, and the maven caches in java-playwright-nightly) all key on hashFiles('**/pom.xml') / hashFiles('**/yarn.lock'). On an exact-key hit actions/cache skips the save; live inventory shows zero maven entries on queue refs right now. They write only after a lockfile bump (~14% of commits) and the orphaned copy is bounded.

Follow-up (separate PR): convert those to actions/cache/restore + a merge_group-guarded actions/cache/save — playwright-knowledge-graph-postgresql-e2e.yml:260 already models the pattern.

Also not changed: the reusable's own saves on pull_request refs — ingestion image ~2.5 GB, distribution ~1.1 GB, browser ~1 GB, roughly 4.6 GB of the 6.7 GB PR-scoped footprint. Those are what give a re-pushed PR its 27% fixture hit rate. Whether that hit rate is worth the budget pressure is a real tradeoff and deserves its own decision, not a side effect of this PR.

What "fixed" looks like

After this lands and populate-playwright-caches.yml runs once on the next push to main, gh api repos/open-metadata/OpenMetadata/actions/caches?ref=refs/heads/main should show playwright-golden-fixture-v2-*, playwright-distribution-v2-*, and playwright-ingestion-image-v2-* entries and keep showing them across subsequent merge_group runs. restore-playwright-fixture on merge_group should flip from Cache not found to Cache restored. Combined with #33061 (tighter fixture fingerprint), the expected steady-state merge_group fixture hit rate is ~85%.

Test plan

  • Both files parse as YAML; the two ${{ }} expressions evaluate to the intended strings (verified by loading and printing the with: values)
  • Swept all merge_group workflows for actions/cache@, cache/save@, setup-node/setup-python/setup-java/setup-uv cache options — classified every key
  • After merge: next populate-playwright-caches.yml push run saves fixture/distribution/ingestion under refs/heads/main
  • After merge: sample 10 merge_group runs; restore-playwright-fixture reports Cache restored for the ones whose queued PRs don't touch FIXTURE_PREFIXES
  • After merge: gh api .../actions/cache/usage stays under 10 GB across a full day

🤖 Generated with Claude Code

Two steps still saved GitHub Actions caches from merge_group runs. The
queue's gh-readonly-queue/* ref dies when its entry merges or is
dequeued, so anything saved there is unreachable by every later run —
but it stays charged against the repo's 10 GB LRU budget until evicted,
and what it evicts is the main-scoped copies everyone else restores from.

Measured 2026-09-09:
  * 18 GB active against the 10 GB budget at one point; ~40
    buildkit-blob-* entries on a single queue ref (mode=max exports every
    layer, 0-380 MB each).
  * Steady-state ~2.35 GB of node-cache-Linux-x64-yarn-* on dead queue
    refs from the playwright-summary job alone.
  * Main's scope held ZERO golden-fixture / distribution / ingestion-image
    entries — all evicted despite populate-playwright-caches.yml saving
    them on every push to main.
  * Downstream: 231 of 235 merge_group Playwright runs in 24h missed the
    golden fixture and rebuilt it (~17 min each, on the critical path of
    every shard). Fixture cache hit rate: 2% merge_group, 27% PR.

The two writers, both now gated off merge_group — reads stay
unconditional, and pull_request / workflow_dispatch (refs that outlive
the run) may still populate:

  java-playwright-nightly.yml
    docker/build-push-action `cache-to: type=gha,mode=max` on every
    event. The spike vector: a queue ref that cold-builds the server
    image dumps dozens of layer blobs into the budget in one go.

  playwright-postgresql-e2e.yml (playwright-summary job)
    actions/setup-node `cache: yarn`. setup-node's built-in cache saves
    as a post-step under the current ref with no restore-only mode; this
    is the only setup-node+cache writer on a merge_group trigger in the
    repo. ~1.2 GB per merge_group run, every run. A cold
    `yarn --ignore-scripts` on the summary job costs ~1 min; a missed
    golden fixture costs ~17 min per shard.

Same rule playwright-e2e-reusable.yml already applies to every one of
its own actions/cache/save steps.

Swept every other merge_group workflow for cache writers. The remaining
~15 actions/cache@v6 steps (integration-tests-*, service-unit-tests,
yarn-coverage, java-playwright-nightly's maven caches) all key on
hashFiles(**/pom.xml) / hashFiles(**/yarn.lock): on an exact hit
actions/cache skips the save, and live inventory confirms zero maven
entries on queue refs. They write only after a lockfile bump (~14% of
commits) and the orphaned copy is bounded. Follow-up: convert them to
actions/cache/restore + a merge_group-guarded actions/cache/save, the
pattern playwright-knowledge-graph-postgresql-e2e.yml already uses.

Not changed here: the reusable's own saves on pull_request refs
(ingestion image ~2.5 GB, distribution ~1.1 GB, browser ~1 GB — ~4.6 GB
of the 6.7 GB PR-scoped footprint). Those give re-pushed PRs a 27%
fixture hit rate; whether that is worth the budget is a separate
decision.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Sep 9, 2026
@gitar-bot

gitar-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Prevents merge_group workflow runs from writing GitHub Actions caches under ephemeral queue refs that are unreachable after merge, protecting the 10 GB budget from LRU eviction of main-scoped caches. No issues found.

Options

Display: compact → Showing less information.

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

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit c02466ee2e1fd1bf4ae17543cba1766f17dcaa36 in Playwright run 34386940850, attempt 1.

✅ 557 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 47m 32s

⏱️ Max setup 4m 36s · max shard execution 14m 32s · max shard-job elapsed before upload 18m 19s · reporting 4s

🌐 236.17 requests/attempt · 2.82 app boots/UI scenario · 9.17% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 236.17 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.82 per UI scenario (1629 boots / 578 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 99 0 0 0 0 0
✅ Shard chromium-02 96 0 0 0 0 0
✅ Shard chromium-03 98 0 0 0 0 0
✅ Shard chromium-04 106 0 0 0 0 0
✅ Shard data-asset-rules-01 65 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 11 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@harshach
harshach merged commit 7ece558 into main Sep 9, 2026
104 of 105 checks passed
@harshach
harshach deleted the ci-gate-ephemeral-cache-writers branch September 9, 2026 19:28
Vansh0310 pushed a commit to Vansh0310/OpenMetadata that referenced this pull request Sep 29, 2026
…per-test lanes before shard fan-out (open-metadata#33095)

* ci: stop merge_group runs from saving the ingestion venv cache under queue refs

Follow-up to open-metadata#33085, which gated the setup-node yarn cache and the
buildkit layer cache off merge_group. It missed the largest ephemeral
writer because my sweep only covered .github/workflows/*.yml with a
direct merge_group trigger — not composite actions, and not reusables
invoked by merge_group callers.

The writer is the Python venv save in
.github/actions/setup-openmetadata-test-environment/action.yml, used by
py-tests-shared.yml (via py-tests.yml and py-tests-postgres.yml on
merge_group). Its `if:` guarded the fork pull_request_target
cache-poisoning case and nothing else — even though the same action,
~50 lines earlier, gates setup-uv's enable-cache off merge_group with a
comment explaining the ephemeral-ref problem. One writer fixed, one
missed, same file.

Cost: ~1 GB per Python version per merge_group run (the py-tests matrix
runs two), saved under a gh-readonly-queue/* ref that dies when the
entry merges or is dequeued, charged against the 10 GB LRU budget until
evicted.

Measured 2026-09-10:
  * 03:44-03:49: four Linux-py3.1x-om-venv entries, 3.98 GB, on two
    dead queue refs. Total cache 11.46 GB against 10 GB.
  * 03:24: populate-playwright-caches.yml (02:54 push run) saved
    playwright-golden-fixture, playwright-distribution and
    playwright-ingestion-image under main. By ~03:50 distribution
    (0.37 GB) and ingestion-image (1.26 GB) were gone — LRU-evicted —
    while the 54 MB fixture survived only because a merge_group run
    had just restored it (last_accessed 03:49, 03:52).
  * Net effect on merge_group runs: fixture cache now hits, but `build`
    still runs mvn cold (~6.5 min) and the ingestion lanes still rebuild
    the image, because the main-scoped copies cannot survive 2 GB/run of
    ephemeral writes.

Change: add `github.event_name != 'merge_group'` to the save's `if:`.
The restore step above is untouched, so queue runs keep hitting main's
venv; only the write is gated. Same rule playwright-e2e-reusable.yml
applies to all of its own saves.

Not changed: the 32 MB spacy-model actions/cache@ in py-tests-shared.yml
(same class, 0.6% of budget — not worth the surface). Not changed:
CodeQL's overlay-base-database entries (8 x ~470 MB = 3.74 GB on main
in 45 min) — that is GitHub default-setup CodeQL, no workflow file to
edit; it is the elephant in the budget but not ours to gate here.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ci(playwright): start the AutoPilot MySQL fixture; route failed-start logs through the stop script

start_playwright_autopilot_mysql.sh and the stop script's cleanup were already
on main but nothing started the container. Start it alongside the ingestion
image, seed it from docker/development/playwright-autopilot-mysql.sql, and
export PLAYWRIGHT_AUTOPILOT_MYSQL_* so AutoPilot.spec can use a per-shard source.

A failed start now runs the stop script with PW_STARTUP_FAILED=true, which
already saves and prints the server log tail, so the start script no longer
dumps it a second time.

From open-metadata#33088 (harshach/debug-merge-queue).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(playwright): make the helper-test lanes pass on main

Both lanes already on main (helper-tests.config.ts, browser-helper-tests.config.ts)
had rotted because nothing runs them in CI: 10 HTTP-helper and 2 serverLoad
browser tests failed on a clean main.

- fetchCompletedCsvAsyncJobResult polls /csvAsyncJobs/{jobId} and fails fast on
  FAILED/CANCELLED/unknown status or a mismatched job, instead of scanning a
  list (which is not what the endpoint returns).
- setRemoteRunnerAsDefault, getGlossaryApprovalWorkflowSnapshot and
  deleteArticleByFqn throw on an HTTP error rather than silently continuing.
- serverLoad boot cache: a read that started before a write is no longer
  cached after it (write generation), so a cached boot config cannot go stale.
  Keeps main's lost-token guard and "Route is already handled" tolerance; a
  disposed response is only ignored when its page is closed.

From open-metadata#33088 (harshach/debug-merge-queue).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(playwright): run the HTTP and browser helper lanes before shard fan-out

Adds the plan-playwright steps from open-metadata#33088: HTTP helper tests and the
browser-helper lane (compiled core components, real Chromium), each in a
network-less, read-only container. A broken shared helper now fails planning
in about a minute instead of surfacing as scattered e2e timeouts.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): point the impact map at the moved Auth login specs

open-metadata#34056 moved Pages/Login.spec.ts and Pages/LoginConfiguration.spec.ts to
e2e/Auth/, but impact-map.json still listed the old paths. Login.spec.ts is in
the smoke list every targeted PR run selects, so shard planning failed with
"Playwright selectors reference specs that do not exist" on every such PR.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Auto-revert Test <test-auto-revert@example.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
timothybrush pushed a commit to timothybrush/OpenMetadata that referenced this pull request Sep 30, 2026
…in (open-metadata#34237)

Measured 2026-09-29 15:44Z: the 10 GB Actions cache budget held 13.3 GB,
of which 11.6 GB (87%) sat under refs/pull/* and only 2.2 GB under main.
Main had no Playwright fixture entries at all; the warmer's copies from
13:16 had been LRU-evicted by the PR-ref flood within ~2.5 h. A PR-ref
copy is visible only to that PR's own re-runs, so every one of those
entries cost the shared budget while serving almost nobody.

Four changes, one PR:

- playwright-postgresql-e2e.yml: the summary job used setup-node's
  built-in `cache: yarn`, whose node-cache-* key nothing on main ever
  writes. Every PR missed and saved its own 1.4 GB copy (3 x 1.4 GB, 43%
  of the budget, from three PRs in one afternoon). Replace with
  actions/cache/restore against the warmer's main-scoped yarn-pkg-cache-*
  key. Restore-only; the follow-up my own open-metadata#33085 comment named.
- playwright-e2e-reusable.yml: gate the distribution, golden-fixture and
  ingestion-image saves off pull_request as well as merge_group. Only
  populate-playwright-caches.yml writes them now.
- setup-openmetadata-test-environment/action.yml: same gate on the venv
  save. Restore stays unconditional.
- populate-playwright-caches.yml: new warm-venv job (py 3.10/3.11/3.12)
  calling the composite exactly as py-tests-shared does. Until now no
  push-triggered workflow ran the composite without fast-mode, so main
  never held a venv and merge_group always built it cold.

actionlint: no new findings (the 11 reported pre-exist on main).

This branch was previously deployed

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

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants