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

[Issue] Dependency checker does not work properly when enabling modules #38606

Open
4 of 5 tasks
m2-assistant bot opened this issue Apr 10, 2024 · 4 comments · May be fixed by #38600
Open
4 of 5 tasks

[Issue] Dependency checker does not work properly when enabling modules #38606

m2-assistant bot opened this issue Apr 10, 2024 · 4 comments · May be fixed by #38600
Labels
Area: Framework Component: Module Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: ready for confirmation Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: PR in progress Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@m2-assistant
Copy link

m2-assistant bot commented Apr 10, 2024

This issue is automatically created based on existing pull request: #38600: Dependency checker does not work properly when enabling modules


Description (*)

Enabling / disabling modules is prepared to avoid leaving modules status in a inconsistent state, regarding its dependencies declared in composer.json, so:

  • It should not allow disabling a module that enabled modules depend on. (This case is working properly)
  • It should not allow enabling a module that depends on a disabled module. (This case is not working)

Given Module_A and Module_B, and a declared relation of Module_B => Module_A, I should not be able to enable Module_B without enabling Module_A, but I am:

❯ bin/magento module:disable Module_B Module_A
No modules were changed.
❯ bin/magento module:enable Module_B
The following modules have been enabled:
- Module_B

Cache cleared successfully.
Generated classes cleared successfully. Please run the 'setup:di:compile' command to generate classes.
Info: Some modules might require static view files to be cleared. To do this, run 'module:enable' with the --clear-static-content option to clear them.

Technical Details

DependencyChecker needs to use a PackageInfo instance that uses FullModuleList (as already done at ConflictChecker::__construct) in order to work, so constructor is changed to use PackageInfoFactory::create() implementation which creates PackageInfo instance with FullModuleList embedded (instead of standard ModuleList).

Related Pull Requests

None AFAIK.

Fixed Issues (if relevant)

None AFAIK.

Manual testing scenarios (*)

  1. Create 2 simple modules in app/code, Module_A and Module_B; only registration.php, module.xml and composer.json files are required.
{
    "name": "module/module-a",
    "require": {
    }
}
{
    "name": "module/module-b",
    "require": {
        "module/module-a": "*"
    }
}
  1. Try disabling both modules, then enabling the dependent one without enabling the dependency.

Before the change:

❯ bin/magento module:disable Module_B Module_A
No modules were changed.
❯ bin/magento module:enable Module_B
The following modules have been enabled:
- Module_B

Cache cleared successfully.
Generated classes cleared successfully. Please run the 'setup:di:compile' command to generate classes.
Info: Some modules might require static view files to be cleared. To do this, run 'module:enable' with the --clear-static-content option to clear them.

After the change:

❯ bin/magento module:disable Module_B Module_A
No modules were changed.
❯ bin/magento module:enable Module_B
Unable to change status of modules because of the following constraints:
Cannot enable Module_B because it depends on disabled modules:
Module_A: Module_B->Module_A

The other case keeps working:

❯ bin/magento module:enable Module_A Module_B
The following modules have been enabled:
- Module_A
- Module_B

Cache cleared successfully.
Generated classes cleared successfully. Please run the 'setup:di:compile' command to generate classes.
Info: Some modules might require static view files to be cleared. To do this, run 'module:enable' with the --clear-static-content option to clear them.
❯ bin/magento module:disable Module_A
Unable to change status of modules because of the following constraints:
Cannot disable Module_A because modules depend on it:
Module_B: Module_B->Module_A

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)
@m2-assistant m2-assistant bot linked a pull request Apr 10, 2024 that will close this issue
6 tasks
@m2-community-project m2-community-project bot added this to Ready for Confirmation in Issue Confirmation and Triage Board Apr 10, 2024
@m2-community-project m2-community-project bot added Issue: ready for confirmation Priority: P2 A defect with this priority could have functionality issues which are not to expectations. labels Apr 10, 2024
@engcom-Bravo engcom-Bravo added Reported on 2.4.x Indicates original Magento version for the Issue report. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it labels Apr 10, 2024
@m2-community-project m2-community-project bot added this to Pull Request In Progress in High Priority Backlog Apr 10, 2024
@m2-community-project m2-community-project bot removed this from Ready for Confirmation in Issue Confirmation and Triage Board Apr 10, 2024
@engcom-November engcom-November self-assigned this Apr 16, 2024
Copy link
Author

m2-assistant bot commented Apr 16, 2024

Hi @engcom-November. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-November
Copy link

Hello @adrian-martinez-onestic,

Thank you for the report and collaboration!

Verified this on 2.4-develop.
With Module_B being dependent on Module_A, we cannot enable Module_B without enabling Module_A.
Hence this issue can be confirmed.

Thank you.

@engcom-November engcom-November added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Component: Module Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Framework labels Apr 16, 2024
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-11803 is successfully created for this GitHub issue.

Copy link
Author

m2-assistant bot commented Apr 16, 2024

✅ Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Framework Component: Module Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: ready for confirmation Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: PR in progress Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
High Priority Backlog
  
Pull Request In Progress
Development

Successfully merging a pull request may close this issue.

3 participants