build(docker): stop copying the gitignored Cargo.lock - #305
Conversation
Both Dockerfiles ran `COPY Cargo.toml Cargo.lock ./`, but Cargo.lock is gitignored on purpose — this is a library crate consumed by sibling repos via git dependency, so a committed lock is never used downstream and only goes stale. It is therefore absent from the build context, and the COPY fails the Railway build outright with "failed to calculate checksum ... /Cargo.lock: not found" — BuildKit's wording for a missing source, not a corrupt one. Cargo resolves fresh instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012wrzeZAdwGYTCKoxamwQht
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughBoth Dockerfiles upgrade Rust to 1.98.1, copy only ChangesDocker build updates
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: Poem
Comment |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_033401ee-1523-44be-8233-14f85429c36d) |
The images installed 1.97.1 and asserted in prose that rust-toolchain.toml required it. The channel moved to 1.98.1 on 2026-09-01 and Cargo.toml declares rust-version = "1.98", so the pinned toolchain refuses the build outright: "rustc 1.97.1 is not supported by the following package: ndarray requires rustc 1.98". This was the next failure waiting behind the Cargo.lock COPY. The prose no longer restates the number, per rust-toolchain.toml's own warning that a stale comment on a version pin is how the next reader learns the wrong one — which is how the mismatch survived the bump. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012wrzeZAdwGYTCKoxamwQht
|
Pushed The toolchain pin was staleBoth images installed 1.97.1, and
The bump log records Cargo refuses at manifest load, so fixing only the The comment was the mechanism, so it changed too
Verification — all three RUN steps, on 1.98.1Against the reproduced context (
Unchanged from the PR body: no Docker daemon here, so the image itself is not built, and Worth flagging for the merge decision: no CI job in this repo builds either Dockerfile, so a green matrix here does not cover this change — the evidence above is what stands behind it. Generated by Claude Code |
Summary
Fixes the Railway build failure. Both Dockerfiles ran
COPY Cargo.toml Cargo.lock ./, butCargo.lockis gitignored — so it is not in the build context and theCOPYfails outright:One line changed in each file, plus a comment explaining why the omission is deliberate so it is not "helpfully" restored later.
Three things this is not
COPYfails when a source is missing from the context; re-running the same build produces the same failure.Cargo.lock. Committing an empty one would contradict the.gitignorerationale ("this is a library crate consumed by sibling repos via git dependency, so a committed lock is never used by a downstream build and only goes stale against the branch") and would plant a second, fake source of truth for resolution — the exact thing that policy exists to prevent. Cargo resolving fresh in the image is the intended behaviour.Verification
No Docker daemon in this sandbox, so I reproduced the build context instead: exported the committed tree with
git archive HEAD(what Railway actually sees) and replicated the Dockerfile's exactCOPYset into a clean directory.Cargo.lockin the committed treeCargo.tomlOK,Cargo.lockMISSING — reproduces the failurecargo metadataon the reproduced contextRUSTFLAGS="-C target-cpu=x86-64-v3" cargo build --release(the image's firstRUN, same flags)Finished release profile in 36.14sThe
cargo metadatastep matters beyond resolution: manifest load is where the[patch.crates-io] chacha20 = { path = "vendor/chacha20" }entry and the declared[[example]]/[[bench]]targets are validated — the two hazards the existing Dockerfile comments warn about. Both pass with the reducedCOPYset, so nothing else was silently depending on the lock.Dockerfile.avx512carries the identical line and the identical fix; it differs fromDockerfileonly intarget-cpu=x86-64-v4, which I did not build here (this sandbox is not AVX-512-pinned hardware and the image is documented as SIGILL-on-older-CPUs).🤖 Generated with Claude Code
https://claude.ai/code/session_012wrzeZAdwGYTCKoxamwQht
Generated by Claude Code
Summary by CodeRabbit