[PM-38767] Adopt cargo-run-bin for binary tool version pinning in desktop_native#21169
[PM-38767] Adopt cargo-run-bin for binary tool version pinning in desktop_native#21169coroiu wants to merge 1 commit into
Conversation
…ktop_native Pin the desktop_native workspace's binary cargo tools (cargo-deny, cargo-sort, cargo-udeps, cargo-llvm-cov, cargo-xwin) in [workspace.metadata.bin] and run them via cargo-run-bin (`cargo bin <tool>`), bootstrapped once with `cargo install cargo-run-bin --locked`. Replaces the cargo-tool-versions file and the ad-hoc per-tool `cargo install` calls in CI and build.js. A check-no-binstall guard enforces source-only installs (VULN-613). Includes the PM-24643 improvement: a unified lint runner (--fix / --only) that mirrors CI, exposed as `npm run lint:rust`. The lint.yml rust job is now a per-check x OS matrix with per-check .bin caching and a stable `Rust lint` aggregator job. Dev/CI scripts converted from duplicated bash + PowerShell to portable Node: - scripts/prepare-env-rust.mjs (was prepare-env-unix-rust.sh + -windows-rust.ps1) - scripts/lint-rust.mjs (the unified runner) - scripts/check-no-binstall.mjs (binstall guard) NOTE: branch protection required-status-check names change with the matrix; point them at the new `Rust lint` aggregator job.
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR consolidates binary cargo tool version pinning for Code Review DetailsNo findings. Notes for reviewers / merge:
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21169 +/- ##
=======================================
Coverage ? 49.05%
=======================================
Files ? 4048
Lines ? 126555
Branches ? 19292
=======================================
Hits ? 62081
Misses ? 59933
Partials ? 4541 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|



🎟️ Tracking
desktop_nativeworkspace.📔 Objective
The
desktop_nativeRust workspace pinned its binary cargo tools in three inconsistent places:cargo-tool-versions(cargo-deny/sort/udeps), an ad-hoccargo installintest.yml(cargo-llvm-cov), and another inbuild.js(cargo-xwin). Local-dev and CI versions could drift, and there was no single command to reproduce CI's lint checks locally.This change:
[workspace.metadata.bin]inapps/desktop/desktop_native/Cargo.toml— and runs them viacargo-run-bin(cargo bin <tool>), bootstrapped once withcargo install cargo-run-bin --locked --version 1.7.4. Renovate-managed.check-no-binstallguard: fails CI if cargo-binstall would be used; warns locally.npm run lint:rust(--fix/--only <check>) over fmt/clippy/sort/udeps/deny, mirroring CI so a local pass means CI passes.rustjob into a per-check × OS matrix with per-check.bincaching, plus a stableRust lintaggregator job..mjs), replacing the duplicated bash + PowerShellprepare-envpair with a singlescripts/prepare-env-rust.mjs, so Windows devs no longer need Git Bash.Notable
cargo-xwinruns ascargo bin cargo-xwin build …(not… cargo-xwin xwin build): when cargo-run-bin invokes the binary directly, clap does not strip thexwincargo-subcommand token.Rust lintaggregator job (and drop the oldRun Rust lint on <os>names) so merges aren't blocked.Verified locally
All five checks pass via
npm run lint:rust;cargo bin cargo-llvm-covresolves; pre-commit hooks (lint-staged) run the newcargo bincommands successfully; renovate config validates; both workflows parse.