Repository navigation
ci(cache): gate every cache save to main and guard it - #1217
Merged
Merged
Conversation
This was referenced Sep 26, 2026
zackees
force-pushed
the
ci/1216-rust-cache-save-if
branch
from
September 26, 2026 06:53
4a3291c to
e82a4cf
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Swatinem/rust-cache and actions/cache saved on every pull_request run, filling the 10 GB repo cache with unreachable refs/pull/* entries. - save-if: github.ref == 'refs/heads/main' on all rust-cache steps. - actions/cache split into restore + main-gated actions/cache/save. - ci-preflight-rust: shared-key so warm/lint/unit-test share one entry; only warm saves. - ci/cache_save_guard.py + tests, wired into ./lint. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…1216) ci/lint.py now runs ci.cache_save_guard between wheel_abi_guard and spawn_path_guard; the exact-sequence test did not list it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
zackees
force-pushed
the
ci/1216-rust-cache-save-if
branch
from
September 26, 2026 08:55
49c1af4 to
f931d11
Compare
6 tasks done
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.
Fixes #1216
Part of zackees/setup-soldr#528
Changes
rust-cache: every
Swatinem/rust-cachestep (15 steps in 12 workflows) now hassave-if: ${{ github.ref == 'refs/heads/main' }}. PR runs restoremain's entries and never save.auto-release.yml: saves only onmainpushes, not on tag refs. A cache saved on a tag ref is scoped to that tag, so no later release could restore it. Tag and dispatch runs still restoremain's entry.ci-all-features,security-fuzz,security-audit) run on the default-branch ref, so they still save.actions/cache: the 4 venv caches, the 2 Dylint caches and the fuzz corpus are split into
actions/cache/restore@v4plus a main-gatedactions/cache/save@v4that reusescache-primary-keyand skips on an exact hit.Shared keys:
ci-preflight-rustwarm/lint/unit-test usedkey:. rust-cache adds the job id to that, so each job had a private entry and the sub-workers never restored warm'starget/. They now useshared-key: <label>-preflight-rust. Only warm saves; lint and unit-test usesave-if: false. Keys left as they are:ci-linuxandlinux-x86-buildreproducible: they already share a job id and key.output-shutdown-<label>,independent-fixture-<target>,release-binaries-<target>: each is a different OS or target.<label>-all-features, coverage, security-audit, security-fuzz: each builds a different feature, instrumentation or workspace graph._build<runner>-<mode>: dev and release are different profiles.Guard:
ci/cache_save_guard.py, wired into./lint, withtests/test_ci_cache_save_guard.py. It fails on:falsesave-ifactions/cacheactions/cache/savewithout a main-gatedif:A step can opt out only with a
# cache-save-exempt: <reason>comment.RED -> GREEN
Before (origin/main):
python -m ci.cache_save_guardexits 1 with22 cache step(s) can save on pull_request (#1216), listing every rust-cache and actions/cache step.After:
cache_save_guard: 21 workflow(s) OK. The unit tests pass (11), andtest_repository_workflows_passfails on origin/main.Validation
soldr cargo fmt --all -- --check,soldr cargo clippy --workspace --all-targets -- -D warnings,soldr cargo build --workspace: passsoldr cargo check --workspace --target x86_64-pc-windows-msvcand--target aarch64-apple-darwin: passyaml.safe_load.tests.test_ci_cache_save_guard,test_ci_preflight_workflow,test_coverage_workflow,test_independent_spawn_release: pass./lint: the new guard passes inside it. The run then stops at a failure that is already onorigin/mainand is unrelated to this PR:ci.api_snapshotsaysdocs/api_snapshot_rust.txtis stale (spawn/platform re-exports added upstream). This PR touches no Rust, so the snapshot is left for a separate change.🤖 Generated with Claude Code