@fuzdev/fuz_app 0.183.0 → 0.185.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 +538 -1223
- package/dist/actions/action_codegen.d.ts +1 -1
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +3 -2
- package/dist/actions/connection_closer.d.ts +11 -9
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +11 -9
- package/dist/actions/frontend_rpc_client.d.ts +1 -1
- package/dist/actions/register_action_ws.d.ts +21 -1
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +2 -1
- package/dist/actions/ws_socket_session.d.ts +25 -4
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +81 -25
- package/dist/auth/CLAUDE.md +433 -1048
- package/dist/auth/account_queries.d.ts +1 -1
- package/dist/auth/account_queries.js +1 -1
- package/dist/auth/account_routes.d.ts +4 -5
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +8 -10
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +10 -11
- package/dist/auth/api_token.d.ts +20 -3
- package/dist/auth/api_token.d.ts.map +1 -1
- package/dist/auth/api_token.js +28 -9
- package/dist/auth/api_token_queries.d.ts +2 -2
- package/dist/auth/api_token_queries.js +2 -2
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +3 -2
- package/dist/auth/audit_log_schema.d.ts +15 -9
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +1 -2
- package/dist/auth/auth_guard_resolver.d.ts +1 -1
- package/dist/auth/auth_guard_resolver.js +1 -1
- package/dist/auth/bearer_auth.d.ts +2 -5
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +4 -13
- package/dist/auth/bootstrap_account.d.ts +13 -15
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +9 -11
- package/dist/auth/bootstrap_routes.d.ts +20 -21
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +21 -19
- package/dist/auth/bootstrap_token_store.d.ts +3 -4
- package/dist/auth/bootstrap_token_store.d.ts.map +1 -1
- package/dist/auth/bootstrap_token_store.js +1 -1
- package/dist/auth/cleanup.d.ts +34 -3
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +11 -3
- package/dist/auth/daemon_token.d.ts +5 -1
- package/dist/auth/daemon_token.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.d.ts +12 -8
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +15 -21
- package/dist/auth/deps.d.ts +11 -0
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/invite_queries.d.ts +51 -3
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +81 -6
- package/dist/auth/invite_schema.d.ts +2 -1
- package/dist/auth/invite_schema.d.ts.map +1 -1
- package/dist/auth/middleware.d.ts +2 -3
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +3 -3
- package/dist/auth/request_context.d.ts +3 -3
- package/dist/auth/request_context.js +3 -3
- package/dist/auth/role_grant_offer_actions.d.ts +2 -2
- package/dist/auth/role_grant_offer_actions.js +2 -2
- package/dist/auth/session_cookie.d.ts +82 -174
- package/dist/auth/session_cookie.d.ts.map +1 -1
- package/dist/auth/session_cookie.js +80 -130
- package/dist/auth/session_middleware.d.ts +8 -17
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +14 -23
- package/dist/auth/session_queries.d.ts +9 -14
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +8 -9
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +4 -6
- package/dist/db/CLAUDE.md +5 -3
- package/dist/dev/setup.d.ts +3 -1
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +3 -1
- package/dist/http/CLAUDE.md +315 -768
- package/dist/http/db_routes.d.ts +1 -1
- package/dist/http/db_routes.js +1 -1
- package/dist/http/origin.d.ts +7 -8
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +7 -8
- package/dist/http/pending_effects.d.ts +82 -4
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +82 -4
- package/dist/http/route_result.d.ts +1 -1
- package/dist/http/route_spec.d.ts +17 -14
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/realtime/audit_log_sse.d.ts +1 -1
- package/dist/realtime/sse.d.ts +6 -25
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +4 -25
- package/dist/realtime/sse_constants.d.ts +1 -1
- package/dist/realtime/sse_constants.js +1 -1
- package/dist/server/app_backend.d.ts +4 -5
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +3 -1
- package/dist/server/app_server.d.ts +87 -76
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +111 -91
- package/dist/server/app_server_context.d.ts +1 -2
- package/dist/server/app_server_context.d.ts.map +1 -1
- package/dist/server/env.js +2 -2
- package/dist/server/shutdown_drain.d.ts +69 -0
- package/dist/server/shutdown_drain.d.ts.map +1 -0
- package/dist/server/shutdown_drain.js +77 -0
- package/dist/testing/CLAUDE.md +89 -57
- package/dist/testing/admin_integration.d.ts +4 -5
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +39 -23
- package/dist/testing/app_server.d.ts +3 -8
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +10 -9
- package/dist/testing/attack_surface.d.ts +1 -1
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/audit_completeness.d.ts +2 -3
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +1 -1
- package/dist/testing/cross_backend/bootstrap_backend.d.ts +3 -1
- package/dist/testing/cross_backend/bootstrap_backend.d.ts.map +1 -1
- package/dist/testing/cross_backend/bootstrap_backend.js +5 -1
- package/dist/testing/cross_backend/capability_mounts.d.ts.map +1 -1
- package/dist/testing/cross_backend/capability_mounts.js +16 -11
- package/dist/testing/cross_backend/conformance_table.d.ts +5 -6
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +4 -4
- package/dist/testing/cross_backend/cookie_attributes.js +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +10 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +33 -7
- package/dist/testing/cross_backend/default_backend_configs.d.ts +3 -3
- package/dist/testing/cross_backend/default_spine_surface.d.ts +0 -6
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +4 -9
- package/dist/testing/cross_backend/differential.d.ts +2 -3
- package/dist/testing/cross_backend/differential.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential.js +1 -1
- package/dist/testing/cross_backend/full_spine_mount.d.ts +1 -42
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +45 -4
- package/dist/testing/cross_backend/in_process_setup.d.ts +7 -8
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +10 -13
- package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +3 -4
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.js +2 -2
- package/dist/testing/cross_backend/setup.d.ts +1 -1
- package/dist/testing/cross_backend/spawn_backend.d.ts +14 -0
- package/dist/testing/cross_backend/spawn_backend.d.ts.map +1 -1
- package/dist/testing/cross_backend/spawn_backend.js +56 -8
- package/dist/testing/cross_backend/spine_suites.d.ts +18 -16
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +38 -18
- package/dist/testing/cross_backend/standard.d.ts +19 -84
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.js +8 -23
- package/dist/testing/cross_backend/standard_auth.d.ts +74 -0
- package/dist/testing/cross_backend/standard_auth.d.ts.map +1 -0
- package/dist/testing/cross_backend/standard_auth.js +28 -0
- package/dist/testing/cross_backend/standard_bundle.d.ts +48 -0
- package/dist/testing/cross_backend/standard_bundle.d.ts.map +1 -0
- package/dist/testing/cross_backend/standard_bundle.js +43 -0
- package/dist/testing/cross_backend/testing_credential_read.d.ts +10 -11
- package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_credential_read.js +12 -12
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +46 -30
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +52 -31
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +5 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts +16 -3
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +22 -7
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +6 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +7 -3
- package/dist/testing/daemon_token_rotation.d.ts.map +1 -1
- package/dist/testing/daemon_token_rotation.js +2 -3
- package/dist/testing/error_coverage.d.ts +5 -0
- package/dist/testing/error_coverage.d.ts.map +1 -1
- package/dist/testing/error_coverage.js +2 -1
- package/dist/testing/integration.d.ts +6 -23
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +53 -83
- package/dist/testing/integration_helpers.d.ts +16 -0
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +29 -1
- package/dist/testing/middleware_gate_probes.d.ts +55 -1
- package/dist/testing/middleware_gate_probes.d.ts.map +1 -1
- package/dist/testing/middleware_gate_probes.js +69 -3
- package/dist/testing/rate_limiting.d.ts +2 -3
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +3 -3
- package/dist/testing/rpc_helpers.d.ts +1 -2
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +3 -3
- package/dist/testing/rpc_round_trip.d.ts +2 -3
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +1 -1
- package/dist/testing/sse_round_trip.d.ts +2 -3
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/stubs.d.ts +5 -6
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +10 -8
- package/dist/testing/test_app.d.ts +8 -5
- package/dist/testing/test_app.d.ts.map +1 -1
- package/dist/testing/test_app.js +7 -7
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +3 -0
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +1 -2
- package/package.json +1 -1
package/dist/testing/CLAUDE.md
CHANGED
|
@@ -33,12 +33,12 @@ time (never runtime), where a throwing guard would break `vite build`.
|
|
|
33
33
|
- `stub_handler()` — a `route_raw` text answer (`stub`), a handler that fits any route (`attach_route_handler(shape, stub_handler)`).
|
|
34
34
|
- `stub_route_spec(shape)` — a spec for a surface that is described and never served: `shape` with a handler that throws when run (the spine routes of `create_rust_spine_consumer_surface_spec`).
|
|
35
35
|
- `stub_mw` — pass-through middleware (`async (_c, next) => next()`).
|
|
36
|
-
- `create_stub_app_deps()` — factory: fresh `AppDeps` with a stub keyring (`sign` answers `<value>.stub_signature`, so
|
|
36
|
+
- `create_stub_app_deps()` — factory: fresh `AppDeps` with a stub keyring (`sign` answers `<value>.stub_signature`, so a session cookie signed on stub deps is a line; nothing else of it does anything), no-op password, a `create_noop_stub` DB, silent `Logger`, no-op `audit`, an empty `connection_closer` and `notification_sender`.
|
|
37
37
|
- `create_test_audit_emitter()` — no-op `AuditEmitter`; `emit` / `emit_role_grant_target` / `emit_pool` resolve 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, `inflight_count` returns 0.
|
|
38
38
|
- `create_stub_audit_sse()` — no-op `AuditLogSse` for surface-test wiring without booting real SSE. `on_audit_event` no-op (nothing is broadcast); `required_role` is `admin`; `registry` is a fresh `SseRegistry` (live `.count` / `.close_*` for registry-state tests, isolated per call). For real SSE plumbing build via `create_audit_log_sse` against `create_test_app`.
|
|
39
|
-
- `create_stub_api_middleware({include_daemon_token?, origin_carve_outs?})` — stub `MiddlewareSpec[]` with `create_auth_middleware_specs`'s names, paths, order and declared `errors` (pinned against it by `auth/middleware.mounted.test.ts`), each layer its own pass-through handler so `assert_middleware_stack_mounted` tells them apart. A stub declaring more errors than the real layer would widen every route's error map under its path.
|
|
39
|
+
- `create_stub_api_middleware({include_daemon_token?, origin_carve_outs?})` — stub `MiddlewareSpec[]` with `create_auth_middleware_specs`'s names, paths, order and declared `errors` (pinned against it by `auth/middleware.mounted.test.ts`), each layer its own pass-through handler so `assert_middleware_stack_mounted` tells them apart. A stub declaring more errors than the real layer would widen every route's error map under its path. The real stack: `auth/CLAUDE.md` §Middleware.
|
|
40
40
|
- `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.
|
|
41
|
-
- `create_stub_app_server_context(
|
|
41
|
+
- `create_stub_app_server_context(session_cookie_name)` — stub `AppServerContext` over `create_stub_app_backend()`; rate limiters null, `bootstrap_status.available: false`.
|
|
42
42
|
- `create_test_app_surface_spec(options)` — the `AppSurfaceSpec` `create_app_server` would build, in its order (consumer routes, bootstrap, RPC endpoints, `GET /api/surface` when `surface_route: true` — pass both the same value), over a stub middleware list mirroring the real one (body limit, host gate, `trusted_proxy`, the stub auth stack). Single source of truth for attack-surface tests — track `create_app_server` wiring changes here; `testing/test_app_server.db.test.ts` pins it against `create_test_app`. It throws where `create_app_server` throws (the assembly asserts of `auth/CLAUDE.md` §Middleware, and a `ws_endpoints` spec with no `allowed_origins` when none is given). Options: `CreateTestAppSurfaceSpecOptions` TSDoc.
|
|
43
43
|
|
|
44
44
|
Throwing stubs surface mock escape: a test that accidentally reaches into
|
|
@@ -92,6 +92,10 @@ in insert order (lists sort `created_at, id`). The in-process seed and
|
|
|
92
92
|
`query_create_actor_with_clock_timestamp`, so both spines list them alike.
|
|
93
93
|
`query_admin_account_list` is the exception: it sorts `created_at, name, id`
|
|
94
94
|
to keep one actor per account the same on both backends.
|
|
95
|
+
`_testing_reset` stamps each seeded account's session the same way
|
|
96
|
+
(`RESET_SESSION_CLOCK_STAMP_SQL`, `cross_backend/testing_reset_actions.ts`,
|
|
97
|
+
byte for byte the Rust reset's), so the seeded sessions list in seed order on
|
|
98
|
+
both spines rather than tying on one transaction's `NOW()`.
|
|
95
99
|
|
|
96
100
|
`create_test_session_row(db, token_hash, account_id, expires_in_seconds)`
|
|
97
101
|
inserts an `auth_session` row expiring that many seconds past the database's
|
|
@@ -240,7 +244,7 @@ cookie" flow, split by intent:
|
|
|
240
244
|
- `bootstrap_test_keeper(options)` — keeper path used by `create_test_app_server`. Same body as the general helper plus a lock flip (`UPDATE bootstrap_lock SET bootstrapped = true ...`) so test DB state matches a real bootstrap completion, letting production code trust the lock as the single signal.
|
|
241
245
|
- `create_test_account_with_credentials(options)` — general path used by `TestApp.create_account` for additional non-keeper accounts. Same body, no lock interaction (additional accounts aren't bootstraps).
|
|
242
246
|
|
|
243
|
-
Both take `{db, keyring,
|
|
247
|
+
Both take `{db, keyring, password, username?, password_value?, roles?}`
|
|
244
248
|
(shared `CreateTestAccountWithCredentialsOptions` / `BootstrapTestKeeperOptions`),
|
|
245
249
|
and store the username lowercased, as the Rust spine's `_testing_reset` seeds
|
|
246
250
|
do, so the returned `account.username` is its lowercase.
|
|
@@ -248,8 +252,8 @@ do, so the returned `account.username` is its lowercase.
|
|
|
248
252
|
Types:
|
|
249
253
|
|
|
250
254
|
- `TestAppServer extends AppBackend` — adds `account`, `actor`, `api_token`, `session_cookie`, `keyring`, `cleanup()`.
|
|
251
|
-
- `TestAppServerOptions` —
|
|
252
|
-
- `CreateTestAppOptions extends TestAppServerOptions` (`test_app.ts`, as `TestAccount`, `TestApp` and `SuiteAppOptions`) — 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`, `
|
|
255
|
+
- `TestAppServerOptions` — optional `db`, `db_type`, `migration_namespaces`, `password`, `username`, `password_value`, `roles` (default `DEFAULT_TEST_KEEPER_ROLES`, keeper and admin, as a production bootstrap grants), `audit_factory`. `migration_namespaces` runs extra namespaces after auth in the auto-created in-memory database (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`.
|
|
256
|
+
- `CreateTestAppOptions extends TestAppServerOptions` (`test_app.ts`, as `TestAccount`, `TestApp` and `SuiteAppOptions`) — adds `session_cookie_name` and `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_cookie_name`, `create_route_specs`, `rpc_endpoints`, `bootstrap`), and `exclude_db_invariants?` (§`db_invariant_queries.ts` + `db_invariants.ts`).
|
|
253
257
|
- `TestAccount` — `{account, actor, session_cookie, api_token, create_session_headers, create_bearer_headers}`.
|
|
254
258
|
- `TestApp` — `{app, backend, server, surface_spec, surface, route_specs, create_session_headers, create_bearer_headers, create_daemon_token_headers, create_account, assert_db_invariants, 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.
|
|
255
259
|
|
|
@@ -267,9 +271,10 @@ logger. Override via `app_options`. `cleanup()` is the assembled server's idempo
|
|
|
267
271
|
limiters it built, and removes the audit listeners and closer members it
|
|
268
272
|
added.
|
|
269
273
|
|
|
270
|
-
`auth_cleanup` is
|
|
274
|
+
`auth_cleanup` is `'off'` here: a background pass would delete rows and
|
|
271
275
|
write audit rows mid-test. A suite that opts in through `app_options` has the
|
|
272
|
-
schedule stopped by `cleanup()`, which is the assembled server's `close
|
|
276
|
+
schedule stopped by `cleanup()`, which is the assembled server's `close` and
|
|
277
|
+
resolves its `ShutdownDrainGivenUp` report.
|
|
273
278
|
|
|
274
279
|
A fresh Hono app is created on every call because middleware closures bind
|
|
275
280
|
to the server's deps (db, keyring). Hono assembly is cheap;
|
|
@@ -654,7 +659,7 @@ valid credential must name its reason** — `data.reason` over RPC (pass
|
|
|
654
659
|
`{reason}` to `jsonrpc_errors.unauthenticated`), the flat `error` over REST. A
|
|
655
660
|
≥500 carrying a declared code (503 `service_unavailable`, 504 `timeout`, a
|
|
656
661
|
consumer's `register_jsonrpc_error_code`) passes. Options: `{setup_test,
|
|
657
|
-
surface_source,
|
|
662
|
+
surface_source, session_cookie_name, rpc_endpoints, skip_methods?,
|
|
658
663
|
input_overrides?, success_fixtures?}`; a method no picked principal can reach
|
|
659
664
|
goes in `skip_methods`.
|
|
660
665
|
|
|
@@ -686,7 +691,7 @@ actions and the builtin `ROLE_ADMIN` only, each factory on fresh accounts
|
|
|
686
691
|
and calling as one of them, so any consumer mounting
|
|
687
692
|
`create_standard_rpc_actions` can pass it. The fixtures run last on the
|
|
688
693
|
describe's fixture, since they mutate.
|
|
689
|
-
fuz_app wires it through the standard
|
|
694
|
+
fuz_app wires it through the `standard` suite and in the in-process
|
|
690
695
|
`cross_backend/rpc_round_trip_spine.db.test.ts`.
|
|
691
696
|
|
|
692
697
|
### `sse_round_trip.ts` — `describe_sse_route_tests`
|
|
@@ -789,7 +794,7 @@ Each group asserts its required route exists with a descriptive message.
|
|
|
789
794
|
Creates a tight rate limiter (default `max_attempts: 2`, `window_ms: 60_000`)
|
|
790
795
|
per test and disposes it in `finally`.
|
|
791
796
|
|
|
792
|
-
Options: `{
|
|
797
|
+
Options: `{session_cookie_name, create_route_specs, rpc_endpoints?, app_options?, db_factories?, max_attempts?}`.
|
|
793
798
|
Reads inputs directly from the options bag instead of going through the
|
|
794
799
|
`setup_test` fixture protocol — the per-test rate-limiter overrides need a
|
|
795
800
|
fresh `TestApp` per test that the single-fixture model can't carry.
|
|
@@ -815,35 +820,46 @@ cookies + bearer tokens. Its `describe` blocks, by theme:
|
|
|
815
820
|
9. Token revocation + cross-account isolation
|
|
816
821
|
10. Response body schema validation + error-response information leakage
|
|
817
822
|
11. Signup invite edge cases + expired credential rejection + error-coverage breadth
|
|
818
|
-
12. Middleware gates — one test per gate each counted route's error map declares (`middleware_gate_probes.ts`, below)
|
|
819
823
|
|
|
820
824
|
An `ErrorCoverageCollector` runs across groups; `afterAll` filters to
|
|
821
825
|
the routes it counts — login, logout, password, signup (when wired) and the
|
|
822
|
-
RPC path — and asserts `DEFAULT_INTEGRATION_ERROR_COVERAGE` (20%). Bootstrap is
|
|
826
|
+
RPC path (`is_standard_integration_route`, `integration_helpers.ts`) — and asserts `DEFAULT_INTEGRATION_ERROR_COVERAGE` (20%). Bootstrap is
|
|
823
827
|
excluded because no describe block in this suite drives it — its declared
|
|
824
828
|
codes would always be uncovered. Consumer-specific routes aren't exercised
|
|
825
829
|
here either — they don't count against the baseline. The declared paths are
|
|
826
830
|
the route error maps of `surface_source`, middleware included (the origin
|
|
827
831
|
check's 403, the body limit's 413 and 400, and the host gate's 403 where the
|
|
828
832
|
surface declares it), counted per (route, status, code), so
|
|
829
|
-
every error response a test asserts is recorded
|
|
830
|
-
|
|
833
|
+
every error response a test asserts is recorded. The gates' own refusals
|
|
834
|
+
(`MIDDLEWARE_GATE_ERROR_CODES`, `integration_helpers.ts`) are left out of the
|
|
835
|
+
count: `describe_middleware_gate_tests` (below) probes them. Override with
|
|
831
836
|
`error_coverage_min?: number` (set to `0` to skip the assertion — useful for
|
|
832
837
|
minimal route sets whose declared error codes outpace the suite's
|
|
833
838
|
denial-path drivers).
|
|
834
839
|
|
|
835
|
-
Options: `{setup_test, surface_source,
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
840
|
+
Options: `{setup_test, surface_source, capabilities, session_cookie_name,
|
|
841
|
+
rpc_endpoints, error_coverage_min?, check_uncovered_errors?}`; the last is
|
|
842
|
+
called with the declared paths left uncovered before the floor is asserted,
|
|
843
|
+
which fuz_app's own wirings hold to an exact set.
|
|
844
|
+
|
|
845
|
+
### `middleware_gate_probes.ts` — `describe_middleware_gate_tests`
|
|
846
|
+
|
|
847
|
+
`describe_middleware_gate_tests({setup_test, surface_source,
|
|
848
|
+
session_cookie_name, rpc_endpoints, base_url, max_body_bytes?,
|
|
849
|
+
rpc_max_body_bytes?})` — one test per gate each route the integration suite
|
|
850
|
+
counts declares, each refusal's body held to the route's map. Every gate
|
|
851
|
+
refusal (`MIDDLEWARE_GATE_ERROR_CODES`) a counted route declares must have a
|
|
852
|
+
planned probe — the unreadable length aside over a socket — or the call
|
|
853
|
+
throws at collection, so a planner that drops one fails whatever a run
|
|
854
|
+
filters or excludes. A suite of its
|
|
855
|
+
own, beside the integration suite rather than a group of it, because over a
|
|
856
|
+
socket it writes raw heads: the integration suite sends only through the
|
|
857
|
+
fixture transports, so the transcript differential can run it. `base_url` is
|
|
858
|
+
the backend's socket, `null` in-process (`default_in_process_suite_options`
|
|
859
|
+
gives `null`, and `max_body_bytes` from `app_options.max_body_size`); the caps
|
|
842
860
|
default to `SPINE_BODY_LIMIT_DEFAULT_BYTES`, the RPC endpoint's to
|
|
843
861
|
`max_body_bytes`.
|
|
844
862
|
|
|
845
|
-
### `middleware_gate_probes.ts` — the integration suite's gate probes
|
|
846
|
-
|
|
847
863
|
`plan_middleware_gate_probes({route_specs, route_error_maps, base_url,
|
|
848
864
|
max_body_bytes?, rpc_path, rpc_max_body_bytes?})` plans one
|
|
849
865
|
`MiddlewareGateProbe` per gate a route's error map declares, so a carved-out
|
|
@@ -881,9 +897,9 @@ header/account mismatch. Direct-grant fixtures (test focuses on revoke or
|
|
|
881
897
|
isolation, not the consent path) go through `create_test_role_grant_direct`
|
|
882
898
|
from `db_entities.ts`.
|
|
883
899
|
|
|
884
|
-
Required options: `{setup_test, surface_source,
|
|
900
|
+
Required options: `{setup_test, surface_source, session_cookie_name, rpc_endpoints: RpcEndpointsSuiteOption, roles: RoleRegistry, admin_prefix?}`.
|
|
885
901
|
|
|
886
|
-
fuz_app runs it cross-process through
|
|
902
|
+
fuz_app runs it cross-process through `standard_auth`
|
|
887
903
|
and in-process as a consumer wires it
|
|
888
904
|
(`cross_backend/admin_integration_spine.db.test.ts`) — the in-process fixture's
|
|
889
905
|
`create_account` inserts rows directly, writing no `invite_create` or `signup`
|
|
@@ -979,7 +995,7 @@ Registry lookups:
|
|
|
979
995
|
- `find_rpc_method(rpc_endpoints, method)` — surface-shape lookup over `AppSurfaceRpcEndpoint[]` (generated by `generate_app_surface`).
|
|
980
996
|
- `require_rpc_endpoint_path(rpc_endpoints)` — returns the single endpoint path; throws descriptively on zero or multiple endpoints. Used by the admin/audit suites to hard-fail at setup.
|
|
981
997
|
- `RpcEndpointsSuiteOption` — union `Array<RpcEndpointSpec> | ((ctx: AppServerContext) => Array<RpcEndpointSpec>)` accepted by every DB-backed suite's `rpc_endpoints` field.
|
|
982
|
-
- `resolve_rpc_endpoints_for_setup(rpc_endpoints,
|
|
998
|
+
- `resolve_rpc_endpoints_for_setup(rpc_endpoints, session_cookie_name)` — resolves the union to an array for setup-time inspection (path lookup, `find_rpc_action` presence checks). Factory form is invoked once with a stub `AppServerContext`; the produced actions are discarded because `create_app_server` invokes the factory a second time per-test with its real ctx. Safe when the factory is pure wrt endpoint `path` and action `spec.method` list.
|
|
983
999
|
|
|
984
1000
|
### `rpc_attack_surface.ts` + `rpc_envelope_cases.ts` — `describe_rpc_attack_surface_tests`
|
|
985
1001
|
|
|
@@ -1066,15 +1082,23 @@ have files of their own.
|
|
|
1066
1082
|
backend closes the connection after an oversized-body 413. Bun 1.4.3 is the
|
|
1067
1083
|
tested floor.
|
|
1068
1084
|
|
|
1069
|
-
### `cross_backend/
|
|
1085
|
+
### `cross_backend/standard_bundle.ts` — `describe_standard_cross_process_tests`
|
|
1086
|
+
|
|
1087
|
+
Wires the standard suites that run against a spawned backend in one call, in
|
|
1088
|
+
two halves, each a registered suite of its own module:
|
|
1070
1089
|
|
|
1071
|
-
|
|
1090
|
+
- `standard_auth.ts` — `describe_standard_auth_cross_tests`: `integration`
|
|
1091
|
+
always, `admin` when `roles` is provided. Every send goes through the
|
|
1092
|
+
fixture transports, so the transcript differential runs it.
|
|
1093
|
+
- `standard.ts` — `describe_standard_cross_tests`: the middleware gates
|
|
1094
|
+
(`describe_middleware_gate_tests`), `round_trip`, `rpc_round_trip`,
|
|
1095
|
+
`data_exposure`. The gate probes write raw request heads and the round
|
|
1096
|
+
trips and data exposure build fixtures in `beforeAll`, which keeps it out of
|
|
1097
|
+
the transcript.
|
|
1072
1098
|
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
- `rpc_round_trip` — always
|
|
1077
|
-
- `data_exposure` — always
|
|
1099
|
+
`describe_spine_cross_suites` registers the halves apart (`standard_auth`,
|
|
1100
|
+
`standard`); the bundle is for a consumer wiring them outside it, and
|
|
1101
|
+
`STANDALONE_CROSS_SUITES` names it.
|
|
1078
1102
|
|
|
1079
1103
|
Two in-process suites are omitted by design: `rate_limiting` (needs a fresh
|
|
1080
1104
|
per-test `TestApp` for tight rate-limiter overrides; the spawned binary has no
|
|
@@ -1083,9 +1107,8 @@ the in-process backend exposes; wire-level audit observability lives in the
|
|
|
1083
1107
|
consumer's own audit `.cross.test.ts`). The omission rationale lives in the
|
|
1084
1108
|
module doc once instead of repeating in each consumer's `*.cross.test.ts`.
|
|
1085
1109
|
|
|
1086
|
-
`base_url` (required — the
|
|
1087
|
-
|
|
1088
|
-
integration suite;
|
|
1110
|
+
`base_url` (required — the middleware-gate probes write to the socket),
|
|
1111
|
+
`max_body_bytes` and `rpc_max_body_bytes` forward to the gate suite;
|
|
1089
1112
|
`rpc_success_fixtures`, `rpc_skip_methods` and `rpc_input_overrides`
|
|
1090
1113
|
forward to the RPC round-trip's `success_fixtures`, `skip_methods` and
|
|
1091
1114
|
`input_overrides` (`describe_spine_cross_suites` also forwards
|
|
@@ -1096,20 +1119,21 @@ round-trip and data exposure, the two that resolve route paths.
|
|
|
1096
1119
|
|
|
1097
1120
|
Hard-codes the cross-process-safe set with no `skip` knob; if a future
|
|
1098
1121
|
consumer needs partial opt-out, add the knob then.
|
|
1099
|
-
`StandardCrossProcessTestOptions` is
|
|
1100
|
-
|
|
1101
|
-
|
|
1122
|
+
`StandardCrossProcessTestOptions` is both halves' options
|
|
1123
|
+
(`StandardAuthCrossTestOptions`, `StandardCrossTestOptions`): the in-process
|
|
1124
|
+
suites' shared options minus their in-process-only knobs
|
|
1125
|
+
(`create_route_specs`, `rate_limiting_app_options`).
|
|
1102
1126
|
|
|
1103
1127
|
### `cross_backend/spine_suites.ts` — `describe_spine_cross_suites`
|
|
1104
1128
|
|
|
1105
1129
|
One call that runs every shipped single-backend cross suite against one
|
|
1106
1130
|
spawned backend: `describe_spine_cross_suites(handle, {surface_source,
|
|
1107
|
-
|
|
1131
|
+
session_cookie_name, rpc_endpoints, live_rpc_endpoints?, roles?, setup?, exclude?,
|
|
1108
1132
|
exclude_cases?, expected_skips?, overrides?, suite_roles?, ws_required_roles?, rpc_success_fixtures?,
|
|
1109
1133
|
rpc_skip_methods?, rpc_input_overrides?, rpc_max_body_bytes?, ws_max_message_bytes?})`.
|
|
1110
1134
|
`live_rpc_endpoints` is the backend's whole live mount; given, `rpc_adversarial`
|
|
1111
1135
|
also walks the methods it keeps off the declared surface. `rpc_input_overrides`
|
|
1112
|
-
reaches the standard
|
|
1136
|
+
reaches the `standard` suite's RPC round-trip and `rpc_adversarial`'s
|
|
1113
1137
|
`input_overrides`, so one valid body per method serves both; a key naming a
|
|
1114
1138
|
method on neither the declared surface nor `live_rpc_endpoints` throws at
|
|
1115
1139
|
collection. Without it a consumer writes a file per suite, and a suite added
|
|
@@ -1117,12 +1141,14 @@ here never reaches it.
|
|
|
1117
1141
|
|
|
1118
1142
|
- **The registry.** `SUITE_NAMES` / `SuiteName` — the closed set of suites the
|
|
1119
1143
|
call runs, each named by its module (`ws_round_trip` is
|
|
1120
|
-
`describe_cross_process_ws_tests
|
|
1144
|
+
`describe_cross_process_ws_tests`; `standard_auth` and `standard` the two
|
|
1145
|
+
halves of the standard bundle).
|
|
1121
1146
|
`STANDALONE_CROSS_SUITES` (keyed by the closed `StandaloneSuiteName`) names
|
|
1122
1147
|
the modules left out, each with why: the
|
|
1123
1148
|
`differential` (two handles), `login_security` and `ws_action_rate_limit`
|
|
1124
1149
|
(a backend spawned with live limiters, which the standard suites would
|
|
1125
|
-
exhaust),
|
|
1150
|
+
exhaust), the `conformance_table` runner (the consumer's own cases), and
|
|
1151
|
+
`standard_bundle` (the two standard halves in one call).
|
|
1126
1152
|
`src/test/testing/cross_backend/spine_suites.test.ts` imports every module
|
|
1127
1153
|
under `cross_backend/` and holds the two lists to the ones exporting a
|
|
1128
1154
|
`describe_*` function, whatever the export form (the Bun adapter,
|
|
@@ -1138,7 +1164,7 @@ here never reaches it.
|
|
|
1138
1164
|
called on its own — the daemon token from the handle, and each suite's
|
|
1139
1165
|
`setup_test` from `default_cross_process_setup` over the `setup` options
|
|
1140
1166
|
plus the seeding the suite needs (concatenated): a keeper-only
|
|
1141
|
-
`non_admin_keeper` for
|
|
1167
|
+
`non_admin_keeper` for `standard_auth`'s keeper ≠ admin probe, the
|
|
1142
1168
|
multi-actor keepers of `fact_serving` and `transport_composition`, the
|
|
1143
1169
|
offer grantor of `role_grant_offer_enumeration`, the `cell_editor` holder of
|
|
1144
1170
|
`cell_grant_role`. Suites are registered without a wrapping `describe`, so
|
|
@@ -1154,7 +1180,7 @@ here never reaches it.
|
|
|
1154
1180
|
aren't the spine defaults (`SPINE_BODY_LIMIT_DEFAULT_BYTES`,
|
|
1155
1181
|
`DEFAULT_WS_MAX_MESSAGE_BYTES`). The first reaches `body_size`,
|
|
1156
1182
|
`body_size_smuggling`, `transport_composition`'s RPC over-cap row and the
|
|
1157
|
-
standard
|
|
1183
|
+
`standard` suite's middleware-gate probes of the RPC endpoint (each
|
|
1158
1184
|
takes it as `rpc_max_body_bytes`), the second `ws_round_trip`'s
|
|
1159
1185
|
`max_message_bytes` — one value per limit for every suite probing it.
|
|
1160
1186
|
- **`exclude`** — `{[suite]: reason}`; the reason is required and shows in the
|
|
@@ -1163,7 +1189,7 @@ here never reaches it.
|
|
|
1163
1189
|
(`testing_backdoor`, which checks the backdoor declaration the gating reads,
|
|
1164
1190
|
and `capability_mounts`, which checks the mount flags), or a suite already
|
|
1165
1191
|
skipping itself for an undeclared backdoor throws before anything registers.
|
|
1166
|
-
- **Backdoors.** `capabilities.testing_backdoors` must declare `SPINE_SUITES_REQUIRED_BACKDOORS` (`_testing_reset`, `_testing_drain_effects`), plus `_testing_put_fact` with `fact_serving` and `_testing_room_evict` with `rooms`, or the call throws. A suite whose every case drives another backdoor (`SuiteEntry.backdoors`) skips itself, with the reason, on a backend not declaring it — an exclude, override or `exclude_cases` entry for it throws as dead; `spine_suites.test.ts` holds each entry's `backdoors` to the names its module uses.
|
|
1192
|
+
- **Backdoors.** `capabilities.testing_backdoors` must declare `SPINE_SUITES_REQUIRED_BACKDOORS` (`_testing_reset`, `_testing_drain_effects`), `_testing_db_invariants` unless `setup` turns the invariant check off (`exclude_db_invariants: {all: reason}`), plus `_testing_put_fact` with `fact_serving` and `_testing_room_evict` with `rooms`, or the call throws. A suite whose every case drives another backdoor (`SuiteEntry.backdoors`) skips itself, with the reason, on a backend not declaring it — an exclude, override or `exclude_cases` entry for it throws as dead; `spine_suites.test.ts` holds each entry's `backdoors` to the names its module uses.
|
|
1167
1193
|
- **`exclude_cases`** — `SuiteCaseExclusions`, `{[suite]: {[name path]: reason}}`: single tests of a running suite by full name path (describe titles and test name joined with `' > '`, below the calling suite), skipped at run time with the reason. An entry for an unknown, excluded, self-skipping or unexcludable suite throws at collection; one naming no collected test fails the closing test (`check_spine_case_exclusions`).
|
|
1168
1194
|
- **`expected_skips`** — `{[name path]: reason}`: the gated skips the backend
|
|
1169
1195
|
owes — the cases a suite skips because the backend lacks what they gate on
|
|
@@ -1204,7 +1230,7 @@ builtin, and `sse_round_trip`'s other-role keep case for `ROLE_ADMIN`. fuz_app's
|
|
|
1204
1230
|
### `cross_backend/rust_spine_consumer_surface.ts` — `create_rust_spine_consumer_surface_spec`
|
|
1205
1231
|
|
|
1206
1232
|
The declared surface of a consumer served by the Rust spine, for its cross
|
|
1207
|
-
suites: `create_rust_spine_consumer_surface_spec({
|
|
1233
|
+
suites: `create_rust_spine_consumer_surface_spec({session_cookie_name,
|
|
1208
1234
|
domain_action_specs, extra_rpc_actions?, roles?, exclude_methods?,
|
|
1209
1235
|
rpc_path?, host_gate?})`, built on `create_test_app_surface_spec` from the hono-free route
|
|
1210
1236
|
shapes. It declares `/health`, the `ACCOUNT_ROUTER_PATHS` under
|
|
@@ -1246,7 +1272,7 @@ conformance cases assert _expected behavior_ — the security negatives
|
|
|
1246
1272
|
wire-shape check passes green on even when behavior is wrong.
|
|
1247
1273
|
|
|
1248
1274
|
- `conformance_case.ts` — the `ConformanceCase` type (data, never parsed): `{name, request: {method, params?, params_json?, as, acting?, verb?}, expect: {status, error_reason?, error_code?, fields?, headers?, set_cookie?, equivalence_group?}, note?, xfail?}`. `method` resolves its schemas from the live registry (RPC) or the REST auth routes. `as` is a closed `ConformancePrincipal` — fixture accessors, never inline minting; what each principal sends and which leg refuses it is on the type. `acting` (`ConformanceActingBinding`) has the runner fill `params.acting` with a real actor id. Beyond status and reason (`error_reason: null` pins an RPC denial carrying no `data.reason`): `error_code` (else the status's default JSON-RPC code), `equivalence_group` (members answer byte-identical `{status, body}`), `headers` (present-and-equal, or `null` for absent), `set_cookie` (a `SessionCookieEffect`; **omitted means `'none'`**). Always checked: no fingerprint header (`FINGERPRINT_HEADERS`), and no session cookie minted outside 2xx. `check_conformance_cases` refuses a row that can't mean anything.
|
|
1249
|
-
- `conformance_table.ts` — `describe_conformance_table_tests({cases, setup_test, surface_source, capabilities, rpc_endpoints, live_rpc_endpoints?,
|
|
1275
|
+
- `conformance_table.ts` — `describe_conformance_table_tests({cases, setup_test, surface_source, capabilities, rpc_endpoints, live_rpc_endpoints?, session_cookie_name, principals?, ws?, suite_name?})`, on the Tier 1 fixture protocol, so **one case array runs in-process and cross-process**. Methods resolve from `rpc_endpoints`, then `live_rpc_endpoints` (methods kept off the declared surface; fuz_app's is `create_spine_live_rpc_endpoints()`) — `resolve_conformance_rpc_endpoints`; `send_conformance_case` is the send half the differential shares; `role_holder` / `wrong_role` read an `extra_accounts` username named in `principals`. `ws` (cross-process only) re-sends each case `is_ws_conformance_case` admits as one frame on a socket the principal opens, under the same expectations; an equivalence group left with one member there is dropped.
|
|
1250
1276
|
- `conformance_rpc_auth.ts` — `generate_rpc_auth_conformance_cases({surface_source,
|
|
1251
1277
|
live_rpc_endpoints?, skip_methods?})` → `ConformanceCase[]` from each declared RPC method's
|
|
1252
1278
|
`RouteAuth`, then each live-mounted one the declared surface lacks
|
|
@@ -1317,8 +1343,7 @@ fixture). fuz_app's own case files and wiring are
|
|
|
1317
1343
|
### Suite modules
|
|
1318
1344
|
|
|
1319
1345
|
Each `SUITE_NAMES` module in `cross_backend/` exports one
|
|
1320
|
-
`describe_<module>_cross_tests(options)`. The exceptions are `
|
|
1321
|
-
(`describe_standard_cross_process_tests`), `ws_round_trip`
|
|
1346
|
+
`describe_<module>_cross_tests(options)`. The exceptions are `ws_round_trip`
|
|
1322
1347
|
(`describe_cross_process_ws_tests`), `sse_round_trip`
|
|
1323
1348
|
(`describe_cross_process_sse_tests`), `peer_ping_ws`
|
|
1324
1349
|
(`describe_peer_ping_ws_tests`) and `role_grant_offer_notification_ws`
|
|
@@ -1375,7 +1400,8 @@ without.
|
|
|
1375
1400
|
| `session_cookie_codec` | exactly one accepted spelling of a signed cookie: non-canonical signature or `expires_at` spellings refused | — |
|
|
1376
1401
|
| `simple_request` | an untyped, CORS-safelisted, or non-JSON `POST` to a JSON route → 415 `unsupported_content_type` | — |
|
|
1377
1402
|
| `sse_round_trip` | the audit stream: connect, a data frame, a close on each revocation of a stream proven admitted, a session-scoped revoke leaving a sibling session's stream open, a revoke of the gating role's global grant closing the stream and a global revoke of another role leaving it open (scope matching is `ws_role_gated`'s), the per-session stream cap | `sse` (delete and purge also `account_lifecycle`) |
|
|
1378
|
-
| `standard` | the
|
|
1403
|
+
| `standard` | the standard bundle less its auth suites: the middleware-gate probes of each counted route, round trip, RPC round trip, data exposure | — |
|
|
1404
|
+
| `standard_auth` | the standard auth suites: integration, and admin when `roles` is given; run by the transcript differential | `account_status` (the status wire-shape case) |
|
|
1379
1405
|
| `testing_backdoor` | the backdoor declaration, and every declared `_testing_*` action refusing anonymous, session, and bearer callers | `testing_backdoors` (the declaration) |
|
|
1380
1406
|
| `token_lifetime` | the API token `lifetime` round trip: ttl mint → `expires_at` on create and list, an eternal control, bad lifetimes → 400, a bearer beside a winning daemon token or a winning session never touched, the request acting as the winner's account; an invalid daemon token falls through to the bearer beside it | — |
|
|
1381
1407
|
| `token_scope_surface` | the `surface:<name>` half of token scoping: a narrowed bearer refused the audit stream and the bare-hash fact read, anonymous on the status read; scope outranks role | `sse`, `fact_serving_admin_hash`, `account_status` (per case) |
|
|
@@ -1526,7 +1552,7 @@ Conventions that hold across them:
|
|
|
1526
1552
|
(`ensure_database_for_url`), then the spawn. A second argument
|
|
1527
1553
|
(`CrossBackendGlobalSetupDeps`) swaps the database creator and the spawn,
|
|
1528
1554
|
for testing the setup itself.
|
|
1529
|
-
- `testing/cross_backend/bootstrap_backend.ts` / `create_dual_spawn_global_setup.ts` — spawn and bootstrap one backend, or two (`provide_keys`); `before_bootstrap(config)` runs once the backend is healthy and before its keeper bootstrap, for a probe of the pre-bootstrap window, and a throw from it tears the backend down and fails the setup.
|
|
1555
|
+
- `testing/cross_backend/bootstrap_backend.ts` / `create_dual_spawn_global_setup.ts` — spawn and bootstrap one backend, or two (`provide_keys`); `before_bootstrap(config)` runs once the backend is healthy and before its keeper bootstrap, for a probe of the pre-bootstrap window, and a throw from it tears the backend down and fails the setup. The dual spawn's `after_bootstrap(handle, side)` runs once a backend's bootstrap has succeeded, before any test, for a read of what the bootstrap wrote; a throw tears down every backend spawned so far.
|
|
1530
1556
|
- `testing/cross_backend/cargo_binary.ts` — `prepare_cargo_binary({workspace_dir,
|
|
1531
1557
|
package, bin?, profile?})` builds a Cargo binary (`cargo build -p --bin
|
|
1532
1558
|
--profile`, output inherited, a failed build throws) unless
|
|
@@ -1565,7 +1591,13 @@ Conventions that hold across them:
|
|
|
1565
1591
|
(`create_output_tail`) for an early exit's error — with its exit code or
|
|
1566
1592
|
signal — and for the log line an unexpected exit after startup writes.
|
|
1567
1593
|
Registers exit-time + signal cleanup so vitest worker death or
|
|
1568
|
-
Ctrl+C kills children before they strand ports.
|
|
1594
|
+
Ctrl+C kills children before they strand ports. `teardown` rejects unless
|
|
1595
|
+
the child exits `0` on its SIGTERM — a non-zero code (a spine whose
|
|
1596
|
+
shutdown gave up or failed), an exit by signal (the SIGKILL escalation), an
|
|
1597
|
+
exit during the run, or a group teardown gave up on — naming the backend,
|
|
1598
|
+
the exit and the stderr tail, so every global setup that awaits it fails
|
|
1599
|
+
the run on an unclean shutdown; the dual-spawn setup tears both down before
|
|
1600
|
+
it throws.
|
|
1569
1601
|
- `testing/transports/fetch_transport.ts` — cookie-threading HTTP transport
|
|
1570
1602
|
satisfying `RpcTestTransport`. Carries a name-keyed cookie jar that
|
|
1571
1603
|
updates on every response's `Set-Cookie` and re-sends on every request;
|
|
@@ -1684,7 +1716,7 @@ Conventions that hold across them:
|
|
|
1684
1716
|
| action | bundled | does |
|
|
1685
1717
|
| --- | --- | --- |
|
|
1686
1718
|
| `_testing_reset` | yes | the consumer's `reset_state(db)` first, on the same transaction (domain rows depend on auth rows); then every auth row wiped, `app_settings` and `bootstrap_lock` reset, a fresh keeper and any `extra_accounts` seeded through the in-process primitives |
|
|
1687
|
-
| `_testing_drain_effects` | yes | answers `{ok: true}` once no audit pool write is in flight,
|
|
1719
|
+
| `_testing_drain_effects` | yes | answers `{ok: true}` once no request's effect flush (`deps.request_tracker`) and no audit pool write is in flight, those started while it waits included — never a handler still running, its own among them; the barrier before an audit or effect read (WS replies before its effects flush) |
|
|
1688
1720
|
| `_testing_db_invariants` | yes | every row breaking a `DB_INVARIANTS` check, read after each test |
|
|
1689
1721
|
| `_testing_mint_session` | yes | a backdated session row behind a valid cookie (the `expired_session` principal) |
|
|
1690
1722
|
| `_testing_put_fact` | yes | seeds a fact, with an optional holder or external URL |
|
|
@@ -1757,11 +1789,11 @@ The reusable shape for standing up a **spawnable TS** cross-process test
|
|
|
1757
1789
|
binary (the TS analog of the Rust `testing_spine_stub`), so consumers don't
|
|
1758
1790
|
re-roll the serve / daemon-info / drain boilerplate:
|
|
1759
1791
|
|
|
1760
|
-
- `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.
|
|
1792
|
+
- `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, and resolve its `ShutdownDrainGivenUp` report — then, on a clean close, awaits the drain, since open sockets would otherwise hold it, and exits `0`; it exits `1` without that wait when the report gave up on anything (`shutdown_gave_up`) — a given-up request still holds its connection — or the close threw, twin of the Rust spine's `StartupError::ShutdownGivenUp`. On `pg` a give-up's `close` can still wait on `pool.end()` for a client a wedged handler holds; the harness defaults to pglet and PGlite. Exports the `TestingServerAdapter` (`prepare_websocket: (options?: PrepareWebsocketOptions) => UpgradeWebSocket`) / `ServeHandle` / `PrepareWebsocketOptions` / `BuildTestingAppContext` interfaces.
|
|
1761
1793
|
- `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).
|
|
1762
1794
|
- `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).
|
|
1763
1795
|
- `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.
|
|
1764
|
-
- `testing/cross_backend/default_spine_surface.ts` — the canonical no-domain spine surface (account/admin/audit/signup + bootstrap): `
|
|
1796
|
+
- `testing/cross_backend/default_spine_surface.ts` — the canonical no-domain spine surface (account/admin/audit/signup + bootstrap): `spine_roles`, `create_spine_route_specs`, `create_spine_ready_route_spec` (the `/ready` route over the committed `expected_schema.json`), `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.
|
|
1765
1797
|
- `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, then the WS-only room verbs and `room_notification_actions`, 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 — and the stub's RPC dispatcher refuses its `ws_only` room verbs). `options.room_registry` is the registry the room verbs, `_testing_room_evict`, and `_testing_reset` (which clears it) share — the binary builds it with `create_spine_room_registry(connections)` (exclusive, the default bounds; the twin of the stub's `stub_room_registry`) over its WS endpoints' connection registry; omitted, one over a fresh connection registry serves enumeration. 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).
|
|
1766
1798
|
- `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()`.
|
|
1767
1799
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import './assert_dev_env.js';
|
|
2
|
-
import type { SessionOptions } from '../auth/session_cookie.js';
|
|
3
2
|
import { type RoleRegistry } from '../auth/role_schema.js';
|
|
4
3
|
import { type RpcEndpointsSuiteOption } from './rpc_helpers.js';
|
|
5
4
|
import type { AppSurfaceSpec } from '../http/surface.js';
|
|
@@ -20,8 +19,8 @@ export interface StandardAdminIntegrationTestOptions {
|
|
|
20
19
|
* shape for in-process and cross-process tests).
|
|
21
20
|
*/
|
|
22
21
|
surface_source: AppSurfaceSpec;
|
|
23
|
-
/**
|
|
24
|
-
|
|
22
|
+
/** The session cookie's name — read for the session cookie and the factory-form `rpc_endpoints` resolution. */
|
|
23
|
+
session_cookie_name: string;
|
|
25
24
|
/** Role registry from `create_role_registry()` — used to determine valid/invalid/web-grantable roles. */
|
|
26
25
|
roles: RoleRegistry;
|
|
27
26
|
/**
|
|
@@ -31,7 +30,7 @@ export interface StandardAdminIntegrationTestOptions {
|
|
|
31
30
|
rpc_endpoints: RpcEndpointsSuiteOption;
|
|
32
31
|
/**
|
|
33
32
|
* Path prefix where admin routes are mounted (e.g., `'/api/admin'`).
|
|
34
|
-
* Used by the 401
|
|
33
|
+
* Used by the 401 error-coverage probe to scope to fuz_app admin
|
|
35
34
|
* routes only, avoiding app-specific admin-gated routes that may use
|
|
36
35
|
* stub deps. Default `'/api/admin'`.
|
|
37
36
|
*/
|
|
@@ -42,7 +41,7 @@ export interface StandardAdminIntegrationTestOptions {
|
|
|
42
41
|
*
|
|
43
42
|
* Exercises account listing, role_grant grant/revoke (via RPC), session
|
|
44
43
|
* management, token management, audit log reads, admin-to-admin
|
|
45
|
-
* isolation, and 401
|
|
44
|
+
* isolation, and 401 error-coverage on the admin REST surface.
|
|
46
45
|
* Output-schema conformance is not in scope — see the module docstring
|
|
47
46
|
* for the suites that cover it.
|
|
48
47
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_integration.d.ts","sourceRoot":"","sources":["../../src/lib/testing/admin_integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"admin_integration.d.ts","sourceRoot":"","sources":["../../src/lib/testing/admin_integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiC7B,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAYvE,OAAO,EAMN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AA4B1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,0BAA0B,CAAC;AAavE;;GAEG;AACH,MAAM,WAAW,mCAAmC;IACnD;;;;OAIG;IACH,UAAU,EAAE,SAAS,CAAC;IACtB;;;;OAIG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,+GAA+G;IAC/G,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yGAAyG;IACzG,KAAK,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAiBD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yCAAyC,GACrD,SAAS,mCAAmC,KAC1C,IAg/BF,CAAC"}
|
|
@@ -7,7 +7,7 @@ import './assert_dev_env.js';
|
|
|
7
7
|
* surface — see `role_grant_offer_create` / `role_grant_revoke`), session/token
|
|
8
8
|
* management, and audit log routes against a real database.
|
|
9
9
|
*
|
|
10
|
-
* Consumers call it with their route factory, session
|
|
10
|
+
* Consumers call it with their route factory, session cookie name, role registry,
|
|
11
11
|
* and RPC endpoint specs — all admin route tests come for free.
|
|
12
12
|
*
|
|
13
13
|
* Scope: admin *semantics* — cross-admin isolation, role_grant grant/revoke
|
|
@@ -26,6 +26,7 @@ import './assert_dev_env.js';
|
|
|
26
26
|
* @module
|
|
27
27
|
*/
|
|
28
28
|
import { describe, test, assert, afterAll } from 'vitest';
|
|
29
|
+
import { parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
29
30
|
import { ROLE_ADMIN } from '../auth/role_schema.js';
|
|
30
31
|
import { GRANT_PATH_ADMIN } from '../auth/grant_path_schema.js';
|
|
31
32
|
import { create_test_request_headers } from './test_origin.js';
|
|
@@ -65,7 +66,7 @@ const pick_grantable_role = (role_specs) => {
|
|
|
65
66
|
*
|
|
66
67
|
* Exercises account listing, role_grant grant/revoke (via RPC), session
|
|
67
68
|
* management, token management, audit log reads, admin-to-admin
|
|
68
|
-
* isolation, and 401
|
|
69
|
+
* isolation, and 401 error-coverage on the admin REST surface.
|
|
69
70
|
* Output-schema conformance is not in scope — see the module docstring
|
|
70
71
|
* for the suites that cover it.
|
|
71
72
|
*
|
|
@@ -78,10 +79,10 @@ export const describe_standard_admin_integration_tests = (options) => {
|
|
|
78
79
|
const route_specs = options.surface_source.route_specs;
|
|
79
80
|
// Hard-fail early so consumers see a clear setup error instead of a
|
|
80
81
|
// confusing test failure when `rpc_endpoints` is missing.
|
|
81
|
-
const rpc_endpoints_for_setup = resolve_rpc_endpoints_for_setup(options.rpc_endpoints, options.
|
|
82
|
+
const rpc_endpoints_for_setup = resolve_rpc_endpoints_for_setup(options.rpc_endpoints, options.session_cookie_name);
|
|
82
83
|
const rpc_path = require_rpc_endpoint_path(rpc_endpoints_for_setup);
|
|
83
84
|
describe('standard_admin_integration', () => {
|
|
84
|
-
const
|
|
85
|
+
const cookie_name = options.session_cookie_name;
|
|
85
86
|
const { role_specs } = options.roles;
|
|
86
87
|
const grantable_role = pick_grantable_role(role_specs);
|
|
87
88
|
// Error coverage tracking across test groups
|
|
@@ -852,27 +853,42 @@ export const describe_standard_admin_integration_tests = (options) => {
|
|
|
852
853
|
});
|
|
853
854
|
});
|
|
854
855
|
// --- 8a. Error coverage: unauthenticated access to admin routes ---
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
856
|
+
// `/api/admin` is nearly empty — admin reads and mutations live
|
|
857
|
+
// on the RPC endpoint behind spec-level role auth. The path-prefix carve is still the right scope here
|
|
858
|
+
// because error coverage is tracked against REST `RouteSpec`s,
|
|
859
|
+
// not RPC method specs (`describe_rpc_round_trip_tests` covers
|
|
860
|
+
// the admin RPC surface separately).
|
|
861
|
+
const prefix = options.admin_prefix ?? '/api/admin';
|
|
862
|
+
const admin_routes = route_specs.filter((s) => s.path.startsWith(prefix) &&
|
|
863
|
+
(s.auth.roles?.includes('admin') ?? false) &&
|
|
864
|
+
// params and query validate ahead of the 401 (the route pipeline's
|
|
865
|
+
// order), so a route is driven only when the bare request passes them:
|
|
866
|
+
// no params, and a query that takes none (the audit stream's optional
|
|
867
|
+
// `acting`)
|
|
868
|
+
!s.params &&
|
|
869
|
+
(!s.query || parse(s.query, {}).ok));
|
|
870
|
+
// registered only where such routes exist, the describe too (an empty one
|
|
871
|
+
// fails the run): a plain skip would leave the transcript differential's
|
|
872
|
+
// run partial (its stale-ledger check unjudged), and a gated one would owe
|
|
873
|
+
// every consumer an `expected_skips` entry
|
|
874
|
+
if (admin_routes.length > 0) {
|
|
875
|
+
describe('error coverage breadth', () => {
|
|
876
|
+
test('exercises 401 on admin routes for error coverage', async () => {
|
|
877
|
+
const fixture = await options.setup_test();
|
|
878
|
+
// Hit admin routes without auth to exercise 401 error schemas — a
|
|
879
|
+
// fresh transport, since the fixture's carries the keeper's cookie
|
|
880
|
+
const transport = fixture.fresh_transport();
|
|
881
|
+
for (const route of admin_routes) {
|
|
882
|
+
const res = await transport(route.path, {
|
|
883
|
+
method: route.method,
|
|
884
|
+
headers: { host: 'localhost', 'content-type': to_route_content_type(route) }
|
|
885
|
+
});
|
|
886
|
+
// no credential: every admin route answers 401 before authorization
|
|
887
|
+
assert.strictEqual(res.status, 401, `${route.method} ${route.path}`);
|
|
872
888
|
await error_collector.assert_and_record(route_specs, route.method, route.path, res);
|
|
873
889
|
}
|
|
874
|
-
}
|
|
890
|
+
});
|
|
875
891
|
});
|
|
876
|
-
}
|
|
892
|
+
}
|
|
877
893
|
});
|
|
878
894
|
};
|
|
@@ -3,7 +3,6 @@ import type { Uuid } from '../primitive_schemas.js';
|
|
|
3
3
|
import { type Keyring } from '../auth/keyring.js';
|
|
4
4
|
import type { Db, DbType } from '../db/db.js';
|
|
5
5
|
import type { PasswordHashDeps } from '../auth/password.js';
|
|
6
|
-
import { type SessionOptions } from '../auth/session_cookie.js';
|
|
7
6
|
import { type MigrationNamespace } from '../db/migrate.js';
|
|
8
7
|
import { type AppBackend, type AuditFactory } from '../server/app_backend.js';
|
|
9
8
|
import type { AppServerOptions } from '../server/app_server.js';
|
|
@@ -32,7 +31,6 @@ export declare const TEST_COOKIE_SECRET: string;
|
|
|
32
31
|
export interface CreateTestAccountWithCredentialsOptions {
|
|
33
32
|
db: Db;
|
|
34
33
|
keyring: Keyring;
|
|
35
|
-
session_options: SessionOptions<string>;
|
|
36
34
|
password: PasswordHashDeps;
|
|
37
35
|
username?: string;
|
|
38
36
|
password_value?: string;
|
|
@@ -72,7 +70,6 @@ export declare const create_test_account_with_credentials: (options: CreateTestA
|
|
|
72
70
|
export interface MintTestSessionOptions {
|
|
73
71
|
db: Db;
|
|
74
72
|
keyring: Keyring;
|
|
75
|
-
session_options: SessionOptions<string>;
|
|
76
73
|
/** Account the minted session belongs to. */
|
|
77
74
|
account_id: string;
|
|
78
75
|
/**
|
|
@@ -81,7 +78,7 @@ export interface MintTestSessionOptions {
|
|
|
81
78
|
* the authoritative DB-row expiry gate (`query_session_get_valid` —
|
|
82
79
|
* `WHERE expires_at > NOW()`) rejects it, while the returned cookie's
|
|
83
80
|
* own signed payload stays valid (future). Resolution therefore passes
|
|
84
|
-
* the cookie-payload check in `
|
|
81
|
+
* the cookie-payload check in `parse_session_from_cookies` and is refused at the
|
|
85
82
|
* DB-row gate — the gate the in-process payload-expiry tests never
|
|
86
83
|
* reach and the one that structurally needs a server-side mint.
|
|
87
84
|
*/
|
|
@@ -108,7 +105,7 @@ export declare const mint_test_session: (options: MintTestSessionOptions) => Pro
|
|
|
108
105
|
* Bootstrap the test-DB keeper. Direct-query shortcut for the default
|
|
109
106
|
* `create_test_app` path — bootstrap is not what most tests exercise, so
|
|
110
107
|
* we skip the real `bootstrap_account` flow (no audit row, no
|
|
111
|
-
*
|
|
108
|
+
* keeper set on a daemon-token state); the cross-backend harness drives the real
|
|
112
109
|
* `POST /bootstrap` against every backend it spawns.
|
|
113
110
|
*
|
|
114
111
|
* Flips `bootstrap_lock.bootstrapped = true` so the post-insert DB state
|
|
@@ -158,8 +155,6 @@ export interface TestAppServer extends AppBackend {
|
|
|
158
155
|
* Configuration for `create_test_app_server`.
|
|
159
156
|
*/
|
|
160
157
|
export interface TestAppServerOptions {
|
|
161
|
-
/** Session options — needed for cookie signing. */
|
|
162
|
-
session_options: SessionOptions<string>;
|
|
163
158
|
/** Existing database — skips internal DB creation when provided. Caller owns the DB lifecycle. */
|
|
164
159
|
db?: Db;
|
|
165
160
|
/** Database driver type — only used when `db` is provided. Default: `'pglet-memory'`. */
|
|
@@ -219,7 +214,7 @@ export interface TestAppServerOptions {
|
|
|
219
214
|
* Uses `stub_password_deps` by default — deterministic hashing that works
|
|
220
215
|
* correctly for login/logout tests without Argon2 overhead.
|
|
221
216
|
*
|
|
222
|
-
* @param options -
|
|
217
|
+
* @param options - the database, the keeper's credentials and roles, and the audit factory
|
|
223
218
|
* @returns a `TestAppServer` ready for HTTP testing
|
|
224
219
|
* @mutates the underlying database — when `db` is supplied, first resets the
|
|
225
220
|
* `app_settings` row (`open_signup`, `updated_at`, `updated_by`); in either
|