@fuzdev/fuz_app 0.182.0 → 0.184.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/README.md +2 -0
- package/dist/actions/CLAUDE.md +535 -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 +14 -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 +9 -1
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +43 -19
- package/dist/auth/CLAUDE.md +430 -1024
- package/dist/auth/account_queries.d.ts +1 -1
- package/dist/auth/account_queries.js +1 -1
- package/dist/auth/account_routes.d.ts +9 -8
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +78 -75
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +32 -28
- 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_emitter.d.ts +75 -84
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_emitter.js +83 -71
- package/dist/auth/audit_log_schema.d.ts +25 -14
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +23 -8
- 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 +42 -26
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +36 -19
- 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 +26 -31
- 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/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 +19 -5
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/deps.js +3 -2
- 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/resolved_auth.d.ts +7 -7
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +4 -4
- package/dist/auth/role_grant_offer_actions.d.ts +27 -3
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +42 -35
- package/dist/auth/role_grant_offer_queries.d.ts +60 -4
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +79 -5
- package/dist/auth/role_grant_queries.d.ts +3 -52
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +5 -80
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +11 -22
- 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 +15 -17
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +28 -20
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +93 -43
- package/dist/db/CLAUDE.md +5 -3
- package/dist/db/sql_columns.d.ts +1 -1
- package/dist/db/sql_columns.js +1 -1
- 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 -763
- package/dist/http/db_routes.d.ts +8 -23
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +73 -73
- 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 +118 -6
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +114 -6
- package/dist/http/route_result.d.ts +1 -1
- package/dist/http/route_spec.d.ts +14 -11
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/realtime/sse.d.ts +4 -23
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +4 -25
- 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 +80 -16
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +113 -31
- 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/testing/CLAUDE.md +265 -796
- package/dist/testing/admin_integration.d.ts +2 -3
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +3 -3
- package/dist/testing/adversarial_404.d.ts +6 -1
- package/dist/testing/adversarial_404.d.ts.map +1 -1
- package/dist/testing/adversarial_404.js +38 -17
- package/dist/testing/app_server.d.ts +23 -148
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +53 -131
- 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/audit_drift_guard.d.ts +11 -6
- package/dist/testing/audit_drift_guard.d.ts.map +1 -1
- package/dist/testing/audit_drift_guard.js +15 -8
- package/dist/testing/cross_backend/audit_cross_helpers.d.ts +12 -9
- package/dist/testing/cross_backend/audit_cross_helpers.d.ts.map +1 -1
- package/dist/testing/cross_backend/audit_cross_helpers.js +13 -14
- package/dist/testing/cross_backend/capabilities.d.ts +9 -6
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +11 -7
- package/dist/testing/cross_backend/capability_mounts.d.ts +103 -0
- package/dist/testing/cross_backend/capability_mounts.d.ts.map +1 -0
- package/dist/testing/cross_backend/capability_mounts.js +428 -0
- package/dist/testing/cross_backend/cell_moderate.js +2 -2
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +12 -11
- package/dist/testing/cross_backend/conformance_principal.d.ts +54 -0
- package/dist/testing/cross_backend/conformance_principal.d.ts.map +1 -0
- package/dist/testing/cross_backend/conformance_principal.js +283 -0
- package/dist/testing/cross_backend/conformance_table.d.ts +7 -56
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +6 -274
- package/dist/testing/cross_backend/cookie_attributes.js +1 -1
- package/dist/testing/cross_backend/credential_deadline.d.ts.map +1 -1
- package/dist/testing/cross_backend/credential_deadline.js +2 -0
- package/dist/testing/cross_backend/credential_wire.d.ts +1 -1
- package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -1
- package/dist/testing/cross_backend/db_state_diff.d.ts +72 -0
- package/dist/testing/cross_backend/db_state_diff.d.ts.map +1 -0
- package/dist/testing/cross_backend/db_state_diff.js +444 -0
- package/dist/testing/cross_backend/declared_skips.d.ts +68 -0
- package/dist/testing/cross_backend/declared_skips.d.ts.map +1 -0
- package/dist/testing/cross_backend/declared_skips.js +132 -0
- 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 +13 -5
- package/dist/testing/cross_backend/differential.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential.js +35 -11
- package/dist/testing/cross_backend/differential_normalize.d.ts +12 -0
- package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential_normalize.js +16 -0
- 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 +28 -19
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +156 -142
- package/dist/testing/cross_backend/login_security.d.ts +12 -0
- package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
- package/dist/testing/cross_backend/login_security.js +21 -4
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +0 -2
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -1
- package/dist/testing/cross_backend/request_target_conformance_wire.js +3 -1
- package/dist/testing/cross_backend/revocation_drivers.d.ts +18 -5
- package/dist/testing/cross_backend/revocation_drivers.d.ts.map +1 -1
- package/dist/testing/cross_backend/revocation_drivers.js +18 -10
- package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts +1 -1
- package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +33 -1
- package/dist/testing/cross_backend/role_grant_participation.js +4 -4
- package/dist/testing/cross_backend/rpc_adversarial.js +1 -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/session_cap.d.ts +2 -2
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +22 -11
- package/dist/testing/cross_backend/setup.d.ts +32 -2
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +32 -1
- package/dist/testing/cross_backend/spine_suites.d.ts +125 -15
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +459 -62
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
- package/dist/testing/cross_backend/sse_round_trip.d.ts +9 -1
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +123 -27
- package/dist/testing/cross_backend/standard.d.ts +2 -3
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.js +3 -3
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +4 -2
- 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 +84 -47
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +95 -63
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +2 -3
- package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +7 -3
- package/dist/testing/cross_backend/ws_round_trip.d.ts +5 -0
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +54 -8
- package/dist/testing/daemon_token_rotation.d.ts.map +1 -1
- package/dist/testing/daemon_token_rotation.js +2 -3
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +3 -0
- package/dist/testing/db.d.ts +0 -32
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +0 -86
- package/dist/testing/db_entities.d.ts +14 -0
- package/dist/testing/db_entities.d.ts.map +1 -1
- package/dist/testing/db_entities.js +17 -0
- package/dist/testing/db_invariant_queries.d.ts +259 -0
- package/dist/testing/db_invariant_queries.d.ts.map +1 -0
- package/dist/testing/db_invariant_queries.js +400 -0
- package/dist/testing/db_invariants.d.ts +106 -0
- package/dist/testing/db_invariants.d.ts.map +1 -0
- package/dist/testing/db_invariants.gen.sql.d.ts +11 -0
- package/dist/testing/db_invariants.gen.sql.d.ts.map +1 -0
- package/dist/testing/db_invariants.gen.sql.js +13 -0
- package/dist/testing/db_invariants.js +141 -0
- package/dist/testing/db_invariants.sql +152 -0
- package/dist/testing/describe_db.d.ts +36 -0
- package/dist/testing/describe_db.d.ts.map +1 -0
- package/dist/testing/describe_db.js +71 -0
- package/dist/testing/integration.d.ts +8 -12
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +13 -17
- package/dist/testing/integration_helpers.d.ts +1 -1
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/rate_limiting.d.ts +3 -4
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +6 -5
- package/dist/testing/role_grant_helpers.d.ts +1 -1
- package/dist/testing/role_grant_helpers.d.ts.map +1 -1
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +3 -0
- package/dist/testing/rpc_attack_surface.d.ts +8 -6
- package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
- package/dist/testing/rpc_attack_surface.js +69 -6
- 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 +3 -4
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +4 -1
- package/dist/testing/sse_round_trip.d.ts +3 -4
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +15 -6
- package/dist/testing/stubs.d.ts +9 -8
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +20 -13
- package/dist/testing/test_app.d.ts +168 -0
- package/dist/testing/test_app.d.ts.map +1 -0
- package/dist/testing/test_app.js +123 -0
- 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,13 +33,13 @@ 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
|
|
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, `
|
|
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
|
+
- `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[]`
|
|
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(
|
|
42
|
-
- `create_test_app_surface_spec(options)` —
|
|
41
|
+
- `create_stub_app_server_context(session_cookie_name)` — stub `AppServerContext` over `create_stub_app_backend()`; rate limiters null, `bootstrap_status.available: false`.
|
|
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
|
|
45
45
|
stub territory breaks immediately with a label-scoped error rather than
|
|
@@ -81,23 +81,23 @@ harness's `connect`, `create_bearer_auth_test_app`'s `pre_context`.
|
|
|
81
81
|
`query_create_account_with_actor` with default `password_hash` (`'hash'`),
|
|
82
82
|
storing the username lowercased, as every production creation path does and
|
|
83
83
|
the `account_username_lowercase` CHECK requires.
|
|
84
|
-
Returns `{account, actor}`.
|
|
85
|
-
`create_test_actor` / `create_test_account` helpers that had accumulated
|
|
86
|
-
across the auth test suite. Use for query-level tests needing real DB rows
|
|
84
|
+
Returns `{account, actor}`. Use for query-level tests needing real DB rows
|
|
87
85
|
but not a full session/token bundle. For tests also needing an API token +
|
|
88
86
|
session cookie + role_grants, use `bootstrap_test_keeper` from `app_server.ts`.
|
|
89
87
|
|
|
90
|
-
`create_test_extra_actor(db, account_id, name)` adds an actor
|
|
91
|
-
|
|
92
|
-
(`
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
88
|
+
`create_test_extra_actor(db, account_id, name)` adds an actor with
|
|
89
|
+
`created_at` from `clock_timestamp()`, so a multi-actor account's actors list
|
|
90
|
+
in insert order (lists sort `created_at, id`). The in-process seed and
|
|
91
|
+
`_testing_reset` use it, as the Rust reset uses
|
|
92
|
+
`query_create_actor_with_clock_timestamp`, so both spines list them alike.
|
|
93
|
+
`query_admin_account_list` is the exception: it sorts `created_at, name, id`
|
|
94
|
+
to keep one actor per account the same on both backends.
|
|
95
|
+
|
|
96
|
+
`create_test_session_row(db, token_hash, account_id, expires_in_seconds)`
|
|
97
|
+
inserts an `auth_session` row expiring that many seconds past the database's
|
|
98
|
+
`NOW()` — negative for one already expired — the statement the Rust
|
|
99
|
+
`_testing_mint_session` runs; `mint_test_session` writes through it. For a
|
|
100
|
+
test needing a lifetime other than `query_create_session`'s full one.
|
|
101
101
|
|
|
102
102
|
`create_test_role_grant_direct(db, input)` wraps `query_create_role_grant`
|
|
103
103
|
for tests needing an active role_grant seeded directly, bypassing the
|
|
@@ -122,10 +122,10 @@ mismatch.
|
|
|
122
122
|
|
|
123
123
|
### `audit_drift_guard.ts` — audit-emission validation
|
|
124
124
|
|
|
125
|
-
- `install_audit_drift_guard()` — `beforeEach` resets + `afterEach` zero-checks the `audit_metadata_validation_failures` + `audit_unknown_event_type_failures` counters from `auth/audit_log_queries.ts` and the emitter's write-failure counter (`get_audit_write_failures` in `auth/audit_emitter.ts`). Call once at the top of any `describe_db` block firing audit emits — production validation and the emitter's write are fail-open, so without this any regression shipping a typo'd `event_type` or undeclared metadata field, or losing a row the database refused, is silent. A test that fails a write on purpose resets the counter (`reset_audit_write_failures`) once it has asserted it.
|
|
125
|
+
- `install_audit_drift_guard()` — `beforeEach` resets + `afterEach` zero-checks the `audit_metadata_validation_failures` + `audit_unknown_event_type_failures` counters from `auth/audit_log_queries.ts` and the emitter's write-failure counter (`get_audit_write_failures` in `auth/audit_emitter.ts`). Call once at the top of any `describe_db` block firing audit emits — production validation and the emitter's write are fail-open, so without this any regression shipping a typo'd `event_type` or undeclared metadata field, or losing a row the database refused, is silent. A test that fails a write on purpose resets the counter (`reset_audit_write_failures`) once it has asserted it. It also zero-checks the success-outside-a-transaction counter (`get_audit_success_outside_transaction`; `reset_audit_success_outside_transaction` for a test that writes one on purpose).
|
|
126
126
|
- `assert_audit_event_metadata(event, {reject_unknown_keys?})` — the wire-side twin: parses a read audit row's `metadata` against its builtin event type's `audit_metadata_schemas` entry as declared, so a mistyped, `null`, or missing field fails while a consumer-added key passes (the schemas are fuz_schema `loose_object`s, and a builtin's schema can't be overridden, so added keys are a consumer's only extension path). `reject_unknown_keys` closes the world, each `loose_object`'s `def` spread into an `object`: an undeclared key fails too, for a suite whose backend adds none. The wire schema leaves `metadata` a loose record and only the TS spine validates it, at insert and fail-open, so this is what holds every spine's rows to their event's contract. A consumer-registered event type passes unexamined. `list_audit_events` and the admin suite run it on every row they read, with `reject_unknown_keys` from the fixture's `reject_unknown_audit_metadata_keys` (a setup option on `default_cross_process_setup`, `default_in_process_setup` and `default_in_process_suite_options`); fuz_app's own spine wiring turns it on.
|
|
127
|
-
- `assert_no_audit_drift()` — the zero-check itself, for a test that manages the counters. Pair with `await_pending_effects: true
|
|
128
|
-
- `create_recording_audit_emitter(calls_ref?)` — no-op `AuditEmitter` pushing every `emit` and `emit_pool` call into `calls`. Pass `calls_ref` to write into a caller-owned array; omit to let the helper allocate. Returns `{emitter, calls}` — destructure `emitter` as the `audit` dep and read `calls` to assert. `add_listener` records (never fires) and returns a remover with the production semantics, so `listener_count` tracks what a server registered and released.
|
|
127
|
+
- `assert_no_audit_drift()` — the zero-check itself, for a test that manages the counters. Pair with `await_pending_effects: true`.
|
|
128
|
+
- `create_recording_audit_emitter(calls_ref?)` — no-op `AuditEmitter` pushing every `emit` and `emit_pool` call into `calls`. Pass `calls_ref` to write into a caller-owned array; omit to let the helper allocate. Returns `{emitter, calls}` — destructure `emitter` as the `audit` dep and read `calls` to assert. `add_listener` records (never fires) and returns a remover with the production semantics, so `listener_count` tracks what a server registered and released.
|
|
129
129
|
- `RecordingAuditEmitter` — `{emitter: AuditEmitter; calls: Array<AuditLogInput>}`.
|
|
130
130
|
|
|
131
131
|
### `token_scope_fixtures.ts` — scope documents built to a size
|
|
@@ -140,12 +140,12 @@ measures one. Hono-free, imported by the cross-process token suite.
|
|
|
140
140
|
|
|
141
141
|
### `connection_closer_helpers.ts` — `ConnectionCloser` test doubles
|
|
142
142
|
|
|
143
|
-
- `create_recording_closer()` — `{closer, calls}`; `closer.close_connections(target)` records the `target` and `close_all_connections()` records `{kind: 'all'}` into `calls`, closing nothing. To see a handler's closes, add it to the backend's closer (`ctx.deps.connection_closer.add(closer)`) or build the factory's deps with it. The closes are queued post-commit, so they have run by the time a `create_test_app` response is in hand (`await_pending_effects: true`
|
|
143
|
+
- `create_recording_closer()` — `{closer, calls}`; `closer.close_connections(target)` records the `target` and `close_all_connections()` records `{kind: 'all'}` into `calls`, closing nothing. To see a handler's closes, add it to the backend's closer (`ctx.deps.connection_closer.add(closer)`) or build the factory's deps with it. The closes are queued post-commit, so they have run by the time a `create_test_app` response is in hand (`await_pending_effects: true`).
|
|
144
144
|
- `assert_close_call(call, expected)` — pins a recorded close call to `expected` (`assert.deepEqual`); handles the missing-element case.
|
|
145
145
|
- `RecordedClose` — `ConnectionCloseTarget | {kind: 'all'}`.
|
|
146
146
|
- `RecordingCloser` — `{closer, calls}`.
|
|
147
147
|
|
|
148
|
-
## Database — `db.ts`
|
|
148
|
+
## Database — `db.ts` + `describe_db.ts`
|
|
149
149
|
|
|
150
150
|
Factory builders for parameterized DB tests. Consumer projects pass their
|
|
151
151
|
`init_schema` callback (which calls `run_migrations(db, [AUTH_MIGRATION_NS, ...app_migrations])`);
|
|
@@ -159,8 +159,12 @@ factories accept any migration namespace set.
|
|
|
159
159
|
- `create_pg_factory(init_schema, test_url?)` — PostgreSQL; `skip: true` when `test_url` missing. Each `create()` opens a pool and resets the `public` schema before `init_schema`, like every other factory, so a persistent test database carries no stale DDL; a missing database (`3D000`) gets a `createdb` hint. Pool reused + cleaned up across `create()` calls.
|
|
160
160
|
- `auth_truncate_tables` — `['invite', 'api_token', 'auth_session', 'role_grant', 'role_grant_offer', 'actor', 'account']` in FK-safe order. Excludes `audit_log` — unit DB tests don't need to truncate it.
|
|
161
161
|
- `auth_integration_truncate_tables` — `auth_truncate_tables + ['audit_log']` for integration suites that exercise the audit path.
|
|
162
|
-
- `create_describe_db(factories, truncate_tables)` — returns `describe_db(name, fn)` running `fn(get_db)` once per factory inside a `describe` with shared `beforeAll(create)` + `beforeEach(TRUNCATE)` + `afterAll(close)`. Skipped factories use `describe.skip`.
|
|
163
162
|
- `log_db_factory_status(factories)` — console summary of enabled / skipped factories.
|
|
163
|
+
|
|
164
|
+
`db.ts` is vitest-free (`app_server.ts` reaches it, and with it the spawned
|
|
165
|
+
spine binary); the two helpers that call vitest live in `describe_db.ts`:
|
|
166
|
+
|
|
167
|
+
- `create_describe_db(factories, truncate_tables)` — returns `describe_db(name, fn)` running `fn(get_db)` once per factory inside a `describe` with shared `beforeAll(create)` + `beforeEach(TRUNCATE)` + `afterAll(close)`. Skipped factories use `describe.skip`.
|
|
164
168
|
- `assert_columns_match_live(db, table, columns)` — the named-projection drift guard: asserts a `*_COLUMNS` const (`ACCOUNT_COLUMNS`, `CELL_COLUMNS`, a consumer's own) names exactly the live `public`-schema columns of `table`, via `query_public_columns(db, {table})`. Per module, or iterated from a table → const registry (fuz_app's own: `src/test/db/column_projections.db.test.ts`).
|
|
165
169
|
|
|
166
170
|
**WASM caching.** `create_pglite_factory` and `create_pglet_wasm_factory` each
|
|
@@ -172,14 +176,55 @@ with `isolate: false` + `fileParallelism: false` to amortize WASM boot across
|
|
|
172
176
|
every DB test file — which also makes that one instance the whole run's; a
|
|
173
177
|
project that isolates its files gets one per worker instead.
|
|
174
178
|
|
|
179
|
+
### `db_invariant_queries.ts` + `db_invariants.ts` — auth-schema invariants after every test
|
|
180
|
+
|
|
181
|
+
`db_invariant_queries.ts` (vitest-free, so a test binary mounts it) —
|
|
182
|
+
`DB_INVARIANTS`, named SQL checks over the auth tables and `audit_log`, one
|
|
183
|
+
set for both spines; the list, what each holds and how a creation is ordered
|
|
184
|
+
against a removal are the module's TSDoc. `DB_INVARIANTS_SQL` is the whole
|
|
185
|
+
set as one statement (`$1` keeper role, `$2` admin role, each row's columns
|
|
186
|
+
as JSON text); `db_invariants.gen.sql.ts` writes it to `db_invariants.sql`,
|
|
187
|
+
which the Rust `fuz_testing` embeds byte for byte
|
|
188
|
+
(`conformance_table_copies.cross.test.ts` holds the pair).
|
|
189
|
+
`query_db_invariant_rows` / `DbInvariantRows` (the backdoor's answer) /
|
|
190
|
+
`to_db_invariant_violations` / `query_db_invariant_violations` /
|
|
191
|
+
`format_db_invariant_violations`. `db_invariants.ts` holds the hooks:
|
|
192
|
+
`assert_db_invariants` (over a `Db`), `assert_db_invariant_rows` (over
|
|
193
|
+
rows a backend answered), `register_db_invariants_check`,
|
|
194
|
+
`check_db_invariants_after_all`, `check_db_invariants_after_suite`.
|
|
195
|
+
|
|
196
|
+
`create_test_app` registers its `assert_db_invariants` to run when the test
|
|
197
|
+
that built it finishes (`register_db_invariants_check` — only inside a running
|
|
198
|
+
test; skipped when the test already failed), so a direct caller is checked
|
|
199
|
+
too; `default_in_process_setup` uses the test app's check, and the
|
|
200
|
+
cross-process setup registers its fixture's. In-process it queries the app's
|
|
201
|
+
own database;
|
|
202
|
+
cross-process it calls the backend's `_testing_db_invariants` on the keeper's
|
|
203
|
+
daemon-token channel (unrecorded by a transcript), so `memory://` spawns are
|
|
204
|
+
checked too. A backend not declaring `_testing_db_invariants` in
|
|
205
|
+
`capabilities.testing_backdoors` throws at setup unless the setup passes
|
|
206
|
+
`exclude_db_invariants: {all: reason}`. An app or fixture built in `beforeAll` is
|
|
207
|
+
checked once its describe's tests are done (`check_db_invariants_after_all`,
|
|
208
|
+
or `check_db_invariants_after_suite` inside a describe's own closing
|
|
209
|
+
`afterAll`, ahead of the close). Opt out per invariant with `exclude_db_invariants: {[name]:
|
|
210
|
+
reason}` on `create_test_app` or the setup — reason required, validated on
|
|
211
|
+
every call, logged once per distinct set, merged by name in `describe_spine_cross_suites` — for
|
|
212
|
+
tests that write rows by hand without the cascade, or a gap an
|
|
213
|
+
`xfail_until` marker tracks; `all` excludes every one.
|
|
214
|
+
|
|
175
215
|
## Test app assembly
|
|
176
216
|
|
|
177
|
-
### `app_server.ts`
|
|
217
|
+
### `app_server.ts` and `test_app.ts`
|
|
178
218
|
|
|
179
|
-
`
|
|
180
|
-
|
|
219
|
+
`app_server.ts` is vitest-free (the spawned spine binary, the reset actions
|
|
220
|
+
and fuz_forge's server build import it; `src/test/vitest_free_modules.test.ts`
|
|
221
|
+
holds its import graph to that): `create_test_app_server(options)`
|
|
222
|
+
bootstraps a minimal `AppBackend` with a keeper account, API token, session
|
|
223
|
+
cookie, and signed `Keyring`. `test_app.ts` holds the test-app layer:
|
|
181
224
|
`create_test_app(options)` layers `create_app_server` on top, returning a
|
|
182
|
-
fully assembled Hono app + the backend + helpers
|
|
225
|
+
fully assembled Hono app + the backend + helpers (and `TestApp`,
|
|
226
|
+
`TestAccount`, `CreateTestAppOptions`, `CreateTestAppAccountArgs`,
|
|
227
|
+
`SuiteAppOptions`, the session/bearer header builders).
|
|
183
228
|
|
|
184
229
|
Key module-scope values:
|
|
185
230
|
|
|
@@ -195,7 +240,7 @@ cookie" flow, split by intent:
|
|
|
195
240
|
- `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.
|
|
196
241
|
- `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).
|
|
197
242
|
|
|
198
|
-
Both take `{db, keyring,
|
|
243
|
+
Both take `{db, keyring, password, username?, password_value?, roles?}`
|
|
199
244
|
(shared `CreateTestAccountWithCredentialsOptions` / `BootstrapTestKeeperOptions`),
|
|
200
245
|
and store the username lowercased, as the Rust spine's `_testing_reset` seeds
|
|
201
246
|
do, so the returned `account.username` is its lowercase.
|
|
@@ -203,10 +248,10 @@ do, so the returned `account.username` is its lowercase.
|
|
|
203
248
|
Types:
|
|
204
249
|
|
|
205
250
|
- `TestAppServer extends AppBackend` — adds `account`, `actor`, `api_token`, `session_cookie`, `keyring`, `cleanup()`.
|
|
206
|
-
- `TestAppServerOptions` —
|
|
207
|
-
- `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`, `
|
|
251
|
+
- `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`.
|
|
252
|
+
- `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`).
|
|
208
253
|
- `TestAccount` — `{account, actor, session_cookie, api_token, create_session_headers, create_bearer_headers}`.
|
|
209
|
-
- `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.
|
|
254
|
+
- `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.
|
|
210
255
|
|
|
211
256
|
`create_test_app` hard-codes the test-friendly `AppServerOptions`:
|
|
212
257
|
`allowed_origins` exactly `TEST_ORIGIN` (built by
|
|
@@ -216,8 +261,7 @@ rate limiter `null` — a limiter passed through `app_options` wins over the
|
|
|
216
261
|
mode, so a rate-limit test enables just the one it pins; the mode's stderr
|
|
217
262
|
banner prints once per module instance — once per test file in an isolated
|
|
218
263
|
vitest project, once per run under `isolate: false`, ../../../docs/usage.md §Rate limiters), static daemon token state (no rotation, keeper already set),
|
|
219
|
-
|
|
220
|
-
the response returns so tests can assert on side effects inline), and silent
|
|
264
|
+
`await_pending_effects: true` (§Cross-cutting conventions), and a silent
|
|
221
265
|
logger. Override via `app_options`. `cleanup()` is the assembled server's idempotent
|
|
222
266
|
`close` — it also closes the server's live connections, disposes the
|
|
223
267
|
limiters it built, and removes the audit listeners and closer members it
|
|
@@ -228,7 +272,7 @@ write audit rows mid-test. A suite that opts in through `app_options` has the
|
|
|
228
272
|
schedule stopped by `cleanup()`, which is the assembled server's `close`.
|
|
229
273
|
|
|
230
274
|
A fresh Hono app is created on every call because middleware closures bind
|
|
231
|
-
to the server's deps (db, keyring). Hono assembly is cheap
|
|
275
|
+
to the server's deps (db, keyring). Hono assembly is cheap;
|
|
232
276
|
the WASM caching in `db.ts` is where the real savings are.
|
|
233
277
|
|
|
234
278
|
### `auth_apps.ts` — adversarial-auth app factories
|
|
@@ -335,87 +379,14 @@ declarations (DDL, the method set), this compares answers. Each impl is the
|
|
|
335
379
|
oracle for the other — a case the table pins by status alone, or an extra
|
|
336
380
|
field a loose output schema passes on one spine, shows up as a difference.
|
|
337
381
|
|
|
338
|
-
- `cross_backend/differential_normalize.ts` — `normalize_differential_response
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
tokens, `tok_` token ids, lowercase UUIDs, `ISO8601_SECONDS` timestamps,
|
|
347
|
-
bare 64-hex digests — matched inside any string, object keys included): the
|
|
348
|
-
first UUID is `<uuid:1>`, a repeat of it `<uuid:1>` again, so identity
|
|
349
|
-
relations within one response survive while the values differ across
|
|
350
|
-
backends. Placeholders are positional, not tied to fixture identity, so two
|
|
351
|
-
ids that appear once each and trade places normalize equal. Only the
|
|
352
|
-
canonical spelling is placeholdered — an uppercase UUID or a millisecond
|
|
353
|
-
timestamp stays raw and differs — and a `blake3:` content address is
|
|
354
|
-
compared verbatim (equal bytes hash equal on both spines). Keys are sorted (and visited
|
|
355
|
-
in that order when numbering); array order is kept. `header_names` is the
|
|
356
|
-
sorted name set minus `VOLATILE_HEADER_NAMES` (framing and per-request
|
|
357
|
-
headers each server sets its own way); values are never compared —
|
|
358
|
-
`set-cookie` carries a fresh credential, and the contract header values are
|
|
359
|
-
the conformance table's `expect.headers` + no-fingerprint floor.
|
|
360
|
-
`diff_differential_responses(a, b)` → `DifferentialDiff[]`, one per leaf
|
|
361
|
-
path (`status`, `headers.<name>`, `session_cookie`, `body.error.data.reason`; an object one
|
|
362
|
-
side lacks diffs key by key, and an empty one against a missing one at its
|
|
363
|
-
own path), `differential_path_covers(covered, path)`,
|
|
364
|
-
`format_differential_diffs(diffs, labels)`.
|
|
365
|
-
- `cross_backend/differential.ts` —
|
|
366
|
-
`describe_differential_conformance_tests({cases, backends: [a, b],
|
|
367
|
-
surface_source, rpc_endpoints, live_rpc_endpoints?, session_options,
|
|
368
|
-
principals?, known_divergences?, suite_name?})`, each backend `{name,
|
|
369
|
-
setup_test, ws?}`; methods resolve as the table resolves them
|
|
370
|
-
(`resolve_conformance_rpc_endpoints`).
|
|
371
|
-
`ws` on both runs the cases over their WebSocket endpoints, filtered by
|
|
372
|
-
`is_ws_conformance_case`, with the ledger checked against what is left; on
|
|
373
|
-
one alone, registration throws. Per case, each backend's own `setup_test`
|
|
374
|
-
(separate databases and keepers), the principal resolved and the request
|
|
375
|
-
sent through `send_conformance_case` (`conformance_table.ts`), both answers
|
|
376
|
-
normalized and diffed. Every HTTP request carries
|
|
377
|
-
`DIFFERENTIAL_REQUEST_HEADERS` (`accept-encoding: identity`), so a runtime's
|
|
378
|
-
own compression (for a request accepting gzip, as Node's `fetch` sends by
|
|
379
|
-
default) never reads as a `content-encoding` / `vary`
|
|
380
|
-
difference. The per-case `expect` is not asserted —
|
|
381
|
-
each backend's conformance leg holds it. `KnownDivergence` is the ledger
|
|
382
|
-
row: `{case_name | method, tracking_id, reason, what_differs}`, the names a
|
|
383
|
-
string or a list, `what_differs` the diff paths covered (a path covers everything under it; a cookie difference where one side sends no `Set-Cookie` also differs at `headers.set-cookie`, so its entry names both), each a string or a `KnownDivergencePath`
|
|
384
|
-
`{path, a?, b?}` pinning the value a side shows there (`undefined` for
|
|
385
|
-
nothing). A pin is compared with the normalized leaf value at the differing
|
|
386
|
-
path, so a placeholdered value never matches the raw one, an object pin
|
|
387
|
-
must list its keys sorted, and a parent-path pin never matches. A case may
|
|
388
|
-
differ at the paths of the entries it matches, with their values, and
|
|
389
|
-
nowhere else. `xfail_until`'s turns-red semantics clean
|
|
390
|
-
the ledger: a case a `case_name` entry names must still show it (checked in
|
|
391
|
-
that case's test), a `method` entry must still show on one of its cases
|
|
392
|
-
(checked by a closing test once they all ran — a filtered or failed run
|
|
393
|
-
leaves it unjudged, and the test skips when nothing was judged), and an
|
|
394
|
-
entry matching no case, or listing a case name that doesn't exist or a
|
|
395
|
-
method no case sends, fails —
|
|
396
|
-
the static half is `check_known_divergence_ledger(cases, ledger)`, exported
|
|
397
|
-
for checking a ledger without a backend. No other ignore path exists.
|
|
398
|
-
|
|
399
|
-
fuz_app runs it under the `cross_backend_parity` project
|
|
400
|
-
(`differential.cross.test.ts`, its ledger `differential_known_divergences.ts`
|
|
401
|
-
in `src/test/cross_backend/`): every `conformance_*_cases.ts` array plus the
|
|
402
|
-
generated auth rows (over the live mount too, so the cell verbs, the actor
|
|
403
|
-
resolvers and the `_testing_*` backdoors are compared), TS spine vs
|
|
404
|
-
`testing_spine_stub`, both on Postgres so no engine difference reads as a body
|
|
405
|
-
difference. The same cases run again over
|
|
406
|
-
WS, against `differential_ws_known_divergences` (the HTTP ledger without its
|
|
407
|
-
header row). The multi-actor `conformance_acting_cases.ts` rows run with the
|
|
408
|
-
generated rows on a keeper seeded with `extra_actors`, over both transports.
|
|
409
|
-
The TS spine runs under `DEV` there, so its DEV-only diagnostics (the
|
|
410
|
-
`issues` on `invalid_params`, the `X-Fuz-Auth-Debug` header) are ledger rows.
|
|
411
|
-
The suite composition is `describe_spine_differential_suites`
|
|
412
|
-
(`src/test/cross_backend/spine_differential.ts`), which takes the two
|
|
413
|
-
backends and their ledgers. fuz_app also holds two TS runtimes to each other
|
|
414
|
-
with it: the `cross_backend_ts_differential` project
|
|
415
|
-
(`differential_ts.cross.test.ts`) dual-spawns the TS spine binary on Node and
|
|
416
|
-
on Bun, both on `memory://`, against an empty ledger — both run under `DEV`,
|
|
417
|
-
so the DEV-only rows show on both sides and differ nowhere. It needs no Rust
|
|
418
|
-
or Postgres and runs in the `cross-ts` CI job.
|
|
382
|
+
- `cross_backend/differential_normalize.ts` — `normalize_differential_response` → `DifferentialResponse` `{status, body, header_names, session_cookie}`: volatile values in their canonical spelling (`VOLATILE_VALUE_PATTERNS`) become positional placeholders, so identity relations inside one response survive; header values are never compared, and the cookie compares as its `SessionCookieEffect`. `diff_differential_responses` → one `DifferentialDiff` per leaf path. The rules are the module's TSDoc.
|
|
383
|
+
- `cross_backend/differential.ts` — `describe_differential_conformance_tests({cases, backends: [a, b], …})`: per case, each backend's own fixture, the request sent through `send_conformance_case`, both answers normalized and diffed (each case's `expect` is its conformance leg's, not asserted here). `ws` on both re-runs the WS-eligible cases over sockets; `db_state` on both also compares the database each case leaves (either on one backend alone throws at registration). The `KnownDivergence` ledger is the only ignore path and turns red like `xfail_until` when an entry stops matching (`check_known_divergence_ledger` is the static half); a pin compares against the normalized value, so it never matches a raw one.
|
|
384
|
+
- `cross_backend/db_state_diff.ts` — `create_db_state_probe(handle)` reads every `public` table but `schema_version` from the backend's own Postgres after draining its audit writes; `normalize_db_state` makes ids, tokens and timestamps comparable; `diff_db_states` names differences `db.<table>[i].<column>`. The normalization rules are the module's TSDoc.
|
|
385
|
+
|
|
386
|
+
fuz_app's wiring (TS vs Rust under `cross_backend_parity`, Node vs Bun under
|
|
387
|
+
`cross_backend_ts_differential`, both through
|
|
388
|
+
`describe_spine_differential_suites`): ../../test/CLAUDE.md §Cross-backend
|
|
389
|
+
self-tests.
|
|
419
390
|
|
|
420
391
|
## Assertions, coverage, helpers
|
|
421
392
|
|
|
@@ -515,7 +486,7 @@ adversarial/round-trip tests. A value that is no schema throws, naming it.
|
|
|
515
486
|
- `detect_format(field_schema)` — `detect_json_schema_format` over `to_field_json_schema`: the `format`, `'pattern'` for a regex, or `null`.
|
|
516
487
|
- `generate_valid_value(field, field_schema)` — base-type switch producing a valid sample (UUIDs → nil UUID, strings → `'xxxxxxxxxx'`, numbers → `1`, objects → `generate_valid_object` against the field schema, so a nested refinement is satisfied too, enums → first entry, records → `{}`, a void field → `undefined`, etc.). For branded-string refinements, walks a fallback chain synthesized from the `pattern` string the JSON Schema representation exposes: fixed-length hex (`^[0-9a-f]{N}$` — blake3 / sha256 / md5 digests; `0`.repeat(N)), prefix-lengthed slug (`^<prefix>_[A-Za-z0-9_-]{N}$` — `ApiTokenId`-style ids; `<prefix>_` + `x`.repeat(N)), absolute path prefix, URL prefix, two `/`-joined segments (an `owner/name` slug). First candidate the field accepts is used.
|
|
517
488
|
- `generate_valid_string_param(field, field_schema)` — a string a URL-sourced field (route param, query value) accepts: the nil UUID for a UUID field, else the first of `test_value`, the generated valid value as a string, `1`, `0`, `true`, `false`, the field's JSON Schema `default` or lower bound as a string, each `min_value` / `max_value` bound anywhere in the schema as an integer (a string parsed into an integer whose range excludes the small candidates, as `db_routes`' `query_int` — bounds past a `transform`, which JSON Schema can't say) and a synthesized string the field accepts; `null` when none does. The params and query case generators build their base from it.
|
|
518
|
-
- `resolve_valid_path(path, params_schema?, param_values?)` — swaps each whole param segment (
|
|
489
|
+
- `resolve_valid_path(path, params_schema?, param_values?)` — swaps each whole param segment (as Hono reads a template) for a value the params schema accepts: a `param_values` entry (`RouteParamValues`) first, else `test_<name>` where the schema admits it, the nil UUID for a UUID param, or a synthesized value, always percent-encoded. A `:name{re}` param's value must match its pattern (RegExpRouter's reading), else it throws naming the route and pointing at `param_values` — no guess, no silent skip. The other refusals are its TSDoc.
|
|
519
490
|
- `to_route_content_type(route)` — the `Content-Type` a well-formed request to the route sends: `application/json`, or `application/octet-stream` for a `raw_body` route. Every `POST` route refuses anything else with 415 before its other gates, so every probe in the harnesses (auth, params and query fuzz, 404, data exposure, round trip) sends it, body or not.
|
|
520
491
|
- `generate_valid_object(object_schema, schema) => {value, result}` — required and defaulted fields; when `schema` (refinements included) refuses those, each optional field alone in declaration order, the first that parses; failing that, the optional fields added cumulatively until it parses. Covers a `check` over optional fields (at least one of, exactly one of, both of) at any depth, and, where one optional field suffices, keeps the others (an `acting` declared first) out. Returns the last `parse` result (`GeneratedObject`) and leaves the throw to the caller, which renders its issues with `format_issues` (`schema_issues.ts`).
|
|
521
492
|
- `generate_valid_object_with_field(object_schema, schema, base, field)` — a valid object carrying `field`, built from the valid `base`: `base` itself when it carries the field; else the field joins `base`, with the optional fields `base` omits filled as `generate_valid_object` fills them (a pair rule: `scope_kind` needs `scope_id`); failing that, the field replaces `base`'s optional fields, refilled around it (exactly one of: adding `slug` drops `id`). `null` when no object the generator builds carries the field. The body a single-fault case on a field the base omits changes.
|
|
@@ -524,7 +495,7 @@ adversarial/round-trip tests. A value that is no schema throws, naming it.
|
|
|
524
495
|
### `integration_helpers.ts` — route lookup + body checks
|
|
525
496
|
|
|
526
497
|
- `find_route_spec(specs, method, path)` — the first spec in list (mount) order whose method and path template match, as Hono dispatches (the hono-free `find_mounted_route`; the DEV check reads Hono's own router), `HEAD` read as `GET`, the path read as the router reads it (the raw pathname, nothing decoded); a template passed as the path (a segment that is `*` or starts with `:`) finds its own spec first, outranking mount order.
|
|
527
|
-
- `find_auth_route(specs, suffix, method)` — suffix-ending match for REST auth routes; decouples tests from consumer prefix. `suffix` is typed as `RestAuthRouteSuffix` and throws at runtime on unknown values
|
|
498
|
+
- `find_auth_route(specs, suffix, method)` — suffix-ending match for REST auth routes; decouples tests from consumer prefix. `suffix` is typed as `RestAuthRouteSuffix` (`rest_auth_route_suffixes`: login, logout, password, signup, bootstrap) and throws at runtime on unknown values.
|
|
528
499
|
- `assert_response_matches_spec(specs, method, path, response, route_error_maps?)` — 2xx → validates against `spec.output`; an error status (400 and up) → `assert_error_response_declared` against the route's error map — the one in `route_error_maps` (`AppSurfaceSpec.route_error_maps`, middleware included), else the route's own: a status the map lacks throws (`Undeclared error status (S): METHOD path: …`), as does a body off its schema, with the DEV error check's exemptions (500 `internal_error`, 503 `service_unavailable`, a JSON-RPC envelope on a `jsonrpc` route). Non-JSON responses allowed only when no schema applies. The round trips and `ErrorCoverageCollector.assert_and_record` run through it. An answer no route gave — the app's 405 `method_not_allowed`, its JSON `route_not_found` 404, the plain-text `404 Not Found` — fails outright, even where the route declares a 404: a route on the surface that the backend doesn't mount is never a pass.
|
|
529
500
|
- `assert_no_error_info_leakage(body, context)` — rejects field-name patterns (`stack`, `trace`, `sql`, …) + value patterns (`node_modules`, stack-like `at …`, `.ts:NN`).
|
|
530
501
|
- `assert_rate_limit_retry_after_header(response, body)` — `Retry-After` numeric header equals `Math.ceil(body.retry_after)`.
|
|
@@ -539,8 +510,7 @@ adversarial/round-trip tests. A value that is no schema throws, naming it.
|
|
|
539
510
|
|
|
540
511
|
### `attack_surface.ts` — `describe_standard_attack_surface_tests`
|
|
541
512
|
|
|
542
|
-
Single-call bundle
|
|
543
|
-
case per route):
|
|
513
|
+
Single-call bundle, every adversarial case per route included. The groups:
|
|
544
514
|
|
|
545
515
|
1. **attack surface snapshot** — `matches committed snapshot`, `is deterministic`.
|
|
546
516
|
2. **attack surface structure** — `only expected public routes`, `full middleware stack on API routes`, `surface invariants`, `rpc/ws surface invariants`, `security policy`.
|
|
@@ -576,7 +546,7 @@ accepts (`assert_error_schema_valid`).
|
|
|
576
546
|
The generators live in the hono-free `adversarial_input_cases.ts`, so the
|
|
577
547
|
cross-process suites reuse them:
|
|
578
548
|
|
|
579
|
-
- `generate_input_test_cases(input_schema, options?)` → `InputTestCase[]` — whole-body structural
|
|
549
|
+
- `generate_input_test_cases(input_schema, options?)` → `InputTestCase[]` — whole-body structural cases, missing required fields, and per field a wrong type, `null`, a format violation and boundary cases read from its input-side JSON Schema (`to_field_json_schema`). Every per-field case is **single-fault** — a valid base (`generate_valid_object`, or `options.base`) with only that field broken — emitted only when the schema refuses it, and names its field (`InputTestCase.field`). A void or null input gets none; any other non-object input throws. The case list is the module's TSDoc.
|
|
580
550
|
- `expected_invalid_reason(input_schema, test_case)` → `string | undefined` — the `data.reason` an RPC refusal of the case owes: the broken field's `invalid_reason` (`schema_meta.ts`), resolved by the same `resolve_invalid_reason` the dispatcher resolves through, or none for an undeclared field or a whole-body case.
|
|
581
551
|
- `generate_params_test_cases(params_schema)` → `ParamsTestCase[]` — format violations only (unconstrained string params accept anything), each one the field refuses.
|
|
582
552
|
- `generate_query_test_cases(query_schema)` → `QueryTestCase[]` — missing required fields the field refuses to go without (a preprocessed field with a default accepts its absence) + format violations the field refuses.
|
|
@@ -591,7 +561,9 @@ rather than `ERROR_INVALID_JSON_BODY`.
|
|
|
591
561
|
|
|
592
562
|
`describe_adversarial_404({build, roles})` — for every route with `params` and
|
|
593
563
|
a 404 definition of its own in `errors`, replaces the handler with a stub
|
|
594
|
-
returning
|
|
564
|
+
returning the first 404 definition's code with its fields generated from its
|
|
565
|
+
schema (`generate_valid_object`; fields it can't generate throw at collection,
|
|
566
|
+
naming the route), fires with
|
|
595
567
|
nil-UUID params, asserts 404, a code the route error map declares at 404, and a body its 404
|
|
596
568
|
accepts (`assert_error_schema_valid`, `AppSurfaceSpec.route_error_maps`). No DB needed.
|
|
597
569
|
|
|
@@ -669,40 +641,22 @@ picks them up separately.
|
|
|
669
641
|
|
|
670
642
|
### `rpc_round_trip.ts` — `describe_rpc_round_trip_tests`
|
|
671
643
|
|
|
672
|
-
DB-backed round
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
`pick_auth_principal` (`integration_helpers.ts`, shared with the REST
|
|
689
|
-
round-trip; `AuthPrincipal`): none for a public method, the keeper's daemon
|
|
690
|
-
token when `credential_types` names it, the admin account's session for an
|
|
691
|
-
admin-gated method, the keeper's session for another role, else the authed
|
|
692
|
-
account's session. The request goes through `to_principal_transport`, so a
|
|
693
|
-
spawned backend sees only the picked credential — over the fixture's own
|
|
694
|
-
transport it would discard a daemon token as browser context and answer for
|
|
695
|
-
the keeper's session cookie. A 403 `credential_type_required` therefore fails
|
|
696
|
-
(`is_credential_type_refusal`): the principal was picked because the method
|
|
697
|
-
admits its credential type, so a method no picked principal can reach goes in
|
|
698
|
-
`skip_methods`. The 401 check is `is_unauthenticated_refusal`: a 401
|
|
699
|
-
reading `authentication_required` or naming no reason fails; a handler's own
|
|
700
|
-
401 reason on an authenticated call (`invalid_credentials` for a wrong current
|
|
701
|
-
password) passes. So a handler that answers 401 to a valid credential must name
|
|
702
|
-
its reason — `data.reason` over RPC, the flat `error` over REST: a reason-less
|
|
703
|
-
401 reads as unauthenticated and fails the round-trip. TS's
|
|
704
|
-
`jsonrpc_errors.unauthenticated(message)` sends no `data` unless given one, so
|
|
705
|
-
pass `{reason}` as its second argument.
|
|
644
|
+
DB-backed round trip for RPC: every method over POST, the `side_effects:
|
|
645
|
+
false` ones over GET too; a success parses against `output`, an error must be
|
|
646
|
+
a well-formed envelope. It fails on `method not found`, a crash (500,
|
|
647
|
+
`internal_error`, or a ≥500 that is no envelope), a 403
|
|
648
|
+
`credential_type_required`, and a 401 to a non-public call that reads
|
|
649
|
+
`authentication_required` or names no reason: the principal
|
|
650
|
+
(`pick_auth_principal`, shared with the REST round trip, sent through
|
|
651
|
+
`to_principal_transport` so it carries that credential alone) was picked
|
|
652
|
+
because the method admits its credential. So **a handler answering 401 to a
|
|
653
|
+
valid credential must name its reason** — `data.reason` over RPC (pass
|
|
654
|
+
`{reason}` to `jsonrpc_errors.unauthenticated`), the flat `error` over REST. A
|
|
655
|
+
≥500 carrying a declared code (503 `service_unavailable`, 504 `timeout`, a
|
|
656
|
+
consumer's `register_jsonrpc_error_code`) passes. Options: `{setup_test,
|
|
657
|
+
surface_source, session_cookie_name, rpc_endpoints, skip_methods?,
|
|
658
|
+
input_overrides?, success_fixtures?}`; a method no picked principal can reach
|
|
659
|
+
goes in `skip_methods`.
|
|
706
660
|
|
|
707
661
|
A side-effecting method picked for the authed account runs on a fresh account
|
|
708
662
|
of its own (`round_trip_uses_fresh_account`, keyed on the spec's
|
|
@@ -766,8 +720,8 @@ cover real sockets.
|
|
|
766
720
|
|
|
767
721
|
Three layers:
|
|
768
722
|
|
|
769
|
-
1. **Primitives** — `create_fake_ws(options?)` (a real `WSContext`
|
|
770
|
-
2. **Harness** — `create_ws_test_harness({actions, registry?, receive_timeout?, log?, on_socket_open?, on_socket_close?})` → `WsTestHarness
|
|
723
|
+
1. **Primitives** — `create_fake_ws(options?)` (a real `WSContext` recording `sends` / `closes` over a fake Node-`ws`-shaped `socket` with `bufferedAmount`, `stalled` and `terminate`, for backpressure and frameless-cut tests), `create_fake_hono_context(opts)` (sets the `ResolvedAuth` the auth middleware would — the dispatcher reads it, so a hand-built upgrade context must too), `create_stub_upgrade()` (a stand-in for the runtime's `upgradeWebSocket` that records each upgrade's real `Context`, so an upgrade can run through an assembled app's whole middleware chain — `src/test/server/create_app_server_ws_endpoints.dispatch.db.test.ts`), `MinimalActionEnvironment`, `dispatch_ws_message`.
|
|
724
|
+
2. **Harness** — `create_ws_test_harness({actions, registry?, receive_timeout?, log?, on_socket_open?, on_socket_close?})` → `WsTestHarness`; `await harness.connect(identity?)` resolves once the connection is admitted and `on_socket_open` has run. Identities are preset (`TEST_CONTEXT_PRESET_KEY`), which also skips the admission credential re-read, so tests of the re-read drive `register_action_ws` over a real database (`src/test/actions/register_action_ws.admission.db.test.ts`). Handlers run under the stub db's transaction wrap; domain deps and the audit emitter reach them through the action factory's closure.
|
|
771
725
|
3. **Round-trip helpers** — predicates + wire-frame types live in `transports/ws_client.ts` (shared with the cross-process `ws_transport.ts` impl): `is_notification(method)`, `is_notification_with<P>(method, match)` (type-guard combinator — narrows `wait_for` return type), `is_response_for(id)`, `JsonrpcNotificationFrame<P>` / `JsonrpcSuccessResponseFrame<R>` / `JsonrpcErrorResponseFrame<D>` (typed wire-frame shapes distinct from the runtime schemas in `http/jsonrpc.ts` — generic over `params` / `result` / `data` so tests narrow without casts).
|
|
772
726
|
|
|
773
727
|
`WsClient` (in `transports/ws_client.ts`):
|
|
@@ -793,13 +747,13 @@ waiter on timeout so the `waiters` array doesn't grow.
|
|
|
793
747
|
|
|
794
748
|
### `data_exposure.ts` — `describe_data_exposure_tests`
|
|
795
749
|
|
|
796
|
-
|
|
750
|
+
The groups:
|
|
797
751
|
|
|
798
|
-
1. **schema-level** (
|
|
752
|
+
1. **schema-level** (no DB) — walks JSON Schema representations:
|
|
799
753
|
- `no sensitive fields in any output schema` — `sensitive_field_blocklist`, over every route, RPC method and WS method output, and the params the server pushes over WS (a `remote_notification`'s payload, whose `output` is `s.void`, and the request of a `request_response` with `initiator` `'backend'` or `'both'`)
|
|
800
754
|
- `no admin-only fields in non-admin output schemas` — `admin_only_field_blocklist`, over the route outputs a non-admin reaches; routes only, since the blocklist matches by name and domain RPC/WS outputs carry `created_by`/`updated_by` legitimately. Admin-gated means every role in an any-of `roles` (or a WS endpoint's `required_roles`) is `admin` or `keeper`, or the daemon token is required
|
|
801
755
|
- `no sensitive fields in any error schema`
|
|
802
|
-
2. **runtime** (
|
|
756
|
+
2. **runtime** (DB-backed via `create_test_app`):
|
|
803
757
|
- `unauthenticated error responses contain no sensitive fields`
|
|
804
758
|
- `admin routes return 403 for non-admin user` — cross-privilege check
|
|
805
759
|
- `all 2xx responses pass field blocklists` — GETs sorted before POSTs so data-returning routes fire before destructive ones (logout, revoke-all) invalidate sessions
|
|
@@ -823,7 +777,7 @@ as `'/path method_name'`, and pushed WS params as `'/path method_name params'`
|
|
|
823
777
|
|
|
824
778
|
### `rate_limiting.ts` — `describe_rate_limiting_tests`
|
|
825
779
|
|
|
826
|
-
|
|
780
|
+
The groups:
|
|
827
781
|
|
|
828
782
|
1. IP rate limiting on login — fires `max_attempts + 1` requests; last should be 429 with a `REST_RATE_LIMIT_EXCEEDED` body + valid `Retry-After` header.
|
|
829
783
|
2. Per-account rate limiting on login — same username exhausts the bucket; a different username is not blocked.
|
|
@@ -835,7 +789,7 @@ Each group asserts its required route exists with a descriptive message.
|
|
|
835
789
|
Creates a tight rate limiter (default `max_attempts: 2`, `window_ms: 60_000`)
|
|
836
790
|
per test and disposes it in `finally`.
|
|
837
791
|
|
|
838
|
-
Options: `{
|
|
792
|
+
Options: `{session_cookie_name, create_route_specs, rpc_endpoints?, app_options?, db_factories?, max_attempts?}`.
|
|
839
793
|
Reads inputs directly from the options bag instead of going through the
|
|
840
794
|
`setup_test` fixture protocol — the per-test rate-limiter overrides need a
|
|
841
795
|
fresh `TestApp` per test that the single-fixture model can't carry.
|
|
@@ -848,8 +802,7 @@ the spread are ignored by the suite.
|
|
|
848
802
|
### `integration.ts` — `describe_standard_integration_tests`
|
|
849
803
|
|
|
850
804
|
Exercises the full stack against a real in-memory database + auth middleware + session
|
|
851
|
-
cookies + bearer tokens.
|
|
852
|
-
these thematic areas:
|
|
805
|
+
cookies + bearer tokens. Its `describe` blocks, by theme:
|
|
853
806
|
|
|
854
807
|
1. Login/logout lifecycle
|
|
855
808
|
2. Login response body (strict schema)
|
|
@@ -879,7 +832,7 @@ probes each gate on each counted route. Override with
|
|
|
879
832
|
minimal route sets whose declared error codes outpace the suite's
|
|
880
833
|
denial-path drivers).
|
|
881
834
|
|
|
882
|
-
Options: `{setup_test, surface_source,
|
|
835
|
+
Options: `{setup_test, surface_source, session_cookie_name, rpc_endpoints, base_url,
|
|
883
836
|
max_body_bytes?, rpc_max_body_bytes?, error_coverage_min?,
|
|
884
837
|
check_uncovered_errors?}`; the last is called with the declared paths left
|
|
885
838
|
uncovered before the floor is asserted, which fuz_app's own wirings hold to an
|
|
@@ -913,18 +866,12 @@ asserts the declared status and code, then `assert_and_record`s it.
|
|
|
913
866
|
|
|
914
867
|
### `admin_integration.ts` — `describe_standard_admin_integration_tests`
|
|
915
868
|
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
parsed by `assert_audit_event_metadata`, closed to undeclared keys when the
|
|
923
|
-
fixture asks, and the completeness test drives login, logout, the offer flow,
|
|
924
|
-
grant + revoke, token create, password change, and — each where the surface
|
|
925
|
-
mounts its actions — token revoke, session revoke, invite create + delete and
|
|
926
|
-
`app_settings_update`), admin-to-admin
|
|
927
|
-
isolation, error coverage, response schema validation.
|
|
869
|
+
Groups: account listing, session and token management, audit log reads (every
|
|
870
|
+
row parsed by `assert_audit_event_metadata`, closed to undeclared keys when the
|
|
871
|
+
fixture asks), the admin audit trail and audit completeness (an optional
|
|
872
|
+
action's case only where the surface mounts it), admin-to-admin isolation,
|
|
873
|
+
error coverage. Role grants go through the RPC offer flow
|
|
874
|
+
(`role_grant_offer_and_accept`), never a direct insert.
|
|
928
875
|
|
|
929
876
|
The shared `role_grant_offer_and_accept` helper (`role_grant_helpers.ts`)
|
|
930
877
|
composes both RPCs end-to-end and takes
|
|
@@ -934,7 +881,7 @@ header/account mismatch. Direct-grant fixtures (test focuses on revoke or
|
|
|
934
881
|
isolation, not the consent path) go through `create_test_role_grant_direct`
|
|
935
882
|
from `db_entities.ts`.
|
|
936
883
|
|
|
937
|
-
Required options: `{setup_test, surface_source,
|
|
884
|
+
Required options: `{setup_test, surface_source, session_cookie_name, rpc_endpoints: RpcEndpointsSuiteOption, roles: RoleRegistry, admin_prefix?}`.
|
|
938
885
|
|
|
939
886
|
fuz_app runs it cross-process through the standard bundle
|
|
940
887
|
and in-process as a consumer wires it
|
|
@@ -965,15 +912,9 @@ actions alongside admin / role-grant-offer — easiest is
|
|
|
965
912
|
`create_standard_rpc_actions`, which bundles all three. Consumers that only
|
|
966
913
|
wire admin will hit `method not found: account_token_create` on first run.
|
|
967
914
|
|
|
968
|
-
Error
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
when the scoped count is ≤1, the `afterAll` hook logs
|
|
972
|
-
`[error coverage] skipped admin REST coverage assertion — …` and does not
|
|
973
|
-
fail. The 20% `DEFAULT_INTEGRATION_ERROR_COVERAGE` baseline is a REST-era
|
|
974
|
-
threshold; the RPC surface has its own coverage via
|
|
975
|
-
`describe_rpc_round_trip_tests`. TODO: move this error-coverage collector
|
|
976
|
-
to the RPC round-trip suite entirely and delete this skip branch.
|
|
915
|
+
Error coverage counts the admin surface's REST routes alone (`/audit/stream`);
|
|
916
|
+
with one route or none in scope, the floor is skipped with a log line. The RPC
|
|
917
|
+
surface's coverage is `describe_rpc_round_trip_tests`'.
|
|
977
918
|
|
|
978
919
|
### `audit_completeness.ts` — `describe_audit_completeness_tests`
|
|
979
920
|
|
|
@@ -1038,20 +979,20 @@ Registry lookups:
|
|
|
1038
979
|
- `find_rpc_method(rpc_endpoints, method)` — surface-shape lookup over `AppSurfaceRpcEndpoint[]` (generated by `generate_app_surface`).
|
|
1039
980
|
- `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.
|
|
1040
981
|
- `RpcEndpointsSuiteOption` — union `Array<RpcEndpointSpec> | ((ctx: AppServerContext) => Array<RpcEndpointSpec>)` accepted by every DB-backed suite's `rpc_endpoints` field.
|
|
1041
|
-
- `resolve_rpc_endpoints_for_setup(rpc_endpoints,
|
|
982
|
+
- `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.
|
|
1042
983
|
|
|
1043
984
|
### `rpc_attack_surface.ts` + `rpc_envelope_cases.ts` — `describe_rpc_attack_surface_tests`
|
|
1044
985
|
|
|
1045
|
-
|
|
986
|
+
The groups:
|
|
1046
987
|
|
|
1047
988
|
1. **RPC auth enforcement** — per-endpoint, per-method:
|
|
1048
989
|
- unauthenticated → `unauthenticated` (code -32001)
|
|
1049
990
|
- wrong role → `forbidden` (-32002)
|
|
1050
991
|
- authenticated without role → `forbidden`
|
|
1051
992
|
- **keeper rejects non-daemon credentials** — session and api_token credentials are rejected even when the account has the keeper role (only `daemon_token` passes). The credential-type gate fires before the role gate (see `auth/CLAUDE.md` §Keeper auth shape).
|
|
1052
|
-
- correct auth passes (
|
|
993
|
+
- correct auth passes — valid params (`input_overrides` or generated) reach the method's handler, a recording stub, at 200
|
|
1053
994
|
- GET unauthenticated for `side_effects: false` reads
|
|
1054
|
-
2. **RPC adversarial envelopes** — the fixed
|
|
995
|
+
2. **RPC adversarial envelopes** — the fixed cases of `create_rpc_envelope_cases(endpoint, {skip_methods?})` (hono-free `rpc_envelope_cases.ts`, shared with the cross-process `describe_rpc_adversarial_cross_tests`): malformed and response-shaped envelopes, batches, unknown methods, the GET read restriction and its query parsing, and anonymous ordering cases (an anonymous GET mutation or batch is `invalid_request`, never 401; params validation runs after authorization). Each is sent by an app its method admits and pinned — status, code, echoed `id`, `data.reason` — by `assert_rpc_envelope_refusal`. The case list is the module's TSDoc.
|
|
1055
996
|
3. **RPC adversarial params** — `generate_rpc_params_test_cases(input, options?)` (`rpc_envelope_cases.ts`): `generate_input_test_cases` minus its structural cases (a non-object `params` is refused at the envelope, not at params validation), taking the same `{base?, label?}`. Every case expects 400 `invalid_params` with `data.reason` the broken field's declared `invalid_reason` (`expected_invalid_reason`), absent for an undeclared field. Shared with the cross-process suite. `input_overrides` (method name → valid params) seeds a method's cases from that base; an override its schema refuses throws at collection, naming the method.
|
|
1056
997
|
|
|
1057
998
|
Skips silently when `surface.rpc_endpoints` is empty. Uses stub deps — no
|
|
@@ -1059,15 +1000,10 @@ DB needed.
|
|
|
1059
1000
|
|
|
1060
1001
|
Options: `{build: () => AppSurfaceSpec, roles: Array<string>, input_overrides?}`.
|
|
1061
1002
|
|
|
1062
|
-
**Opt-in bundles need their own per-bundle suite file
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
`describe_rpc_round_trip_tests` unless the consumer ships a
|
|
1067
|
-
`<module>.rpc_suites.db.test.ts` mounting the opt-in factory on the RPC
|
|
1068
|
-
endpoint and calling both suites. See ../../test/CLAUDE.md §Composable
|
|
1069
|
-
Test Suites for the obligation note; existing
|
|
1070
|
-
`src/test/auth/*.rpc_suites.db.test.ts` files are templates.
|
|
1003
|
+
**Opt-in bundles need their own per-bundle suite file** — an action bundle
|
|
1004
|
+
outside `create_standard_rpc_actions` gets no adversarial or round-trip
|
|
1005
|
+
coverage until a `<module>.rpc_suites.db.test.ts` mounts it (../../test/CLAUDE.md
|
|
1006
|
+
§Composable Test Suites).
|
|
1071
1007
|
|
|
1072
1008
|
## Cross-cutting conventions
|
|
1073
1009
|
|
|
@@ -1099,172 +1035,36 @@ have files of their own.
|
|
|
1099
1035
|
|
|
1100
1036
|
### Fixture protocol + capabilities
|
|
1101
1037
|
|
|
1102
|
-
- `testing/cross_backend/setup.ts` — `SetupTest` / `TestFixture` /
|
|
1103
|
-
|
|
1104
|
-
`fixture.
|
|
1105
|
-
|
|
1106
|
-
`
|
|
1107
|
-
`
|
|
1108
|
-
`
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
`
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
`
|
|
1118
|
-
`
|
|
1119
|
-
`
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
over the production RPC surface, so the invite-gated mint keeps
|
|
1133
|
-
`open_signup` at its production default (`false`) and the per-test
|
|
1134
|
-
secondary holds real session + bearer credentials.
|
|
1135
|
-
`create_account({roles: [...]})` then drives `role_grant_offer_create`
|
|
1136
|
-
(keeper) + `role_grant_offer_accept` (per-test) for each role — roles
|
|
1137
|
-
whose `RoleSpec.grant_paths` don't include `'admin'` reject loudly at
|
|
1138
|
-
offer-create time (`ERROR_ROLE_GRANT_OFFER_ROLE_NOT_GRANTABLE`); those
|
|
1139
|
-
roles must be seeded via `extra_accounts` at bootstrap-equivalent time
|
|
1140
|
-
instead. `create_account({email})` threads an email onto the signup body
|
|
1141
|
-
(the username-scoped invite matches regardless of email), so the account
|
|
1142
|
-
lands with an email set — the hook the username-or-email login parity suite
|
|
1143
|
-
uses; the in-process path sets it directly on the inserted row. Must be a
|
|
1144
|
-
valid, per-test-unique `Email` (the `LOWER(email)` partial-unique index
|
|
1145
|
-
rejects collisions). The signup and login it drives go to the setup's
|
|
1146
|
-
`signup_path` / `login_path` (default `SPINE_ACCOUNT_SIGNUP_PATH` /
|
|
1147
|
-
`SPINE_ACCOUNT_LOGIN_PATH`, from `spine_surface_constants.ts`, which also
|
|
1148
|
-
carries the other account routes, `SPINE_WS_PATH`, and the prefix).
|
|
1149
|
-
Caller-supplied `username`s pass through as given — the database is wiped
|
|
1150
|
-
between tests, so a hardcoded name like `'user_two'` never collides. Every
|
|
1151
|
-
`TestFixture` also exposes
|
|
1152
|
-
`fresh_transport({origin?: string | null})` — cookie-jar-free probe;
|
|
1153
|
-
pass `{origin: null}` for bearer-only paths. It also carries the conformance principals' mints — `mint_expired_session()`, and `mint_revoked_session()` / `mint_revoked_token()` / `mint_expired_token()` for the dead credentials, each proving its credential live through `assert_credential_authenticates` over a cookie-free transport before killing it; in-process they need `account_verify` on the setup's `rpc_endpoints`, and cross-process `mint_expired_token` needs `_testing_shorten_credential_expiry` mounted.
|
|
1154
|
-
|
|
1155
|
-
**Keeper ≠ admin.** `fixture.account` is the keeper account holding
|
|
1156
|
-
`[ROLE_KEEPER, ROLE_ADMIN]` — the role split mirrors production
|
|
1157
|
-
`bootstrap_account`. `ROLE_KEEPER` does not grant admin reach; bootstrap
|
|
1158
|
-
just happens to land both as separate grants. Probing the separation (a
|
|
1159
|
-
keeper-only account must 403 on admin RPCs) requires declaring
|
|
1160
|
-
`extra_accounts: [{username, roles: [ROLE_KEEPER]}]` — `ROLE_KEEPER`'s
|
|
1161
|
-
`grant_paths` is bootstrap-only, so a post-bootstrap offer/accept can't
|
|
1162
|
-
deliver it.
|
|
1163
|
-
|
|
1164
|
-
- `testing/cross_backend/capabilities.ts` — `BackendCapabilities` vocabulary
|
|
1165
|
-
(the **gating** flags `ws` / `sse` / `cell_crud` / `cell_relations` /
|
|
1166
|
-
`cell_gated_create` / `account_lifecycle` / `fact_serving` /
|
|
1167
|
-
`fact_serving_admin_hash` / `ready` /
|
|
1168
|
-
`account_status` / `spine_fallback` / `host_gate` / `peer_request` /
|
|
1169
|
-
`ws_handshake_pipelining` / `ws_account_actions` /
|
|
1170
|
-
`ws_role_gated` / `rooms` — each read by `test_if` or a row's `requires` —
|
|
1171
|
-
the non-gating `ws_refusal_body` and `runtime_resolves_dot_segments`, which
|
|
1172
|
-
pick how a case reads its answer, and the list
|
|
1173
|
-
`ws_upgrade_runtime_refusals`, the upgrades the backend's runtime answers
|
|
1174
|
-
before the app runs (`['empty_host']` on `@hono/node-server`, `[]` on Bun
|
|
1175
|
-
and the Rust spine), which the request-header wire suite holds to exactly
|
|
1176
|
-
that answer; `peer_request` (server-initiated requests — the ActionPeer
|
|
1177
|
-
`peer/ping` round-trip) is `true` on fuz_app's Rust and TS spine presets
|
|
1178
|
-
(`ConnectionRegistry.request_connection`); a backend states it
|
|
1179
|
-
`true` once it wires the `peer/ping` HTTP + WS mount), `test_if(cond, name, fn)`
|
|
1180
|
-
for capability-gated cases, and `in_process_capabilities` preset. Only
|
|
1181
|
-
flags a suite reads are capabilities — a wiring fact that gates nothing is
|
|
1182
|
-
not recorded. **Mount flags have no family default**: `MountFlag` names the
|
|
1183
|
-
flags that describe a backend's own mounts (`ws`, `sse`, `cell_crud`,
|
|
1184
|
-
`cell_relations`, `cell_gated_create`, `fact_serving`,
|
|
1185
|
-
`fact_serving_admin_hash`, `ready`,
|
|
1186
|
-
`peer_request`, `ws_account_actions`, `ws_role_gated`, `rooms`), and the family
|
|
1187
|
-
defaults (`ts_default_capabilities` / `rust_default_capabilities`, typed
|
|
1188
|
-
`FamilyDefaultCapabilities`) omit them and the `testing_backdoors` list (the
|
|
1189
|
-
`_testing_*` backdoors the backend mounts, from `TESTING_BACKDOOR_METHODS` —
|
|
1190
|
-
§Testing-backdoor declaration below; `[]` in-process, every one on fuz_app's
|
|
1191
|
-
spine presets), with `capabilities` required on
|
|
1192
|
-
`make_default_{ts,rust}_backend_config` — so a config that leaves one out
|
|
1193
|
-
fails typecheck naming it, rather than silently skipping its suites. The
|
|
1194
|
-
family defaults carry the declared surface's mounts (`account_lifecycle`,
|
|
1195
|
-
`account_status`, and `spine_fallback` — an unmatched path outside the auth
|
|
1196
|
-
scope answered by the spine's own fallback, which a backend serving a static
|
|
1197
|
-
or SPA fallback of its own states `false`; and `host_gate`, the DNS-rebinding
|
|
1198
|
-
gate on, which a backend running with it off states `false`) and the
|
|
1199
|
-
runtime-behavior flags
|
|
1200
|
-
(`ws_handshake_pipelining`, `ws_refusal_body`, `ws_upgrade_runtime_refusals`,
|
|
1201
|
-
`runtime_resolves_dot_segments`) of the family's reference runtime — Node for TS, hyper
|
|
1202
|
-
for Rust; a backend on another runtime (Bun) overrides them. `cell_crud`
|
|
1203
|
-
gates the CRUD parity suite, `cell_relations` the relation / ACL / audit
|
|
1204
|
-
parity suite — both `true` on every backend that live-mounts the full cell
|
|
1205
|
-
surface (TS spine binary, in-process app, Rust stub). A backend mounting only
|
|
1206
|
-
plain CRUD would declare `cell_crud: true, cell_relations: false`.
|
|
1207
|
-
`cell_gated_create` gates `describe_cell_gated_create_cross_tests` +
|
|
1208
|
-
`describe_cell_moderate_cross_tests` (the parent-aware-creation-authorizer +
|
|
1209
|
-
`cell_moderate` parity proofs) and, with `cell_relations`,
|
|
1210
|
-
`describe_cell_grant_steward_cross_tests` (the steward-revoke seam: a scoped
|
|
1211
|
-
`participant` grant stewards its scope under the
|
|
1212
|
-
`test_cell_grant_steward_revoke_authorize` policy mounted beside the create
|
|
1213
|
-
one); unlike `cell_crud`/`cell_relations`
|
|
1214
|
-
it is **cross-only** (`false` in-process) — `true` only on the reference
|
|
1215
|
-
spine binaries that live-mount the `test_cell_gated_create_authorize` policy
|
|
1216
|
-
(the TS spine `full_spine_mount` + the Rust `testing_spine_stub`), since the
|
|
1217
|
-
authorizer _behavior_ adds no method/wire shape and so the schema + manifest
|
|
1218
|
-
parity gates are blind to an authorizer divergence (the `cell_moderate`
|
|
1219
|
-
_verb_ it pairs with is on the manifest, separately gated).
|
|
1220
|
-
`rooms` gates `describe_rooms_ws_cross_tests` — **cross-only** too, and for
|
|
1221
|
-
the same reason: its rooms run on the `test_room_authorize` policy, so it is
|
|
1222
|
-
`true` only on a backend mounting the room verbs over that policy and an
|
|
1223
|
-
exclusive registry (the reference spine binaries); a consumer mounting rooms
|
|
1224
|
-
over its own authorizer states `false`.
|
|
1225
|
-
`account_lifecycle` gates `describe_account_lifecycle_cross_tests` (the
|
|
1226
|
-
`account_delete` / `account_undelete` / `account_purge` parity suite); unlike
|
|
1227
|
-
cells those verbs **are** on the declared surface (in `create_admin_actions`,
|
|
1228
|
-
auto-enumerated for shape/auth) — the flag gates the behavioral parity the
|
|
1229
|
-
generic round-trip can't drive (it can't delete the subject). `true` on every
|
|
1230
|
-
spine. `fact_serving`
|
|
1231
|
-
gates `describe_fact_serving_cross_tests` (the cell-scoped per-reference
|
|
1232
|
-
fact-serving parity suite, incl. the served fact's hardening headers and
|
|
1233
|
-
bodyless masked 404s); like cells it stays off the declared surface and is
|
|
1234
|
-
`true` on every spine that mounts the cell-gated serve route +
|
|
1235
|
-
the `_testing_put_fact` seeder (whose optional `holder` records a
|
|
1236
|
-
`fact_holder` row, so a non-admin can reference what it seeds, and whose
|
|
1237
|
-
optional `external_url` writes a bare external row naming that URL, so the
|
|
1238
|
-
suite can pin that a URL naming another hash's file is refused) — it also
|
|
1239
|
-
gates `describe_cell_ref_admission_cross_tests` (its grant, item, and clone
|
|
1240
|
-
cases with `cell_relations`). `fact_serving_admin_hash`
|
|
1241
|
-
is the admin-only bare-hash route (`GET /api/facts/:hash`), its own flag
|
|
1242
|
-
because a backend can serve the cell-gated route alone: it gates the
|
|
1243
|
-
fact-serving suite's bare-hash cases (with `fact_serving`) and the bare-hash
|
|
1244
|
-
cases of the query-shape and token-scope-surface suites. `ready` gates `describe_ready_cross_tests`
|
|
1245
|
-
(anonymous `GET /ready` → `200 {ready: true}` on a clean spine bootstrap);
|
|
1246
|
-
like cells/sse the `/ready` deploy gate stays off the declared surface, `true`
|
|
1247
|
-
on every spine that live-mounts it over the shared `expected_schema.json`.
|
|
1248
|
-
`account_status` gates the integration suite's `account status response body`
|
|
1249
|
-
case — `GET /api/account/status` is bundled into `create_account_route_specs`,
|
|
1250
|
-
so every spine serves it (`true`); the gate fails loud if a declaring backend
|
|
1251
|
-
doesn't mount it.
|
|
1252
|
-
No flag covers the body-size smuggling probe: every backend closes the
|
|
1253
|
-
connection after an oversized-body 413 (at once on Node, Bun and the Rust
|
|
1254
|
-
spine), so the pipelined request
|
|
1255
|
-
goes unanswered. Bun 1.4.3 is the tested floor — an older Bun kept the
|
|
1256
|
-
connection and served the next request, correctly framed, and fails the probe.
|
|
1257
|
-
`ws_handshake_pipelining` gates the WS round-trip suite's
|
|
1258
|
-
frames-with-the-handshake case (`true` Node/Rust — frames written in the
|
|
1259
|
-
same TCP write as the upgrade request reach the socket; `false` Bun, which
|
|
1260
|
-
answers such a request `400` when the upgrade follows an asynchronous check,
|
|
1261
|
-
as it does behind auth, and `false` in-process, where there is no socket to
|
|
1262
|
-
write raw bytes to).
|
|
1263
|
-
`ws_account_actions` (the WS endpoint mounts the account actions — `true` on
|
|
1264
|
-
fuz_app's own spine presets; a consumer states it like every mount flag) gates the WS
|
|
1265
|
-
round-trip suite's self-revocation case (which requires the reply ahead of
|
|
1266
|
-
the close on every backend) and, with `rpc_path`, its WS-mutation audit case
|
|
1267
|
-
(which calls `_testing_drain_effects`).
|
|
1038
|
+
- `testing/cross_backend/setup.ts` — the fixture protocol: `SetupTest` / `TestFixture` / `CreateTestAccountOptions`, and `default_cross_process_setup(handle, options?)` over a `BootstrappedBackendHandle`; the in-process `default_in_process_setup` (over `create_test_app`; `migration_namespaces` for tables beyond auth) and `default_in_process_suite_options` (the `{setup_test, surface_source, capabilities}` triple plus pass-through options) are `in_process_setup.ts`. Every test starts from a freshly bootstrapped keeper: cross-process by `_testing_reset` over the daemon-token channel (every auth row wiped, the keeper and any `extra_accounts` seeded, the answered seeds matched by `match_testing_reset_seeds`), in-process by a fresh `create_test_app`. `fixture.create_account({roles?, email?})` goes through the production surface — invite, signup, login, `account_token_create`, an offer and accept per role — so a role whose `grant_paths` lacks `'admin'` is seeded through `extra_accounts` instead; an `email` must be per-test unique. The fixture also carries `fresh_transport({origin?})` (no cookie jar; `{origin: null}` for bearer-only paths) and the dead-credential mints the conformance principals use, each proving its credential live before killing it (in-process they need `account_verify` on the setup's `rpc_endpoints`; cross-process `mint_expired_token` needs `_testing_shorten_credential_expiry` mounted).
|
|
1039
|
+
|
|
1040
|
+
**Keeper ≠ admin.** `fixture.account` holds `[ROLE_KEEPER, ROLE_ADMIN]` as two
|
|
1041
|
+
grants, as a production bootstrap does (in-process,
|
|
1042
|
+
`DEFAULT_TEST_KEEPER_ROLES`); keeper reach is not admin reach. To probe the
|
|
1043
|
+
split, seed `extra_accounts: [{username, roles: [ROLE_KEEPER]}]`
|
|
1044
|
+
(`ROLE_KEEPER` is bootstrap-only).
|
|
1045
|
+
|
|
1046
|
+
- `testing/cross_backend/capabilities.ts` — `BackendCapabilities`, `test_if(cond, name, fn)` (a skipped case registered through `test_skip_gated`, so `check_declared_skips` holds it to a declaration), `in_process_capabilities`. A flag exists only if a suite reads it. `MountFlag`s and `testing_backdoors` have no family default (`FamilyDefaultCapabilities` omits them, and `capabilities` is required on `make_default_{ts,rust}_backend_config`), so a config leaving one out fails typecheck by name, and `capability_mounts` probes each mount a request observes, so a `false` beside a mounted surface fails too. Each field's TSDoc carries its meaning and what it gates; the table is the map.
|
|
1047
|
+
|
|
1048
|
+
| flags | kind | TS / Rust default | in-process |
|
|
1049
|
+
| --- | --- | --- | --- |
|
|
1050
|
+
| `ws`, `sse`, `cell_crud`, `cell_relations`, `fact_serving`, `fact_serving_admin_hash`, `ready` | mount | none (stated per config) | `true` |
|
|
1051
|
+
| `peer_request`, `ws_account_actions`, `cell_gated_create`, `ws_role_gated`, `rooms` | mount, cross-process only | none | `false` |
|
|
1052
|
+
| `account_lifecycle`, `account_status`, `spine_fallback`, `host_gate` | declared spine surface / config | `true` / `true` | `true` |
|
|
1053
|
+
| `ws_handshake_pipelining` | runtime | `true` (Bun `false`) / `true` | `false` |
|
|
1054
|
+
| `ws_refusal_body` | runtime, not a gate | `false` (Bun `true`) / `true` | `true` |
|
|
1055
|
+
| `ws_upgrade_runtime_refusals` | runtime list | `['empty_host']` (Bun `[]`) / `[]` | `[]` |
|
|
1056
|
+
| `runtime_resolves_dot_segments` | runtime, not a gate | `true` / `false` | `true` |
|
|
1057
|
+
| `testing_backdoors` | list (§Testing-backdoor declaration) | none | `[]` |
|
|
1058
|
+
|
|
1059
|
+
`cell_gated_create` and `rooms` are `true` only on a backend mounting the test
|
|
1060
|
+
policies (`test_cell_gated_create_authorize`, `test_room_authorize`) — the
|
|
1061
|
+
parity gates are blind to an authorizer's behavior. A backend serving its own
|
|
1062
|
+
static or SPA fallback states `spine_fallback: false`; one running with the
|
|
1063
|
+
host gate off, `host_gate: false`.
|
|
1064
|
+
|
|
1065
|
+
No flag covers the body-size smuggling probe (`body_size_smuggling.ts`): every
|
|
1066
|
+
backend closes the connection after an oversized-body 413. Bun 1.4.3 is the
|
|
1067
|
+
tested floor.
|
|
1268
1068
|
|
|
1269
1069
|
### `cross_backend/standard.ts` — `describe_standard_cross_process_tests`
|
|
1270
1070
|
|
|
@@ -1304,8 +1104,8 @@ minus their in-process-only knobs (`create_route_specs`,
|
|
|
1304
1104
|
|
|
1305
1105
|
One call that runs every shipped single-backend cross suite against one
|
|
1306
1106
|
spawned backend: `describe_spine_cross_suites(handle, {surface_source,
|
|
1307
|
-
|
|
1308
|
-
exclude_cases?, overrides?, suite_roles?, ws_required_roles?, rpc_success_fixtures?,
|
|
1107
|
+
session_cookie_name, rpc_endpoints, live_rpc_endpoints?, roles?, setup?, exclude?,
|
|
1108
|
+
exclude_cases?, expected_skips?, overrides?, suite_roles?, ws_required_roles?, rpc_success_fixtures?,
|
|
1309
1109
|
rpc_skip_methods?, rpc_input_overrides?, rpc_max_body_bytes?, ws_max_message_bytes?})`.
|
|
1310
1110
|
`live_rpc_endpoints` is the backend's whole live mount; given, `rpc_adversarial`
|
|
1311
1111
|
also walks the methods it keeps off the declared surface. `rpc_input_overrides`
|
|
@@ -1330,7 +1130,9 @@ here never reaches it.
|
|
|
1330
1130
|
all), so a new suite fails until it is registered or stated standalone; the
|
|
1331
1131
|
dispatch table
|
|
1332
1132
|
is a `Record<SuiteName, …>`, so a registered name without an entry fails
|
|
1333
|
-
typecheck.
|
|
1133
|
+
typecheck. The same file holds §Suite modules' table to one row per suite
|
|
1134
|
+
in `SUITE_NAMES` order.
|
|
1135
|
+
- **Other runners.** `register_spine_suites(handle, options, {names?, wrap_setup_test?})` (`@internal`) runs the listed suites in `SUITE_NAMES` order, each `setup_test` wrapped (after the override merge); `describe_spine_cross_suites` is it over every suite, unwrapped. Each entry's required `transcript` (`SpineSuiteTranscript`) is `'http'` when every send goes through the recorded fixture transports, else `{excluded: {kind, reason}}` (`websocket`, `raw_socket`, `sse`, `embedded_secrets`), each kind held to the module's imports by fuz_app's census (../../test/CLAUDE.md §Cross-backend self-tests).
|
|
1334
1136
|
- **Options from the handle.** Paths, cookie name and capabilities come from
|
|
1335
1137
|
`handle.config` — `to_cross_suite_options(handle)`, exported for a suite
|
|
1336
1138
|
called on its own — the daemon token from the handle, and each suite's
|
|
@@ -1357,57 +1159,22 @@ here never reaches it.
|
|
|
1357
1159
|
`max_message_bytes` — one value per limit for every suite probing it.
|
|
1358
1160
|
- **`exclude`** — `{[suite]: reason}`; the reason is required and shows in the
|
|
1359
1161
|
run as a skipped test. An empty reason, an unknown suite name, a suite
|
|
1360
|
-
both excluded and overridden,
|
|
1361
|
-
declaration the gating reads
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
`
|
|
1370
|
-
|
|
1371
|
-
`
|
|
1372
|
-
`
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
`_testing_*` names, `testing_*_action_spec` references, and the
|
|
1377
|
-
`cross_put_fact` / `cross_drain_effects` seeders — to its entry's
|
|
1378
|
-
`backdoors`, the required pair, `_testing_put_fact` under
|
|
1379
|
-
`capabilities.fact_serving`, or `_testing_room_evict` under
|
|
1380
|
-
`capabilities.rooms`; a helper module the suite calls isn't read.
|
|
1381
|
-
- **`exclude_cases`** — `SuiteCaseExclusions`, `{[suite]: {[name path]:
|
|
1382
|
-
reason}}`: single tests of a suite that runs, each by its name path (the
|
|
1383
|
-
describe titles and the test name joined with `' > '` — what the reporter
|
|
1384
|
-
prints after the file and any `describe` wrapping the call; a full path, not
|
|
1385
|
-
a leaf name, so a title repeated under two describes names one test). One
|
|
1386
|
-
`beforeEach` on the calling suite (`register_spine_case_exclusions`) skips
|
|
1387
|
-
them at run time with `ctx.skip(reason)`, so the suite files stay as they
|
|
1388
|
-
are and each shows as skipped with its reason; it finds a test's suite
|
|
1389
|
-
from the top-level task ranges each suite registered (read through
|
|
1390
|
-
`TestRunner.getCurrentSuite()` at collection), so an entry matches only
|
|
1391
|
-
below its own suite. A reasonless entry, an empty suite map, or an entry for
|
|
1392
|
-
an unknown, excluded or self-skipping suite, or for `testing_backdoor`,
|
|
1393
|
-
throws at collection; an entry
|
|
1394
|
-
naming no test its suite collected fails the closing test
|
|
1395
|
-
(`check_spine_case_exclusions`, which reads the collected paths, so a
|
|
1396
|
-
filtered run still checks them) — the dead-name check, as the known-divergence
|
|
1397
|
-
ledger has.
|
|
1398
|
-
- **`overrides`** — `SuiteOverrides`, per suite a `Partial` of its own options
|
|
1399
|
-
(`SuiteOptionsMap`), shallow-merged over the derived ones: a role list, an
|
|
1400
|
-
`xfail`, a narrower capability set, `ws: undefined` to drop optional socket
|
|
1401
|
-
cases (`session_cap` and `testing_backdoor` gate no case on `capabilities.ws`,
|
|
1402
|
-
so `ws` is their only socket switch), `extra_methods` to fire a consumer's own
|
|
1403
|
-
daemon-token seams through `testing_backdoor` (whose
|
|
1404
|
-
`capabilities.testing_backdoors` an override can't change — the call throws
|
|
1405
|
-
unless the merge keeps the backend's list). An entry can instead be a function of the derived
|
|
1406
|
-
options returning the patch (`SuiteOverride`), for a change built on a
|
|
1407
|
-
derived value — an `xfail` added to the derived multi-actor setup — so the
|
|
1408
|
-
seeding isn't restated. After the merge, every option the suite's type
|
|
1409
|
-
requires (each entry's `required` set, exhaustive by type) must be neither
|
|
1410
|
-
`undefined` nor `''`, or the call throws at collection naming suite and key.
|
|
1162
|
+
both excluded and overridden, a suite in `UNEXCLUDABLE_SPINE_SUITES`
|
|
1163
|
+
(`testing_backdoor`, which checks the backdoor declaration the gating reads,
|
|
1164
|
+
and `capability_mounts`, which checks the mount flags), or a suite already
|
|
1165
|
+
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`), `_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
|
+
- **`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
|
+
- **`expected_skips`** — `{[name path]: reason}`: the gated skips the backend
|
|
1169
|
+
owes — the cases a suite skips because the backend lacks what they gate on
|
|
1170
|
+
(`test_if`) and the suites skipped for an undeclared backdoor (their line
|
|
1171
|
+
under `SPINE_SUITES_SKIPPED_TITLE`), each by its name path below the calling
|
|
1172
|
+
suite with a required reason. Given, the call ends with
|
|
1173
|
+
`check_declared_skips` over them, an `exclude`d suite's line declared by its
|
|
1174
|
+
`exclude` entry; omitted, no skip is checked. fuz_app's own call keys the
|
|
1175
|
+
list by backend name, so a capability flipped by mistake fails rather than
|
|
1176
|
+
declaring its own skip.
|
|
1177
|
+
- **`overrides`** — `SuiteOverrides`: per suite a `Partial` of its options, or a function of the derived options returning one (`SuiteOverride`), shallow-merged over the derived ones — a role list, an `xfail`, `ws: undefined` to drop optional socket cases. Every option a suite requires must survive the merge non-empty, or the call throws naming suite and key. The unexcludable suites take only what `check_unexcludable_override` allows, so an option added later is refused until classified.
|
|
1411
1178
|
- **Inputs the handle doesn't carry.** The declared surface is a required
|
|
1412
1179
|
option. Paths and roles that name the reference spines' mounts (the
|
|
1413
1180
|
role-gated WS endpoint and its roles) default to the `SPINE_*` constants —
|
|
@@ -1431,13 +1198,13 @@ reach, so every `cell_grant_role` arm still turns on the grant, while an admin
|
|
|
1431
1198
|
views and edits every cell — `describe_cell_grant_role_cross_tests` refuses
|
|
1432
1199
|
`ROLE_ADMIN` — and the scoped-assign case of `role_grant_participation` and
|
|
1433
1200
|
the scoped-revoke case of `role_grant_offer_notification_ws` skip for a
|
|
1434
|
-
builtin
|
|
1201
|
+
builtin, and `sse_round_trip`'s other-role keep case for `ROLE_ADMIN`. fuz_app's own wiring is
|
|
1435
1202
|
`src/test/cross_backend/spine_suites.cross.test.ts`.
|
|
1436
1203
|
|
|
1437
1204
|
### `cross_backend/rust_spine_consumer_surface.ts` — `create_rust_spine_consumer_surface_spec`
|
|
1438
1205
|
|
|
1439
1206
|
The declared surface of a consumer served by the Rust spine, for its cross
|
|
1440
|
-
suites: `create_rust_spine_consumer_surface_spec({
|
|
1207
|
+
suites: `create_rust_spine_consumer_surface_spec({session_cookie_name,
|
|
1441
1208
|
domain_action_specs, extra_rpc_actions?, roles?, exclude_methods?,
|
|
1442
1209
|
rpc_path?, host_gate?})`, built on `create_test_app_surface_spec` from the hono-free route
|
|
1443
1210
|
shapes. It declares `/health`, the `ACCOUNT_ROUTER_PATHS` under
|
|
@@ -1478,155 +1245,8 @@ conformance cases assert _expected behavior_ — the security negatives
|
|
|
1478
1245
|
(must be refused / must not leak / found-vs-not-found same shape) a
|
|
1479
1246
|
wire-shape check passes green on even when behavior is wrong.
|
|
1480
1247
|
|
|
1481
|
-
- `conformance_case.ts` — the `ConformanceCase` type (
|
|
1482
|
-
|
|
1483
|
-
error_reason?, error_code?, fields?, headers?, set_cookie?, equivalence_group?}, note?, xfail?}`. A case is **data** — `method`
|
|
1484
|
-
resolves its `input`/`output` from the live registry (RPC) or `RouteSpec`
|
|
1485
|
-
(the REST auth routes), so the case never carries a schema. `as` is the
|
|
1486
|
-
closed `ConformancePrincipal` enum (`keeper` / `daemon` / `invalid_daemon` /
|
|
1487
|
-
`daemon_browser` / `token` / `bearer_browser` / `malformed_bearer` / `scoped_token` / `anonymous` /
|
|
1488
|
-
`fresh_non_admin` / `role_holder` / `wrong_role` / `expired_session`, and
|
|
1489
|
-
the dead credentials `tampered_cookie` / `wrong_daemon` / `unknown_bearer` /
|
|
1490
|
-
`revoked_session` / `revoked_token` / `expired_token`) —
|
|
1491
|
-
fixture accessors, never inline credential minting.
|
|
1492
|
-
The dead credentials each ride a transport carrying nothing else, and each
|
|
1493
|
-
is well-formed, so the leg that refuses it is the one named:
|
|
1494
|
-
`tampered_cookie` is the keeper's cookie with its MAC changed (present and
|
|
1495
|
-
invalid — refused as anonymous and cleared); `wrong_daemon` a token-shaped
|
|
1496
|
-
`X-Daemon-Token` that is not the server's; `unknown_bearer` a token-shaped
|
|
1497
|
-
bearer no row matches; `revoked_session` a session that verified and was
|
|
1498
|
-
revoked (`fixture.mint_revoked_session()` — its cookie still verifies, so it
|
|
1499
|
-
is not cleared); `revoked_token` (`fixture.mint_revoked_token()`);
|
|
1500
|
-
`expired_token` a token past its `expires_at`
|
|
1501
|
-
(`fixture.mint_expired_token()` — on an account of its own, its expiry
|
|
1502
|
-
pulled in to `EXPIRED_TOKEN_SHORTEN_SECONDS` by the statement
|
|
1503
|
-
`_testing_shorten_credential_expiry` runs, `query_shorten_credential_expiry`,
|
|
1504
|
-
then one wait of `EXPIRED_TOKEN_WAIT_MS`, on both fixtures, so the row is
|
|
1505
|
-
one production could hold). Each of the three mints proves its credential
|
|
1506
|
-
live first — `assert_credential_authenticates`, an `account_verify` over a
|
|
1507
|
-
transport carrying only it — and that its revoke removed a row or its expiry rewrote one, and throws
|
|
1508
|
-
otherwise: revocation is a row delete, so without that a credential that
|
|
1509
|
-
never worked would pass as revoked. Each answers as `anonymous` does, row
|
|
1510
|
-
for row.
|
|
1511
|
-
`invalid_daemon` sends a malformed `X-Daemon-Token` alongside the keeper
|
|
1512
|
-
session cookie over a no-Origin transport: the middleware soft-fail-discards
|
|
1513
|
-
the daemon token (matching the Rust spine's `None`), auth falls through to the
|
|
1514
|
-
session leg, and a daemon-gated action then refuses the session credential
|
|
1515
|
-
with `credential_type_required` — not a hard invalid-token 401 (the session
|
|
1516
|
-
base credential is what makes the credential-type gate, not the auth gate, the
|
|
1517
|
-
refusing layer).
|
|
1518
|
-
`daemon_browser` sends a _valid_ `X-Daemon-Token` in a browser context
|
|
1519
|
-
(default `Origin` present) alongside the keeper session cookie: the middleware
|
|
1520
|
-
discards the header-bearing token as browser context (mirroring the bearer
|
|
1521
|
-
guard + the Rust spine's `is_browser_context`), so auth falls through to the
|
|
1522
|
-
session leg → `credential_type_required`. Unlike `daemon` (no Origin → token
|
|
1523
|
-
honored → 400 confirm guard), the 403 proves a valid token is _dropped_, not
|
|
1524
|
-
honored, when an `Origin` is present.
|
|
1525
|
-
`bearer_browser` is the bearer twin: a _valid_ bearer api-token in a browser
|
|
1526
|
-
context (default `Origin` present), fresh jar (no session) — the bearer
|
|
1527
|
-
middleware discards it, so an authed action 401s, wire-indistinguishable from
|
|
1528
|
-
`anonymous` (pinned by the `bearer_soft_fail` equivalence group). The
|
|
1529
|
-
`token` principal is the honored counterpart (suppresses `Origin`).
|
|
1530
|
-
`malformed_bearer` is the keeper's token minus its last character over a
|
|
1531
|
-
no-Origin, empty-jar transport — refused by the shape precheck before any
|
|
1532
|
-
database work, so it joins `bearer_soft_fail` too.
|
|
1533
|
-
`expired_session` is the keeper behind an expired server-side session
|
|
1534
|
-
(`fixture.mint_expired_session()`: a backdated `auth_session` row behind a
|
|
1535
|
-
still-valid signed cookie, so the DB-row expiry gate is what refuses it).
|
|
1536
|
-
`acting` (`ConformanceActingBinding`) has the runner fill `params.acting`
|
|
1537
|
-
with a real actor id: `principal` (the actor of the account the
|
|
1538
|
-
principal's credential names), `extra_actor` (`fixture.extra_actors[0]`),
|
|
1539
|
-
`keeper_actor` (`fixture.actor`, foreign to every non-keeper principal);
|
|
1540
|
-
params must then be an object or omitted, without an `acting` of their own,
|
|
1541
|
-
and a principal presenting no account throws.
|
|
1542
|
-
`error_reason` is the imported
|
|
1543
|
-
`ERROR_*` constant (asserted against the RPC `error.data.reason` or the
|
|
1544
|
-
REST flat-body `error`; the dispatcher's 401 carries
|
|
1545
|
-
`authentication_required`). `error_reason: null` pins a denial with no
|
|
1546
|
-
reason — a handler's bare `forbidden` — as carrying no `data.reason` (RPC
|
|
1547
|
-
only: a REST error body always names its code). On every RPC error row the
|
|
1548
|
-
runner also asserts the JSON-RPC `error.code`: `error_code` when the row
|
|
1549
|
-
names one, else the code the status maps to
|
|
1550
|
-
(`http_status_to_jsonrpc_error_code`) — several codes share a status, so a
|
|
1551
|
-
refusal under another one (`invalid_request` at 400) states it.
|
|
1552
|
-
`check_conformance_cases(cases)` (exported) runs when the table is
|
|
1553
|
-
described and throws on a row that can't mean anything: `error_reason: null`
|
|
1554
|
-
or `error_code` on a REST row, and a status outside 2xx beside a
|
|
1555
|
-
`set_cookie` that mints. `equivalence_group` is the
|
|
1556
|
-
**negative-space** axis: every case tagged with the same group string must
|
|
1557
|
-
produce a **byte-identical** normalized response (`{status, body}`),
|
|
1558
|
-
asserted per impl after the case loop. It promotes a masked pair
|
|
1559
|
-
(wrong-password ≡ account-not-found, found-but-unauthorized ≡ not-found)
|
|
1560
|
-
from "same status + reason" to "wire-indistinguishable", so a prober
|
|
1561
|
-
hitting either spine can't tell the members apart — the twin of the
|
|
1562
|
-
positive `output`-schema parity the runner already enforces. The
|
|
1563
|
-
per-case status/reason assertions stay the non-vacuous positive control
|
|
1564
|
-
(a both-paths-identically-broken group still fails the per-case checks).
|
|
1565
|
-
`headers` is the **header** negative-space axis: a string value pins a
|
|
1566
|
-
header present-and-equal (case-insensitive name), `null` pins it absent.
|
|
1567
|
-
Independent of it, the runner enforces an always-on **no-fingerprint**
|
|
1568
|
-
invariant on _every_ response (`conformance_table.ts` `FINGERPRINT_HEADERS`
|
|
1569
|
-
— `Server` / `X-Powered-By` / `WWW-Authenticate` must stay absent on both
|
|
1570
|
-
spines, so a framework upgrade adding one can't become a silent
|
|
1571
|
-
backend-fingerprinting oracle).
|
|
1572
|
-
`set_cookie` is the **session cookie** axis, a `SessionCookieEffect`
|
|
1573
|
-
(`session_cookie_effect.ts`): `'none'`, `'clear'` (exactly the clearing
|
|
1574
|
-
line), `'set'` (exactly one minting line), `'clear_then_set'` (a login
|
|
1575
|
-
carrying a stale cookie). **Omitted means `'none'`**, so every row asserts
|
|
1576
|
-
it mints and clears nothing unless it says otherwise. The lines are compared
|
|
1577
|
-
byte for byte with the spine's own formatters
|
|
1578
|
-
(`classify_session_cookie_effect`; lines in no recognised shape fail the
|
|
1579
|
-
row) — so a drift in the TS formatter itself is caught by the Rust legs,
|
|
1580
|
-
`cookie_attributes` and the credential wire suite, which spell the lines
|
|
1581
|
-
themselves. Behind it sits a floor: a response that is not 2xx never mints
|
|
1582
|
-
a session cookie (`assert_session_cookie`, HTTP legs) — a backstop, since a
|
|
1583
|
-
row can't be written expecting a mint on a refusal. Headers are deliberately kept out of the
|
|
1584
|
-
`equivalence_group` `{status, body}` comparison (`Set-Cookie` / `Date` vary).
|
|
1585
|
-
- `conformance_table.ts` — `describe_conformance_table_tests({cases,
|
|
1586
|
-
setup_test, surface_source, capabilities, rpc_endpoints, live_rpc_endpoints?,
|
|
1587
|
-
session_options, principals?, ws?, suite_name?})`. A case's RPC method
|
|
1588
|
-
resolves from `rpc_endpoints` first, then from `live_rpc_endpoints` — the
|
|
1589
|
-
endpoints the backend live-mounts, for methods kept off the declared surface
|
|
1590
|
-
(cell verbs, opt-in resolvers, `_testing_*` backdoors); a backend's whole
|
|
1591
|
-
live mount is a fine value, since a declared method still resolves from the
|
|
1592
|
-
declared surface. `resolve_conformance_rpc_endpoints({rpc_endpoints,
|
|
1593
|
-
live_rpc_endpoints?, session_options})` (exported) builds that lookup list,
|
|
1594
|
-
for the table and the differential alike. fuz_app's spine value is
|
|
1595
|
-
`create_spine_live_rpc_endpoints()` (`full_spine_mount.ts`), the binary's
|
|
1596
|
-
whole mount built on stub deps for resolution only. Same `{setup_test, surface_source,
|
|
1597
|
-
capabilities}` protocol every Tier 1 suite uses, so **one case array runs
|
|
1598
|
-
both transports** — in-process (`gro test`) and cross-process (the gate,
|
|
1599
|
-
each backend's real auth resolution). `resolve_conformance_principal` (exported) maps the
|
|
1600
|
-
always-available principals to fixture accessors; `role_holder` /
|
|
1601
|
-
`wrong_role` read a seeded `extra_accounts` username named via
|
|
1602
|
-
`options.principals`. `send_conformance_case(c, {fixture, surface_source, principals?,
|
|
1603
|
-
resolved_rpc_endpoints, request_headers?})` (exported) is the send half — principal resolved,
|
|
1604
|
-
request sent, the raw `{target, status, headers, set_cookies, body}` back
|
|
1605
|
-
unasserted (`set_cookies` every `Set-Cookie` line in order — a headers
|
|
1606
|
-
record folds them; `[]` on the WS leg); the
|
|
1607
|
-
table asserts on it, and the cross-backend differential compares two.
|
|
1608
|
-
`request_headers` go on the HTTP request beneath the principal's (the
|
|
1609
|
-
differential's identity encoding); the WS leg sends none.
|
|
1610
|
-
**WS leg:** `ws: WsEndpointTarget` (`{base_url, ws_path, origin?}`) on
|
|
1611
|
-
either sends each case as one frame on an admitted socket the principal
|
|
1612
|
-
opens — its headers on the upgrade, no `Origin` where the HTTP leg
|
|
1613
|
-
suppresses it, its own actor as `?acting=`. Both spines resolve an actor at
|
|
1614
|
-
the upgrade, refusing a multi-actor account's upgrade without `?acting=`
|
|
1615
|
-
(400 `actor_required`), and per-frame dispatch resolves each frame's
|
|
1616
|
-
`acting` on both. The leg always sends `?acting=`, so it does not cover that
|
|
1617
|
-
upgrade refusal; the front-door table's multi-actor row does. The frame is the envelope the HTTP
|
|
1618
|
-
body is (`serialize_action_result` on TS), so the response reads
|
|
1619
|
-
`{status, headers: {}, body: frame}` with `status` the code's
|
|
1620
|
-
`jsonrpc_error_code_to_http_status` (200 for a result) and every row holds
|
|
1621
|
-
unchanged. What WS loses is headers — the TS DEV-only `X-Fuz-Auth-Debug`
|
|
1622
|
-
among them. `is_ws_conformance_case(c)` (exported) is the filter: RPC, sent
|
|
1623
|
-
`POST`, no header value pinned, a session cookie effect of `'none'`, a
|
|
1624
|
-
principal that can hold a socket — not
|
|
1625
|
-
`anonymous` / `bearer_browser` / `malformed_bearer` / `expired_session` or
|
|
1626
|
-
a dead credential, refused at the upgrade, nor `scoped_token`, refused `surface:ws_upgrade`
|
|
1627
|
-
there (a narrowed bearer can never send a frame, so no per-frame scope row
|
|
1628
|
-
exists; the front-door table pins the upgrade refusal). An equivalence
|
|
1629
|
-
group left with one member on the WS leg is dropped. Cross-process only.
|
|
1248
|
+
- `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?, 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.
|
|
1630
1250
|
- `conformance_rpc_auth.ts` — `generate_rpc_auth_conformance_cases({surface_source,
|
|
1631
1251
|
live_rpc_endpoints?, skip_methods?})` → `ConformanceCase[]` from each declared RPC method's
|
|
1632
1252
|
`RouteAuth`, then each live-mounted one the declared surface lacks
|
|
@@ -1657,6 +1277,25 @@ capabilities}` protocol every Tier 1 suite uses, so **one case array runs
|
|
|
1657
1277
|
live gates, and the Rust spine dispatches its own. Input-dependent handler
|
|
1658
1278
|
checks stay hand-written rows. fuz_app spreads it into both conformance
|
|
1659
1279
|
legs.
|
|
1280
|
+
- `declared_skips.ts` — gated skips and the check over them.
|
|
1281
|
+
`test_skip_gated(name, fn)` registers a skipped test tagged
|
|
1282
|
+
`TaskMeta.fuz_gated_skip` (`is_gated_skip` reads it) — what `test_if`,
|
|
1283
|
+
`describe_spine_cross_suites`' skipped-suite lines and `capability_mounts`'
|
|
1284
|
+
rows with no WebSocket endpoint to probe (`gated_skip`) register; every skip a
|
|
1285
|
+
backend's declarations cause goes through it, and only the informational
|
|
1286
|
+
`UNPROBED_CAPABILITIES` rows stay plain skips. The tag is set at
|
|
1287
|
+
registration, so a `-t` filter or `.only` never changes it.
|
|
1288
|
+
`check_declared_skips(expected)` registers a closing test (named
|
|
1289
|
+
`DECLARED_SKIPS_CHECK_NAME`) that reads every test under its suite — the
|
|
1290
|
+
enclosing `describe`, or the file — and holds the tagged ones to
|
|
1291
|
+
`expected`, name path below that suite → required reason
|
|
1292
|
+
(`find_declared_skip_problems`, the pure half): an undeclared skip fails, so
|
|
1293
|
+
does an entry whose test was registered to run (stale) or that names no
|
|
1294
|
+
test. A nested suite with a check of its own owns its subtree: an outer
|
|
1295
|
+
check neither collects nor needs declared what sits below it. fuz_app calls it in every single-backend cross file with a gated case,
|
|
1296
|
+
and per backend in the security and timing projects; the transcript
|
|
1297
|
+
differential holds both sides to its `expected_skips` the same way and
|
|
1298
|
+
leaves the declared skips out of its whole-run count.
|
|
1660
1299
|
- `xfail.ts` — `xfail_until(marker, name, fn)` for deferred-by-design rows,
|
|
1661
1300
|
`marker` an `XfailMarker` `{tracking_id, reason, fails_with}`. `fails_with`
|
|
1662
1301
|
is required — a `RegExp` over the thrown message or a predicate over the
|
|
@@ -1702,6 +1341,7 @@ without.
|
|
|
1702
1341
|
| `app_settings` | an anonymous signup reads `open_signup` fresh after `app_settings_update` | — |
|
|
1703
1342
|
| `body_size` | the 1 MiB body cap: cap+1 → 413 `payload_too_large`, exactly the cap not size-rejected, an over-cap chunked body → 413, no upload racing the close | — |
|
|
1704
1343
|
| `body_size_smuggling` | raw socket: an oversized `POST` + a pipelined `GET` → at most one response; `Content-Length` beside `Transfer-Encoding` → close (Bun 1.4.3 is the tested floor) | — |
|
|
1344
|
+
| `capability_mounts` | each mount flag a request observes (`ws`, `sse`, `cell_crud`, `cell_relations`, `fact_serving`, `fact_serving_admin_hash`, `ready`, `account_status`, `ws_account_actions`, `ws_role_gated`) probed once and held to its declaration both ways — `true` answers as mounted, `false` as unmounted; each flag's probe again as an unmounted control (its surface moved under `CAPABILITY_MOUNTS_ABSENT`) read as unmounted on every backend; every other flag a skipped test naming why (`UNPROBED_CAPABILITIES`); can't be excluded or overridden; probes the paths the gated suites send to; cross-process only | every probed flag (the declaration) |
|
|
1705
1345
|
| `cell_crud` | the CRUD lifecycle + authz matrix, each response parsed against its output schema, `cell_list` paging past hidden rows, mistyped `data` | `cell_crud` (clone cases also `cell_relations`) |
|
|
1706
1346
|
| `cell_gated_create` | the parent-aware `CellCreateAuthorize`: admin-only `space` root, contributions gated by the root's `policy[kind]`, 404 on a hidden parent vs 403 on a visible one, `cell_policy_set` | `cell_gated_create` |
|
|
1707
1347
|
| `cell_grant_role` | role-shaped `cell_grant`: holder admitted, non-holder excluded, unregistered role refused, the `cell_list shared_with:'me'` role arm | `cell_relations` |
|
|
@@ -1710,11 +1350,9 @@ without.
|
|
|
1710
1350
|
| `cell_ref_admission` | possession-gated fact refs: one refusal for stored and unstored hashes, holders by upload, clones per row, the admin bypass, the ref grammar | `fact_serving` (grant, item, clone cases also `cell_relations`) |
|
|
1711
1351
|
| `cell_relations` | grant / field / item / clone / audit verbs, the relation-read visibility filter (a child the reader can't view is absent, never an edge), a clone dropping children its cloner can't view | `cell_relations` |
|
|
1712
1352
|
| `cookie_attributes` | the session `Set-Cookie`: `HttpOnly; Secure; SameSite=Strict; Path=/` + `Max-Age` on login, none on a failed login, `Max-Age=0` with the same flags on logout | — |
|
|
1713
|
-
| `credential_deadline` | a socket on a session or an API token closes with `WS_CLOSE_SESSION_REVOKED` "Credential expired" at its credential's expiry; an audit stream on a session ends there | `ws`, `sse`; `_testing_shorten_credential_expiry` |
|
|
1714
1353
|
| `credential_conformance` | every row of `credential_conformance.json` through `_testing_credential_read`: how the backend reads the session cookie, the bearer and the daemon token out of a request's header lines, and the lines it refuses as no header lines | `_testing_credential_read` |
|
|
1715
1354
|
| `credential_conformance_wire` | raw socket: each row's header lines sent as an RPC `POST` and as a WebSocket upgrade — which credential authenticated (the account `account_verify` answers) and the exact clearing `Set-Cookie`, or none; the clear's scope, its order ahead of a login's new cookie, and a minted cookie authenticating as sent | `ws` (the upgrade leg; with `ws_account_actions` an accepted upgrade also answers `account_verify` on the socket, naming the credential) |
|
|
1716
|
-
| `
|
|
1717
|
-
| `request_target_conformance_wire` | raw socket: each `wire` row of `request_target_conformance.json` sent as written — an escape that doesn't decode refused in each surface's shape (the RPC `GET`'s `invalid_request` envelope, 400 `invalid_query_params` on a REST query and the WS upgrade, 400 `invalid_route_params` on a path param, always JSON), the decodable controls echoed exactly, a route that reads no query refusing nothing in it; and the routing rows — a method a routed path doesn't serve → 405 with `Allow` (compared as a set, absent on a gate's refusal) and `method_not_allowed`, an unmatched path → `route_not_found` under `/api/` and the plain-text 404 elsewhere, an encoded or doubled-slash spelling of a routed path unrouted, dot segments per `runtime_resolves_dot_segments`. A row's `requires` is a list of capabilities and each requirement set is its own test, skipped when the backend doesn't declare it | `ws`, `sse`, `account_status`, `fact_serving`, `fact_serving_admin_hash`, `spine_fallback` (per row), `ws_refusal_body`, `runtime_resolves_dot_segments` |
|
|
1355
|
+
| `credential_deadline` | a socket on a session or an API token closes with `WS_CLOSE_SESSION_REVOKED` "Credential expired" at its credential's expiry; an audit stream on a session ends there | `ws`, `sse`; `_testing_shorten_credential_expiry` |
|
|
1718
1356
|
| `credential_header_robustness` | raw socket: an oversized or control-character credential header never escalates, smuggles a request, desyncs, or wedges the server (a duplicated one is `credential_conformance_wire`'s) | — |
|
|
1719
1357
|
| `fact_serving` | `GET /api/cells/:cell_id/facts/:hash` per reference, the hardening headers, bodyless masked 404s; the admin-only `GET /api/facts/:hash` | `fact_serving` (bare-hash cases also `fact_serving_admin_hash`) |
|
|
1720
1358
|
| `identity_parity` | `Username` / `UsernameProvided` / `Email` end to end: login canonicalization, username-or-email login, login input validation, ASCII-only creation, the `USERNAME_LENGTH_MIN`..`USERNAME_LENGTH_MAX` edges, email format — each by error reason | — |
|
|
@@ -1724,8 +1362,10 @@ without.
|
|
|
1724
1362
|
| `peer_ping_ws` | the server→client `peer/ping` round trip and its negatives (unsolicited response, id isolation, timeout, wrong shape, client error, no transport over HTTP) | `peer_request` |
|
|
1725
1363
|
| `query_shape` | duplicate-key, unknown-key, and phase-order query semantics on the status route, the RPC `GET`, and the bare-hash fact route | `account_status`, `fact_serving_admin_hash` (per case) |
|
|
1726
1364
|
| `ready` | anonymous `GET /ready` → `200 {ready: true}` over the committed `expected_schema.json` | `ready` |
|
|
1365
|
+
| `request_header_conformance_wire` | raw socket: each row of `request_header_conformance.json` sent as an RPC `POST` and as a WebSocket upgrade — an empty, repeated or off-grammar `Origin`, `Host` or `Content-Type` refused with its code, any `Origin` or `Referer` line discarding a bearer or daemon token, the gates' order; the accounts and raw sends shared with the credential wire suite (`credential_wire.ts`). Assumes the backend's own origin allowed (`overrides` names another) | `ws` (the upgrade leg), `ws_refusal_body`, `ws_upgrade_runtime_refusals` (per row), `host_gate` (the rows the host gate refuses) |
|
|
1366
|
+
| `request_target_conformance_wire` | raw socket: each `wire` row of `request_target_conformance.json` sent as written — an escape that doesn't decode refused in each surface's shape (the RPC `GET`'s `invalid_request` envelope, 400 `invalid_query_params` on a REST query and the WS upgrade, 400 `invalid_route_params` on a path param, always JSON), the decodable controls echoed exactly, a route that reads no query refusing nothing in it; and the routing rows — a method a routed path doesn't serve → 405 with `Allow` (compared as a set, absent on a gate's refusal) and `method_not_allowed`, an unmatched path → `route_not_found` under `/api/` and the plain-text 404 elsewhere, an encoded or doubled-slash spelling of a routed path unrouted, dot segments per `runtime_resolves_dot_segments`. A row's `requires` is a list of capabilities and each requirement set is its own test, skipped when the backend doesn't declare it | `ws`, `sse`, `account_status`, `fact_serving`, `fact_serving_admin_hash`, `spine_fallback` (per row), `ws_refusal_body`, `runtime_resolves_dot_segments` |
|
|
1727
1367
|
| `role_grant_offer_enumeration` | `role_grant_offer_accept`'s deliberate split: a nonexistent offer → 404 `role_grant_offer_not_found`, a sibling actor's on the caller's own account → 403 `role_grant_offer_actor_mismatch` | — |
|
|
1728
|
-
| `role_grant_offer_lifecycle` | a decline or retract by a non-party → 404 identical to a missing offer; of a decided offer → 400 `role_grant_offer_terminal`; an accept after a decline or a retract the same, granting nothing, and a replayed accept answering the first grant; one audit row per success, none per refusal; lost grantor authority supersedes pending offers; a recipient's delete supersedes every pending offer to it, and an offer to a deleted account or actor answers as one to a missing one | — |
|
|
1368
|
+
| `role_grant_offer_lifecycle` | a decline or retract by a non-party → 404 identical to a missing offer; of a decided offer → 400 `role_grant_offer_terminal`; a re-offer while pending answering the same offer, its `to_actor_id` narrowed or widened to the request's, and a new offer once decided; an accept after a decline or a retract the same, granting nothing, and a replayed accept answering the first grant; one audit row per success, none per refusal; lost grantor authority supersedes pending offers; a recipient's delete supersedes every pending offer to it, and an offer to a deleted account or actor answers as one to a missing one | — |
|
|
1729
1369
|
| `role_grant_offer_notification_ws` | each offer and role-grant notification strict-parsed against its params schema — a revoke's supersedes reaching every party's socket, and (with `account_lifecycle`) a delete's and a purge's reaching the live parties while the removed account's socket closes having heard nothing — the target socket hearing exactly the expected notifications once each, in order, and a bystander socket that must receive nothing, both behind a `heartbeat` barrier | `ws` |
|
|
1730
1370
|
| `role_grant_participation` | the success paths of app-role conferral: assign + idempotency, a scoped assign, offer → accept, offer replay | — |
|
|
1731
1371
|
| `role_grant_role_grammar` | an off-grammar `role` or scope kind on the grant verbs → `invalid_params` with no reason and no audit row | — |
|
|
@@ -1734,7 +1374,7 @@ without.
|
|
|
1734
1374
|
| `session_cap` | a login past the per-account session cap evicts the oldest session and only it, closing its socket with the revoked reason while a kept session's socket stays open; the session list marks the caller's own | — (the socket case runs when given a `ws` target) |
|
|
1735
1375
|
| `session_cookie_codec` | exactly one accepted spelling of a signed cookie: non-canonical signature or `expires_at` spellings refused | — |
|
|
1736
1376
|
| `simple_request` | an untyped, CORS-safelisted, or non-JSON `POST` to a JSON route → 415 `unsupported_content_type` | — |
|
|
1737
|
-
| `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, the per-session stream cap | `sse` (delete and purge also `account_lifecycle`) |
|
|
1377
|
+
| `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`) |
|
|
1738
1378
|
| `standard` | the `describe_standard_cross_process_tests` bundle: integration, admin, round trip, RPC round trip, data exposure | `account_status` (the status wire-shape case) |
|
|
1739
1379
|
| `testing_backdoor` | the backdoor declaration, and every declared `_testing_*` action refusing anonymous, session, and bearer callers | `testing_backdoors` (the declaration) |
|
|
1740
1380
|
| `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 | — |
|
|
@@ -1760,8 +1400,8 @@ What the suites share:
|
|
|
1760
1400
|
`RpcResult` carries the HTTP `status` beside the envelope; a reply that is no
|
|
1761
1401
|
JSON object throws naming the method, the status and the body's head.
|
|
1762
1402
|
- **`cross_backend/audit_cross_helpers.ts`** — `list_audit_events(fixture,
|
|
1763
|
-
params, rpc_path?)` drains first (`cross_drain_effects`, which refuses
|
|
1764
|
-
answer
|
|
1403
|
+
params, rpc_path?)` drains first (`cross_drain_effects`, which refuses any
|
|
1404
|
+
answer but exactly `{ok: true}`), then lists and parses every row's metadata
|
|
1765
1405
|
(`assert_audit_event_metadata`), so no reader skips the barrier.
|
|
1766
1406
|
`assert_audit_metadata_fields(fixture, metadata, expected, absent?)` compares
|
|
1767
1407
|
field by field, so a consumer's added key passes unless the fixture closed
|
|
@@ -1950,7 +1590,7 @@ Conventions that hold across them:
|
|
|
1950
1590
|
types for the **`on_request`** seam: a responder answers a server-initiated
|
|
1951
1591
|
request (`{result}` / `{error}` / `undefined` to swallow), the path
|
|
1952
1592
|
`describe_peer_ping_ws_tests` drives. With no `on_request` the seam is inert
|
|
1953
|
-
(a server-initiated request flows to `messages`
|
|
1593
|
+
(a server-initiated request flows to `messages`).
|
|
1954
1594
|
- `testing/transports/ws_transport.ts` — `create_ws_transport({base_url, ws_path, cookies, origin?, on_request?, headers?})` (`origin: null` sends no `Origin`, which a daemon-token upgrade needs; a refused upgrade rejects with `WsUpgradeRefusedError`, carrying the refusal's `status` and `body`), returning a `WsTransportClient` — a `WsClient` plus `send_text(text)`, which writes one frame verbatim (a frame that is not JSON).
|
|
1955
1595
|
It builds a real-upgrade WS client using the `ws` npm package (optional
|
|
1956
1596
|
peerDep; consumers wiring cross-process tests `npm install --save-dev ws`).
|
|
@@ -2039,192 +1679,41 @@ Conventions that hold across them:
|
|
|
2039
1679
|
`*_attack_surface.json` snapshot is an observability artifact for human
|
|
2040
1680
|
inspection + gen-time drift detection
|
|
2041
1681
|
(`assert_surface_matches_snapshot`); it is not consumed at test runtime.
|
|
2042
|
-
- `testing/cross_backend/testing_reset_actions.ts` —
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
`_testing_reset`
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
its cell / fact / file tables) reset on the same connection rather than a
|
|
2063
|
-
separately-pooled one that would deadlock against this open transaction
|
|
2064
|
-
under the in-memory drivers. Auth
|
|
2065
|
-
gates on `credential_types: ['daemon_token']` — effectively keeper-only
|
|
2066
|
-
without forcing the `actor: 'required'` ⟺ `acting?: ActingActor`
|
|
2067
|
-
biconditional. No free-form runtime grant action exists — see the
|
|
2068
|
-
`testing_reset_actions.ts` TSDoc for the audit + WS fan-out rationale
|
|
2069
|
-
that rejected a `_testing_seed_role_grant` shape.
|
|
2070
|
-
|
|
2071
|
-
Same module also exports `create_testing_drain_effects_action(audit)` — the
|
|
2072
|
-
`_testing_drain_effects` RPC action (daemon-token-gated, like
|
|
2073
|
-
`_testing_reset`). It awaits `audit.drain_inflight()` so a following
|
|
2074
|
-
`audit_log_list` is authoritative — the deterministic barrier a
|
|
2075
|
-
cross-process audit assertion fires before reading (no poll/sleep). The
|
|
2076
|
-
emitter must be built with `create_audit_emitter({track_inflight: true})`
|
|
2077
|
-
(the spine binary's `audit_factory` does — pinned by
|
|
2078
|
-
`cross_backend/testing_spine_server.audit.test.ts`), or the drain resolves at once.
|
|
2079
|
-
The action answers `{ok: true, tracked}`, `tracked` read from
|
|
2080
|
-
`audit.is_tracking_inflight()`, and `cross_drain_effects` refuses anything but
|
|
2081
|
-
`tracked: true` — so a binary built over an untracked emitter fails its first
|
|
2082
|
-
audit read rather than racing it. The Rust twin answers the same shape.
|
|
2083
|
-
The barrier is needed whatever the transport: HTTP on a binary running
|
|
2084
|
-
`await_pending_effects: true` settles a mutation's writes before
|
|
2085
|
-
responding, but WS replies before its effects flush, so a WS mutation's
|
|
2086
|
-
audit write can still be in flight when its reply arrives. The drain waits
|
|
2087
|
-
until no tracked `emit` write is outstanding — writes started while it
|
|
2088
|
-
waits included — the same wait-for-zero as the Rust spine's
|
|
2089
|
-
`AuditEmitter::drain_inflight` over `new_with_inflight_tracking`.
|
|
2090
|
-
`create_testing_actions` bundles it over `deps.audit`; suites that mount
|
|
2091
|
-
their own endpoint (e.g. the in-process
|
|
2092
|
-
`account_lifecycle_parity.db.test.ts`) add it directly, over a tracked
|
|
2093
|
-
emitter, so the shared suite body can call the barrier on every backend
|
|
2094
|
-
uniformly.
|
|
2095
|
-
|
|
2096
|
-
Also bundled: `_testing_flood_notifications`
|
|
2097
|
-
(`create_testing_flood_notifications_action()`) — queues `count`
|
|
2098
|
-
notifications of `size` payload bytes each (method `_testing_flood`, params
|
|
2099
|
-
`{index, payload}`) onto the caller's own WebSocket connection in one
|
|
2100
|
-
synchronous run and answers `{queued: count}`, so a suite can push a
|
|
2101
|
-
connection's outbound queue past its byte budget from outside. Refused with
|
|
2102
|
-
`invalid_params` past `TESTING_FLOOD_MAX_COUNT`, `TESTING_FLOOD_MAX_SIZE`, or
|
|
2103
|
-
`TESTING_FLOOD_MAX_TOTAL_BYTES` (`count` × `size`), and over HTTP (reason
|
|
2104
|
-
`no_connection` — there is no connection to queue onto). The Rust mirror is
|
|
2105
|
-
`fuz_testing::create_testing_flood_notifications_action_spec`.
|
|
2106
|
-
|
|
2107
|
-
Also bundled: `_testing_mint_session` — mints a backdated-expiry
|
|
2108
|
-
`auth_session` row for an account (via `mint_test_session` in `app_server.ts`)
|
|
2109
|
-
and returns its signed cookie value (future-dated payload). Backs the
|
|
2110
|
-
`expired_session` conformance principal: the backdated DB row + valid cookie
|
|
2111
|
-
payload isolate the authoritative server-side DB-row expiry gate
|
|
2112
|
-
(`query_session_get_valid` — `expires_at > NOW()`), the gate the in-process
|
|
2113
|
-
payload-expiry tests never reached. Daemon-token-gated like its siblings; the
|
|
2114
|
-
Rust mirror is `fuz_testing::create_testing_mint_session_action_spec`.
|
|
2115
|
-
|
|
2116
|
-
In the hono-free sibling `testing/cross_backend/testing_origin_check.ts`,
|
|
2117
|
-
**not** bundled: `_testing_origin_check`
|
|
2118
|
-
(`create_testing_origin_check_action()`, `run_testing_origin_check(input)`,
|
|
2119
|
-
`TestingOriginCheckInput` / `TestingOriginCheckOutput`) — answers the origin
|
|
2120
|
-
allowlist's parse and request check for one `{patterns, origin}` pair:
|
|
2121
|
-
`{ok: true, allowed}` or `{ok: false, errors: [{index?, kind}]}`. Pure, no
|
|
2122
|
-
database. Kept out of the bundle so a consumer whose Rust binary doesn't
|
|
2123
|
-
mount the mirror (`fuz_testing::create_testing_origin_check_action_spec`)
|
|
2124
|
-
keeps an exact action-manifest gate; the spine binary appends it in
|
|
2125
|
-
`build_full_spine_rpc_actions`.
|
|
2126
|
-
|
|
2127
|
-
In the hono-free sibling `testing/cross_backend/testing_credential_read.ts`,
|
|
2128
|
-
also **not** bundled: `_testing_credential_read`
|
|
2129
|
-
(`create_testing_credential_read_action(deps)`,
|
|
2130
|
-
`run_testing_credential_read(input, deps)`, `TestingCredentialReadInput` /
|
|
2131
|
-
`TestingCredentialReadOutput`) — reads a list of raw header lines as the
|
|
2132
|
-
credential legs would: `{session_cookie: 'absent' | 'invalid' | 'valid',
|
|
2133
|
-
bearer_token, daemon_token}`, the tokens as read or `null`. Pure: it runs
|
|
2134
|
-
the readers of `auth/credential_headers.ts` and the cookie verify, no
|
|
2135
|
-
database, and never the request's own headers. `lines` is capped
|
|
2136
|
-
(`TESTING_CREDENTIAL_READ_LINES_MAX` lines of at most
|
|
2137
|
-
`TESTING_CREDENTIAL_READ_LINE_LENGTH_MAX` characters, the same bounds on
|
|
2138
|
-
the Rust mirror), and every refusal of it — over a cap, or a line that is no
|
|
2139
|
-
header line: a control byte, DEL, a character above U+00FF, no `:` — is
|
|
2140
|
-
`invalid_params` with `ERROR_TESTING_CREDENTIAL_READ_LINE`. Appended in
|
|
2141
|
-
`build_full_spine_rpc_actions`; the Rust mirror is
|
|
2142
|
-
`fuz_testing::create_testing_credential_read_action_spec`.
|
|
2143
|
-
|
|
2144
|
-
Back in `testing_reset_actions.ts`, also **not** bundled:
|
|
2145
|
-
`_testing_shorten_credential_expiry`
|
|
2146
|
-
(`create_testing_shorten_credential_expiry_action()`) — pulls an account's
|
|
2147
|
-
`auth_session` and `api_token` expiries in to `seconds` (1–60) from now,
|
|
2148
|
-
shorten-only (`LEAST`, an eternal token gaining one), answering
|
|
2149
|
-
`{sessions, api_tokens}` counts. Applied before a connection opens, since
|
|
2150
|
-
the deadline is read when the credential resolves. Backs
|
|
2151
|
-
`describe_credential_deadline_cross_tests`; appended in
|
|
2152
|
-
`build_full_spine_rpc_actions` for the same manifest reason as
|
|
2153
|
-
`_testing_origin_check`. The Rust mirror is
|
|
2154
|
-
`fuz_testing::create_testing_shorten_credential_expiry_action_spec`.
|
|
2155
|
-
|
|
2156
|
-
Also not bundled: `_testing_room_evict`
|
|
2157
|
-
(`create_testing_room_evict_action(registry)`, input
|
|
2158
|
-
`{target: TestingRoomEvictTarget, reason}`) — calls the room registry's
|
|
2159
|
-
`evict` and answers its `{seats, watches, pending}` count, so the rooms suite
|
|
2160
|
-
pins eviction without a consumer's domain. It needs the registry the room
|
|
2161
|
-
verbs run on, so the full-mount layer appends it beside them. The Rust mirror
|
|
2162
|
-
is `fuz_testing::create_testing_room_evict_action_spec`.
|
|
2163
|
-
|
|
2164
|
-
Also in `testing_reset_actions.ts` — but **not** bundled by
|
|
2165
|
-
`create_testing_actions` — `_testing_action_manifest` (+ `create_testing_action_manifest_action(mounted, ws_only?)`, `ws_only` the WebSocket-only actions it lists as `transport: 'ws'`):
|
|
2166
|
-
dumps the live RPC registry as a normalized `ActionManifest` for the
|
|
2167
|
-
cross-impl manifest-parity gate (see §Cross-impl RPC-manifest parity). It must
|
|
2168
|
-
enumerate _every_ mounted method, which `create_testing_actions` (one
|
|
2169
|
-
sub-factory) can't see, so it's appended at the full-mount layer
|
|
2170
|
-
(`full_spine_mount.ts` `build_full_spine_rpc_actions`), closing over the
|
|
2171
|
-
complete action list plus its own spec. Daemon-token-gated like its siblings;
|
|
2172
|
-
the Rust mirror is `fuz_testing::create_testing_action_manifest_action_spec`.
|
|
1682
|
+
- `testing/cross_backend/testing_reset_actions.ts` (+ the hono-free `testing_origin_check.ts`, `testing_credential_read.ts`) — the `_testing_*` backdoors, each daemon-token-gated (`credential_types: ['daemon_token']`) and mirrored by a `fuz_testing` spec on the Rust spine. `create_testing_actions(deps, options)` bundles what every test binary mounts; the rest are appended at the full-mount layer (`build_full_spine_rpc_actions`), so a consumer whose Rust binary lacks a mirror keeps an exact action-manifest gate:
|
|
1683
|
+
|
|
1684
|
+
| action | bundled | does |
|
|
1685
|
+
| --- | --- | --- |
|
|
1686
|
+
| `_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 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
|
+
| `_testing_db_invariants` | yes | every row breaking a `DB_INVARIANTS` check, read after each test |
|
|
1689
|
+
| `_testing_mint_session` | yes | a backdated session row behind a valid cookie (the `expired_session` principal) |
|
|
1690
|
+
| `_testing_put_fact` | yes | seeds a fact, with an optional holder or external URL |
|
|
1691
|
+
| `_testing_flood_notifications` | yes | queues notifications onto the caller's socket past its outbound budget (`invalid_params` past its caps, `no_connection` over HTTP) |
|
|
1692
|
+
| `_testing_schema_snapshot`, `_testing_migration_tracker` | yes | the parity gates' reads |
|
|
1693
|
+
| `_testing_origin_check`, `_testing_credential_read` | no | the origin matcher and the credential header readers, pure |
|
|
1694
|
+
| `_testing_shorten_credential_expiry` | no | pulls an account's session and token expiries in (shorten-only) |
|
|
1695
|
+
| `_testing_room_evict` | no | the room registry's `evict` |
|
|
1696
|
+
| `_testing_action_manifest` | no | the live registry as an `ActionManifest` |
|
|
1697
|
+
|
|
1698
|
+
No free-form grant backdoor exists (the module doc says why). The keeper's
|
|
1699
|
+
cached id (`DaemonTokenState.keeper_account_id`) moves to a reset's new keeper
|
|
1700
|
+
only after its commit, so a rolled-back reset leaves the next one able to
|
|
1701
|
+
authenticate.
|
|
2173
1702
|
|
|
2174
1703
|
### Testing-backdoor declaration + credential gate — `cross_backend/testing_backdoor.ts`
|
|
2175
1704
|
|
|
2176
1705
|
`describe_testing_backdoor_cross_tests({setup_test, capabilities, rpc_path?,
|
|
2177
|
-
ws?, extra_methods?})`
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
one gets the rows below, whose anonymous row fails as "declared but not
|
|
2189
|
-
mounted" on a `method_not_found`. So the declaration can't lie in either
|
|
2190
|
-
direction, and the suites gated on it skip only what the backend lacks. A
|
|
2191
|
-
declared name outside the known list, or a duplicate, throws at collection.
|
|
2192
|
-
The suite runs on every backend, one declaring only the required backdoors
|
|
2193
|
-
included — `describe_spine_cross_suites` refuses to exclude it, skip any of
|
|
2194
|
-
its cases, or hand it other `capabilities` through `overrides`.
|
|
2195
|
-
|
|
2196
|
-
**Credential gate.** For each declared backdoor (the privileged writes, the
|
|
2197
|
-
audit barrier, the connection flood, and the introspection reads), and each
|
|
2198
|
-
`extra_methods` entry (`TestingBackdoorProbe` `{method, params?}` — a
|
|
2199
|
-
consumer's own daemon-token seam, which must start with `_testing_` and not be
|
|
2200
|
-
a known backdoor), it fires three principals over real HTTP: **anonymous** →
|
|
2201
|
-
401 `unauthenticated`, **session** → 403 `forbidden` `credential_type_required`,
|
|
2202
|
-
**bearer** → 403 `forbidden` `credential_type_required` — and, when `ws`
|
|
2203
|
-
(`{base_url, ws_path, origin?}`) is passed, sends each on a socket opened with
|
|
2204
|
-
the keeper's session cookie, which answers the same `forbidden`
|
|
2205
|
-
`credential_type_required` (a socket is no way around the daemon-token channel) —
|
|
2206
|
-
proving the daemon-token gate that fences each backdoor action holds end-to-end
|
|
2207
|
-
on the real dispatcher (the spec-derived `describe_rpc_attack_surface_tests`
|
|
2208
|
-
never enumerates them because they're off the declared surface). Each method is
|
|
2209
|
-
sent with **valid** params so each case varies only the credential (validation
|
|
2210
|
-
runs after the gates — order is 401 → authz → 403 → 429 → 400); the handler never
|
|
2211
|
-
runs. The known backdoors' params are a `Record<TestingBackdoorMethod, …>`, so a
|
|
2212
|
-
backdoor added to the list fails typecheck until it has them. Cited property:
|
|
2213
|
-
`docs/security.md` §Test Backdoor Actions. The credential rows run
|
|
2214
|
-
cross-process only (the `_testing_*` actions are mounted on the spawned binary,
|
|
2215
|
-
not the in-process app — like the ws/sse suites); in-process, an app mounting
|
|
2216
|
-
none declares none and gets the declaration rows alone, one per known backdoor
|
|
2217
|
-
— fuz_app's in-process leg is `cross_backend/testing_backdoor_parity.db.test.ts`,
|
|
2218
|
-
while its cross legs declare every backdoor, so they run no declaration row.
|
|
2219
|
-
The complement is the
|
|
2220
|
-
in-process spec-level gate test (`src/test/testing/testing_actions_auth.test.ts`,
|
|
2221
|
-
asserting each spec declares `credential_types: ['daemon_token']`) + the
|
|
2222
|
-
`assert_no_testing_methods` surface invariant. fuz_app's conformance table
|
|
2223
|
-
also covers the same gates, through the auth rows it generates over the live
|
|
2224
|
-
mount (`live_rpc_endpoints`), which the differential compares across spines;
|
|
2225
|
-
this suite stays for consumers whose backends mount the `_testing_*` actions
|
|
2226
|
-
without a conformance table over their live mount, and for the declaration
|
|
2227
|
-
check.
|
|
1706
|
+
ws?, extra_methods?})` holds `capabilities.testing_backdoors` to the backend
|
|
1707
|
+
both ways — a known backdoor (`TESTING_BACKDOOR_METHODS`) left out must
|
|
1708
|
+
answer `method_not_found` anonymously, a declared one must be mounted — then
|
|
1709
|
+
sends every declared backdoor and `extra_methods` probe (each starting
|
|
1710
|
+
`_testing_`, never a known backdoor) as anonymous (401), session and bearer
|
|
1711
|
+
(403 `credential_type_required`), and on a session socket when `ws` is given,
|
|
1712
|
+
with valid params so only the credential varies. It runs on every backend and
|
|
1713
|
+
can't be excluded; in-process, an app mounting none gets the declaration rows
|
|
1714
|
+
alone. Property: ../../../docs/security.md §Test Backdoor Actions; the
|
|
1715
|
+
spec-level complement is `assert_no_testing_methods` and
|
|
1716
|
+
`src/test/testing/testing_actions_auth.test.ts`.
|
|
2228
1717
|
|
|
2229
1718
|
### Limiter-enabled backends — `login_security.ts` + `ws_action_rate_limit.ts`
|
|
2230
1719
|
|
|
@@ -2243,10 +1732,8 @@ to boot on a cap without the flag.
|
|
|
2243
1732
|
Neither suite resets a limiter: each case isolates itself with its own
|
|
2244
1733
|
forwarded IP or the fresh keeper `_testing_reset` seeds. The IP cases'
|
|
2245
1734
|
addresses are fixed per process and their buckets outlive the reset, so a
|
|
2246
|
-
vitest retry of one fails. fuz_app
|
|
2247
|
-
|
|
2248
|
-
in-process limiter and proxy paths are `describe_rate_limiting_tests` and the
|
|
2249
|
-
proxy middleware tests.
|
|
1735
|
+
vitest retry of one fails. fuz_app's wiring: ../../test/CLAUDE.md
|
|
1736
|
+
§Cross-backend self-tests.
|
|
2250
1737
|
|
|
2251
1738
|
### Timing overrides — `timing_env`
|
|
2252
1739
|
|
|
@@ -2259,16 +1746,10 @@ through `timing_env` (`default_backend_configs.ts`), which sets
|
|
|
2259
1746
|
`spine_surface_constants.ts`. Both spine binaries read them as a positive
|
|
2260
1747
|
integer of ms up to 2³¹ − 1 and refuse to boot on anything else; unset keeps
|
|
2261
1748
|
the defaults (`SSE_KEEP_ALIVE_INTERVAL_MS`, `DEFAULT_WS_RECEIVE_TIMEOUT`).
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
`
|
|
2265
|
-
|
|
2266
|
-
way; the timing project boots both spines with them shortened.
|
|
2267
|
-
Cross-process only; fuz_app's own wiring is
|
|
2268
|
-
`src/test/cross_backend/sse_keep_alive.cross.test.ts`,
|
|
2269
|
-
`src/test/cross_backend/ws_receive_timeout.cross.test.ts` and
|
|
2270
|
-
`src/test/cross_backend/db_checkout_timeout.cross.test.ts`, under the
|
|
2271
|
-
`cross_backend_timing` project.
|
|
1749
|
+
`db_checkout_timeout_ms` and `db_audit_checkout_timeout_ms` set the production
|
|
1750
|
+
pool checkout bounds (`FUZ_DB_CHECKOUT_TIMEOUT_MS`,
|
|
1751
|
+
`FUZ_DB_AUDIT_CHECKOUT_TIMEOUT_MS`) the same way. Cross-process only;
|
|
1752
|
+
fuz_app's wiring: ../../test/CLAUDE.md §Cross-backend self-tests.
|
|
2272
1753
|
|
|
2273
1754
|
### Building a TS test-server binary — `testing_server_core.ts` + adapters
|
|
2274
1755
|
|
|
@@ -2280,20 +1761,15 @@ re-roll the serve / daemon-info / drain boilerplate:
|
|
|
2280
1761
|
- `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).
|
|
2281
1762
|
- `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).
|
|
2282
1763
|
- `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.
|
|
2283
|
-
- `testing/cross_backend/default_spine_surface.ts` — the canonical no-domain spine surface (account/admin/audit/signup + bootstrap): `
|
|
1764
|
+
- `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.
|
|
2284
1765
|
- `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).
|
|
2285
1766
|
- `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()`.
|
|
2286
1767
|
|
|
2287
|
-
fuz_app's own binary
|
|
1768
|
+
fuz_app's own binary (`src/test/cross_backend/testing_spine_server{,_node,_bun}.ts`) is the worked example: one runtime-agnostic `build_spine_app` over `create_app_backend` + `create_app_server`, `build_full_spine_mount`'s lists on one RPC endpoint and two WS endpoints (`/api/ws` and `SPINE_ROLE_GATED_WS_PATH`) sharing one registry, so each socket hears a notification once; `_node` and `_bun` differ only in their adapter. It leaves `auth_cleanup` off, as the Rust stub does — a background pass would delete rows under a running suite; a consumer's binary may schedule it only when nothing its suites seed is already expired (the `expired_session` principal seeds a backdated session row).
|
|
2288
1769
|
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
`ctx.audit_sse` is set (keeps the shared surface snapshot SSE-free, since the surface stub ctx has
|
|
2293
|
-
`audit_sse: null`). `capabilities.sse` is a mount flag, so each config states
|
|
2294
|
-
it (`ts_spine_backend_config.ts` for the TS spines) and a consumer that doesn't
|
|
2295
|
-
wire `audit_log_sse` states `false`. The
|
|
2296
|
-
real-HTTP `transports/sse_transport.ts` feeds `describe_cross_process_sse_tests`.
|
|
1770
|
+
`capabilities.sse` is a mount flag, so each config states it; a consumer
|
|
1771
|
+
binary that doesn't wire `audit_log_sse` states `false`. The real-HTTP
|
|
1772
|
+
`transports/sse_transport.ts` feeds `describe_cross_process_sse_tests`.
|
|
2297
1773
|
|
|
2298
1774
|
The auth-cost handling for cross-process testing is consumer-side: each
|
|
2299
1775
|
consumer ships a separate test binary wiring a fast-params
|
|
@@ -2336,13 +1812,7 @@ scenario→task→report adapter over `@fuzdev/fuz_util`'s benchmark library
|
|
|
2336
1812
|
(`Benchmark`, `benchmark_stats_compare`, `benchmark_format_markdown`) —
|
|
2337
1813
|
no stats engine reinvented. fuz_app ships the primitive; consumers wire
|
|
2338
1814
|
scenarios + the run.
|
|
2339
|
-
fuz_app
|
|
2340
|
-
(`src/benchmarks/cross_impl.bench.ts`) on the back of its TS spine binary —
|
|
2341
|
-
ts-node + ts-bun (+ the Rust `spine_stub` when `FUZ_TESTING_RUST_SPINE_STUB_BIN`
|
|
2342
|
-
is set). The two TS runtimes are apples-to-apples with each other (same
|
|
2343
|
-
in-memory pglet driver); TS-vs-Rust carries the pglet-vs-Postgres DB-layer caveat
|
|
2344
|
-
(documented in the run). The artifact (`*.latest.json`) is gitignored.
|
|
2345
|
-
|
|
1815
|
+
fuz_app's own run: ../../test/CLAUDE.md §Cross-backend self-tests.
|
|
2346
1816
|
- `bench/scenario.ts` — `BenchScenario` (`{name, requires?, run}`) +
|
|
2347
1817
|
`BenchScenarioContext` (pre-authed `transport`, `rpc_path`,
|
|
2348
1818
|
`capabilities`). The `run` body is the timed task; it `throw`s on a
|
|
@@ -2357,8 +1827,7 @@ in-memory pglet driver); TS-vs-Rust carries the pglet-vs-Postgres DB-layer cavea
|
|
|
2357
1827
|
bootstraps each backend once (uses `handle.keeper_transport`; **no reset
|
|
2358
1828
|
in the hot loop**), runs each scenario as a one-task `Benchmark` named by
|
|
2359
1829
|
the backend, returns `CrossImplBenchResult` (`{backends, scenarios, entries}`).
|
|
2360
|
-
Network-tuned defaults override fuz_util's micro defaults
|
|
2361
|
-
(warmup 20 / min 100 / duration 3000ms).
|
|
1830
|
+
Network-tuned defaults override fuz_util's micro defaults (its TSDoc).
|
|
2362
1831
|
- `bench/bench_report.ts` — `format_cross_impl_markdown` (per-scenario
|
|
2363
1832
|
table, backend rows), `compare_cross_impl` (Welch verdict per scenario
|
|
2364
1833
|
vs a reference backend) + `format_cross_impl_comparison`, and
|