docs(mesh): warn on shadowed remote routes, and tell the truth about mesh
Local routes are merged ahead of remote ones, so a local twin wins. That precedence is worth keeping — your own code beating an imported one is how you override a teapot — but it was an accident of [...local, ...remote] ordering with nothing said, so a shadowed export looked like a broken teapot from the outside. Warn, name the teapot, and leave the call to the developer. The docs had gone stale in the way that started all of this. runtimes.md claimed four times that mesh is Node-only; the mesh guide said finalization is deferred to listen(); the changelog said "WebSocket and mesh remain Node-only". All false now. The mesh guide gains what was enforced but never written down — which is how the listen() trap got made in the first place, when the previous plan's "document it" never landed: - runs on Node/Deno/Bun, teapot and teacup, any combination; not on edge, and why - no listen() required: the graph boots on first use - buffered routes only, and why streams cannot cross an RPC hop - one teapot per route, local-over-remote precedence, and the protocol version Refs .specs/2026-07-15-green-tea-mesh-cross-runtime-plan.md Task 9 Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
5 files changed
+159
-11
No files matched your search
@@ -503,6 +503,19 @@ async function spliceRemoteScopes(
|
||||
}
|
||||
|
||||
routeOwners.set(key, teapot.url);
|
||||
|
||||
// Local routes are merged ahead of remote ones (see buildHttpRoutes), so a local twin
|
||||
// wins. That precedence is deliberate — your own code beats an imported one, and it is
|
||||
// how you override a teapot — but silently shadowing an export looks exactly like a
|
||||
// broken teapot from the outside. Warn and let the developer decide.
|
||||
if (registry.routePlans.some((plan) => plan.method === route.method && plan.pattern === route.pattern)) {
|
||||
console.warn(
|
||||
`[green-tea] mesh: route '${key}' is exported by teapot ${teapot.url} but also declared locally — ` +
|
||||
'the local route takes precedence and the remote one will not be reached. ' +
|
||||
'Remove one if that is not what you meant.',
|
||||
);
|
||||
}
|
||||
|
||||
remoteRoutes.push({
|
||||
method: route.method,
|
||||
pattern: route.pattern,
|
||||
|
||||
Reference in new issue
Block a user