Repository navigation
fix(lock): pin a relocated dependency sidecar to the bytes mise just wrote - #13407
Conversation
When a sidecar is published to a new directory, mise writes normalized bytes there. Recording the digest the entry arrived with left a relocated legacy CRLF entry pinning bytes that no longer exist anywhere, and its empty cache cell meant no later save could heal it. Digest the verified graph instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited) Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughChangesSidecar digest normalization
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
|
Instruction countsNothing was compared, and so nothing was gated. No series appears on both sides: either the base has no measurements recorded, or the two were measured on different runner classes, which are deliberately not comparable — counts shift between machine types by more than a real regression does. New, nothing to compare against: Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run. Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.
|
https://entire.io/gh/jdx/mise/trails/55
Follow-up to #13403, which merged while this case was still under review.
#13398 made sidecar digests cover normalized graph text, and #13403 kept
accepting the raw-CRLF digests older versions recorded on Windows and taught
mise to heal them. One path was left behind: when a sidecar is published to a
new directory — a lockfile moved or renamed, a backend variant, a sidecar
restored after being pruned —
SidecarWrites::preparewrites the freshlynormalized bytes there but recorded
graph.identity(), the digest the entryarrived with.
For an entry carrying a legacy CRLF digest, the result pinned bytes that exist
nowhere: the new directory holds LF text, whose normalized digest and raw
digest both differ from what was written to
mise.lock. That relocated entrycould not be verified on any platform, and because the returned pointer has an
empty cache cell, no later save could heal it either.
The digest now covers the graph that was just verified and published, so a
relocated sidecar is pinned to the bytes actually on disk. Entries that were
already normalized are unaffected — for them the two values are equal by
definition.
Test
src/lockfile/graph.rsextends the legacy-digest unit test: after the staleentry heals in place, it saves the lockfile to a different directory and
asserts the republished sidecar is LF, the new entry records the normalized
digest rather than the legacy one, and reading that lockfile back loads the
graph. Reverting the one-line change fails this test.
cargo test --bin mise lockfile(202 tests),mise run lint, andcargo clippy --workspace --all-features --all-targets -- -D warningspass.🤖 Generated with Claude Code
AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5; version: 2.1.270.
Note
Medium Risk
Touches lockfile sidecar publish and digest pinning; wrong behavior broke verification for relocated entries, but the change is narrow and covered by an extended unit test.
Overview
Fixes dependency sidecar digests when a lockfile is saved to a new path (move, rename, variant, restore). After
preparewrites LF-normalized sidecar bytes, the stored digest now comes fromdigest_textof the published graph instead of reusinggraph.identity()from the incoming entry.That stops legacy CRLF digests from being copied onto relocated sidecars whose on-disk text no longer matches—entries that previously could not be verified and could not self-heal on later saves. In-place saves for already-normalized entries are unchanged.
The legacy CRLF digest test now saves to another directory and asserts the new lockfile records the normalized digest, the sidecar has no
\r, and the graph loads.Reviewed by Cursor Bugbot for commit 9fd08e4. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit