Repository navigation
Description
Outcome
The WordPress anti-patterns and lifecycle mistakes that docs/design-principles.md names, and that review still has to catch by hand today, fail the checks instead: output echoed outside views, raw values printed unescaped, collaborators pulled from globals, work in service constructors, services nobody declares, unsatisfiable or misordered dependencies, registration actions that never fire, unprefixed names in WordPress's shared spaces, static access to the plugin from inside the object graph, and type names that encode their kind rather than their concept (#94).
Why now
The original review found manual gaps and an unescaped raw backend sample. Those original 13 child tasks are now closed; #79/#114 fixed the sample. The completion-audit gap was filed as #162 and is now fixed by #165. The principle-13 table names serviceIdsPrefixed for declared service-map keys; prefixedNames continues to cover WordPress registration names. Runtime-filter-added IDs and the value of VIEW_OVERRIDE_DIRECTORY remain explicit manual boundaries, outside this epic's declared-ID criterion.
Shared context
- Same machinery and message contract as epic Epic: Misusing the scaffold's architecture fails fast, with a message that says what to do instead #43:
RuleManifest,docs/architecture-rules.md, PHPStan rules intests/php/PHPStan/Rule/with fixtures intests/php/PHPStan/Fixture/, settings underparameters.architectureinphpstan.neon.dist. - Composition-root checks extend
tests/php/Architecture/CompositionRootContract.php. - Existing related rules:
noContextChecksInRegister(configured list atphpstan.neon.dist,hooks.contextFunctions),prefixedNames(prefixedNames.<kind>),noHooksInConstructor,noStaticState. - Related behaviour bugs live under Epic: The infrastructure honours its design principles and absorbs fixes proven in production #18: infrastructure: service registration silently skips services and cannot report unsatisfiable dependencies #20 (unsatisfiable dependencies), infrastructure: services cannot receive the injector without a static locator #22 (injecting the injector), views: theme overrides are not scoped to the plugin #29 (theme override paths).
Constraints and non-goals
- No baselines, no broad ignores; small behaviour-neutral fixes land with their rule, anything larger is filed against Epic: The infrastructure honours its design principles and absorbs fixes proven in production #18 and blocks the rule.
- Rulings (maintainer, 2026-10-23): the service-locator rule is tooling: feature services never look up collaborators in the container or reconfigure the injector #92 (no
ServiceContainerin subsystems,Injector::make()only), and tooling: reach the plugin factory only from the main plugin file and listed edge bridges #86 allows the plugin factory at listed edge bridges; the falsy-return rule is the narrowT|falseban in tooling: forbid return types that union false with a value #91; interfaces-only service constructor parameters are declined, because principle 4's rule of thumb argues against forced abstractions anddependencyDirectionalready covers cross-layer dependencies. docs: clarify hooks-only integration and defer an additional public PHP API #93 is closed with the hooks-only public integration policy. The view-context proposal is views: investigate context methods exposed through the rendering scope #145 (needs decision); a future multi-extension API is infrastructure: investigate a public API for multi-extension access #144 (needs use-case). Neither approves a global-functions/facade exception or blocks the prefix check here. - PHP 7.4 floor for everything under
tests/.
Breakdown
The original 13 native children (#77–#86, #91, #92 and #94) are closed. The added #162 is also closed through #165. All 14 native children are closed. Its check reads the configured SERVICE_PREFIX, reports invalid declarations without resolving them, and covers valid, invalid, empty-prefix and generated-prefix roots; the catalogue/table update has landed.
Definition of done
- Every sub-issue is closed.
- The "Reviewed by hand" column of
docs/architecture-rules.mdno longer lists "collaborators pulled from globals" or "HTML echoed from business logic" for principle 7, nor "prefixes of service identifiers" for principle 13.
Verification
For each child implementation, run composer test:architecture, composer test and composer lint in the reference CI environments (PHP 8.3 for lint; PHP 7.4 and 8.3 for tests). composer lint already runs test:phpstan-rules. Assert each new check's diagnostic against a failing fixture and verify its permitted counterpart passes; do not weaken a gate to make the tree pass. At epic completion, verify every native child is closed and review the catalogue/principle rows against the definition of done.
Completion audit (main 61a9b00)
- All 14 native children are closed.
- docs/architecture-rules.md:130 no longer leaves globals or output from business logic to manual review; noGlobalState and outputOnlyThroughViews cover them.
- docs/architecture-rules.md:136 names serviceIdsPrefixed, and :176-200 documents declared-ID coverage and the runtime-filter boundary. CompositionRootContract.php:181-213 implements the check.
- Isolated PHP 8.3.36 verification: composer test:architecture passes (214 tests, 584 assertions); composer lint passes, including 132 PHPStan rule tests.
Impact on generated plugins
Tests and tool configuration only, plus the sample-view escaping fix. Generated plugins inherit the checks.
Updated 2026-10-23: Confirmed all 13 original children closed, but retained the unmet service-ID-prefix completion criterion. Filed/attached #162; updated sample/public-API status. Architecture tests/lint pass, but this epic remains open with 13/14 children closed.
Updated 2026-10-23: Verified all 14 native children closed and #165 implements the declared-ID prefix check, generated-prefix fixtures and catalogue update. Both definition-of-done bullets now hold; architecture tests (214/584) and lint pass on current main/PHP 8.3. Close the completed epic.
Activity
schlessera commentedon Oct 23, 2026
Triage (2026-10-23): Reconciled 13 open native children including #94, reflected the maintainer’s context-object investigation direction in #93, and added reference-CI verification. Existing rulings in #86/#91/#92/#94 are preserved; no new policy is approved.
schlessera commentedon Oct 23, 2026
Triage (2026-10-23): Confirmed all 13 original children closed, but retained the unmet service-ID-prefix completion criterion. Filed/attached #162; updated sample/public-API status. Architecture tests/lint pass, but this epic remains open with 13/14 children closed.
schlessera commentedon Oct 23, 2026
Triage (2026-10-23): Verified all 14 native children closed and #165 implements the declared-ID prefix check, generated-prefix fixtures and catalogue update. Both definition-of-done bullets now hold; architecture tests (214/584) and lint pass on current main/PHP 8.3. Close the completed epic.