CARGO_PRIMARY_PACKAGE is not included in the fingerprint, and can change for workspace members #14678
Labels
A-environment-variables
Area: environment variables
A-rebuild-detection
Area: rebuild detection and fingerprinting
A-workspaces
Area: workspaces
C-bug
Category: bug
S-triage
Status: This issue is waiting on initial triage.
Problem
The
is_primary_package
status can change for workspace members, but it is not tracked in the fingerprint. This can cause the CARGO_PRIMARY_PACKAGE to change, but not be reflected in the build.This can happen when you run a
cargo
command that selects all workspace members as roots, and then later run a separate cargo command that only selects one of them, but includes another workspace member as a dependency. That second command will act differently if you hadn't run the first command.I don't know if this really matters, and maybe we decide to just ignore it. However, I'm uncomfortable with untracked state in the fingerprint.
Steps
Here's a test using cargo's testsuite:
Possible Solution(s)
A possible solution is to include the primary state in the fingerprint.
Changing this will need very careful consideration of the impact on clippy (the primary reason this exists). Will it cause more cache thrashing for clippy users? If so, maybe we need to rethink how it is set for workspace dependencies.
Notes
No response
Version
cargo 1.83.0-nightly (ad074ab 2024-10-04)
release: 1.83.0-nightly
commit-hash: ad074ab
commit-date: 2024-10-04
host: aarch64-apple-darwin
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.7.1 (sys:0.4.74+curl-8.9.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Mac OS 14.6.1 [64-bit]
The text was updated successfully, but these errors were encountered: