-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Make the module list more deterministic #21020
Conversation
Hi @ajardin. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked test cases:
- standalone 3rd party module
- three 3rd party modules with mutual dependencies
- Magento module that had a dependency on 3rd party (including prev test cases)
Hi @vpodorozh, thank you for the review. |
Hi @ajardin, thank you for your contribution! |
Thanks @ajardin! |
foreach ($origList as $moduleName => $value) { | ||
foreach (array_keys($modules) as $moduleName) { | ||
$sequence = $this->expandSequence($origList, $moduleName); | ||
asort($sequence); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would make more sense to add this call into
$result = array_unique(array_merge($result, $relatedResult));
Great, @ajardin, as I pointed out in #8479 (comment) there is no such thing as "deterministic" in general, having big enough amount of third-party modules the same issue will be observed after the fix. However, in reality there are much more core modules than external ones, thus generally diffs should become cleaner. |
I've found that the modules ranking in the
app/etc/config
is not completely deterministic as a module addition will affect the ranking of unrelated modules. This generates a lot of conflicts when starting a Magento project since many modules are likely to be added.Description (*)
I tried the changes proposed in #16120 at first, but the implementation was likely incomplete as I was still able to reproduce the issue. So, I came to the conclusion that we need to sort the sequence of each module AND to put all Magento modules at the top of the list before performing the bubble sorting. There is no impact on the prioritization process itself. However by keeping third-party modules together, we will mitigate the impact of a module addition because it will be naturally added at the end of the list without messing Magento modules ranking. I've also added a specific unit test.
Fixed Issues (if relevant)
Manual testing scenarios (*)
setup:upgrade
.app/etc/config.php
file.setup:upgrade
.app/etc/config.php
file, but the ranking of several unrelated modules is also affected.Contribution checklist (*)