-
Notifications
You must be signed in to change notification settings - Fork 365
test(model): Fix the test for cyclic dependencies #10083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@oheger-bosch, fixing the test for cyclic dependencies now actually shows that we're running into a stack overflow. From a first glance it seems that calling Can you have a look as well? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10083 +/- ##
============================================
- Coverage 57.47% 57.47% -0.01%
+ Complexity 1704 1703 -1
============================================
Files 346 346
Lines 12855 12855
Branches 1222 1222
============================================
- Hits 7389 7388 -1
Misses 4992 4992
- Partials 474 475 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
It is unclear to me what you want to achieve with this PR. The code that adds dependencies to the graph uses a set to store the nodes it already has processed and to detect cycles in the graph. Obviously, your artificial dependency handler implementation tricks this out. Not sure how realistic this is. |
I'm currently inspecting various "strange" real-world issues that we have when analyzing Gradle or Node projects (like #9763). As part of that I was inspecting various areas of the code again, and came across this test, which does not seem to be doing what it advertises. But do you agree that the test in its current form actually does not check that cycles are properly handled?
This handler is modeled after a real-world handler where the identifiers for packages are just strings, and in order to determine transitive dependencies you need to use this string in a map of packages where each string is mapped to its direct dependencies. |
@oheger-bosch, I'd appreciate some feedback here. |
Well, the test handles at least a logic cyclic dependency between some packages; although this does not seem to be a cycle in the form that you encounter. Given that this code has been developed in a test-driven style, there must have been a stage in the implementation in which this test was failing. |
I'd appreciate any proposals for titles then, as to me it's totally unclear what this test is supposed to cover, that is not yet covered by other tests. |
If you want to remove it, I won't object. |
Hmm. IMO we should either make the title match the test code, or make the test code match the title. The latter is what I've originally proposed here, to gain coverage for that case. Somehow this discussion is also going in cycles 😉 |
Sorry, this was not my intention. To move this forward, it is probably necessary to figure out whether there is actually a problem with such cyclic dependencies you create in your modified test (and the stack overflow seems to indicate this). So, do you have any idea why the cycle detection does not work here? The |
77e0f38 to
2d18c93
Compare
Please see my comment above: My assumption was that cycles are not detected / broken unless Or are you saying that cycle detection and breaking of cycles happens at different stages?
I'm not sure (how it's supposed to work exactly). The only place where the set of processed nodes is amended is here, but that code is never hit when running the test. I'd appreciate if you could try to debug the new test as well, as you are way more familiar with the code than I am. |
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 <[email protected]>
2d18c93 to
a592a93
Compare
There is no cycle in the originally defined
dependency chain. Doing so is actually not directly possible with the recursively defined
PackageReferenceclass.Solve that by using a primitive
DependencyHandlerthat just uses indexes to identify dependencies.