Skip to content

Rust: Make crate fallback logic more conservative in path resolution library - #22495

Open
hvitved wants to merge 2 commits into
github:mainfrom
hvitved:rust/path-resolution-crate-fallback-uniqueness
Open

Rust: Make crate fallback logic more conservative in path resolution library#22495
hvitved wants to merge 2 commits into
github:mainfrom
hvitved:rust/path-resolution-crate-fallback-uniqueness

Conversation

@hvitved

@hvitved hvitved commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

When doing a QA run for #21795, I noticed that our fallback logic for crate dependencies can sometimes lead to combinatorial explosions. This PR alleviates this by only applying the fallback logic to crates that have a unique latest version. DCA confirms that this PR resolves the performance issue, most notably on the reflaxe-rust project, where the hxrt crate exists in many test copies (e.g. https://github.com/fullofcaffeine/reflaxe.rust/blob/main/test/snapshot/abstracts_conversions/intended/hxrt/Cargo.toml).

@github-actions github-actions Bot added the Rust Pull requests that update Rust code label Sep 2, 2026
@hvitved
hvitved force-pushed the rust/path-resolution-crate-fallback-uniqueness branch from e35d861 to 1925c20 Compare September 3, 2026 07:06
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Sep 3, 2026
@hvitved
hvitved marked this pull request as ready for review September 3, 2026 10:49
@hvitved
hvitved requested a review from a team as a code owner September 3, 2026 10:49
@hvitved
hvitved requested review from paldepind and a balanced review from Copilot September 3, 2026 10:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Raw string ordering can select the wrong semantic version, and the uniqueness behavior lacks regression coverage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 Medium severity · 1 Low severity

New issues introduced by this change (2)
Severity Finding
Medium severity rust/​ql/​lib/​codeql/​rust/​internal/​PathResolution.qllver is a raw Cargo version string, so this ordering is lexicographic rather than semantic: for…
Low severity rust/​ql/​lib/​codeql/​rust/​internal/​PathResolution.qll — The existing path-resolution fixture does not contain multiple extracted crate entities sharing the…
What changed in this PR

Restricts Rust crate dependency fallback to a uniquely identified latest crate version, reducing path-resolution explosions.

Changes:

  • Selects the latest crate version for fallback resolution.
  • Adds debugging support for crate dependency edges.
File Description
rust/​ql/​lib/​codeql/​rust/​internal/​PathResolution.qll Narrows crate fallback resolution and adds debugging support.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rust/ql/lib/codeql/rust/internal/PathResolution.qll
Comment thread rust/ql/lib/codeql/rust/internal/PathResolution.qll
@hvitved
hvitved requested review from a team as code owners September 3, 2026 11:06
@hvitved
hvitved force-pushed the rust/path-resolution-crate-fallback-uniqueness branch from d432cd5 to 52e2c72 Compare September 3, 2026 11:08
Comment thread shared/util/codeql/util/SemVer.qll Dismissed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Go JS no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants