release: host component context contract + filesystem fix#14
Merged
Conversation
Introduce a host-agnostic runtime context so adapters resolve host identity, asset version, and base paths without hard-coding consumer-specific globals. Hosts build an implementation once at boot and register it via the HostContext static registry; adapter helpers (often static, outside the DI graph) read it back and fall back safely when no host has configured one. This is the shared cross-host abstraction backing the WordPress adapter's removal of the MIDDAG_ACCOUNT_* constant coupling. Moodle's ComponentContext stays the moodle-side host-identity seam (conceptually aligned). - src/Kernel/Contract/HostComponentContextInterface.php — componentName / assetVersion / basePath; generic, no Moodle/WordPress assumptions. - src/Kernel/HostContext.php — set/get/reset; get() returns null when unconfigured. - tests/Kernel/HostContextTest.php. Gates: composer check (PHPStan + CS-Fixer + Rector) and composer test (554) green.
Prove a HostComponentContextInterface whose basePath() returns null can be registered and read back through HostContext, exercising the nullable bridge accessor consumers must degrade against.
Add the host component context to the adapter bridge-contract docs and explain how it relates to ComponentNameResolverInterface: they overlap only on the component identifier; the resolver serves boot-failure classification, the context serves neutral runtime lookup.
LocalFilesystem stored the root after rtrim only, so a root carrying an internal slash-slash (e.g. from a base dir already ending in a separator) never matched resolve()'s lexically normalized prefix check and rejected every operation as escaping the root. Collapse repeated separators on construction and cover it with a regression test.
Rector 2.5 flipped withImportNames()'s removeUnusedImports default to true, and its removal is not {@see}-docblock-aware: it strips imports referenced only from docblock {@see} tags, breaking the generated @api xRef links and turning CI's composer check red. Pass removeUnusedImports: false explicitly to restore the pre-2.5 behaviour.
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.
Promotes develop → main to cut 0.11.2 (pre-1.0 patch).
Included
feat(kernel): neutralHostComponentContextInterface+HostContextcomposition-root registry (ba9e492)test(kernel): cover host context with nullbasePathdocs(kernel): document the host-context bridge contract + its relation toComponentNameResolverInterfacefix(filesystem): normalize redundant separators inLocalFilesystemroot (latent confinement bug)build: keep Rector unused-import removal off (2.5 default flip stripped{@see}docblock imports)Gates
composer check(PHPStan L6 + PHP-CS-Fixer + Rector) andcomposer test(556, 1 skip) green on develop (CI run 27932239901).🤖 Generated with Claude Code