Skip to content

Dependency comparison improvements#11426

Draft
sschuberth wants to merge 4 commits intomainfrom
deps-comp-imps
Draft

Dependency comparison improvements#11426
sschuberth wants to merge 4 commits intomainfrom
deps-comp-imps

Conversation

@sschuberth
Copy link
Member

Please have a look at the individual commit messages for the details.

…ncies

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
There is no cycle in the originally defined

    depCyc2 -> depFoo -> depCyc1

dependency chain. Doing so is actually not directly possible with the
recursively defined `PackageReference` class.

Solve that by using a primitive `DependencyHandler` that just uses
indexes to identify dependencies.

However, as the functionality to break cycles is not actually
implemented yet in the dependency graph builder, disable this test
temporarily until it is implemented with an upcoming change.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
mnonnenmacher and others added 2 commits February 12, 2026 11:02
Stop processing transitive dependencies in `DependencyGraphBuilder` if
the same dependency already appeared in the same branch.

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.com>
Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.78%. Comparing base (fe50797) to head (509af51).

Additional details and impacted files
@@            Coverage Diff            @@
##               main   #11426   +/-   ##
=========================================
  Coverage     57.77%   57.78%           
  Complexity     1711     1711           
=========================================
  Files           347      347           
  Lines         12901    12904    +3     
  Branches       1236     1237    +1     
=========================================
+ Hits           7453     7456    +3     
+ Misses         5000     4999    -1     
- Partials        448      449    +1     
Flag Coverage Δ
test-ubuntu-24.04 42.48% <100.00%> (-0.01%) ⬇️
test-windows-2025 42.46% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

.build(checkReferences = false)

graph.nodes shouldHaveSize 6
graph.edges shouldHaveSize 5
Copy link
Member

Choose a reason for hiding this comment

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

It could be nice to verify the actual edges here to demonstrate how the cycles are broken.

Copy link
Member Author

Choose a reason for hiding this comment

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

While debugging this with PNPM-specific changes on top, it looks to be as if indeed the cycle is broken at the "wrong" place. I need to further investigate this; moving back to draft.

val depFoo = createDependency("org.foo", "foo", "1.2.0", dependencies = setOf(depCyc1))
val depCyc2 = createDependency("org.cyclic", "cyclic", "77.7", dependencies = setOf(depFoo))
// TODO: Enable this once the functionality to break cycles is fully implemented.
"deal with cycles in dependencies".config(enabled = false) {
Copy link
Member

Choose a reason for hiding this comment

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

"deal with cycles" is so unspecific, how about also changing it to "break cycles"?

addDependencyToGraph(scopeName, it, transitive = true, processed)
if (it in processed) {
return@mapNotNullTo null
}
Copy link
Member

Choose a reason for hiding this comment

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

In #11207 I had this problem with this change:

The second commit tries to fix that issue by breaking cycles in transitive dependencies. With that fix, the first stack overflow does not happena anymore, but then there is a stack overflow in the default implementation of DependencyHandler.areDependenciesEqual when it tries to compare the dependency subtrees when adding the nodes.

Is this somehow solved by the early returns you added in the first commit?

Copy link
Member Author

Choose a reason for hiding this comment

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

Is this somehow solved by the early returns you added in the first commit?

Yes, at least that fixed the stack overflow I was seeing in my PNPM experiments.

@sschuberth sschuberth marked this pull request as draft February 12, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants