Repository navigation
ci(cache): prune Actions cache entries nothing can restore - #853
Merged
Merged
Conversation
The repository's Actions cache sat at its 10 GB limit with Zig caches that can never be read again, and evicted every chipdb (#843). Two kinds of entry are dead weight: - entries saved on a closed pull request's merge ref (or a deleted branch): only that ref could restore them; - older entries of a key that ends in the run id. mlugg/setup-zig saves one per run and restores by prefix, which takes the newest, so the older ones in the same series on the same ref are never read. actions-cache-prune runs hourly, when a pull request closes, and on demand (dry run by default). The rules are a plain function in .github/scripts/cache-prune.js; the job runs its 14 node tests before it deletes anything, and actions-cache-prune-test runs them on any pull request that changes them. 12 of 12 mutants of the rules are killed by the tests. Dry run against the live repository on 2026-10-04: 161 entries, 10.73 GB; it would drop 139 (9.00 GB) and keep 22 (1.73 GB). 100 of the dropped belong to the closed pull requests #828, #839, #840 and #841; 39 are superseded setup-zig entries on main. Part of #851 and #844. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
X Brain Health CheckScore: 100.0/100 X Brain is above merge threshold |
🧪 Brain Stress Test ResultsScore: not measured (no stress test prints a Score: line) X Stress test passed |
This was referenced Oct 4, 2026
dmitrii-f-t27
pushed a commit
that referenced
this pull request
Oct 10, 2026
The prune from #853 keeps the newest entry of every series on every live ref. On 2026-10-05 that alone came to 7.97 GB (130 entries), and the saves between two prunes took the repository past 10 GB, where GitHub evicts by last read, fixed keys included. The chipdb saved on fix/ci-chipdb-cache on 2026-10-04 was gone by the next morning, and the LED one-hot run on #852 rebuilt it (2 m 54 s). Two changes: - cache-prune.js: after the existing rules, while the kept entries are over BUDGET_BYTES (8e9), drop setup-zig's per-run entries on refs other than main, least recently read first. Nothing else is dropped for the budget: not a fixed key, not main, and not a chipdb whose key ends in a run id (one branch saves chipdb-...-regymm-<run id>). A chipdb hit saves about three minutes; a Zig cache hit tens of seconds at most. - actions-cache-prune.yml: also run on workflow_run after brain-ci and CI complete. The hourly schedule started 2 runs in 9 slots between 18:41Z and 03:46Z. brain-ci's jobs hold 8.59 GB and CI's 1.85 GB of 10.84 GB. Eight new tests (22 in all); 13 of 13 mutants of the budget rule are killed. On the 162-entry list of 2026-10-05 the plan drops 43 entries (3.06 GB), 10 of them (0.72 GB) for the budget, and keeps 119 (7.78 GB), including all 5 chipdb entries and all 9 entries on main. Refs #844 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Part of #851 and #844. It works together with #852: that PR makes the chipdb cache able to hit, and this one makes room so the entry survives.
What was wrong
Live read of
actions/cacheson 2026-10-04:setup-zig-cache-v2-*, whichmlugg/setup-zig@v2saves on every run of every Zig job, with the run id in the key.What this adds
actions-cache-prune.ymlruns hourly, when a pull request closes, and on demand. On demand it is a dry run by default. It deletes two kinds of entry:It keeps fixed keys (
setup-zig-tarball-*, the chipdb keyed on part and image from #852) and the newest entry of each series on every live ref.The rules live in
.github/scripts/cache-prune.js. The job checks out the default branch, runs the rules' tests, and only then deletes anything. It does not use the closed pull request's merge ref, because that ref may already be gone and should not decide what gets deleted.actions-cache-prune-test.ymlruns the same tests on any pull request that changes the rules.Evidence
node --testcases pass. They cover:gh api, against this repository on 2026-10-04: 161 entries, 10.73 GB. It would drop 139 (9.00 GB) and keep 22 (1.73 GB).Not measured
gh workflow run actions-cache-prune.yml(a dry run by default) shows the plan before the first hourly run acts on it.workflow_runtrigger after the Zig workflows.🤖 Generated with Claude Code