13.0.0 — Performance, autowire caching, stampede-safe cache#489
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Major release focused on improving runtime performance by caching autowire/service discovery results, reducing repeated per-request computations, and adding stampede-safe manifest cache rebuilds.
Changes:
- Added production and development service-class caches, plus reflection/autowire performance improvements.
- Reduced repeated work during block registration/rendering and various helpers via request-lifetime memoization.
- Made manifest cache rebuild stampede-safe via advisory
flock()locking.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Main/Autowiring.php | Autowire build optimizations (reflection cache, transitive deps work queue, primitive defaults handling). |
| src/Main/AbstractMain.php | Service registration loop refactor; dev/prod service cache read/write; namespace mtime invalidation. |
| src/Helpers/TailwindTrait.php | Breakpoints memoization; tighter types; debug-prefix slug caching. |
| src/Helpers/StoreBlocksTrait.php | Request-lifetime memoization of global settings manifest lookup. |
| src/Helpers/SelectorsTrait.php | Route selector serialization through Helpers::clsx(); reduce string concatenation. |
| src/Helpers/RenderTrait.php | Remove handler table; direct dispatch; cache default render path name and file existence checks. |
| src/Helpers/PathsTrait.php | Spread-based path composition; new (faster) “file vs folder” detection logic. |
| src/Helpers/GeneralTrait.php | Perf/typing tweaks; JSON parsing via JSON_THROW_ON_ERROR; request-lifetime URL caching. |
| src/Helpers/CssVariablesTrait.php | Build CSS output via implode; escape <style id>; optimize breakpoint matching and caching. |
| src/Helpers/CacheTrait.php | Stampede-safe manifest cache rebuild using advisory flock() with double-checked load. |
| src/Helpers/AttributesTrait.php | Add PROPS_PASSTHROUGH_KEYS; optimize merges; tighter return types; attrs output via implode. |
| src/Exception/ComponentException.php | Adjust object-vs-non-object error message branching. |
| src/Blocks/AbstractBlocks.php | Hoist settings/wrapper lookups; thread shared context; memoize camel/kebab conversions. |
| composer.json | Dev dependency bumps for PHPCS installer and coding standards. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…cy queue Agent-Logs-Url: https://github.com/infinum/eightshift-libs/sessions/302f0961-7f41-467c-bea3-114424bfc3a3 Co-authored-by: iruzevic <23283324+iruzevic@users.noreply.github.com>
Agent-Logs-Url: https://github.com/infinum/eightshift-libs/sessions/6659a92b-522f-40af-9d1c-621ced7ccd8c Co-authored-by: iruzevic <23283324+iruzevic@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
goranalkovic-infinum
previously approved these changes
May 15, 2026
kancijan
previously approved these changes
May 15, 2026
dadadavorin
previously approved these changes
May 15, 2026
adding change log
f1b91d4
iruzevic
added a commit
that referenced
this pull request
May 29, 2026
* 13.0.0 — Performance, autowire caching, stampede-safe cache (#489) * major improvement on the speed security * Adopt Rector, raise dev tooling baseline, sweep docblocks - Bump infinum/eightshift-coding-standards to ^4.0.1, raise PHPCS minimum WP to 8.4 - Add Rector with project config and rector/fix scripts; drop php-parallel-lint - Add phpstan-deprecation-rules and roave/security-advisories - Apply Rector sweep across the library: constructor promotion, ::class, callable arrow syntax, type-narrowing, drop redundant @return docblocks - Refresh 13.0.0 changelog entry to reflect the above Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * updates for the latest changes on main branch * updates for the latest changes on main branch * update * updates * updates * updates * updates * updates --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Major release focused on autowire performance, request-lifetime caching, and a stampede-safe manifest cache rebuild. Touches
AbstractMain/Autowiring,AbstractBlocksregistration, and most helper traits.Highlights
{Namespace}ServiceClasses.jsoncache that sits next to the compiled PHP-DI container; dev gets a separate cache keyed by the namespace mtime and disabled under WP-CLI so scaffolding still sees freshly added classes.foreach-with-reference into an explicit work queue.CacheTrait::populateCacheData()rebuilds under an advisoryflock()with a double-checked load on contention.Helpers::getSettings()and wrapper attribute lookups out of the per-block loop, and memoizes camel↔kebab conversions in the recursive attribute walk.StoreBlocksTrait::getSettings(),TailwindTrait::getTwBreakpoints(), the defaultRenderTraitpath name, and template-file existence checks.Added
{Namespace}ServiceClasses.jsoncache + dev{Namespace}DevServiceClasses.jsoncache (mtime-invalidated, disabled in CLI).flock()-based stampede protection inCacheTrait::populateCacheData().Autowiringnow accepts primitive constructor parameters with default values instead of throwing.ReflectionClasscache across the autowire build.AttributesTrait::PROPS_PASSTHROUGH_KEYSconstant for the special keys propagated throughprops().Changed
Autowiringconstructor parameters promoted toreadonly; redundantAbstractMain::__construct()removed (inherits fromAutowiring).Autowiring::buildServiceClasses()resolves transitive deps via a work queue instead of mutating the array under aforeachreference.AbstractBlocks::registerBlocks()threads a shared$context(blockClassPrefix, settings/wrapper attributes) intoregisterBlock()/getAttributes()so it no longer recomputes per block.prepareComponentAttribute/prepareComponentAttributesmemoize camel↔kebab and emit one varargsarray_mergeinstead of a chain.RenderTraitdrops the$renderHandlersindirection in favor of direct dispatch, caches defaultrenderPathName, and memoizes filesystem existence checks.TailwindTrait::unifyClasses()/processOption()/getTwBreakpoints()andAttributesTrait::checkAttr()(now: mixed).CssVariablesTrait::outputCssVariablesGlobalClean()builds output via a singleimplode();outputCssVariablesGlobal/outputCssVariablesInlinepass IDs throughesc_attr().PathsTrait::joinPaths()uses an inlinestrrposextension check;getProjectPaths()uses spread-operator path composition.GeneralTrait::isValidXml()collapsed to a single check;flattenArray()preserves all non-nullscalars;recursiveArrayFind()annotated asarray<int, mixed>.SelectorsTraitserializers useimplode()and route throughHelpers::clsx()directly.ComponentException::throwNotStringOrArray()inverted to useis_object().dealerdirect/phpcodesniffer-composer-installer→1.2.1,infinum/eightshift-coding-standards→^3.1.0.Removed
RenderTrait::initializeRenderCaches()and the$renderHandlerslookup table.AbstractMain::__construct()(promotedAutowiringconstructor is used instead).Fixed
Autowiring::buildClasses()filename regex now requires.phpto terminate the filename (previouslyFoo.phpinfowould have matched).Autowiring/AbstractMaindirectory walks skip.and..viaRecursiveDirectoryIterator::SKIP_DOTS.CssVariablesTraitcallsHelpers::getSettingsGlobalVariablesBreakpoints()instead ofself::so the trait works when consumed by classes that don't import that helper directly.wp_json_encode()of the manifest payload on the cache write path.flattenArray()no longer drops legitimate falsy scalars (0,false,'').QA
AbstractMain:eightshift-cache/{Namespace}ServiceClasses.jsonis written and reused on subsequent requests.{Namespace}DevServiceClasses.jsonon the next request (mtime bump).wp boilerplate create-…) still picks up newly added services — dev cache must be bypassed in CLI..lockfile appears alongside it.composer installsucceeds with the new PHPCS installer + coding-standards versions;composer run-script standards-checkis clean.<style id="…">markup matches previous output for the same global settings, withidnowesc_attr'd.Helpers::flattenArray()consumers that previously relied on0/false/''being dropped — confirm none in your project.