Repository navigation
ci(frontend): one writer per shared cache key, and only from main - #889
Merged
Merged
Conversation
The 10 GB Actions cache budget was measured FULL with sccache out of it —
10,387,544,511 bytes across 73 entries — and ~2.3 GB of that was PR branches
minting their own copies of entries `main` already owns. Three `actions/cache`
sites in the frontend workflows carried no `save-if`, so every ref saved:
`pnpm-store` held four entries (~1.58 GB) and `next-build` four (~0.74 GB).
rust.yml already states this pattern for `shared-key: rust` ("`lint` is the
SINGLE WRITER, and only from `main`", the other compile jobs `save-if: false`);
the frontend caches never got it. Now:
pnpm-store `check` on main; `e2e` and the nightly experiment restore-only
next-build `e2e`'s chromium-1 leg on main; experiment restore-only
`next-build` is pinned to one matrix leg rather than to the job, because `check`
never runs `pnpm build` and so cannot be its writer — which leaves a four-leg
matrix whose legs would otherwise race to save one key. All four build the
identical tree, so any leg's cache is equivalent.
PR branches still restore through the existing `restore-keys` prefixes, which is
where nearly all the value is: both keys follow the lockfile, not the branch.
The `coverage` job needs no guard and did not get one — it is
`schedule`/`workflow_dispatch`-only, so no pull request can write its entries.
Prerequisite for #887, which moves sccache back onto this budget, and correct
independently of it.
Closes #888
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #888
What
One writer per shared frontend cache key, and only from
main.pnpm-storeiswritten by
check;next-buildbye2e'schromium-1leg. Every other callsite — the
e2eshards and the nightlyfrontend-experimentswatchdog — isrestore-only.
Why
The 10 GB Actions cache budget is full with sccache out of it (10,387,544,511
bytes / 73 entries), and ~2.3 GB of that was PR branches minting their own copies
of entries
mainalready owns:pnpm-storeheld four entries (~1.58 GB),next-buildfour (~0.74 GB). Prerequisite for #887, and correct on its own.Proof
actionlinton both changed files: exit 0, no findings (re-run without a pipe —the first attempt's
$?wastail's).scripts/ci/workflow-shell-check.sh: ok,12 hand-written workflows, all within budget. Both files parse under
yaml.safe_load, and everyactions/cachesite in them now carries an explicitsave-if— audited programmatically rather than by eye:No Rust changed, so
make checkis not the gate for this diff; thefrontendtier in CI is, and it exercises both restore paths on this very PR.
Risk & rollback
Risk: a PR branch no longer gets an exact-key
next-buildhit after touchingsrc/**, falling back to the lockfile prefix — the same trade rust.yml alreadymakes. Rollback:
git revert <merge-sha>; the guards are additive and nothingdepends on them.
Post-merge ledger
Closed by: agent · session
a3ee4d31-1a50-4299-82b3-0eaf6cd8d848onMac· 2026-11-08T20:57:23Zmainis green with this change on it — merge3615cf18; all fourworkflows on that SHA concluded
success(rust,frontend,infra,devcontainer). Corroborated by9583e470, a later head with this commitas an ancestor, whose
rustalso succeeded.images—n/a — nothing that goes into an image changed.Verifiedrather than assumed: the only workflows that ran on
3615cf18wereinfra,devcontainer,rust,frontend.imagesis absent, which iscorrect for a workflow-file change.
deploy—n/a — no image was built, so the workflow_run trigger never fired.There is no running process to read a line from.driftsuccess (b4b0b0fb),kindsuccess(
0a4aac56),deploymost recentlyskipped(2b66beb5), its normalstate when no image changed. None is reachable by a frontend-workflow
edit.
hand.
n/a — this PR deferred nothing;its scope landedwhole. The budget question ci: cache-prune will outgrow its 30m timeout now that sccache writes one entry per object again #902 tracks arrived from ci(rust): sccache back on the Actions cache backend, off S3 #893's backend move,
not from this change.
work:
checkcannot ownnext-buildbecause it never runspnpm build,so on a four-leg matrix the write must be pinned to one leg for "single
writer" to be true at all.
Specific to this change
recorded rather than claimed. Total usage moved 10,387,544,511 →
12,026,615,900 bytes and 73 → 1,223 entries, but that is dominated by
ci(rust): sccache back on the Actions cache backend, off S3 #893's sccache move rather than by this reclaim. The two keys now stand at
19 entries on
mainagainst 20 still in PR scopes — duplicates do notvanish at merge, they age out on 7-day idle, so the ~2.3 GB arrives next
week.
deferred — #902, which owns the budget trend.Instead of reading log lines I queried the cache API for entries created
after the merge (~19:39Z): the only one is
2026-11-08T19:45:38 refs/heads/main next-build-6e04c46f37abfe5, and no PR ref has createdeither key since.
last_accessed_atwould have been the wrong field —it moves on reads, so it showed PR entries as recent;
created_atis whatanswers this.
7-day idle expiry makes this a next-week observation, now carried as the
budget-trend item on ci: cache-prune will outgrow its 30m timeout now that sccache writes one entry per object again #902 rather than a box left quietly open here.
deferred — #902Context — plan, discoveries, measurements, files
Plan
Audit which jobs write which shared keyssave-ifguards, single writer per key, main-onlyactionlint + workflow-shell-check + programmatic save-if auditDiscoveries
checkcannot be thenext-buildwriter. It never runspnpm build, soit has no
.next/cacheto save. That leaves thee2ejob, which is afour-leg matrix — so the write is pinned to
matrix.slug == 'chromium-1'rather than to the job. Without the leg pin, "single writer" would have been
false in the one place it mattered, with three legs racing to save one key.
coveragejob is not part of this problem. Its ~1.6 GB ofv2-rust-coverageentries look like the same pattern but it isschedule/workflow_dispatch-only, so no pull request can write them. Thetwo entries are rust-cache's ordinary key-churn. Whether a nightly job should
hold 1.6 GB of a shared budget is a real question and belongs to ci: move sccache off S3 to the Actions cache backend ($209/mo egress -> ~$5) #887's
measurement phase, not here.
Measurements
Files
.github/workflows/frontend.yml— threesave-ifguards.github/workflows/frontend-experiments.yml— two, both restore-only