Repository navigation
Conversation
paldepind
force-pushed
the
rust/inconsistent-feature
branch
from
October 20, 2026 11:25
3b50eaf to
a3e8174
Compare
paldepind
marked this pull request as ready for review
October 22, 2026 06:33
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new configuration unit test cannot compile, and a failed workspace reload now aborts extraction.
3 open issues
What changed in this PR
This PR makes Rust dependency extraction deterministic across workspaces by selecting a configuration for each dependency file, preferring more enabled features.
Changes:
- Defer dependency extraction until workspace configurations have been compared.
- Count unique manifests in diagnostics while retaining reload durations.
- Add richer-feature and tie-breaking regression cases, and update extraction-step expectations.
| File | Description |
|---|---|
| rust/ql/integration-tests/workspace-with-glob/steps.expected | Records the additional manifest load. |
| rust/ql/integration-tests/hello-workspace/steps.rust-project.expected | Updates project-manifest load expectations. |
| rust/ql/integration-tests/hello-workspace/steps.cargo.expected | Updates Cargo manifest load expectations. |
| rust/ql/integration-tests/hello-project/steps.rust-project.expected | Records the project-manifest reload. |
| rust/ql/integration-tests/hello-project/steps.cargo.expected | Records the Cargo manifest reload. |
| rust/ql/integration-tests/dependency-features/test_dependency_features.py | Generates competing feature configurations. |
| rust/ql/integration-tests/dependency-features/source/second/src/lib.rs | Exercises dependency macros from the second workspace. |
| rust/ql/integration-tests/dependency-features/source/first/src/lib.rs | Exercises dependency macros from the first workspace. |
| rust/ql/integration-tests/dependency-features/functions.tie.reversed.expected | Captures reversed tie-case results. |
| rust/ql/integration-tests/dependency-features/functions.tie.expected | Captures equal-feature selection results. |
| rust/ql/integration-tests/dependency-features/functions.rich.reversed.expected | Captures reversed richer-feature results. |
| rust/ql/integration-tests/dependency-features/functions.rich.expected | Captures richer-feature selection results. |
| rust/ql/integration-tests/dependency-features/functions.ql | Checks extracted calls and resolved targets. |
| rust/ql/integration-tests/dependency-features/dependencies/beta/src/lib.rs | Supplies feature-gated functions and macros. |
| rust/ql/integration-tests/dependency-features/dependencies/beta/Cargo.toml | Declares beta’s test features. |
| rust/ql/integration-tests/dependency-features/dependencies/beta/.cargo-checksum.json | Supports the local dependency source. |
| rust/ql/integration-tests/dependency-features/dependencies/alpha/src/lib.rs | Supplies feature-gated functions and macros. |
| rust/ql/integration-tests/dependency-features/dependencies/alpha/Cargo.toml | Declares alpha’s test features. |
| rust/ql/integration-tests/dependency-features/dependencies/alpha/.cargo-checksum.json | Supports the local dependency source. |
| rust/ql/integration-tests/dependency-features/.cargo/config.toml | Redirects dependency resolution to local fixtures. |
| rust/extractor/src/util.rs | Adds optional-value comparison support. |
| rust/extractor/src/rust_analyzer.rs | Clarifies enclosing-workspace lookup and excludes self-matches. |
| rust/extractor/src/main.rs | Groups sources deterministically and adds deferred dependency extraction. |
| rust/extractor/src/diagnostics.rs | Deduplicates manifest counts and adds a regression test. |
| rust/extractor/src/configuration.rs | Implements dependency configuration ranking and selection. |
Review effort: Max
Defer dependency extraction until all workspaces have been considered, prefer configurations enabling more Cargo features, and use deterministic tie-breaking. Co-authored-by: Copilot <[email protected]> Copilot-Session: 3def7ce6-eea3-4d78-963d-f3675492bb16
Add tests for extraction of dependency files with different features enabled in different manifest files. Co-authored-by: Copilot <[email protected]> Copilot-Session: 3def7ce6-eea3-4d78-963d-f3675492bb16
Regenerate existing integration-test expectations to account for manifest reloads in the deferred dependency extraction pass. Co-authored-by: Copilot <[email protected]> Copilot-Session: 3def7ce6-eea3-4d78-963d-f3675492bb16
paldepind
force-pushed
the
rust/inconsistent-feature
branch
from
October 22, 2026 09:30
a3e8174 to
c3fdbd8
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Problem: When a project under extraction contains multiple
Cargo.tomlfiles, theCargo.tomlfiles might specify overlapping dependencies but enable different features for the dependencies.The extractor previously extracted each dependency file using whichever
Cargo.tomlit encountered first in a hash-map. This made extraction non-deterministic.Fix: This PR defers dependency extraction until all
Cargo.tomlfiles have been examined, then selects a configuration per file, preferring the one with more enabled features and using deterministic tie-breaking based on paths. Once that is done, the "winning" manifests are reloaded to extract the dependency files for which they "won".Note to reviewer:
mainfunction, specifically how we now have twoforloops over manifests and in the first pass defer extracting dependency files and instead calldependencies.add_file.test_dependency_features.pyattempt to give an overview.The DCA report shows some changes. Nothing looks particularly good/bad nor actionable, so I think its fine. The real test is wether future DCA runs have less wobble.