@fuzdev/fuz_app 0.183.0 → 0.185.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/CLAUDE.md +538 -1223
- package/dist/actions/action_codegen.d.ts +1 -1
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +3 -2
- package/dist/actions/connection_closer.d.ts +11 -9
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +11 -9
- package/dist/actions/frontend_rpc_client.d.ts +1 -1
- package/dist/actions/register_action_ws.d.ts +21 -1
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +2 -1
- package/dist/actions/ws_socket_session.d.ts +25 -4
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +81 -25
- package/dist/auth/CLAUDE.md +433 -1048
- package/dist/auth/account_queries.d.ts +1 -1
- package/dist/auth/account_queries.js +1 -1
- package/dist/auth/account_routes.d.ts +4 -5
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +8 -10
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +10 -11
- package/dist/auth/api_token.d.ts +20 -3
- package/dist/auth/api_token.d.ts.map +1 -1
- package/dist/auth/api_token.js +28 -9
- package/dist/auth/api_token_queries.d.ts +2 -2
- package/dist/auth/api_token_queries.js +2 -2
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +3 -2
- package/dist/auth/audit_log_schema.d.ts +15 -9
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +1 -2
- package/dist/auth/auth_guard_resolver.d.ts +1 -1
- package/dist/auth/auth_guard_resolver.js +1 -1
- package/dist/auth/bearer_auth.d.ts +2 -5
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +4 -13
- package/dist/auth/bootstrap_account.d.ts +13 -15
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +9 -11
- package/dist/auth/bootstrap_routes.d.ts +20 -21
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +21 -19
- package/dist/auth/bootstrap_token_store.d.ts +3 -4
- package/dist/auth/bootstrap_token_store.d.ts.map +1 -1
- package/dist/auth/bootstrap_token_store.js +1 -1
- package/dist/auth/cleanup.d.ts +34 -3
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +11 -3
- package/dist/auth/daemon_token.d.ts +5 -1
- package/dist/auth/daemon_token.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.d.ts +12 -8
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +15 -21
- package/dist/auth/deps.d.ts +11 -0
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/invite_queries.d.ts +51 -3
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +81 -6
- package/dist/auth/invite_schema.d.ts +2 -1
- package/dist/auth/invite_schema.d.ts.map +1 -1
- package/dist/auth/middleware.d.ts +2 -3
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +3 -3
- package/dist/auth/request_context.d.ts +3 -3
- package/dist/auth/request_context.js +3 -3
- package/dist/auth/role_grant_offer_actions.d.ts +2 -2
- package/dist/auth/role_grant_offer_actions.js +2 -2
- package/dist/auth/session_cookie.d.ts +82 -174
- package/dist/auth/session_cookie.d.ts.map +1 -1
- package/dist/auth/session_cookie.js +80 -130
- package/dist/auth/session_middleware.d.ts +8 -17
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +14 -23
- package/dist/auth/session_queries.d.ts +9 -14
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +8 -9
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +4 -6
- package/dist/db/CLAUDE.md +5 -3
- package/dist/dev/setup.d.ts +3 -1
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +3 -1
- package/dist/http/CLAUDE.md +315 -768
- package/dist/http/db_routes.d.ts +1 -1
- package/dist/http/db_routes.js +1 -1
- package/dist/http/origin.d.ts +7 -8
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +7 -8
- package/dist/http/pending_effects.d.ts +82 -4
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +82 -4
- package/dist/http/route_result.d.ts +1 -1
- package/dist/http/route_spec.d.ts +17 -14
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/realtime/audit_log_sse.d.ts +1 -1
- package/dist/realtime/sse.d.ts +6 -25
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +4 -25
- package/dist/realtime/sse_constants.d.ts +1 -1
- package/dist/realtime/sse_constants.js +1 -1
- package/dist/server/app_backend.d.ts +4 -5
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +3 -1
- package/dist/server/app_server.d.ts +87 -76
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +111 -91
- package/dist/server/app_server_context.d.ts +1 -2
- package/dist/server/app_server_context.d.ts.map +1 -1
- package/dist/server/env.js +2 -2
- package/dist/server/shutdown_drain.d.ts +69 -0
- package/dist/server/shutdown_drain.d.ts.map +1 -0
- package/dist/server/shutdown_drain.js +77 -0
- package/dist/testing/CLAUDE.md +89 -57
- package/dist/testing/admin_integration.d.ts +4 -5
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +39 -23
- package/dist/testing/app_server.d.ts +3 -8
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +10 -9
- package/dist/testing/attack_surface.d.ts +1 -1
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/audit_completeness.d.ts +2 -3
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +1 -1
- package/dist/testing/cross_backend/bootstrap_backend.d.ts +3 -1
- package/dist/testing/cross_backend/bootstrap_backend.d.ts.map +1 -1
- package/dist/testing/cross_backend/bootstrap_backend.js +5 -1
- package/dist/testing/cross_backend/capability_mounts.d.ts.map +1 -1
- package/dist/testing/cross_backend/capability_mounts.js +16 -11
- package/dist/testing/cross_backend/conformance_table.d.ts +5 -6
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +4 -4
- package/dist/testing/cross_backend/cookie_attributes.js +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +10 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +33 -7
- package/dist/testing/cross_backend/default_backend_configs.d.ts +3 -3
- package/dist/testing/cross_backend/default_spine_surface.d.ts +0 -6
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +4 -9
- package/dist/testing/cross_backend/differential.d.ts +2 -3
- package/dist/testing/cross_backend/differential.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential.js +1 -1
- package/dist/testing/cross_backend/full_spine_mount.d.ts +1 -42
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +45 -4
- package/dist/testing/cross_backend/in_process_setup.d.ts +7 -8
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +10 -13
- package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +3 -4
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.js +2 -2
- package/dist/testing/cross_backend/setup.d.ts +1 -1
- package/dist/testing/cross_backend/spawn_backend.d.ts +14 -0
- package/dist/testing/cross_backend/spawn_backend.d.ts.map +1 -1
- package/dist/testing/cross_backend/spawn_backend.js +56 -8
- package/dist/testing/cross_backend/spine_suites.d.ts +18 -16
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +38 -18
- package/dist/testing/cross_backend/standard.d.ts +19 -84
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.js +8 -23
- package/dist/testing/cross_backend/standard_auth.d.ts +74 -0
- package/dist/testing/cross_backend/standard_auth.d.ts.map +1 -0
- package/dist/testing/cross_backend/standard_auth.js +28 -0
- package/dist/testing/cross_backend/standard_bundle.d.ts +48 -0
- package/dist/testing/cross_backend/standard_bundle.d.ts.map +1 -0
- package/dist/testing/cross_backend/standard_bundle.js +43 -0
- package/dist/testing/cross_backend/testing_credential_read.d.ts +10 -11
- package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_credential_read.js +12 -12
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +46 -30
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +52 -31
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +5 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts +16 -3
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +22 -7
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +6 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +7 -3
- package/dist/testing/daemon_token_rotation.d.ts.map +1 -1
- package/dist/testing/daemon_token_rotation.js +2 -3
- package/dist/testing/error_coverage.d.ts +5 -0
- package/dist/testing/error_coverage.d.ts.map +1 -1
- package/dist/testing/error_coverage.js +2 -1
- package/dist/testing/integration.d.ts +6 -23
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +53 -83
- package/dist/testing/integration_helpers.d.ts +16 -0
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +29 -1
- package/dist/testing/middleware_gate_probes.d.ts +55 -1
- package/dist/testing/middleware_gate_probes.d.ts.map +1 -1
- package/dist/testing/middleware_gate_probes.js +69 -3
- package/dist/testing/rate_limiting.d.ts +2 -3
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +3 -3
- package/dist/testing/rpc_helpers.d.ts +1 -2
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +3 -3
- package/dist/testing/rpc_round_trip.d.ts +2 -3
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +1 -1
- package/dist/testing/sse_round_trip.d.ts +2 -3
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/stubs.d.ts +5 -6
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +10 -8
- package/dist/testing/test_app.d.ts +8 -5
- package/dist/testing/test_app.d.ts.map +1 -1
- package/dist/testing/test_app.js +7 -7
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +3 -0
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +1 -2
- package/package.json +1 -1
|
@@ -1,45 +1,4 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
|
-
/**
|
|
3
|
-
* The **full** live RPC mount for fuz_app's own spine test binary — the
|
|
4
|
-
* complete action set `testing_spine_server.ts` exposes on a single RPC
|
|
5
|
-
* endpoint, in one place.
|
|
6
|
-
*
|
|
7
|
-
* Where `default_spine_surface.ts` defines the **declared** surface
|
|
8
|
-
* (`create_spine_surface_spec` / `spine_rpc_endpoints` — the
|
|
9
|
-
* `create_standard_rpc_actions` bundle the spec-derived suites
|
|
10
|
-
* auto-enumerate), this module defines its superset: the standard bundle
|
|
11
|
-
* **plus** the families the binary live-mounts but keeps off the declared
|
|
12
|
-
* surface —
|
|
13
|
-
*
|
|
14
|
-
* - the `_testing_*` daemon-token backdoors (`create_testing_actions`),
|
|
15
|
-
* - the full cell verb set (CRUD + grant + field + item + audit),
|
|
16
|
-
* - the opt-in `actor_lookup` / `actor_search` resolvers,
|
|
17
|
-
* - the `_testing_origin_check` probe the origin conformance table drives,
|
|
18
|
-
* - the `_testing_credential_read` probe the credential conformance table drives,
|
|
19
|
-
* - the `_testing_shorten_credential_expiry` seam the credential-deadline
|
|
20
|
-
* suite drives,
|
|
21
|
-
* - the `_testing_room_evict` seam the rooms suite drives, over the room
|
|
22
|
-
* registry the WebSocket-only room verbs run on,
|
|
23
|
-
* - the `_testing_action_manifest` backdoor, appended last (it dumps the live
|
|
24
|
-
* method set for the cross-impl manifest-parity gate, so it must enumerate
|
|
25
|
-
* every method above it — and the room verbs, as `transport: 'ws'`).
|
|
26
|
-
*
|
|
27
|
-
* Single-sourcing the mount here lets the binary, the in-process parity
|
|
28
|
-
* setup, and the `spine_method_coverage` reconciliation test all build the
|
|
29
|
-
* same list — so a method can never be mounted in one place and forgotten
|
|
30
|
-
* in another.
|
|
31
|
-
*
|
|
32
|
-
* The binary's WS endpoint serves the same list: `build_full_spine_mount`
|
|
33
|
-
* builds it once and hands the WS mount the protocol actions plus every RPC
|
|
34
|
-
* action, twinning the Rust `testing_spine_stub`, which compiles one action
|
|
35
|
-
* registry and serves it on both transports — plus the room verbs and their
|
|
36
|
-
* notifications, which only the WS endpoint serves (the stub's `ws_only`
|
|
37
|
-
* specs, which its RPC dispatcher refuses). The reconciliation test
|
|
38
|
-
* enumerates `build_full_spine_rpc_actions` with stub deps and asserts the live method set equals the tagged coverage
|
|
39
|
-
* manifest; see `src/test/cross_backend/spine_method_coverage.ts`.
|
|
40
|
-
*
|
|
41
|
-
* @module
|
|
42
|
-
*/
|
|
43
2
|
import type { Action, RpcAction } from '../../actions/action_types.js';
|
|
44
3
|
import { ConnectionRegistry } from '../../actions/connection_registry.js';
|
|
45
4
|
import { RoomRegistry } from '../../actions/room_registry.js';
|
|
@@ -81,7 +40,7 @@ export interface FullSpineMountOptions {
|
|
|
81
40
|
* the off-surface families (`_testing_*` backdoors, cells, actor resolvers).
|
|
82
41
|
*
|
|
83
42
|
* Mirrors the previous inline assembly in `testing_spine_server.ts` exactly —
|
|
84
|
-
* `
|
|
43
|
+
* `session_cookie_name` is pinned to `SESSION_COOKIE_NAME` (the binary's cookie
|
|
85
44
|
* config) and `roles` to `spine_roles` (carrying `cell_editor`), so the only
|
|
86
45
|
* runtime-varying inputs are the daemon-token state and the room registry.
|
|
87
46
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"full_spine_mount.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/full_spine_mount.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"full_spine_mount.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/full_spine_mount.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA6C9B,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAS1E,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAMnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA2C7D;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,GAAI,aAAa,kBAAkB,KAAG,YAC1B,CAAC;AAEpD,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACrC;;;;;;OAMG;IACH,QAAQ,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;IAC9C;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC;CACtC;AASD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,4BAA4B,GACxC,MAAM,OAAO,EACb,SAAS,qBAAqB,KAC5B,KAAK,CAAC,SAAS,CAAwD,CAAC;AAwE3E,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACnC;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,OAAO,EACb,SAAS,qBAAqB,KAC5B,cAYF,CAAC;AAaF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,+BAA+B,QAAO,KAAK,CAAC,eAAe,CAOvE,CAAC"}
|
|
@@ -1,4 +1,46 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* The **full** live RPC mount for fuz_app's own spine test binary — the
|
|
4
|
+
* complete action set `testing_spine_server.ts` exposes on a single RPC
|
|
5
|
+
* endpoint, in one place.
|
|
6
|
+
*
|
|
7
|
+
* Where `default_spine_surface.ts` defines the **declared** surface
|
|
8
|
+
* (`create_spine_surface_spec` / `spine_rpc_endpoints` — the
|
|
9
|
+
* `create_standard_rpc_actions` bundle the spec-derived suites
|
|
10
|
+
* auto-enumerate), this module defines its superset: the standard bundle
|
|
11
|
+
* **plus** the families the binary live-mounts but keeps off the declared
|
|
12
|
+
* surface —
|
|
13
|
+
*
|
|
14
|
+
* - the `_testing_*` daemon-token backdoors (`create_testing_actions`),
|
|
15
|
+
* - the full cell verb set (CRUD + grant + field + item + audit),
|
|
16
|
+
* - the opt-in `actor_lookup` / `actor_search` resolvers,
|
|
17
|
+
* - the `_testing_origin_check` probe the origin conformance table drives,
|
|
18
|
+
* - the `_testing_credential_read` probe the credential conformance table drives,
|
|
19
|
+
* - the `_testing_shorten_credential_expiry` seam the credential-deadline
|
|
20
|
+
* suite drives,
|
|
21
|
+
* - the `_testing_room_evict` seam the rooms suite drives, over the room
|
|
22
|
+
* registry the WebSocket-only room verbs run on,
|
|
23
|
+
* - the `_testing_action_manifest` backdoor, appended last (it dumps the live
|
|
24
|
+
* method set for the cross-impl manifest-parity gate, so it must enumerate
|
|
25
|
+
* every method above it — and the room verbs, as `transport: 'ws'`).
|
|
26
|
+
*
|
|
27
|
+
* Single-sourcing the mount here lets the binary, the in-process parity
|
|
28
|
+
* setup, and the `spine_method_coverage` reconciliation test all build the
|
|
29
|
+
* same list — so a method can never be mounted in one place and forgotten
|
|
30
|
+
* in another.
|
|
31
|
+
*
|
|
32
|
+
* The binary's WS endpoint serves the same list: `build_full_spine_mount`
|
|
33
|
+
* builds it once and hands the WS mount the protocol actions plus every RPC
|
|
34
|
+
* action, twinning the Rust `testing_spine_stub`, which compiles one action
|
|
35
|
+
* registry and serves it on both transports — plus the room verbs and their
|
|
36
|
+
* notifications, which only the WS endpoint serves (the stub's `ws_only`
|
|
37
|
+
* specs, which its RPC dispatcher refuses). The reconciliation test
|
|
38
|
+
* enumerates `build_full_spine_rpc_actions` with stub deps and asserts the live method set equals the tagged coverage
|
|
39
|
+
* manifest; see `src/test/cross_backend/spine_method_coverage.ts`.
|
|
40
|
+
*
|
|
41
|
+
* @module
|
|
42
|
+
*/
|
|
43
|
+
import { SESSION_COOKIE_NAME } from '../../auth/session_cookie.js';
|
|
2
44
|
import { ConnectionRegistry } from '../../actions/connection_registry.js';
|
|
3
45
|
import { peer_ping_action } from '../../actions/peer_ping.js';
|
|
4
46
|
import { protocol_actions } from '../../actions/protocol.js';
|
|
@@ -18,7 +60,7 @@ import { create_testing_credential_read_action } from './testing_credential_read
|
|
|
18
60
|
import { create_testing_origin_check_action } from './testing_origin_check.js';
|
|
19
61
|
import { test_cell_gated_create_authorize } from './test_cell_gated_create_authorize.js';
|
|
20
62
|
import { test_cell_grant_steward_revoke_authorize } from './test_cell_grant_steward_revoke_authorize.js';
|
|
21
|
-
import { spine_roles
|
|
63
|
+
import { spine_roles } from './default_spine_surface.js';
|
|
22
64
|
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
23
65
|
/**
|
|
24
66
|
* The domain tables the spine binary's `_testing_reset` empties beside the
|
|
@@ -56,7 +98,7 @@ export const create_spine_room_registry = (connections) => new RoomRegistry(conn
|
|
|
56
98
|
* the off-surface families (`_testing_*` backdoors, cells, actor resolvers).
|
|
57
99
|
*
|
|
58
100
|
* Mirrors the previous inline assembly in `testing_spine_server.ts` exactly —
|
|
59
|
-
* `
|
|
101
|
+
* `session_cookie_name` is pinned to `SESSION_COOKIE_NAME` (the binary's cookie
|
|
60
102
|
* config) and `roles` to `spine_roles` (carrying `cell_editor`), so the only
|
|
61
103
|
* runtime-varying inputs are the daemon-token state and the room registry.
|
|
62
104
|
*
|
|
@@ -79,7 +121,6 @@ const build_full_spine_actions = (deps, options) => {
|
|
|
79
121
|
const actions = [
|
|
80
122
|
...create_standard_rpc_actions(deps, { roles: spine_roles }),
|
|
81
123
|
...create_testing_actions(deps, {
|
|
82
|
-
session_options: spine_session_options,
|
|
83
124
|
daemon_token_state: options.daemon_token_state,
|
|
84
125
|
reset_state: create_reset_spine_domain_state(room_registry)
|
|
85
126
|
}),
|
|
@@ -107,7 +148,7 @@ const build_full_spine_actions = (deps, options) => {
|
|
|
107
148
|
// cookie name — out of `create_testing_actions` for the same reason
|
|
108
149
|
create_testing_credential_read_action({
|
|
109
150
|
keyring: deps.keyring,
|
|
110
|
-
|
|
151
|
+
session_cookie_name: SESSION_COOKIE_NAME
|
|
111
152
|
}),
|
|
112
153
|
// the credential-deadline suite's shorten-only seam — kept out of
|
|
113
154
|
// `create_testing_actions` for the same reason
|
|
@@ -3,7 +3,6 @@ import type { RouteSpec } from '../../http/route_spec.js';
|
|
|
3
3
|
import type { AppSurfaceSpec } from '../../http/surface.js';
|
|
4
4
|
import type { BootstrapServerOptions } from '../../server/app_server.js';
|
|
5
5
|
import type { AppServerContext } from '../../server/app_server_context.js';
|
|
6
|
-
import type { SessionOptions } from '../../auth/session_cookie.js';
|
|
7
6
|
import { type CreateTestAppOptions, type SuiteAppOptions } from '../test_app.js';
|
|
8
7
|
import { type DbInvariantExclusions } from '../db_invariant_queries.js';
|
|
9
8
|
import { type RpcEndpointsSuiteOption } from '../rpc_helpers.js';
|
|
@@ -71,7 +70,7 @@ export declare const default_in_process_setup: (options: InProcessSetupOptions)
|
|
|
71
70
|
* `{setup_test, surface_source, capabilities}` bundle.
|
|
72
71
|
*/
|
|
73
72
|
export interface DefaultInProcessSuiteOptions {
|
|
74
|
-
|
|
73
|
+
session_cookie_name: string;
|
|
75
74
|
create_route_specs: (ctx: AppServerContext) => Array<RouteSpec>;
|
|
76
75
|
rpc_endpoints?: RpcEndpointsSuiteOption;
|
|
77
76
|
/**
|
|
@@ -125,8 +124,8 @@ export interface DefaultInProcessSuiteOptions {
|
|
|
125
124
|
* Build the full in-process suite bundle in a single helper invocation.
|
|
126
125
|
* Output covers `{setup_test, surface_source, capabilities}` plus every
|
|
127
126
|
* factory input the Tier 1 suites read at their top level
|
|
128
|
-
* (`
|
|
129
|
-
*
|
|
127
|
+
* (`session_cookie_name`, `create_route_specs`, `rpc_endpoints`), and the
|
|
128
|
+
* middleware-gate suite's `base_url` (`null`, no socket) and `max_body_bytes`
|
|
130
129
|
* (`app_options.max_body_size`, `app_options.host_gate`) — so the call site spreads once and adds
|
|
131
130
|
* only suite-specific extras (`roles`, `skip_routes`, `input_overrides`,
|
|
132
131
|
* `db_factories`, ...).
|
|
@@ -134,7 +133,7 @@ export interface DefaultInProcessSuiteOptions {
|
|
|
134
133
|
* ```ts
|
|
135
134
|
* // Suite-extras-free call: helper output is the entire options bag.
|
|
136
135
|
* describe_round_trip_validation(default_in_process_suite_options({
|
|
137
|
-
*
|
|
136
|
+
* session_cookie_name,
|
|
138
137
|
* create_route_specs,
|
|
139
138
|
* rpc_endpoints: [rpc_endpoint_spec],
|
|
140
139
|
* }));
|
|
@@ -142,14 +141,14 @@ export interface DefaultInProcessSuiteOptions {
|
|
|
142
141
|
* // With suite-specific extras: spread and add.
|
|
143
142
|
* describe_standard_admin_integration_tests({
|
|
144
143
|
* ...default_in_process_suite_options({
|
|
145
|
-
*
|
|
144
|
+
* session_cookie_name, create_route_specs, rpc_endpoints,
|
|
146
145
|
* extra_keeper_roles: [MY_APP_ROLE],
|
|
147
146
|
* }),
|
|
148
147
|
* roles,
|
|
149
148
|
* });
|
|
150
149
|
* ```
|
|
151
150
|
*
|
|
152
|
-
* Suites that don't read `
|
|
151
|
+
* Suites that don't read `session_cookie_name` / `rpc_endpoints` at their
|
|
153
152
|
* top level (`round_trip`, `data_exposure`) accept the spread anyway —
|
|
154
153
|
* excess properties on spread sources aren't checked by TS, and the
|
|
155
154
|
* uniform shape keeps consumer call sites mechanical.
|
|
@@ -158,7 +157,7 @@ export declare const default_in_process_suite_options: <const O extends DefaultI
|
|
|
158
157
|
setup_test: SetupTest;
|
|
159
158
|
surface_source: AppSurfaceSpec;
|
|
160
159
|
capabilities: BackendCapabilities;
|
|
161
|
-
|
|
160
|
+
session_cookie_name: O["session_cookie_name"];
|
|
162
161
|
create_route_specs: O["create_route_specs"];
|
|
163
162
|
rpc_endpoints: O["rpc_endpoints"];
|
|
164
163
|
base_url: null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in_process_setup.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/in_process_setup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqB9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"in_process_setup.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/in_process_setup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqB9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAiB3E,OAAO,EAEN,KAAK,oBAAoB,EACzB,KAAK,eAAe,EAEpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAEN,KAAK,qBAAqB,EAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAA2B,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEtF,OAAO,EAMN,KAAK,SAAS,EAEd,KAAK,gBAAgB,EACrB,MAAM,YAAY,CAAC;AAepB;;;;;GAKG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IAClE;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC1D;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9C;;;OAGG;IACH,QAAQ,CAAC,kCAAkC,CAAC,EAAE,OAAO,CAAC;CACtD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,qBAAqB,KAAG,SAgKzE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAC5C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACjD;;;OAGG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC;;;OAGG;IACH,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAC7C;;;OAGG;IACH,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C;;;;;OAKG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CAChC;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,gCAAgC,GAAI,KAAK,CAAC,CAAC,SAAS,4BAA4B,EAC5F,SAAS,CAAC,KACR;IACF,UAAU,EAAE,SAAS,CAAC;IACtB,cAAc,EAAE,cAAc,CAAC;IAC/B,YAAY,EAAE,mBAAmB,CAAC;IAClC,mBAAmB,EAAE,CAAC,CAAC,qBAAqB,CAAC,CAAC;IAC9C,kBAAkB,EAAE,CAAC,CAAC,oBAAoB,CAAC,CAAC;IAC5C,aAAa,EAAE,CAAC,CAAC,eAAe,CAAC,CAAC;IAClC,QAAQ,EAAE,IAAI,CAAC;IACf,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CAsClC,CAAC"}
|
|
@@ -65,11 +65,11 @@ export const default_in_process_setup = (options) => {
|
|
|
65
65
|
// `grant_paths` excludes `'admin'` (e.g. `ROLE_KEEPER`) — see
|
|
66
66
|
// `ExtraAccountSpec` for why this bypass is bootstrap-cradle-only.
|
|
67
67
|
const extra_accounts = {};
|
|
68
|
-
const
|
|
68
|
+
const cookie_name = options.session_cookie_name;
|
|
69
69
|
// where `account_verify` is mounted, for the liveness checks of the
|
|
70
70
|
// dead-credential mints; read only when one runs
|
|
71
71
|
const account_verify_rpc_path = (accessor) => {
|
|
72
|
-
const found = find_rpc_action(resolve_rpc_endpoints_for_setup(options.rpc_endpoints ?? [], options.
|
|
72
|
+
const found = find_rpc_action(resolve_rpc_endpoints_for_setup(options.rpc_endpoints ?? [], options.session_cookie_name), 'account_verify');
|
|
73
73
|
if (!found) {
|
|
74
74
|
throw new Error(`${accessor}: the in-process app mounts no account_verify to prove the credential live`);
|
|
75
75
|
}
|
|
@@ -79,7 +79,6 @@ export const default_in_process_setup = (options) => {
|
|
|
79
79
|
const seeded = await create_test_account_with_credentials({
|
|
80
80
|
db: test_app.backend.deps.db,
|
|
81
81
|
keyring: test_app.backend.keyring,
|
|
82
|
-
session_options: options.session_options,
|
|
83
82
|
password: test_app.backend.deps.password,
|
|
84
83
|
username: spec.username,
|
|
85
84
|
password_value: spec.password_value,
|
|
@@ -119,7 +118,6 @@ export const default_in_process_setup = (options) => {
|
|
|
119
118
|
const { session_cookie } = await mint_test_session({
|
|
120
119
|
db: test_app.backend.deps.db,
|
|
121
120
|
keyring: test_app.backend.keyring,
|
|
122
|
-
session_options: options.session_options,
|
|
123
121
|
account_id: test_app.backend.account.id,
|
|
124
122
|
expires_in_seconds: EXPIRED_SESSION_OFFSET_SECONDS
|
|
125
123
|
});
|
|
@@ -138,7 +136,6 @@ export const default_in_process_setup = (options) => {
|
|
|
138
136
|
const { session_cookie, session_hash } = await mint_test_session({
|
|
139
137
|
db,
|
|
140
138
|
keyring: test_app.backend.keyring,
|
|
141
|
-
session_options: options.session_options,
|
|
142
139
|
account_id,
|
|
143
140
|
expires_in_seconds: AUTH_SESSION_LIFETIME_MS / 1000
|
|
144
141
|
});
|
|
@@ -203,8 +200,8 @@ export const default_in_process_setup = (options) => {
|
|
|
203
200
|
* Build the full in-process suite bundle in a single helper invocation.
|
|
204
201
|
* Output covers `{setup_test, surface_source, capabilities}` plus every
|
|
205
202
|
* factory input the Tier 1 suites read at their top level
|
|
206
|
-
* (`
|
|
207
|
-
*
|
|
203
|
+
* (`session_cookie_name`, `create_route_specs`, `rpc_endpoints`), and the
|
|
204
|
+
* middleware-gate suite's `base_url` (`null`, no socket) and `max_body_bytes`
|
|
208
205
|
* (`app_options.max_body_size`, `app_options.host_gate`) — so the call site spreads once and adds
|
|
209
206
|
* only suite-specific extras (`roles`, `skip_routes`, `input_overrides`,
|
|
210
207
|
* `db_factories`, ...).
|
|
@@ -212,7 +209,7 @@ export const default_in_process_setup = (options) => {
|
|
|
212
209
|
* ```ts
|
|
213
210
|
* // Suite-extras-free call: helper output is the entire options bag.
|
|
214
211
|
* describe_round_trip_validation(default_in_process_suite_options({
|
|
215
|
-
*
|
|
212
|
+
* session_cookie_name,
|
|
216
213
|
* create_route_specs,
|
|
217
214
|
* rpc_endpoints: [rpc_endpoint_spec],
|
|
218
215
|
* }));
|
|
@@ -220,21 +217,21 @@ export const default_in_process_setup = (options) => {
|
|
|
220
217
|
* // With suite-specific extras: spread and add.
|
|
221
218
|
* describe_standard_admin_integration_tests({
|
|
222
219
|
* ...default_in_process_suite_options({
|
|
223
|
-
*
|
|
220
|
+
* session_cookie_name, create_route_specs, rpc_endpoints,
|
|
224
221
|
* extra_keeper_roles: [MY_APP_ROLE],
|
|
225
222
|
* }),
|
|
226
223
|
* roles,
|
|
227
224
|
* });
|
|
228
225
|
* ```
|
|
229
226
|
*
|
|
230
|
-
* Suites that don't read `
|
|
227
|
+
* Suites that don't read `session_cookie_name` / `rpc_endpoints` at their
|
|
231
228
|
* top level (`round_trip`, `data_exposure`) accept the spread anyway —
|
|
232
229
|
* excess properties on spread sources aren't checked by TS, and the
|
|
233
230
|
* uniform shape keeps consumer call sites mechanical.
|
|
234
231
|
*/
|
|
235
232
|
export const default_in_process_suite_options = (options) => ({
|
|
236
233
|
setup_test: default_in_process_setup({
|
|
237
|
-
|
|
234
|
+
session_cookie_name: options.session_cookie_name,
|
|
238
235
|
create_route_specs: options.create_route_specs,
|
|
239
236
|
rpc_endpoints: options.rpc_endpoints,
|
|
240
237
|
bootstrap: options.bootstrap,
|
|
@@ -247,7 +244,7 @@ export const default_in_process_suite_options = (options) => ({
|
|
|
247
244
|
}),
|
|
248
245
|
surface_source: options.surface_source ??
|
|
249
246
|
create_test_app_surface_spec({
|
|
250
|
-
|
|
247
|
+
session_cookie_name: options.session_cookie_name,
|
|
251
248
|
create_route_specs: options.create_route_specs,
|
|
252
249
|
rpc_endpoints: options.rpc_endpoints,
|
|
253
250
|
// Mirror what `create_test_app` → `create_app_server` will mount.
|
|
@@ -262,7 +259,7 @@ export const default_in_process_suite_options = (options) => ({
|
|
|
262
259
|
daemon_token: true
|
|
263
260
|
}),
|
|
264
261
|
capabilities: in_process_capabilities,
|
|
265
|
-
|
|
262
|
+
session_cookie_name: options.session_cookie_name,
|
|
266
263
|
create_route_specs: options.create_route_specs,
|
|
267
264
|
rpc_endpoints: options.rpc_endpoints,
|
|
268
265
|
// in-process: no socket, and the limit `create_app_server` mounts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc_success_fixtures.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/rpc_success_fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"rpc_success_fixtures.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/rpc_success_fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAsC9B,OAAO,KAAK,EAAqB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAOlF,uDAAuD;AACvD,MAAM,WAAW,8BAA8B;IAC9C,gGAAgG;IAChG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iCAAiC,GAC7C,UAAS,8BAAmC,KAC1C,kBAwHF,CAAC"}
|
|
@@ -12,7 +12,8 @@ import '../assert_dev_env.js';
|
|
|
12
12
|
*
|
|
13
13
|
* Spine-generic: the fixtures use only standard RPC actions and the builtin
|
|
14
14
|
* `ROLE_ADMIN`, so any consumer mounting `create_standard_rpc_actions` can
|
|
15
|
-
* pass the map to `
|
|
15
|
+
* pass the map to `describe_spine_cross_suites` or
|
|
16
|
+
* `describe_standard_cross_process_tests` (as
|
|
16
17
|
* `rpc_success_fixtures`) or `describe_rpc_round_trip_tests` (as
|
|
17
18
|
* `success_fixtures`). Each fixture mints
|
|
18
19
|
* its own accounts and calls as one of them, so none touches or calls as the
|
|
@@ -23,7 +23,6 @@ import '../assert_dev_env.js';
|
|
|
23
23
|
import type { RpcAction } from '../../actions/action_types.js';
|
|
24
24
|
import type { ActionSpecUnion } from '../../actions/action_spec.js';
|
|
25
25
|
import type { RoleRegistry } from '../../auth/role_schema.js';
|
|
26
|
-
import type { SessionOptions } from '../../auth/session_cookie.js';
|
|
27
26
|
import type { AppSurfaceSpec, RpcEndpointSpec } from '../../http/surface.js';
|
|
28
27
|
import type { AppServerContext } from '../../server/app_server_context.js';
|
|
29
28
|
/**
|
|
@@ -62,8 +61,8 @@ export interface RustSpineConsumerRpcEndpointsOptions {
|
|
|
62
61
|
}
|
|
63
62
|
/** Options for `create_rust_spine_consumer_surface_spec`. */
|
|
64
63
|
export interface RustSpineConsumerSurfaceSpecOptions extends RustSpineConsumerRpcEndpointsOptions {
|
|
65
|
-
/** The
|
|
66
|
-
readonly
|
|
64
|
+
/** The session cookie's name. */
|
|
65
|
+
readonly session_cookie_name: string;
|
|
67
66
|
/**
|
|
68
67
|
* Whether the server mounts the spine's host gate
|
|
69
68
|
* (`fuz_http::StackOptions::host_gate`, on by default), declared as the
|
|
@@ -91,7 +90,7 @@ export declare const create_rust_spine_consumer_rpc_endpoints: (options: RustSpi
|
|
|
91
90
|
* layer every consumer test binary wires, and — unless `host_gate` is
|
|
92
91
|
* `false` — the host gate's `host` layer.
|
|
93
92
|
*
|
|
94
|
-
* @param options - the consumer's session
|
|
93
|
+
* @param options - the consumer's session cookie name, action specs, extras and roles
|
|
95
94
|
* @returns the surface spec, for `describe_spine_cross_suites`'s `surface_source`
|
|
96
95
|
* @throws Error when an account route shape the Rust router mounts is missing,
|
|
97
96
|
* or an `exclude_methods` entry names no domain spec
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rust_spine_consumer_surface.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/rust_spine_consumer_surface.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAA6B,MAAM,8BAA8B,CAAC;AAM/F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"rust_spine_consumer_surface.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/rust_spine_consumer_surface.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAA6B,MAAM,8BAA8B,CAAC;AAM/F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAK9D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAI3E;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,wDAAyD,CAAC;AAK3F,8DAA8D;AAC9D,MAAM,WAAW,oCAAoC;IACpD;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC7D;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IACzE,yFAAyF;IACzF,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjD,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,6DAA6D;AAC7D,MAAM,WAAW,mCAAoC,SAAQ,oCAAoC;IAChG,iCAAiC;IACjC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,wCAAwC,GACpD,SAAS,oCAAoC,KAC3C,CAAC,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,eAAe,CAAC,CA+BpD,CAAC;AAiCF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uCAAuC,GACnD,SAAS,mCAAmC,KAC1C,cAUA,CAAC"}
|
|
@@ -86,13 +86,13 @@ const create_spine_consumer_route_specs = (ctx) => {
|
|
|
86
86
|
* layer every consumer test binary wires, and — unless `host_gate` is
|
|
87
87
|
* `false` — the host gate's `host` layer.
|
|
88
88
|
*
|
|
89
|
-
* @param options - the consumer's session
|
|
89
|
+
* @param options - the consumer's session cookie name, action specs, extras and roles
|
|
90
90
|
* @returns the surface spec, for `describe_spine_cross_suites`'s `surface_source`
|
|
91
91
|
* @throws Error when an account route shape the Rust router mounts is missing,
|
|
92
92
|
* or an `exclude_methods` entry names no domain spec
|
|
93
93
|
*/
|
|
94
94
|
export const create_rust_spine_consumer_surface_spec = (options) => create_test_app_surface_spec({
|
|
95
|
-
|
|
95
|
+
session_cookie_name: options.session_cookie_name,
|
|
96
96
|
create_route_specs: create_spine_consumer_route_specs,
|
|
97
97
|
rpc_endpoints: create_rust_spine_consumer_rpc_endpoints(options),
|
|
98
98
|
// the binaries mount `bootstrap_router`; `surface_only` declares its shape
|
|
@@ -198,7 +198,7 @@ export interface TestFixture {
|
|
|
198
198
|
* return the ready-to-send `Cookie` header value (`name=value`). The
|
|
199
199
|
* minted `auth_session` row is backdated while the signed cookie payload
|
|
200
200
|
* stays valid — so resolution clears the cookie-payload gate
|
|
201
|
-
* (`
|
|
201
|
+
* (`parse_session_from_cookies`) and is refused at the authoritative DB-row gate
|
|
202
202
|
* (`query_session_get_valid` — `WHERE expires_at > NOW()`). Backs the
|
|
203
203
|
* `expired_session` conformance principal. In-process mints directly via
|
|
204
204
|
* `mint_test_session`; cross-process drives the `_testing_mint_session`
|
|
@@ -30,6 +30,13 @@ import '../assert_dev_env.js';
|
|
|
30
30
|
* a startup failure reports it with the exit code or signal, and an exit
|
|
31
31
|
* after startup that teardown didn't cause is logged with it.
|
|
32
32
|
*
|
|
33
|
+
* Teardown holds the backend to a clean exit: a spine whose graceful
|
|
34
|
+
* shutdown gave up on work still running, or threw, exits `1` (the TS core's
|
|
35
|
+
* `start_testing_server`, the Rust spine's `StartupError::ShutdownGivenUp`),
|
|
36
|
+
* and `teardown` rejects on anything but exit code `0` — naming the backend,
|
|
37
|
+
* its exit code or signal, and its stderr tail — as it does for a backend
|
|
38
|
+
* that exited during the run or had to be killed.
|
|
39
|
+
*
|
|
33
40
|
* Bootstrapping (`POST /api/account/bootstrap`) is a separate concern —
|
|
34
41
|
* the caller composes `bootstrap()` from `testing/transports/bootstrap.ts`
|
|
35
42
|
* against a `FetchTransport` built around `handle.config.base_url`.
|
|
@@ -59,6 +66,13 @@ export interface BackendHandle {
|
|
|
59
66
|
* escalating to SIGKILL after a grace window. Idempotent — later calls
|
|
60
67
|
* await the same exit. A descendant that left the group — spawned detached,
|
|
61
68
|
* or one that called `setsid` — is out of reach and survives teardown.
|
|
69
|
+
*
|
|
70
|
+
* Rejects unless the child exited `0` on the SIGTERM: an exit code other
|
|
71
|
+
* than `0` (a shutdown that gave up or failed), an exit by signal (the
|
|
72
|
+
* SIGKILL escalation among them), an exit before teardown (already
|
|
73
|
+
* logged when it happened), or a group still running when teardown gave
|
|
74
|
+
* up. The error names the backend and the exit, with the stderr tail. The
|
|
75
|
+
* group is torn down either way.
|
|
62
76
|
*/
|
|
63
77
|
readonly teardown: () => Promise<void>;
|
|
64
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn_backend.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/spawn_backend.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B
|
|
1
|
+
{"version":3,"file":"spawn_backend.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/spawn_backend.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAK9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIzD,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC7B,yFAAyF;IACzF,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAgBD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,QAAY,CAAC;AAmE/C;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,KAAG,OAAO,CAAC,OAAO,CAenE,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,MAAM,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM,KAAG,UAmBtD,CAAC;AA8FF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GAAU,QAAQ,aAAa,KAAG,OAAO,CAAC,aAAa,CA2OhF,CAAC"}
|
|
@@ -30,6 +30,13 @@ import '../assert_dev_env.js';
|
|
|
30
30
|
* a startup failure reports it with the exit code or signal, and an exit
|
|
31
31
|
* after startup that teardown didn't cause is logged with it.
|
|
32
32
|
*
|
|
33
|
+
* Teardown holds the backend to a clean exit: a spine whose graceful
|
|
34
|
+
* shutdown gave up on work still running, or threw, exits `1` (the TS core's
|
|
35
|
+
* `start_testing_server`, the Rust spine's `StartupError::ShutdownGivenUp`),
|
|
36
|
+
* and `teardown` rejects on anything but exit code `0` — naming the backend,
|
|
37
|
+
* its exit code or signal, and its stderr tail — as it does for a backend
|
|
38
|
+
* that exited during the run or had to be killed.
|
|
39
|
+
*
|
|
33
40
|
* Bootstrapping (`POST /api/account/bootstrap`) is a separate concern —
|
|
34
41
|
* the caller composes `bootstrap()` from `testing/transports/bootstrap.ts`
|
|
35
42
|
* against a `FetchTransport` built around `handle.config.base_url`.
|
|
@@ -300,6 +307,8 @@ export const spawn_backend = async (config) => {
|
|
|
300
307
|
let exit_info = null;
|
|
301
308
|
let started = false;
|
|
302
309
|
let teardown_invoked = false;
|
|
310
|
+
// an exit after startup that teardown didn't cause — a teardown failure
|
|
311
|
+
let exited_during_run = false;
|
|
303
312
|
// The child leads its own process group (`detached: true`), so its pid is
|
|
304
313
|
// the group id; a descendant stays in the group after the child exits. Once
|
|
305
314
|
// the group is seen empty it is never signalled again: its id is a pid the
|
|
@@ -335,6 +344,7 @@ export const spawn_backend = async (config) => {
|
|
|
335
344
|
// a startup failure is reported by the throw below; an exit teardown
|
|
336
345
|
// caused is expected
|
|
337
346
|
if (started && !teardown_invoked) {
|
|
347
|
+
exited_during_run = true;
|
|
338
348
|
console.error(`spawn_backend(${config.name}): backend exited unexpectedly (${format_exit(code, signal)})` +
|
|
339
349
|
format_stderr_tail());
|
|
340
350
|
}
|
|
@@ -369,12 +379,50 @@ export const spawn_backend = async (config) => {
|
|
|
369
379
|
// already exited, and would hold the port or the database
|
|
370
380
|
signal_group('SIGTERM');
|
|
371
381
|
};
|
|
372
|
-
|
|
373
|
-
|
|
382
|
+
/** Tear the group down, resolving how the wait ended; never rejects. */
|
|
383
|
+
let stopped = null;
|
|
384
|
+
const stop = () => {
|
|
374
385
|
teardown_sync();
|
|
375
386
|
live_teardowns.delete(teardown_sync);
|
|
376
|
-
return (
|
|
387
|
+
return (stopped ??= wait_for_group_exit());
|
|
388
|
+
};
|
|
389
|
+
/** Why the child's exit was not the clean one teardown requires, or `null`. */
|
|
390
|
+
const describe_unclean_exit = (wait) => {
|
|
391
|
+
if (wait === 'gave_up') {
|
|
392
|
+
return `teardown gave up with the process group still running ${TEARDOWN_SIGKILL_GRACE_MS}ms after SIGKILL`;
|
|
393
|
+
}
|
|
394
|
+
if (exit_info === null)
|
|
395
|
+
return 'never exited';
|
|
396
|
+
if (exit_info.kind === 'spawn_error')
|
|
397
|
+
return `failed to spawn (${exit_info.message})`;
|
|
398
|
+
const exit = format_exit(exit_info.code, exit_info.signal);
|
|
399
|
+
if (exited_during_run)
|
|
400
|
+
return `exited during the run (${exit}), before teardown`;
|
|
401
|
+
const clean = exit_info.signal === null && exit_info.code === 0;
|
|
402
|
+
// ahead of the clean check: a child that exited 0 can leave its group
|
|
403
|
+
// running, and the SIGKILL that ended the group is still a failure
|
|
404
|
+
if (wait === 'killed') {
|
|
405
|
+
return clean
|
|
406
|
+
? `exited (${exit}) at teardown, but its process group outlived it and was killed ` +
|
|
407
|
+
`${TEARDOWN_SIGKILL_GRACE_MS}ms after SIGTERM — a descendant that did not exit on SIGTERM`
|
|
408
|
+
: `exited (${exit}) at teardown — its shutdown did not finish within ` +
|
|
409
|
+
`${TEARDOWN_SIGKILL_GRACE_MS}ms of SIGTERM, so its group was killed`;
|
|
410
|
+
}
|
|
411
|
+
if (clean)
|
|
412
|
+
return null;
|
|
413
|
+
if (exit_info.signal !== null) {
|
|
414
|
+
return (`died by ${exit} at teardown — the process did not handle SIGTERM ` +
|
|
415
|
+
'(a wrapper that dies by the signal, e.g. `gro run`)');
|
|
416
|
+
}
|
|
417
|
+
return `exited (${exit}) at teardown, not code=0 — a shutdown that gave up on work still running or failed`;
|
|
377
418
|
};
|
|
419
|
+
let teardown_done = null;
|
|
420
|
+
const teardown = () => (teardown_done ??= stop().then((wait) => {
|
|
421
|
+
const unclean = describe_unclean_exit(wait);
|
|
422
|
+
if (unclean !== null) {
|
|
423
|
+
throw new Error(`spawn_backend(${config.name}): ${unclean}${format_stderr_tail()}`);
|
|
424
|
+
}
|
|
425
|
+
}));
|
|
378
426
|
// Wait for the child and every process left in its group to exit, so callers
|
|
379
427
|
// can be sure the port is free. A backend that ignores SIGTERM — or whose
|
|
380
428
|
// graceful shutdown wedges (e.g. a runtime whose `server.stop()` never
|
|
@@ -390,16 +438,15 @@ export const spawn_backend = async (config) => {
|
|
|
390
438
|
let killed = false;
|
|
391
439
|
while (is_group_running()) {
|
|
392
440
|
const now = Date.now();
|
|
393
|
-
if (now >= give_up_at)
|
|
394
|
-
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
441
|
+
if (now >= give_up_at)
|
|
442
|
+
return 'gave_up';
|
|
397
443
|
if (!killed && now >= kill_at) {
|
|
398
444
|
killed = true;
|
|
399
445
|
signal_group('SIGKILL');
|
|
400
446
|
}
|
|
401
447
|
await sleep(TEARDOWN_POLL_INTERVAL_MS);
|
|
402
448
|
}
|
|
449
|
+
return killed ? 'killed' : 'exited';
|
|
403
450
|
};
|
|
404
451
|
live_teardowns.add(teardown_sync);
|
|
405
452
|
try {
|
|
@@ -410,7 +457,8 @@ export const spawn_backend = async (config) => {
|
|
|
410
457
|
return { config, child, daemon_token, teardown };
|
|
411
458
|
}
|
|
412
459
|
catch (err) {
|
|
413
|
-
|
|
460
|
+
// the startup failure is the report, whatever the exit
|
|
461
|
+
await stop();
|
|
414
462
|
throw new Error(`spawn_backend(${config.name}) failed: ${err.message}${format_stderr_tail()}`);
|
|
415
463
|
}
|
|
416
464
|
};
|