CARD-21 (core #126), decision D17 (accepted 2026-10-22: always reserved; Node accepts and closes 1008 like app.upgrade).
Before this change the Node upgrade listener intercepted /__mesh__/control only when a mesh control channel existed. Otherwise it served a user @Ws route there. app.upgrade (Deno, Bun, edge) always checked the path first and closed 1008. So one app behaved differently depending on the runtime.
Boot check (src/http/reserved-paths.ts, new): createApp fails when a @Ws, @Stream or HTTP route claims a reserved path. The error names the declaration and the path, for example route @Ws /__mesh__/control at Routes.h0 uses the reserved path /__mesh__/control (the mesh control channel) — …. A literal pattern is checked by equality and a parameterised one by matchPattern. Mountpoints are included, because the check runs on the joined pattern.
Mesh splice: a route a teapot exports is checked inside spliceRemoteScopes and fails the teacup's boot, naming the teapot URL (T7). A real teapot can't export such a route because its own boot refuses it, so the test uses a hand-rolled teapot.
Node refusal: with no control channel, routeUpgrade accepts the upgrade and closes 1008 with the same reason as app.upgrade. The reason is now one constant, MESH_CONTROL_DISABLED_REASON, in src/mesh/teapot.ts. It is not exported from the barrel.
The helper takes a list of reserved paths so CARD-17 can add /__live__ and /__ready__ (stacked PR to follow).
Frozen capture: needs owner approval
Commit test(router-parity): reserved mesh path refused on Node for CARD-21 (owner approval required) is kept separate on purpose. It is not approved yet.
ws.test.ts: the parity fixture declared @Ws('/__mesh__/control') to capture the old split. Under D17 that route fails createApp, so the fixture drops it. The path stays in UPGRADE_PATHS.
ws-node-upgrade.json: the /__mesh__/control row changes from 101, sent [reserved], close 1005 to 101, sent [], close 1008 "<reason>".
ws-app-upgrade.json is unchanged, although the card expected it to change. app.upgrade already refused the path before matching, so removing the route doesn't change its answer.
Bisect note: the feature commit on its own fails router-parity/ws.test.ts because the fixture route no longer boots. The golden commit fixes that.
Where I was unsure: please decide
Which patterns count as claiming the path. D17 says "any route that can match it". Read literally, that includes /:org/:repo and a /:rest* fallback, which would fail the boot of ordinary apps for a path they never named. I implemented the narrower reading: a route fails only when it matches the path and its first segment is the literal __mesh__. This covers T1–T3, /__mesh__/:rest*, constrained params that accept control, and mountpoints. Broader patterns still boot, and the reserved path is answered before route matching on every adapter, so those routes never see it. If you want the literal reading, it's a one-line change in claimedReservedPath. No existing test uses such a pattern, so the suite can't decide this either way.
Node apps with no @Ws/@Stream routes and no mesh still attach no upgrade listener, as before. There an upgrade to /__mesh__/control reaches the HTTP pipeline, usually a 404, not the 1008 close. Attaching a listener always would change the upgrade answer for every path on such apps, which is outside this card. Tell me if you want it.
Test evidence (local, after rebasing on develop with #134 and #135)
Card cases: T1–T3 plus extra pattern cases, T4 (Node listener, including a mesh app with nothing exported), T5 (app.upgrade) and T7 are in test/reserved-paths.test.ts. T1 and T5 are repeated in test/deno/ws.test.ts, test/bun/ws.test.ts and the workerd run (test/edge/run.ts + worker.ts). T6 is covered by the existing mesh suites (Node, Deno, Bun), which pass unchanged.
npm run lint 0 errors (52 warnings, as before: no-explicit-any)
npm run format:check All matched files use Prettier code style!
npm run typecheck clean
npm test Test Files 93 passed (93) · Tests 926 passed (926)
npm run build ESM/DTS build success
npm run complexity:check every function <= 25
npm run test:deno 37 passed | 0 failed
npm run test:bun 27 pass · 0 fail
npm run test:edge ... + reserved path — PASS; router parity 1158 matcher + 55 app.fetch — PASS
npm audit --audit-level=moderate found 0 vulnerabilities
Docs follow-up (CARD-12)
reference/createapp.md: a "Reserved paths" list with /__mesh__/control (always reserved), plus CARD-17's /__live__ and /__ready__ (when health is on) and the dev routes /__graph__ and /__openapi__. Include the boot-error wording and the first-segment rule from item 1.
Mesh guide: on an app with no control channel, an upgrade to /__mesh__/control closes 1008 on every runtime, and a teapot can't export a route there.
Migration note for the breaking change.
## What and why
CARD-21 (core #126), decision **D17** (accepted 2026-10-22: always reserved; Node accepts and closes `1008` like `app.upgrade`).
Before this change the Node upgrade listener intercepted `/__mesh__/control` only when a mesh control channel existed. Otherwise it served a user `@Ws` route there. `app.upgrade` (Deno, Bun, edge) always checked the path first and closed `1008`. So one app behaved differently depending on the runtime.
- **Boot check** (`src/http/reserved-paths.ts`, new): `createApp` fails when a `@Ws`, `@Stream` or HTTP route claims a reserved path. The error names the declaration and the path, for example `route @Ws /__mesh__/control at Routes.h0 uses the reserved path /__mesh__/control (the mesh control channel) — …`. A literal pattern is checked by equality and a parameterised one by `matchPattern`. Mountpoints are included, because the check runs on the joined pattern.
- **Mesh splice**: a route a teapot exports is checked inside `spliceRemoteScopes` and fails the teacup's boot, naming the teapot URL (T7). A real teapot can't export such a route because its own boot refuses it, so the test uses a hand-rolled teapot.
- **Node refusal**: with no control channel, `routeUpgrade` accepts the upgrade and closes `1008` with the same reason as `app.upgrade`. The reason is now one constant, `MESH_CONTROL_DISABLED_REASON`, in `src/mesh/teapot.ts`. It is not exported from the barrel.
- The helper takes a list of reserved paths so CARD-17 can add `/__live__` and `/__ready__` (stacked PR to follow).
## Frozen capture: needs owner approval
Commit `test(router-parity): reserved mesh path refused on Node for CARD-21 (owner approval required)` is kept separate on purpose. **It is not approved yet.**
- `ws.test.ts`: the parity fixture declared `@Ws('/__mesh__/control')` to capture the old split. Under D17 that route fails `createApp`, so the fixture drops it. The path stays in `UPGRADE_PATHS`.
- `ws-node-upgrade.json`: the `/__mesh__/control` row changes from `101, sent [reserved], close 1005` to `101, sent [], close 1008 "<reason>"`.
- `ws-app-upgrade.json` is **unchanged**, although the card expected it to change. `app.upgrade` already refused the path before matching, so removing the route doesn't change its answer.
- Bisect note: the feature commit on its own fails `router-parity/ws.test.ts` because the fixture route no longer boots. The golden commit fixes that.
## Where I was unsure: please decide
1. **Which patterns count as claiming the path.** D17 says "any route that can match it". Read literally, that includes `/:org/:repo` and a `/:rest*` fallback, which would fail the boot of ordinary apps for a path they never named. I implemented the narrower reading: a route fails only when it matches the path **and** its first segment is the literal `__mesh__`. This covers T1–T3, `/__mesh__/:rest*`, constrained params that accept `control`, and mountpoints. Broader patterns still boot, and the reserved path is answered before route matching on every adapter, so those routes never see it. If you want the literal reading, it's a one-line change in `claimedReservedPath`. No existing test uses such a pattern, so the suite can't decide this either way.
2. **Node apps with no `@Ws`/`@Stream` routes and no mesh** still attach no upgrade listener, as before. There an upgrade to `/__mesh__/control` reaches the HTTP pipeline, usually a 404, not the `1008` close. Attaching a listener always would change the upgrade answer for every path on such apps, which is outside this card. Tell me if you want it.
## Test evidence (local, after rebasing on develop with #134 and #135)
Card cases: T1–T3 plus extra pattern cases, T4 (Node listener, including a mesh app with nothing exported), T5 (`app.upgrade`) and T7 are in `test/reserved-paths.test.ts`. T1 and T5 are repeated in `test/deno/ws.test.ts`, `test/bun/ws.test.ts` and the workerd run (`test/edge/run.ts` + `worker.ts`). T6 is covered by the existing mesh suites (Node, Deno, Bun), which pass unchanged.
```
npm run lint 0 errors (52 warnings, as before: no-explicit-any)
npm run format:check All matched files use Prettier code style!
npm run typecheck clean
npm test Test Files 93 passed (93) · Tests 926 passed (926)
npm run build ESM/DTS build success
npm run complexity:check every function <= 25
npm run test:deno 37 passed | 0 failed
npm run test:bun 27 pass · 0 fail
npm run test:edge ... + reserved path — PASS; router parity 1158 matcher + 55 app.fetch — PASS
npm audit --audit-level=moderate found 0 vulnerabilities
```
## Docs follow-up (CARD-12)
- `reference/createapp.md`: a "Reserved paths" list with `/__mesh__/control` (always reserved), plus CARD-17's `/__live__` and `/__ready__` (when `health` is on) and the dev routes `/__graph__` and `/__openapi__`. Include the boot-error wording and the first-segment rule from item 1.
- Mesh guide: on an app with no control channel, an upgrade to `/__mesh__/control` closes `1008` on every runtime, and a teapot can't export a route there.
- Migration note for the breaking change.
Owner decisions (2026-10-23): frozen capture change in 03bdf42 (ws-node-upgrade.json) approved. Narrow reserved-path check (first segment literally __mesh__) accepted; the no-upgrade-handler gap on Node is accepted and documented. Not merging yet: implementation review first.
Owner decisions (2026-10-23): frozen capture change in 03bdf42 (`ws-node-upgrade.json`) **approved**. Narrow reserved-path check (first segment literally `__mesh__`) accepted; the no-upgrade-handler gap on Node is accepted and documented. Not merging yet: implementation review first.
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.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
Golden update for ws-node-upgrade.json, needs owner approval (CARD-08
rule). The WS parity fixture declared @Ws('/__mesh__/control') to
capture the old adapter split: the Node listener served it (101, the
route's frame, close 1005), app.upgrade refused it (1008). Under D17
that route fails createApp, so the fixture drops it and keeps the path
in UPGRADE_PATHS. The Node row now matches the app.upgrade row: 101, no
frame, close 1008 with the shared reason.
ws-app-upgrade.json is unchanged: app.upgrade already refused the path
before matching, so removing the route does not change its answer.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
Implementation review done on 2026-10-23: a Codex review of all 12 sprint PRs, with each finding verified. The P1s in #142 and the P3 in #149 are fixed. The owner (Chrnx) authorized merging in order, each one rebased on develop with CI green. This supersedes the earlier "not merging yet" note.
Implementation review done on 2026-10-23: a Codex review of all 12 sprint PRs, with each finding verified. The P1s in #142 and the P3 in #149 are fixed. The owner (Chrnx) authorized merging in order, each one rebased on develop with CI green. This supersedes the earlier "not merging yet" note.
chrnx
merged commit 09251496c0 into develop2026-10-23 05:57:07 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What and why
CARD-21 (core #126), decision D17 (accepted 2026-10-22: always reserved; Node accepts and closes
1008likeapp.upgrade).Before this change the Node upgrade listener intercepted
/__mesh__/controlonly when a mesh control channel existed. Otherwise it served a user@Wsroute there.app.upgrade(Deno, Bun, edge) always checked the path first and closed1008. So one app behaved differently depending on the runtime.src/http/reserved-paths.ts, new):createAppfails when a@Ws,@Streamor HTTP route claims a reserved path. The error names the declaration and the path, for exampleroute @Ws /__mesh__/control at Routes.h0 uses the reserved path /__mesh__/control (the mesh control channel) — …. A literal pattern is checked by equality and a parameterised one bymatchPattern. Mountpoints are included, because the check runs on the joined pattern.spliceRemoteScopesand fails the teacup's boot, naming the teapot URL (T7). A real teapot can't export such a route because its own boot refuses it, so the test uses a hand-rolled teapot.routeUpgradeaccepts the upgrade and closes1008with the same reason asapp.upgrade. The reason is now one constant,MESH_CONTROL_DISABLED_REASON, insrc/mesh/teapot.ts. It is not exported from the barrel./__live__and/__ready__(stacked PR to follow).Frozen capture: needs owner approval
Commit
test(router-parity): reserved mesh path refused on Node for CARD-21 (owner approval required)is kept separate on purpose. It is not approved yet.ws.test.ts: the parity fixture declared@Ws('/__mesh__/control')to capture the old split. Under D17 that route failscreateApp, so the fixture drops it. The path stays inUPGRADE_PATHS.ws-node-upgrade.json: the/__mesh__/controlrow changes from101, sent [reserved], close 1005to101, sent [], close 1008 "<reason>".ws-app-upgrade.jsonis unchanged, although the card expected it to change.app.upgradealready refused the path before matching, so removing the route doesn't change its answer.router-parity/ws.test.tsbecause the fixture route no longer boots. The golden commit fixes that.Where I was unsure: please decide
/:org/:repoand a/:rest*fallback, which would fail the boot of ordinary apps for a path they never named. I implemented the narrower reading: a route fails only when it matches the path and its first segment is the literal__mesh__. This covers T1–T3,/__mesh__/:rest*, constrained params that acceptcontrol, and mountpoints. Broader patterns still boot, and the reserved path is answered before route matching on every adapter, so those routes never see it. If you want the literal reading, it's a one-line change inclaimedReservedPath. No existing test uses such a pattern, so the suite can't decide this either way.@Ws/@Streamroutes and no mesh still attach no upgrade listener, as before. There an upgrade to/__mesh__/controlreaches the HTTP pipeline, usually a 404, not the1008close. Attaching a listener always would change the upgrade answer for every path on such apps, which is outside this card. Tell me if you want it.Test evidence (local, after rebasing on develop with #134 and #135)
Card cases: T1–T3 plus extra pattern cases, T4 (Node listener, including a mesh app with nothing exported), T5 (
app.upgrade) and T7 are intest/reserved-paths.test.ts. T1 and T5 are repeated intest/deno/ws.test.ts,test/bun/ws.test.tsand the workerd run (test/edge/run.ts+worker.ts). T6 is covered by the existing mesh suites (Node, Deno, Bun), which pass unchanged.Docs follow-up (CARD-12)
reference/createapp.md: a "Reserved paths" list with/__mesh__/control(always reserved), plus CARD-17's/__live__and/__ready__(whenhealthis on) and the dev routes/__graph__and/__openapi__. Include the boot-error wording and the first-segment rule from item 1./__mesh__/controlcloses1008on every runtime, and a teapot can't export a route there.87d9a0f328to03bdf427d8Owner decisions (2026-10-23): frozen capture change in
03bdf42(ws-node-upgrade.json) approved. Narrow reserved-path check (first segment literally__mesh__) accepted; the no-upgrade-handler gap on Node is accepted and documented. Not merging yet: implementation review first.Golden update for ws-node-upgrade.json, needs owner approval (CARD-08 rule). The WS parity fixture declared @Ws('/__mesh__/control') to capture the old adapter split: the Node listener served it (101, the route's frame, close 1005), app.upgrade refused it (1008). Under D17 that route fails createApp, so the fixture drops it and keeps the path in UPGRADE_PATHS. The Node row now matches the app.upgrade row: 101, no frame, close 1008 with the shared reason. ws-app-upgrade.json is unchanged: app.upgrade already refused the path before matching, so removing the route does not change its answer. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>03bdf427d8to9977d14605Implementation review done on 2026-10-23: a Codex review of all 12 sprint PRs, with each finding verified. The P1s in #142 and the P3 in #149 are fixed. The owner (Chrnx) authorized merging in order, each one rebased on develop with CI green. This supersedes the earlier "not merging yet" note.