feat: the manifest names the event holder, so a host reads the events without constructing the manager - #43
Merged
Conversation
… without constructing the manager Measured on cattle (greenhouse evidence/0567): with every emitter declaring at construction, events:catalogue in a CLI process listed 7 of the family's 24 framework events. An emitter declares when it is BUILT, and a CLI run never builds most of them — the catalogue answered for the process, not for the app. PluginEvents now implements Milpa\Interfaces\Event\DeclaresEvents (milpa/core 0.12) and composer.json names it under extra.milpa.events, the same way a capability already names its operation provider (greenhouse evidence/0565). A host reading vendor/composer/installed.json can resolve the holder and declare these four lifecycle events on behalf of a PluginsManager the running process will never construct. No event name, key or declaration content changed. The falsifier measures the manifest on disk, not the prose about it: it reads the package's own composer.json, asserts the listed holders exist and implement the contract, and compares the declarations reached THROUGH the manifest against the holder's own. Dropping a letter from the FQCN turns it red (two failures and an error); restoring it turns it green.
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.
Greenhouse
decisions/0228, second slice — a package declares its events in its manifest.What the first slice measured
With every emitter declaring at CONSTRUCTION,
events:catalogueon fresh cattle listed 7 of thefamily's 24 framework events (greenhouse
evidence/0567). That is not a bug in the catalogue: aCLI process never builds a
ToolRegistry, aJsonRpcService, aProcessRunner, and never renders alive component. The catalogue answered for the process, not for the app.
What this changes here
milpa/corefloor raised to>=0.12 <1.0(the release that carriesMilpa\Interfaces\Event\DeclaresEvents).Only
milpa/coremoved:v0.11.0 => v0.12.0.Milpa\Plugin\Event\PluginEvents— the package's existing declarations holder — nowimplements DeclaresEvents.Its
declarations()was already static and already there; this only makes the contract visible.composer.jsongainsextra.milpa.eventsnaming that holder, mirroring how a capability already namesits operation provider in its manifest (greenhouse
evidence/0565, read byCapabilities::declaredBy()from
vendor/composer/installed.json). A host can now declarecapability.resolved,plugin.booting,plugin.bootedandkernel.bootedon behalf of aPluginsManagerthis process never constructs.No event name, payload key, or declaration content changed.
The falsifier
tests/Event/TheManifestNamesTheEventHolderSoAHostNeedNotConstructTheEmitterTest.phpmeasures themanifest ON DISK, not the prose about it: it reads the package's own
composer.jsonfrom the packageroot, asserts
extra.milpa.eventslists exactly this package's holder, that each named class exists andis_a(..., DeclaresEvents::class, true), and that calling::declarations()on the class named in themanifest reaches the same set of names the holder declares.
Proven it can fail: dropping the trailing
sfrom the FQCN incomposer.jsonturned it red —2 failures + 1 error (
The manifest names holders other than this package's/«…\PluginEvent», which no autoloader can resolve). Restoring the letter turned it green (3 tests, 23 assertions).Gates
composer validate --strictvalid · phpunit 414 tests / 1218 assertions OK · phpstan[OK] No errors·docblocks OK (152 public methods) · php-cs-fixer 0 of 95 fixable · attribution OK ·
coverage 94.18% against a floor of 94.