@fuzdev/fuz_app 0.183.0 → 0.184.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/CLAUDE.md +535 -1223
- package/dist/actions/action_codegen.d.ts +1 -1
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +3 -2
- package/dist/actions/connection_closer.d.ts +11 -9
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +11 -9
- package/dist/actions/frontend_rpc_client.d.ts +1 -1
- package/dist/actions/register_action_ws.d.ts +14 -1
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +2 -1
- package/dist/actions/ws_socket_session.d.ts +9 -1
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +43 -19
- package/dist/auth/CLAUDE.md +430 -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_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/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 +78 -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 +14 -11
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/realtime/sse.d.ts +4 -23
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +4 -25
- package/dist/server/app_backend.d.ts +4 -5
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +3 -1
- package/dist/server/app_server.d.ts +53 -30
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +81 -53
- package/dist/server/app_server_context.d.ts +1 -2
- package/dist/server/app_server_context.d.ts.map +1 -1
- package/dist/server/env.js +2 -2
- package/dist/testing/CLAUDE.md +17 -17
- package/dist/testing/admin_integration.d.ts +2 -3
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +3 -3
- package/dist/testing/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/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/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 +6 -7
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +9 -12
- 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/spine_suites.d.ts +2 -3
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +5 -5
- package/dist/testing/cross_backend/standard.d.ts +2 -3
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.js +3 -3
- package/dist/testing/cross_backend/testing_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 +35 -30
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +39 -31
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +2 -3
- package/dist/testing/daemon_token_rotation.d.ts.map +1 -1
- package/dist/testing/daemon_token_rotation.js +2 -3
- package/dist/testing/integration.d.ts +2 -3
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +4 -4
- 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 +5 -3
- package/dist/testing/test_app.d.ts.map +1 -1
- package/dist/testing/test_app.js +2 -3
- 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
|
@@ -33,7 +33,6 @@ import '../assert_dev_env.js';
|
|
|
33
33
|
*
|
|
34
34
|
* @module
|
|
35
35
|
*/
|
|
36
|
-
import type { SessionOptions } from '../../auth/session_cookie.js';
|
|
37
36
|
import type { RoleRegistry } from '../../auth/role_schema.js';
|
|
38
37
|
import type { AppSurfaceSpec } from '../../http/surface.js';
|
|
39
38
|
import { type RpcSuccessFixtures } from '../rpc_round_trip.js';
|
|
@@ -62,8 +61,8 @@ export interface StandardCrossProcessTestOptions {
|
|
|
62
61
|
* suites in the bundle read no flags and take no capability field.
|
|
63
62
|
*/
|
|
64
63
|
capabilities: BackendCapabilities;
|
|
65
|
-
/**
|
|
66
|
-
|
|
64
|
+
/** The session cookie's name — read for the session cookie and the factory-form `rpc_endpoints` resolution. */
|
|
65
|
+
session_cookie_name: string;
|
|
67
66
|
/**
|
|
68
67
|
* RPC endpoint specs — required. The standard integration tests drive
|
|
69
68
|
* `account_verify`, `account_session_*`, `account_token_*` through the
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"standard.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/standard.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,EAAiC,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE9F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,WAAW,+BAA+B;IAC/C,2CAA2C;IAC3C,UAAU,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B;;;;OAIG;IACH,YAAY,EAAE,mBAAmB,CAAC;IAClC,+GAA+G;IAC/G,mBAAm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F,CAAC"}
|
|
@@ -14,7 +14,7 @@ export const describe_standard_cross_process_tests = (options) => {
|
|
|
14
14
|
setup_test: options.setup_test,
|
|
15
15
|
surface_source: options.surface_source,
|
|
16
16
|
capabilities: options.capabilities,
|
|
17
|
-
|
|
17
|
+
session_cookie_name: options.session_cookie_name,
|
|
18
18
|
rpc_endpoints: options.rpc_endpoints,
|
|
19
19
|
error_coverage_min: options.error_coverage_min,
|
|
20
20
|
base_url: options.base_url,
|
|
@@ -32,7 +32,7 @@ export const describe_standard_cross_process_tests = (options) => {
|
|
|
32
32
|
describe_rpc_round_trip_tests({
|
|
33
33
|
setup_test: options.setup_test,
|
|
34
34
|
surface_source: options.surface_source,
|
|
35
|
-
|
|
35
|
+
session_cookie_name: options.session_cookie_name,
|
|
36
36
|
rpc_endpoints: options.rpc_endpoints,
|
|
37
37
|
skip_methods: options.rpc_skip_methods,
|
|
38
38
|
input_overrides: options.rpc_input_overrides,
|
|
@@ -48,7 +48,7 @@ export const describe_standard_cross_process_tests = (options) => {
|
|
|
48
48
|
describe_standard_admin_integration_tests({
|
|
49
49
|
setup_test: options.setup_test,
|
|
50
50
|
surface_source: options.surface_source,
|
|
51
|
-
|
|
51
|
+
session_cookie_name: options.session_cookie_name,
|
|
52
52
|
roles: options.roles,
|
|
53
53
|
rpc_endpoints: options.rpc_endpoints,
|
|
54
54
|
admin_prefix: options.admin_prefix
|
|
@@ -14,7 +14,6 @@ import '../assert_dev_env.js';
|
|
|
14
14
|
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
15
15
|
import { type RpcAction } from '../../actions/action_types.js';
|
|
16
16
|
import type { Keyring } from '../../auth/keyring.js';
|
|
17
|
-
import { type SessionOptions } from '../../auth/session_cookie.js';
|
|
18
17
|
/**
|
|
19
18
|
* The `data.reason` of every refusal `_testing_credential_read` gives its
|
|
20
19
|
* `lines`: a value that is no list of strings, a list or a line over its cap
|
|
@@ -48,12 +47,12 @@ export declare const TestingCredentialReadInput: import("@fuzdev/fuz_schema/sche
|
|
|
48
47
|
}>;
|
|
49
48
|
export type TestingCredentialReadInput = Infer<typeof TestingCredentialReadInput>;
|
|
50
49
|
/**
|
|
51
|
-
* What a request's `Cookie` lines hold of the session cookie — the
|
|
52
|
-
*
|
|
53
|
-
* lowercase.
|
|
50
|
+
* What a request's `Cookie` lines hold of the session cookie — the `kind` of
|
|
51
|
+
* a `SessionCookieRead` (`parse_session_from_cookies`), the wire form of the
|
|
52
|
+
* Rust spine's `fuz_auth::SessionCookieRead`, its variants in lowercase.
|
|
54
53
|
*/
|
|
55
|
-
export declare const
|
|
56
|
-
export type
|
|
54
|
+
export declare const SessionCookieReadKind: import("@fuzdev/fuz_schema/schema.ts").OneOfSchema<readonly ["absent", "invalid", "valid"]>;
|
|
55
|
+
export type SessionCookieReadKind = Infer<typeof SessionCookieReadKind>;
|
|
57
56
|
/**
|
|
58
57
|
* Output of `_testing_credential_read`, a `@fuzdev/fuz_schema` `object`: how
|
|
59
58
|
* each credential leg reads the lines, before any database work.
|
|
@@ -76,8 +75,8 @@ export type TestingCredentialReadOutput = Infer<typeof TestingCredentialReadOutp
|
|
|
76
75
|
export interface TestingCredentialReadDeps {
|
|
77
76
|
/** The server's cookie keyring. */
|
|
78
77
|
readonly keyring: Keyring;
|
|
79
|
-
/** The server's session
|
|
80
|
-
readonly
|
|
78
|
+
/** The server's session cookie name. */
|
|
79
|
+
readonly session_cookie_name: string;
|
|
81
80
|
}
|
|
82
81
|
/**
|
|
83
82
|
* Split `Name: value` lines into the per-name lines the credential readers
|
|
@@ -93,13 +92,13 @@ export declare const parse_testing_header_lines: (lines: ReadonlyArray<string>)
|
|
|
93
92
|
/**
|
|
94
93
|
* Answer one `_testing_credential_read` input: read each credential out of
|
|
95
94
|
* the lines with the readers the auth middleware legs call
|
|
96
|
-
* (`
|
|
95
|
+
* (`parse_session_from_cookies`,
|
|
97
96
|
* `read_bearer_token`, `read_daemon_token`). The action handler and the
|
|
98
97
|
* conformance table's unit test both call this, so the table checks the same
|
|
99
98
|
* functions the wire serves.
|
|
100
99
|
*
|
|
101
100
|
* @param input - the header lines
|
|
102
|
-
* @param deps - the keyring
|
|
101
|
+
* @param deps - the keyring the cookie is verified with, and its name
|
|
103
102
|
* @returns the reading the Rust twin returns for the same lines
|
|
104
103
|
* @throws ThrownJsonrpcError `invalid_params` for a line `parse_testing_header_lines` refuses
|
|
105
104
|
*/
|
|
@@ -159,7 +158,7 @@ export declare const testing_credential_read_action_spec: {
|
|
|
159
158
|
/**
|
|
160
159
|
* Build the standalone `_testing_credential_read` action (see the spec doc).
|
|
161
160
|
*
|
|
162
|
-
* @param deps - the server's keyring and session
|
|
161
|
+
* @param deps - the server's keyring and session cookie name
|
|
163
162
|
*/
|
|
164
163
|
export declare const create_testing_credential_read_action: (deps: TestingCredentialReadDeps) => RpcAction;
|
|
165
164
|
//# sourceMappingURL=testing_credential_read.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing_credential_read.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_credential_read.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;GAWG;AAEH,OAAO,EAQN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"testing_credential_read.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_credential_read.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;GAWG;AAEH,OAAO,EAQN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAOrD;;;;;;;;;GASG;AACH,eAAO,MAAM,kCAAkC,wBAAwB,CA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AM,yBAAyB,KAAG,SAGtF,CAAC"}
|
|
@@ -14,9 +14,9 @@ import '../assert_dev_env.js';
|
|
|
14
14
|
import { array, max_length, nullable, object, one_of, pipe, string } from '@fuzdev/fuz_schema/schema.ts';
|
|
15
15
|
import { meta } from '@fuzdev/fuz_schema/meta.ts';
|
|
16
16
|
import { rpc_action } from '../../actions/action_types.js';
|
|
17
|
-
import { read_bearer_token, read_daemon_token
|
|
17
|
+
import { read_bearer_token, read_daemon_token } from '../../auth/credential_headers.js';
|
|
18
18
|
import { DAEMON_TOKEN_HEADER } from '../../auth/daemon_token.js';
|
|
19
|
-
import {
|
|
19
|
+
import { parse_session_from_cookies } from '../../auth/session_cookie.js';
|
|
20
20
|
import { trim_optional_whitespace } from '../../http/header_lines.js';
|
|
21
21
|
import { jsonrpc_errors } from '../../http/jsonrpc_errors.js';
|
|
22
22
|
import { bounded_string } from '../../primitive_schemas.js';
|
|
@@ -53,11 +53,11 @@ export const TestingCredentialReadInput = object({
|
|
|
53
53
|
lines: meta(pipe(array(bounded_string({ max: TESTING_CREDENTIAL_READ_LINE_LENGTH_MAX })), max_length(TESTING_CREDENTIAL_READ_LINES_MAX)), { invalid_reason: ERROR_TESTING_CREDENTIAL_READ_LINE })
|
|
54
54
|
});
|
|
55
55
|
/**
|
|
56
|
-
* What a request's `Cookie` lines hold of the session cookie — the
|
|
57
|
-
*
|
|
58
|
-
* lowercase.
|
|
56
|
+
* What a request's `Cookie` lines hold of the session cookie — the `kind` of
|
|
57
|
+
* a `SessionCookieRead` (`parse_session_from_cookies`), the wire form of the
|
|
58
|
+
* Rust spine's `fuz_auth::SessionCookieRead`, its variants in lowercase.
|
|
59
59
|
*/
|
|
60
|
-
export const
|
|
60
|
+
export const SessionCookieReadKind = one_of(['absent', 'invalid', 'valid']);
|
|
61
61
|
/**
|
|
62
62
|
* Output of `_testing_credential_read`, a `@fuzdev/fuz_schema` `object`: how
|
|
63
63
|
* each credential leg reads the lines, before any database work.
|
|
@@ -69,7 +69,7 @@ export const TestingCredentialReadOutput = object({
|
|
|
69
69
|
* the server's keyring and its signed expiry is ahead. Says nothing about
|
|
70
70
|
* the `auth_session` row.
|
|
71
71
|
*/
|
|
72
|
-
session_cookie:
|
|
72
|
+
session_cookie: SessionCookieReadKind,
|
|
73
73
|
/** The API token the bearer leg would look up, or `null` when it reads none. */
|
|
74
74
|
bearer_token: nullable(string),
|
|
75
75
|
/** The daemon token the daemon leg would compare, or `null` when it reads none. */
|
|
@@ -120,21 +120,21 @@ export const parse_testing_header_lines = (lines) => {
|
|
|
120
120
|
/**
|
|
121
121
|
* Answer one `_testing_credential_read` input: read each credential out of
|
|
122
122
|
* the lines with the readers the auth middleware legs call
|
|
123
|
-
* (`
|
|
123
|
+
* (`parse_session_from_cookies`,
|
|
124
124
|
* `read_bearer_token`, `read_daemon_token`). The action handler and the
|
|
125
125
|
* conformance table's unit test both call this, so the table checks the same
|
|
126
126
|
* functions the wire serves.
|
|
127
127
|
*
|
|
128
128
|
* @param input - the header lines
|
|
129
|
-
* @param deps - the keyring
|
|
129
|
+
* @param deps - the keyring the cookie is verified with, and its name
|
|
130
130
|
* @returns the reading the Rust twin returns for the same lines
|
|
131
131
|
* @throws ThrownJsonrpcError `invalid_params` for a line `parse_testing_header_lines` refuses
|
|
132
132
|
*/
|
|
133
133
|
export const run_testing_credential_read = async (input, deps) => {
|
|
134
134
|
const header = parse_testing_header_lines(input.lines);
|
|
135
|
-
const session = await
|
|
135
|
+
const session = await parse_session_from_cookies(header('cookie'), deps.keyring, deps.session_cookie_name);
|
|
136
136
|
return {
|
|
137
|
-
session_cookie: session.
|
|
137
|
+
session_cookie: session.kind,
|
|
138
138
|
bearer_token: read_bearer_token(header('authorization')),
|
|
139
139
|
daemon_token: read_daemon_token(header(DAEMON_TOKEN_HEADER.toLowerCase()))
|
|
140
140
|
};
|
|
@@ -170,6 +170,6 @@ export const testing_credential_read_action_spec = {
|
|
|
170
170
|
/**
|
|
171
171
|
* Build the standalone `_testing_credential_read` action (see the spec doc).
|
|
172
172
|
*
|
|
173
|
-
* @param deps - the server's keyring and session
|
|
173
|
+
* @param deps - the server's keyring and session cookie name
|
|
174
174
|
*/
|
|
175
175
|
export const create_testing_credential_read_action = (deps) => rpc_action(testing_credential_read_action_spec, (input) => run_testing_credential_read(input, deps));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
3
3
|
import { type RpcAction } from '../../actions/action_types.js';
|
|
4
|
+
import { type RequestTracker } from '../../http/pending_effects.js';
|
|
4
5
|
import type { RoomRegistry } from '../../actions/room_registry.js';
|
|
5
6
|
import type { AppDeps } from '../../auth/deps.js';
|
|
6
7
|
import type { AuditEmitter } from '../../auth/audit_emitter.js';
|
|
7
|
-
import type { SessionOptions } from '../../auth/session_cookie.js';
|
|
8
8
|
import type { DaemonTokenState } from '../../auth/daemon_token.js';
|
|
9
9
|
import type { Db } from '../../db/db.js';
|
|
10
10
|
/**
|
|
@@ -91,26 +91,30 @@ export declare const testing_reset_action_spec: {
|
|
|
91
91
|
readonly description: "Test-binary only — wipe auth tables, re-bootstrap a fresh keeper (+ optional extras), fire the domain-state reset.";
|
|
92
92
|
};
|
|
93
93
|
/**
|
|
94
|
-
* `_testing_drain_effects` — await in-flight fire-and-forget
|
|
94
|
+
* `_testing_drain_effects` — await in-flight fire-and-forget work so a
|
|
95
95
|
* following `audit_log_list` or database read is authoritative. The
|
|
96
96
|
* deterministic barrier the cross-backend conformance suite uses in place of
|
|
97
97
|
* a poll/sleep before asserting on audit rows.
|
|
98
98
|
*
|
|
99
|
-
* The handler
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
99
|
+
* The handler waits, repeating until both are empty, for the effect flushes
|
|
100
|
+
* on `AppDeps.request_tracker` (`RequestTracker.drain_flushes`: each
|
|
101
|
+
* request's eager `pending_effects` — the bearer leg's token touch among
|
|
102
|
+
* them — and its post-commit thunks) and for the pool writes of
|
|
103
|
+
* `AppDeps.audit` (`AuditEmitter.drain_inflight`) — a thunk can start an
|
|
104
|
+
* audit write, and a write's listener fan-out runs in a thunk. It matters
|
|
105
|
+
* whatever the transport: both test binaries settle an **HTTP** answer's
|
|
106
|
+
* effects before it responds (the TS binary through
|
|
107
|
+
* `await_pending_effects: true`, the Rust stub through its
|
|
104
108
|
* `await_background_writes_layer`), but a **WS** mutation is answered
|
|
105
109
|
* before its effects flush (reply-then-close for a self-revocation), so its
|
|
106
|
-
* audit write can still be
|
|
107
|
-
* Rust spine
|
|
110
|
+
* audit write or post-commit effect can still be running when the caller
|
|
111
|
+
* reads the reply. The Rust spine awaits the same work on its one tracker,
|
|
112
|
+
* `BackgroundWrites`.
|
|
108
113
|
*
|
|
109
|
-
* Covered: every `emit` that
|
|
110
|
-
* started while it waits.
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* its audit writes, so its drain awaits that too.
|
|
114
|
+
* Covered: every flush and `emit` that started before the drain was
|
|
115
|
+
* dispatched, and any started while it waits. Not a handler still running —
|
|
116
|
+
* the drain's own request is one, and its flush starts only after it answers
|
|
117
|
+
* — nor work that starts after the drain resolves.
|
|
114
118
|
*
|
|
115
119
|
* `auth` gates on the daemon-token credential, matching `_testing_reset`.
|
|
116
120
|
*/
|
|
@@ -147,7 +151,7 @@ export declare const testing_drain_effects_action_spec: {
|
|
|
147
151
|
* The minted `auth_session` row's `expires_at` is backdated while the
|
|
148
152
|
* returned cookie's own signed payload stays valid (future). Cross-process
|
|
149
153
|
* auth resolution therefore passes the
|
|
150
|
-
* cookie-payload gate (`
|
|
154
|
+
* cookie-payload gate (`parse_session_from_cookies`) and is refused by the authoritative
|
|
151
155
|
* DB-row gate (`query_session_get_valid` — `WHERE expires_at > NOW()`) —
|
|
152
156
|
* the gate the in-process payload-expiry tests never reach and the one that
|
|
153
157
|
* structurally needs a server-side mint (the cross-process driver has no
|
|
@@ -181,16 +185,23 @@ export declare const testing_mint_session_action_spec: {
|
|
|
181
185
|
readonly async: true;
|
|
182
186
|
readonly description: string;
|
|
183
187
|
};
|
|
188
|
+
/** What `_testing_drain_effects` waits on — `AppDeps` satisfies it. */
|
|
189
|
+
export interface TestingDrainEffectsDeps {
|
|
190
|
+
/** The backend's request tracker, whose effect flushes the action awaits. */
|
|
191
|
+
request_tracker: Pick<RequestTracker, 'drain_flushes' | 'flush_count'>;
|
|
192
|
+
/** The backend's emitter, whose in-flight pool writes the action awaits. */
|
|
193
|
+
audit: Pick<AuditEmitter, 'drain_inflight' | 'inflight_count'>;
|
|
194
|
+
}
|
|
184
195
|
/**
|
|
185
|
-
* Build the standalone `_testing_drain_effects` action over
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* `{ok: true}`.
|
|
196
|
+
* Build the standalone `_testing_drain_effects` action over the backend's
|
|
197
|
+
* deps — the tracker its requests are held on and the emitter its handlers
|
|
198
|
+
* emit through. Mount it on any test endpoint whose suite asserts on audit
|
|
199
|
+
* rows or effects (the spine binary bundles it via `create_testing_actions`;
|
|
200
|
+
* in-process suites mount it directly). Answers `{ok: true}`.
|
|
190
201
|
*
|
|
191
|
-
* @param
|
|
202
|
+
* @param deps - the backend's `request_tracker` and `audit`
|
|
192
203
|
*/
|
|
193
|
-
export declare const create_testing_drain_effects_action: (
|
|
204
|
+
export declare const create_testing_drain_effects_action: (deps: TestingDrainEffectsDeps) => RpcAction;
|
|
194
205
|
/**
|
|
195
206
|
* `_testing_put_fact` — seed an **embedded** fact (`fact.bytes`) for the
|
|
196
207
|
* cross-process fact-serving suite, which drives over real HTTP and has no
|
|
@@ -676,13 +687,6 @@ export declare const testing_action_manifest_action_spec: {
|
|
|
676
687
|
export declare const create_testing_action_manifest_action: (mounted: ReadonlyArray<RpcAction>, ws_only?: ReadonlyArray<RpcAction>) => RpcAction;
|
|
677
688
|
/** Options for `create_testing_actions`. */
|
|
678
689
|
export interface CreateTestingActionsOptions {
|
|
679
|
-
/**
|
|
680
|
-
* Session cookie options — the reset action uses these when signing
|
|
681
|
-
* the fresh keeper's (and any extra accounts') session cookies.
|
|
682
|
-
* Pass the same `SessionOptions` the live `create_app_server` call
|
|
683
|
-
* was wired with.
|
|
684
|
-
*/
|
|
685
|
-
readonly session_options: SessionOptions<string>;
|
|
686
690
|
/**
|
|
687
691
|
* Daemon-token runtime state — the reset action points
|
|
688
692
|
* `state.keeper_account_id` at the freshly seeded keeper once its
|
|
@@ -716,7 +720,8 @@ export interface CreateTestingActionsOptions {
|
|
|
716
720
|
*
|
|
717
721
|
* Returns the bundled `_testing_*` actions (module doc). The test binary
|
|
718
722
|
* calls this at server-assembly time and registers the result on its
|
|
719
|
-
* dispatcher. `_testing_drain_effects` drains `deps.
|
|
723
|
+
* dispatcher. `_testing_drain_effects` drains `deps.request_tracker` and
|
|
724
|
+
* `deps.audit`.
|
|
720
725
|
*
|
|
721
726
|
* The reset action's table-wipe list mirrors
|
|
722
727
|
* `auth_integration_truncate_tables` from `testing/db.ts` — the
|
|
@@ -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;AAqF9B,OAAO,EAcN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;
|
|
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;AAqF9B,OAAO,EAcN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGvF,OAA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GAyBG;AACH,eAAO,MAAM,6CAA6C;;;;;;;;;;;;;;;;;;;;CA8BZ,CAAC;AAE/C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,+BAA+B,GAC3C,IAAI,EAAE,EACN,YAAY,MAAM,EAClB,SAAS,MAAM,KACb,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAWlD,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,+CAA+C,QAAO,SAGjE,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;CAaF,CAAC;AAkB/C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qCAAqC,GACjD,SAAS,aAAa,CAAC,SAAS,CAAC,EACjC,UAAS,aAAa,CAAC,SAAS,CAAM,KACpC,SASF,CAAC;AAEF,4CAA4C;AAC5C,MAAM,WAAW,2BAA2B;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;IAC9C;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,OAAO,EACb,SAAS,2BAA2B,KAClC,KAAK,CAAC,SAAS,CAsJjB,CAAC"}
|
|
@@ -4,7 +4,7 @@ import '../assert_dev_env.js';
|
|
|
4
4
|
*
|
|
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
8
|
* expired-by-construction server-side session for the expiry conformance
|
|
9
9
|
* cases), **`_testing_put_fact`** (seed an embedded fact for the fact-serving
|
|
10
10
|
* suite), **`_testing_schema_snapshot`** (introspect the live schema for
|
|
@@ -164,26 +164,30 @@ export const testing_reset_action_spec = {
|
|
|
164
164
|
description: 'Test-binary only — wipe auth tables, re-bootstrap a fresh keeper (+ optional extras), fire the domain-state reset.'
|
|
165
165
|
};
|
|
166
166
|
/**
|
|
167
|
-
* `_testing_drain_effects` — await in-flight fire-and-forget
|
|
167
|
+
* `_testing_drain_effects` — await in-flight fire-and-forget work so a
|
|
168
168
|
* following `audit_log_list` or database read is authoritative. The
|
|
169
169
|
* deterministic barrier the cross-backend conformance suite uses in place of
|
|
170
170
|
* a poll/sleep before asserting on audit rows.
|
|
171
171
|
*
|
|
172
|
-
* The handler
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
172
|
+
* The handler waits, repeating until both are empty, for the effect flushes
|
|
173
|
+
* on `AppDeps.request_tracker` (`RequestTracker.drain_flushes`: each
|
|
174
|
+
* request's eager `pending_effects` — the bearer leg's token touch among
|
|
175
|
+
* them — and its post-commit thunks) and for the pool writes of
|
|
176
|
+
* `AppDeps.audit` (`AuditEmitter.drain_inflight`) — a thunk can start an
|
|
177
|
+
* audit write, and a write's listener fan-out runs in a thunk. It matters
|
|
178
|
+
* whatever the transport: both test binaries settle an **HTTP** answer's
|
|
179
|
+
* effects before it responds (the TS binary through
|
|
180
|
+
* `await_pending_effects: true`, the Rust stub through its
|
|
177
181
|
* `await_background_writes_layer`), but a **WS** mutation is answered
|
|
178
182
|
* before its effects flush (reply-then-close for a self-revocation), so its
|
|
179
|
-
* audit write can still be
|
|
180
|
-
* Rust spine
|
|
183
|
+
* audit write or post-commit effect can still be running when the caller
|
|
184
|
+
* reads the reply. The Rust spine awaits the same work on its one tracker,
|
|
185
|
+
* `BackgroundWrites`.
|
|
181
186
|
*
|
|
182
|
-
* Covered: every `emit` that
|
|
183
|
-
* started while it waits.
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* its audit writes, so its drain awaits that too.
|
|
187
|
+
* Covered: every flush and `emit` that started before the drain was
|
|
188
|
+
* dispatched, and any started while it waits. Not a handler still running —
|
|
189
|
+
* the drain's own request is one, and its flush starts only after it answers
|
|
190
|
+
* — nor work that starts after the drain resolves.
|
|
187
191
|
*
|
|
188
192
|
* `auth` gates on the daemon-token credential, matching `_testing_reset`.
|
|
189
193
|
*/
|
|
@@ -214,7 +218,7 @@ export const testing_drain_effects_action_spec = {
|
|
|
214
218
|
* The minted `auth_session` row's `expires_at` is backdated while the
|
|
215
219
|
* returned cookie's own signed payload stays valid (future). Cross-process
|
|
216
220
|
* auth resolution therefore passes the
|
|
217
|
-
* cookie-payload gate (`
|
|
221
|
+
* cookie-payload gate (`parse_session_from_cookies`) and is refused by the authoritative
|
|
218
222
|
* DB-row gate (`query_session_get_valid` — `WHERE expires_at > NOW()`) —
|
|
219
223
|
* the gate the in-process payload-expiry tests never reach and the one that
|
|
220
224
|
* structurally needs a server-side mint (the cross-process driver has no
|
|
@@ -248,16 +252,22 @@ export const testing_mint_session_action_spec = {
|
|
|
248
252
|
'signed cookie value (exercises the authoritative server-side DB-row expiry gate).'
|
|
249
253
|
};
|
|
250
254
|
/**
|
|
251
|
-
* Build the standalone `_testing_drain_effects` action over
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
* `{ok: true}`.
|
|
255
|
+
* Build the standalone `_testing_drain_effects` action over the backend's
|
|
256
|
+
* deps — the tracker its requests are held on and the emitter its handlers
|
|
257
|
+
* emit through. Mount it on any test endpoint whose suite asserts on audit
|
|
258
|
+
* rows or effects (the spine binary bundles it via `create_testing_actions`;
|
|
259
|
+
* in-process suites mount it directly). Answers `{ok: true}`.
|
|
256
260
|
*
|
|
257
|
-
* @param
|
|
261
|
+
* @param deps - the backend's `request_tracker` and `audit`
|
|
258
262
|
*/
|
|
259
|
-
export const create_testing_drain_effects_action = (
|
|
260
|
-
|
|
263
|
+
export const create_testing_drain_effects_action = (deps) => rpc_action(testing_drain_effects_action_spec, async () => {
|
|
264
|
+
const { request_tracker, audit } = deps;
|
|
265
|
+
// until both are empty: a flush's post-commit thunk can start an audit
|
|
266
|
+
// write, and a flush that starts meanwhile is waited for too
|
|
267
|
+
do {
|
|
268
|
+
await request_tracker.drain_flushes();
|
|
269
|
+
await audit.drain_inflight();
|
|
270
|
+
} while (request_tracker.flush_count() > 0 || audit.inflight_count() > 0);
|
|
261
271
|
return { ok: true };
|
|
262
272
|
});
|
|
263
273
|
/**
|
|
@@ -699,7 +709,8 @@ export const create_testing_action_manifest_action = (mounted, ws_only = []) =>
|
|
|
699
709
|
*
|
|
700
710
|
* Returns the bundled `_testing_*` actions (module doc). The test binary
|
|
701
711
|
* calls this at server-assembly time and registers the result on its
|
|
702
|
-
* dispatcher. `_testing_drain_effects` drains `deps.
|
|
712
|
+
* dispatcher. `_testing_drain_effects` drains `deps.request_tracker` and
|
|
713
|
+
* `deps.audit`.
|
|
703
714
|
*
|
|
704
715
|
* The reset action's table-wipe list mirrors
|
|
705
716
|
* `auth_integration_truncate_tables` from `testing/db.ts` — the
|
|
@@ -709,7 +720,7 @@ export const create_testing_action_manifest_action = (mounted, ws_only = []) =>
|
|
|
709
720
|
* without updating this handler fails CI.
|
|
710
721
|
*/
|
|
711
722
|
export const create_testing_actions = (deps, options) => {
|
|
712
|
-
const {
|
|
723
|
+
const { daemon_token_state, reset_state } = options;
|
|
713
724
|
const log = deps.log;
|
|
714
725
|
return [
|
|
715
726
|
rpc_action(testing_reset_action_spec, async (input, ctx) => {
|
|
@@ -767,15 +778,14 @@ export const create_testing_actions = (deps, options) => {
|
|
|
767
778
|
const keeper = await create_test_account_with_credentials({
|
|
768
779
|
db: ctx.db,
|
|
769
780
|
keyring: deps.keyring,
|
|
770
|
-
session_options,
|
|
771
781
|
password: deps.password,
|
|
772
782
|
password_value: DEFAULT_TEST_PASSWORD,
|
|
773
783
|
roles: [...new Set([...DEFAULT_TEST_KEEPER_ROLES, ...(input.extra_keeper_roles ?? [])])]
|
|
774
784
|
});
|
|
775
785
|
// 6. Refresh the daemon-token cache so subsequent daemon-token
|
|
776
786
|
// requests resolve to the freshly seeded keeper. The
|
|
777
|
-
// middleware
|
|
778
|
-
//
|
|
787
|
+
// middleware never re-reads the keeper, so the reset sets it —
|
|
788
|
+
// after the commit, queued as
|
|
779
789
|
// soon as the keeper exists, so a reset that rolls back after it
|
|
780
790
|
// (a failing extra seed, a failed COMMIT) leaves the cache on the
|
|
781
791
|
// keeper still in the database rather than one that never
|
|
@@ -792,7 +802,6 @@ export const create_testing_actions = (deps, options) => {
|
|
|
792
802
|
const seeded = await create_test_account_with_credentials({
|
|
793
803
|
db: ctx.db,
|
|
794
804
|
keyring: deps.keyring,
|
|
795
|
-
session_options,
|
|
796
805
|
password: deps.password,
|
|
797
806
|
username: spec.username,
|
|
798
807
|
password_value: spec.password_value ?? DEFAULT_TEST_PASSWORD,
|
|
@@ -819,7 +828,6 @@ export const create_testing_actions = (deps, options) => {
|
|
|
819
828
|
const { session_cookie } = await mint_test_session({
|
|
820
829
|
db: ctx.db,
|
|
821
830
|
keyring: deps.keyring,
|
|
822
|
-
session_options,
|
|
823
831
|
account_id: input.account_id,
|
|
824
832
|
expires_in_seconds: input.expires_in_seconds
|
|
825
833
|
});
|
|
@@ -842,7 +850,7 @@ export const create_testing_actions = (deps, options) => {
|
|
|
842
850
|
}
|
|
843
851
|
return { hash };
|
|
844
852
|
}),
|
|
845
|
-
create_testing_drain_effects_action(deps
|
|
853
|
+
create_testing_drain_effects_action(deps),
|
|
846
854
|
create_testing_flood_notifications_action(),
|
|
847
855
|
create_testing_schema_snapshot_action(),
|
|
848
856
|
create_testing_migration_tracker_action(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing_server_core.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_core.ts"],"names":[],"mappings":"AAAA,OAAO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AAK,KAAK,CAAC;CAC9B;AAED,wEAAwE;AACxE,MAAM,WAAW,sBAAsB;IACtC;;;;;;;;;OASG;IACH,iBAAiB,EAAE,CAAC,OAAO,CAAC,EAAE,uBAAuB,KAAK,gBAAgB,CAAC;CAC3E;AAED,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC/B,mFAAmF;IACnF,GAAG,EAAE,IAAI,CAAC;IACV;;;;OAIG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,0CAA0C;AAC1C,MAAM,WAAW,yBAAyB;IACzC,8CAA8C;IAC9C,OAAO,EAAE,oBAAoB,CAAC;IAC9B;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACzE,0EAA0E;IAC1E,GAAG,CAAC,EAAE,UAAU,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,OAGpD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAU,SAAS,yBAAyB,KAAG,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"testing_server_core.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_core.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAA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eAAe;IAC/B,mFAAmF;IACnF,GAAG,EAAE,IAAI,CAAC;IACV;;;;OAIG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,0CAA0C;AAC1C,MAAM,WAAW,yBAAyB;IACzC,8CAA8C;IAC9C,OAAO,EAAE,oBAAoB,CAAC;IAC9B;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACzE,0EAA0E;IAC1E,GAAG,CAAC,EAAE,UAAU,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,OAGpD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAU,SAAS,yBAAyB,KAAG,OAAO,CAAC,IAAI,CA2D3F,CAAC"}
|
|
@@ -65,9 +65,8 @@ export const start_testing_server = async (options) => {
|
|
|
65
65
|
// don't await the drain yet: live WebSockets hold it open until
|
|
66
66
|
// `built.close()` ends them (`AppServer.close`), so awaiting it
|
|
67
67
|
// first would wait on sockets nothing is closing. A request already
|
|
68
|
-
// in flight when the signal lands
|
|
69
|
-
//
|
|
70
|
-
// the suite.
|
|
68
|
+
// in flight when the signal lands is waited for by `AppServer.close`
|
|
69
|
+
// (behind `built.close()`), within its drain bound.
|
|
71
70
|
const drained = server.shutdown();
|
|
72
71
|
await built.close();
|
|
73
72
|
await drained;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon_token_rotation.d.ts","sourceRoot":"","sources":["../../src/lib/testing/daemon_token_rotation.ts"],"names":[],"mappings":"AAA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;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGvF,8DAA8D;AAC9D,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAEnD,iDAAiD;AACjD,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,iBAAiB,GAAG,QAAQ,CAAC,CAAC;AAE7F;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,GAC9B,SAAS,oBAAoB,EAC7B,YAAY,MAAM,EAClB,OAAO,MAAM,KACX,OAAO,CAAC,IAAI,CAId,CAAC;AAEF,yCAAyC;AACzC,MAAM,WAAW,0BAA0B;IAC1C;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,gDAAgD;AAChD,MAAM,WAAW,mBAAmB;IACnC,2EAA2E;IAC3E,KAAK,EAAE,gBAAgB,CAAC;IACxB,kGAAkG;IAClG,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,2BAA2B,GACvC,SAAS,oBAAoB,GAAG,YAAY,EAC5C,MAAM,SAAS,EACf,SAAS,0BAA0B,EACnC,KAAK,MAAM,KACT,OAAO,CAAC,mBAAmB,CAoD7B,CAAC"}
|
|
@@ -42,9 +42,8 @@ export const start_daemon_token_rotation = async (runtime, deps, options, log) =
|
|
|
42
42
|
if (last_slash > 0) {
|
|
43
43
|
await runtime.mkdir(token_path.slice(0, last_slash), { recursive: true });
|
|
44
44
|
}
|
|
45
|
-
// resolve keeper account (
|
|
46
|
-
//
|
|
47
|
-
// rotation-starts-before-bootstrap case)
|
|
45
|
+
// resolve keeper account (null pre-bootstrap; the bootstrap route sets it
|
|
46
|
+
// once its account commits, given this state on `create_app_server`)
|
|
48
47
|
const keeper_account_id = await resolve_keeper_account_id(deps);
|
|
49
48
|
// generate initial token and write to disk
|
|
50
49
|
const initial_token = generate_daemon_token();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import './assert_dev_env.js';
|
|
2
|
-
import type { SessionOptions } from '../auth/session_cookie.js';
|
|
3
2
|
import { type RpcEndpointsSuiteOption } from './rpc_helpers.js';
|
|
4
3
|
import { type UncoveredEntry } from './error_coverage.js';
|
|
5
4
|
import type { AppSurfaceSpec } from '../http/surface.js';
|
|
@@ -29,11 +28,11 @@ export interface StandardIntegrationTestOptions {
|
|
|
29
28
|
/** Backend capability declarations for capability-gated cases. */
|
|
30
29
|
capabilities: BackendCapabilities;
|
|
31
30
|
/**
|
|
32
|
-
*
|
|
31
|
+
* The session cookie's name — needed to resolve factory-form `rpc_endpoints`
|
|
33
32
|
* against a stub `AppServerContext` at setup time and to read
|
|
34
33
|
* `cookie_name` for manual cookie composition in the session cases.
|
|
35
34
|
*/
|
|
36
|
-
|
|
35
|
+
session_cookie_name: string;
|
|
37
36
|
/**
|
|
38
37
|
* RPC endpoint specs — required. This suite dispatches
|
|
39
38
|
* `account_verify`, `account_session_*`, and `account_token_*` via
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA4B7B,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AAa7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAKpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAY1D;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;;;OAIG;IACH,UAAU,EAAE,SAAS,CAAC;IACtB;;;;;;;;;OASG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,kEAAkE;IAClE,YAAY,EAAE,mBAAmB,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;;;;;;;;OAWG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACpE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,mCAAmC,GAC/C,SAAS,8BAA8B,KACrC,IA+/CF,CAAC"}
|
|
@@ -5,7 +5,7 @@ import './assert_dev_env.js';
|
|
|
5
5
|
* `describe_standard_integration_tests` creates a composable test suite that
|
|
6
6
|
* exercises the full middleware stack (origin, session, bearer_auth, request_context)
|
|
7
7
|
* against a real database. Consumers call it with their route factory and
|
|
8
|
-
* session
|
|
8
|
+
* session cookie name — all auth route tests come for free.
|
|
9
9
|
*
|
|
10
10
|
* Tests use `stub_password_deps` (deterministic hashing, no Argon2 overhead).
|
|
11
11
|
* Login handlers call `verify_password(submitted, stored_hash)` which works because
|
|
@@ -68,10 +68,10 @@ export const describe_standard_integration_tests = (options) => {
|
|
|
68
68
|
// confusing test failure when `rpc_endpoints` is missing. Factory-form
|
|
69
69
|
// callers are resolved with a stub ctx purely to extract the endpoint
|
|
70
70
|
// path; the running backend handles live dispatch.
|
|
71
|
-
const rpc_endpoints_for_setup = resolve_rpc_endpoints_for_setup(options.rpc_endpoints, options.
|
|
71
|
+
const rpc_endpoints_for_setup = resolve_rpc_endpoints_for_setup(options.rpc_endpoints, options.session_cookie_name);
|
|
72
72
|
const rpc_path = require_rpc_endpoint_path(rpc_endpoints_for_setup);
|
|
73
73
|
describe('standard_integration', () => {
|
|
74
|
-
const
|
|
74
|
+
const cookie_name = options.session_cookie_name;
|
|
75
75
|
// Error coverage tracking across test groups
|
|
76
76
|
const error_collector = new ErrorCoverageCollector(options.surface_source.route_error_maps);
|
|
77
77
|
// the auth routes this suite drives: login / logout / password, signup
|
|
@@ -391,7 +391,7 @@ export const describe_standard_integration_tests = (options) => {
|
|
|
391
391
|
// it exercises the authoritative server-side DB-row expiry gate over
|
|
392
392
|
// real auth resolution on every spine, not the cookie-payload gate a
|
|
393
393
|
// backdated-payload forge hit here. The payload gate stays covered by
|
|
394
|
-
// `
|
|
394
|
+
// `parse_session_from_cookies`'s own unit tests.
|
|
395
395
|
});
|
|
396
396
|
// --- 4. Session revocation ---
|
|
397
397
|
describe('session revocation', () => {
|