Menu

#501 ci: stop storing every Rust cache twice

closed
nobody
None
2026-07-20
2026-07-20
Anonymous
No

Originally created by: Akarsh-Hegde

Supersedes this branch's first approach (narrowing the Windows job to registry-only). That freed 2.36GB by making a blocking gate slower. This frees ~4.46GB and makes nothing slower. Windows keeps its target cache.

The finding

The repo cache sits at 9.8GB of 10GB, and roughly 4.46GB of it is a second copy of something already present.

GitHub scopes caches by ref, and all three Rust jobs saved on both integration branches. These are not near-identical caches - they are byte-identical keys:

main      v0-rust-macos-universal-Darwin-arm64-201b0125-da9962c3
pre-main  v0-rust-macos-universal-Darwin-arm64-201b0125-da9962c3

main      v0-rust-windows-portability-Windows_NT-x64-2f1d0420-20ffafee
pre-main  v0-rust-windows-portability-Windows_NT-x64-2f1d0420-20ffafee

main      v0-rust-rust-Linux-x64-acc56c03-da9962c3
pre-main  v0-rust-rust-Linux-x64-acc56c03-da9962c3

The change

Save on main only. A run restores from its own branch or the default branch, so pre-main and PR runs read main's copy and simply stop writing their own.

The rust job already reasoned exactly this way for PR branches - "PR runs still RESTORE from the base branch; they just stop writing a duplicate." It just was not carried the last step to pre-main.

Cost, bounded

The key only diverges when Cargo.lock, the toolchain, or RUSTFLAGS change - 39 of 650 commits (6%) touched Cargo.lock in the last 30 days.

And even that case is not a cold build. Per rust-cache's own docs:

The action will try to restore from a previous Cargo.lock version as well, so lockfile updates should only re-build changed dependencies.

So a lockfile change on pre-main degrades to incremental work, not a full recompile. (I verified this against the action's README rather than assuming it - see the correction below for why.)

Why now

Six Rust caches totalled 9.6GB against the 10GB repo quota, which evicted the release job's cache within ~3h of it being written and forced every release to compile cold.

That is ci.yml's own comment, from the last time this bit. Capping save-if bought room once; the release path has since split into two per-arch caches, so demand grew again. This is where the room comes from - and the priority is fast macOS releases on staging and production.

The builds themselves are not the problem

Checked before blaming the cache. target/release is 4.8GB locally, 3.9GB of it deps/, dominated by objc2_app_kit (92MB rlib + 85MB rmeta) and cidre (43MB, twice). There is no [profile.release] override and debug info is already off by default. 4.8GB compressing to 2.4GB is simply what this workspace costs to compile - the waste was the duplication, not the size.

Correction carried over from [#497]

I claimed there that [#494] orphaned two 2.4GB rust-macos-universal caches and freed ~4.8GB. That was wrong: macos-universal is a CI job (ci.yml:171), and both copies were last read minutes before I checked. There was no headroom. [#497] as merged would have evicted live CI caches to store release caches LRU would evict again before the next release. This PR is the space that claim assumed.

Test plan

  • [x] ci.yml parses; all six jobs intact; all three rust-cache steps now save-if: main
  • [ ] After merge, confirm CI on pre-main still restores (look for a cache hit, not "No cache found")
  • [ ] Confirm the repo cache total drops by ~4.46GB as the pre-main copies age out
  • [ ] Confirm windows-portability stays green

🤖 Generated with Claude Code

Related

Tickets: #494
Tickets: #497

Discussion

  • Anonymous

    Anonymous - 2026-07-20

    Originally posted by: coderabbitai[bot]

    [!IMPORTANT]

    Review skipped

    Auto reviews are disabled on base/target branches other than the default branch.

    Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.


    ⚙️ Run configuration

    Configuration used: Organization UI

    Review profile: ASSERTIVE

    Plan: Pro Plus

    Run ID: 2ad43fe8-f769-4de2-b3cc-2b5d736eb5b9

    You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

    Use the checkbox below for a quick retry:
    - [ ] 🔍 Trigger review

    ✨ Finishing Touches
    🧪 Generate unit tests (beta) - [ ] Create PR with unit tests - [ ] Commit unit tests in branch `ci/free-cache-for-mac-releases`

    Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

    ❤️ Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

    Comment @coderabbitai help to get the list of available commands.

     
  • Anonymous

    Anonymous - 2026-07-20

    Ticket changed by: Akarsh-Hegde

    • status: open --> closed
     

Log in to post a comment.