@fuzdev/fuz_app 0.184.0 → 0.186.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 +18 -3
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +36 -5
- package/dist/actions/register_action_ws.d.ts +14 -7
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.d.ts +17 -4
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +41 -7
- package/dist/auth/CLAUDE.md +18 -9
- package/dist/auth/account_queries.d.ts +53 -40
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +57 -50
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +59 -25
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +26 -9
- package/dist/auth/audit_emitter.js +2 -2
- package/dist/auth/audit_log_queries.d.ts +11 -3
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +4 -4
- 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.js +1 -1
- package/dist/auth/auth_ddl.d.ts.map +1 -1
- package/dist/auth/auth_ddl.js +4 -0
- package/dist/auth/cleanup.d.ts +34 -3
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +12 -4
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +35 -0
- package/dist/auth/role_grant_offer_queries.d.ts +13 -13
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +12 -13
- package/dist/auth/role_grant_queries.d.ts +16 -9
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +16 -9
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +15 -0
- package/dist/auth/session_queries.d.ts +24 -0
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +28 -0
- package/dist/db/CLAUDE.md +3 -3
- package/dist/db/cell_ddl.d.ts +8 -3
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +10 -5
- package/dist/http/CLAUDE.md +1 -1
- package/dist/http/body_limit.d.ts +4 -4
- package/dist/http/body_limit.js +4 -4
- package/dist/http/pending_effects.d.ts +8 -4
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/route_spec.d.ts +3 -3
- 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 +2 -2
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse_constants.d.ts +1 -1
- package/dist/realtime/sse_constants.js +1 -1
- package/dist/server/app_server.d.ts +59 -71
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +52 -60
- 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 +197 -66
- package/dist/testing/admin_integration.d.ts +2 -2
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +36 -20
- package/dist/testing/app_server.d.ts +5 -7
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +5 -7
- package/dist/testing/auth_apps.d.ts +3 -1
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +22 -5
- package/dist/testing/cross_backend/backend_config.d.ts +8 -0
- package/dist/testing/cross_backend/backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/backend_log.d.ts +71 -0
- package/dist/testing/cross_backend/backend_log.d.ts.map +1 -0
- package/dist/testing/cross_backend/backend_log.js +134 -0
- package/dist/testing/cross_backend/backend_swap.d.ts +41 -0
- package/dist/testing/cross_backend/backend_swap.d.ts.map +1 -0
- package/dist/testing/cross_backend/backend_swap.js +431 -0
- package/dist/testing/cross_backend/body_size_smuggling.js +3 -3
- 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 +9 -5
- package/dist/testing/cross_backend/conformance_case.d.ts +11 -6
- package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_case.js +4 -0
- package/dist/testing/cross_backend/conformance_principal.d.ts +2 -2
- package/dist/testing/cross_backend/conformance_principal.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_principal.js +27 -10
- 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 +38 -5
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +50 -15
- package/dist/testing/cross_backend/in_process_setup.d.ts +1 -1
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +53 -31
- package/dist/testing/cross_backend/revocation_drivers.d.ts +14 -2
- package/dist/testing/cross_backend/revocation_drivers.d.ts.map +1 -1
- package/dist/testing/cross_backend/revocation_drivers.js +36 -8
- 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_stub_backend_config.d.ts +7 -0
- 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 +4 -2
- package/dist/testing/cross_backend/setup.d.ts +44 -43
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +64 -62
- package/dist/testing/cross_backend/spawn_backend.d.ts +19 -1
- package/dist/testing/cross_backend/spawn_backend.d.ts.map +1 -1
- package/dist/testing/cross_backend/spawn_backend.js +138 -11
- package/dist/testing/cross_backend/spine_suites.d.ts +17 -14
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +37 -15
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +4 -2
- package/dist/testing/cross_backend/standard.d.ts +18 -82
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.js +6 -21
- 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_reset_actions.d.ts +18 -6
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +23 -8
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +7 -30
- 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 +20 -4
- 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/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +4 -3
- package/dist/testing/data_exposure.d.ts +4 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +93 -25
- package/dist/testing/db_invariants.d.ts +5 -5
- package/dist/testing/db_invariants.js +5 -5
- 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 +4 -20
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +49 -79
- 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/logged_errors.d.ts +61 -0
- package/dist/testing/logged_errors.d.ts.map +1 -0
- package/dist/testing/logged_errors.js +285 -0
- 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 +76 -3
- package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
- package/dist/testing/rpc_attack_surface.js +41 -16
- package/dist/testing/stubs.d.ts +5 -1
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +6 -3
- package/dist/testing/test_app.d.ts +39 -9
- package/dist/testing/test_app.d.ts.map +1 -1
- package/dist/testing/test_app.js +70 -12
- package/dist/testing/transports/fetch_transport.d.ts +10 -0
- package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
- package/dist/testing/transports/fetch_transport.js +13 -0
- package/package.json +4 -3
|
@@ -1,53 +1,22 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* - `describe_standard_integration_tests`
|
|
12
|
-
* - `describe_round_trip_validation`
|
|
13
|
-
* - `describe_rpc_round_trip_tests`
|
|
14
|
-
* - `describe_data_exposure_tests`
|
|
15
|
-
*
|
|
16
|
-
* **Gated on `roles`** — included when the consumer supplies a
|
|
17
|
-
* `RoleRegistry`:
|
|
18
|
-
*
|
|
19
|
-
* - `describe_standard_admin_integration_tests`
|
|
20
|
-
*
|
|
21
|
-
* **Suites omitted** — the ones that don't survive a process boundary,
|
|
22
|
-
* documented here so per-consumer files don't have to repeat the
|
|
23
|
-
* bookkeeping:
|
|
24
|
-
*
|
|
25
|
-
* - `describe_rate_limiting_tests` — builds a fresh `TestApp` per test to
|
|
26
|
-
* inject tight per-test rate-limiter overrides. That path requires
|
|
27
|
-
* in-process construction of `Backend` + rate limiter; the spawned
|
|
28
|
-
* binary has neither knob nor restart-per-test budget.
|
|
29
|
-
* - `describe_audit_completeness_tests` — reaches into FK-structural
|
|
30
|
-
* introspection that only the in-process backend exposes. Wire-level
|
|
31
|
-
* audit observability lives in the consumer's own audit `.cross.test.ts`
|
|
32
|
-
* driving `audit_log_list` / `audit_log_role_grant_history`.
|
|
3
|
+
* The standard suites against a spawned backend that fuz_app's transcript
|
|
4
|
+
* differential can't run: `describe_middleware_gate_tests`, whose probes write
|
|
5
|
+
* raw request heads over a socket, and `describe_round_trip_validation`,
|
|
6
|
+
* `describe_rpc_round_trip_tests` and `describe_data_exposure_tests`, which
|
|
7
|
+
* build fixtures outside a test. The standard auth suites, which it can, are
|
|
8
|
+
* `standard_auth.ts`; `describe_standard_cross_process_tests`
|
|
9
|
+
* (`standard_bundle.ts`) runs both in one call.
|
|
33
10
|
*
|
|
34
11
|
* @module
|
|
35
12
|
*/
|
|
36
|
-
import type { RoleRegistry } from '../../auth/role_schema.js';
|
|
37
13
|
import type { AppSurfaceSpec } from '../../http/surface.js';
|
|
38
14
|
import { type RpcSuccessFixtures } from '../rpc_round_trip.js';
|
|
39
15
|
import type { RpcEndpointsSuiteOption } from '../rpc_helpers.js';
|
|
40
|
-
import type { BackendCapabilities } from './capabilities.js';
|
|
41
|
-
import type { UncoveredEntry } from '../error_coverage.js';
|
|
42
16
|
import type { SetupTest, TestFixture } from './setup.js';
|
|
43
17
|
import type { RouteParamValues } from '../schema_generators.js';
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
*
|
|
47
|
-
* The in-process suites' shared options minus their in-process-only knobs
|
|
48
|
-
* (`create_route_specs`, `rate_limiting_app_options`).
|
|
49
|
-
*/
|
|
50
|
-
export interface StandardCrossProcessTestOptions {
|
|
18
|
+
/** Configuration for `describe_standard_cross_tests`. */
|
|
19
|
+
export interface StandardCrossTestOptions {
|
|
51
20
|
/** Per-test fixture-producing function. */
|
|
52
21
|
setup_test: SetupTest;
|
|
53
22
|
/**
|
|
@@ -55,59 +24,27 @@ export interface StandardCrossProcessTestOptions {
|
|
|
55
24
|
* in-process and cross-process tests.
|
|
56
25
|
*/
|
|
57
26
|
surface_source: AppSurfaceSpec;
|
|
58
|
-
/**
|
|
59
|
-
* Backend capability declarations. Forwarded to the one bundled suite
|
|
60
|
-
* that gates on them (`describe_standard_integration_tests`); the other
|
|
61
|
-
* suites in the bundle read no flags and take no capability field.
|
|
62
|
-
*/
|
|
63
|
-
capabilities: BackendCapabilities;
|
|
64
|
-
/** The session cookie's name — read for the session cookie and the factory-form `rpc_endpoints` resolution. */
|
|
27
|
+
/** The session cookie's name — read for the factory-form `rpc_endpoints` resolution. */
|
|
65
28
|
session_cookie_name: string;
|
|
66
|
-
/**
|
|
67
|
-
* RPC endpoint specs — required. The standard integration tests drive
|
|
68
|
-
* `account_verify`, `account_session_*`, `account_token_*` through the
|
|
69
|
-
* RPC surface (and admin tests, when wired, drive role_grant grant/revoke
|
|
70
|
-
* through it too).
|
|
71
|
-
*/
|
|
29
|
+
/** RPC endpoint specs — the RPC round trip drives every method on them. */
|
|
72
30
|
rpc_endpoints: RpcEndpointsSuiteOption;
|
|
73
|
-
/**
|
|
74
|
-
* Role registry from `create_role_registry()`.
|
|
75
|
-
* When provided, the admin integration suite is included.
|
|
76
|
-
*/
|
|
77
|
-
roles?: RoleRegistry;
|
|
78
|
-
/**
|
|
79
|
-
* Path prefix where admin routes are mounted.
|
|
80
|
-
* Default `'/api/admin'`.
|
|
81
|
-
*/
|
|
82
|
-
admin_prefix?: string;
|
|
83
|
-
/**
|
|
84
|
-
* Forwarded to `describe_standard_integration_tests` — overrides the
|
|
85
|
-
* default error-coverage threshold on the scoped REST surface. Set to
|
|
86
|
-
* `0` to skip the assertion entirely.
|
|
87
|
-
*/
|
|
88
|
-
error_coverage_min?: number;
|
|
89
31
|
/**
|
|
90
32
|
* Base URL the spawned backend is reachable at. Forwarded to
|
|
91
|
-
* `
|
|
92
|
-
*
|
|
33
|
+
* `describe_middleware_gate_tests`, whose probes write their request heads
|
|
34
|
+
* to the socket.
|
|
93
35
|
*/
|
|
94
36
|
base_url: string;
|
|
95
37
|
/**
|
|
96
|
-
* Forwarded to `
|
|
38
|
+
* Forwarded to `describe_middleware_gate_tests` — the backend's
|
|
97
39
|
* request-body cap on every counted route but the RPC endpoint, when it
|
|
98
40
|
* isn't the spine default.
|
|
99
41
|
*/
|
|
100
42
|
max_body_bytes?: number;
|
|
101
43
|
/**
|
|
102
|
-
* Forwarded to `
|
|
44
|
+
* Forwarded to `describe_middleware_gate_tests` — the backend's
|
|
103
45
|
* request-body cap on the RPC endpoint, when it isn't `max_body_bytes`.
|
|
104
46
|
*/
|
|
105
47
|
rpc_max_body_bytes?: number;
|
|
106
|
-
/**
|
|
107
|
-
* Forwarded to `describe_standard_integration_tests` — called with the
|
|
108
|
-
* declared error paths of its counted routes it never observed.
|
|
109
|
-
*/
|
|
110
|
-
check_uncovered_errors?: (uncovered: Array<UncoveredEntry>) => void;
|
|
111
48
|
/**
|
|
112
49
|
* Forwarded to `describe_round_trip_validation` as `skip_routes`
|
|
113
50
|
* (`'METHOD /path'` keys). For consumer REST routes whose responses
|
|
@@ -166,9 +103,8 @@ export interface StandardCrossProcessTestOptions {
|
|
|
166
103
|
}>>;
|
|
167
104
|
}
|
|
168
105
|
/**
|
|
169
|
-
* Run the
|
|
170
|
-
*
|
|
171
|
-
* module doc for the suites omitted from this bundle and why.
|
|
106
|
+
* Run the standard suites the transcript can't — the middleware-gate probes,
|
|
107
|
+
* round trip, RPC round trip, data exposure.
|
|
172
108
|
*/
|
|
173
|
-
export declare const
|
|
109
|
+
export declare const describe_standard_cross_tests: (options: StandardCrossTestOptions) => void;
|
|
174
110
|
//# sourceMappingURL=standard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standard.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/standard.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B
|
|
1
|
+
{"version":3,"file":"standard.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/standard.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAiC,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE9F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,yDAAyD;AACzD,MAAM,WAAW,wBAAwB;IACxC,2CAA2C;IAC3C,UAAU,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,wFAAwF;IACxF,mBAAmB,EAAE,MAAM,CAAC;IAC5B,2EAA2E;IAC3E,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvC;;;;;OAKG;IACH,yBAAyB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1C;;;;;OAKG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC;;;;;;;OAOG;IACH,oBAAoB,CAAC,EAAE,kBAAkB,CAAC;IAC1C;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3D;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,GAAG,CAC1B,MAAM,EACN,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CACnF,CAAC;CACF;AAED;;;GAGG;AACH,eAAO,MAAM,6BAA6B,GAAI,SAAS,wBAAwB,KAAG,IAgCjF,CAAC"}
|
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
|
-
import {
|
|
3
|
-
import { describe_standard_admin_integration_tests } from '../admin_integration.js';
|
|
2
|
+
import { describe_middleware_gate_tests } from '../middleware_gate_probes.js';
|
|
4
3
|
import { describe_round_trip_validation } from '../round_trip.js';
|
|
5
4
|
import { describe_rpc_round_trip_tests } from '../rpc_round_trip.js';
|
|
6
5
|
import { describe_data_exposure_tests } from '../data_exposure.js';
|
|
7
6
|
/**
|
|
8
|
-
* Run the
|
|
9
|
-
*
|
|
10
|
-
* module doc for the suites omitted from this bundle and why.
|
|
7
|
+
* Run the standard suites the transcript can't — the middleware-gate probes,
|
|
8
|
+
* round trip, RPC round trip, data exposure.
|
|
11
9
|
*/
|
|
12
|
-
export const
|
|
13
|
-
|
|
10
|
+
export const describe_standard_cross_tests = (options) => {
|
|
11
|
+
describe_middleware_gate_tests({
|
|
14
12
|
setup_test: options.setup_test,
|
|
15
13
|
surface_source: options.surface_source,
|
|
16
|
-
capabilities: options.capabilities,
|
|
17
14
|
session_cookie_name: options.session_cookie_name,
|
|
18
15
|
rpc_endpoints: options.rpc_endpoints,
|
|
19
|
-
error_coverage_min: options.error_coverage_min,
|
|
20
16
|
base_url: options.base_url,
|
|
21
17
|
max_body_bytes: options.max_body_bytes,
|
|
22
|
-
rpc_max_body_bytes: options.rpc_max_body_bytes
|
|
23
|
-
check_uncovered_errors: options.check_uncovered_errors
|
|
18
|
+
rpc_max_body_bytes: options.rpc_max_body_bytes
|
|
24
19
|
});
|
|
25
20
|
describe_round_trip_validation({
|
|
26
21
|
setup_test: options.setup_test,
|
|
@@ -44,14 +39,4 @@ export const describe_standard_cross_process_tests = (options) => {
|
|
|
44
39
|
skip_routes: options.data_exposure_skip_routes,
|
|
45
40
|
param_values: options.param_values
|
|
46
41
|
});
|
|
47
|
-
if (options.roles) {
|
|
48
|
-
describe_standard_admin_integration_tests({
|
|
49
|
-
setup_test: options.setup_test,
|
|
50
|
-
surface_source: options.surface_source,
|
|
51
|
-
session_cookie_name: options.session_cookie_name,
|
|
52
|
-
roles: options.roles,
|
|
53
|
-
rpc_endpoints: options.rpc_endpoints,
|
|
54
|
-
admin_prefix: options.admin_prefix
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
42
|
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* The standard auth suites against a spawned backend:
|
|
4
|
+
* `describe_standard_integration_tests`, and
|
|
5
|
+
* `describe_standard_admin_integration_tests` when the consumer supplies a
|
|
6
|
+
* `RoleRegistry`. Every request they send goes through the fixture
|
|
7
|
+
* transports, each test building its own fixture, so fuz_app's transcript
|
|
8
|
+
* differential runs them — the login, session, token and invite verbs each
|
|
9
|
+
* diffed request by request, and the database each test leaves.
|
|
10
|
+
*
|
|
11
|
+
* The rest of the standard suites — the middleware-gate probes, written to a
|
|
12
|
+
* raw socket, and the round trips and data exposure, which build fixtures
|
|
13
|
+
* outside a test — are `describe_standard_cross_tests` (`standard.ts`);
|
|
14
|
+
* `describe_standard_cross_process_tests` (`standard_bundle.ts`) runs both.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import type { RoleRegistry } from '../../auth/role_schema.js';
|
|
19
|
+
import type { AppSurfaceSpec } from '../../http/surface.js';
|
|
20
|
+
import type { RpcEndpointsSuiteOption } from '../rpc_helpers.js';
|
|
21
|
+
import type { UncoveredEntry } from '../error_coverage.js';
|
|
22
|
+
import type { BackendCapabilities } from './capabilities.js';
|
|
23
|
+
import type { SetupTest } from './setup.js';
|
|
24
|
+
/** Configuration for `describe_standard_auth_cross_tests`. */
|
|
25
|
+
export interface StandardAuthCrossTestOptions {
|
|
26
|
+
/** Per-test fixture-producing function. */
|
|
27
|
+
setup_test: SetupTest;
|
|
28
|
+
/**
|
|
29
|
+
* App surface. Constructed in TS by the consumer; same shape for
|
|
30
|
+
* in-process and cross-process tests.
|
|
31
|
+
*/
|
|
32
|
+
surface_source: AppSurfaceSpec;
|
|
33
|
+
/**
|
|
34
|
+
* Backend capability declarations, read by the integration suite's gated
|
|
35
|
+
* cases.
|
|
36
|
+
*/
|
|
37
|
+
capabilities: BackendCapabilities;
|
|
38
|
+
/** The session cookie's name — read for the session cookie and the factory-form `rpc_endpoints` resolution. */
|
|
39
|
+
session_cookie_name: string;
|
|
40
|
+
/**
|
|
41
|
+
* RPC endpoint specs — required. The integration suite drives
|
|
42
|
+
* `account_verify`, `account_session_*` and `account_token_*` through the
|
|
43
|
+
* RPC surface, and the admin suite, when wired, the admin and role-grant
|
|
44
|
+
* verbs.
|
|
45
|
+
*/
|
|
46
|
+
rpc_endpoints: RpcEndpointsSuiteOption;
|
|
47
|
+
/**
|
|
48
|
+
* Role registry from `create_role_registry()`.
|
|
49
|
+
* When provided, the admin integration suite is included.
|
|
50
|
+
*/
|
|
51
|
+
roles?: RoleRegistry;
|
|
52
|
+
/**
|
|
53
|
+
* Path prefix where admin routes are mounted.
|
|
54
|
+
* Default `'/api/admin'`.
|
|
55
|
+
*/
|
|
56
|
+
admin_prefix?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Forwarded to `describe_standard_integration_tests` — overrides the
|
|
59
|
+
* default error-coverage threshold on the scoped REST surface. Set to
|
|
60
|
+
* `0` to skip the assertion entirely.
|
|
61
|
+
*/
|
|
62
|
+
error_coverage_min?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Forwarded to `describe_standard_integration_tests` — called with the
|
|
65
|
+
* declared error paths of its counted routes it never observed.
|
|
66
|
+
*/
|
|
67
|
+
check_uncovered_errors?: (uncovered: Array<UncoveredEntry>) => void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Run the standard auth suites against a spawned backend — integration, and
|
|
71
|
+
* admin when `roles` is provided.
|
|
72
|
+
*/
|
|
73
|
+
export declare const describe_standard_auth_cross_tests: (options: StandardAuthCrossTestOptions) => void;
|
|
74
|
+
//# sourceMappingURL=standard_auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard_auth.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/standard_auth.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,8DAA8D;AAC9D,MAAM,WAAW,4BAA4B;IAC5C,2CAA2C;IAC3C,UAAU,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B;;;OAGG;IACH,YAAY,EAAE,mBAAmB,CAAC;IAClC,+GAA+G;IAC/G,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;OAGG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,sBAAsB,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACpE;AAED;;;GAGG;AACH,eAAO,MAAM,kCAAkC,GAAI,SAAS,4BAA4B,KAAG,IAoB1F,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
import { describe_standard_integration_tests } from '../integration.js';
|
|
3
|
+
import { describe_standard_admin_integration_tests } from '../admin_integration.js';
|
|
4
|
+
/**
|
|
5
|
+
* Run the standard auth suites against a spawned backend — integration, and
|
|
6
|
+
* admin when `roles` is provided.
|
|
7
|
+
*/
|
|
8
|
+
export const describe_standard_auth_cross_tests = (options) => {
|
|
9
|
+
describe_standard_integration_tests({
|
|
10
|
+
setup_test: options.setup_test,
|
|
11
|
+
surface_source: options.surface_source,
|
|
12
|
+
capabilities: options.capabilities,
|
|
13
|
+
session_cookie_name: options.session_cookie_name,
|
|
14
|
+
rpc_endpoints: options.rpc_endpoints,
|
|
15
|
+
error_coverage_min: options.error_coverage_min,
|
|
16
|
+
check_uncovered_errors: options.check_uncovered_errors
|
|
17
|
+
});
|
|
18
|
+
if (options.roles) {
|
|
19
|
+
describe_standard_admin_integration_tests({
|
|
20
|
+
setup_test: options.setup_test,
|
|
21
|
+
surface_source: options.surface_source,
|
|
22
|
+
session_cookie_name: options.session_cookie_name,
|
|
23
|
+
roles: options.roles,
|
|
24
|
+
rpc_endpoints: options.rpc_endpoints,
|
|
25
|
+
admin_prefix: options.admin_prefix
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* One call wiring the standard suites that run against a spawned backend —
|
|
4
|
+
* the ones whose option shape is `{setup_test, surface_source, capabilities, ...}`
|
|
5
|
+
* and whose bodies fire requests through `fixture.transport` rather than
|
|
6
|
+
* touching the in-process `Backend`, for a consumer wiring them outside
|
|
7
|
+
* `describe_spine_cross_suites`, which registers the two halves apart:
|
|
8
|
+
*
|
|
9
|
+
* - `describe_standard_auth_cross_tests` (`standard_auth.ts`) —
|
|
10
|
+
* `describe_standard_integration_tests`, and
|
|
11
|
+
* `describe_standard_admin_integration_tests` when the consumer supplies a
|
|
12
|
+
* `RoleRegistry`
|
|
13
|
+
* - `describe_standard_cross_tests` (`standard.ts`) —
|
|
14
|
+
* `describe_middleware_gate_tests`, `describe_round_trip_validation`,
|
|
15
|
+
* `describe_rpc_round_trip_tests` and `describe_data_exposure_tests`
|
|
16
|
+
*
|
|
17
|
+
* **Suites omitted** — the ones that don't survive a process boundary,
|
|
18
|
+
* documented here so per-consumer files don't have to repeat the
|
|
19
|
+
* bookkeeping:
|
|
20
|
+
*
|
|
21
|
+
* - `describe_rate_limiting_tests` — builds a fresh `TestApp` per test to
|
|
22
|
+
* inject tight per-test rate-limiter overrides. That path requires
|
|
23
|
+
* in-process construction of `Backend` + rate limiter; the spawned
|
|
24
|
+
* binary has neither knob nor restart-per-test budget.
|
|
25
|
+
* - `describe_audit_completeness_tests` — reaches into FK-structural
|
|
26
|
+
* introspection that only the in-process backend exposes. Wire-level
|
|
27
|
+
* audit observability lives in the consumer's own audit `.cross.test.ts`
|
|
28
|
+
* driving `audit_log_list` / `audit_log_role_grant_history`.
|
|
29
|
+
*
|
|
30
|
+
* @module
|
|
31
|
+
*/
|
|
32
|
+
import { type StandardCrossTestOptions } from './standard.js';
|
|
33
|
+
import { type StandardAuthCrossTestOptions } from './standard_auth.js';
|
|
34
|
+
/**
|
|
35
|
+
* Configuration for `describe_standard_cross_process_tests`: both halves'
|
|
36
|
+
* options — the in-process suites' shared options minus their
|
|
37
|
+
* in-process-only knobs (`create_route_specs`, `rate_limiting_app_options`).
|
|
38
|
+
*/
|
|
39
|
+
export interface StandardCrossProcessTestOptions extends StandardAuthCrossTestOptions, StandardCrossTestOptions {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Run the cross-process standard test bundle — the auth suites (integration,
|
|
43
|
+
* admin when `roles` is provided), then the middleware-gate probes, round
|
|
44
|
+
* trip, RPC round trip and data exposure. See the module doc for the suites
|
|
45
|
+
* omitted and why.
|
|
46
|
+
*/
|
|
47
|
+
export declare const describe_standard_cross_process_tests: (options: StandardCrossProcessTestOptions) => void;
|
|
48
|
+
//# sourceMappingURL=standard_bundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard_bundle.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/standard_bundle.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAiC,KAAK,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EAEN,KAAK,4BAA4B,EACjC,MAAM,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,MAAM,WAAW,+BAChB,SAAQ,4BAA4B,EAAE,wBAAwB;CAAG;AAElE;;;;;GAKG;AACH,eAAO,MAAM,qCAAqC,GACjD,SAAS,+BAA+B,KACtC,IAGF,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* One call wiring the standard suites that run against a spawned backend —
|
|
4
|
+
* the ones whose option shape is `{setup_test, surface_source, capabilities, ...}`
|
|
5
|
+
* and whose bodies fire requests through `fixture.transport` rather than
|
|
6
|
+
* touching the in-process `Backend`, for a consumer wiring them outside
|
|
7
|
+
* `describe_spine_cross_suites`, which registers the two halves apart:
|
|
8
|
+
*
|
|
9
|
+
* - `describe_standard_auth_cross_tests` (`standard_auth.ts`) —
|
|
10
|
+
* `describe_standard_integration_tests`, and
|
|
11
|
+
* `describe_standard_admin_integration_tests` when the consumer supplies a
|
|
12
|
+
* `RoleRegistry`
|
|
13
|
+
* - `describe_standard_cross_tests` (`standard.ts`) —
|
|
14
|
+
* `describe_middleware_gate_tests`, `describe_round_trip_validation`,
|
|
15
|
+
* `describe_rpc_round_trip_tests` and `describe_data_exposure_tests`
|
|
16
|
+
*
|
|
17
|
+
* **Suites omitted** — the ones that don't survive a process boundary,
|
|
18
|
+
* documented here so per-consumer files don't have to repeat the
|
|
19
|
+
* bookkeeping:
|
|
20
|
+
*
|
|
21
|
+
* - `describe_rate_limiting_tests` — builds a fresh `TestApp` per test to
|
|
22
|
+
* inject tight per-test rate-limiter overrides. That path requires
|
|
23
|
+
* in-process construction of `Backend` + rate limiter; the spawned
|
|
24
|
+
* binary has neither knob nor restart-per-test budget.
|
|
25
|
+
* - `describe_audit_completeness_tests` — reaches into FK-structural
|
|
26
|
+
* introspection that only the in-process backend exposes. Wire-level
|
|
27
|
+
* audit observability lives in the consumer's own audit `.cross.test.ts`
|
|
28
|
+
* driving `audit_log_list` / `audit_log_role_grant_history`.
|
|
29
|
+
*
|
|
30
|
+
* @module
|
|
31
|
+
*/
|
|
32
|
+
import { describe_standard_cross_tests } from './standard.js';
|
|
33
|
+
import { describe_standard_auth_cross_tests } from './standard_auth.js';
|
|
34
|
+
/**
|
|
35
|
+
* Run the cross-process standard test bundle — the auth suites (integration,
|
|
36
|
+
* admin when `roles` is provided), then the middleware-gate probes, round
|
|
37
|
+
* trip, RPC round trip and data exposure. See the module doc for the suites
|
|
38
|
+
* omitted and why.
|
|
39
|
+
*/
|
|
40
|
+
export const describe_standard_cross_process_tests = (options) => {
|
|
41
|
+
describe_standard_auth_cross_tests(options);
|
|
42
|
+
describe_standard_cross_tests(options);
|
|
43
|
+
};
|
|
@@ -7,6 +7,17 @@ import type { AppDeps } from '../../auth/deps.js';
|
|
|
7
7
|
import type { AuditEmitter } from '../../auth/audit_emitter.js';
|
|
8
8
|
import type { DaemonTokenState } from '../../auth/daemon_token.js';
|
|
9
9
|
import type { Db } from '../../db/db.js';
|
|
10
|
+
/**
|
|
11
|
+
* Restamps a seeded account's session at the wall clock, run right after the
|
|
12
|
+
* account is seeded. The reset seeds every account in one transaction, where
|
|
13
|
+
* `NOW()` is one instant, so the seeded sessions would tie on `created_at` and
|
|
14
|
+
* a list ordered by it (`admin_session_list`) would break the tie by the
|
|
15
|
+
* random session hash — a different order per run and per spine. Stamped in
|
|
16
|
+
* seed order, they list the same on both. The Rust reset runs this statement
|
|
17
|
+
* byte for byte (`fuz_testing::testing_reset`); the actor twin is
|
|
18
|
+
* `create_test_extra_actor`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const RESET_SESSION_CLOCK_STAMP_SQL = "UPDATE auth_session SET created_at = clock_timestamp() WHERE account_id = $1";
|
|
10
21
|
/**
|
|
11
22
|
* The `_testing_reset` action spec.
|
|
12
23
|
*
|
|
@@ -153,10 +164,10 @@ export declare const testing_drain_effects_action_spec: {
|
|
|
153
164
|
* auth resolution therefore passes the
|
|
154
165
|
* cookie-payload gate (`parse_session_from_cookies`) and is refused by the authoritative
|
|
155
166
|
* DB-row gate (`query_session_get_valid` — `WHERE expires_at > NOW()`) —
|
|
156
|
-
* the gate the in-process payload-expiry tests never reach
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
167
|
+
* the gate the in-process payload-expiry tests never reach. It forges a dead
|
|
168
|
+
* session no wire path leaves (the database-invariant twin check's session on
|
|
169
|
+
* a deleted account); a session that lived and then expired is the
|
|
170
|
+
* `expired_session` principal's, over `_testing_shorten_credential_expiry`.
|
|
160
171
|
*
|
|
161
172
|
* `auth` gates on the daemon-token credential, matching `_testing_reset` —
|
|
162
173
|
* effectively keeper-only. Like its siblings the action is internally
|
|
@@ -601,8 +612,9 @@ export declare const testing_shorten_credential_expiry_action_spec: {
|
|
|
601
612
|
* and `api_token` row of the account gets `LEAST(expires_at, NOW() + seconds)`,
|
|
602
613
|
* so nothing moves later and an eternal token gains an expiry.
|
|
603
614
|
*
|
|
604
|
-
* Shared by the action and the in-process fixture's `mint_expired_token
|
|
605
|
-
* both fixtures expire a
|
|
615
|
+
* Shared by the action and the in-process fixture's `mint_expired_token` and
|
|
616
|
+
* `mint_expired_session`, so both fixtures expire a credential with one
|
|
617
|
+
* statement. Unbounded here; the
|
|
606
618
|
* action's input holds `seconds` to its range.
|
|
607
619
|
*
|
|
608
620
|
* @param db - the database, a request transaction or the pool
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing_reset_actions.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_reset_actions.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"testing_reset_actions.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_reset_actions.ts"],"names":[],"mappings":"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"}
|
|
@@ -5,8 +5,9 @@ import '../assert_dev_env.js';
|
|
|
5
5
|
* The daemon-token-authed actions bundled by `create_testing_actions`:
|
|
6
6
|
* **`_testing_reset`** (DB wipe + keeper re-seed), **`_testing_drain_effects`**
|
|
7
7
|
* (effects barrier), **`_testing_mint_session`** (forge an
|
|
8
|
-
* expired-by-construction server-side session
|
|
9
|
-
*
|
|
8
|
+
* expired-by-construction server-side session on any account, a dead session
|
|
9
|
+
* no wire path leaves — the database-invariant twin check's session on a
|
|
10
|
+
* deleted account), **`_testing_put_fact`** (seed an embedded fact for the fact-serving
|
|
10
11
|
* suite), **`_testing_schema_snapshot`** (introspect the live schema for
|
|
11
12
|
* cross-impl parity diffing against a Rust backend's `fuz_db` snapshot),
|
|
12
13
|
* **`_testing_migration_tracker`** (dump the `schema_version` tracker rows for
|
|
@@ -105,6 +106,17 @@ const SeededAccountShape = object({
|
|
|
105
106
|
api_token: string,
|
|
106
107
|
session_cookie: string
|
|
107
108
|
});
|
|
109
|
+
/**
|
|
110
|
+
* Restamps a seeded account's session at the wall clock, run right after the
|
|
111
|
+
* account is seeded. The reset seeds every account in one transaction, where
|
|
112
|
+
* `NOW()` is one instant, so the seeded sessions would tie on `created_at` and
|
|
113
|
+
* a list ordered by it (`admin_session_list`) would break the tie by the
|
|
114
|
+
* random session hash — a different order per run and per spine. Stamped in
|
|
115
|
+
* seed order, they list the same on both. The Rust reset runs this statement
|
|
116
|
+
* byte for byte (`fuz_testing::testing_reset`); the actor twin is
|
|
117
|
+
* `create_test_extra_actor`.
|
|
118
|
+
*/
|
|
119
|
+
export const RESET_SESSION_CLOCK_STAMP_SQL = 'UPDATE auth_session SET created_at = clock_timestamp() WHERE account_id = $1';
|
|
108
120
|
/**
|
|
109
121
|
* The `_testing_reset` action spec.
|
|
110
122
|
*
|
|
@@ -220,10 +232,10 @@ export const testing_drain_effects_action_spec = {
|
|
|
220
232
|
* auth resolution therefore passes the
|
|
221
233
|
* cookie-payload gate (`parse_session_from_cookies`) and is refused by the authoritative
|
|
222
234
|
* DB-row gate (`query_session_get_valid` — `WHERE expires_at > NOW()`) —
|
|
223
|
-
* the gate the in-process payload-expiry tests never reach
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
235
|
+
* the gate the in-process payload-expiry tests never reach. It forges a dead
|
|
236
|
+
* session no wire path leaves (the database-invariant twin check's session on
|
|
237
|
+
* a deleted account); a session that lived and then expired is the
|
|
238
|
+
* `expired_session` principal's, over `_testing_shorten_credential_expiry`.
|
|
227
239
|
*
|
|
228
240
|
* `auth` gates on the daemon-token credential, matching `_testing_reset` —
|
|
229
241
|
* effectively keeper-only. Like its siblings the action is internally
|
|
@@ -613,8 +625,9 @@ export const testing_shorten_credential_expiry_action_spec = {
|
|
|
613
625
|
* and `api_token` row of the account gets `LEAST(expires_at, NOW() + seconds)`,
|
|
614
626
|
* so nothing moves later and an eternal token gains an expiry.
|
|
615
627
|
*
|
|
616
|
-
* Shared by the action and the in-process fixture's `mint_expired_token
|
|
617
|
-
* both fixtures expire a
|
|
628
|
+
* Shared by the action and the in-process fixture's `mint_expired_token` and
|
|
629
|
+
* `mint_expired_session`, so both fixtures expire a credential with one
|
|
630
|
+
* statement. Unbounded here; the
|
|
618
631
|
* action's input holds `seconds` to its range.
|
|
619
632
|
*
|
|
620
633
|
* @param db - the database, a request transaction or the pool
|
|
@@ -782,6 +795,7 @@ export const create_testing_actions = (deps, options) => {
|
|
|
782
795
|
password_value: DEFAULT_TEST_PASSWORD,
|
|
783
796
|
roles: [...new Set([...DEFAULT_TEST_KEEPER_ROLES, ...(input.extra_keeper_roles ?? [])])]
|
|
784
797
|
});
|
|
798
|
+
await ctx.db.query(RESET_SESSION_CLOCK_STAMP_SQL, [keeper.account.id]);
|
|
785
799
|
// 6. Refresh the daemon-token cache so subsequent daemon-token
|
|
786
800
|
// requests resolve to the freshly seeded keeper. The
|
|
787
801
|
// middleware never re-reads the keeper, so the reset sets it —
|
|
@@ -807,6 +821,7 @@ export const create_testing_actions = (deps, options) => {
|
|
|
807
821
|
password_value: spec.password_value ?? DEFAULT_TEST_PASSWORD,
|
|
808
822
|
roles: spec.roles
|
|
809
823
|
});
|
|
824
|
+
await ctx.db.query(RESET_SESSION_CLOCK_STAMP_SQL, [seeded.account.id]);
|
|
810
825
|
extras.push(seeded);
|
|
811
826
|
}
|
|
812
827
|
// 8. Seed any additional keeper actors. Same bootstrap-cradle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing_server_bun.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_bun.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA4B9B,OAAO,KAAK,EAAe,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AA0BlF,4CAA4C;AAC5C,eAAO,MAAM,0BAA0B,QAAO,
|
|
1
|
+
{"version":3,"file":"testing_server_bun.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_bun.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA4B9B,OAAO,KAAK,EAAe,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AA0BlF,4CAA4C;AAC5C,eAAO,MAAM,0BAA0B,QAAO,oBA4C7C,CAAC"}
|
|
@@ -61,36 +61,13 @@ export const create_bun_testing_adapter = () => {
|
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
const handle = {
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
// hang), and the client runtime — a single server-closed WS is
|
|
72
|
-
// necessary and sufficient. Client-initiated close or leaving the
|
|
73
|
-
// socket open both stop cleanly in ~0ms. In this suite the trigger is
|
|
74
|
-
// any server-initiated WS close — a revocation's (the WS round-trip suite's
|
|
75
|
-
// close-on-revoke cases), a cap eviction's, an oversized message's —
|
|
76
|
-
// which is why teardown hangs after those and not under HTTP-only or
|
|
77
|
-
// client-closed WS traffic.
|
|
78
|
-
//
|
|
79
|
-
// So initiate a force-close (`true` drops active connections, no
|
|
80
|
-
// drain) but DON'T await it: awaiting hangs `start_testing_server`'s
|
|
81
|
-
// shutdown forever — `built.close()` and `exit(0)` never run, and the
|
|
82
|
-
// spawning harness blocks on a child that never exits (observed as a
|
|
83
|
-
// multi-minute hang needing SIGKILL). The force-close still tears the
|
|
84
|
-
// live sockets down; the `exit(0)` the core fires immediately after
|
|
85
|
-
// does the real teardown a few ms later. Node doesn't need this — its
|
|
86
|
-
// `close()` resolves normally. The `.catch` guards a
|
|
87
|
-
// future Bun that rejects rather than hangs; if a future Bun resolves
|
|
88
|
-
// the promise after a server-initiated close, revert to
|
|
89
|
-
// `await server.stop(true)` to mirror the Node adapter.
|
|
90
|
-
shutdown: () => {
|
|
91
|
-
void Promise.resolve(server.stop(true)).catch(() => { });
|
|
92
|
-
return Promise.resolve();
|
|
93
|
-
}
|
|
64
|
+
// `false` stops accepting and lets the requests in flight finish, as
|
|
65
|
+
// Node's `server.close()` does; `true` would reset them, losing a
|
|
66
|
+
// response the shutdown drain is waiting to send. It settles once
|
|
67
|
+
// every connection is gone: the core's `built.close()` ends the live
|
|
68
|
+
// WebSockets, and a shutdown that gave up skips the wait. Verified on
|
|
69
|
+
// Bun 1.4.4, the tested floor.
|
|
70
|
+
shutdown: () => Promise.resolve(server.stop(false))
|
|
94
71
|
};
|
|
95
72
|
return handle;
|
|
96
73
|
},
|