Run global plugins in the compiled interceptor's default branch (#28) - #32
Open
pingiun wants to merge 1 commit into
Open
Run global plugins in the compiled interceptor's default branch (#28)#32pingiun wants to merge 1 commit into
pingiun wants to merge 1 commit into
Conversation
Compiled interceptors emitted a `switch (getCurrentScope())` whose `default` branch was whatever scope happened to be grouped last - often an area chain, or a parent-direct fall-through - so plugins declared in the global etc/di.xml were skipped in CLI/primary and in any scope not explicitly enumerated (crontab, webapi_rest, webapi_soap, graphql). Standard Magento merges the global config into every scope, so those plugins must always fire. - AreasPluginList::getPluginsConfigForAllAreas() now always includes the `primary` and `global` scopes, regardless of what Scope::getAllScopes() returns on a given Magento version. - CompiledInterceptor now drives the `switch` `default` branch from the GLOBAL scope's plugin chain and emits an explicit `case` only for scopes whose merged chain differs from global. A class with only global plugins collapses to a plain, switch-free body that always runs them. Adds Test/Unit/CompiledInterceptor/ScopeCasesTest.php locking that the global chain drives `default`, that scopes equal to global collapse into it, and that genuinely area-only plugins keep a parent-direct default. Fixes creatuity#28 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
|
@jakwinkler I made this commit blind, although Claude is confident in it 😬. What do you think of it? |
|
Looks good but I am not the one who can merge it :-) |
Author
|
Yeah just wanted to check since you opened the issue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Compiled interceptors put the last-grouped scope in the
switchdefaultbranch, so plugins declared in the globaletc/di.xmlwere skipped in CLI/primaryand any scope not explicitly enumerated (crontab,webapi_rest,webapi_soap,graphql, custom scopes). Standard Magento merges the global config into every scope, so those plugins must always fire.This drives the
defaultbranch from the global plugin chain (always aggregatingprimary+global, independent ofScope::getAllScopes()) and emits an explicitcaseonly for scopes whose merged chain differs. A class with only global plugins collapses to a plain, switch-free body. Includes a unit test.Fixes #28.
🤖 Generated with Claude Code