Skip to content

Fix invalid preferences #297

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

Merged

Conversation

fredden
Copy link
Member

@fredden fredden commented Jun 8, 2021

Description

These preferences are defined in XML but the classes they reference do not exist (in production mode). This is blocking progress on magento/magento2#33161

Fixed Issues

Manual testing scenarios

No visible changes should be apparent with this change.

Questions or comments

None

Contribution checklist

  • Author has signed the Adobe CLA
  • 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)
  • All automated tests passed successfully (all builds are green)

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

2 similar comments
@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@@ -40,7 +40,6 @@
<preference for="Magento\TwoFactorAuth\Api\DuoAuthenticateInterface" type="Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity\Authenticate"/>
<preference for="Magento\TwoFactorAuth\Api\Data\DuoDataInterface" type="Magento\TwoFactorAuth\Model\Data\Provider\Engine\DuoSecurity\Data"/>
<preference for="Magento\TwoFactorAuth\Api\U2fKeyConfigReaderInterface" type="Magento\TwoFactorAuth\Model\Provider\Engine\U2fKey\ConfigReader"/>
<preference for="OTPHP\TOTPInterface" type="OTPHP\TOTP"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

This class isn't within scope for dependency injection.

Screenshot_2021-06-15_22-38-40

From what I can tell, this is used as a return type in Magento\TwoFactorAuth\Model\Provider\Engine\Google::getTotp() and Magento\TwoFactorAuth\Model\Provider\Engine\Google\TotpFactory::create(), and as a mock in Magento\TwoFactorAuth\Test\Unit\Model\Provider\Engine\GoogleTest::setUp(). None of these seem to need a Magento preference.

@nathanjosiah
Copy link
Contributor

@fredden Thank you for your contribution! I think the PR looks ok except for a comment I left in the di.xml file. Please take a look at that and I think we can move this forward.

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@nathanjosiah
Copy link
Contributor

@magento run all tests with 2.4.3-develop

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@nathanjosiah
Copy link
Contributor

@magento run all tests against 2.4.3-develop

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@nathanjosiah
Copy link
Contributor

@fredden Looks like there are still some errors in the integration tests and the static tests.

@nathanjosiah
Copy link
Contributor

@fredden If you want to work on this let me know, there are still valid failures in the builds which I have highlighted. I will close this for now.

@fredden
Copy link
Member Author

fredden commented Jun 24, 2021

@nathanjosiah Please can you re-open this. I don't seem to have a button to do so myself. This definitely needs to be fixed.

The error showing up that seems related to this change is:

Data set: app/code/Magento/TwoFactorAuth/Plugin/BypassTwoFactorAuthForTestFramework.php
Module Magento\TwoFactorAuth has external dependencies: hard [Magento\TestFramework]
/var/www/html/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php:572
/var/www/html/lib/internal/Magento/Framework/App/Utility/AggregateInvoker.php:56
/var/www/html/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php:575

It doesn't feel right to put a runtime dependency on the test framework. The required class is distributed as part of magento/magento2-base. What's the best approach for resolving this?

I can see that the same test is reporting a number of similar issues in other modules. Perhaps that's something that should be resolved in a separate pull request?

Module Magento\ReCaptchaCheckout has undeclared dependencies: hard [Magento\QuoteGraphQl]
Module Magento\ReCaptchaCustomer has undeclared dependencies: hard [Magento\CustomerGraphQl, Magento\Integration]
Module Magento\ReCaptchaNewsletter has undeclared dependencies: hard [Magento\NewsletterGraphQl]
Module Magento\ReCaptchaPaypal has undeclared dependencies: hard [Magento\PaypalGraphQl]
Module Magento\ReCaptchaReview has undeclared dependencies: hard [Magento\ReviewGraphQl]
Module Magento\ReCaptchaSendFriend has undeclared dependencies: hard [Magento\SendFriendGraphQl]

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@nathanjosiah
Copy link
Contributor

@magento run all tests against 2.4.4

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

1 similar comment
@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@nathanjosiah
Copy link
Contributor

@fredden Looks like everything is green except the static test (https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/security-package/pull/297/72113ff36dd11533a11b1852965b0149/Statics/allure-report-ce/index.html#categories/ace6c7944747e2a66397aa9d447b7430/fa91d33adabf7a98/) which doesn't like the hard dep in your new plugin.

app/code/Magento/TwoFactorAuth/Plugin/BypassTwoFactorAuthForTestFramework.php Module Magento\TwoFactorAuth has external dependencies: hard [Magento\TestFramework] /var/www/html/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php:572 /var/www/html/lib/internal/Magento/Framework/App/Utility/AggregateInvoker.php:56 /var/www/html/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php:575

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

1 similar comment
@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@fredden
Copy link
Member Author

fredden commented Jul 22, 2021

I've changed the namespace for the plugin to see if this makes the static test happier. This doesn't seem to change the functionality any. (ie, this still fixes the bug in this module, and is compatible with the setup:di:compile check/safe-guard being introduced in the linked pull request.) I don't know if this will fix the static test or not; I suspect there's logic to ignore certain paths as the original Observer has exactly the same dependencies on the TestFramework.

I've triggered test runs for v2.4.4 (as @nathanjosiah has done previously) and the main branches (from the linked pull request so all the other related pull requests are included in the build).

@nathanjosiah
Copy link
Contributor

The 2.4.4 tests are all green and the DB compare job is failing here and here but they are both about the magento_giftregistry_data table which is clearly not from this PR. I am pulling this ticket in for QA and internal processing.

@magento-engcom-team
Copy link

@nathanjosiah, an error occurred during the Pull Request import.

@nathanjosiah
Copy link
Contributor

@magento-engcom-team
Copy link

@nathanjosiah the branch with code successfully imported intomagento-commerce/security-package repository. Branch name: imported-magento-security-package-297.

1 similar comment
@magento-engcom-team
Copy link

@nathanjosiah the branch with code successfully imported intomagento-commerce/security-package repository. Branch name: imported-magento-security-package-297.

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

5 similar comments
@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to Plugin to \Magento\TwoFactorAuth\Observer\ControllerActionPredispatch
4 participants