@fuzdev/fuz_app 0.150.0 → 0.151.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 +1 -1
- package/dist/actions/CLAUDE.md +324 -299
- package/dist/actions/action_bridge.d.ts +5 -86
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +4 -84
- package/dist/actions/action_codegen.d.ts +8 -166
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +19 -95
- package/dist/actions/action_dispatcher.d.ts +10 -0
- package/dist/actions/action_dispatcher.d.ts.map +1 -1
- package/dist/actions/action_dispatcher.js +9 -6
- package/dist/actions/action_event.d.ts +1 -2
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +7 -13
- package/dist/actions/action_event_helpers.d.ts +1 -40
- package/dist/actions/action_event_helpers.d.ts.map +1 -1
- package/dist/actions/action_event_helpers.js +1 -25
- package/dist/actions/action_rpc.d.ts +10 -215
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +56 -111
- package/dist/actions/action_spec.d.ts +2 -2
- package/dist/actions/action_spec.js +2 -2
- package/dist/actions/action_types.d.ts +229 -8
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +56 -5
- package/dist/actions/broadcast_api.d.ts +22 -17
- package/dist/actions/broadcast_api.d.ts.map +1 -1
- package/dist/actions/broadcast_api.js +16 -27
- package/dist/actions/cancel.d.ts +4 -13
- package/dist/actions/cancel.d.ts.map +1 -1
- package/dist/actions/cancel.js +5 -17
- package/dist/actions/compile_action_registry.d.ts +1 -2
- package/dist/actions/compile_action_registry.d.ts.map +1 -1
- package/dist/actions/connection_closer.d.ts +120 -50
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +139 -31
- package/dist/actions/{transports_ws_backend.d.ts → connection_registry.d.ts} +120 -132
- package/dist/actions/connection_registry.d.ts.map +1 -0
- package/dist/actions/{transports_ws_backend.js → connection_registry.js} +149 -152
- package/dist/actions/frontend_rpc_client.d.ts +52 -2
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +42 -4
- package/dist/actions/peer_ping.d.ts +7 -9
- package/dist/actions/peer_ping.d.ts.map +1 -1
- package/dist/actions/peer_ping.js +6 -8
- package/dist/actions/peer_request.d.ts +6 -5
- package/dist/actions/peer_request.d.ts.map +1 -1
- package/dist/actions/peer_request.js +6 -5
- package/dist/actions/perform_action.d.ts +36 -28
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +60 -34
- package/dist/actions/protocol.d.ts +14 -0
- package/dist/actions/protocol.d.ts.map +1 -1
- package/dist/actions/protocol.js +18 -0
- package/dist/actions/register_action_ws.d.ts +137 -298
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +155 -923
- package/dist/actions/socket.svelte.d.ts +9 -0
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +16 -5
- package/dist/actions/transports.d.ts +88 -34
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +76 -76
- package/dist/actions/transports_http.d.ts +48 -12
- package/dist/actions/transports_http.d.ts.map +1 -1
- package/dist/actions/transports_http.js +75 -44
- package/dist/actions/transports_ws.d.ts +29 -0
- package/dist/actions/transports_ws.d.ts.map +1 -1
- package/dist/actions/transports_ws.js +34 -8
- package/dist/actions/ws_endpoint_spec.d.ts +52 -75
- package/dist/actions/ws_endpoint_spec.d.ts.map +1 -1
- package/dist/actions/ws_endpoint_spec.js +27 -10
- package/dist/actions/ws_outbound_writer.d.ts +3 -3
- package/dist/actions/ws_outbound_writer.js +3 -3
- package/dist/actions/ws_socket_session.d.ts +321 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -0
- package/dist/actions/ws_socket_session.js +783 -0
- package/dist/auth/CLAUDE.md +70 -44
- package/dist/auth/account_action_specs.d.ts +2 -0
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_actions.d.ts +1 -1
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +9 -3
- package/dist/auth/account_queries.d.ts +10 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +27 -17
- package/dist/auth/account_routes.d.ts +2 -1
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +14 -17
- package/dist/auth/account_schema.d.ts +5 -5
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +5 -2
- package/dist/auth/actor_lookup_actions.d.ts +1 -1
- package/dist/auth/actor_lookup_actions.d.ts.map +1 -1
- package/dist/auth/actor_lookup_actions.js +1 -1
- package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
- package/dist/auth/actor_search_action_specs.js +2 -1
- package/dist/auth/actor_search_actions.d.ts +1 -1
- package/dist/auth/actor_search_actions.d.ts.map +1 -1
- package/dist/auth/actor_search_actions.js +1 -1
- package/dist/auth/actor_search_queries.d.ts +5 -5
- package/dist/auth/actor_search_queries.d.ts.map +1 -1
- package/dist/auth/actor_search_queries.js +7 -7
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +3 -1
- package/dist/auth/admin_actions.d.ts +1 -1
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +12 -42
- package/dist/auth/all_cell_actions.d.ts +6 -4
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +1 -1
- package/dist/auth/api_token_queries.d.ts +1 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +1 -0
- package/dist/auth/audit_emitter.d.ts +3 -3
- package/dist/auth/audit_emitter.js +2 -2
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +3 -2
- package/dist/auth/audit_log_routes.d.ts +20 -11
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +49 -29
- package/dist/auth/audit_log_schema.d.ts +13 -21
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +10 -18
- package/dist/auth/bearer_auth.d.ts +7 -4
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +21 -15
- package/dist/auth/cell_action_helpers.d.ts +89 -0
- package/dist/auth/cell_action_helpers.d.ts.map +1 -0
- package/dist/auth/cell_action_helpers.js +113 -0
- package/dist/auth/cell_actions.d.ts +22 -13
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +105 -167
- package/dist/auth/cell_audit_actions.d.ts +1 -1
- package/dist/auth/cell_audit_actions.d.ts.map +1 -1
- package/dist/auth/cell_audit_actions.js +3 -12
- package/dist/auth/cell_audit_metadata.d.ts +1 -1
- package/dist/auth/cell_audit_metadata.js +1 -1
- package/dist/auth/cell_field_actions.d.ts +1 -1
- package/dist/auth/cell_field_actions.d.ts.map +1 -1
- package/dist/auth/cell_field_actions.js +16 -66
- package/dist/auth/cell_grant_action_specs.d.ts +2 -2
- package/dist/auth/cell_grant_action_specs.js +3 -3
- package/dist/auth/cell_grant_actions.d.ts +73 -11
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +63 -55
- package/dist/auth/cell_grant_audit_metadata.d.ts +6 -3
- package/dist/auth/cell_grant_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_grant_audit_metadata.js +7 -4
- package/dist/auth/cell_item_actions.d.ts +1 -1
- package/dist/auth/cell_item_actions.d.ts.map +1 -1
- package/dist/auth/cell_item_actions.js +21 -82
- package/dist/auth/cleanup.d.ts +1 -1
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +6 -3
- package/dist/auth/credential_deadline.d.ts +3 -3
- package/dist/auth/credential_deadline.js +3 -3
- package/dist/auth/credential_type_schema.d.ts +5 -5
- package/dist/auth/credential_type_schema.js +5 -5
- package/dist/auth/daemon_token_middleware.d.ts +12 -6
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +28 -17
- package/dist/auth/deps.d.ts +4 -4
- package/dist/auth/fail_floor.d.ts +55 -0
- package/dist/auth/fail_floor.d.ts.map +1 -0
- package/dist/auth/fail_floor.js +63 -0
- package/dist/auth/invite_queries.d.ts +3 -15
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +3 -21
- package/dist/auth/middleware.d.ts +12 -7
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +42 -29
- package/dist/auth/migrations.d.ts +5 -33
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +9 -16
- package/dist/auth/request_context.d.ts +101 -71
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +137 -140
- package/dist/auth/resolved_auth.d.ts +122 -36
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +89 -38
- package/dist/auth/role_grant_offer_action_specs.d.ts +99 -14
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +26 -13
- package/dist/auth/role_grant_offer_actions.d.ts +13 -7
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +14 -12
- package/dist/auth/role_grant_offer_notifications.d.ts +3 -3
- package/dist/auth/role_grant_offer_notifications.js +1 -1
- package/dist/auth/role_grant_offer_queries.d.ts +0 -5
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +9 -41
- package/dist/auth/role_grant_queries.d.ts +17 -67
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +34 -106
- package/dist/auth/role_grant_sql.d.ts +42 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -0
- package/dist/auth/role_grant_sql.js +54 -0
- package/dist/auth/scope_kind_schema.d.ts +1 -1
- package/dist/auth/scope_kind_schema.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +1 -1
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +1 -1
- package/dist/auth/session_queries.d.ts +2 -1
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +2 -1
- package/dist/auth/signup_routes.d.ts +2 -1
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +14 -13
- package/dist/auth/standard_rpc_actions.d.ts +1 -1
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/token_scope.d.ts +19 -46
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +23 -41
- package/dist/db/CLAUDE.md +9 -4
- package/dist/db/cell_ddl.d.ts +5 -142
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +17 -16
- package/dist/db/cell_field_queries.d.ts +0 -13
- package/dist/db/cell_field_queries.d.ts.map +1 -1
- package/dist/db/cell_field_queries.js +0 -16
- package/dist/db/cell_grant_queries.d.ts +10 -5
- package/dist/db/cell_grant_queries.d.ts.map +1 -1
- package/dist/db/cell_grant_queries.js +13 -7
- package/dist/db/cell_item_queries.d.ts +0 -7
- package/dist/db/cell_item_queries.d.ts.map +1 -1
- package/dist/db/cell_item_queries.js +0 -10
- package/dist/db/cell_queries.d.ts +12 -48
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +24 -55
- package/dist/db/cell_view_sql.d.ts +1 -6
- package/dist/db/cell_view_sql.d.ts.map +1 -1
- package/dist/db/cell_view_sql.js +1 -2
- package/dist/db/fact_ddl.d.ts +5 -30
- package/dist/db/fact_ddl.d.ts.map +1 -1
- package/dist/db/fact_ddl.js +14 -13
- package/dist/db/fact_store.d.ts +11 -0
- package/dist/db/fact_store.d.ts.map +1 -1
- package/dist/db/fact_store.js +4 -1
- package/dist/db/migrate.d.ts +44 -6
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +63 -4
- package/dist/dev/setup.d.ts +18 -14
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +42 -39
- package/dist/env/dotenv.d.ts +2 -2
- package/dist/env/dotenv.js +2 -2
- package/dist/env/update_env_variable.d.ts +33 -21
- package/dist/env/update_env_variable.d.ts.map +1 -1
- package/dist/env/update_env_variable.js +54 -35
- package/dist/hono_context.d.ts +15 -90
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +9 -56
- package/dist/http/CLAUDE.md +35 -20
- package/dist/http/auth_shape.d.ts +1 -8
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +6 -12
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +3 -2
- package/dist/http/db_routes.d.ts +3 -3
- package/dist/http/db_routes.js +3 -3
- package/dist/http/error_schemas.d.ts +1 -2
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +1 -2
- package/dist/http/health_schema.d.ts +16 -0
- package/dist/http/health_schema.d.ts.map +1 -0
- package/dist/http/health_schema.js +12 -0
- package/dist/http/jsonrpc_errors.d.ts +22 -2
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +41 -3
- package/dist/http/jsonrpc_helpers.d.ts +60 -17
- package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
- package/dist/http/jsonrpc_helpers.js +67 -25
- package/dist/http/origin.d.ts +30 -1
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +46 -9
- package/dist/http/origin_wildcard.d.ts +97 -0
- package/dist/http/origin_wildcard.d.ts.map +1 -0
- package/dist/http/origin_wildcard.js +142 -0
- package/dist/http/pending_effects.d.ts +28 -0
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +32 -1
- package/dist/http/route_spec.d.ts +4 -3
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +54 -45
- package/dist/http/surface.d.ts +1 -1
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface_query.d.ts +9 -50
- package/dist/http/surface_query.d.ts.map +1 -1
- package/dist/http/surface_query.js +48 -94
- package/dist/realtime/audit_log_sse.d.ts +180 -0
- package/dist/realtime/audit_log_sse.d.ts.map +1 -0
- package/dist/realtime/audit_log_sse.js +154 -0
- package/dist/realtime/sse.d.ts +21 -6
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +33 -10
- package/dist/realtime/sse_constants.d.ts +29 -2
- package/dist/realtime/sse_constants.d.ts.map +1 -1
- package/dist/realtime/sse_constants.js +35 -2
- package/dist/realtime/{subscriber_registry.d.ts → sse_registry.d.ts} +12 -12
- package/dist/realtime/sse_registry.d.ts.map +1 -0
- package/dist/realtime/{subscriber_registry.js → sse_registry.js} +4 -4
- package/dist/schema_meta.d.ts +30 -10
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +85 -21
- package/dist/sensitivity.d.ts +9 -3
- package/dist/sensitivity.d.ts.map +1 -1
- package/dist/sensitivity.js +3 -2
- package/dist/server/app_backend.d.ts +8 -5
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +6 -12
- package/dist/server/app_server.d.ts +62 -51
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +84 -71
- package/dist/server/app_server_context.d.ts +1 -1
- package/dist/server/app_server_context.d.ts.map +1 -1
- package/dist/server/env.d.ts +24 -20
- package/dist/server/env.d.ts.map +1 -1
- package/dist/server/env.js +24 -34
- package/dist/server/serve_fact_route.d.ts +12 -16
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +59 -34
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +2 -2
- package/dist/testing/CLAUDE.md +179 -158
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +10 -19
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +8 -0
- package/dist/testing/app_server.d.ts +9 -77
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +31 -112
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +3 -4
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -5
- package/dist/testing/auth_apps.d.ts +3 -3
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +9 -6
- package/dist/testing/connection_closer_helpers.d.ts +8 -16
- package/dist/testing/connection_closer_helpers.d.ts.map +1 -1
- package/dist/testing/connection_closer_helpers.js +7 -20
- package/dist/testing/cross_backend/action_manifest.d.ts +15 -4
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +13 -3
- package/dist/testing/cross_backend/action_manifest_parity.d.ts +15 -7
- package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest_parity.js +8 -1
- package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
- package/dist/testing/cross_backend/body_size.js +25 -22
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +22 -3
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
- package/dist/testing/cross_backend/build_test_backend_paths.js +34 -11
- package/dist/testing/cross_backend/capabilities.d.ts +13 -7
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_grant_role.js +2 -2
- package/dist/testing/cross_backend/cell_grant_steward.d.ts +4 -0
- package/dist/testing/cross_backend/cell_grant_steward.d.ts.map +1 -0
- package/dist/testing/cross_backend/cell_grant_steward.js +120 -0
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +21 -0
- package/dist/testing/cross_backend/conformance_table.d.ts +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.d.ts +18 -4
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +29 -9
- package/dist/testing/cross_backend/default_spine_surface.d.ts +7 -7
- package/dist/testing/cross_backend/default_spine_surface.js +2 -2
- package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -1
- package/dist/testing/cross_backend/fact_serving.js +48 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -4
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +9 -2
- package/dist/testing/cross_backend/origin_scope.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_scope.js +5 -13
- package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +29 -4
- package/dist/testing/cross_backend/postgres_database.d.ts +32 -0
- package/dist/testing/cross_backend/postgres_database.d.ts.map +1 -1
- package/dist/testing/cross_backend/postgres_database.js +56 -1
- package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
- package/dist/testing/cross_backend/query_shape.js +18 -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 +23 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +17 -5
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +5 -4
- package/dist/testing/cross_backend/session_cap.d.ts +8 -0
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +66 -2
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +5 -4
- package/dist/testing/cross_backend/spine_suites.d.ts +4 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +21 -0
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +22 -7
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +22 -7
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +4 -3
- package/dist/testing/cross_backend/standard.d.ts +6 -12
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts +8 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts.map +1 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.js +22 -0
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +4 -6
- package/dist/testing/cross_backend/testing_origin_check.d.ts +1 -1
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_origin_check.js +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +10 -5
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +7 -6
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +5 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts +6 -7
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +1 -1
- package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_node.js +13 -2
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +68 -0
- 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 +45 -3
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +16 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +11 -8
- package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_action_rate_limit.js +30 -12
- package/dist/testing/cross_backend/ws_connection_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_connection_cap.js +5 -7
- package/dist/testing/cross_backend/ws_endpoint.d.ts +2 -3
- package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_envelope.d.ts +17 -0
- package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -0
- package/dist/testing/cross_backend/ws_envelope.js +172 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts +16 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_inbound_dispatch.js +8 -4
- package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.js +5 -8
- package/dist/testing/cross_backend/ws_role_gated.js +2 -2
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +6 -4
- package/dist/{cli/daemon.d.ts → testing/daemon_info.d.ts} +15 -47
- package/dist/testing/daemon_info.d.ts.map +1 -0
- package/dist/testing/daemon_info.js +108 -0
- package/dist/testing/daemon_token_rotation.js +1 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +3 -4
- package/dist/testing/db.js +2 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +35 -65
- package/dist/testing/integration_helpers.d.ts +0 -15
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +2 -42
- package/dist/testing/middleware.d.ts +20 -12
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +49 -40
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +13 -22
- package/dist/testing/resolved_auth.d.ts +30 -0
- package/dist/testing/resolved_auth.d.ts.map +1 -0
- package/dist/testing/resolved_auth.js +41 -0
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +3 -0
- package/dist/testing/rpc_helpers.d.ts +1 -1
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +2 -1
- package/dist/testing/sse_round_trip.d.ts +5 -4
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/stubs.d.ts +2 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +24 -21
- package/dist/testing/test_origin.d.ts +25 -0
- package/dist/testing/test_origin.d.ts.map +1 -0
- package/dist/testing/test_origin.js +28 -0
- package/dist/testing/transports/raw_http.d.ts +54 -0
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +58 -0
- package/dist/testing/transports/ws_raw_client.d.ts +8 -0
- package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
- package/dist/testing/transports/ws_raw_client.js +13 -0
- package/dist/testing/transports/ws_transport.d.ts +15 -2
- package/dist/testing/transports/ws_transport.d.ts.map +1 -1
- package/dist/testing/transports/ws_transport.js +4 -2
- package/dist/testing/ws_round_trip.d.ts +27 -25
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +34 -26
- package/dist/ui/AccountSessions.svelte +48 -19
- package/dist/ui/AccountSessions.svelte.d.ts +2 -17
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte +6 -1
- package/dist/ui/AdminAuditLog.svelte +61 -22
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte +1 -1
- package/dist/ui/AdminOverview.svelte +76 -37
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminRoleGrantHistory.svelte +6 -1
- package/dist/ui/AdminSessions.svelte +1 -1
- package/dist/ui/AppShell.svelte +3 -2
- package/dist/ui/AppShell.svelte.d.ts +3 -2
- package/dist/ui/AppShell.svelte.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +121 -35
- package/dist/ui/Datatable.svelte +33 -18
- package/dist/ui/Datatable.svelte.d.ts +2 -14
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte +10 -1
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/PopoverButton.svelte +13 -8
- package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferForm.svelte +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferHistory.svelte +3 -3
- package/dist/ui/RoleGrantOfferInbox.svelte +19 -15
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte +66 -27
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.d.ts +7 -14
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +14 -9
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +6 -4
- package/dist/ui/admin_invites_state.svelte.d.ts +2 -2
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.d.ts +9 -9
- package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.js +9 -9
- package/dist/ui/app_settings_state.svelte.d.ts +2 -2
- package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.d.ts +70 -13
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +239 -47
- package/dist/ui/backend_probe.svelte.d.ts +93 -0
- package/dist/ui/backend_probe.svelte.d.ts.map +1 -0
- package/dist/ui/backend_probe.svelte.js +140 -0
- package/dist/ui/format_scope.d.ts +7 -7
- package/dist/ui/format_scope.d.ts.map +1 -1
- package/dist/ui/format_scope.js +4 -4
- package/dist/ui/keyed_async_slot.svelte.d.ts +2 -2
- package/dist/ui/keyed_async_slot.svelte.js +2 -2
- package/dist/ui/popover.svelte.d.ts +18 -19
- package/dist/ui/popover.svelte.d.ts.map +1 -1
- package/dist/ui/popover.svelte.js +103 -16
- package/dist/ui/role_grant_offers_state.svelte.d.ts +41 -46
- package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/role_grant_offers_state.svelte.js +37 -19
- package/dist/ui/ui_format.d.ts +17 -0
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +20 -0
- package/package.json +2 -1
- package/dist/actions/register_ws_endpoint.d.ts +0 -79
- package/dist/actions/register_ws_endpoint.d.ts.map +0 -1
- package/dist/actions/register_ws_endpoint.js +0 -109
- package/dist/actions/transports_ws_auth_guard.d.ts +0 -96
- package/dist/actions/transports_ws_auth_guard.d.ts.map +0 -1
- package/dist/actions/transports_ws_auth_guard.js +0 -141
- package/dist/actions/transports_ws_backend.d.ts.map +0 -1
- package/dist/cli/args.d.ts +0 -55
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js +0 -100
- package/dist/cli/config.d.ts +0 -47
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -77
- package/dist/cli/daemon.d.ts.map +0 -1
- package/dist/cli/daemon.js +0 -181
- package/dist/cli/help.d.ts +0 -124
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -215
- package/dist/cli/logger.d.ts +0 -46
- package/dist/cli/logger.d.ts.map +0 -1
- package/dist/cli/logger.js +0 -48
- package/dist/cli/util.d.ts +0 -36
- package/dist/cli/util.d.ts.map +0 -1
- package/dist/cli/util.js +0 -50
- package/dist/realtime/sse_auth_guard.d.ts +0 -197
- package/dist/realtime/sse_auth_guard.d.ts.map +0 -1
- package/dist/realtime/sse_auth_guard.js +0 -239
- package/dist/realtime/subscriber_registry.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.d.ts +0 -29
- package/dist/testing/bootstrap_success.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.js +0 -144
- package/dist/testing/mock_fs.d.ts +0 -20
- package/dist/testing/mock_fs.d.ts.map +0 -1
- package/dist/testing/mock_fs.js +0 -28
- package/dist/testing/standard.d.ts +0 -122
- package/dist/testing/standard.d.ts.map +0 -1
- package/dist/testing/standard.js +0 -73
- package/dist/testing/testing_rate_limiter.d.ts +0 -65
- package/dist/testing/testing_rate_limiter.d.ts.map +0 -1
- package/dist/testing/testing_rate_limiter.js +0 -80
package/dist/testing/CLAUDE.md
CHANGED
|
@@ -33,8 +33,8 @@ time (never runtime), where a throwing guard would break `vite build`.
|
|
|
33
33
|
- `stub_mw` — pass-through middleware (`async (_c, next) => next()`).
|
|
34
34
|
- `create_stub_app_deps()` — factory: fresh `AppDeps` with no-op keyring/password/`delete_file`, a `read_secure_file` that throws ENOENT (the no-token-file state), a `create_noop_stub` DB, silent `Logger`, no-op `audit`, an empty `connection_closer`.
|
|
35
35
|
- `create_test_audit_emitter()` — no-op `AuditEmitter`; `emit` / `emit_role_grant_target` no-op, `emit_pool` resolves immediately, `notify` no-op, `add_listener` throws (use `create_recording_audit_emitter` for a listener-accepting emitter), `listener_count` returns 0, `drain_inflight` resolves immediately, `is_tracking_inflight` returns `false`.
|
|
36
|
-
- `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 `
|
|
37
|
-
- `create_stub_api_middleware({include_daemon_token?, origin_carve_outs?})` — stub `MiddlewareSpec[]` matching `create_auth_middleware_specs`'s output (origin
|
|
36
|
+
- `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`.
|
|
37
|
+
- `create_stub_api_middleware({include_daemon_token?, origin_carve_outs?})` — stub `MiddlewareSpec[]` matching `create_auth_middleware_specs`'s output (origin, optional daemon_token, session, request_context, bearer_auth) for surface generation without booting real auth — the same names, paths, order, and declared `errors` (`origin` declares a 403; `bearer_auth` and `daemon_token` declare none, since both soft-fail through `next()`), pinned against the real factory by `auth/middleware.mounted.test.ts`. The surface merges middleware errors into every route under the path, so a stub declaring more would widen the test surface with statuses the live server never returns. Each spec gets its own pass-through handler (not the shared `stub_mw`), so `assert_middleware_stack_mounted` tells the layers apart. See `auth/CLAUDE.md` §Middleware for the real stack.
|
|
38
38
|
- `create_stub_app_backend(options?)` — stub `AppBackend` with no database: `create_stub_app_deps()` (or `options.deps`), no migration results, a `close` that does nothing (or `options.close`). For assembling a server in tests that never reach the database.
|
|
39
39
|
- `create_stub_app_server_context(session_options)` — stub `AppServerContext` over `create_stub_app_backend()`; rate limiters null, `bootstrap_status.available: false`.
|
|
40
40
|
- `create_test_app_surface_spec(options)` — builds an `AppSurfaceSpec` mirroring `create_app_server`'s route assembly, in its order (consumer routes, then bootstrap routes, RPC endpoint routes, and `GET /api/surface`, + stub middleware + surface generation). `GET /api/surface` is listed only with `surface_route: true`, as `create_app_server` mounts it only when opted in — pass the same value to both so the surface-derived suites probe it exactly when the live server serves it. `daemon_token: true` lists the `daemon_token` layer `create_app_server` mounts when given a `daemon_token_state` (`create_test_app` always passes one, and `default_in_process_suite_options` sets it, along with `app_options.surface_route`); `testing/test_app_server.db.test.ts` pins the stub's routes (order, auth, error schemas, applicable middleware) and middleware names against `create_test_app`'s for every `surface_route` setting. Its middleware list mirrors the real one — a stub `trusted_proxy` spec at `'*'`, then the stub auth stack — so every route's `applicable_middleware` starts with `trusted_proxy` (a route outside `/api/*` lists `['trusted_proxy', 'origin']`, since the origin check covers every path, and a route under an origin carve-out drops `origin`), as on the live server. `CreateTestAppSurfaceSpecOptions`: `session_options`, `create_route_specs`, `env_schema?`, `event_specs?`, `rpc_endpoints?`, `ws_endpoints?`, `allowed_origins?`, `origin_carve_outs?`, `transform_middleware?`, `bootstrap?`, `surface_route?`, `daemon_token?`. Throws, like `create_app_server`, on an endpoint path outside `AUTH_MIDDLEWARE_PATH` (`assert_endpoint_in_auth_scope`), on a route that reads or mints a credential outside it (`assert_credential_routes_in_auth_scope`), on an origin carve-out that overlaps that scope (`assert_origin_carve_outs_valid`), and on a `transform_middleware` that moves, drops, duplicates, reorders, wraps, or replaces the stub proxy spec or a stub auth spec (`assert_middleware_stack_mounted`); the transform receives shallow copies in a fresh array, so an in-place mutation can't slip past the check. Throws on a `ws_endpoints` spec with no `allowed_origins` of its own when no `allowed_origins` option is given (there is no server list to default from). Bootstrap is opt-in (symmetric with `create_app_server` — omit to skip; pass the same value as prod to mount routes at `bootstrap.route_prefix ?? '/api/account'`). Single source of truth for attack-surface tests — track `create_app_server` wiring changes here.
|
|
@@ -60,14 +60,18 @@ casts — the factory brands internally. Exported as `TestAccountOverrides` /
|
|
|
60
60
|
- `create_test_context(role_grants?)` — `{account, actor, role_grants}`; pass `[{role: 'keeper'}, {role: 'admin'}]` for multi-role.
|
|
61
61
|
- `create_test_raw_api_token(label?)` — a well-formed raw bearer value (`secret_fuz_token_` + `label` padded with `A` to 43 chars) that passes `is_api_token_shaped`, so a mocked-lookup test reaches token validation; distinct labels give distinct tokens.
|
|
62
62
|
- `create_test_validated_api_token(overrides?)` — a `ValidatedApiToken` (what `query_validate_api_token` returns) with a `full` scope; override `scope` to test a narrowed one.
|
|
63
|
-
- `create_test_audit_event(overrides?)` — `{id: 'evt-test', event_type: 'login', outcome: 'success', …}`, for
|
|
63
|
+
- `create_test_audit_event(overrides?)` — `{id: 'evt-test', event_type: 'login', outcome: 'success', …}`, for revocation-guard / audit tests.
|
|
64
64
|
|
|
65
|
-
### `
|
|
65
|
+
### `resolved_auth.ts` — `ResolvedAuth` factory
|
|
66
66
|
|
|
67
|
-
`
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
`create_test_resolved_auth({credential_type, account_id, session_id?,
|
|
68
|
+
api_token_id?, scope?, credential_deadline?})` — the `ResolvedAuth` arm for a
|
|
69
|
+
credential type, as the auth middleware builds it: a session's `session_hash`
|
|
70
|
+
is `hash_session_token(session_id)` (default a fresh uuid), an API token's id
|
|
71
|
+
defaults to a fresh uuid and its scope to `full`, a daemon token has no
|
|
72
|
+
deadline. For harnesses that preset `RESOLVED_AUTH_KEY` instead of running the
|
|
73
|
+
middleware — `create_test_app_from_specs`, `create_fake_hono_context`, the WS
|
|
74
|
+
harness's `connect`, `create_bearer_auth_test_app`'s `pre_context`.
|
|
71
75
|
|
|
72
76
|
### `db_entities.ts` — DB-backed entity factories
|
|
73
77
|
|
|
@@ -86,7 +90,10 @@ sort `created_at, id`, so a shared `created_at` would order them by random id;
|
|
|
86
90
|
seeded through it, the account's first actor sorts first and the extras in
|
|
87
91
|
insert order. `_testing_reset` and the in-process setup seed `extra_actors`
|
|
88
92
|
with it, as the Rust reset does with `query_create_actor_with_clock_timestamp`,
|
|
89
|
-
so both spines list a multi-actor keeper's actors in one order.
|
|
93
|
+
so both spines list a multi-actor keeper's actors in one order. The exception
|
|
94
|
+
is `query_admin_account_list`, whose actors sort `created_at, name, id`: it
|
|
95
|
+
keeps one actor per account, and a data key ahead of the random id picks the
|
|
96
|
+
same one on two backends holding the same rows (under the same text collation).
|
|
90
97
|
|
|
91
98
|
`create_test_role_grant_direct(db, input)` wraps `query_create_role_grant`
|
|
92
99
|
for tests needing an active role_grant seeded directly, bypassing the
|
|
@@ -119,15 +126,15 @@ mismatch.
|
|
|
119
126
|
|
|
120
127
|
### `connection_closer_helpers.ts` — `ConnectionCloser` test doubles
|
|
121
128
|
|
|
122
|
-
- `create_recording_closer()` — `{closer, calls}`;
|
|
123
|
-
- `assert_close_call(call,
|
|
124
|
-
- `RecordedClose` — `
|
|
129
|
+
- `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` flushes both queues).
|
|
130
|
+
- `assert_close_call(call, expected)` — pins a recorded close call to `expected` (`assert.deepEqual`); handles the missing-element case.
|
|
131
|
+
- `RecordedClose` — `ConnectionCloseTarget | {kind: 'all'}`.
|
|
125
132
|
- `RecordingCloser` — `{closer, calls}`.
|
|
126
133
|
|
|
127
134
|
## Database — `db.ts`
|
|
128
135
|
|
|
129
136
|
Factory builders for parameterized DB tests. Consumer projects pass their
|
|
130
|
-
`init_schema` callback (which calls `run_migrations(db, [
|
|
137
|
+
`init_schema` callback (which calls `run_migrations(db, [AUTH_MIGRATION_NS, ...app_migrations])`);
|
|
131
138
|
factories accept any migration namespace set.
|
|
132
139
|
|
|
133
140
|
- `DbFactory` — `{name, create, close, skip, skip_reason?}`.
|
|
@@ -163,9 +170,10 @@ fully assembled Hono app + the backend + helpers.
|
|
|
163
170
|
Key module-scope values:
|
|
164
171
|
|
|
165
172
|
- `stub_password_deps` — `PasswordHashDeps` hashing via `stub_hash_${password}` and verifying by equality. Deterministic, no Argon2 cost — use for every test not specifically exercising password hashing.
|
|
166
|
-
- `
|
|
173
|
+
- `TEST_ORIGIN` / `create_test_request_headers(extra?)` (from the dependency-free `testing/test_origin.ts`, so a cross-process suite reads them without the server assembly) — `'http://localhost:5173'`, the origin an in-process test request comes from (and `rpc_call`'s default `Origin`, cross-process too) and the one origin the loopback options allow, and the `{host: 'localhost', origin: TEST_ORIGIN}` pair every in-process request starts from, `extra` added after (the session headers builders are built on it).
|
|
174
|
+
- `create_loopback_app_server_options()` — the loopback `create_app_server` options an in-process test server takes (`TEST_ORIGIN` allowed, the loopback proxy trusted, an empty env schema), fresh per call; `create_test_app` spreads it under its own defaults (`rate_limiters: 'disabled_for_testing'`, `await_pending_effects: true`).
|
|
167
175
|
- `TEST_COOKIE_SECRET` — 64-hex-char deterministic cookie secret. Produces a valid `Keyring` via `create_keyring`. Never used in production — the stub guard plus fixed value is the contract.
|
|
168
|
-
- `fallback_db_factory` — module-level auth-only default factory (`create_default_db_factory`) `create_test_app_server` uses when no `db` is passed, reusing its driver's WASM cache. When `migration_namespaces` is supplied, a memoized sibling factory (keyed by namespace set) migrating `[
|
|
176
|
+
- `fallback_db_factory` — module-level auth-only default factory (`create_default_db_factory`) `create_test_app_server` uses when no `db` is passed, reusing its driver's WASM cache. When `migration_namespaces` is supplied, a memoized sibling factory (keyed by namespace set) migrating `[AUTH_MIGRATION_NS, ...migration_namespaces]` is used instead — same shared WASM, extra tables.
|
|
169
177
|
|
|
170
178
|
Two helpers share the "insert account + actor + roles + API token + session +
|
|
171
179
|
cookie" flow, split by intent:
|
|
@@ -176,10 +184,6 @@ cookie" flow, split by intent:
|
|
|
176
184
|
Both take `{db, keyring, session_options, password, username?, password_value?, roles?}`
|
|
177
185
|
(shared `CreateTestAccountWithCredentialsOptions` / `BootstrapTestKeeperOptions`).
|
|
178
186
|
|
|
179
|
-
For exercising the bootstrap success path end-to-end against an empty DB (no
|
|
180
|
-
pre-keeper, lock unflipped), use `create_test_app_for_bootstrap` — pair with
|
|
181
|
-
`describe_bootstrap_success_tests` for the consumer-runnable suite.
|
|
182
|
-
|
|
183
187
|
Types:
|
|
184
188
|
|
|
185
189
|
- `TestAppServer extends AppBackend` — adds `account`, `actor`, `api_token`, `session_cookie`, `keyring`, `cleanup()`.
|
|
@@ -187,11 +191,10 @@ Types:
|
|
|
187
191
|
- `CreateTestAppOptions extends TestAppServerOptions` — adds `create_route_specs` (required), `rpc_endpoints?: RpcEndpointsSuiteOption` (top-level only — single source of truth, symmetric with the suite-level option), `bootstrap?: BootstrapServerOptions` (top-level only — same precedent as `rpc_endpoints`), and `app_options?: SuiteAppOptions` (`Partial<AppServerOptions>` excluding the five fields the helper manages: `backend`, `session_options`, `create_route_specs`, `rpc_endpoints`, `bootstrap`).
|
|
188
192
|
- `TestAccount` — `{account, actor, session_cookie, api_token, create_session_headers, create_bearer_headers}`.
|
|
189
193
|
- `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.
|
|
190
|
-
- `CreateTestAppForBootstrapOptions` — `{session_options, create_route_specs, rpc_endpoints?, bootstrap: BootstrapLiveOptions, bootstrap_token, app_options?, db?, db_type?, password?, audit_factory?}`. `bootstrap` is required + narrowed to `live` mode (the helper exists for the success-path test).
|
|
191
|
-
- `TestAppForBootstrap` — `{app, backend, server, surface_spec, surface, route_specs, create_request_headers, cleanup}`. No keeper credentials (test drives bootstrap itself).
|
|
192
194
|
|
|
193
195
|
`create_test_app` hard-codes the test-friendly `AppServerOptions`:
|
|
194
|
-
`allowed_origins
|
|
196
|
+
`allowed_origins` exactly `TEST_ORIGIN` (built by
|
|
197
|
+
`parse_allowed_origins`, as `create_app_server` requires), stub proxy pinned to `127.0.0.1`,
|
|
195
198
|
`env_schema: z.object({})`, `rate_limiters: 'disabled_for_testing'` (every
|
|
196
199
|
rate limiter `null` — a limiter passed through `app_options` wins over the
|
|
197
200
|
mode, so a rate-limit test enables just the one it pins; the mode's stderr
|
|
@@ -199,14 +202,12 @@ banner prints once per module instance — once per test file in an isolated
|
|
|
199
202
|
vitest project, once per run under `isolate: false`, ../../../docs/usage.md §Rate limiters), static daemon token state (no rotation, keeper already set),
|
|
200
203
|
**`await_pending_effects: true`** (fire-and-forget effects complete before
|
|
201
204
|
the response returns so tests can assert on side effects inline), and silent
|
|
202
|
-
logger. Override via `app_options`. `
|
|
203
|
-
the limiters the same way. `cleanup()` is the assembled server's idempotent
|
|
205
|
+
logger. Override via `app_options`. `cleanup()` is the assembled server's idempotent
|
|
204
206
|
`close` — it also closes the server's live connections, disposes the
|
|
205
207
|
limiters it built, and removes the audit listeners and closer members it
|
|
206
208
|
added.
|
|
207
209
|
|
|
208
|
-
`auth_cleanup` is left at its default, **off**, here and
|
|
209
|
-
`create_test_app_for_bootstrap`: a background pass would delete rows and
|
|
210
|
+
`auth_cleanup` is left at its default, **off**, here: a background pass would delete rows and
|
|
210
211
|
write audit rows mid-test. A suite that opts in through `app_options` has the
|
|
211
212
|
schedule stopped by `cleanup()`, which is the assembled server's `close`.
|
|
212
213
|
|
|
@@ -218,8 +219,8 @@ the WASM caching in `db.ts` is where the real savings are.
|
|
|
218
219
|
|
|
219
220
|
Pre-built Hono apps at each auth level (public / authed / keeper / per-role)
|
|
220
221
|
for attack-surface testing. No middleware stack — a single `/*` middleware
|
|
221
|
-
injects `
|
|
222
|
-
|
|
222
|
+
injects the `ResolvedAuth` (`RESOLVED_AUTH_KEY`, credential type default
|
|
223
|
+
`'session'`) + `REQUEST_CONTEXT_KEY` plus the `TEST_CONTEXT_PRESET_KEY` flag (so the
|
|
223
224
|
dispatcher's authorization phase trusts the pre-baked context and skips its
|
|
224
225
|
DB-backed actor resolution), then hands off to `apply_route_specs` with
|
|
225
226
|
`fuz_auth_guard_resolver` + `create_fuz_authorization_handler`. Production
|
|
@@ -260,8 +261,9 @@ per-method auth shape.
|
|
|
260
261
|
|
|
261
262
|
- `cross_backend/action_manifest.ts` — `ActionManifest` / `ActionManifestEntry`
|
|
262
263
|
Zod schema (the `_testing_action_manifest` wire validator) + `build_action_manifest(specs)`,
|
|
263
|
-
which normalizes each spec to `{method, side_effects, account, actor, roles,
|
|
264
|
-
credential_types, rate_limit}` (
|
|
264
|
+
which normalizes each spec to `{method, input, side_effects, account, actor, roles,
|
|
265
|
+
credential_types, rate_limit}` (`input` is `'void'` for a `z.void()` input, by
|
|
266
|
+
`is_void_schema`, else `'object'` — the Rust `InputShape`; auth axes pass through; `roles` /
|
|
265
267
|
`credential_types` flatten to sorted arrays; `rate_limit` is the declared
|
|
266
268
|
class or an explicit `null`, so a missing key reads as drift rather than a
|
|
267
269
|
default). Twin of `schema_introspect.ts`. Excludes the protocol actions
|
|
@@ -272,8 +274,8 @@ credential_types, rate_limit}` (auth axes pass through; `roles` /
|
|
|
272
274
|
including them would be a spurious cross-impl diff.
|
|
273
275
|
- `cross_backend/action_manifest_parity.ts` — `diff_action_manifests` /
|
|
274
276
|
`format_action_manifest_diffs` / `assert_action_manifests_equal` (twin of
|
|
275
|
-
`schema_parity.ts`) — asserts exact method-set + per-method
|
|
276
|
-
`ActionManifestDiff` kinds: `method_only_in`, `side_effects_differ`,
|
|
277
|
+
`schema_parity.ts`) — asserts exact method-set + per-method input-shape and
|
|
278
|
+
auth-shape parity. `ActionManifestDiff` kinds: `method_only_in`, `input_differs`, `side_effects_differ`,
|
|
277
279
|
`rate_limit_differs`, `auth_field_differs`, `auth_list_differs`.
|
|
278
280
|
- `cross_backend/setup.ts` `capture_action_manifest(handle)` — dumps a backend's
|
|
279
281
|
manifest over the daemon-token `_testing_action_manifest` channel (twin of
|
|
@@ -493,8 +495,6 @@ Walks Zod schemas to generate valid values for adversarial/round-trip tests.
|
|
|
493
495
|
- `find_route_spec(specs, method, path)` — exact match then parameterized match (`:foo` matches any segment).
|
|
494
496
|
- `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 (only login/logout/password/verify/signup/bootstrap remain on REST).
|
|
495
497
|
- `assert_response_matches_spec(specs, method, path, response)` — 2xx → validates against `spec.output`; non-2xx → validates against merged error schemas for that status. Non-JSON responses allowed only when no schema applies.
|
|
496
|
-
- `create_expired_test_cookie(keyring, session_options)` — validly signed cookie with `expires_at` in 1970.
|
|
497
|
-
- `check_error_response_fields(body)` — returns the list of fields outside `KNOWN_SAFE_ERROR_FIELDS` (`error`, `issues`, `required_roles`, `required_credential_types`, `retry_after`, `has_references`, `ok`).
|
|
498
498
|
- `assert_no_error_info_leakage(body, context)` — rejects field-name patterns (`stack`, `trace`, `sql`, …) + value patterns (`node_modules`, stack-like `at …`, `.ts:NN`).
|
|
499
499
|
- `assert_rate_limit_retry_after_header(response, body)` — `Retry-After` numeric header equals `Math.ceil(body.retry_after)`.
|
|
500
500
|
- `sensitive_field_blocklist` — `['password_hash', 'token_hash']`; never in any response body.
|
|
@@ -563,8 +563,15 @@ schema. No DB needed.
|
|
|
563
563
|
|
|
564
564
|
### `adversarial_headers.ts` — header injection suite
|
|
565
565
|
|
|
566
|
+
**Importing it mocks query modules for the whole test file.** It imports
|
|
567
|
+
`middleware.ts`, whose hoisted `vi.mock` replaces `api_token_queries`,
|
|
568
|
+
`account_queries`, and `role_grant_queries` with mocks in the importing
|
|
569
|
+
file — the bearer-path queries become `vi.fn()` stubs returning `undefined`,
|
|
570
|
+
and any other export of those modules throws on access. Keep the suite in its
|
|
571
|
+
own test file.
|
|
572
|
+
|
|
566
573
|
`describe_standard_adversarial_headers(suite_name, options, allowed_origin, extra_cases?)`
|
|
567
|
-
—
|
|
574
|
+
— the standard cases:
|
|
568
575
|
|
|
569
576
|
1. bearer + rogue Origin → 403 `ERROR_FORBIDDEN_ORIGIN`
|
|
570
577
|
2. bearer + allowed Origin → bearer silently discarded (browser context)
|
|
@@ -580,23 +587,23 @@ validation. Extra cases append to the standard list.
|
|
|
580
587
|
|
|
581
588
|
## Middleware stack — `middleware.ts`
|
|
582
589
|
|
|
583
|
-
Module-level `vi.mock()` for the
|
|
590
|
+
Module-level `vi.mock()` for the query modules bearer auth touches:
|
|
584
591
|
`api_token_queries`, `account_queries`, `role_grant_queries`. Because
|
|
585
592
|
`vi.mock()` is hoisted, these run before any imports resolve — so any test
|
|
586
|
-
file that imports from `middleware.ts
|
|
593
|
+
file that imports from `middleware.ts`, directly or through
|
|
594
|
+
`adversarial_headers.ts`, gets these mocks globally. Pair with
|
|
587
595
|
`vi.restoreAllMocks()` in `afterEach` when mixing into `.db.test.ts` files.
|
|
588
596
|
|
|
589
597
|
- `BearerAuthTestOptions`, `BearerAuthTestCase` — test-case table shape for the bearer auth runner.
|
|
590
598
|
- `create_bearer_auth_mocks(tc)` — configures the module-level mocks per test case; returns spy references.
|
|
591
599
|
- `TEST_CLIENT_IP = '127.0.0.1'` — IP set by the proxy stub in `create_bearer_auth_test_app`.
|
|
592
|
-
- `create_bearer_auth_test_app(tc)` — Hono app with bearer middleware + echo route at `/api/test` returning `{ok,
|
|
600
|
+
- `create_bearer_auth_test_app(tc)` — Hono app with bearer middleware + echo route at `/api/test` returning `{ok, resolved_auth, request_context_set}` — the `ResolvedAuth` bearer auth writes (`null` for none), its `credential_deadline` as how far ahead it lies (`null` for none; `BearerAuthTestCase.expected_credential_deadline_ms` asserts it), plus a flag for tests that pre-populate `REQUEST_CONTEXT_KEY` via `pre_context`. `assert_account_set` holds the value to exactly the `api_token` arm's fields.
|
|
593
601
|
- `describe_bearer_auth_cases(suite_name, cases)` — table-driven runner; one `test()` per case; asserts status, error, body fields, `api_token_id`, context preservation.
|
|
594
602
|
- `TEST_MIDDLEWARE_PATH = '/api/test'` — path used by the echo route in the stack factory.
|
|
595
603
|
- `create_test_middleware_stack_app(options?)` — real proxy + origin + bearer middleware for integration-shape testing. Echo route returns `{ok, client_ip, has_context}`.
|
|
596
604
|
|
|
597
605
|
The echo route under `create_bearer_auth_test_app` deliberately surfaces
|
|
598
|
-
|
|
599
|
-
`CREDENTIAL_TYPE_KEY`, `AUTH_API_TOKEN_ID_KEY`) — bearer middleware writes
|
|
606
|
+
the middleware-written `ResolvedAuth` (`get_resolved_auth`) — bearer middleware writes
|
|
600
607
|
account-grain identity only; the dispatcher's authorization phase owns
|
|
601
608
|
`REQUEST_CONTEXT_KEY`. The `request_context_set` flag covers the test-only
|
|
602
609
|
`pre_context` injection path. When public auth surface gains a new context
|
|
@@ -698,7 +705,7 @@ method and assert the stream closes within 2s.
|
|
|
698
705
|
`SseRouteTestSpec` per route: `{path, trigger, event_specs?, assert_closes_on_revoke?}`.
|
|
699
706
|
A consumer registry closes on the revoke when its route joined it to the
|
|
700
707
|
backend's closer (`ctx.deps.connection_closer.add(create_sse_connection_closer(registry, role))`)
|
|
701
|
-
or when the suite's `on_audit_event` option wires a guard (e.g. `
|
|
708
|
+
or when the suite's `on_audit_event` option wires a guard (e.g. `create_revocation_guard` over `create_sse_connection_closer(registry, role)`); with
|
|
702
709
|
neither, the revoke assertion fails.
|
|
703
710
|
|
|
704
711
|
Frame reading is delegated to the shared `create_sse_frame_reader`
|
|
@@ -710,16 +717,16 @@ streaming `fetch` body.
|
|
|
710
717
|
### `ws_round_trip.ts` — WebSocket harness (non-HTTP)
|
|
711
718
|
|
|
712
719
|
In-process test driver for `register_action_ws`. Consumers pass specs +
|
|
713
|
-
handlers, receive `{
|
|
720
|
+
handlers, receive `{registry, connect()}` back. The full dispatch path is
|
|
714
721
|
exercised (per-action auth, input validation, `ctx.notify`, broadcast via
|
|
715
|
-
`
|
|
722
|
+
`ConnectionRegistry`, close-on-revoke), but Hono's wire upgrade is
|
|
716
723
|
skipped — there is no server, so no runtime adapter; the cross-process suites
|
|
717
724
|
cover real sockets.
|
|
718
725
|
|
|
719
726
|
Three layers:
|
|
720
727
|
|
|
721
|
-
1. **Primitives** — `create_fake_ws(options?)` (a real `WSContext` over capture arrays `sends` / `closes`, plus `socket` — the fake runtime socket behind `ws.raw`, shaped like Node's `ws`: a `bufferedAmount` the
|
|
722
|
-
2. **Harness** — `create_ws_test_harness({actions,
|
|
728
|
+
1. **Primitives** — `create_fake_ws(options?)` (a real `WSContext` over capture arrays `sends` / `closes`, plus `socket` — the fake runtime socket behind `ws.raw`, shaped like Node's `ws`: a `bufferedAmount` the registry's outbound writer reads for backpressure, `stalled` (start it with `{stalled: true}`) to model a client that stopped reading, and `terminate` / `terminated` for the frameless cut; `readyState` reads open until closed or terminated), `create_fake_hono_context(opts)`, `create_stub_upgrade()`, `MinimalActionEnvironment`, `dispatch_ws_message(on_message, event, ws)`. The fake context sets the `ResolvedAuth` the production auth middleware sets (`RESOLVED_AUTH_KEY`, built by `create_test_resolved_auth` — a session's hash as `hash_session_token(auth_session_id)`), because the dispatcher reads the credential through `get_resolved_auth(c)`; a hand-built upgrade context must do the same. `create_stub_upgrade()` stands in for a runtime adapter's `upgradeWebSocket`: it passes a request without `Upgrade: websocket` to `next()`, and records an upgrade request — its real `Context` and the endpoint's events factory — in `upgrades`, answering `200`. So a test can send `app.request('/api/ws', {headers: {upgrade: 'websocket', cookie | authorization, origin, 'x-forwarded-for'}})` through an assembled app's whole middleware chain and build the socket's events from the `Context` that chain produced (`src/test/server/create_app_server_ws_endpoints.dispatch.db.test.ts`); `get_create_events()` still returns the last mounted factory, for a hand-built context.
|
|
729
|
+
2. **Harness** — `create_ws_test_harness({actions, registry?, receive_timeout?, log?, on_socket_open?, on_socket_close?})` → `WsTestHarness`. `connect(identity?)` is async and resolves after the connection is admitted and `on_socket_open` completes, so broadcasts sent immediately after `await harness.connect()` reach the client. The harness pre-bakes its `RequestContext` (`TEST_CONTEXT_PRESET_KEY`), which also skips the admission credential re-read — there are no session or token rows behind a harness identity — so tests of the re-read itself drive `register_action_ws` with a real database and no preset (`src/test/actions/register_action_ws.admission.db.test.ts`). The harness threads its own `create_stub_db()` into the dispatcher's `db` slot so handlers declaring `side_effects: true` execute under the same transaction wrap they would in production (the stub's `transaction(fn)` synchronously calls `fn(stub_db)`); domain deps reach handlers via factory closures, the same way HTTP RPC factories already wire them. Audit fan-out runs through whatever `audit` emitter the consumer supplied to its action factory closure (typically `create_test_audit_emitter()` for unit harnesses).
|
|
723
730
|
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 Zod schemas in `http/jsonrpc.ts` — generic over `params` / `result` / `data` so tests narrow without casts).
|
|
724
731
|
|
|
725
732
|
`WsClient` (in `transports/ws_client.ts`):
|
|
@@ -912,60 +919,6 @@ Bootstrap audit logging is excluded because `create_test_app` doesn't
|
|
|
912
919
|
provide the filesystem token state; covered separately in
|
|
913
920
|
`bootstrap_account.db.test.ts`.
|
|
914
921
|
|
|
915
|
-
### `standard.ts` — `describe_standard_tests`
|
|
916
|
-
|
|
917
|
-
Bundles every DB-backed suite carrying the standard option shape, each
|
|
918
|
-
gated on its relevant config — silent-skip when the gate isn't met:
|
|
919
|
-
|
|
920
|
-
- `integration` — always
|
|
921
|
-
- `admin` — `roles` provided
|
|
922
|
-
- `audit_completeness` — `roles` provided (proxy for consumer admin wiring; `rpc_endpoints` is bundle-required)
|
|
923
|
-
- `bootstrap_success` — `bootstrap.mode === 'live'`
|
|
924
|
-
- `round_trip` — always
|
|
925
|
-
- `rpc_round_trip` — `rpc_endpoints` provided
|
|
926
|
-
- `data_exposure` — always
|
|
927
|
-
- `rate_limiting` — always (owns its own per-test setup, bypasses the fixture protocol — needs `create_route_specs` directly)
|
|
928
|
-
|
|
929
|
-
Realization that lifted the bundle from 2 suites to 8: fold-in cost between
|
|
930
|
-
suites is zero because each `describe_*` block owns its own setup via the
|
|
931
|
-
`{setup_test, surface_source, capabilities}` protocol, so suites whose
|
|
932
|
-
tests need opposite-shaped default DB state (e.g. the bootstrap-success
|
|
933
|
-
suite needs an empty DB while the integration suite needs the
|
|
934
|
-
pre-bootstrapped keeper) coexist in one bundle without cost. Each test
|
|
935
|
-
invokes the right per-test fixture. Consumers wiring the standard surface
|
|
936
|
-
call once instead of seven times; forgetting a suite no longer silently
|
|
937
|
-
loses coverage.
|
|
938
|
-
|
|
939
|
-
`rpc_success_fixtures`, `rpc_skip_methods` and `rpc_input_overrides`
|
|
940
|
-
forward to the RPC round-trip's `success_fixtures`, `skip_methods` and
|
|
941
|
-
`input_overrides` (same options on `describe_standard_cross_process_tests`;
|
|
942
|
-
`describe_spine_cross_suites` also forwards `rpc_input_overrides` to
|
|
943
|
-
`rpc_adversarial`) — `rpc_skip_methods` is the consumer escape hatch for a
|
|
944
|
-
method the generic round-trip can't drive in its test wiring.
|
|
945
|
-
|
|
946
|
-
`StandardTestOptions` requires `create_route_specs` (for rate_limiting) and
|
|
947
|
-
`rpc_endpoints` (for admin/audit_completeness/rpc_round_trip); the admin
|
|
948
|
-
suite's requirement is enforced at the type level so a missing
|
|
949
|
-
`rpc_endpoints` is a compile error rather than a runtime throw. Optional
|
|
950
|
-
`bootstrap` (top-level, same precedent as `rpc_endpoints`) feeds both the
|
|
951
|
-
disabled/surface_only/live wire-shape gating and the bootstrap-success
|
|
952
|
-
suite gate.
|
|
953
|
-
|
|
954
|
-
Attack surface suites stay separate — their option shape is
|
|
955
|
-
`{build, snapshot_path, expected_public_routes, ...}` rather than the
|
|
956
|
-
shared `{setup_test, surface_source, capabilities}`. A peer
|
|
957
|
-
`describe_standard_surface_tests` bundler lives for that side if/when
|
|
958
|
-
needed.
|
|
959
|
-
|
|
960
|
-
Cross-process counterpart: `cross_backend/standard.ts` —
|
|
961
|
-
`describe_standard_cross_process_tests`. Different bundle because three of
|
|
962
|
-
the eight in-process suites don't survive a process boundary
|
|
963
|
-
(`rate_limiting` needs a fresh per-test `TestApp`, `audit_completeness`
|
|
964
|
-
reads FK structure, `bootstrap_success` is one-shot per backend lifecycle);
|
|
965
|
-
the cross-process bundle documents the omissions once upstream so
|
|
966
|
-
per-consumer files don't repeat the bookkeeping. See the Cross-backend
|
|
967
|
-
integration layer §`cross_backend/standard.ts` below.
|
|
968
|
-
|
|
969
922
|
## RPC helpers
|
|
970
923
|
|
|
971
924
|
### `rpc_helpers.ts` — envelope construction + response assertions
|
|
@@ -991,7 +944,7 @@ One-shot transport:
|
|
|
991
944
|
- `headers_to_record(headers)` — snapshot a `Headers` into a lowercased-key `Record<string, string>` (multi-value collapses to the comma-joined form; `Set-Cookie` excluded). Used by `rpc_call` and the conformance table's REST branch to thread response headers through for assertions.
|
|
992
945
|
- `RpcCallArgs` — `{app, path, method, params?, headers?, id?, verb?}`. `verb` defaults to `'POST'`; use `'GET'` for `side_effects: false` methods.
|
|
993
946
|
- `rpc_call_raw(args)` — the same request as `rpc_call`, the response unparsed: `RpcCallRawResult` `{status, headers, body}` with the whole envelope. `parse_rpc_call_result(raw, method)` turns it into an `RpcCallResult`; `rpc_call` is the two composed.
|
|
994
|
-
- `rpc_call(args)` — merges `RPC_CALL_DEFAULT_HEADERS` (`host: 'localhost'`, `origin:
|
|
947
|
+
- `rpc_call(args)` — merges `RPC_CALL_DEFAULT_HEADERS` (`host: 'localhost'`, `origin: TEST_ORIGIN`, `Content-Type: 'application/json'`) under caller headers. Envelope-shape violations throw; JSON-RPC errors return `{ok: false, error}` so callers assert on `error.code` / `error.data.reason`.
|
|
995
948
|
- `rpc_call_typed<T>(args, output_schema)` — parses the success `result` through the schema; throws on envelope failure, error response, or schema mismatch. Use `rpc_call` when the test needs to assert on error shapes.
|
|
996
949
|
- `rpc_call_for_spec<TSpec>(args)` — spec-bound variant: takes `{..., spec, params}` in place of `{..., method, params}`. `params` is typed from `spec.input` and the success `result` is typed from `spec.output` (runtime-validated, same contract as `rpc_call_typed`). Error branch stays untyped (JSON-RPC `error.data` shapes vary per call site). Use at happy-path + denial-path call sites; fall back to `rpc_call` for adversarial tests that send deliberately-malformed params.
|
|
997
950
|
|
|
@@ -1014,7 +967,7 @@ Registry lookups:
|
|
|
1014
967
|
- **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).
|
|
1015
968
|
- correct auth passes (not 401/403)
|
|
1016
969
|
- GET unauthenticated for `side_effects: false` reads
|
|
1017
|
-
2. **RPC adversarial envelopes** — the fixed set `create_rpc_envelope_cases(endpoint, {skip_methods?})` builds, exercising the envelope parse, method lookup, and GET read restriction: non-JSON body → `parse_error`, wrong `jsonrpc` version, missing `jsonrpc` / `method` / `id`, batch array, non-object POST `params` → `invalid_request`, unknown method → `method_not_found`, GET missing `method`/`id` → `invalid_request`, GET invalid-JSON params → `invalid_params`, GET non-object params on **every** read (each of `RPC_NON_OBJECT_PARAMS`: a number, an array, a string, a boolean) → `invalid_params`, GET mutation method → `invalid_request`, plus three ordering cases sent with no credential (an anonymous GET mutation and an anonymous batch, both `invalid_request`, never 401; an anonymous GET with non-object params on a read requiring an identity, the 401 — params validation runs after authorization). Each case is sent by the app its method's auth admits (`select_auth_app`) and pins status, code, echoed `id`, and `data.reason` (exact where the dispatcher sets one, absent otherwise) via `assert_rpc_envelope_refusal`. The cases are data (`RpcEnvelopeCase`) in the hono-free `rpc_envelope_cases.ts`, shared with the cross-process `describe_rpc_adversarial_cross_tests`; `to_rpc_envelope_request` builds a case's request, and `rpc_get_side_effects_reason(method)` is the GET read restriction's reason.
|
|
970
|
+
2. **RPC adversarial envelopes** — the fixed set `create_rpc_envelope_cases(endpoint, {skip_methods?})` builds, exercising the envelope parse, method lookup, and GET read restriction: non-JSON body → `parse_error`, wrong `jsonrpc` version, missing `jsonrpc` / `method` / `id`, a response-shaped body (`{jsonrpc, id, result}`) → `invalid_request` on `id: null`, batch array, non-object POST `params` → `invalid_request`, unknown method → `method_not_found`, GET missing `method`/`id` → `invalid_request`, GET invalid-JSON params → `invalid_params`, GET non-object params on **every** read (each of `RPC_NON_OBJECT_PARAMS`: a number, an array, a string, a boolean) → `invalid_params`, GET mutation method → `invalid_request`, plus three ordering cases sent with no credential (an anonymous GET mutation and an anonymous batch, both `invalid_request`, never 401; an anonymous GET with non-object params on a read requiring an identity, the 401 — params validation runs after authorization). Each case is sent by the app its method's auth admits (`select_auth_app`) and pins status, code, echoed `id`, and `data.reason` (exact where the dispatcher sets one, absent otherwise) via `assert_rpc_envelope_refusal`. The cases are data (`RpcEnvelopeCase`) in the hono-free `rpc_envelope_cases.ts`, shared with the cross-process `describe_rpc_adversarial_cross_tests`; `to_rpc_envelope_request` builds a case's request, and `rpc_get_side_effects_reason(method)` is the GET read restriction's reason.
|
|
1018
971
|
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.
|
|
1019
972
|
|
|
1020
973
|
Skips silently when `surface.rpc_endpoints` is empty. Uses stub deps — no
|
|
@@ -1070,7 +1023,7 @@ file; the dual-spawn and limiter-enabled suites name their own files.
|
|
|
1070
1023
|
`migration_namespaces` for suites needing tables beyond the auth-only
|
|
1071
1024
|
default — the cell parity suite passes `[CELL_MIGRATION_NS]`, and
|
|
1072
1025
|
`create_test_app` provisions a per-test fresh db migrating
|
|
1073
|
-
`[
|
|
1026
|
+
`[AUTH_MIGRATION_NS, ...migration_namespaces]`), and
|
|
1074
1027
|
`default_in_process_suite_options(options)` (emits the full Tier 1 suite
|
|
1075
1028
|
options bag: the `{setup_test, surface_source, capabilities}` triple plus
|
|
1076
1029
|
`session_options` / `create_route_specs` / `rpc_endpoints` pass-through;
|
|
@@ -1130,7 +1083,7 @@ file; the dual-spawn and limiter-enabled suites name their own files.
|
|
|
1130
1083
|
reader (`ws_refusal_body` picks how the front-door table reads a WS
|
|
1131
1084
|
refusal instead); `peer_request` (server-initiated requests — the ActionPeer
|
|
1132
1085
|
`peer/ping` round-trip) is `true` on fuz_app's Rust and TS spine presets
|
|
1133
|
-
(`
|
|
1086
|
+
(`ConnectionRegistry.request_connection`); a backend states it
|
|
1134
1087
|
`true` once it wires the `peer/ping` HTTP + WS mount), `test_if(cond, name, fn)`
|
|
1135
1088
|
for capability-gated cases, and `in_process_capabilities` preset. Only
|
|
1136
1089
|
flags a suite reads are capabilities — a wiring fact that gates nothing is
|
|
@@ -1156,7 +1109,11 @@ file; the dual-spawn and limiter-enabled suites name their own files.
|
|
|
1156
1109
|
plain CRUD would declare `cell_crud: true, cell_relations: false`.
|
|
1157
1110
|
`cell_gated_create` gates `describe_cell_gated_create_cross_tests` +
|
|
1158
1111
|
`describe_cell_moderate_cross_tests` (the parent-aware-creation-authorizer +
|
|
1159
|
-
`cell_moderate` parity proofs)
|
|
1112
|
+
`cell_moderate` parity proofs) and, with `cell_relations`,
|
|
1113
|
+
`describe_cell_grant_steward_cross_tests` (the steward-revoke seam: a scoped
|
|
1114
|
+
`participant` grant stewards its scope under the
|
|
1115
|
+
`test_cell_grant_steward_revoke_authorize` policy mounted beside the create
|
|
1116
|
+
one); unlike `cell_crud`/`cell_relations`
|
|
1160
1117
|
it is **cross-only** (`false` in-process) — `true` only on the reference
|
|
1161
1118
|
spine binaries that live-mount the `test_cell_gated_create_authorize` policy
|
|
1162
1119
|
(the TS spine `full_spine_mount` + the Rust `testing_spine_stub`), since the
|
|
@@ -1209,8 +1166,7 @@ file; the dual-spawn and limiter-enabled suites name their own files.
|
|
|
1209
1166
|
|
|
1210
1167
|
### `cross_backend/standard.ts` — `describe_standard_cross_process_tests`
|
|
1211
1168
|
|
|
1212
|
-
|
|
1213
|
-
cross-process-safe subset in one call:
|
|
1169
|
+
Wires the standard suites that run against a spawned backend in one call:
|
|
1214
1170
|
|
|
1215
1171
|
- `integration` — always
|
|
1216
1172
|
- `admin` — `roles` provided
|
|
@@ -1218,22 +1174,25 @@ cross-process-safe subset in one call:
|
|
|
1218
1174
|
- `rpc_round_trip` — always
|
|
1219
1175
|
- `data_exposure` — always
|
|
1220
1176
|
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1177
|
+
Two in-process suites are omitted by design: `rate_limiting` (needs a fresh
|
|
1178
|
+
per-test `TestApp` for tight rate-limiter overrides; the spawned binary has no
|
|
1179
|
+
restart-per-test budget) and `audit_completeness` (reads FK structure that only
|
|
1180
|
+
the in-process backend exposes; wire-level audit observability lives in the
|
|
1181
|
+
consumer's own audit `.cross.test.ts`). The omission rationale lives in the
|
|
1182
|
+
module doc once instead of repeating in each consumer's `*.cross.test.ts`.
|
|
1183
|
+
|
|
1184
|
+
`rpc_success_fixtures`, `rpc_skip_methods` and `rpc_input_overrides`
|
|
1185
|
+
forward to the RPC round-trip's `success_fixtures`, `skip_methods` and
|
|
1186
|
+
`input_overrides` (`describe_spine_cross_suites` also forwards
|
|
1187
|
+
`rpc_input_overrides` to `rpc_adversarial`) — `rpc_skip_methods` is the
|
|
1188
|
+
consumer escape hatch for a method the generic round-trip can't drive in its
|
|
1189
|
+
test wiring.
|
|
1230
1190
|
|
|
1231
1191
|
Hard-codes the cross-process-safe set with no `skip` knob; if a future
|
|
1232
1192
|
consumer needs partial opt-out, add the knob then.
|
|
1233
|
-
`StandardCrossProcessTestOptions` is
|
|
1234
|
-
|
|
1235
|
-
`
|
|
1236
|
-
the omitted suites.
|
|
1193
|
+
`StandardCrossProcessTestOptions` is the in-process suites' shared options
|
|
1194
|
+
minus their in-process-only knobs (`create_route_specs`,
|
|
1195
|
+
`rate_limiting_app_options`).
|
|
1237
1196
|
|
|
1238
1197
|
### `cross_backend/spine_suites.ts` — `describe_spine_cross_suites`
|
|
1239
1198
|
|
|
@@ -1502,7 +1461,7 @@ capabilities}` protocol every Tier 1 suite uses, so **one case array runs
|
|
|
1502
1461
|
(400 `actor_required`), and per-frame dispatch resolves each frame's
|
|
1503
1462
|
`acting` on both. The leg always sends `?acting=`, so it does not cover that
|
|
1504
1463
|
upgrade refusal; the front-door table's multi-actor row does. The frame is the envelope the HTTP
|
|
1505
|
-
body is (`
|
|
1464
|
+
body is (`serialize_action_result` on TS), so the response reads
|
|
1506
1465
|
`{status, headers: {}, body: frame}` with `status` the code's
|
|
1507
1466
|
`jsonrpc_error_code_to_http_status` (200 for a result) and every row holds
|
|
1508
1467
|
unchanged. What WS loses is headers — the TS DEV-only `X-Fuz-Auth-Debug`
|
|
@@ -1589,12 +1548,11 @@ Real-upgrade WebSocket coverage of a spawned backend — the cross-process
|
|
|
1589
1548
|
counterpart to the in-process `ws_round_trip.ts` harness, kept a separate
|
|
1590
1549
|
call (not folded into `describe_standard_cross_process_tests`) because it
|
|
1591
1550
|
needs raw `base_url` / `ws_path` the standard bundle doesn't carry, mirroring
|
|
1592
|
-
how `describe_ws_round_trip_tests` sits beside `
|
|
1593
|
-
in-process. `describe_cross_process_ws_tests({setup_test, capabilities,
|
|
1551
|
+
how `describe_ws_round_trip_tests` sits beside the in-process suites. `describe_cross_process_ws_tests({setup_test, capabilities,
|
|
1594
1552
|
base_url, ws_path, origin?, rpc_path?, max_message_bytes?, logout_path?,
|
|
1595
1553
|
password_path?, max_tokens?, ws_account_roles?})` opens a live
|
|
1596
1554
|
`WebSocket` via `create_ws_transport` (the `ws` npm package) and asserts
|
|
1597
|
-
cases against the upgrade
|
|
1555
|
+
cases against the upgrade route `register_action_ws` mounts (origin →
|
|
1598
1556
|
`require_auth` → dispatch): authed upgrade round-trips `heartbeat`,
|
|
1599
1557
|
requests sent the moment the socket opens are all answered (both spines admit a
|
|
1600
1558
|
connection only after re-reading its credential; frames that arrive first wait
|
|
@@ -1681,7 +1639,7 @@ completes in the drain's first poll. Unlike `describe_cross_process_ws_tests` (c
|
|
|
1681
1639
|
built from spine primitives only (accounts / role-grants / offers / WS), zero
|
|
1682
1640
|
consumer domain, so it lives here and runs against any backend that wires the
|
|
1683
1641
|
standard RPC actions' `notification_sender` and registers a WS socket: fuz_app's
|
|
1684
|
-
own spine self-tests (`testing_spine_server`, whose `
|
|
1642
|
+
own spine self-tests (`testing_spine_server`, whose `connection_registry` is threaded
|
|
1685
1643
|
as the sender via `spine_rpc_endpoints({notification_sender})`; the Rust
|
|
1686
1644
|
`testing_spine_stub`, which wires it natively) and downstream twin-impl
|
|
1687
1645
|
consumers (fuz_forge's Deno + Rust backends call it as a thin invocation).
|
|
@@ -1704,7 +1662,7 @@ spine binaries' role-gated endpoint with `ws_required_roles` declared.
|
|
|
1704
1662
|
Real-upgrade parity for a **role-gated WebSocket losing its role**: a revoked
|
|
1705
1663
|
global grant of a role an endpoint's `required_roles` lists closes the account's
|
|
1706
1664
|
sockets on that endpoint with `WS_CLOSE_PERMISSION_REVOKED` (and its reason),
|
|
1707
|
-
while the account's ungated socket on the same
|
|
1665
|
+
while the account's ungated socket on the same connection registry stays open,
|
|
1708
1666
|
dispatching, and receiving the account's pushes, and a re-upgrade is refused at
|
|
1709
1667
|
the gate (403); a scoped revoke of a listed role closes nothing — the case
|
|
1710
1668
|
first opens the gated socket on a global grant of `scoped_role` alone, which
|
|
@@ -1733,11 +1691,14 @@ drives the whole round-trip and every outcome (success / `Timeout` / wrong-shape
|
|
|
1733
1691
|
the inbound server-initiated request is answered as soon as it arrives; the
|
|
1734
1692
|
security negatives use the raw `WsClient.send` to inject unsolicited /
|
|
1735
1693
|
cross-connection frames. Cases: the positive round-trip plus
|
|
1736
|
-
unsolicited-response rejection, per-connection id isolation
|
|
1694
|
+
unsolicited-response rejection, per-connection id isolation (a second
|
|
1695
|
+
socket's forged reply for the first's id, then a round-trip on the second
|
|
1696
|
+
socket as a barrier, so the first's timeout is asserted to come after the
|
|
1697
|
+
forged reply was read — never a deadline that ran out first), never-reply
|
|
1737
1698
|
`Timeout`, wrong-shape rejection, an undeclared reply key accepted and dropped
|
|
1738
1699
|
(both spines read the reply forward-compatibly), client-error forwarding, and
|
|
1739
1700
|
the HTTP no-transport path. Gated on `capabilities.peer_request` — `true` on
|
|
1740
|
-
both the Rust spine and the TS spine (the `
|
|
1701
|
+
both the Rust spine and the TS spine (the `ConnectionRegistry.request_connection`
|
|
1741
1702
|
path + `register_action_ws` response correlation); `peer/ping` is a protocol
|
|
1742
1703
|
action (manifest-excluded), so parity is behavioral here, not via the manifest
|
|
1743
1704
|
gate. Cross-process only.
|
|
@@ -1757,11 +1718,29 @@ it — so the suite gates on `capabilities.peer_request`.
|
|
|
1757
1718
|
ws_path})`. The wire literals are independent copies of the producers'
|
|
1758
1719
|
constants, so a value changed on one spine fails here. Cross-process only.
|
|
1759
1720
|
|
|
1721
|
+
### `cross_backend/ws_envelope.ts` — `describe_ws_envelope_cross_tests`
|
|
1722
|
+
|
|
1723
|
+
Real-upgrade parity for the WS read loop's frame envelope — the socket twin of
|
|
1724
|
+
`rpc_adversarial`'s HTTP envelope cases. A frame that is not JSON answers
|
|
1725
|
+
`parse_error`, a scalar or bare-string frame and a batch array each answer
|
|
1726
|
+
`invalid_request`, all with `id: null` and the socket left open; a
|
|
1727
|
+
notification, a stray response matching no server-initiated request, and a
|
|
1728
|
+
`cancel` (unknown id, malformed params, or a request in flight) answer no
|
|
1729
|
+
frame. The in-flight cancel holds a `peer/ping` with
|
|
1730
|
+
`create_holding_peer_ping_responder` (exported from `ws_inbound_dispatch.ts`)
|
|
1731
|
+
and pins that the request still answers under its id — neither spine's
|
|
1732
|
+
`peer/ping` observes its signal, so the cancel's effect is a consumer seam's
|
|
1733
|
+
to pin. Silence is asserted positively: a `heartbeat` probe after the frames,
|
|
1734
|
+
and nothing but its response after the mark. Gated on `capabilities.ws`, the
|
|
1735
|
+
in-flight cancel also on `capabilities.peer_request`.
|
|
1736
|
+
`describe_ws_envelope_cross_tests({setup_test, capabilities, base_url,
|
|
1737
|
+
ws_path})`. Cross-process only.
|
|
1738
|
+
|
|
1760
1739
|
### `cross_backend/ws_outbound_overflow.ts` — `describe_ws_outbound_overflow_cross_tests`
|
|
1761
1740
|
|
|
1762
1741
|
Real-upgrade parity for the **per-connection outbound bound** — the byte
|
|
1763
1742
|
budget both spines hold a WebSocket's waiting frames to
|
|
1764
|
-
(`
|
|
1743
|
+
(`ConnectionRegistry`'s `outbound_queue_bytes`, the Rust `fuz_realtime`
|
|
1765
1744
|
outbound queue; same default, same per-frame charge). The close code and its
|
|
1766
1745
|
reason are wire contract — a client reads `WS_CLOSE_OUTBOUND_OVERFLOW` as "you
|
|
1767
1746
|
fell behind, reconnect" — so this is the pin that runs on both.
|
|
@@ -1789,7 +1768,7 @@ flood action on its WS endpoint.
|
|
|
1789
1768
|
### `cross_backend/ws_connection_cap.ts` — `describe_ws_connection_cap_cross_tests`
|
|
1790
1769
|
|
|
1791
1770
|
Real-upgrade parity for the **per-account WebSocket connection cap** — the
|
|
1792
|
-
evict-oldest policy both spines apply (`
|
|
1771
|
+
evict-oldest policy both spines apply (`ConnectionRegistry`'s
|
|
1793
1772
|
`max_connections_per_account`, the Rust `fuz_realtime` `ConnectionRegistry`).
|
|
1794
1773
|
The close code, its reason, and which socket closes are wire contract — a
|
|
1795
1774
|
client reads `WS_CLOSE_CONNECTION_LIMIT` as "superseded, don't reconnect" — so
|
|
@@ -1800,8 +1779,8 @@ fresh-per-test keeper's session cookies (one account), each answering a
|
|
|
1800
1779
|
`heartbeat` before the next opens (`create_admitted_ws_transport`) so the
|
|
1801
1780
|
backend registered them in order and
|
|
1802
1781
|
"oldest" names the same socket on both spines. Cases: one connection past the
|
|
1803
|
-
cap closes exactly the oldest with `WS_CLOSE_CONNECTION_LIMIT` +
|
|
1804
|
-
`
|
|
1782
|
+
cap closes exactly the oldest with `WS_CLOSE_CONNECTION_LIMIT` +
|
|
1783
|
+
`WS_CLOSE_CONNECTION_LIMIT_REASON` while every other socket, the newest included, keeps
|
|
1805
1784
|
dispatching — and the session then upgrades again (a revoked session couldn't),
|
|
1806
1785
|
superseding the next-oldest; and a socket held open while a cap's worth of
|
|
1807
1786
|
others open and close in sequence is never evicted (a backend that leaks closed
|
|
@@ -1818,14 +1797,18 @@ cross-process only.
|
|
|
1818
1797
|
|
|
1819
1798
|
Parity for the per-account session cap over real HTTP: logging in past
|
|
1820
1799
|
`max_sessions` (default `DEFAULT_MAX_SESSIONS`) never refuses a login and
|
|
1821
|
-
evicts the oldest session
|
|
1800
|
+
evicts the oldest session, and `account_session_list` marks each login's own
|
|
1801
|
+
session `is_current` (none for a bearer or daemon-token caller, even with a
|
|
1802
|
+
session cookie beside the daemon token).
|
|
1822
1803
|
`describe_session_cap_cross_tests({setup_test, max_sessions?, login_path?,
|
|
1823
|
-
status_path?, ws?, ws_account_roles?})` —
|
|
1824
|
-
|
|
1825
|
-
`WS_CLOSE_SESSION_REVOKED` once the evicting
|
|
1826
|
-
is skipped, so a caller passes it only for
|
|
1827
|
-
|
|
1828
|
-
|
|
1804
|
+
status_path?, rpc_path?, ws?, ws_account_actions?, ws_account_roles?})` —
|
|
1805
|
+
pass `ws` (`{base_url, ws_path, origin?}`) to also assert that the evicted
|
|
1806
|
+
session's socket is closed with `WS_CLOSE_SESSION_REVOKED` once the evicting
|
|
1807
|
+
login commits; omitted, that case is skipped, so a caller passes it only for
|
|
1808
|
+
a backend with `capabilities.ws`. `ws_account_actions`
|
|
1809
|
+
(`capabilities.ws_account_actions`) also lists the sessions over a login's
|
|
1810
|
+
socket and asserts its own row is the one current; `ws_account_roles` gives
|
|
1811
|
+
the socket accounts' roles, for a backend whose WS upgrade requires one.
|
|
1829
1812
|
Cross-process only.
|
|
1830
1813
|
|
|
1831
1814
|
### `cross_backend/sse_round_trip.ts` — `describe_cross_process_sse_tests`
|
|
@@ -2052,7 +2035,12 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
|
|
|
2052
2035
|
`createdb`'s stderr, never thrown), `ensure_database_for_url(url, deps?)` (the
|
|
2053
2036
|
database a `postgres:` URL names; anything else left alone),
|
|
2054
2037
|
`with_database_name`, `to_maintenance_database_url`, `redact_database_url`
|
|
2055
|
-
(a URL fit to print), `is_postgres_url
|
|
2038
|
+
(a URL fit to print), `is_postgres_url`, and `empty_owned_database(url,
|
|
2039
|
+
{owned_name, label, hint?})` — drops and recreates the `public` schema of
|
|
2040
|
+
the one database a setup owns (any other name in the URL is refused before
|
|
2041
|
+
connecting), for a backend that does not wipe its own database; a missing
|
|
2042
|
+
database (`3D000`), an unreachable server or a role that cannot connect
|
|
2043
|
+
throws with what to check. The harness creates a database only
|
|
2056
2044
|
when a setup asks, so a test role needs no `CREATEDB` grant otherwise.
|
|
2057
2045
|
- `testing/cross_backend/spawn_backend.ts` — `spawn_backend(config) => BackendHandle`.
|
|
2058
2046
|
Refuses a port that already accepts connections, writes the bootstrap
|
|
@@ -2088,7 +2076,7 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
|
|
|
2088
2076
|
request (`{result}` / `{error}` / `undefined` to swallow), the path
|
|
2089
2077
|
`describe_peer_ping_ws_tests` drives. With no `on_request` the seam is inert
|
|
2090
2078
|
(a server-initiated request flows to `messages` as before).
|
|
2091
|
-
- `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)
|
|
2079
|
+
- `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), returning a `WsTransportClient` — a `WsClient` plus `send_text(text)`, which writes one frame verbatim (a frame that is not JSON)
|
|
2092
2080
|
builds a real-upgrade WS client using the `ws` npm package (optional
|
|
2093
2081
|
peerDep; consumers wiring cross-process tests `npm install --save-dev ws`).
|
|
2094
2082
|
Threads the keeper cookie onto the upgrade so per-action auth succeeds on
|
|
@@ -2121,7 +2109,9 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
|
|
|
2121
2109
|
server's hands **with the handshake** (`pipelined` — written in the same TCP
|
|
2122
2110
|
write as the upgrade request, so before the connection can have been
|
|
2123
2111
|
admitted). Small unfragmented text frames only. Helpers `is_raw_ws_close`,
|
|
2124
|
-
`raw_ws_close_code`, `RAW_WS_OPCODE_TEXT` / `_CLOSE
|
|
2112
|
+
`raw_ws_close_code`, `RAW_WS_OPCODE_TEXT` / `_CLOSE`, and
|
|
2113
|
+
`RAW_WS_UPGRADE_HEADERS` — an upgrade request's headers with RFC 6455's
|
|
2114
|
+
sample key, for probing an upgrade refusal through any HTTP client.
|
|
2125
2115
|
- `testing/transports/raw_http.ts` — `raw_http_exchange(base_url, request_bytes, {read_timeout_ms, until?})`
|
|
2126
2116
|
→ `RawHttpExchange` (`{received, closed_by_server}`): writes caller-built
|
|
2127
2117
|
HTTP/1.1 bytes to a raw `node:net` socket once and reads what the server
|
|
@@ -2137,10 +2127,18 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
|
|
|
2137
2127
|
count, so a response concatenated after a body is seen),
|
|
2138
2128
|
`raw_http_first_status`, `raw_http_header_lines` (headers as CRLF lines),
|
|
2139
2129
|
`raw_http_parse_json` (a body's JSON, `undefined` when it isn't), and
|
|
2140
|
-
`RAW_HTTP_READ_TIMEOUT_MS`, the suites' default read window.
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
`
|
|
2130
|
+
`RAW_HTTP_READ_TIMEOUT_MS`, the suites' default read window.
|
|
2131
|
+
`raw_http_send_head(base_url, {method?, path, headers, content_length,
|
|
2132
|
+
read_timeout_ms?})` (`RawHttpHeadRequest`) is the over-cap probe built on
|
|
2133
|
+
them: the request head alone, declaring `content_length` body bytes and
|
|
2134
|
+
sending none, read until one whole response — so a server that refuses on
|
|
2135
|
+
the declared length answers and one that reads the body first fails on the
|
|
2136
|
+
read timeout. It writes `Host` and `Content-Length` itself (naming either in
|
|
2137
|
+
`headers` throws), defaults nothing else, and throws when no whole response
|
|
2138
|
+
arrives. The body-size, body-size smuggling, credential-header,
|
|
2139
|
+
origin-scope and transport-composition suites share this module; they take
|
|
2140
|
+
the 1 MiB cap they probe from `SPINE_BODY_LIMIT_DEFAULT_BYTES`
|
|
2141
|
+
(`spine_surface_constants.ts`).
|
|
2144
2142
|
- `testing/transports/sse_frame_reader.ts` — `create_sse_frame_reader(reader, default_timeout_ms?)`,
|
|
2145
2143
|
the transport-agnostic SSE framing core over a
|
|
2146
2144
|
`ReadableStreamDefaultReader<Uint8Array>`: `\n\n` framing, per-read timeout,
|
|
@@ -2407,8 +2405,9 @@ resolution on both spines. `xfail` is for a backend known to admit the
|
|
|
2407
2405
|
socket; fuz_app passes none. Given `base_url`, every
|
|
2408
2406
|
probe is written to the socket (`raw_http_exchange`) and an over-cap request
|
|
2409
2407
|
sends its head alone; with `base_url: null` the probes go through the
|
|
2410
|
-
fixture's transport and the WS rows skip
|
|
2411
|
-
|
|
2408
|
+
fixture's transport and only the WS upgrade rows skip — the WS-path rows
|
|
2409
|
+
that ask for no upgrade gate on `capabilities.ws` alone. Not in the standard
|
|
2410
|
+
bundle. fuz_app's in-process leg is `src/test/auth/transport_composition_parity.db.test.ts`.
|
|
2412
2411
|
|
|
2413
2412
|
`cross_backend/narrowed_api_token.ts` — `mint_narrowed_api_token({app,
|
|
2414
2413
|
rpc_path, session_headers, methods, name?})` mints a method-scoped api token
|
|
@@ -2537,7 +2536,10 @@ a `{kind:'ttl', days}` mint returns and stores a bounded `expires_at`
|
|
|
2537
2536
|
(create output + `account_token_list` read-back), `{kind:'eternal'}` stores
|
|
2538
2537
|
NULL, an omitted or out-of-range lifetime 400s identically on both
|
|
2539
2538
|
spines, and a `name` at `API_TOKEN_NAME_LENGTH_MAX` mints and reads back whole
|
|
2540
|
-
while one UTF-16 code unit past it is `invalid_params`.
|
|
2539
|
+
while one UTF-16 code unit past it is `invalid_params`. It also pins the
|
|
2540
|
+
credential legs' order from stored state: a bearer sent beside a winning
|
|
2541
|
+
daemon token keeps `last_used_at` null (never validated), against a token used
|
|
2542
|
+
alone whose touch lands. Exists because the action-manifest parity gate captures no param
|
|
2541
2543
|
schemas while the Rust spine hand-parses params — a spine that silently
|
|
2542
2544
|
dropped the field would answer the same mint with a 200 and an eternal
|
|
2543
2545
|
token; only the stored-state read-back catches it. Ungated (mint + list are
|
|
@@ -2777,12 +2779,12 @@ limiter (the action defaults' windows, the cap replacing both
|
|
|
2777
2779
|
`max_attempts`) shared by RPC and WS, and refuse to boot on a cap without the
|
|
2778
2780
|
flag. Off, neither spine builds an action limiter. Runs under the
|
|
2779
2781
|
`cross_backend_security` dual-spawn beside the login-security suite. The TS
|
|
2780
|
-
spine
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2782
|
+
spine and the Rust stub both charge every classed action — the auth families
|
|
2783
|
+
included — in their dispatchers, after authorization and ahead of params
|
|
2784
|
+
validation. The `account_token_create` cases pin an auth family's class (a
|
|
2785
|
+
malformed `acting` selector, refused by the dispatcher's own params check,
|
|
2786
|
+
still charged), the IP case the WS dispatcher's IP axis, and the `cell_create`
|
|
2787
|
+
cases the account axis of a consumer-shaped spec, RPC and WS — reachable over WS on both spines because
|
|
2786
2788
|
the TS spine serves its full action set on `/api/ws`, as the Rust stub serves
|
|
2787
2789
|
one registry on both transports. The IP case's addresses are fixed per
|
|
2788
2790
|
process and their bucket outlives `_testing_reset`, so a vitest retry of it
|
|
@@ -2790,13 +2792,31 @@ would fail.
|
|
|
2790
2792
|
Cross-process only; fuz_app's own wiring is
|
|
2791
2793
|
`src/test/cross_backend/ws_action_rate_limit.cross.test.ts`.
|
|
2792
2794
|
|
|
2795
|
+
### Timing overrides — `timing_env`
|
|
2796
|
+
|
|
2797
|
+
`audit_sse_keep_alive_ms` and `ws_receive_timeout_ms` on both spine backend
|
|
2798
|
+
configs (`ts_spine_*_backend_config`, `rust_spine_stub_backend_config`) replace
|
|
2799
|
+
the audit stream's keep-alive interval and the WS endpoints' receive timeout,
|
|
2800
|
+
through `timing_env` (`default_backend_configs.ts`), which sets
|
|
2801
|
+
`AUDIT_SSE_KEEP_ALIVE_MS_ENV` (`FUZ_AUDIT_SSE_KEEP_ALIVE_MS`) and
|
|
2802
|
+
`WS_RECEIVE_TIMEOUT_MS_ENV` (`FUZ_WS_RECEIVE_TIMEOUT_MS`) from
|
|
2803
|
+
`spine_surface_constants.ts`. Both spine binaries read them as a positive
|
|
2804
|
+
integer of ms up to 2³¹ − 1 and refuse to boot on anything else; unset keeps
|
|
2805
|
+
the defaults (`SSE_KEEP_ALIVE_INTERVAL_MS`, `DEFAULT_WS_RECEIVE_TIMEOUT`).
|
|
2806
|
+
fuz_app's `cross_backend_timing` project shortens both, so its suites watch
|
|
2807
|
+
each spine's timers fire within seconds.
|
|
2808
|
+
Cross-process only; fuz_app's own wiring is
|
|
2809
|
+
`src/test/cross_backend/sse_keep_alive.cross.test.ts` and
|
|
2810
|
+
`src/test/cross_backend/ws_receive_timeout.cross.test.ts`, under the
|
|
2811
|
+
`cross_backend_timing` project.
|
|
2812
|
+
|
|
2793
2813
|
### Role-gated participation parity — `cross_backend/role_grant_participation.ts`
|
|
2794
2814
|
|
|
2795
2815
|
The role-gated-participation capstone — TS↔Rust agreement that an **app-defined
|
|
2796
2816
|
role is conferred identically** on both spines. A `participant`
|
|
2797
2817
|
(`grant_paths: ['admin']`) app-role is registered on both spines (`spine_roles`
|
|
2798
|
-
in `default_spine_surface.ts` + the Rust `testing_spine_stub`'s `RoleRegistry
|
|
2799
|
-
and
|
|
2818
|
+
in `default_spine_surface.ts` + the Rust `testing_spine_stub`'s `RoleRegistry`,
|
|
2819
|
+
which its auth and cell surfaces both read); the cross legs prove the three conferral properties agree.
|
|
2800
2820
|
|
|
2801
2821
|
**Declarative-max, imperative-as-escape-hatch.** The single-request matrix is
|
|
2802
2822
|
declarative (`conformance_participation_cases.ts`, run via
|
|
@@ -2881,14 +2901,15 @@ binary (the TS analog of the Rust `testing_spine_stub`), so consumers don't
|
|
|
2881
2901
|
re-roll the serve / daemon-info / WS-attach / drain boilerplate:
|
|
2882
2902
|
|
|
2883
2903
|
- `testing/cross_backend/testing_server_core.ts` — `start_testing_server({adapter, daemon_name, host, port, app_version?, build_app})`. Owns the runtime-neutral orchestration: open-host refusal, stale-daemon check, daemon-info write, `serve`, post-serve WS attach, graceful shutdown. Domain-free — the app is the caller's `build_app(context: BuildTestingAppContext): Promise<BuiltTestingApp>` seam (`{app, close}`). WebSocket endpoints mount through `create_app_server`'s `ws_endpoints` on every runtime: the build calls `context.prepare_websocket({max_message_bytes?})`, which asks the adapter for a `PreparedWebsocket` (`{create_upgrade_websocket: (app) => UpgradeWebSocket, attach_to_server?}`) and returns its factory, to pass as `create_upgrade_websocket`; the core runs each `attach_to_server` once `serve` returns (Node's `injectWebSocket`). Shutdown starts the listener's `shutdown` (stop accepting), runs `close` — which must end live WebSockets, as `AppServer.close` does — then awaits the drain, since open sockets would otherwise hold it. Exports the `TestingServerAdapter` (`prepare_websocket: (options?: PrepareWebsocketOptions) => PreparedWebsocket`) / `ServeHandle` / `PreparedWebsocket` / `PrepareWebsocketOptions` / `BuildTestingAppContext` interfaces.
|
|
2884
|
-
- `testing/
|
|
2904
|
+
- `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` (`kill -0`).
|
|
2905
|
+
- `testing/cross_backend/testing_server_node.ts` — `create_node_testing_adapter()` (`@hono/node-server` + `@hono/node-ws`). Optional peer deps (like `ws`); only test binaries import them. Its factory sets the `ws` server's `maxPayload` to twice `max_message_bytes` (default `DEFAULT_WS_MAX_MESSAGE_BYTES`) — `@hono/node-ws` takes no option for it, and `ws`'s own default is 100 MiB — so a grossly oversized message is refused at the frame layer (`WS_CLOSE_MESSAGE_TOO_BIG` with no reason) before it is buffered whole, while one just over the limit reaches the per-message check, which sends `WS_CLOSE_MESSAGE_TOO_BIG_REASON` as every other backend does. Bun's adapter sets the same multiple as its frame cap (see below); Deno takes no frame cap and keeps the per-message check alone.
|
|
2885
2906
|
- `testing/cross_backend/testing_server_deno.ts` — `create_deno_testing_adapter()` (`Deno.serve` + `@hono/deno`, an optional peer dep; `Deno` declared locally so it typechecks under the Node toolchain). Spawn the entry with `--sloppy-imports` (Deno doesn't do `.js`→`.ts`; Gro's loader does, so the Node path needs no flag).
|
|
2886
2907
|
- `testing/cross_backend/testing_server_bun.ts` — `create_bun_testing_adapter()` (`Bun.serve` + `@hono/bun`'s module-level `getConnInfo`, `upgradeWebSocket`, and `websocket`; `Bun.serve` declared locally so it typechecks under the Node toolchain). Needs the optional `@hono/bun` peer dep (the counterpart to Node's `@hono/node-server` + `@hono/node-ws`; `Bun.serve` is built in), and Bun resolves `.js`→`.ts` natively (no flag, unlike Deno). Reuses `create_node_runtime` (Bun implements the `node:fs`/`node:process` surface). WS is module-level + stateless (like Deno) — the `websocket` handler is threaded into `serve`, where `Bun.serve` wants it, so no post-serve attach. It carries `maxPayloadLength` at twice `max_message_bytes` rather than Bun's 16 MiB default: past its cap Bun drops the socket without a close frame (1006), so the headroom leaves a message just over the limit to the per-message check (`WS_CLOSE_MESSAGE_TOO_BIG`, as on Node), while a grossly oversized one is refused before Bun buffers it whole.
|
|
2887
2908
|
- `testing/cross_backend/default_spine_surface.ts` — the canonical no-domain spine surface (account/admin/audit/signup + bootstrap): `spine_session_options`, `spine_roles`, `create_spine_route_specs`, `spine_rpc_endpoints`, `create_spine_surface_spec`. This is the **declared** surface — the `create_standard_rpc_actions` bundle the spec-derived suites auto-enumerate. It passes `daemon_token: true` (both spine binaries mount the daemon-token layer) and leaves `GET /api/surface` at its default, off — the TS spine binary does too, and the Rust `testing_spine_stub` serves none. Shared by the spine_stub cross test, the TS cross tests, and the binary.
|
|
2888
2909
|
- `testing/cross_backend/full_spine_mount.ts` — `build_full_spine_rpc_actions(deps, options)` — the **full** live RPC mount: the declared bundle **plus** the off-declared-surface families the binary live-mounts (`_testing_*` backdoors, the cell verb set, the opt-in `actor_lookup` / `actor_search` resolvers). `build_full_spine_mount(deps, options)` builds it once for both of the binary's endpoints, returning `FullSpineMount` (`{rpc_actions, ws_actions}`): the WS list is `protocol_actions` plus every RPC action not already among them, twinning the Rust `testing_spine_stub`, which serves one registry on RPC and WS (the one difference is `cancel` — a registered protocol action on TS, owned by the read loop on Rust). Single-sources the mount so the binary and the `spine_method_coverage` reconciliation test build the same list. `create_spine_live_rpc_endpoints()` wraps the list, built on stub deps, as one endpoint at `SPINE_RPC_PATH` — the `live_rpc_endpoints` value the conformance table, the differential and the auth-row generator resolve off-surface methods from (no handler built there runs).
|
|
2889
2910
|
- `testing/cross_backend/ts_spine_backend_config.ts` — `ts_spine_node_backend_config()` / `ts_spine_deno_backend_config()` / `ts_spine_bun_backend_config()` presets (in-memory pglet, no external infra), the TS analog of `rust_spine_stub_backend_config()`.
|
|
2890
2911
|
|
|
2891
|
-
fuz_app's own binary wiring (`src/test/cross_backend/testing_spine_server{,_node,_deno,_bun}.ts`) is the worked example: ~one `build_app` over `create_app_backend` + `create_app_server` (`rate_limiters: 'disabled_for_testing'` plus whichever login / action limiters its env toggles built, `build_full_spine_mount`'s two lists on one `rpc_endpoints` entry and two `ws_endpoints` entries — `/api/ws` and the role-gated `SPINE_ROLE_GATED_WS_PATH` — sharing one `
|
|
2912
|
+
fuz_app's own binary wiring (`src/test/cross_backend/testing_spine_server{,_node,_deno,_bun}.ts`) is the worked example: ~one `build_app` over `create_app_backend` + `create_app_server` (`rate_limiters: 'disabled_for_testing'` plus whichever login / action limiters its env toggles built, `build_full_spine_mount`'s two lists on one `rpc_endpoints` entry and two `ws_endpoints` entries — `/api/ws` and the role-gated `SPINE_ROLE_GATED_WS_PATH` — sharing one `registry`, which is also the role-grant-offer `notification_sender`), reusing `default_spine_surface`. `src/test/cross_backend/testing_spine_server.db.test.ts` builds it with the Node adapter in-process and asserts its surface lists both WS endpoints (the gated one with its `required_roles`) and passes the surface invariants. The `_node`/`_deno`/`_bun` entries differ only in which adapter they wire — `build_spine_app` is runtime-agnostic. It leaves `create_app_server`'s `auth_cleanup` off, as the Rust `testing_spine_stub` leaves its twin unscheduled: a background pass would delete rows and write audit rows under a running suite. A consumer's cross-process test binary may schedule it when nothing its suites seed is already expired (the conformance table's `expired_session` principal seeds a backdated session row); an in-process harness leaves it off.
|
|
2892
2913
|
|
|
2893
2914
|
### Live-method coverage reconciliation — `method_coverage.ts`
|
|
2894
2915
|
|