|
| 1 | +--- |
| 2 | +"@objectstack/spec": major |
| 3 | +"@objectstack/core": patch |
| 4 | +--- |
| 5 | + |
| 6 | +fix(spec)!: retire the never-built typed-event system; the lifecycle registry now lists the events that actually fire (#4212 follow-up) |
| 7 | + |
| 8 | +The lifecycle-event surface promised a typed-event system that was never |
| 9 | +built, in three layers. `kernel/plugin-lifecycle-events.zod.ts` shipped ten |
| 10 | +payload schemas (`PluginRegisteredEvent`, `PluginErrorEvent`, |
| 11 | +`HookTriggeredEvent`, `KernelReadyEvent`, …) and a 21-name |
| 12 | +`PluginLifecycleEventType` enum — zero consumers for every export, and the |
| 13 | +enum was wrong in both directions: 17 names nothing fires, 10 real events |
| 14 | +missing. `contracts/plugin-lifecycle-events.ts` declared the same 17 dead |
| 15 | +names in `IPluginLifecycleEvents` next to 5 real ones, plus an |
| 16 | +`ITypedEventEmitter` interface nothing implements. All of it read as a |
| 17 | +promise; anyone who coded against it (hooking `plugin:started`, awaiting |
| 18 | +`plugin:error`) registered a handler that could never fire, with no error |
| 19 | +saying so — the same silent-drop shape as the #4212 lifecycle-hook family. |
| 20 | + |
| 21 | +Removed, with zero consumers verified repo-wide: |
| 22 | + |
| 23 | +- `kernel/plugin-lifecycle-events.zod.ts` and every export: `EventPhase`, |
| 24 | + `PluginEventBase`, `PluginRegisteredEvent`, `PluginLifecyclePhaseEvent`, |
| 25 | + `PluginErrorEvent`, `ServiceRegisteredEvent`, `ServiceUnregisteredEvent`, |
| 26 | + `HookRegisteredEvent`, `HookTriggeredEvent`, `KernelEventBase`, |
| 27 | + `KernelReadyEvent`, `KernelShutdownEvent`, `PluginLifecycleEventType` |
| 28 | + (schemas and inferred types). |
| 29 | +- `ITypedEventEmitter` from `contracts/plugin-lifecycle-events.ts`. |
| 30 | +- The 17 never-fired names from `IPluginLifecycleEvents`. |
| 31 | + |
| 32 | +`IPluginLifecycleEvents` is now the registry of the **14 events with a real |
| 33 | +emitter** — `kernel:{ready,bootstrapped,listening,shutdown}`, `app:seeded`, |
| 34 | +`metadata:reloaded` (payload `metadata` now optional, matching the documented |
| 35 | +contract), `external.schema.drift`, `ai:routes`, `auth:configure`, and the |
| 36 | +`{service}:ready` convention family (`mcp`, `automation`, `analytics`, |
| 37 | +`external-datasource`, `datasource-admin`) — each payload as observed at its |
| 38 | +fire site. A new `LifecycleEventName` union types |
| 39 | +`PluginContext.hook`/`trigger` in `@objectstack/core` as |
| 40 | +`LifecycleEventName | (string & {})`: known names autocomplete, custom |
| 41 | +cross-plugin names stay legal, existing callers compile unchanged. A pinning |
| 42 | +test asserts two-way equality between the interface keys and the fire-site |
| 43 | +inventory. |
| 44 | + |
| 45 | +FROM → TO: |
| 46 | + |
| 47 | +- `PluginLifecycleEventType` → `LifecycleEventName` (the union of names that |
| 48 | + fire). There is no runtime enum; the bus is open by design. |
| 49 | +- Event payload schemas (`KernelReadyEvent`, `PluginErrorEvent`, …) → the |
| 50 | + payload tuples on `IPluginLifecycleEvents`. No wire format existed or |
| 51 | + exists; payloads are in-process arguments. |
| 52 | +- `ITypedEventEmitter` → `PluginContext.hook`/`trigger` (the emitter that |
| 53 | + actually exists). |
| 54 | +- Handlers for the 17 dead names → delete them; they never ran. For plugin |
| 55 | + phase observation use the boot report (ADR-0084); for per-plugin errors the |
| 56 | + kernel throws/logs at the failing phase. |
| 57 | + |
| 58 | +Plain deletion rather than `retiredKey()` tombstones, per the #4233 |
| 59 | +precedent: these keys were never authorable — they described runtime event |
| 60 | +payload records no config author can write, so the silent-strip class the |
| 61 | +authorable-surface ratchet guards against is vacuous. Its baseline entries |
| 62 | +and the `json-schema.manifest.json` keys are dropped deliberately in this PR. |
| 63 | +No ADR-0087 conversion: no stack metadata names these types; there is nothing |
| 64 | +for `os migrate meta` to rewrite. |
0 commit comments