Skip to content

release: host component context contract + filesystem fix#14

Merged
michaelmeneses merged 5 commits into
mainfrom
develop
Jun 22, 2026
Merged

release: host component context contract + filesystem fix#14
michaelmeneses merged 5 commits into
mainfrom
develop

Conversation

@michaelmeneses

Copy link
Copy Markdown
Contributor

Promotes develop → main to cut 0.11.2 (pre-1.0 patch).

Included

  • feat(kernel): neutral HostComponentContextInterface + HostContext composition-root registry (ba9e492)
  • test(kernel): cover host context with null basePath
  • docs(kernel): document the host-context bridge contract + its relation to ComponentNameResolverInterface
  • fix(filesystem): normalize redundant separators in LocalFilesystem root (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) and composer test (556, 1 skip) green on develop (CI run 27932239901).

🤖 Generated with Claude Code

michaelmeneses and others added 5 commits June 14, 2026 06:49
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.
@michaelmeneses michaelmeneses merged commit e5fc48d into main Jun 22, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant