Skip to content

Add creatuity/magento2-interceptors as a bundled extension #206

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

rhoerr
Copy link
Contributor

@rhoerr rhoerr commented Apr 11, 2025

I propose adding Creatuity_Interception as a bundled module with the upcoming Mage-OS 1.1.0. https://github.com/creatuity/magento2-interceptors

  • It provides a meaningful and quantifiable performance improvement for all Magento Open Source sites, in the area of 10%;
  • It is safe and battle tested, having been in frequent production use since 2019, including over 49k composer installs, and including all ParadoxLabs client sites I maintain;
  • It is widely known and trusted;
  • It is well maintained, with negligible open issues (rare or debatable edge cases).

Implications

  • Mage-OS will have a new compiled_plugins cache type to be enabled or disabled on sites (optional opt-in)
  • When enabled, compiling will result in interceptors being written into the generated/ folder with explicit calls to each plugin
  • Adding or changing plugins during development requires clearing the compiled interceptors
  • It changes stack traces for plugins, since they are now called directly, allowing for more direct understanding and debugging of execution paths involving plugins

Risks

  • Minimal: It's widely used and a drop-in replacement for default interceptors.
  • Magento has not merged it to date due to the architectural implications on the core. That's not a concern to us, partly because we're not Magento, partly because it's well proven, partly because it's a separate package that's easily disabled.
  • There is a report of case-insensitive conflicts between plugins (where one plugin on a class has pluginname and another has pluginName on the same class, only one will be compiled and executed). I've never seen this situation arise, and would argue it's bad practice in the first place.
  • There is a report of inability to disable plugins in one scope but not another. This may have been since resolved in core, and could not be reproduced on 2.4.7.

Benefits

  • 10% improvement in server response times, on average.

PR

This PR results in the module being added as a pinned require of mage-os/product-community-edition like:

    "creatuity/magento2-interceptors": "1.3.5",

which composer will then require via packagist, like any other third party package (Monolog, Laminas, Symphony, ...).

@rhoerr rhoerr requested a review from a team as a code owner April 11, 2025 03:40
Copy link
Contributor

@fballiano fballiano left a comment

Choose a reason for hiding this comment

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

agree 100%

@furan917
Copy link

furan917 commented Apr 11, 2025

I love this addition. However I have a confidence check.

There is a report of inability to disable plugins in one scope but not another. This may have been since resolved in core, and could not be reproduced on 2.4.7.

Is there any current standing area where this is reproduced? Absence of reproduction isn't always an indicator of working as intended, as it may be specific edgecases, but if there's a somewhere that has reproducible steps to show it was an issue in 2.4.X-px (x=Whatever the latest version as of the first report) and now we see those steps no longer reproduce I'd be all for it.

I only bring this up because it reads not as "We confidently can say this no longer exists" and more of "We believe but have no confirmation".


Update: Confident Mels PR solves the issue from local testing

@rhoerr
Copy link
Contributor Author

rhoerr commented Apr 11, 2025

Is there any current standing area where this is reproduced? Absence of reproduction isn't always an indicator of working as intended, as it may be specific edgecases, but if there's a somewhere that has reproducible steps to show it was an issue in 2.4.X-px (x=Whatever the latest version as of the first report) and now we see those steps no longer reproduce I'd be all for it.

You can see the tracking issue or help out at creatuity/magento2-interceptors#14 .

@fballiano fballiano merged commit 9a2ae50 into mage-os:main Apr 14, 2025
1 check 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.

4 participants