Skip to content
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

Bugfix/broken submodule topological sort #242

Merged

Conversation

ajwittmond
Copy link
Contributor

@ajwittmond ajwittmond commented Dec 21, 2023

This is a bugfix for a subtle issue in the topological sorting of nested submodules.
The issue occurs when

  1. Submodules are nested at least 2 deep
  2. A module imports a another module, traversing up 2 levels (such as mod1.a imports mod2.b)
  3. One of the modules upstream of the module that does this is named such that its name is lexographically less than the aforementioned module

This issue occurs due to the fact that when sorting submodules, the external modules are not included in the sort however they are still returned from get_upstream_dependencies! This breaks the algorithms and causes nodes with these dependencies to not be processed and instead be falsely identified as cyclical dependencies.

The result of this is that the generated files have the wrong import order, which results in undefined references.

I have added and example of this occurring to the tests.

@ajwittmond ajwittmond marked this pull request as draft December 21, 2023 23:40
Copy link

codecov bot commented Dec 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (97f55ed) 92.34% compared to head (0b4bd35) 92.73%.
Report is 1 commits behind head on master.

❗ Current head 0b4bd35 differs from pull request most recent head 272b8fd. Consider uploading reports for the commit 272b8fd to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #242      +/-   ##
==========================================
+ Coverage   92.34%   92.73%   +0.39%     
==========================================
  Files          25       25              
  Lines        2807     2808       +1     
==========================================
+ Hits         2592     2604      +12     
+ Misses        215      204      -11     

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

@ajwittmond ajwittmond marked this pull request as ready for review December 21, 2023 23:50
@Drvi
Copy link
Collaborator

Drvi commented Jan 3, 2024

Hey @ajwittmond, thanks so much for your contribution, and sorry for the delay with my review. This is a great catch and I really appreciate you figuring out what went wrong and how to fix it. After a bit of investigation, I think the crux of the issue is that we didn't specify the upstream dependencies for internal modules correctly (which you solved by removing the bad dependencies), I tweaked the logic to generate the right dependencies to begin with.

Could you please check if the new version still fixes the original issue you encountered? Thanks again.

@ajwittmond
Copy link
Contributor Author

I have confirmed that the new changes fix the original issue and agree that passing all of the relevant dependencies to the sort as nodes is a better solution. Thank you for addressing this.

@Drvi Drvi merged commit 80a1e9b into JuliaIO:master Jan 4, 2024
5 of 8 checks passed
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