fix: Docker cache#2314
Merged
Merged
Conversation
kkovaacs
approved these changes
Jul 6, 2026
kkovaacs
left a comment
Contributor
There was a problem hiding this comment.
Nice catch!
Hope this indeed solves the stale cache issues we've seen from time to time...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
We have Docker builds failing due to mismatched caching https://github.com/0xMiden/node/actions/runs/28658546904/job/84993414912?pr=2312.
bin/ntx-builder/src/server/get_network_note_status.rshad been updated (in a newer commit) to implementhandle()with 4 params, matching a newer version of the GetNetworkNoteStatus trait in miden-node-proto. But the build linked that fresh ntx-builder source against a stale, previously-cached miden-node-proto .rlib — compiled from an older commit where the trait still only declared 2 params. Two different commits' code got mixed into the same build.The cache mounts have no id= at all (--mount=type=cache,sharing=locked,target=/app/target), so there was a single global, unkeyed /app/target mount shared by every arch and every binary. Cargo decides whether to recompile a path crate by comparing source file mtimes against its recorded fingerprint mtimes. BuildKit's COPY . . stamps every file with the same normalized timestamp regardless of actual content — so from Cargo's point of view, miden-node-proto's source didn't look "newer" than the fingerprint left behind by whichever earlier build populated that shared mount, even though the trait definition had genuinely changed since then. Cargo concluded "unchanged, reuse the cached .rlib" and just relinked it, instead of recompiling.
Docker's timestamp normalization defeats Cargo's mtime-based staleness check on a shared build-cache mount. The solution is to restore each file's real last-commit mtime before compiling. This makes sure a file whose content actually changed since the cached build always looks newer to Cargo, so the crate gets recompiled instead of silently reusing an incompatible cached artifact.
Changes
Note: the per-binary cache mount id change means the first CI run after this PR merges will cold-build every image (as seen in run 28758866086) — expected one-time cost before the new caches are warm. Subsequent run showed correct cache usage.
Changelog