fix(ci): refresh changed sources after restoring Cargo caches - #302
hyperb1iss wants to merge 5 commits into
Conversation
Fallback target archives can be newer than a fresh checkout, while the source timestamp snapshot deliberately restores only exact source matches. Touch changed, new, and mode-mismatched inputs after archive restoration so Cargo cannot accept stale fingerprints without invoking rustc. Cover the original failure with a real Cargo build that first reproduces the false Fresh result, then proves timestamp restoration forces recompilation. Co-Authored-By: Nova (GPT-6) <noreply@openai.com>
Refresh every tracked source when a restored cache lacks a usable timestamp snapshot so Cargo cannot accept stale fingerprints from legacy archives. Use a monotonic whole-second timestamp for refreshed inputs to avoid moving submillisecond filesystem timestamps backward. Real Cargo fixtures cover missing, malformed, and legacy metadata alongside changed sources. Co-Authored-By: Sol (GPT-5.6) <noreply@openai.com>
Use the high-resolution epoch clock when invalidating stale Cargo artifacts. Advance an already newer source by one microsecond instead of a whole second so the rebuild output immediately becomes newer and remains reusable. Cover the rebuild boundary by requiring the next Cargo invocation to report the fixture as Fresh without another compilation. Co-Authored-By: Sol (GPT-5.6) <noreply@openai.com>
Validate the full source and symlink snapshot structure before traversal. Valid JSON primitives and malformed entries now follow the safe cache invalidation path instead of throwing after target restoration. Exercise null and malformed-entry snapshots with real Cargo rebuild and immediate-reuse checks. Co-Authored-By: Sol (GPT-5.6) <noreply@openai.com>
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughSource timestamp restoration now validates snapshot metadata and refreshes tracked source timestamps when metadata or file state is invalid. Unchanged files retain recorded timestamps. Tests cover changed, new, mode-changed, and malformed-source states. ChangesSource timestamp restoration
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Comment |
Use a submillisecond offset for the timestamp precision case. The file API accepts seconds, so the previous literal advanced almost a second.
A fallback Cargo target cache can contain artifacts newer than the current checkout. When changed files keep their checkout timestamps, Cargo can reuse an old library even though the source has changed. A native CI run hit this by compiling a new enum-variant test against stale library metadata.
Restore cached timestamps only when source content and executable mode match. Refresh changed and newly tracked inputs after extracting the target archive. Missing, malformed, or incompatible timestamp metadata refreshes the tracked sources, preserving fallback cache reuse without trusting stale fingerprints. A changed symlink inventory also invalidates source freshness.
🧪 Validation
Real Cargo fixtures reproduce the stale
Freshresult and verify that restoration forces compilation. Coverage includes changed and new files, executable-mode changes, symlink targets, and missing or legacy metadata. The cache action tests also verify that unchanged inputs retain reuse.Summary by CodeRabbit