Skip to content

chore: read the Stryker caches on main every day - #209

Merged
benatespina merged 1 commit into
mainfrom
chore/keep-stryker-caches
Oct 24, 2026
Merged

benatespina merged 1 commit into
mainfrom
chore/keep-stryker-caches

Conversation

@benatespina

Copy link
Copy Markdown
Member

Summary

  • GitHub evicts a cache nobody has read for 7 days. A pull request can read only the caches saved on main, and a push to main refreshes only the incremental Stryker files of the packages it changed. So after a quiet week, a pull request ran every mutant of the other packages cold. On chore(deps): update non-major dependencies #202, Mutation (core) found no stryker-core- cache (last written 2026-10-10), ran all 6,333 mutants and hit the timeout.
  • New workflow stryker-cache.yml: once a day, and on demand, each package restores its stryker-<package>- cache from main. A restore counts as a read, so the cache is not evicted. Each job takes about 3 seconds and needs no checkout.

Why this mechanism

  • Restore only, not a scheduled mutation run. Warm caches are already cheap to use. The content stays current because the mutation job rewrites a package's file whenever that package changes on main. Running Stryker on a schedule would cost minutes per package every day just to keep a file alive.
  • Daily. A weekly run would read the cache on the same day it is due to be evicted, and GitHub can delay or skip scheduled runs. A daily run tolerates several missed days for about 7 × 3 s of runner time.
  • Fails on a miss (fail-on-cache-miss). Reading cannot create a cache that main lacks, so a red run is the signal. The next mutation run of that package on main writes the cache.
  • The 10 GB limit is not a concern. Each incremental file is 20 to 165 KB. Older per-commit keys are never matched by the prefix restore, so they age out after 7 days. The repository uses about 2.2 GB, almost all of it pnpm caches. Keeping these caches read also protects them from LRU eviction under the limit.

Validation

workflow_dispatch only works once the file is on main, and pull requests do not trigger a schedule-only workflow. To test it, I pushed the same file with an extra push trigger to a throwaway branch, which can read main's caches, and deleted that branch afterwards:

  • Read (cli) restored stryker-cli-a52ee3e… from refs/heads/main. That cache's last_accessed_at moved from 10:44:17Z to 10:50:39Z, which confirms that a restore with no checkout resets the eviction clock.
  • The other six failed with "Failed to restore cache entry": today main has no Stryker cache for them, because they were evicted.

After merge

Until main has a cache for every package, the daily run fails for the missing ones. #208 changes ci.yml, so its merge runs mutation for every package on main and writes all seven caches. After that, run this workflow once with workflow_dispatch to confirm that every job is green.

pnpm check exits 0. No changeset: no package changes.

GitHub evicts a cache nobody reads for 7 days, and a push to main only
refreshes the incremental files of the packages it changed, so a pull
request after a quiet week ran every mutant of the others cold: core
found no cache on #202 and ran out of time.
@benatespina
benatespina force-pushed the chore/keep-stryker-caches branch from 8158dcd to b967571 Compare October 24, 2026 11:17
@benatespina
benatespina merged commit 2d2f01f into main Oct 24, 2026
5 checks passed
@benatespina
benatespina deleted the chore/keep-stryker-caches branch October 24, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant