fix(framework): normalize plugin list cache ID generation#40499
fix(framework): normalize plugin list cache ID generation#40499lbajsarowicz wants to merge 1 commit intomagento:2.4-developfrom
Conversation
|
Hi @lbajsarowicz. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
|
The security team has been informed about this pull request due to the presence of risky security keywords. For security vulnerability reports, please visit Adobe's vulnerability disclosure program on HackerOne or email psirt@adobe.com. |
|
@magento run all tests |
Sort scopes alphabetically before creating cache IDs to ensure consistency between compile-time (PluginListGenerator) and runtime (PluginList) generation. This allows pre-compiled plugin metadata files to be loaded correctly, improving performance after cache:flush. Fixes magento#40407
987fa1a to
27c9a74
Compare
|
@magento run all tests |
|
Doesn't this duplicate this fix: #40408 ? |
|
Closing as duplicate of #40408 by @jakwinkler, which addresses the same plugin list cache ID normalization issue with a similar sorting approach. Their PR was submitted first (Jan 2026). |
Description
Sort scopes alphabetically before creating cache IDs in both
PluginListandPluginListGeneratorto ensure compile-time and runtime cache IDs match.Root Cause:
The cache IDs generated at compile-time (
PluginListGenerator::write()) didn't match runtime (PluginList::_loadScopedData()) because:primary|globalvsglobal|primarydepending on which scope loaded firstSolution:
Normalize cache IDs by sorting scopes alphabetically before creating the ID. This ensures cache IDs are deterministic regardless of processing order, allowing pre-compiled plugin metadata files (~600KB+) to be loaded correctly and eliminating 1-2 second delays on first request after cache:flush.
Related Pull Requests
None
Fixed Issues (if relevant)
Manual testing scenarios
bin/magento setup:di:compileand verify plugin-list files are generated ingenerated/metadata/bin/magento cache:flushPluginList::_loadScopedData()before$configData = $this->configLoader->load($cacheId):generated/metadata/Questions or comments
Unit tests pass:
vendor/bin/phpunit lib/internal/Magento/Framework/Interception/Test/Unit/PluginList/PluginListTest.phpContribution checklist
⭐ Support my work
Do you like the fix? Remember to react with "👍🏻" to get it merged faster,
Then Sponsor me on Github so I can spend more time on fixing issues like this one.
Learn more at https://github.com/sponsors/lbajsarowicz