Skip to content

ci(dogfood): split the cargo-state cache into restore + main-only save - #799

Merged
norrietaylor merged 1 commit into
mainfrom
ci/dogfood-cache-split-restore-save
Jul 17, 2026
Merged

ci(dogfood): split the cargo-state cache into restore + main-only save#799
norrietaylor merged 1 commit into
mainfrom
ci/dogfood-cache-split-restore-save

Conversation

@norrietaylor

@norrietaylor norrietaylor commented Jul 17, 2026

Copy link
Copy Markdown
Member

Summary

Splits the dogfood job's actions/cache into an always-run actions/cache/restore and an end-of-job actions/cache/save guarded to main, mirroring the KVM lane's documented cache policy (ci-linux-kvm.yml: "PR branches restore but never write: … caches written by every branch LRU-evict the main entries all PRs restore from").

Failure state: every PR branch's dogfood run saves its own dogfood-minimal-cargo-* entry via the combined action's post step. Under the repo's 10 GB cache quota, those per-branch entries LRU-evict the main-built entries — so the next PR's restore misses (or falls back to a stale prefix match) and dogfood rebuilds from scratch, exactly the churn the KVM lane's split already prevents for its own cache.

Change:

  • actions/cache@v5actions/cache/restore@v6 (id: cargo-cache), same path/key/restore-keys.
  • New Save Cargo state cache (main only) step after the smoketest: actions/cache/save@v6, if: github.ref == 'refs/heads/main' && steps.cargo-cache.outputs.cache-hit != 'true', keyed on cache-primary-key — save semantics identical to the KVM lane (runs only on job success, skips when the exact key already exists).

actionlint passes.

Note: .github/workflows/ is CODEOWNER-gated per CONTRIBUTING.md; this PR needs a CODEOWNER review to land.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved CI build-cache handling to restore existing caches efficiently.
    • Added conditional cache saving for builds on the main branch when no matching cache is found.

The combined actions/cache post step writes a cache entry from every
branch: each PR's dogfood run saves its own cargo-state entry, and
those per-branch entries LRU-evict the main entries that all PRs
restore from — the same failure the KVM lane documents on its own
split cache. Mirror that lane's policy: actions/cache/restore always,
actions/cache/save at the end of the job guarded on main and on the
primary key not already existing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The dogfood CI job now restores Cargo caches separately and conditionally saves new cache entries on main when restoration misses.

Changes

Cargo cache workflow

Layer / File(s) Summary
Restore and conditionally save Cargo cache
.github/workflows/ci.yml
The dogfood job uses actions/cache/restore@v6, then saves the cache with actions/cache/save@v6 only on main after a restore miss, using the restore step’s primary key.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: twitchyliquid64

Poem

I’m a bunny with caches tucked neat,
Restoring Cargo makes builds hop sweet.
On main, when the old cache is gone,
I save fresh bytes before dawn.
Thump-thump—CI races on!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: splitting the dogfood Cargo cache into restore and main-only save steps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 112-115: Ensure the workflow change involving the cargo-cache
restore step receives the required CI-owner/CODEOWNER approval before merging.
Do not alter the workflow implementation; satisfy the repository’s review-gating
requirement for .github/workflows changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f5f4778d-a527-48dc-a895-60f05062c323

📥 Commits

Reviewing files that changed from the base of the PR and between bba123b and 9ed3415.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Comment thread .github/workflows/ci.yml
Comment on lines +112 to +115
# Restore-only; the save half (main only) runs at the end of the
# job, matching the KVM lane's cache policy.
id: cargo-cache
uses: actions/cache/restore@v6

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== tracked files related to workflow policy ==\n'
git ls-files | rg '(^|/)(CODEOWNERS|CONTRIBUTING|README|\.github/workflows/ci\.yml|\.github/|docs/)' || true

printf '\n== search for workflow policy language ==\n'
rg -n --hidden --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**' \
  '(.github/workflows|CODEOWNER|CODEOWNERS|frozen|workflow)' \
  CODEOWNERS .github README* CONTRIBUTING* docs* 2>/dev/null || true

printf '\n== candidate policy files ==\n'
for f in CODEOWNERS .github/CODEOWNERS .github/workflows/ci.yml README.md CONTRIBUTING.md; do
  if [ -f "$f" ]; then
    echo "--- $f ($(wc -l < "$f") lines) ---"
    sed -n '1,220p' "$f"
    echo
  fi
done

Repository: gominimal/minimal

Length of output: 27583


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== inspect .github/workflows/ci.yml around the referenced lines ==\n'
if [ -f .github/workflows/ci.yml ]; then
  nl -ba .github/workflows/ci.yml | sed -n '90,145p'
fi

printf '\n== find any CODEOWNERS entries for workflows ==\n'
for f in CODEOWNERS .github/CODEOWNERS; do
  if [ -f "$f" ]; then
    echo "--- $f ---"
    rg -n '^.*\.github/workflows/|^/?.github/workflows/|^\.github/' "$f" || true
  fi
done

Repository: gominimal/minimal

Length of output: 263


Require CI-owner review for this workflow change

The repo freezes .github/workflows/**, and .github/ is CODEOWNER-gated, so this edit should only merge with the required owner approval.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 112 - 115, Ensure the workflow change
involving the cargo-cache restore step receives the required CI-owner/CODEOWNER
approval before merging. Do not alter the workflow implementation; satisfy the
repository’s review-gating requirement for .github/workflows changes.

Sources: Coding guidelines, Learnings

@norrietaylor
norrietaylor merged commit 9e9f15e into main Jul 17, 2026
28 checks passed
@norrietaylor
norrietaylor deleted the ci/dogfood-cache-split-restore-save branch July 17, 2026 00:36
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.

2 participants