feat(mesh)!: reserve /__mesh__/control on every adapter (CARD-21, #126)
The Node upgrade listener only intercepted /__mesh__/control when a mesh control channel was configured; otherwise a user @Ws route there was served. app.upgrade (Deno, Bun, edge) always checked the path first and closed 1008. The same app therefore worked on Node and was refused everywhere else. D17 makes the path reserved in every app, mesh or not: - createApp fails when a @Ws, @Stream or HTTP route claims the path, naming the declaration. A literal pattern is checked by equality, a parameterised one (/__mesh__/:x, /__mesh__/:rest*) by matching the reserved path against it. Patterns whose first segment is not the literal __mesh__ (/:org/:repo, /:rest*) still boot: the adapters answer the path before route matching, so those routes never see it. - A route exported by a teapot is checked during the teacup splice. - The Node listener, with no control channel, accepts the upgrade and closes 1008 with the reason app.upgrade gives. The reason is now one shared constant. The check lives in src/http/reserved-paths.ts so CARD-17 can add /__live__ and /__ready__ to the same list. BREAKING CHANGE: an app that declares a route at /__mesh__/control, or a pattern under /__mesh__/ that matches it, now fails createApp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
10 files changed
+481
-7
No files matched your search
@@ -58,6 +58,22 @@ npm treats versions as semver and semver forbids leading zeros.
|
||||
constraints at a later segment of an otherwise unreachable route. The route then boots, as
|
||||
before.
|
||||
|
||||
- **`/__mesh__/control` is reserved in every app, mesh or not** (#126). A `@Ws`, `@Stream` or HTTP
|
||||
route that claims it — `@Ws('/__mesh__/control')`, `@Get('/__mesh__/control')`,
|
||||
`@Ws('/__mesh__/:x')`, `/__mesh__/:rest*`, or a mountpoint that adds up to one of these — now
|
||||
fails `createApp`, naming the declaration and the reserved path. A route exported by a teapot is
|
||||
checked the same way, and fails the teacup's boot. Before, the Node listener served a user route
|
||||
there whenever no mesh control channel was configured, while `app.upgrade` (Deno, Bun, the edge)
|
||||
always refused it, so the same route worked on one runtime and not the others. A pattern whose
|
||||
first segment is not the literal `__mesh__` (`/:org/:repo`, `/:rest*`) still boots; the reserved
|
||||
path is answered ahead of the route table on every runtime, so such a route never sees it.
|
||||
|
||||
An upgrade to `/__mesh__/control` on an app with no control channel is now refused identically
|
||||
everywhere: the Node listener accepts it and closes `1008` with
|
||||
`mesh control channel not enabled: this app exports nothing, or has no mesh.secret`, as
|
||||
`app.upgrade` already did. An app with no `@Ws`/`@Stream` routes and no mesh attaches no upgrade
|
||||
listener on Node, as before, so there the request still reaches the HTTP route table.
|
||||
|
||||
### Added
|
||||
|
||||
- **`limits.maxWsMessageBytes` and `limits.maxWsQueue`** (#107): per-connection bounds on inbound
|
||||
|
||||
Reference in new issue
Block a user