fix: add --locked flag to cargo install cargo-llvm-cov in coverage.sh#759
fix: add --locked flag to cargo install cargo-llvm-cov in coverage.sh#759xiaolai wants to merge 1 commit intogoogleworkspace:mainfrom
Conversation
Without --locked, cargo resolves the newest compatible versions of all transitive dependencies at install time, which can produce different binaries across runs and pull in unreviewed dependency updates. The --locked flag forces cargo to use the dependency versions pinned in cargo-llvm-cov's own Cargo.lock, making the install reproducible. Co-Authored-By: Claude Code <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 2ca035a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the reliability and security of the development environment by pinning dependencies during the installation of the cargo-llvm-cov tool. By enforcing the use of the lockfile, the installation process becomes deterministic, ensuring that every environment uses the exact same dependency graph intended by the tool maintainers. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request adds the --locked flag to the cargo install command for cargo-llvm-cov in the coverage script to improve installation reproducibility. A review comment points out that while --locked pins transitive dependencies, the version of the tool itself should also be explicitly pinned to ensure full reproducibility and prevent potential breaking changes or security vulnerabilities from future releases.
| if ! cargo llvm-cov --version &> /dev/null; then | ||
| echo "cargo-llvm-cov is not installed. Installing..." | ||
| cargo install cargo-llvm-cov | ||
| cargo install --locked cargo-llvm-cov |
There was a problem hiding this comment.
While the --locked flag ensures that transitive dependencies are pinned to the versions specified in the tool's Cargo.lock, it does not pin the version of cargo-llvm-cov itself. For truly reproducible and secure installs, the tool version should also be pinned (e.g., cargo install --locked --version 0.6.11 cargo-llvm-cov). Without this, the script will always install the latest version available on crates.io, which could introduce breaking changes or security vulnerabilities, partially defeating the purpose of the reproducibility and security goals stated in this pull request.
scripts/coverage.shinstallscargo-llvm-covviacargo install cargo-llvm-covwithout the--lockedflag. Without--locked, Cargo resolves the newest compatible versions of all transitive dependencies at install time rather than using the versions pinned in the tool's ownCargo.lock. This means:Adding
--lockedensures the install is fully reproducible and uses only the dependency graph thecargo-llvm-covmaintainers tested against.