Skip to content

ci: restore Maven cache from master-produced caches in maven-verify#1399

Open
joaodinissf wants to merge 1 commit into
dsldevkit:masterfrom
joaodinissf:ci/maven-verify-cache-restore-keys
Open

ci: restore Maven cache from master-produced caches in maven-verify#1399
joaodinissf wants to merge 1 commit into
dsldevkit:masterfrom
joaodinissf:ci/maven-verify-cache-restore-keys

Conversation

@joaodinissf

@joaodinissf joaodinissf commented May 31, 2026

Copy link
Copy Markdown
Collaborator

The maven-verify cache never hits in practice. Three compounding causes, verified against the live cache inventory:

  1. Exact-key-only restore: the key embeds hashFiles('**/pom.xml'), so every pom-touching PR (each dependabot bump) missed outright — e.g. run 27416121979: Cache not found for input keys: Linux-maven-0-3ecae… followed by a full cold download.
  2. PR scope isolation: the eight open PRs each held a byte-identical 704 MB cache under their own refs/pull/N/merge scope, invisible to one another. Only master-scoped caches are shareable, and verify.yml (pull_request-only) never saves there. Meanwhile snapshot.yml does produce a master-scoped Linux-maven-publish-* cache on every push — and its own restore-keys already reach down into Linux-maven-0-, so the sharing was one-directional by accident.
  3. Eviction churn: the redundant per-PR saves pushed the repo over its 10 GB cache budget (10.35 GB / 14 caches), so LRU eviction also killed same-PR reuse.

The fix stays within the one cache step:

  • actions/cache/restore (restore-only): PRs stop saving — ends the duplicate-cache churn and the eviction pressure (steady state ≈ two master caches, ~1.5 GB).
  • restore-keys prefix fallback, including Linux-maven-publish-: every PR warm-starts from the snapshot build's ~/.m2 (a superset of what verify needs), refreshed on each merge to master. The maven-0 epoch remains the manual cache-bust lever, and the explicit two-prefix list keeps a future epoch bump effective.

Mechanism verified end-to-end in a fork experiment (joaodinissf#26): after a pom touch, the second run logged Cache restored from key: Linux-maven-0-… and round-tripped the cached content from the first run.

🤖 Generated with Claude Code

The maven-verify cache never hit in practice, for three compounding reasons
(verified against the live cache inventory):

- actions/cache only restores on an exact key match, and the key embeds
  hashFiles('**/pom.xml') — so any pom-touching PR missed outright.
- GitHub isolates caches per PR scope: the eight open PRs each held a
  byte-identical 704 MB cache under their own refs/pull/N/merge, invisible
  to one another. The only shareable scope is master, and verify.yml (a
  pull_request-only workflow) never saved there.
- master DOES have a cache producer — snapshot.yml saves ~/.m2/repository
  as Linux-maven-publish-* on every push — but verify's restore prefix
  (Linux-maven-0-) could never match that family. snapshot.yml's own
  restore-keys already reach down into Linux-maven-0-; the sharing was
  one-directional by accident.
- The redundant per-PR saves pushed the repo over its 10 GB cache budget
  (10.35 GB across 14 caches), so LRU eviction also killed same-PR reuse.

Fix, all in the one cache step: switch to actions/cache/restore (PRs stop
saving — ends the duplicate-cache churn and the eviction pressure), add
restore-keys with prefix fallback, and include Linux-maven-publish- so every
PR warm-starts from the snapshot build's superset cache, refreshed on each
merge to master. The maven-0 epoch remains the manual bust lever.

Mechanism verified in a fork experiment (#26): a pom-touching
second run logged 'Cache restored from key: Linux-maven-0-…' and round-
tripped the cached content.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@joaodinissf joaodinissf force-pushed the ci/maven-verify-cache-restore-keys branch from f145e0c to df9375b Compare June 12, 2026 21:05
@joaodinissf joaodinissf changed the title ci: add restore-keys to the maven-verify Maven cache ci: restore Maven cache from master-produced caches in maven-verify Jun 12, 2026
@joaodinissf joaodinissf marked this pull request as draft June 12, 2026 21:07
auto-merge was automatically disabled June 12, 2026 21:07

Pull request was converted to draft

@joaodinissf joaodinissf removed the request for review from rubenporras June 12, 2026 21:07
@joaodinissf joaodinissf marked this pull request as ready for review June 12, 2026 22:03
@joaodinissf joaodinissf requested a review from rubenporras June 12, 2026 22:03
@joaodinissf joaodinissf enabled auto-merge (rebase) June 12, 2026 22:03
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