Files
civitai__civitai/.github
Zachary Lowden 20e5c21c07 ci(cache): reclaim 9.65 GB of the cache budget and cache the vitest transform cache (#4415)
The repo's Actions cache holds 21 entries / 10,878,231,374 bytes against a
10 GB per-repo limit, so LRU eviction is live and is throwing away useful
entries.

There are exactly two cache keys, same content hash, differing only by OS:

  node-cache-Linux-x64-pnpm-428a04cc...     1 copy,  on refs/heads/main, 511 MB
  node-cache-Windows-x64-pnpm-428a04cc...  20 copies, each on a different
                                           refs/pull/N/merge, ~518 MB each
                                           = 9.65 GB, 95.3% of the budget

Mechanism: an Actions cache entry is scoped to a ref. A PR run can read an
entry saved on its base branch, but not one saved by another PR, and it saves
into its own refs/pull/N/merge scope. windows-dev-env.yml triggers on
pull_request only, so there was no entry on refs/heads/main for a PR to
restore from: every PR missed, and every PR then saved its own ~518 MB copy
under the same key in its own dead scope. lint.yml does not have this problem
precisely because it has a push-to-main leg.

Two changes:

1. windows-dev-env.yml gains push: branches: [main]. One base-branch entry
   then serves every PR and no PR saves its own. Two side effects the guard
   test in scripts/__tests__/main-branch-ci-coverage.test.ts pins, both fixed
   here: the concurrency group must vary per commit on main (it was
   github.ref, one group for the whole branch), and a job on the push path
   may not be unconditionally continue-on-error (a run reporting success over
   a failed step). The canary stays report-only on PRs, which is what its
   header actually argues for, and renders honestly on main. No step in that
   workflow reads github.base_ref or github.event.pull_request, so nothing
   needed gating.

2. lint.yml's unit job caches node_modules/.vite. Measured on a warm local
   checkout: 302 MB, all of it esbuild pre-bundles under
   .vite/vitest/<hash>/{deps,deps_ssr}. All four shards rebuild it cold on
   every PR today. Restore always, save only on main, so this can never
   repeat the per-PR-scope leak above: four entries total, 1.21 GB worst
   case, restorable by every PR from its base branch.

Verified: actionlint clean on both files (and red on a deliberately broken
copy, as a negative control); both parse as YAML; the main-branch CI coverage
guard is 6/6 green, and goes red on exactly the two assertions above when the
concurrency group and continue-on-error are reverted. The unit, packages and
apps jobs keep no job-level if:, so they still run on every PR to main and
release.

The 20 orphaned Windows entries are being deleted separately by the operator;
nothing here reaps them.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-25 22:06:51 -05:00
..