fix(mesh): reconnect to a teapot that came back, refusing a manifest that no longer fits
A dropped link stayed dead for the life of the process. Every RPC answered 503 until the teacup restarted, so deploying a teapot forced a restart of every teacup depending on it and boot order became load-bearing — a worse operational property than any gap the docs actually listed. The Link now outlives any single socket, because the graph captured its rpc closure at boot and a reconnect that produced a new Link would leave the graph pointing at the dead one. Backoff doubles from 500ms to 30s with full jitter, so teacups that went down together do not return in lockstep. A returning teapot whose manifest no longer exports what the graph was validated against is refused, not adopted: that graph is already serving, and a token cannot be validated away after the fact. The link keeps retrying, since a partial deploy may still restore it, and logs once per distinct manifest rather than once per attempt. Refusal ships as a named policy (onManifestChange: 'refuse') so hot reconciliation can arrive later as an addition rather than as a change of what the default means — these are separate processes on separate deploy cadences. close() is terminal. closeLinks runs on shutdown, and a link that reconnected after the application hung up would leave a process that cannot exit. Also closes the documented gap where an app-scope export outlived its teapot with a stale value: a successful reconnect re-registers those bindings, so the next resolve re-runs the RPC. That invalidation is a named function rather than inline, because it is the seam a future 'reconcile' reuses. Tested on all three runtimes rather than on Node alone — Node's ws package, Deno's global WebSocket and Bun's server-level socket handler are three implementations, and swapping a socket under a live graph is where they stop agreeing. 7 of the 9 new Node tests were verified to fail against the old code; the 2 that pass are the ones that should, since the old code never reconnected at all. Mesh stays alpha. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
8 files changed
+819
-57
No files matched your search
@@ -8,6 +8,28 @@ npm treats versions as semver and semver forbids leading zeros.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- **A mesh teacup now reconnects to a teapot that came back.** A dropped link used to stay dead for
|
||||
the life of the process: every RPC answered 503 until the teacup was restarted, so deploying a
|
||||
teapot forced a restart of every teacup that depended on it, and boot order became load-bearing.
|
||||
Links now reconnect with exponential backoff and jitter (500ms doubling to 30s), tunable through
|
||||
`mesh: { reconnect: { initialDelayMs, maxDelayMs } }` and disabled with `reconnect: false`.
|
||||
`close()` is terminal — a link the application hung up on never reconnects, so `app.close()` cannot
|
||||
leave a process that refuses to exit.
|
||||
|
||||
A returning teapot whose manifest no longer exports something the graph was validated against at
|
||||
boot is **refused** rather than adopted, named by `mesh: { onManifestChange: 'refuse' }`, which is
|
||||
the default and currently the only policy. The link keeps retrying, since a partial deploy may
|
||||
still restore it, and logs the refusal once per distinct manifest rather than once per attempt.
|
||||
Serving against a manifest that no longer backs the graph would surface as a 500 that looks like
|
||||
application code. Extra exports in a returning manifest are ignored: the graph is fixed at boot.
|
||||
|
||||
This also closes the documented gap where **an app-scope export outlived its teapot with a stale
|
||||
value** — a successful reconnect re-registers those bindings, so the next resolve re-runs the RPC.
|
||||
|
||||
Mesh remains **alpha** and behind `experimental: true`.
|
||||
|
||||
## [26.8.0-beta.1] - 2026-08-17
|
||||
|
||||
### Added
|
||||
|
||||
Reference in new issue
Block a user