@fuzdev/fuz_app 0.177.0 → 0.178.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -770,14 +770,13 @@ runs after server context is assembled so action lists can depend on
770
770
  `ctx.deps` / `ctx.action_*_rate_limiter`. Each entry is auto-mounted via
771
771
  `register_action_ws` against the assembled Hono app.
772
772
 
773
- `create_upgrade_websocket: (app: Hono) => UpgradeWebSocket` returns the
774
- Hono adapter helper. It is a factory because Node's `createNodeWebSocket({app})`
775
- needs the app `create_app_server` builds: it is called once, with that app
776
- (the same instance as `AppServer.app`), after the app exists and before the
777
- mount — and only when `ws_endpoints` resolves non-empty. Bun passes
778
- `() => upgradeWebSocket`. `create_app_server` throws when `ws_endpoints`
779
- resolves non-empty but the factory is missing; a factory returning `[]` does
780
- NOT trip the check, so feature-flag gated WS surfaces stay safe.
773
+ `upgrade_websocket: UpgradeWebSocket` is the Hono runtime adapter's
774
+ module-level helper — `upgradeWebSocket` from `@hono/bun`, or from
775
+ `@hono/node-server` on Node, whose `serve` must then be given a `ws`
776
+ `WebSocketServer` built with `noServer: true` (`websocket: {server}`).
777
+ `create_app_server` throws when `ws_endpoints` resolves non-empty but the
778
+ helper is missing; a `ws_endpoints` factory returning `[]` does NOT trip the check, so
779
+ feature-flag gated WS surfaces stay safe.
781
780
 
782
781
  What every auto-mount gets, so no hand mount has to remember it: the
783
782
  `action_ip_rate_limiter` / `action_account_rate_limiter` instances the RPC
