@fuzdev/fuz_app 0.128.0 → 0.130.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.
- package/dist/actions/CLAUDE.md +23 -6
- package/dist/actions/connection_closer.d.ts +3 -1
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/register_action_ws.d.ts +46 -1
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +105 -14
- package/dist/actions/transports.d.ts +2 -1
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +2 -1
- package/dist/actions/transports_ws_backend.d.ts +37 -4
- package/dist/actions/transports_ws_backend.d.ts.map +1 -1
- package/dist/actions/transports_ws_backend.js +68 -4
- package/dist/auth/CLAUDE.md +1 -1
- package/dist/auth/actor_lookup_action_specs.d.ts +2 -2
- package/dist/auth/actor_lookup_action_specs.js +2 -2
- package/dist/auth/audit_emitter.d.ts +14 -7
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_emitter.js +6 -8
- package/dist/auth/audit_log_routes.d.ts +7 -3
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +48 -26
- package/dist/auth/bearer_auth.d.ts +3 -2
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +3 -2
- package/dist/auth/request_context.d.ts +1 -1
- package/dist/auth/request_context.js +1 -1
- package/dist/auth/token_scope.d.ts +4 -2
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +10 -2
- package/dist/http/CLAUDE.md +4 -5
- package/dist/http/auth_shape.d.ts +3 -2
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +3 -2
- package/dist/http/common_routes.d.ts +1 -14
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +1 -19
- package/dist/http/ip_canonical.d.ts +1 -1
- package/dist/http/ip_canonical.js +1 -1
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +7 -5
- package/dist/realtime/sse.d.ts +14 -1
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +77 -1
- package/dist/realtime/sse_auth_guard.d.ts +3 -1
- package/dist/realtime/sse_auth_guard.d.ts.map +1 -1
- package/dist/realtime/sse_auth_guard.js +4 -2
- package/dist/realtime/subscriber_registry.d.ts +44 -8
- package/dist/realtime/subscriber_registry.d.ts.map +1 -1
- package/dist/realtime/subscriber_registry.js +64 -10
- package/dist/server/app_server.d.ts +122 -8
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +136 -91
- package/dist/server/surface_route.d.ts +32 -0
- package/dist/server/surface_route.d.ts.map +1 -0
- package/dist/server/surface_route.js +46 -0
- package/dist/testing/CLAUDE.md +33 -12
- package/dist/testing/app_server.d.ts +39 -4
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +84 -68
- package/dist/testing/audit_completeness.js +1 -1
- package/dist/testing/audit_drift_guard.d.ts +1 -1
- package/dist/testing/cross_backend/default_spine_surface.d.ts +2 -2
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +5 -2
- package/dist/testing/cross_backend/identity_parity.js +1 -1
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +4 -1
- package/dist/testing/cross_backend/method_coverage.d.ts +1 -1
- package/dist/testing/cross_backend/method_coverage.d.ts.map +1 -1
- package/dist/testing/cross_backend/method_coverage.js +2 -2
- package/dist/testing/cross_backend/peer_ping_ws.d.ts +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +4 -4
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +1 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.d.ts +4 -4
- package/dist/testing/cross_backend/setup.js +1 -1
- package/dist/testing/cross_backend/sse_round_trip.d.ts +1 -1
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +24 -14
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +40 -32
- package/dist/testing/cross_backend/testing_server_bun.d.ts +1 -1
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +80 -64
- package/dist/testing/cross_backend/testing_server_core.d.ts +10 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_deno.d.ts +1 -1
- package/dist/testing/cross_backend/testing_server_deno.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_deno.js +1 -1
- package/dist/testing/cross_backend/testing_server_node.d.ts +1 -1
- package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_node.js +2 -2
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts +20 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts.map +1 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.js +177 -0
- package/dist/testing/cross_backend/ws_round_trip.d.ts +1 -1
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +11 -9
- package/dist/testing/stubs.d.ts +45 -7
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +60 -31
- package/dist/testing/ws_round_trip.d.ts +1 -3
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/ui/AdminSurface.svelte +3 -1
- package/dist/ui/AdminSurface.svelte.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +3 -1
- package/dist/ui/async_slot.svelte.d.ts +4 -4
- package/dist/ui/async_slot.svelte.js +4 -4
- package/dist/ui/keyed_async_slot.svelte.d.ts +4 -4
- package/dist/ui/keyed_async_slot.svelte.js +3 -3
- package/package.json +1 -1
package/dist/testing/CLAUDE.md
CHANGED
|
@@ -31,13 +31,13 @@ time (never runtime), where a throwing guard would break `vite build`.
|
|
|
31
31
|
- `create_stub_db()` — real `Db` whose `client.query` yields `{rows: []}` and `transaction(fn)` synchronously calls `fn(inner_stub_db)`. Safe for `apply_route_specs`'s declarative transaction wrapper.
|
|
32
32
|
- `stub_handler()` — fresh `Response('stub')`.
|
|
33
33
|
- `stub_mw` — pass-through middleware (`async (_c, next) => next()`).
|
|
34
|
-
- `stub_app_deps` — frozen `AppDeps`, every capability throwing, `audit` a no-op `AuditEmitter` from `create_test_audit_emitter`, `connection_closer` an empty `RealtimeCloser`.
|
|
35
34
|
- `create_stub_app_deps()` — factory: fresh `AppDeps` with no-op keyring/password/`delete_file`, a `read_secure_file` that throws ENOENT (the no-token-file state), a `create_noop_stub` DB, silent `Logger`, no-op `audit`, an empty `connection_closer`.
|
|
36
35
|
- `create_test_audit_emitter()` — no-op `AuditEmitter`; `emit` / `emit_role_grant_target` no-op, `emit_pool` resolves immediately, `notify` no-op, `add_listener` throws (use `create_recording_audit_emitter` for a listener-accepting emitter), `listener_count` returns 0, `drain_inflight` resolves immediately.
|
|
37
36
|
- `create_stub_audit_sse()` — no-op `AuditLogSse` for surface-test wiring without booting real SSE. `on_audit_event` no-op (nothing is broadcast); `registry` is a fresh `SubscriberRegistry` (live `.count` / `.close_*` for registry-state tests, isolated per call). For real SSE plumbing build via `create_audit_log_sse` against `create_test_app`.
|
|
38
|
-
- `create_stub_api_middleware({include_daemon_token?})` — stub `MiddlewareSpec[]` matching `create_auth_middleware_specs`'s output (origin/session/request_context/bearer_auth, optional daemon_token) for surface generation without booting real auth. Each spec gets its own pass-through handler (not the shared `stub_mw`), so `assert_middleware_stack_mounted` tells the layers apart. See `auth/CLAUDE.md` §Middleware for the real stack.
|
|
39
|
-
- `
|
|
40
|
-
- `
|
|
37
|
+
- `create_stub_api_middleware({include_daemon_token?})` — stub `MiddlewareSpec[]` matching `create_auth_middleware_specs`'s output (origin/session/request_context/bearer_auth, optional daemon_token) for surface generation without booting real auth — the same names, paths, order, and declared `errors` (`origin` declares a 403; `bearer_auth` and `daemon_token` declare none, since both soft-fail through `next()`), pinned against the real factory by `auth/middleware.mounted.test.ts`. The surface merges middleware errors into every route under the path, so a stub declaring more would widen the test surface with statuses the live server never returns. Each spec gets its own pass-through handler (not the shared `stub_mw`), so `assert_middleware_stack_mounted` tells the layers apart. See `auth/CLAUDE.md` §Middleware for the real stack.
|
|
38
|
+
- `create_stub_app_backend(options?)` — stub `AppBackend` with no database: `create_stub_app_deps()` (or `options.deps`), no migration results, a `close` that does nothing (or `options.close`). For assembling a server in tests that never reach the database.
|
|
39
|
+
- `create_stub_app_server_context(session_options)` — stub `AppServerContext` over `create_stub_app_backend()`; rate limiters null, `bootstrap_status.available: false`.
|
|
40
|
+
- `create_test_app_surface_spec(options)` — builds an `AppSurfaceSpec` mirroring `create_app_server`'s route assembly, in its order (consumer routes, then bootstrap routes, RPC endpoint routes, and `GET /api/surface`, + stub middleware + surface generation). `GET /api/surface` is listed only with `surface_route: true`, as `create_app_server` mounts it only when opted in — pass the same value to both so the surface-derived suites probe it exactly when the live server serves it. `daemon_token: true` lists the `daemon_token` layer `create_app_server` mounts when given a `daemon_token_state` (`create_test_app` always passes one, and `default_in_process_suite_options` sets it, along with `app_options.surface_route`); `testing/test_app_server.db.test.ts` pins the stub's routes (order, auth, error schemas, applicable middleware) and middleware names against `create_test_app`'s for every `surface_route` setting. Its middleware list mirrors the real one — a stub `trusted_proxy` spec at `'*'`, then the stub auth stack — so every route's `applicable_middleware` starts with `trusted_proxy` (a route outside `/api/*` now lists just `['trusted_proxy']`), as on the live server. `CreateTestAppSurfaceSpecOptions`: `session_options`, `create_route_specs`, `env_schema?`, `event_specs?`, `rpc_endpoints?`, `ws_endpoints?`, `allowed_origins?`, `transform_middleware?`, `bootstrap?`, `surface_route?`, `daemon_token?`. Throws, like `create_app_server`, on an endpoint path outside `AUTH_MIDDLEWARE_PATH` (`assert_endpoint_in_auth_scope`) and on a `transform_middleware` that moves, drops, duplicates, reorders, wraps, or replaces the stub proxy spec or a stub auth spec (`assert_middleware_stack_mounted`); the transform receives shallow copies in a fresh array, so an in-place mutation can't slip past the check. Throws on a `ws_endpoints` spec with no `allowed_origins` of its own when no `allowed_origins` option is given (there is no server list to default from). Bootstrap is opt-in (symmetric with `create_app_server` — omit to skip; pass the same value as prod to mount routes at `bootstrap.route_prefix ?? '/api/account'`). Single source of truth for attack-surface tests — track `create_app_server` wiring changes here.
|
|
41
41
|
|
|
42
42
|
Throwing stubs surface mock escape: a test that accidentally reaches into
|
|
43
43
|
stub territory breaks immediately with a label-scoped error rather than
|
|
@@ -150,6 +150,7 @@ fully assembled Hono app + the backend + helpers.
|
|
|
150
150
|
Key module-scope values:
|
|
151
151
|
|
|
152
152
|
- `stub_password_deps` — `PasswordHashDeps` hashing via `stub_hash_${password}` and verifying by equality. Deterministic, no Argon2 cost — use for every test not specifically exercising password hashing.
|
|
153
|
+
- `create_loopback_app_server_options()` — the loopback `create_app_server` options an in-process test server takes (`localhost` origins, the loopback proxy trusted, an empty env schema), fresh per call; `create_test_app` and `create_test_app_for_bootstrap` spread it under their own defaults (`rate_limiters: 'disabled_for_testing'`, `await_pending_effects: true`).
|
|
153
154
|
- `TEST_COOKIE_SECRET` — 64-hex-char deterministic cookie secret. Produces a valid `Keyring` via `create_validated_keyring`. Never used in production — the stub guard plus fixed value is the contract.
|
|
154
155
|
- `fallback_pglite_factory` — module-level auth-only PGlite factory `create_test_app_server` uses when no `db` is passed. Reuses the WASM cache via `create_pglite_factory`. When `migration_namespaces` is supplied, a memoized sibling factory (keyed by namespace set) migrating `[auth_migration_ns, ...migration_namespaces]` is used instead — same shared WASM, extra tables.
|
|
155
156
|
|
|
@@ -172,9 +173,9 @@ Types:
|
|
|
172
173
|
- `TestAppServerOptions` — `session_options` (required), optional `db`, `db_type`, `migration_namespaces`, `password`, `username`, `password_value`, `roles`, `audit_factory`. `migration_namespaces` runs extra namespaces after auth in the auto-created PGlite (mirrors `create_app_backend`); mutually exclusive with `db` (caller-migrated) — passing both throws. The optional `audit_factory` defaults to `default_audit_factory` (no-listener `create_audit_emitter` over the test backend's `{db, log}`); pass a custom factory to compose `on_audit_event` / `audit_log_config`, instrument `emit` with `emit_decorator`, or otherwise replace the emitter. Mirrors `CreateAppBackendOptions` end-to-end — the previous `on_audit_event` / `audit_log_config` sugar was removed alongside the production rename.
|
|
173
174
|
- `CreateTestAppOptions extends TestAppServerOptions` — adds `create_route_specs` (required), `rpc_endpoints?: RpcEndpointsSuiteOption` (top-level only — single source of truth, symmetric with the suite-level option), `bootstrap?: BootstrapServerOptions` (top-level only — same precedent as `rpc_endpoints`), and `app_options?: SuiteAppOptions` (`Partial<AppServerOptions>` excluding the five fields the helper manages: `backend`, `session_options`, `create_route_specs`, `rpc_endpoints`, `bootstrap`).
|
|
174
175
|
- `TestAccount` — `{account, actor, session_cookie, api_token, create_session_headers, create_bearer_headers}`.
|
|
175
|
-
- `TestApp` — `{app, backend, surface_spec, surface, route_specs, create_session_headers, create_bearer_headers, create_daemon_token_headers, create_account, cleanup}`.
|
|
176
|
+
- `TestApp` — `{app, backend, server, surface_spec, surface, route_specs, create_session_headers, create_bearer_headers, create_daemon_token_headers, create_account, cleanup}`. `server` is the assembled `AppServer`, for what `create_app_server` built beyond the lifted fields — `require_audit_sse(test_app.server)` with `audit_log_sse` in `app_options`, `test_app.server.ws_endpoints[path]` — instead of capturing them from a `create_route_specs` closure.
|
|
176
177
|
- `CreateTestAppForBootstrapOptions` — `{session_options, create_route_specs, rpc_endpoints?, bootstrap: BootstrapLiveOptions, bootstrap_token, app_options?, db?, db_type?, password?, audit_factory?}`. `bootstrap` is required + narrowed to `live` mode (the helper exists for the success-path test).
|
|
177
|
-
- `TestAppForBootstrap` — `{app, backend, surface_spec, surface, route_specs, create_request_headers, cleanup}`. No keeper credentials (test drives bootstrap itself).
|
|
178
|
+
- `TestAppForBootstrap` — `{app, backend, server, surface_spec, surface, route_specs, create_request_headers, cleanup}`. No keeper credentials (test drives bootstrap itself).
|
|
178
179
|
|
|
179
180
|
`create_test_app` hard-codes the test-friendly `AppServerOptions`:
|
|
180
181
|
`allowed_origins: [/^http:\/\/localhost/]`, stub proxy pinned to `127.0.0.1`,
|
|
@@ -1201,6 +1202,22 @@ action (manifest-excluded), so parity is behavioral here, not via the manifest
|
|
|
1201
1202
|
gate. Cross-process only; fuz_app's own wiring is
|
|
1202
1203
|
`src/test/cross_backend/peer_ping_ws.cross.test.ts`.
|
|
1203
1204
|
|
|
1205
|
+
### `cross_backend/ws_inbound_dispatch.ts` — `describe_ws_inbound_dispatch_cross_tests`
|
|
1206
|
+
|
|
1207
|
+
Real-upgrade parity for the two refusals a WebSocket request meets ahead of
|
|
1208
|
+
dispatch: a request whose id names a request still running on the socket →
|
|
1209
|
+
`invalid_request` with `data.reason: 'duplicate_request_id'`, not dispatched
|
|
1210
|
+
(the running request answers under its id as usual, and the id frees once it
|
|
1211
|
+
has); and past the per-socket in-flight ceiling (128 on both spines) a new
|
|
1212
|
+
request → `queue_overflow` with its id, not dispatched, the socket left open,
|
|
1213
|
+
the duplicate check first. Requests are held in flight with `peer/ping` — the
|
|
1214
|
+
client's responder withholds the server's ping echo until the test releases
|
|
1215
|
+
it — so the suite gates on `capabilities.peer_request`.
|
|
1216
|
+
`describe_ws_inbound_dispatch_cross_tests({setup_test, capabilities, base_url,
|
|
1217
|
+
ws_path})`. The wire literals are independent copies of the producers'
|
|
1218
|
+
constants, so a value changed on one spine fails here. Cross-process only;
|
|
1219
|
+
fuz_app's own wiring is `src/test/cross_backend/ws_inbound_dispatch.cross.test.ts`.
|
|
1220
|
+
|
|
1204
1221
|
### `cross_backend/ws_connection_cap.ts` — `describe_ws_connection_cap_cross_tests`
|
|
1205
1222
|
|
|
1206
1223
|
Real-upgrade parity for the **per-account WebSocket connection cap** — the
|
|
@@ -1442,8 +1459,11 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
|
|
|
1442
1459
|
`create_test_account_with_credentials` (same primitive in-process uses,
|
|
1443
1460
|
keeping write semantics in parity), seeds any `extra_accounts` at the
|
|
1444
1461
|
same bootstrap-equivalent step (the only path for roles like
|
|
1445
|
-
`ROLE_KEEPER` whose `grant_paths` is bootstrap-only),
|
|
1446
|
-
`DaemonTokenState.keeper_account_id` to the new row
|
|
1462
|
+
`ROLE_KEEPER` whose `grant_paths` is bootstrap-only), queues the refresh
|
|
1463
|
+
of `DaemonTokenState.keeper_account_id` to the new row as a post-commit
|
|
1464
|
+
effect (so a reset that rolls back — a throwing `reset_state`, a failed
|
|
1465
|
+
commit — leaves the cache on the keeper still in the database, and the
|
|
1466
|
+
next reset can still authenticate), then fires the
|
|
1447
1467
|
consumer-supplied `reset_state(db)` callback for domain-state reset —
|
|
1448
1468
|
passed the **transactional** `Db` the auth wipe ran on, so DB-domain
|
|
1449
1469
|
consumers (e.g. fuz_forge truncating its cell / fact / file tables) reset
|
|
@@ -1461,7 +1481,8 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
|
|
|
1461
1481
|
`audit_log_list` is authoritative — the deterministic barrier a
|
|
1462
1482
|
cross-process audit assertion fires before reading (no poll/sleep). The
|
|
1463
1483
|
emitter must be built with `create_audit_emitter({track_inflight: true})`
|
|
1464
|
-
(the spine binary's `audit_factory` does
|
|
1484
|
+
(the spine binary's `audit_factory` does — pinned by
|
|
1485
|
+
`cross_backend/testing_spine_server.audit.test.ts`), or the drain resolves at once.
|
|
1465
1486
|
The barrier is needed whatever the transport: HTTP on a binary running
|
|
1466
1487
|
`await_pending_effects: true` settles a mutation's writes before
|
|
1467
1488
|
responding, but WS replies before its effects flush, so a WS mutation's
|
|
@@ -1814,10 +1835,10 @@ binary (the TS analog of the Rust `testing_spine_stub`), so consumers don't
|
|
|
1814
1835
|
re-roll the serve / daemon-info / WS-attach / drain boilerplate:
|
|
1815
1836
|
|
|
1816
1837
|
- `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.
|
|
1817
|
-
- `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 `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 an oversized message is refused at the frame layer (still `WS_CLOSE_MESSAGE_TOO_BIG`) before it is buffered whole. Deno
|
|
1838
|
+
- `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 `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 an oversized message is refused at the frame layer (still `WS_CLOSE_MESSAGE_TOO_BIG`) before it is buffered whole. Bun's adapter sets twice it as its frame cap (see below); Deno takes no frame cap and keeps the per-message check alone.
|
|
1818
1839
|
- `testing/cross_backend/testing_server_deno.ts` — `create_deno_testing_adapter()` (`Deno.serve` + `@hono/deno`, an optional peer dep; `Deno` declared locally so it typechecks under the Node toolchain). Spawn the entry with `--sloppy-imports` (Deno doesn't do `.js`→`.ts`; Gro's loader does, so the Node path needs no flag).
|
|
1819
|
-
- `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), and Bun resolves `.js`→`.ts` natively (no flag, unlike Deno). Reuses `create_node_runtime` (Bun implements the `node:fs`/`node:process` surface). WS is module-level + stateless (like Deno) — the `websocket` handler is threaded into `serve`, where `Bun.serve` wants it, so no post-serve attach.
|
|
1820
|
-
- `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. `$lib`-free (it's reached by the spawned binary under Gro's loader, which doesn't resolve `$lib`), so keep it on relative imports. Shared by the spine_stub cross test, the TS cross tests, and the binary.
|
|
1840
|
+
- `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), and Bun resolves `.js`→`.ts` natively (no flag, unlike Deno). Reuses `create_node_runtime` (Bun implements the `node:fs`/`node:process` surface). WS is module-level + stateless (like Deno) — 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.
|
|
1841
|
+
- `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. `$lib`-free (it's reached by the spawned binary under Gro's loader, which doesn't resolve `$lib`), so keep it on relative imports. Shared by the spine_stub cross test, the TS cross tests, and the binary.
|
|
1821
1842
|
- `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. Also `$lib`-free.
|
|
1822
1843
|
- `testing/cross_backend/ts_spine_backend_config.ts` — `ts_spine_node_backend_config()` / `ts_spine_deno_backend_config()` / `ts_spine_bun_backend_config()` presets (in-memory PGlite, no external infra), the TS analog of `rust_spine_stub_backend_config()`.
|
|
1823
1844
|
|
|
@@ -21,7 +21,7 @@ import type { PasswordHashDeps } from '../auth/password.js';
|
|
|
21
21
|
import { type SessionOptions } from '../auth/session_cookie.js';
|
|
22
22
|
import { type MigrationNamespace } from '../db/migrate.js';
|
|
23
23
|
import { type AppBackend, type AuditFactory } from '../server/app_backend.js';
|
|
24
|
-
import { type AppServerOptions, type BootstrapServerOptions, type BootstrapLiveOptions } from '../server/app_server.js';
|
|
24
|
+
import { type AppServer, type AppServerOptions, type BootstrapServerOptions, type BootstrapLiveOptions } from '../server/app_server.js';
|
|
25
25
|
import type { AppServerContext } from '../server/app_server_context.js';
|
|
26
26
|
import type { AppSurface, AppSurfaceSpec } from '../http/surface.js';
|
|
27
27
|
import type { RouteSpec } from '../http/route_spec.js';
|
|
@@ -201,11 +201,30 @@ export interface TestAppServerOptions {
|
|
|
201
201
|
*
|
|
202
202
|
* Matches the production shape — `create_app_backend` requires an
|
|
203
203
|
* `audit_factory` and `create_test_app_server` mirrors that contract
|
|
204
|
-
* end-to-end.
|
|
205
|
-
* fields were removed alongside the `CreateAppBackendOptions` rename.
|
|
204
|
+
* end-to-end.
|
|
206
205
|
*/
|
|
207
206
|
audit_factory?: AuditFactory;
|
|
208
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Create an app server with a bootstrapped account for testing.
|
|
210
|
+
*
|
|
211
|
+
* Sets up:
|
|
212
|
+
* - Auth tables (via cached PGlite factory, or reuses existing `db`)
|
|
213
|
+
* - A keeper account with hashed password
|
|
214
|
+
* - Role role_grants for each role in `options.roles`
|
|
215
|
+
* - An API token for Bearer auth
|
|
216
|
+
* - A session with a signed cookie value
|
|
217
|
+
*
|
|
218
|
+
* Uses `stub_password_deps` by default — deterministic hashing that works
|
|
219
|
+
* correctly for login/logout tests without Argon2 overhead.
|
|
220
|
+
*
|
|
221
|
+
* @param options - session options and optional overrides
|
|
222
|
+
* @returns a `TestAppServer` ready for HTTP testing
|
|
223
|
+
* @mutates the underlying database — when `db` is supplied, first resets the
|
|
224
|
+
* `app_settings` row (`open_signup`, `updated_at`, `updated_by`); in either
|
|
225
|
+
* branch inserts an account, actor, role role_grants, API token, and session
|
|
226
|
+
* row, and flips `bootstrap_lock.bootstrapped` (`bootstrap_test_keeper`).
|
|
227
|
+
*/
|
|
209
228
|
export declare const create_test_app_server: (options: TestAppServerOptions) => Promise<TestAppServer>;
|
|
210
229
|
/**
|
|
211
230
|
* Configuration for `create_test_app`.
|
|
@@ -291,6 +310,13 @@ export interface CreateTestAppAccountArgs {
|
|
|
291
310
|
export interface TestApp {
|
|
292
311
|
app: Hono;
|
|
293
312
|
backend: TestAppServer;
|
|
313
|
+
/**
|
|
314
|
+
* The assembled `AppServer` — reach for what `create_app_server` built
|
|
315
|
+
* beyond the fields lifted onto `TestApp`: `audit_sse` (with
|
|
316
|
+
* `audit_log_sse` in `app_options`), the `ws_endpoints` transports,
|
|
317
|
+
* `bootstrap_status`, `migration_results`.
|
|
318
|
+
*/
|
|
319
|
+
server: AppServer;
|
|
294
320
|
surface_spec: AppSurfaceSpec;
|
|
295
321
|
surface: AppSurface;
|
|
296
322
|
route_specs: Array<RouteSpec>;
|
|
@@ -305,6 +331,13 @@ export interface TestApp {
|
|
|
305
331
|
/** Cleanup resources — `AppServer.close`: stops an opted-in auth cleanup schedule, closes live connections, disposes the limiters the server built and removes the audit listeners and closer members it added, then the backend's `close`. Idempotent. */
|
|
306
332
|
cleanup: () => Promise<void>;
|
|
307
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* The loopback `create_app_server` options an in-process test server takes:
|
|
336
|
+
* `localhost` origins allowed, the loopback proxy trusted (so
|
|
337
|
+
* `X-Forwarded-For` sets the client IP), and an empty env schema. A fresh
|
|
338
|
+
* object per call — spread it ahead of the options a test varies.
|
|
339
|
+
*/
|
|
340
|
+
export declare const create_loopback_app_server_options: () => Pick<AppServerOptions, "allowed_origins" | "proxy" | "env_schema">;
|
|
308
341
|
/**
|
|
309
342
|
* Create a fully assembled test app with a Hono server, middleware, and routes.
|
|
310
343
|
*
|
|
@@ -354,12 +387,14 @@ export interface CreateTestAppForBootstrapOptions {
|
|
|
354
387
|
export interface TestAppForBootstrap {
|
|
355
388
|
app: Hono;
|
|
356
389
|
backend: AppBackend;
|
|
390
|
+
/** The assembled `AppServer`, as on `TestApp` — `bootstrap_status`, `audit_sse`, the `ws_endpoints` transports. */
|
|
391
|
+
server: AppServer;
|
|
357
392
|
surface_spec: AppSurfaceSpec;
|
|
358
393
|
surface: AppSurface;
|
|
359
394
|
route_specs: Array<RouteSpec>;
|
|
360
395
|
/** Build host/origin request headers for the anonymous bootstrap POST. */
|
|
361
396
|
create_request_headers: (extra?: Record<string, string>) => Record<string, string>;
|
|
362
|
-
/**
|
|
397
|
+
/** Cleanup resources — `AppServer.close`, as on `TestApp`; the backend's own `close` leaves the injected or factory-cached database open. Idempotent. */
|
|
363
398
|
cleanup: () => Promise<void>;
|
|
364
399
|
}
|
|
365
400
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_server.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/app_server.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAGjC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAInD,OAAO,EAA4B,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE5E,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAU5D,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC7F,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG3E,OAAO,EAEN,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,MA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AAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnF,yJAAyJ;IACzJ,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,6BAA6B,GACzC,SAAS,gCAAgC,KACvC,OAAO,CAAC,mBAAmB,CAqE7B,CAAC"}
|
|
@@ -185,26 +185,13 @@ const _build_test_backend = async (options) => {
|
|
|
185
185
|
if (!keyring_result.ok) {
|
|
186
186
|
throw new Error(`Test keyring failed: ${keyring_result.errors.join(', ')}`);
|
|
187
187
|
}
|
|
188
|
-
let
|
|
188
|
+
let db;
|
|
189
|
+
let db_name;
|
|
189
190
|
if (existing_db) {
|
|
190
191
|
// Reset singleton config row from a previous test (harmless on fresh pglite).
|
|
191
192
|
await existing_db.query('UPDATE app_settings SET open_signup = false, updated_at = NULL, updated_by = NULL WHERE open_signup = true OR updated_at IS NOT NULL');
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
db_type,
|
|
195
|
-
db_name: 'test',
|
|
196
|
-
migration_results: [], // migrations ran in the factory's init_schema
|
|
197
|
-
close: async () => { },
|
|
198
|
-
deps: {
|
|
199
|
-
keyring: keyring_result.keyring,
|
|
200
|
-
password,
|
|
201
|
-
db: existing_db,
|
|
202
|
-
log: test_log,
|
|
203
|
-
audit,
|
|
204
|
-
connection_closer: create_realtime_closer(),
|
|
205
|
-
...fs_stubs
|
|
206
|
-
}
|
|
207
|
-
};
|
|
193
|
+
db = existing_db;
|
|
194
|
+
db_name = 'test';
|
|
208
195
|
}
|
|
209
196
|
else {
|
|
210
197
|
// In-memory PGlite via cached factory — reuses the WASM instance from `testing/db.ts`
|
|
@@ -213,30 +200,52 @@ const _build_test_backend = async (options) => {
|
|
|
213
200
|
// copy of `testing/db.ts` — under the `db` project's `isolate: false` +
|
|
214
201
|
// `fileParallelism: false` that is once for the whole run.
|
|
215
202
|
// `migration_namespaces` selects an auth+extras factory; auth-only is the default.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
// here, and no caller reads this field to pick behavior — it is reported, not
|
|
219
|
-
// dispatched on.
|
|
220
|
-
const db = await resolve_fallback_factory(migration_namespaces).create();
|
|
221
|
-
const audit = audit_factory({ db, log: test_log });
|
|
222
|
-
backend = {
|
|
223
|
-
db_type: 'pglite-memory',
|
|
224
|
-
db_name: '(memory)',
|
|
225
|
-
migration_results: [],
|
|
226
|
-
close: async () => { },
|
|
227
|
-
deps: {
|
|
228
|
-
keyring: keyring_result.keyring,
|
|
229
|
-
password,
|
|
230
|
-
db,
|
|
231
|
-
log: test_log,
|
|
232
|
-
audit,
|
|
233
|
-
connection_closer: create_realtime_closer(),
|
|
234
|
-
...fs_stubs
|
|
235
|
-
}
|
|
236
|
-
};
|
|
203
|
+
db = await resolve_fallback_factory(migration_namespaces).create();
|
|
204
|
+
db_name = '(memory)';
|
|
237
205
|
}
|
|
206
|
+
const backend = {
|
|
207
|
+
// a supplied `db` reports the caller's `db_type`; the auto-created one names
|
|
208
|
+
// PGlite unconditionally — a run that installs a substitute factory
|
|
209
|
+
// (`set_substitute_db_factory`) before this module loads gets that driver
|
|
210
|
+
// here, and no caller reads this field to pick behavior: it is reported,
|
|
211
|
+
// not dispatched on
|
|
212
|
+
db_type: existing_db ? db_type : 'pglite-memory',
|
|
213
|
+
db_name,
|
|
214
|
+
// the factory's init ran the migrations, for a supplied `db` and the auto-created one alike
|
|
215
|
+
migration_results: [],
|
|
216
|
+
close: async () => { },
|
|
217
|
+
deps: {
|
|
218
|
+
keyring: keyring_result.keyring,
|
|
219
|
+
password,
|
|
220
|
+
db,
|
|
221
|
+
log: test_log,
|
|
222
|
+
audit: audit_factory({ db, log: test_log }),
|
|
223
|
+
connection_closer: create_realtime_closer(),
|
|
224
|
+
...fs_stubs
|
|
225
|
+
}
|
|
226
|
+
};
|
|
238
227
|
return { backend, keyring: keyring_result.keyring };
|
|
239
228
|
};
|
|
229
|
+
/**
|
|
230
|
+
* Create an app server with a bootstrapped account for testing.
|
|
231
|
+
*
|
|
232
|
+
* Sets up:
|
|
233
|
+
* - Auth tables (via cached PGlite factory, or reuses existing `db`)
|
|
234
|
+
* - A keeper account with hashed password
|
|
235
|
+
* - Role role_grants for each role in `options.roles`
|
|
236
|
+
* - An API token for Bearer auth
|
|
237
|
+
* - A session with a signed cookie value
|
|
238
|
+
*
|
|
239
|
+
* Uses `stub_password_deps` by default — deterministic hashing that works
|
|
240
|
+
* correctly for login/logout tests without Argon2 overhead.
|
|
241
|
+
*
|
|
242
|
+
* @param options - session options and optional overrides
|
|
243
|
+
* @returns a `TestAppServer` ready for HTTP testing
|
|
244
|
+
* @mutates the underlying database — when `db` is supplied, first resets the
|
|
245
|
+
* `app_settings` row (`open_signup`, `updated_at`, `updated_by`); in either
|
|
246
|
+
* branch inserts an account, actor, role role_grants, API token, and session
|
|
247
|
+
* row, and flips `bootstrap_lock.bootstrapped` (`bootstrap_test_keeper`).
|
|
248
|
+
*/
|
|
240
249
|
export const create_test_app_server = async (options) => {
|
|
241
250
|
const { session_options, password = stub_password_deps, username = 'keeper', password_value = DEFAULT_TEST_PASSWORD, roles = [ROLE_KEEPER] } = options;
|
|
242
251
|
const { backend, keyring } = await _build_test_backend(options);
|
|
@@ -257,18 +266,40 @@ export const create_test_app_server = async (options) => {
|
|
|
257
266
|
};
|
|
258
267
|
};
|
|
259
268
|
/**
|
|
260
|
-
* The `create_app_server` options
|
|
261
|
-
*
|
|
269
|
+
* The loopback `create_app_server` options an in-process test server takes:
|
|
270
|
+
* `localhost` origins allowed, the loopback proxy trusted (so
|
|
271
|
+
* `X-Forwarded-For` sets the client IP), and an empty env schema. A fresh
|
|
272
|
+
* object per call — spread it ahead of the options a test varies.
|
|
262
273
|
*/
|
|
263
|
-
const
|
|
274
|
+
export const create_loopback_app_server_options = () => ({
|
|
264
275
|
allowed_origins: [/^http:\/\/localhost/],
|
|
265
276
|
proxy: { trusted_proxies: ['127.0.0.1'], get_connection_ip: () => '127.0.0.1' },
|
|
266
|
-
env_schema: z.object({})
|
|
277
|
+
env_schema: z.object({})
|
|
278
|
+
});
|
|
279
|
+
/**
|
|
280
|
+
* The `create_app_server` options both test-app builders share — a fresh
|
|
281
|
+
* object per call, spread ahead of the per-builder options and `app_options`.
|
|
282
|
+
*/
|
|
283
|
+
const test_app_options = () => ({
|
|
284
|
+
...create_loopback_app_server_options(),
|
|
267
285
|
// every limiter off unless `app_options` passes one — a rate-limit test
|
|
268
286
|
// enables just the limiter it pins
|
|
269
287
|
rate_limiters: 'disabled_for_testing',
|
|
270
288
|
await_pending_effects: true
|
|
271
289
|
});
|
|
290
|
+
/** Build request headers carrying `session_cookie` in the `cookie_name` cookie. */
|
|
291
|
+
const create_session_headers_builder = (cookie_name, session_cookie) => (extra) => ({
|
|
292
|
+
host: 'localhost',
|
|
293
|
+
origin: 'http://localhost:5173',
|
|
294
|
+
cookie: `${cookie_name}=${session_cookie}`,
|
|
295
|
+
...extra
|
|
296
|
+
});
|
|
297
|
+
/** Build request headers carrying `api_token` as a Bearer token. */
|
|
298
|
+
const create_bearer_headers_builder = (api_token) => (extra) => ({
|
|
299
|
+
host: 'localhost',
|
|
300
|
+
authorization: `Bearer ${api_token}`,
|
|
301
|
+
...extra
|
|
302
|
+
});
|
|
272
303
|
/**
|
|
273
304
|
* Create a fully assembled test app with a Hono server, middleware, and routes.
|
|
274
305
|
*
|
|
@@ -296,7 +327,7 @@ export const create_test_app = async (options) => {
|
|
|
296
327
|
keeper_account_id: test_server.account.id
|
|
297
328
|
};
|
|
298
329
|
const result = await create_app_server({
|
|
299
|
-
...
|
|
330
|
+
...test_app_options(),
|
|
300
331
|
backend: test_server,
|
|
301
332
|
session_options: options.session_options,
|
|
302
333
|
daemon_token_state,
|
|
@@ -311,17 +342,8 @@ export const create_test_app = async (options) => {
|
|
|
311
342
|
const { app, surface_spec } = result;
|
|
312
343
|
const { cookie_name } = options.session_options;
|
|
313
344
|
const { password = stub_password_deps } = options;
|
|
314
|
-
const create_session_headers = (
|
|
315
|
-
|
|
316
|
-
origin: 'http://localhost:5173',
|
|
317
|
-
cookie: `${cookie_name}=${test_server.session_cookie}`,
|
|
318
|
-
...extra
|
|
319
|
-
});
|
|
320
|
-
const create_bearer_headers = (extra) => ({
|
|
321
|
-
host: 'localhost',
|
|
322
|
-
authorization: `Bearer ${test_server.api_token}`,
|
|
323
|
-
...extra
|
|
324
|
-
});
|
|
345
|
+
const create_session_headers = create_session_headers_builder(cookie_name, test_server.session_cookie);
|
|
346
|
+
const create_bearer_headers = create_bearer_headers_builder(test_server.api_token);
|
|
325
347
|
const create_daemon_token_headers = (extra) => ({
|
|
326
348
|
host: 'localhost',
|
|
327
349
|
[DAEMON_TOKEN_HEADER]: test_daemon_token,
|
|
@@ -342,22 +364,14 @@ export const create_test_app = async (options) => {
|
|
|
342
364
|
});
|
|
343
365
|
return {
|
|
344
366
|
...bootstrapped,
|
|
345
|
-
create_session_headers: (
|
|
346
|
-
|
|
347
|
-
origin: 'http://localhost:5173',
|
|
348
|
-
cookie: `${cookie_name}=${bootstrapped.session_cookie}`,
|
|
349
|
-
...extra
|
|
350
|
-
}),
|
|
351
|
-
create_bearer_headers: (extra) => ({
|
|
352
|
-
host: 'localhost',
|
|
353
|
-
authorization: `Bearer ${bootstrapped.api_token}`,
|
|
354
|
-
...extra
|
|
355
|
-
})
|
|
367
|
+
create_session_headers: create_session_headers_builder(cookie_name, bootstrapped.session_cookie),
|
|
368
|
+
create_bearer_headers: create_bearer_headers_builder(bootstrapped.api_token)
|
|
356
369
|
};
|
|
357
370
|
};
|
|
358
371
|
return {
|
|
359
372
|
app,
|
|
360
373
|
backend: test_server,
|
|
374
|
+
server: result,
|
|
361
375
|
surface_spec,
|
|
362
376
|
surface: surface_spec.surface,
|
|
363
377
|
route_specs: surface_spec.route_specs,
|
|
@@ -416,8 +430,9 @@ export const create_test_app_for_bootstrap = async (options) => {
|
|
|
416
430
|
}
|
|
417
431
|
};
|
|
418
432
|
const { backend } = await _build_test_backend({ ...options, fs_stubs });
|
|
419
|
-
//
|
|
420
|
-
//
|
|
433
|
+
// No keeper account exists pre-bootstrap, so no daemon token can authenticate
|
|
434
|
+
// — a placeholder, passed so the daemon-token middleware mounts as it does
|
|
435
|
+
// under `create_test_app` and the two surfaces match.
|
|
421
436
|
const daemon_token_state = {
|
|
422
437
|
current_token: generate_daemon_token(),
|
|
423
438
|
previous_token: null,
|
|
@@ -425,7 +440,7 @@ export const create_test_app_for_bootstrap = async (options) => {
|
|
|
425
440
|
keeper_account_id: null
|
|
426
441
|
};
|
|
427
442
|
const result = await create_app_server({
|
|
428
|
-
...
|
|
443
|
+
...test_app_options(),
|
|
429
444
|
backend,
|
|
430
445
|
session_options,
|
|
431
446
|
daemon_token_state,
|
|
@@ -442,6 +457,7 @@ export const create_test_app_for_bootstrap = async (options) => {
|
|
|
442
457
|
return {
|
|
443
458
|
app: result.app,
|
|
444
459
|
backend,
|
|
460
|
+
server: result,
|
|
445
461
|
surface_spec: result.surface_spec,
|
|
446
462
|
surface: result.surface_spec.surface,
|
|
447
463
|
route_specs: result.surface_spec.route_specs,
|
|
@@ -51,7 +51,7 @@ const create_admin_observer = (fixture) => fixture.create_account({ username: 'a
|
|
|
51
51
|
* future-proofs against tests with more emissions; per-test
|
|
52
52
|
* `auth_integration_truncate_tables` keeps the table empty between cases.
|
|
53
53
|
*
|
|
54
|
-
* `observer` is a dedicated admin account (see
|
|
54
|
+
* `observer` is a dedicated admin account (see `create_admin_observer`)
|
|
55
55
|
* — its credentials are never the subject of the mutation under test, so the
|
|
56
56
|
* read works uniformly across every flow including session-revoking ones.
|
|
57
57
|
*/
|
|
@@ -22,7 +22,7 @@ import type { AuditLogInput } from '../auth/audit_log_schema.js';
|
|
|
22
22
|
*/
|
|
23
23
|
export declare const install_audit_drift_guard: () => void;
|
|
24
24
|
/**
|
|
25
|
-
* Pair returned by
|
|
25
|
+
* Pair returned by `create_recording_audit_emitter` — the
|
|
26
26
|
* `AuditEmitter` to inject as `deps.audit`, plus the shared `calls`
|
|
27
27
|
* array that records every captured emission. Both fields are live —
|
|
28
28
|
* callers read `calls` after exercising the handler to assert on the
|
|
@@ -47,7 +47,7 @@ export declare const spine_session_options: SessionOptions<string>;
|
|
|
47
47
|
* (`admin_account_list.grantable_roles` carries it on both spines).
|
|
48
48
|
*/
|
|
49
49
|
export declare const spine_roles: RoleSchemaResult;
|
|
50
|
-
/** Options for
|
|
50
|
+
/** Options for `spine_rpc_endpoints`. */
|
|
51
51
|
export interface SpineRpcEndpointsOptions {
|
|
52
52
|
/**
|
|
53
53
|
* WS notification sender threaded into the role-grant-offer sub-factory for
|
|
@@ -97,7 +97,7 @@ export declare const spine_rpc_endpoints: (ctx: AppServerContext, options?: Spin
|
|
|
97
97
|
export declare const create_spine_route_specs: (ctx: AppServerContext) => Array<RouteSpec>;
|
|
98
98
|
/**
|
|
99
99
|
* The spine's `/ready` route spec — the column-presence schema-drift deploy
|
|
100
|
-
* gate, reading
|
|
100
|
+
* gate, reading `SPINE_EXPECTED_SCHEMA_URL`. Mounted **live** by the TS
|
|
101
101
|
* spine binary (in `build_spine_app`) and the in-process readiness parity leg,
|
|
102
102
|
* but kept **off** the declared surface (`create_spine_surface_spec`) like the
|
|
103
103
|
* fact-serving / ws / sse behaviors — `describe_ready_cross_tests` (gated on
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default_spine_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/default_spine_surface.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAItD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEtF,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAI1F,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAe3E;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,MAAM,CAAwC,CAAC;AAElG;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAE,gBAGxB,CAAC;AAEH
|
|
1
|
+
{"version":3,"file":"default_spine_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/default_spine_surface.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAItD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEtF,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAI1F,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAe3E;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,MAAM,CAAwC,CAAC;AAElG;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAE,gBAGxB,CAAC;AAEH,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACxC;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACzD;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAC/B,KAAK,gBAAgB,EACrB,UAAU,wBAAwB,KAChC,KAAK,CAAC,eAAe,CAQvB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GAAI,KAAK,gBAAgB,KAAG,KAAK,CAAC,SAAS,CAgC/E,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,6BAA6B,GAAI,MAAM,MAAM,KAAG,SAC+B,CAAC;AAE7F;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,QAAO,cAS1C,CAAC"}
|
|
@@ -102,7 +102,7 @@ export const create_spine_route_specs = (ctx) => [
|
|
|
102
102
|
];
|
|
103
103
|
/**
|
|
104
104
|
* The spine's `/ready` route spec — the column-presence schema-drift deploy
|
|
105
|
-
* gate, reading
|
|
105
|
+
* gate, reading `SPINE_EXPECTED_SCHEMA_URL`. Mounted **live** by the TS
|
|
106
106
|
* spine binary (in `build_spine_app`) and the in-process readiness parity leg,
|
|
107
107
|
* but kept **off** the declared surface (`create_spine_surface_spec`) like the
|
|
108
108
|
* fact-serving / ws / sse behaviors — `describe_ready_cross_tests` (gated on
|
|
@@ -124,5 +124,8 @@ export const create_spine_surface_spec = () => create_test_app_surface_spec({
|
|
|
124
124
|
session_options: spine_session_options,
|
|
125
125
|
create_route_specs: create_spine_route_specs,
|
|
126
126
|
rpc_endpoints: spine_rpc_endpoints,
|
|
127
|
-
bootstrap: { mode: 'surface_only' }
|
|
127
|
+
bootstrap: { mode: 'surface_only' },
|
|
128
|
+
// both spine binaries mount the daemon-token layer (the TS one rotates a
|
|
129
|
+
// token on disk); `GET /api/surface` stays off, the default on both
|
|
130
|
+
daemon_token: true
|
|
128
131
|
});
|
|
@@ -279,7 +279,7 @@ export const describe_identity_parity_cross_tests = (options) => {
|
|
|
279
279
|
const signup = (fixture, username, password = DEFAULT_TEST_PASSWORD) => post_json(fixture, signup_path, { username, password });
|
|
280
280
|
/**
|
|
281
281
|
* Assert an attempt settled to `status` **and** carried the flat-REST error
|
|
282
|
-
* reason that status implies on every spine (see
|
|
282
|
+
* reason that status implies on every spine (see `REASON_BY_STATUS`) —
|
|
283
283
|
* a body-shape check, not just a status check, so a backend can't pass by
|
|
284
284
|
* returning the right status with the wrong/leaky body.
|
|
285
285
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in_process_setup.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/in_process_setup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqB9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,EAIN,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAGN,KAAK,uBAAuB,EAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA2B,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEtF,OAAO,EAGN,KAAK,SAAS,EAEd,KAAK,gBAAgB,EACrB,MAAM,YAAY,CAAC;AAepB;;;;;GAKG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IAClE;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC1D;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,qBAAqB,KAAG,SAqEjC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAC5C,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,kBAAkB,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACjD;;;OAGG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CAChC;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,gCAAgC,GAAI,KAAK,CAAC,CAAC,SAAS,4BAA4B,EAC5F,SAAS,CAAC,KACR;IACF,UAAU,EAAE,SAAS,CAAC;IACtB,cAAc,EAAE,cAAc,CAAC;IAC/B,YAAY,EAAE,mBAAmB,CAAC;IAClC,eAAe,EAAE,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACtC,kBAAkB,EAAE,CAAC,CAAC,oBAAoB,CAAC,CAAC;IAC5C,aAAa,EAAE,CAAC,CAAC,eAAe,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"in_process_setup.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/in_process_setup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqB9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,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AAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACjD;;;OAGG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CAChC;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,gCAAgC,GAAI,KAAK,CAAC,CAAC,SAAS,4BAA4B,EAC5F,SAAS,CAAC,KACR;IACF,UAAU,EAAE,SAAS,CAAC;IACtB,cAAc,EAAE,cAAc,CAAC;IAC/B,YAAY,EAAE,mBAAmB,CAAC;IAClC,eAAe,EAAE,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACtC,kBAAkB,EAAE,CAAC,CAAC,oBAAoB,CAAC,CAAC;IAC5C,aAAa,EAAE,CAAC,CAAC,eAAe,CAAC,CAAC;CA8BjC,CAAC"}
|
|
@@ -157,7 +157,10 @@ export const default_in_process_suite_options = (options) => ({
|
|
|
157
157
|
// Mirror what `create_test_app` → `create_app_server` will mount.
|
|
158
158
|
// Both helpers read from the top-level `bootstrap` slot so surface
|
|
159
159
|
// and live app stay in sync by construction.
|
|
160
|
-
bootstrap: options.bootstrap
|
|
160
|
+
bootstrap: options.bootstrap,
|
|
161
|
+
surface_route: options.app_options?.surface_route,
|
|
162
|
+
// `create_test_app` always passes a `daemon_token_state`
|
|
163
|
+
daemon_token: true
|
|
161
164
|
}),
|
|
162
165
|
capabilities: in_process_capabilities,
|
|
163
166
|
session_options: options.session_options,
|
|
@@ -39,7 +39,7 @@ export interface MethodCoverageEntry {
|
|
|
39
39
|
/** Optional free-text note printed nowhere — documentation for the reader. */
|
|
40
40
|
readonly note?: string;
|
|
41
41
|
}
|
|
42
|
-
/** Inputs for
|
|
42
|
+
/** Inputs for `assert_rpc_method_coverage`. */
|
|
43
43
|
export interface RpcMethodCoverageInput {
|
|
44
44
|
/** Every method the live RPC endpoint mounts (`action.spec.method`). */
|
|
45
45
|
readonly live_methods: ReadonlyArray<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method_coverage.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/method_coverage.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAiC9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,sEAAsE;AACtE,MAAM,MAAM,kBAAkB;AAC7B;;;;GAIG;AACD,UAAU,CAAC;;;;GAIV,GACD,aAAa,CAAC;;;;GAIb,GACD,UAAU,CAAC;AAEd,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IACnC,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,mBAAmB,CAAC;IAChD;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACvB;AAED
|
|
1
|
+
{"version":3,"file":"method_coverage.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/method_coverage.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAiC9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,sEAAsE;AACtE,MAAM,MAAM,kBAAkB;AAC7B;;;;GAIG;AACD,UAAU,CAAC;;;;GAIV,GACD,aAAa,CAAC;;;;GAIb,GACD,UAAU,CAAC;AAEd,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IACnC,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,mBAAmB,CAAC;IAChD;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,+CAA+C;AAC/C,MAAM,WAAW,sBAAsB;IACtC,wEAAwE;IACxE,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7C,wEAAwE;IACxE,QAAQ,CAAC,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjD,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IACtD,yDAAyD;IACzD,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CACxC;AAID;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,GAAI,OAAO,sBAAsB,KAAG,IAyF1E,CAAC"}
|
|
@@ -14,8 +14,8 @@ import '../assert_dev_env.js';
|
|
|
14
14
|
* actually claimed by a suite — so a newly mounted-but-untested method could
|
|
15
15
|
* ship silently.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
* set against a
|
|
17
|
+
* `assert_rpc_method_coverage` closes that gap: it diffs the live method
|
|
18
|
+
* set against a `MethodCoverageEntry` manifest (both directions — a
|
|
19
19
|
* mounted-but-unclaimed method *and* a stale manifest row both fail loud) and
|
|
20
20
|
* checks each entry's tier is consistent with the declared surface + the
|
|
21
21
|
* backdoor prefix. The manifest becomes the forcing function — a new method
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
import { type BackendCapabilities } from './capabilities.js';
|
|
3
3
|
import type { SetupTest } from './setup.js';
|
|
4
|
-
/** Configuration for
|
|
4
|
+
/** Configuration for `describe_peer_ping_ws_tests`. */
|
|
5
5
|
export interface PeerPingWsTestOptions {
|
|
6
6
|
/** Per-test fixture producer (`default_cross_process_setup(handle, ...)`). */
|
|
7
7
|
readonly setup_test: SetupTest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer_ping_ws.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/peer_ping_ws.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAkD9B,OAAO,EAAE,KAAK,mBAAmB,EAAW,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAuB5C,
|
|
1
|
+
{"version":3,"file":"peer_ping_ws.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/peer_ping_ws.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAkD9B,OAAO,EAAE,KAAK,mBAAmB,EAAW,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAuB5C,uDAAuD;AACvD,MAAM,WAAW,qBAAqB;IACrC,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,iFAAiF;IACjF,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,GAAI,SAAS,qBAAqB,KAAG,IA8O5E,CAAC"}
|