Problem
The repo currently has a three-way inconsistency around Cargo.lock:
- The root
.gitignore ignores Cargo.lock.
- 30 examples commit it anyway (tracked files override the ignore):
rust/backend_wasm64, rust/basic_bitcoin, rust/basic_ethereum, rust/candid_type_generation, rust/canister-info, rust/canister-snapshot-download, rust/canister-snapshots, rust/canister_logs, rust/exchange-rates, rust/face-recognition, rust/guards, rust/icp_transfer, rust/image-classification, rust/inter-canister-calls, rust/low_wasm_memory, rust/parallel_calls, rust/performance_counters, rust/periodic_tasks, rust/photo_gallery, rust/qrcode, rust/query_stats, rust/receiving-icp, rust/send_http_get, rust/send_http_post, rust/simd, rust/threshold-schnorr, rust/unit_testable_rust_canister, rust/who_am_i, rust/x509, and motoko/parallel_calls (Rust load-test tool).
- The remaining Rust examples (
rust/hello_world, rust/vetkeys/*, rust/evm_block_explorer, rust/llm_chatbot, rust/threshold-ecdsa, ...) do not commit it.
Current impact: none of the committed locks are used by builds
- The
@dfinity/rust recipe (icp-cli-recipes) has a locked: boolean option that appends --locked to cargo build — but it defaults to false and no example sets it.
- Three examples use custom
cargo build steps in icp.yaml (image-classification, face-recognition, composite_query); none pass --locked/--frozen.
- The only
--locked flags in the repo are cargo install --locked for CI tools (candid-extractor, wasi2ic), which use the tool's own bundled lock file, not the example's.
So today the committed locks only pin what developers get locally; CI always resolves fresh dependencies.
Options
(a) Commit Cargo.lock everywhere and make it load-bearing
- Remove
Cargo.lock from the root .gitignore, commit the missing locks, set locked: true in every rust recipe config (and add --locked to the three custom build steps).
- Pro: reproducible builds; local dev matches CI.
- Con: locks go stale unless updates are automated (Renovate/Dependabot); more churn in PRs.
(b) Untrack all locks and stay lock-free
git rm --cached the 30 tracked locks; keep the root gitignore entry.
- Pro: zero maintenance; CI always builds against the latest compatible dependencies, catching upstream breakage early — arguably the right behavior for an examples repo that wants to stay current.
- Con: builds are not reproducible; a bad upstream release can break CI for unrelated PRs.
Either option is better than the current mixed state.
Problem
The repo currently has a three-way inconsistency around
Cargo.lock:.gitignoreignoresCargo.lock.rust/backend_wasm64,rust/basic_bitcoin,rust/basic_ethereum,rust/candid_type_generation,rust/canister-info,rust/canister-snapshot-download,rust/canister-snapshots,rust/canister_logs,rust/exchange-rates,rust/face-recognition,rust/guards,rust/icp_transfer,rust/image-classification,rust/inter-canister-calls,rust/low_wasm_memory,rust/parallel_calls,rust/performance_counters,rust/periodic_tasks,rust/photo_gallery,rust/qrcode,rust/query_stats,rust/receiving-icp,rust/send_http_get,rust/send_http_post,rust/simd,rust/threshold-schnorr,rust/unit_testable_rust_canister,rust/who_am_i,rust/x509, andmotoko/parallel_calls(Rust load-test tool).rust/hello_world,rust/vetkeys/*,rust/evm_block_explorer,rust/llm_chatbot,rust/threshold-ecdsa, ...) do not commit it.Current impact: none of the committed locks are used by builds
@dfinity/rustrecipe (icp-cli-recipes) has alocked: booleanoption that appends--lockedtocargo build— but it defaults to false and no example sets it.cargo buildsteps inicp.yaml(image-classification,face-recognition,composite_query); none pass--locked/--frozen.--lockedflags in the repo arecargo install --lockedfor CI tools (candid-extractor,wasi2ic), which use the tool's own bundled lock file, not the example's.So today the committed locks only pin what developers get locally; CI always resolves fresh dependencies.
Options
(a) Commit
Cargo.lockeverywhere and make it load-bearingCargo.lockfrom the root.gitignore, commit the missing locks, setlocked: truein every rust recipe config (and add--lockedto the three custom build steps).(b) Untrack all locks and stay lock-free
git rm --cachedthe 30 tracked locks; keep the root gitignore entry.Either option is better than the current mixed state.