@@ -873,7 +872,7 @@ HTTP RPC also calls. The socket session owns only WS-specific concerns:
873
872
  - **Wire envelope parsing** — `parse_json_text` (`http/json_text.ts`: what the Rust spine's `serde_json` refuses is a `parse_error` here too) → batch rejection → `classify_jsonrpc_message` (`http/jsonrpc_helpers.ts`, the twin of the Rust `fuz_http::classify`, the same classifier the HTTP POST path runs) → per-arm handling: an `invalid` answers its error on its id; a `response` routes to the socket's pending peer request; a `notification` routes `cancel` and is otherwise dropped; a `request` goes on to the duplicate-id and in-flight checks and dispatch. The classifier runs the twin's order — version, then the `method` axis, then `id`, then the `JsonrpcRequest` envelope — so `{method: 'x'}` and `{jsonrpc: '1.0', method: 'x'}` answer `invalid_request` rather than being dropped as notifications; a response is the twin's shape exactly (no string `method`, a string/number `id`, exactly one of `result` / `error`), so a hybrid like `{method, id, result}` stays a dispatchable request; and `params: null`, an array `params`, or a non-string/number `id` answers `invalid_request` (-32600) on both transports rather than reaching the dispatcher as `invalid_params`. Notifications stay unvalidated (they carry no id to echo). A non-object frame answers `id: null`. POST answers a notification or a response `invalid_request` on `id: null`, as the Rust spine does.
874
873
  - **Cancel-notification interception** — `{request_id → AbortController}` map; aborts the matching pending controller before the cancel bubbles past the dispatcher
875
874
  - **Duplicate live ids refused** — a request whose id names a request still running on the socket is answered `invalid_request` with `data.reason` `ERROR_DUPLICATE_REQUEST_ID` and not dispatched; the running request keeps its controller, its cancel entry, and its reply id. An id is free again once its request is answered. Same refusal on the Rust spine
876
- - **In-flight ceiling** — at most `MAX_INBOUND_DISPATCHES_PER_CONNECTION` (128) requests run at once per socket (`@hono/node-ws` does not await `onMessage`, so nothing else bounds them); one more is answered `queue_overflow` (`WS_INBOUND_DISPATCH_OVERFLOW_MESSAGE`) and not dispatched, and the socket stays open and keeps reading — a reply to a server-initiated request still gets through. The duplicate check runs first; neither refusal reaches `perform_action`, so neither charges the action rate limiters. Same cap, message, and order as the Rust spine's `MAX_INBOUND_DISPATCHES_PER_CONNECTION`
875
+ - **In-flight ceiling** — at most `MAX_INBOUND_DISPATCHES_PER_CONNECTION` (128) requests run at once per socket (`@hono/node-server` does not await `onMessage`, so nothing else bounds them); one more is answered `queue_overflow` (`WS_INBOUND_DISPATCH_OVERFLOW_MESSAGE`) and not dispatched, and the socket stays open and keeps reading — a reply to a server-initiated request still gets through. The duplicate check runs first; neither refusal reaches `perform_action`, so neither charges the action rate limiters. Same cap, message, and order as the Rust spine's `MAX_INBOUND_DISPATCHES_PER_CONNECTION`
877
876
  - **Socket-scoped notify** — `(method, params) => registry.send_to(connection_id, notification)`, threaded into `perform_action` as `notify`
878
877
  - **Every send through the registry** — responses, error frames, and notifications all go through `registry.send_to`, so they are held to the connection's outbound budget; a handler that sends past it closes its own socket with `WS_CLOSE_OUTBOUND_OVERFLOW` and gets no response written
879
878
  - **Composed abort signal** — `AbortSignal.any([socket_close, per_request_cancel])`, threaded as `signal`
@@ -919,7 +918,7 @@ the registry after the mount returns, releasing it when assembly fails or
919
918
  the server closes.
920
919
 
921
920
  Because `onOpen` awaits, an adapter can deliver `onMessage` before admission
922
- (`@hono/node-ws` doesn't await `onOpen` at all). Those frames are **queued, not
921
+ (`@hono/node-server` doesn't await `onOpen` at all). Those frames are **queued, not
923
922
  dispatched** — nothing runs on a credential that has not been re-read — and
924
923
  dispatch in arrival order, back to back, once the socket is admitted and
925
924
  `on_socket_open` has completed; a refusal drops them unread. The Rust spine
@@ -941,7 +940,7 @@ returns (it times out); start such a request without awaiting it.
941
940
 
942
941
  **A server-closed socket dispatches nothing.** An adapter can keep delivering
943
942
  frames after the server calls `ws.close(…)`, until the close handshake
944
- completes — `@hono/node-ws` does, for up to the `ws` close timeout when the
943
+ completes — `@hono/node-server` does, for up to the `ws` close timeout when the
945
944
  client withholds its close frame. So every server-side close removes the
946
945
  connection from the registry and aborts the socket's controller **at close
947
946
  time**: the registry does both for a revocation or a cap eviction, and
@@ -980,7 +979,7 @@ and reaches `on_effect_error` (`create_app_server` threads its own to the
980
979
  endpoints it mounts) with `{transport: 'ws', method, path}`. Nothing orders that
981
980
  flush against other frames: frames on an admitted socket are not serialized
982
981
  (`handle_frame` calls aren't chained, and an adapter need not await
983
- `onMessage` — `@hono/node-ws` doesn't), so a message's effects can still be
982
+ `onMessage` — `@hono/node-server` doesn't), so a message's effects can still be
984
983
  in flight when the caller reads its reply and when the next message
985
984
  dispatches. A test that reads the audit log after a WS reply awaits
986
985
  `_testing_drain_effects` first, over an emitter built with
@@ -94,7 +94,7 @@
94
94
  * ## A server-closed socket dispatches nothing
95
95
  *
96
96
  * A runtime adapter can keep delivering inbound frames after the server calls
97
- * `ws.close(…)`, until the close handshake completes (`@hono/node-ws` does —
97
+ * `ws.close(…)`, until the close handshake completes (`@hono/node-server` does —
98
98
  * up to the `ws` close timeout when the client withholds its close frame).
99
99
  * So every server-side close — revocation, cap eviction, heartbeat timeout,
100
100
  * an oversized message, a refused admission — removes the connection from the
@@ -160,7 +160,7 @@ export declare const PRE_ADMISSION_QUEUE_BYTES_FACTOR = 4;
160
160
  * stays open, and the requests already running keep answering.
161
161
  *
162
162
  * A runtime adapter can hand frames over without awaiting the previous one's
163
- * dispatch (`@hono/node-ws` does not await `onMessage`), so without a ceiling
163
+ * dispatch (`@hono/node-server` does not await `onMessage`), so without a ceiling
164
164
  * one socket could hold any number of handlers — and their pooled database
165
165
  * work — at once. Shedding rather than queueing keeps the socket reading, so a
166
166
  * reply to a server-initiated request still reaches the handler awaiting it.
@@ -94,7 +94,7 @@
94
94
  * ## A server-closed socket dispatches nothing
95
95
  *
96
96
  * A runtime adapter can keep delivering inbound frames after the server calls
97
- * `ws.close(…)`, until the close handshake completes (`@hono/node-ws` does —
97
+ * `ws.close(…)`, until the close handshake completes (`@hono/node-server` does —
98
98
  * up to the `ws` close timeout when the client withholds its close frame).
99
99
  * So every server-side close — revocation, cap eviction, heartbeat timeout,
100
100
  * an oversized message, a refused admission — removes the connection from the
@@ -161,7 +161,7 @@ export const PRE_ADMISSION_QUEUE_BYTES_FACTOR = 4;
161
161
  * stays open, and the requests already running keep answering.
162
162
  *
163
163
  * A runtime adapter can hand frames over without awaiting the previous one's
164
- * dispatch (`@hono/node-ws` does not await `onMessage`), so without a ceiling
164
+ * dispatch (`@hono/node-server` does not await `onMessage`), so without a ceiling
165
165
  * one socket could hold any number of handlers — and their pooled database
166
166
  * work — at once. Shedding rather than queueing keeps the socket reading, so a
167
167
  * reply to a server-initiated request still reaches the handler awaiting it.
@@ -667,7 +667,7 @@ export const create_ws_socket_events = (endpoint, upgrade) => {
667
667
  };
668
668
  return {
669
669
  onOpen: async (_event, ws) => {
670
- // An adapter may not await this (`@hono/node-ws` doesn't), so it
670
+ // An adapter may not await this (`@hono/node-server` doesn't), so it
671
671
  // must never reject.
672
672
  try {
673
673
  await open_socket(ws);
@@ -319,39 +319,28 @@ export interface AppServerOptions {
319
319
  */
320
320
  rpc_endpoints?: Array<RpcEndpointSpec> | ((context: AppServerContext) => Array<RpcEndpointSpec>);
321
321
  /**
322
- * Returns the Hono runtime adapter's `upgradeWebSocket` helper for the
323
- * assembled app. `create_app_server` calls it once, with the app it
324
- * builds (the same instance as `AppServer.app`), after creating the app
325
- * and before mounting `ws_endpoints` — and only when `ws_endpoints`
326
- * resolves non-empty, so it is never called for a server with no
327
- * WebSocket endpoints. Required in that case: assembly throws without it.
328
- * One helper services every mounted endpoint.
322
+ * The Hono runtime adapter's `upgradeWebSocket` helper, which services
323
+ * every mounted `ws_endpoints` entry. Required when `ws_endpoints`
324
+ * resolves non-empty — assembly throws without it — and unused otherwise.
329
325
  *
330
- * A factory rather than the helper itself because Node's adapter needs
331
- * the app: `@hono/node-ws` has no module-level helper, only
332
- * `createNodeWebSocket({app})`, and `create_app_server` is what builds
333
- * the app. Bun's ignores the argument:
326
+ * Bun's is `upgradeWebSocket` from `@hono/bun`, whose `websocket` goes
327
+ * to `Bun.serve`. Node's is `upgradeWebSocket` from `@hono/node-server`,
328
+ * which upgrades only on a server given a `ws` `WebSocketServer` built
329
+ * with `noServer: true`; cap its `maxPayload` near the endpoint's
330
+ * `max_message_bytes`, since `ws` defaults to 100 MiB:
334
331
  *
335
332
  * ```ts
336
- * import {upgradeWebSocket} from '@hono/bun';
337
- * create_upgrade_websocket: () => upgradeWebSocket,
333
+ * import {serve, upgradeWebSocket} from '@hono/node-server';
334
+ * import {WebSocketServer} from 'ws';
335
+ * const server = await create_app_server({..., upgrade_websocket: upgradeWebSocket});
336
+ * const wss = new WebSocketServer({noServer: true, maxPayload: 2 * max_message_bytes});
337
+ * serve({fetch: server.app.fetch, port, websocket: {server: wss}});
338
338
  * ```
339
339
  *
340
- * Node keeps the adapter so it can attach to the server after `serve()`:
341
- *
342
- * ```ts
343
- * let node_ws: NodeWebSocket | undefined;
344
- * const server = await create_app_server({
345
- * ...,
346
- * create_upgrade_websocket: (app) => (node_ws = createNodeWebSocket({app})).upgradeWebSocket,
347
- * });
348
- * node_ws?.injectWebSocket(serve({fetch: server.app.fetch, port}));
349
- * ```
350
- *
351
- * Test harnesses pass `() => stub.upgradeWebSocket` with
340
+ * Test harnesses pass `stub.upgradeWebSocket` with
352
341
  * `create_stub_upgrade` from `testing/ws_round_trip.ts`.
353
342
  */
354
- create_upgrade_websocket?: (app: Hono) => UpgradeWebSocket;
343
+ upgrade_websocket?: UpgradeWebSocket;
355
344
  /**
356
345
  * WebSocket endpoint specs — single source of truth for both surface
357
346
  * generation *and* live dispatch. Each entry is auto-mounted via
@@ -369,7 +358,7 @@ export interface AppServerOptions {
369
358
  * form when action lists depend on `ctx.deps` — e.g. when spreading
370
359
  * `create_standard_rpc_actions({...ctx.deps, notification_sender})` over WS.
371
360
  *
372
- * When non-empty, `create_upgrade_websocket` must be supplied (throws
361
+ * When non-empty, `upgrade_websocket` must be supplied (throws
373
362
  * otherwise). A factory returning `[]` does NOT trip the check —
374
363
  * feature-flag gated WS surfaces stay safe.
375
364
  *
@@ -1 +1 @@
1
- {"version":3,"file":"app_server.d.ts","sourceRoot":"","sources":["../../src/lib/server/app_server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,EAEN,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,uB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G;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAEpC,aAAa,CAAC,uBAAuB,CAAC,CAAC;AAE5C;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACpC,2DAA2D;IAC3D,IAAI,EAAE,eAAe,CAAC;IACtB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC,uBAAuB,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9D;;;OAGG;IACH,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,GACjC,SAAS,IAAI,CAAC,gBAAgB,EAAE,uBAAuB,GAAG,eAAe,CAAC,KACxE,oBAkBF,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACtC,6EAA6E;IAC7E,cAAc,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,SAAS,CAAC;IAC1D,2CAA2C;IAC3C,iBAAiB,EAAE,eAAe,CAAC;IACnC,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC,uBAAuB,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC;IACnE,uFAAuF;IACvF,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACzC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GACtC,OAAO,sBAAsB,KAC3B,KAAK,CAAC,oBAAoB,CA0D5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,iBAAiB,GAAU,SAAS,gBAAgB,KAAG,OAAO,CAAC,SAAS,CAQpF,CAAC"}
@@ -414,18 +414,18 @@ const assemble_app_server = async (options, releases) => {
414
414
  const resolved_ws_endpoints = resolve_ws_endpoints(typeof options.ws_endpoints === 'function'
415
415
  ? options.ws_endpoints(context)
416
416
  : options.ws_endpoints, { allowed_origins: options.allowed_origins, rpc_endpoints: resolved_rpc_endpoints });
417
- // the endpoints to mount and the adapter factory they need — null when none resolve
417
+ // the endpoints to mount and the adapter helper they need — null when none resolve
418
418
  let ws_mount = null;
419
419
  if (resolved_ws_endpoints?.length) {
420
- const create_upgrade_websocket = options.create_upgrade_websocket;
421
- if (create_upgrade_websocket === undefined) {
422
- throw new Error('create_app_server: ws_endpoints resolved non-empty but create_upgrade_websocket is missing. ' +
423
- "Pass a factory returning the Hono adapter's upgradeWebSocket helper.");
420
+ const upgrade_websocket = options.upgrade_websocket;
421
+ if (upgrade_websocket === undefined) {
422
+ throw new Error('create_app_server: ws_endpoints resolved non-empty but upgrade_websocket is missing. ' +
423
+ "Pass the Hono adapter's upgradeWebSocket helper.");
424
424
  }
425
425
  for (const endpoint of resolved_ws_endpoints) {
426
426
  assert_endpoint_in_auth_scope('ws_endpoints', endpoint.path);
427
427
  }
428
- ws_mount = { endpoints: resolved_ws_endpoints, create_upgrade_websocket };
428
+ ws_mount = { endpoints: resolved_ws_endpoints, upgrade_websocket };
429
429
  }
430
430
  // The one revocation listener, registered when a WS endpoint or the audit
431
431
  // stream is mounted — on the backend's closer, so it reaches every member:
@@ -584,9 +584,7 @@ const assemble_app_server = async (options, releases) => {
584
584
  // matches the "WS mount is route registration" mental model.
585
585
  const mounted_ws_endpoints = {};
586
586
  if (ws_mount) {
587
- // the adapter helper — built from this app, which Node's
588
- // `createNodeWebSocket({app})` needs, and only when there is something to mount
589
- const upgrade_websocket = ws_mount.create_upgrade_websocket(app);
587
+ const { upgrade_websocket } = ws_mount;
590
588
  for (const endpoint of ws_mount.endpoints) {
591
589
  const { registry: endpoint_registry } = register_action_ws({
592
590
  app,
@@ -2482,7 +2482,7 @@ audit stream); a `/password` cell pins that route's 401 beside `/logout`'s.
2482
2482
  Each case asserts the status and the body — flat `{error}` or the JSON-RPC
2483
2483
  envelope's `error.data`. A WS refusal's body is required where the backend
2484
2484
  declares `capabilities.ws_refusal_body`; where it doesn't (Node's
2485
- `@hono/node-ws` drops the body), an empty body passes on its status and a sent
2485
+ `@hono/node-server` drops the body), an empty body passes on its status and a sent
2486
2486
  one is still asserted. The table
2487
2487
  is the exported `transport_composition_cases` data. `multi_actor:
2488
2488
  {setup_test, xfail?}` adds `transport_composition_multi_actor_cases`, run on
@@ -3004,12 +3004,12 @@ in-process leg is on the drained setup of `conformance_participation.db.test.ts`
3004
3004
 
3005
3005
  The reusable shape for standing up a **spawnable TS** cross-process test
3006
3006
  binary (the TS analog of the Rust `testing_spine_stub`), so consumers don't
3007
- re-roll the serve / daemon-info / WS-attach / drain boilerplate:
3007
+ re-roll the serve / daemon-info / drain boilerplate:
3008
3008
 
3009
- - `testing/cross_backend/testing_server_core.ts` — `start_testing_server({adapter, daemon_name, host, port, app_version?, build_app})`. Owns the runtime-neutral orchestration: open-host refusal, stale-daemon check, daemon-info write, `serve`, post-serve WS attach, graceful shutdown. Domain-free — the app is the caller's `build_app(context: BuildTestingAppContext): Promise<BuiltTestingApp>` seam (`{app, close}`). WebSocket endpoints mount through `create_app_server`'s `ws_endpoints` on every runtime: the build calls `context.prepare_websocket({max_message_bytes?})`, which asks the adapter for a `PreparedWebsocket` (`{create_upgrade_websocket: (app) => UpgradeWebSocket, attach_to_server?}`) and returns its factory, to pass as `create_upgrade_websocket`; the core runs each `attach_to_server` once `serve` returns (Node's `injectWebSocket`). Shutdown starts the listener's `shutdown` (stop accepting), runs `close` — which must end live WebSockets, as `AppServer.close` does — then awaits the drain, since open sockets would otherwise hold it. Exports the `TestingServerAdapter` (`prepare_websocket: (options?: PrepareWebsocketOptions) => PreparedWebsocket`) / `ServeHandle` / `PreparedWebsocket` / `PrepareWebsocketOptions` / `BuildTestingAppContext` interfaces.
3009
+ - `testing/cross_backend/testing_server_core.ts` — `start_testing_server({adapter, daemon_name, host, port, app_version?, build_app})`. Owns the runtime-neutral orchestration: open-host refusal, stale-daemon check, daemon-info write, `serve`, graceful shutdown. Domain-free — the app is the caller's `build_app(context: BuildTestingAppContext): Promise<BuiltTestingApp>` seam (`{app, close}`). WebSocket endpoints mount through `create_app_server`'s `ws_endpoints` on every runtime: the build calls `context.prepare_websocket({max_message_bytes?})`, which has the adapter prepare its WebSocket support for `serve` and returns the runtime's `upgradeWebSocket`, to pass as `upgrade_websocket`. Shutdown starts the listener's `shutdown` (stop accepting), runs `close` — which must end live WebSockets, as `AppServer.close` does — then awaits the drain, since open sockets would otherwise hold it. Exports the `TestingServerAdapter` (`prepare_websocket: (options?: PrepareWebsocketOptions) => UpgradeWebSocket`) / `ServeHandle` / `PrepareWebsocketOptions` / `BuildTestingAppContext` interfaces.
3010
3010
  - `testing/daemon_info.ts` — the `~/.{name}/run/daemon.json` plumbing the core's stale-daemon check and daemon-info write use: `DaemonInfo` (a strict `@fuzdev/fuz_schema` object), `get_app_dir`, `get_daemon_info_path`, `write_daemon_info` (atomic), `read_daemon_info`, `is_daemon_running` (`probe_process`, signal 0 with no program spawned; another user's process or a pid naming no single process reads as not running).
3011
- - `testing/cross_backend/testing_server_node.ts` — `create_node_testing_adapter()` (`@hono/node-server` + `@hono/node-ws`). Optional peer deps (like `ws`); only test binaries import them. Its factory sets the `ws` server's `maxPayload` to twice `max_message_bytes` (default `DEFAULT_WS_MAX_MESSAGE_BYTES`) — `@hono/node-ws` takes no option for it, and `ws`'s own default is 100 MiB — so a grossly oversized message is refused at the frame layer (`WS_CLOSE_MESSAGE_TOO_BIG` with no reason) before it is buffered whole, while one just over the limit reaches the per-message check, which sends `WS_CLOSE_MESSAGE_TOO_BIG_REASON` as every other backend does. Bun's adapter sets the same multiple as its frame cap (see below).
3012
- - `testing/cross_backend/testing_server_bun.ts` — `create_bun_testing_adapter()` (`Bun.serve` + `@hono/bun`'s module-level `getConnInfo`, `upgradeWebSocket`, and `websocket`; `Bun.serve` declared locally so it typechecks under the Node toolchain). Needs the optional `@hono/bun` peer dep (the counterpart to Node's `@hono/node-server` + `@hono/node-ws`; `Bun.serve` is built in). Reuses `create_node_runtime` (Bun implements the `node:fs`/`node:process` surface). WS is module-level + stateless — the `websocket` handler is threaded into `serve`, where `Bun.serve` wants it, so no post-serve attach. It carries `maxPayloadLength` at twice `max_message_bytes` rather than Bun's 16 MiB default: past its cap Bun drops the socket without a close frame (1006), so the headroom leaves a message just over the limit to the per-message check (`WS_CLOSE_MESSAGE_TOO_BIG`, as on Node), while a grossly oversized one is refused before Bun buffers it whole.
3011
+ - `testing/cross_backend/testing_server_node.ts` — `create_node_testing_adapter()` (`@hono/node-server`'s `serve` and module-level `upgradeWebSocket`, over a `ws` `WebSocketServer`). Optional peer deps; only test binaries import them. `prepare_websocket` builds the `ws` server (`noServer: true`) with `maxPayload` at twice `max_message_bytes` (default `DEFAULT_WS_MAX_MESSAGE_BYTES`; `ws`'s own default is 100 MiB), and `serve` hands it to `@hono/node-server`, so a grossly oversized message is refused at the frame layer (`WS_CLOSE_MESSAGE_TOO_BIG` with no reason) before it is buffered whole, while one just over the limit reaches the per-message check, which sends `WS_CLOSE_MESSAGE_TOO_BIG_REASON` as every other backend does. Bun's adapter sets the same multiple as its frame cap (see below).
3012
+ - `testing/cross_backend/testing_server_bun.ts` — `create_bun_testing_adapter()` (`Bun.serve` + `@hono/bun`'s module-level `getConnInfo`, `upgradeWebSocket`, and `websocket`; `Bun.serve` declared locally so it typechecks under the Node toolchain). Needs the optional `@hono/bun` peer dep (the counterpart to Node's `@hono/node-server` + `ws`; `Bun.serve` is built in). Reuses `create_node_runtime` (Bun implements the `node:fs`/`node:process` surface). WS is module-level + stateless — the `websocket` handler is threaded into `serve`, where `Bun.serve` wants it. It carries `maxPayloadLength` at twice `max_message_bytes` rather than Bun's 16 MiB default: past its cap Bun drops the socket without a close frame (1006), so the headroom leaves a message just over the limit to the per-message check (`WS_CLOSE_MESSAGE_TOO_BIG`, as on Node), while a grossly oversized one is refused before Bun buffers it whole.
3013
3013
  - `testing/cross_backend/default_spine_surface.ts` — the canonical no-domain spine surface (account/admin/audit/signup + bootstrap): `spine_session_options`, `spine_roles`, `create_spine_route_specs`, `spine_rpc_endpoints`, `create_spine_surface_spec`. This is the **declared** surface — the `create_standard_rpc_actions` bundle the spec-derived suites auto-enumerate. It passes `daemon_token: true` (both spine binaries mount the daemon-token layer) and leaves `GET /api/surface` at its default, off — the TS spine binary does too, and the Rust `testing_spine_stub` serves none. Shared by the spine_stub cross test, the TS cross tests, and the binary.
3014
3014
  - `testing/cross_backend/full_spine_mount.ts` — `build_full_spine_rpc_actions(deps, options)` — the **full** live RPC mount: the declared bundle **plus** the off-declared-surface families the binary live-mounts (`_testing_*` backdoors, the cell verb set, the opt-in `actor_lookup` / `actor_search` resolvers). `build_full_spine_mount(deps, options)` builds it once for both of the binary's endpoints, returning `FullSpineMount` (`{rpc_actions, ws_actions}`): the WS list is `protocol_actions` plus every RPC action not already among them, twinning the Rust `testing_spine_stub`, which serves one registry on RPC and WS (the one difference is `cancel` — a registered protocol action on TS, owned by the read loop on Rust). Single-sources the mount so the binary and the `spine_method_coverage` reconciliation test build the same list. `create_spine_live_rpc_endpoints()` wraps the list, built on stub deps, as one endpoint at `SPINE_RPC_PATH` — the `live_rpc_endpoints` value the conformance table, the differential and the auth-row generator resolve off-surface methods from (no handler built there runs).
3015
3015
  - `testing/cross_backend/ts_spine_backend_config.ts` — `ts_spine_node_backend_config()` / `ts_spine_bun_backend_config()` presets (in-memory pglet, no external infra), the TS analog of `rust_spine_stub_backend_config()`.
@@ -195,7 +195,7 @@ export interface BackendCapabilities {
195
195
  * allowed (the case pins the status alone) and a non-empty one is still
196
196
  * asserted.
197
197
  *
198
- * `false` on Node: `@hono/node-ws` writes a refused upgrade to the raw
198
+ * `false` on Node: `@hono/node-server` writes a refused upgrade to the raw
199
199
  * socket with `Content-Length: 0`, dropping the response body. `true` on
200
200
  * Bun and the Rust spine, which send the response as built.
201
201
  */
@@ -118,7 +118,7 @@ export const ts_default_capabilities = Object.freeze({
118
118
  // config) — `Bun.serve` answers such a request `400` when the upgrade
119
119
  // follows an asynchronous check.
120
120
  ws_handshake_pipelining: true,
121
- // `@hono/node-ws` drops a refused upgrade's body, so a Node-served backend
121
+ // `@hono/node-server` drops a refused upgrade's body, so a Node-served backend
122
122
  // sends none. A Bun-served one overrides to `true`.
123
123
  ws_refusal_body: false
124
124
  });
@@ -1 +1 @@
1
- {"version":3,"file":"testing_server_bun.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_bun.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA4B9B,OAAO,KAAK,EAAe,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AA0BlF,4CAA4C;AAC5C,eAAO,MAAM,0BAA0B,QAAO,oBAoE7C,CAAC"}
1
+ {"version":3,"file":"testing_server_bun.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_bun.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA4B9B,OAAO,KAAK,EAAe,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AA0BlF,4CAA4C;AAC5C,eAAO,MAAM,0BAA0B,QAAO,oBAmE7C,CAAC"}
@@ -9,7 +9,7 @@ import '../assert_dev_env.js';
9
9
  * and the Rust spine binary covers the cross-language axis.
10
10
  *
11
11
  * Needs the optional `@hono/bun` peer dep (the Bun counterpart to Node's
12
- * `@hono/node-server` + `@hono/node-ws`); `Bun.serve` is built in.
12
+ * `@hono/node-server` + `ws`); `Bun.serve` is built in.
13
13
  * `RuntimeDeps` reuse `create_node_runtime` — Bun
14
14
  * implements the `node:fs` / `node:process` surface `RuntimeDeps` +
15
15
  * `testing/daemon_info.ts` touch.
@@ -41,12 +41,12 @@ export const create_bun_testing_adapter = () => {
41
41
  runtime_label: 'Bun',
42
42
  runtime: create_node_runtime(),
43
43
  get_connection_ip: (c) => getConnInfo(c).remote.address,
44
- // Bun's WS upgrade is module-level and stateless — no post-serve
45
- // attach. The `websocket` handler is threaded into `serve`
46
- // below, where `Bun.serve` wants it, carrying the frame cap.
44
+ // Bun's WS upgrade is module-level and stateless. The `websocket`
45
+ // handler is threaded into `serve` below, where `Bun.serve` wants it,
46
+ // carrying the frame cap.
47
47
  prepare_websocket: (options) => {
48
48
  max_message_bytes = options?.max_message_bytes ?? DEFAULT_WS_MAX_MESSAGE_BYTES;
49
- return { create_upgrade_websocket: () => upgradeWebSocket };
49
+ return upgradeWebSocket;
50
50
  },
51
51
  serve: ({ fetch, port, hostname }) => {
52
52
  const server = Bun.serve({
@@ -90,8 +90,7 @@ export const create_bun_testing_adapter = () => {
90
90
  shutdown: () => {
91
91
  void Promise.resolve(server.stop(true)).catch(() => { });
92
92
  return Promise.resolve();
93
- },
94
- native: server
93
+ }
95
94
  };
96
95
  return handle;
97
96
  },
@@ -6,26 +6,24 @@ import '../assert_dev_env.js';
6
6
  * A test binary mounts a fuz_app-derived surface over a real HTTP socket so
7
7
  * the `cross_backend/*` suites (and the cross-impl bench) can drive it the
8
8
  * same way they drive the Rust spine. This module owns the runtime-neutral
9
- * orchestration — stale-daemon check, daemon-info write, serve, post-serve
10
- * WS attach, graceful shutdown — and delegates the runtime-boundary
11
- * primitives (HTTP serve, WS upgrade construction, signals, pid, exit) to a
12
- * `TestingServerAdapter`. The shipped adapters are
13
- * `testing/cross_backend/testing_server_node.ts` (`@hono/node-server` + `@hono/node-ws`)
9
+ * orchestration — stale-daemon check, daemon-info write, serve, graceful
10
+ * shutdown — and delegates the runtime-boundary primitives (HTTP serve, WS
11
+ * upgrade, signals, pid, exit) to a `TestingServerAdapter`. The shipped
12
+ * adapters are `testing/cross_backend/testing_server_node.ts` (`@hono/node-server` + `ws`)
14
13
  * and `testing/cross_backend/testing_server_bun.ts` (`Bun.serve` + `@hono/bun`).
15
14
  *
16
15
  * The app itself — routes, RPC, DB, `_testing_reset`, WS endpoints — is the
17
16
  * caller's `StartTestingServerOptions.build_app` seam, so this core
18
17
  * stays domain-free. WebSocket endpoints mount through `create_app_server`'s
19
18
  * `ws_endpoints`: `build_app` asks its context to prepare the runtime's
20
- * upgrade helper and passes the resulting factory as
21
- * `create_upgrade_websocket`; the core attaches it to the server once
22
- * `serve` returns (Node's `injectWebSocket`). fuz_app's own `testing_spine_server` passes a
19
+ * upgrade helper and passes it as `upgrade_websocket`; the adapter threads
20
+ * the prepared frame cap into `serve`. fuz_app's own `testing_spine_server` passes a
23
21
  * no-domain build; consumers (fuz_forge) pass their domain build.
24
22
  *
25
23
  * **NEVER ships in a release.** This module lives under `cross_backend/` and
26
24
  * opens with `import '../assert_dev_env.js';`, which throws on
27
25
  * production-bundle load. The runtime adapters reach for the optional
28
- * `@hono/node-server` / `@hono/node-ws` / `@hono/bun` peer deps; only test
26
+ * `@hono/node-server` / `ws` / `@hono/bun` peer deps; only test
29
27
  * binaries import them.
30
28
  *
31
29
  * @module
@@ -39,14 +37,10 @@ import type { RuntimeDeps } from '../../runtime/deps.js';
39
37
  *
40
38
  * `shutdown` stops accepting new connections at once and settles when the
41
39
  * in-flight ones have drained — the core starts it, closes the app (which
42
- * ends live WebSockets), then awaits it. `native` is an adapter-specific
43
- * server reference — used by Node's `@hono/node-ws` `injectWebSocket(server)`
44
- * post-serve hook.
40
+ * ends live WebSockets), then awaits it.
45
41
  */
46
42
  export interface ServeHandle {
47
43
  shutdown: () => Promise<void>;
48
- /** Adapter-specific server ref for post-serve hooks. Type-erased at the seam. */
49
- native?: unknown;
50
44
  }
51
45
  /** Options for `TestingServerAdapter.prepare_websocket`. */
52
46
  export interface PrepareWebsocketOptions {
@@ -67,19 +61,6 @@ export interface PrepareWebsocketOptions {
67
61
  */
68
62
  max_message_bytes?: number;
69
63
  }
70
- /**
71
- * Result of an adapter's WS preparation step.
72
- *
73
- * `create_upgrade_websocket` is the factory a build passes to
74
- * `create_app_server` as `AppServerOptions.create_upgrade_websocket`.
75
- * `attach_to_server` runs after `serve()` returns a `ServeHandle` —
76
- * Node uses it for `injectWebSocket(server)`, and it does nothing when the
77
- * factory was never called (no `ws_endpoints`); Bun leaves it undefined.
78
- */
79
- export interface PreparedWebsocket {
80
- create_upgrade_websocket: (app: Hono) => UpgradeWebSocket;
81
- attach_to_server?: (handle: ServeHandle) => void;
82
- }
83
64
  /**
84
65
  * Runtime adapter contract for the test-binary entry. Each adapter
85
66
  * (`testing/cross_backend/testing_server_node.ts`,
@@ -93,8 +74,12 @@ export interface TestingServerAdapter {
93
74
  runtime: RuntimeDeps;
94
75
  /** Extract the raw TCP connection IP from a Hono context. */
95
76
  get_connection_ip: (c: Context) => string | undefined;
96
- /** Prepare the runtime's WS upgrade helper and its post-serve attach step. */
97
- prepare_websocket: (options?: PrepareWebsocketOptions) => PreparedWebsocket;
77
+ /**
78
+ * Prepare WebSocket support for the next `serve` — the frame cap, and on
79
+ * Node the `ws` server — and return the runtime's `upgradeWebSocket`
80
+ * helper. Called before `serve`, at most once.
81
+ */
82
+ prepare_websocket: (options?: PrepareWebsocketOptions) => UpgradeWebSocket;
98
83
  /** Bind `app.fetch` to `port` on `hostname`; return a `ServeHandle`. */
99
84
  serve: (options: {
100
85
  fetch: Hono['fetch'];
@@ -111,15 +96,16 @@ export interface TestingServerAdapter {
111
96
  /** What the core hands a `StartTestingServerOptions.build_app` seam. */
112
97
  export interface BuildTestingAppContext {
113
98
  /**
114
- * Prepare the runtime adapter's WS upgrade helper and return the factory
115
- * to pass to `create_app_server` as `create_upgrade_websocket`. The core
116
- * runs the adapter's attach step once the server is bound, so a build
117
- * that mounts `ws_endpoints` needs nothing else. An HTTP-only build
118
- * doesn't call it. Call it at most once per build: the Node adapter
119
- * attaches one upgrade listener per preparation, and two would race on
120
- * the shared socket.
99
+ * Prepare the runtime adapter's WebSocket support and return its
100
+ * `upgradeWebSocket` helper, to pass to `create_app_server` as
101
+ * `upgrade_websocket`; the adapter threads what it prepared into `serve`,
102
+ * so a build that mounts `ws_endpoints` needs nothing else. Call it only
103
+ * when mounting: on Node a prepared server routes every `Upgrade:
104
+ * websocket` request through the upgrade path, refusing one to a plain
105
+ * HTTP route with a bodiless status. Call it at most once per build: the server takes
106
+ * one frame cap, the last preparation's.
121
107
  */
122
- prepare_websocket: (options?: PrepareWebsocketOptions) => (app: Hono) => UpgradeWebSocket;
108
+ prepare_websocket: (options?: PrepareWebsocketOptions) => UpgradeWebSocket;
123
109
  }
124
110
  /** The assembled app a `StartTestingServerOptions.build_app` seam returns. */
125
111
  export interface BuiltTestingApp {
@@ -1 +1 @@
1
- {"version":3,"file":"testing_server_core.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_core.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAU,KAAK,MAAM,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,iFAAiF;IACjF,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,4DAA4D;AAC5D,MAAM,WAAW,uBAAuB;IACvC;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IACjC,wBAAwB,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,gBAAgB,CAAC;IAC1D,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CACjD;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACpC,4EAA4E;IAC5E,aAAa,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,OAAO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;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACzE,0EAA0E;IAC1E,GAAG,CAAC,EAAE,UAAU,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,OAGpD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAU,SAAS,yBAAyB,KAAG,OAAO,CAAC,IAAI,CAkE3F,CAAC"}
1
+ {"version":3,"file":"testing_server_core.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_core.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAU,KAAK,MAAM,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,4DAA4D;AAC5D,MAAM,WAAW,uBAAuB;IACvC;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACpC,4EAA4E;IAC5E,aAAa,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,OAAO,EAAE,WAAW,CAAC;IACrB,6DAA6D;IAC7D,iBAAiB,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;IACtD;;;;OAIG;IACH,iBAAiB,EAAE,CAAC,OAAO,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,MAAM,MAAM,KAAG,OAGpD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAU,SAAS,yBAAyB,KAAG,OAAO,CAAC,IAAI,CA4D3F,CAAC"}
@@ -42,13 +42,8 @@ export const start_testing_server = async (options) => {
42
42
  log.warn(`stale daemon.json (pid ${stale.pid} not running), replacing`);
43
43
  }
44
44
  }
45
- const prepared_websockets = [];
46
45
  const built = await build_app({
47
- prepare_websocket: (ws_options) => {
48
- const prepared = adapter.prepare_websocket(ws_options);
49
- prepared_websockets.push(prepared);
50
- return prepared.create_upgrade_websocket;
51
- }
46
+ prepare_websocket: (ws_options) => adapter.prepare_websocket(ws_options)
52
47
  });
53
48
  await write_daemon_info(runtime, daemon_name, {
54
49
  version: 1,
@@ -59,8 +54,6 @@ export const start_testing_server = async (options) => {
59
54
  });
60
55
  log.info(`Listening on http://${host}:${port} (${adapter.runtime_label}, test mode)`);
61
56
  const server = adapter.serve({ fetch: built.app.fetch, port, hostname: host });
62
- for (const prepared of prepared_websockets)
63
- prepared.attach_to_server?.(server);
64
57
  let shutting_down = false;
65
58
  const shutdown = async () => {
66
59
  if (shutting_down)
@@ -1 +1 @@
1
- {"version":3,"file":"testing_server_node.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_node.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA2B9B,OAAO,KAAK,EAAe,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAqBlF,6CAA6C;AAC7C,eAAO,MAAM,2BAA2B,QAAO,oBAiC7C,CAAC"}
1
+ {"version":3,"file":"testing_server_node.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_node.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA0B9B,OAAO,KAAK,EAAe,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAoBlF,6CAA6C;AAC7C,eAAO,MAAM,2BAA2B,QAAO,oBA2B9C,CAAC"}
@@ -2,31 +2,29 @@ import '../assert_dev_env.js';
2
2
  /**
3
3
  * Node runtime adapter for spawnable cross-process test server binaries.
4
4
  *
5
- * Binds `@hono/node-server`'s `serve()` and `@hono/node-ws`'s two-phase
6
- * `createNodeWebSocket({app})` / `injectWebSocket(server)`: the factory
7
- * `prepare_websocket` returns builds the first half from the app
8
- * `create_app_server` assembles, and the core runs the second once `serve()`
9
- * returns. The shared `testing/cross_backend/testing_server_core.ts` owns
10
- * the rest. A test binary builds this adapter and hands it to
5
+ * Binds `@hono/node-server`'s `serve()` and module-level `upgradeWebSocket`.
6
+ * `prepare_websocket` builds the `ws` `WebSocketServer` that upgrades the
7
+ * sockets, and `serve` hands it to `@hono/node-server`, which upgrades only
8
+ * on a server given one. The shared `testing/cross_backend/testing_server_core.ts`
9
+ * owns the rest. A test binary builds this adapter and hands it to
11
10
  * `start_testing_server` alongside its `build_app` seam.
12
11
  *
13
- * `@hono/node-server` + `@hono/node-ws` are **optional** peer deps (same
14
- * posture as `ws`) — only test binaries import them; production bundles
15
- * never reach this module (the `assert_dev_env` guard throws on prod load).
12
+ * `@hono/node-server` + `ws` are **optional** peer deps — only test binaries
13
+ * import them; production bundles never reach this module (the
14
+ * `assert_dev_env` guard throws on prod load).
16
15
  *
17
16
  * @module
18
17
  */
19
18
  import process from 'node:process';
20
- import { serve } from '@hono/node-server';
19
+ import { serve, upgradeWebSocket } from '@hono/node-server';
21
20
  import { getConnInfo } from '@hono/node-server/conninfo';
22
- import { createNodeWebSocket } from '@hono/node-ws';
21
+ import { WebSocketServer } from 'ws';
23
22
  import { DEFAULT_WS_MAX_MESSAGE_BYTES } from '../../actions/transports.js';
24
23
  import { create_node_runtime } from '../../runtime/node.js';
25
24
  const node_serve_handle = (server) => ({
26
25
  shutdown: () => new Promise((resolve, reject) => {
27
26
  server.close((err) => (err ? reject(err) : resolve()));
28
- }),
29
- native: server
27
+ })
30
28
  });
31
29
  /**
32
30
  * How far above the endpoint's message limit the `ws` frame cap sits. Past
@@ -39,36 +37,27 @@ const node_serve_handle = (server) => ({
39
37
  */
40
38
  const NODE_WS_MAX_PAYLOAD_MULTIPLIER = 2;
41
39
  /** Build the Node `TestingServerAdapter`. */
42
- export const create_node_testing_adapter = () => ({
43
- runtime_label: 'Node',
44
- runtime: create_node_runtime(),
45
- get_connection_ip: (c) => getConnInfo(c).remote.address,
46
- prepare_websocket: (options) => {
47
- const max_payload = NODE_WS_MAX_PAYLOAD_MULTIPLIER * (options?.max_message_bytes ?? DEFAULT_WS_MAX_MESSAGE_BYTES);
48
- let node_ws;
49
- return {
50
- create_upgrade_websocket: (app) => {
51
- node_ws = createNodeWebSocket({ app });
52
- // `@hono/node-ws` builds its `ws` server with no options and takes
53
- // none, so its frame cap would stay `ws`'s 100 MiB default. `ws` reads
54
- // `options.maxPayload` per upgrade, so setting it here — before any
55
- // connection — caps every socket at the multiple of the endpoint's
56
- // message limit.
57
- node_ws.wss.options.maxPayload = max_payload;
58
- return node_ws.upgradeWebSocket;
59
- },
60
- attach_to_server: (handle) => {
61
- // `handle.native` is the `ServerType` from `serve()` —
62
- // type-erased at the `ServeHandle` seam, so it downcasts here.
63
- node_ws?.injectWebSocket(handle.native);
64
- }
65
- };
66
- },
67
- serve: ({ fetch, port, hostname }) => node_serve_handle(serve({ fetch, port, hostname })),
68
- pid: process.pid,
69
- register_shutdown_signals: (handler) => {
70
- process.on('SIGINT', () => void handler());
71
- process.on('SIGTERM', () => void handler());
72
- },
73
- exit: (code) => process.exit(code)
74
- });
40
+ export const create_node_testing_adapter = () => {
41
+ // set by `prepare_websocket`, read by `serve` — the core prepares before it serves
42
+ let wss;
43
+ return {
44
+ runtime_label: 'Node',
45
+ runtime: create_node_runtime(),
46
+ get_connection_ip: (c) => getConnInfo(c).remote.address,
47
+ prepare_websocket: (options) => {
48
+ wss = new WebSocketServer({
49
+ noServer: true,
50
+ maxPayload: NODE_WS_MAX_PAYLOAD_MULTIPLIER *
51
+ (options?.max_message_bytes ?? DEFAULT_WS_MAX_MESSAGE_BYTES)
52
+ });
53
+ return upgradeWebSocket;
54
+ },
55
+ serve: ({ fetch, port, hostname }) => node_serve_handle(serve({ fetch, port, hostname, websocket: wss ? { server: wss } : undefined })),
56
+ pid: process.pid,
57
+ register_shutdown_signals: (handler) => {
58
+ process.on('SIGINT', () => void handler());
59
+ process.on('SIGTERM', () => void handler());
60
+ },
61
+ exit: (code) => process.exit(code)
62
+ };
63
+ };
@@ -52,7 +52,7 @@ import '../assert_dev_env.js';
52
52
  * its named fields) or, past the RPC front door, the JSON-RPC error envelope
53
53
  * with the reason on `error.data.reason`. A WebSocket refusal's body is
54
54
  * required where the backend declares `capabilities.ws_refusal_body`; where it
55
- * doesn't (Node's `@hono/node-ws` drops a refused upgrade's body), an empty
55
+ * doesn't (Node's `@hono/node-server` drops a refused upgrade's body), an empty
56
56
  * body passes on its status and a body that is sent is still asserted.
57
57
  *
58
58
  * **Transport.** Given a `base_url`, every probe is written to the socket
@@ -368,7 +368,7 @@ export const describe_transport_composition_cross_tests = (options) => {
368
368
  const fixture = await fixture_setup();
369
369
  const res = await send_probe(fixture, await build_probe(c, fixture));
370
370
  assert.strictEqual(res.status, c.expect.status, `${case_name(c)}: status (body: ${res.text.slice(0, 200)})`);
371
- // a backend that declares no WS refusal body (Node's `@hono/node-ws`)
371
+ // a backend that declares no WS refusal body (Node's `@hono/node-server`)
372
372
  // may answer with an empty one; a body it does send is still asserted
373
373
  if (c.surface === 'ws_upgrade' && !capabilities.ws_refusal_body && res.text === '')
374
374
  return;
@@ -19,7 +19,7 @@ import { LOGIN_RATE_LIMIT_ENABLED_ENV, SPINE_SSE_PATH, TESTING_BACKDOOR_METHODS,
19
19
  * mounts the role-gated WS endpoint at `SPINE_ROLE_GATED_WS_PATH`), and every
20
20
  * `TESTING_BACKDOOR_METHODS` entry as `testing_backdoors` (`full_spine_mount`
21
21
  * mounts them all, on `/api/rpc` and `/api/ws`). The Node
22
- * binary's preset; `ws_refusal_body` stays `false`, as `@hono/node-ws` drops a
22
+ * binary's preset; `ws_refusal_body` stays `false`, as `@hono/node-server` drops a
23
23
  * refused upgrade's body.
24
24
  */
25
25
  const ts_spine_capabilities = Object.freeze({
@@ -161,7 +161,7 @@ export interface CreateTestAppSurfaceSpecOptions {
161
161
  * to both entry points so the attack surface tests see the same WS
162
162
  * endpoints production auto-mounts. The factory runs once against
163
163
  * the stub `AppServerContext` this helper already builds. No
164
- * `create_upgrade_websocket` needed — this helper produces an
164
+ * `upgrade_websocket` needed — this helper produces an
165
165
  * `AppSurfaceSpec` only, never mounts.
166
166
  */
167
167
  ws_endpoints?: ReadonlyArray<WsEndpointSpec> | ((ctx: AppServerContext) => ReadonlyArray<WsEndpointSpec>);
@@ -323,7 +323,7 @@ export const create_test_app_surface_spec = (options) => {
323
323
  });
324
324
  }) ?? [];
325
325
  // Resolve ws endpoints (mirrors create_app_server). Surface-only —
326
- // no `register_action_ws` call here, so no `create_upgrade_websocket` needed.
326
+ // no `register_action_ws` call here, so no `upgrade_websocket` needed.
327
327
  const declared_ws_endpoints = typeof options.ws_endpoints === 'function' ? options.ws_endpoints(ctx) : options.ws_endpoints;
328
328
  const resolved_ws_endpoints = resolve_ws_endpoints(options.allowed_origins
329
329
  ? declared_ws_endpoints
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/fuz_app",
3
- "version": "0.177.0",
3
+ "version": "0.178.0",
4
4
  "description": "fullstack app library",
5
5
  "glyph": "🗝",
6
6
  "logo": "logo.svg",
@@ -42,8 +42,7 @@
42
42
  "@fuzdev/fuz_util": ">=0.81.0",
43
43
  "@fuzdev/pglet-wasm": ">=0.1.2",
44
44
  "@hono/bun": ">=1",
45
- "@hono/node-server": ">=1",
46
- "@hono/node-ws": ">=1",
45
+ "@hono/node-server": ">=2",
47
46
  "@node-rs/argon2": ">=2",
48
47
  "@sveltejs/kit": "^3",
49
48
  "esm-env": "^1",
@@ -71,9 +70,6 @@
71
70
  "@hono/node-server": {
72
71
  "optional": true
73
72
  },
74
- "@hono/node-ws": {
75
- "optional": true
76
- },
77
73
  "@node-rs/argon2": {
78
74
  "optional": true
79
75
  },
@@ -96,14 +92,13 @@
96
92
  "@fuzdev/fuz_code": "^0.59.0",
97
93
  "@fuzdev/fuz_css": "^0.81.0",
98
94
  "@fuzdev/fuz_schema": "^0.5.7",
99
- "@fuzdev/fuz_ui": "^0.229.0",
95
+ "@fuzdev/fuz_ui": "^0.229.1",
100
96
  "@fuzdev/fuz_util": "^0.82.0",
101
97
  "@fuzdev/gro": "^0.237.0",
102
98
  "@fuzdev/mdz": "^0.10.0",
103
99
  "@fuzdev/pglet-wasm": "^0.1.2",
104
100
  "@hono/bun": "^1.0.1",
105
- "@hono/node-server": "^1.19.14",
106
- "@hono/node-ws": "^1.3.1",
101
+ "@hono/node-server": "^2.1.9",
107
102
  "@node-rs/argon2": "^2.0.2",
108
103
  "@ryanatkn/eslint-config": "^0.13.2",
109
104
  "@sveltejs/adapter-static": "^4.0.0",
@@ -116,7 +111,7 @@
116
111
  "eslint": "^9.39.4",
117
112
  "eslint-plugin-svelte": "^3.15.1",
118
113
  "esm-env": "^1.2.2",
119
- "hono": "^4.13.9",
114
+ "hono": "^4.13.19",
120
115
  "jsdom": "^28.1.0",
121
116
  "pg": "^8.20.0",
122
117
  "svelte": "^5.57.2",