GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ci: fix cargo cache eviction — rust-cache, per-suite e2e keys, main-only saves by mikolalysenko · Pull Request #121 · SocketDev/socket-patch

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Problem

Every ubuntu e2e matrix leg cold-compiles the full ~275-crate dependency graph on every PR run (verified in run 28838256247: Cache not found for input keys on all legs, then 275 Compiling lines each, vs 4 on a cache-hit job). Two compounding causes:

  1. Matrix key collision — all ~9 same-OS e2e legs share one cache key (${{ matrix.os }}-cargo-e2e-<lockhash>). Only one leg wins the cache reserve per run; the other 8 log Failed to save: Unable to reserve cache … another job may be creating this cache.
  2. 10 GiB budget blowout — caching the whole target/ dir puts a single main run's footprint at ~8.2 GiB (windows-latest-cargo-* 3.96 GB, macos-latest-cargo-* 2.19 GB). Against GitHub's 10 GiB LRU budget, every PR save evicts the main-branch caches (the big e2e ones first) — the cache listing shows only the most recent main run's caches ever survive.

Fix

  • Swap the five raw actions/cache blocks (clippy, test matrix, test-release, coverage, e2e) for Swatinem/[email protected] (SHA-pinned), which prunes caches to dependency artifacts (~5-10× smaller) and keys on rustc host triple + job automatically.
  • Per-suite key: ${{ matrix.suite }} on the e2e job — no more reserve races.
  • save-if: github.ref == 'refs/heads/main' everywhere — PR branches restore but never write, so they stop churning the budget.

Workspace crates (socket-patch-core/-cli) recompile each run by design — that ~1-2 min is the tradeoff that keeps the dependency caches small enough to survive. The docker-image jobs keep their deliberate no-cache stance (zizmor cache-poisoning audit).

Expected effect

e2e legs go from ~275-crate cold builds per leg per PR run to dependency-cached builds; total repo cache footprint drops well under the 10 GiB budget so main caches stop being evicted.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mikolalysenko @claude
ci: fix cargo cache eviction — rust-cache, per-suite e2e keys, main-o…
d712af3
…nly saves

Every ubuntu e2e leg has been cold-compiling the full ~275-crate graph
on every PR run. Two compounding causes:

1. Matrix key collision: all ~9 same-OS e2e legs shared one cache key
   (`<os>-cargo-e2e-<lockhash>`), so a single leg won the cache reserve
   per run and the other 8 logged "Unable to reserve cache".
2. Budget blowout: caching the entire target/ dir put a single main
   run's cache footprint at ~8.2 GiB (windows 3.96 GB, macos 2.19 GB)
   against GitHub's 10 GiB LRU budget, so PR-branch saves evicted the
   main caches (and vice versa) — the big e2e caches always first.

Fix: swap the five raw actions/cache blocks (clippy, test matrix,
test-release, coverage, e2e) for Swatinem/rust-cache, which prunes the
cache to dependency artifacts (~5-10x smaller) and keys on the rustc
host triple + job automatically; give e2e legs a per-suite key; and
restrict saves to main (`save-if`) so PR branches restore without
churning the budget. Workspace crates recompile per run by design —
that's the ~1-2 min tradeoff that keeps dependency caches alive.

The docker-image jobs keep their deliberate no-cache stance (zizmor
cache-poisoning audit).

Co-Authored-By: Claude Fable 5 <[email protected]>
@socket-security

socket-security Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgithub/​swatinem/​rust-cache@​c19371144df3bb44fab255c43d04cbc2ab54d1c49910010010070

View full report

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@socket-security-staging

socket-security-staging Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgithub/​swatinem/​rust-cache@​c19371144df3bb44fab255c43d04cbc2ab54d1c49910010010070

View full report

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cenobitedk
Jeppe Hasseriis (cenobitedk) approved these changes Jul 10, 2026
View reviewed changes
@mikolalysenko
Mikola Lysenko (mikolalysenko) merged commit 8225fbd into main Jul 10, 2026
55 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the fix/ci-cargo-cache branch July 10, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cenobitedk Jeppe Hasseriis (cenobitedk) cenobitedk approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@mikolalysenko @cenobitedk
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.