Properly handle recursive dependencies in conda lockfiles - #1857
Merged
Jason Paulos (jasonpaulos) merged 1 commit intoAug 20, 2026
Merged
Conversation
Jason Paulos (jasonpaulos)
requested a review
from Ryan Brandenburg (ryanbrandenburg)
August 19, 2026 20:30
|
👋 Hi! It looks like you modified some files in the
If none of the above scenarios apply, feel free to ignore this comment 🙂 |
Copilot started reviewing on behalf of
Jason Paulos (jasonpaulos)
August 19, 2026 20:34
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a conda-lock detector bug where cyclic (circular) dependencies could trigger unbounded recursion and ultimately a stack overflow. It does this by adding cycle detection to the conda dependency traversal while preserving cyclic edges in the recorded dependency graph.
Changes:
- Add a recursion-path guard (
HashSet<string> currentPath) to stop re-traversing cycles during dependency registration. - Add a unit test that validates circular dependencies complete successfully and that both dependency edges are retained in the graph.
Show a summary per file
| File | Description |
|---|---|
| test/Microsoft.ComponentDetection.Detectors.Tests/CondaLockComponentDetectorTests.cs | Adds a regression test covering a simple python ↔ pip cycle and asserts the resulting graph contains both edges without overflowing. |
| src/Microsoft.ComponentDetection.Detectors/conda/CondaDependencyResolver.cs | Introduces a per-traversal path set to prevent infinite recursion when conda-lock packages form cycles. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
Ryan Brandenburg (ryanbrandenburg)
approved these changes
Aug 19, 2026
Jason Paulos (jasonpaulos)
deleted the
jasonpaulos/conda-lockfile-circular-dep
branch
August 20, 2026 15:02
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.
Fixes a bug where circular dependencies in a conda lockfile would cause a stack overflow, since there were no guards against indefinite recursion.