Files
core/docs/plans
chrnx 9f72604cbb docs(plans): design the shutdown teardown surface, before any code
Task 2.5 has been open since it was raised while deciding #15, deliberately:
it needs public API, and the API freeze is the next milestone.

Three things the design settles that the task description did not anticipate.

Teardown reaches the graph through hooks, PluginApi and a provider dispose(),
but all three are doors into one registry with one order and one failure
policy. Shipping the plugin half now and providers later would freeze two
mechanisms with different semantics around the less common case: the thing
that holds a database connection is a provider, not a plugin. The hooks
framing also means PluginApi's signature never changes, so nothing breaks at
all, which widening it directly would not have achieved.

Callbacks receive nothing. State lives in the closure that registered it, so
no handle crosses a scope and no container, app reference or transport is
needed. That is what makes this a registry rather than an event bus.

It fires from each runtime's real close, not app.close(), which returns at
its no-server guard on everything except Node. Edge cannot participate at all
and that is documented as a capability difference rather than hidden.

Recorded while verifying: "isolation is structural" protects the registration
surface, not the runtime context. A plugin's step can already overwrite
context keys, and a plugin mounting before provideBuiltins can replace the
logger and rooms builtins. Pre-existing and unrelated to teardown, noted so
the finding outlives the conversation that produced it.

D8, the shared timeout budget, is marked open rather than settled: whether
lowering teardownTimeoutMs reserves its slice or merely caps it was not
decided, and the two differ in whether a slow drain can starve teardown of
the time it needs.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-08-17 10:32:23 -05:00
..