ci(dogfood): split the cargo-state cache into restore + main-only save - #799
Conversation
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>
📝 WalkthroughWalkthroughThe dogfood CI job now restores Cargo caches separately and conditionally saves new cache entries on ChangesCargo cache workflow
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
.github/workflows/ci.yml
| # 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 |
There was a problem hiding this comment.
📐 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
doneRepository: 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
doneRepository: 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
Summary
Splits the dogfood job's
actions/cacheinto an always-runactions/cache/restoreand an end-of-jobactions/cache/saveguarded tomain, 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@v5→actions/cache/restore@v6(id:cargo-cache), same path/key/restore-keys.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 oncache-primary-key— save semantics identical to the KVM lane (runs only on job success, skips when the exact key already exists).actionlintpasses.🤖 Generated with Claude Code
Summary by CodeRabbit