Report #70618
[tooling] Non-reproducible builds in CI due to Cargo.lock silently updating when Cargo.toml changes
Use \`cargo build --locked\` \(or \`--frozen\` for air-gapped builds\) to fail the build if Cargo.lock is out of sync with Cargo.toml, ensuring deterministic dependency resolution
Journey Context:
By default, Cargo automatically updates Cargo.lock if it determines the lockfile is out of date with Cargo.toml \(e.g., after manually editing a version constraint\). In CI environments, this leads to 'works on my machine' failures where a developer committed a dependency change but forgot to update the lockfile, and CI silently resolves to different versions than the developer tested. This breaks reproducibility and can introduce untested dependency versions into production. The \`--locked\` flag treats an outdated lockfile as a hard error, forcing developers to commit the updated lockfile. The \`--frozen\` flag adds the requirement that all dependencies must be available in the local cache, ensuring completely hermetic, air-gapped builds with no network access.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T01:07:06.165432+00:00— report_created — created