@fuzdev/fuz_app 0.64.0 → 0.66.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 +510 -946
- package/dist/actions/action_codegen.d.ts +1 -1
- package/dist/actions/action_codegen.js +1 -1
- package/dist/actions/action_event_data.d.ts +1 -1
- package/dist/actions/broadcast_api.d.ts +1 -1
- package/dist/actions/broadcast_api.js +1 -1
- package/dist/actions/cancel.d.ts +2 -2
- package/dist/actions/cancel.js +3 -3
- package/dist/actions/connection_closer.d.ts +1 -4
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +1 -4
- package/dist/actions/register_action_ws.d.ts +2 -2
- package/dist/actions/register_ws_endpoint.d.ts +1 -1
- package/dist/actions/transports_ws_auth_guard.d.ts +1 -2
- package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
- package/dist/actions/transports_ws_auth_guard.js +1 -2
- package/dist/auth/CLAUDE.md +570 -1871
- package/dist/auth/account_schema.d.ts +1 -1
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +1 -1
- package/dist/auth/audit_log_ddl.d.ts +1 -1
- package/dist/auth/audit_log_ddl.d.ts.map +1 -1
- package/dist/auth/audit_log_ddl.js +1 -1
- package/dist/auth/audit_log_schema.js +2 -2
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +1 -5
- package/dist/auth/bootstrap_routes.d.ts +7 -1
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +15 -11
- package/dist/auth/daemon_token_middleware.d.ts +15 -5
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +24 -15
- package/dist/auth/invite_queries.d.ts +17 -7
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +19 -8
- package/dist/auth/keyring.d.ts +6 -6
- package/dist/auth/keyring.js +8 -8
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +4 -2
- package/dist/auth/signup_routes.d.ts +47 -1
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +103 -52
- package/dist/db/create_db.d.ts.map +1 -1
- package/dist/db/create_db.js +13 -0
- package/dist/dev/setup.d.ts +2 -2
- package/dist/dev/setup.js +3 -3
- package/dist/env/resolve.d.ts +44 -7
- package/dist/env/resolve.d.ts.map +1 -1
- package/dist/env/resolve.js +94 -27
- package/dist/http/CLAUDE.md +243 -522
- package/dist/http/error_schemas.d.ts +0 -4
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +0 -4
- package/dist/http/ip_canonical.d.ts +5 -4
- package/dist/http/ip_canonical.d.ts.map +1 -1
- package/dist/http/ip_canonical.js +8 -4
- package/dist/http/jsonrpc.d.ts +23 -7
- package/dist/http/jsonrpc.d.ts.map +1 -1
- package/dist/http/jsonrpc.js +19 -3
- package/dist/http/origin.d.ts +1 -1
- package/dist/http/origin.js +1 -1
- package/dist/http/surface.d.ts +9 -2
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/runtime/mock.d.ts +1 -1
- package/dist/runtime/mock.js +2 -2
- package/dist/server/app_server.d.ts +41 -10
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +10 -4
- package/dist/server/env.d.ts +7 -7
- package/dist/server/env.d.ts.map +1 -1
- package/dist/server/env.js +14 -14
- package/dist/server/static.d.ts +4 -4
- package/dist/server/static.js +7 -7
- package/dist/testing/CLAUDE.md +740 -418
- package/dist/testing/admin_integration.d.ts +18 -23
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +230 -216
- package/dist/testing/app_server.d.ts +141 -39
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +157 -44
- package/dist/testing/audit_completeness.d.ts +25 -22
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +198 -159
- package/dist/testing/bootstrap_success.d.ts +28 -0
- package/dist/testing/bootstrap_success.d.ts.map +1 -0
- package/dist/testing/bootstrap_success.js +144 -0
- package/dist/testing/cross_backend/backend_config.d.ts +113 -0
- package/dist/testing/cross_backend/backend_config.d.ts.map +1 -0
- package/dist/testing/cross_backend/backend_config.js +1 -0
- package/dist/testing/cross_backend/bench/bench_report.d.ts +46 -0
- package/dist/testing/cross_backend/bench/bench_report.d.ts.map +1 -0
- package/dist/testing/cross_backend/bench/bench_report.js +83 -0
- package/dist/testing/cross_backend/bench/run_cross_impl_bench.d.ts +44 -0
- package/dist/testing/cross_backend/bench/run_cross_impl_bench.d.ts.map +1 -0
- package/dist/testing/cross_backend/bench/run_cross_impl_bench.js +38 -0
- package/dist/testing/cross_backend/bench/scenario.d.ts +57 -0
- package/dist/testing/cross_backend/bench/scenario.d.ts.map +1 -0
- package/dist/testing/cross_backend/bench/scenario.js +28 -0
- package/dist/testing/cross_backend/bootstrap_backend.d.ts +41 -0
- package/dist/testing/cross_backend/bootstrap_backend.d.ts.map +1 -0
- package/dist/testing/cross_backend/bootstrap_backend.js +34 -0
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +24 -0
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -0
- package/dist/testing/cross_backend/build_test_backend_paths.js +33 -0
- package/dist/testing/cross_backend/capabilities.d.ts +65 -0
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -0
- package/dist/testing/cross_backend/capabilities.js +47 -0
- package/dist/testing/cross_backend/default_backend_configs.d.ts +122 -0
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -0
- package/dist/testing/cross_backend/default_backend_configs.js +111 -0
- package/dist/testing/cross_backend/default_secrets.d.ts +40 -0
- package/dist/testing/cross_backend/default_secrets.d.ts.map +1 -0
- package/dist/testing/cross_backend/default_secrets.js +39 -0
- package/dist/testing/cross_backend/default_spine_surface.d.ts +64 -0
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -0
- package/dist/testing/cross_backend/default_spine_surface.js +121 -0
- package/dist/testing/cross_backend/setup.d.ts +451 -0
- package/dist/testing/cross_backend/setup.d.ts.map +1 -0
- package/dist/testing/cross_backend/setup.js +581 -0
- package/dist/testing/cross_backend/spawn_backend.d.ts +58 -0
- package/dist/testing/cross_backend/spawn_backend.d.ts.map +1 -0
- package/dist/testing/cross_backend/spawn_backend.js +229 -0
- package/dist/testing/cross_backend/spine_stub_backend_config.d.ts +66 -0
- package/dist/testing/cross_backend/spine_stub_backend_config.d.ts.map +1 -0
- package/dist/testing/cross_backend/spine_stub_backend_config.js +49 -0
- package/dist/testing/cross_backend/sse_round_trip.d.ts +37 -0
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -0
- package/dist/testing/cross_backend/sse_round_trip.js +137 -0
- package/dist/testing/cross_backend/standard.d.ts +96 -0
- package/dist/testing/cross_backend/standard.d.ts.map +1 -0
- package/dist/testing/cross_backend/standard.js +49 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +171 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_reset_actions.js +213 -0
- package/dist/testing/cross_backend/testing_server_bun.d.ts +5 -0
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_server_bun.js +59 -0
- package/dist/testing/cross_backend/testing_server_core.d.ts +140 -0
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_server_core.js +68 -0
- package/dist/testing/cross_backend/testing_server_deno.d.ts +5 -0
- package/dist/testing/cross_backend/testing_server_deno.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_server_deno.js +37 -0
- package/dist/testing/cross_backend/testing_server_node.d.ts +5 -0
- package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_server_node.js +50 -0
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +72 -0
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -0
- package/dist/testing/cross_backend/ts_spine_backend_config.js +112 -0
- package/dist/testing/cross_backend/ws_round_trip.d.ts +35 -0
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -0
- package/dist/testing/cross_backend/ws_round_trip.js +113 -0
- package/dist/testing/data_exposure.d.ts +11 -14
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +123 -146
- package/dist/testing/db_entities.d.ts +22 -1
- package/dist/testing/db_entities.d.ts.map +1 -1
- package/dist/testing/db_entities.js +24 -1
- package/dist/testing/integration.d.ts +56 -21
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +294 -319
- package/dist/testing/integration_helpers.d.ts +16 -6
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +7 -7
- package/dist/testing/mock_fs.d.ts.map +1 -1
- package/dist/testing/mock_fs.js +0 -2
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +9 -0
- package/dist/testing/role_grant_helpers.d.ts +31 -0
- package/dist/testing/role_grant_helpers.d.ts.map +1 -0
- package/dist/testing/role_grant_helpers.js +46 -0
- package/dist/testing/round_trip.d.ts +20 -16
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +61 -86
- package/dist/testing/rpc_helpers.d.ts +10 -4
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +1 -1
- package/dist/testing/rpc_round_trip.d.ts +24 -21
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +87 -104
- package/dist/testing/schema_introspect.d.ts +106 -0
- package/dist/testing/schema_introspect.d.ts.map +1 -0
- package/dist/testing/schema_introspect.js +123 -0
- package/dist/testing/schema_parity.d.ts +144 -0
- package/dist/testing/schema_parity.d.ts.map +1 -0
- package/dist/testing/schema_parity.js +233 -0
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +1 -68
- package/dist/testing/standard.d.ts +56 -25
- package/dist/testing/standard.d.ts.map +1 -1
- package/dist/testing/standard.js +62 -5
- package/dist/testing/stubs.d.ts +21 -6
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +33 -23
- package/dist/testing/testing_rate_limiter.d.ts +59 -0
- package/dist/testing/testing_rate_limiter.d.ts.map +1 -0
- package/dist/testing/testing_rate_limiter.js +74 -0
- package/dist/testing/transports/bootstrap.d.ts +52 -0
- package/dist/testing/transports/bootstrap.d.ts.map +1 -0
- package/dist/testing/transports/bootstrap.js +70 -0
- package/dist/testing/transports/fetch_transport.d.ts +81 -0
- package/dist/testing/transports/fetch_transport.d.ts.map +1 -0
- package/dist/testing/transports/fetch_transport.js +74 -0
- package/dist/testing/transports/sse_frame_reader.d.ts +41 -0
- package/dist/testing/transports/sse_frame_reader.d.ts.map +1 -0
- package/dist/testing/transports/sse_frame_reader.js +84 -0
- package/dist/testing/transports/sse_transport.d.ts +54 -0
- package/dist/testing/transports/sse_transport.d.ts.map +1 -0
- package/dist/testing/transports/sse_transport.js +51 -0
- package/dist/testing/transports/ws_client.d.ts +108 -0
- package/dist/testing/transports/ws_client.d.ts.map +1 -0
- package/dist/testing/transports/ws_client.js +56 -0
- package/dist/testing/transports/ws_transport.d.ts +43 -0
- package/dist/testing/transports/ws_transport.d.ts.map +1 -0
- package/dist/testing/transports/ws_transport.js +169 -0
- package/dist/testing/ws_round_trip.d.ts +21 -103
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +42 -40
- package/dist/ui/CLAUDE.md +5 -3
- package/dist/ui/MenuLink.svelte +16 -16
- package/dist/ui/MenuLink.svelte.d.ts +13 -4
- package/dist/ui/MenuLink.svelte.d.ts.map +1 -1
- package/package.json +10 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap_backend.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/bootstrap_backend.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAIvD,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,YAAY,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,GAC7B,QAAQ,aAAa,KACnB,OAAO,CAAC,yBAAyB,CAgBnC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
import { spawn_backend } from './spawn_backend.js';
|
|
3
|
+
import { bootstrap } from '../transports/bootstrap.js';
|
|
4
|
+
import { create_fetch_transport } from '../transports/fetch_transport.js';
|
|
5
|
+
/**
|
|
6
|
+
* Spawn the test binary described by `config`, bootstrap a keeper, and
|
|
7
|
+
* return the enriched handle.
|
|
8
|
+
*
|
|
9
|
+
* The keeper transport is constructed against `config.base_url` with no
|
|
10
|
+
* initial cookies; `bootstrap()` populates its jar with the session
|
|
11
|
+
* cookie returned by `POST {config.bootstrap_path}`. Subsequent calls
|
|
12
|
+
* against `bootstrapped.keeper_transport` are authenticated as keeper.
|
|
13
|
+
*
|
|
14
|
+
* Mirrors the composition `default_cross_process_setup`'s caller would
|
|
15
|
+
* otherwise hand-roll in every consumer's `globalSetup`.
|
|
16
|
+
*/
|
|
17
|
+
export const bootstrap_backend = async (config) => {
|
|
18
|
+
const handle = await spawn_backend(config);
|
|
19
|
+
try {
|
|
20
|
+
const keeper_transport = create_fetch_transport({ base_url: config.base_url });
|
|
21
|
+
const keeper = await bootstrap({ transport: keeper_transport, config });
|
|
22
|
+
return {
|
|
23
|
+
...handle,
|
|
24
|
+
keeper_transport,
|
|
25
|
+
keeper_account: keeper.account,
|
|
26
|
+
keeper_actor: keeper.actor,
|
|
27
|
+
keeper_cookies: keeper.cookies,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
await handle.teardown();
|
|
32
|
+
throw err;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generic per-backend paths every cross-process test binary needs.
|
|
4
|
+
* Consumers extend this with their own domain paths.
|
|
5
|
+
*
|
|
6
|
+
* - `root` — the per-backend subtree under `os.tmpdir()`. Compose
|
|
7
|
+
* consumer-specific paths under here.
|
|
8
|
+
* - `bootstrap_token_path` — `FUZ_BOOTSTRAP_TOKEN_PATH`; harness writes
|
|
9
|
+
* the bootstrap token here before spawn.
|
|
10
|
+
* - `daemon_token_path` — where `init_daemon_token` (Rust) and the TS
|
|
11
|
+
* server's daemon-token writer land the token (under `{root}/run/`).
|
|
12
|
+
*/
|
|
13
|
+
export interface TestBackendPaths {
|
|
14
|
+
readonly root: string;
|
|
15
|
+
readonly bootstrap_token_path: string;
|
|
16
|
+
readonly daemon_token_path: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Build the generic path layout for a cross-process test backend.
|
|
20
|
+
* `prefix` is typically the `BackendConfig.name` (e.g. `'deno'`,
|
|
21
|
+
* `'rust'`, `'spine_stub'`).
|
|
22
|
+
*/
|
|
23
|
+
export declare const build_test_backend_paths: (prefix: string) => TestBackendPaths;
|
|
24
|
+
//# sourceMappingURL=build_test_backend_paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_test_backend_paths.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/build_test_backend_paths.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqB9B;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACnC;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,QAAQ,MAAM,KAAG,gBASzD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Per-backend filesystem layout under `os.tmpdir()` for cross-process
|
|
4
|
+
* tests.
|
|
5
|
+
*
|
|
6
|
+
* Isolation matters because vitest projects can run in parallel — a
|
|
7
|
+
* shared `root` would mix daemon tokens across concurrently-running
|
|
8
|
+
* backends. Each backend gets its own subtree via the `prefix` arg
|
|
9
|
+
* (typically the `BackendConfig.name`).
|
|
10
|
+
*
|
|
11
|
+
* Consumers compose: take the generic paths from
|
|
12
|
+
* `build_test_backend_paths(name)`, add domain-specific dirs (e.g.
|
|
13
|
+
* `zzz_dir`, `scoped_dir`) under the returned `root`.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import { tmpdir } from 'node:os';
|
|
18
|
+
import { join } from 'node:path';
|
|
19
|
+
/**
|
|
20
|
+
* Build the generic path layout for a cross-process test backend.
|
|
21
|
+
* `prefix` is typically the `BackendConfig.name` (e.g. `'deno'`,
|
|
22
|
+
* `'rust'`, `'spine_stub'`).
|
|
23
|
+
*/
|
|
24
|
+
export const build_test_backend_paths = (prefix) => {
|
|
25
|
+
const root = join(tmpdir(), prefix);
|
|
26
|
+
return {
|
|
27
|
+
root,
|
|
28
|
+
bootstrap_token_path: join(root, 'bootstrap_token'),
|
|
29
|
+
// `init_daemon_token` (Rust) and the TS server's daemon-token
|
|
30
|
+
// writer both land the token at `{root}/run/daemon_token`.
|
|
31
|
+
daemon_token_path: join(root, 'run', 'daemon_token'),
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Optional behaviors a backend may support. Each flag's TSDoc names the
|
|
4
|
+
* tests that gate on it; add a new flag here before referencing it from
|
|
5
|
+
* a suite body, and document the gating tests inline.
|
|
6
|
+
*/
|
|
7
|
+
export interface BackendCapabilities {
|
|
8
|
+
/**
|
|
9
|
+
* Bearer token auth (`Authorization: Bearer <token>`) is wired through
|
|
10
|
+
* the backend's middleware stack. Gates the bearer-token cases in
|
|
11
|
+
* `describe_standard_integration_tests` and `describe_rate_limiting_tests`.
|
|
12
|
+
*/
|
|
13
|
+
readonly bearer_auth: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Trusted-proxy XFF parsing is wired (`X-Forwarded-For` etc.). Gates
|
|
16
|
+
* the proxy-resolution cases in `describe_standard_integration_tests`
|
|
17
|
+
* and the future cross-process proxy integration suite.
|
|
18
|
+
*/
|
|
19
|
+
readonly trusted_proxy: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Per-account login rate limiting is wired. Gates the per-account
|
|
22
|
+
* rate-limit cases in `describe_rate_limiting_tests`.
|
|
23
|
+
*/
|
|
24
|
+
readonly login_rate_limit: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* WebSocket transport is reachable end-to-end. Gates the cross-process
|
|
27
|
+
* WS round-trip suite; the in-process `describe_ws_round_trip_tests`
|
|
28
|
+
* runs against `register_action_ws` directly and ignores this flag.
|
|
29
|
+
*/
|
|
30
|
+
readonly ws: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* SSE transport is reachable end-to-end. Gates the cross-process SSE
|
|
33
|
+
* suite (`describe_cross_process_sse_tests` — connect, audit data frame,
|
|
34
|
+
* close-on-revoke); in-process SSE uses the `on_audit_event` hook and
|
|
35
|
+
* ignores this flag.
|
|
36
|
+
*/
|
|
37
|
+
readonly sse: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Test has direct access to backend-internal state (keyring for
|
|
40
|
+
* signing cookies, DB pool for FK-structural raw queries). Always
|
|
41
|
+
* `true` for in-process Hono via `default_in_process_setup`; always
|
|
42
|
+
* `false` cross-process. Gates the 3 keyring reads in
|
|
43
|
+
* `describe_standard_integration_tests` (expired-cookie generation)
|
|
44
|
+
* and the FK-structural raw query in `describe_audit_completeness_tests`.
|
|
45
|
+
*/
|
|
46
|
+
readonly in_process_only: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Capability declarations for the in-process Hono transport. Every flag
|
|
50
|
+
* is `true` because in-process testing exercises the full backend with
|
|
51
|
+
* no missing optional behaviors. Cross-process consumers
|
|
52
|
+
* declare each flag explicitly per backend.
|
|
53
|
+
*/
|
|
54
|
+
export declare const in_process_capabilities: BackendCapabilities;
|
|
55
|
+
/**
|
|
56
|
+
* Conditional `test()` wrapper — registers a vitest case only when
|
|
57
|
+
* `cond` is true; otherwise registers it as `.skip` so the run still
|
|
58
|
+
* surfaces the gated coverage in the report.
|
|
59
|
+
*
|
|
60
|
+
* Thin wrapper around vitest's `test.skipIf(!cond)` with the argument
|
|
61
|
+
* order flipped to match the more readable `test_if(capabilities.bearer_auth, ...)`
|
|
62
|
+
* call pattern.
|
|
63
|
+
*/
|
|
64
|
+
export declare const test_if: (cond: boolean, name: string, fn: () => void | Promise<void>) => void;
|
|
65
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAmB9B;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB;;;;;;;OAOG;IACH,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;CAClC;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,mBAOpC,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,GAAI,MAAM,OAAO,EAAE,MAAM,MAAM,EAAE,IAAI,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAG,IAMrF,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Capability vocabulary for cross-backend integration testing.
|
|
4
|
+
*
|
|
5
|
+
* Backends declare which optional behaviors they support; suite bodies
|
|
6
|
+
* call `test_if(capabilities.X, ...)` to skip cases the backend doesn't
|
|
7
|
+
* implement. No `if (config.name === 'rust')` branches anywhere — name-
|
|
8
|
+
* checking is a code smell that says capability vocabulary is missing.
|
|
9
|
+
*
|
|
10
|
+
* In-process Hono via `default_in_process_setup` declares every
|
|
11
|
+
* capability `true` (see `in_process_capabilities`). Cross-process
|
|
12
|
+
* backends opt in per-flag on their `BackendConfig`.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
import { test } from 'vitest';
|
|
17
|
+
/**
|
|
18
|
+
* Capability declarations for the in-process Hono transport. Every flag
|
|
19
|
+
* is `true` because in-process testing exercises the full backend with
|
|
20
|
+
* no missing optional behaviors. Cross-process consumers
|
|
21
|
+
* declare each flag explicitly per backend.
|
|
22
|
+
*/
|
|
23
|
+
export const in_process_capabilities = Object.freeze({
|
|
24
|
+
bearer_auth: true,
|
|
25
|
+
trusted_proxy: true,
|
|
26
|
+
login_rate_limit: true,
|
|
27
|
+
ws: true,
|
|
28
|
+
sse: true,
|
|
29
|
+
in_process_only: true,
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Conditional `test()` wrapper — registers a vitest case only when
|
|
33
|
+
* `cond` is true; otherwise registers it as `.skip` so the run still
|
|
34
|
+
* surfaces the gated coverage in the report.
|
|
35
|
+
*
|
|
36
|
+
* Thin wrapper around vitest's `test.skipIf(!cond)` with the argument
|
|
37
|
+
* order flipped to match the more readable `test_if(capabilities.bearer_auth, ...)`
|
|
38
|
+
* call pattern.
|
|
39
|
+
*/
|
|
40
|
+
export const test_if = (cond, name, fn) => {
|
|
41
|
+
if (cond) {
|
|
42
|
+
test(name, fn);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
test.skip(name, fn);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Family-shared `BackendConfig` builders for cross-process test backends.
|
|
4
|
+
*
|
|
5
|
+
* Two consumer-facing factories — {@link make_default_ts_backend_config}
|
|
6
|
+
* and {@link make_default_rust_backend_config} — own the common shape
|
|
7
|
+
* for the JS-runtime (Deno/Node on V8) and Rust families respectively.
|
|
8
|
+
* Per-backend factories in consumer projects compose a small
|
|
9
|
+
* declaration against one of these and add consumer-specific env vars
|
|
10
|
+
* via `extra_env`.
|
|
11
|
+
*
|
|
12
|
+
* Defaults baked in by family:
|
|
13
|
+
*
|
|
14
|
+
* - **TS** — `'memory://'` PGlite, 30s startup window, capabilities
|
|
15
|
+
* without trusted_proxy/login_rate_limit. The TS canonical path
|
|
16
|
+
* leaves these limiters null in test mode.
|
|
17
|
+
* - **Rust** — caller-supplied real Postgres URL (PGlite isn't reachable
|
|
18
|
+
* from `tokio-postgres`), 120s startup window (cargo first-build cost),
|
|
19
|
+
* capabilities including trusted_proxy + login_rate_limit + the
|
|
20
|
+
* `FUZ_TESTING_RESET_DB_ON_STARTUP=true` self-wipe gate.
|
|
21
|
+
*
|
|
22
|
+
* Both builders default `port_env_var` to `'PORT'`. Consumers whose
|
|
23
|
+
* binary reads a different name (e.g. zzz's `ZZZ_PORT`) override.
|
|
24
|
+
*
|
|
25
|
+
* Common across both families: `/api/rpc`, `/api/ws`, `/health`,
|
|
26
|
+
* `/api/account/bootstrap`, `cookie_name: 'fuz_session'`, the standard
|
|
27
|
+
* bootstrap block keyed off `default_test_*` constants. Builders call
|
|
28
|
+
* `build_test_backend_paths(name)` internally when the optional `paths`
|
|
29
|
+
* is omitted.
|
|
30
|
+
*
|
|
31
|
+
* @module
|
|
32
|
+
*/
|
|
33
|
+
import type { BackendBootstrapConfig, BackendConfig } from './backend_config.js';
|
|
34
|
+
import type { BackendCapabilities } from './capabilities.js';
|
|
35
|
+
import { type TestBackendPaths } from './build_test_backend_paths.js';
|
|
36
|
+
/**
|
|
37
|
+
* Capabilities shared by TS-family backends — same canonical
|
|
38
|
+
* implementation, same feature set. No trusted-proxy phase (the test
|
|
39
|
+
* binary doesn't enable proxy parsing) and no per-account login rate
|
|
40
|
+
* limit (the TS canonical path leaves the limiter null in test mode).
|
|
41
|
+
*/
|
|
42
|
+
export declare const ts_default_capabilities: BackendCapabilities;
|
|
43
|
+
/**
|
|
44
|
+
* Capabilities for the Rust family. Adds `trusted_proxy: true` (the
|
|
45
|
+
* Rust spine's client-IP middleware is always wired; the env-gate just
|
|
46
|
+
* controls whether XFF is consulted vs the TCP peer IP) and
|
|
47
|
+
* `login_rate_limit: true` (env-gated bucket on `/login` + `/password`).
|
|
48
|
+
*/
|
|
49
|
+
export declare const rust_default_capabilities: BackendCapabilities;
|
|
50
|
+
export interface MakeDefaultTsBackendConfigOptions {
|
|
51
|
+
/** Diagnostic label; also used as the tmpdir prefix when `paths` is omitted. */
|
|
52
|
+
readonly name: string;
|
|
53
|
+
/** TCP port the binary listens on. */
|
|
54
|
+
readonly port: number;
|
|
55
|
+
/** argv passed to the spawn (first entry is the binary). */
|
|
56
|
+
readonly start_command: ReadonlyArray<string>;
|
|
57
|
+
/** Defaults to `'memory://'` (in-memory PGlite). */
|
|
58
|
+
readonly database_url?: string;
|
|
59
|
+
/** Merged on top of the generic env baseline; later keys win. */
|
|
60
|
+
readonly extra_env?: Readonly<Record<string, string>>;
|
|
61
|
+
/** Defaults to `ts_default_capabilities`. */
|
|
62
|
+
readonly capabilities?: BackendCapabilities;
|
|
63
|
+
/** Pre-computed paths; defaults to `build_test_backend_paths(name)`. */
|
|
64
|
+
readonly paths?: TestBackendPaths;
|
|
65
|
+
/** Override individual bootstrap fields (username/password/token). */
|
|
66
|
+
readonly bootstrap_overrides?: Partial<BackendBootstrapConfig>;
|
|
67
|
+
/**
|
|
68
|
+
* Env-var name the binary reads for its port. Defaults to `'PORT'`.
|
|
69
|
+
* Consumers whose binary reads a different name (e.g. `'ZZZ_PORT'`)
|
|
70
|
+
* override.
|
|
71
|
+
*/
|
|
72
|
+
readonly port_env_var?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Shared builder for TS-family backends (Deno + Node). Owns the common
|
|
76
|
+
* env baseline (NODE_ENV, HOST, PORT, in-memory PGlite, cookie keys,
|
|
77
|
+
* bootstrap token path) so per-backend factories only declare what
|
|
78
|
+
* genuinely differs.
|
|
79
|
+
*/
|
|
80
|
+
export declare const make_default_ts_backend_config: (opts: MakeDefaultTsBackendConfigOptions) => BackendConfig;
|
|
81
|
+
export interface MakeDefaultRustBackendConfigOptions {
|
|
82
|
+
/** Diagnostic label; also used as the tmpdir prefix when `paths` is omitted. */
|
|
83
|
+
readonly name: string;
|
|
84
|
+
/** TCP port the binary listens on. */
|
|
85
|
+
readonly port: number;
|
|
86
|
+
/** argv passed to the spawn (first entry is the binary). */
|
|
87
|
+
readonly start_command: ReadonlyArray<string>;
|
|
88
|
+
/**
|
|
89
|
+
* Required — Rust needs real Postgres (PGlite isn't reachable from
|
|
90
|
+
* `tokio-postgres`). Consumers typically supply
|
|
91
|
+
* `'postgres://localhost/{repo}_test_{name}'`.
|
|
92
|
+
*/
|
|
93
|
+
readonly database_url: string;
|
|
94
|
+
/** Merged on top of the generic env baseline; later keys win. */
|
|
95
|
+
readonly extra_env?: Readonly<Record<string, string>>;
|
|
96
|
+
/** Defaults to `rust_default_capabilities`. */
|
|
97
|
+
readonly capabilities?: BackendCapabilities;
|
|
98
|
+
/** Pre-computed paths; defaults to `build_test_backend_paths(name)`. */
|
|
99
|
+
readonly paths?: TestBackendPaths;
|
|
100
|
+
/** Override individual bootstrap fields (username/password/token). */
|
|
101
|
+
readonly bootstrap_overrides?: Partial<BackendBootstrapConfig>;
|
|
102
|
+
/**
|
|
103
|
+
* Env-var name the binary reads for its port. Defaults to `'PORT'`.
|
|
104
|
+
* Consumers whose binary reads a different name (e.g. `'ZZZ_PORT'`)
|
|
105
|
+
* override.
|
|
106
|
+
*/
|
|
107
|
+
readonly port_env_var?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Initial value for `RUST_LOG`. Defaults to `'info'`. Consumers pass
|
|
110
|
+
* their binary-specific module filter
|
|
111
|
+
* (e.g. `'info,zzz_server=info,testing_zzz_server=info'`).
|
|
112
|
+
*/
|
|
113
|
+
readonly rust_log?: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Shared builder for Rust-family backends. Owns the common env baseline
|
|
117
|
+
* (RUST_LOG, HOST, port, real Postgres, cookie keys, bootstrap token
|
|
118
|
+
* path, the `FUZ_TESTING_RESET_DB_ON_STARTUP=true` self-wipe gate) plus
|
|
119
|
+
* the 120s startup window for cargo's first-run build cost.
|
|
120
|
+
*/
|
|
121
|
+
export declare const make_default_rust_backend_config: (opts: MakeDefaultRustBackendConfigOptions) => BackendConfig;
|
|
122
|
+
//# sourceMappingURL=default_backend_configs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default_backend_configs.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/default_backend_configs.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAC,sBAAsB,EAAE,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAC/E,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAA2B,KAAK,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAQ9F;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,mBAOpC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,mBAOtC,CAAC;AAeH,MAAM,WAAW,iCAAiC;IACjD,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9C,oDAAoD;IACpD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,iEAAiE;IACjE,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,6CAA6C;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAC5C,wEAAwE;IACxE,QAAQ,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAClC,sEAAsE;IACtE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC/D;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,GAC1C,MAAM,iCAAiC,KACrC,aAmCF,CAAC;AAEF,MAAM,WAAW,mCAAmC;IACnD,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,iEAAiE;IACjE,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,+CAA+C;IAC/C,QAAQ,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAC5C,wEAAwE;IACxE,QAAQ,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAClC,sEAAsE;IACtE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC/D;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,GAC5C,MAAM,mCAAmC,KACvC,aA2CF,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
import { build_test_backend_paths } from './build_test_backend_paths.js';
|
|
3
|
+
import { default_test_bootstrap_token, default_test_cookie_keys, default_test_keeper_password, default_test_keeper_username, } from './default_secrets.js';
|
|
4
|
+
/**
|
|
5
|
+
* Capabilities shared by TS-family backends — same canonical
|
|
6
|
+
* implementation, same feature set. No trusted-proxy phase (the test
|
|
7
|
+
* binary doesn't enable proxy parsing) and no per-account login rate
|
|
8
|
+
* limit (the TS canonical path leaves the limiter null in test mode).
|
|
9
|
+
*/
|
|
10
|
+
export const ts_default_capabilities = Object.freeze({
|
|
11
|
+
bearer_auth: true,
|
|
12
|
+
trusted_proxy: false,
|
|
13
|
+
login_rate_limit: false,
|
|
14
|
+
ws: true,
|
|
15
|
+
sse: false,
|
|
16
|
+
in_process_only: false,
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Capabilities for the Rust family. Adds `trusted_proxy: true` (the
|
|
20
|
+
* Rust spine's client-IP middleware is always wired; the env-gate just
|
|
21
|
+
* controls whether XFF is consulted vs the TCP peer IP) and
|
|
22
|
+
* `login_rate_limit: true` (env-gated bucket on `/login` + `/password`).
|
|
23
|
+
*/
|
|
24
|
+
export const rust_default_capabilities = Object.freeze({
|
|
25
|
+
bearer_auth: true,
|
|
26
|
+
trusted_proxy: true,
|
|
27
|
+
login_rate_limit: true,
|
|
28
|
+
ws: true,
|
|
29
|
+
sse: false,
|
|
30
|
+
in_process_only: false,
|
|
31
|
+
});
|
|
32
|
+
/** Bootstrap block built from the default secrets + supplied paths. */
|
|
33
|
+
const build_default_bootstrap = (paths, overrides) => ({
|
|
34
|
+
token_path: paths.bootstrap_token_path,
|
|
35
|
+
token: default_test_bootstrap_token,
|
|
36
|
+
username: default_test_keeper_username,
|
|
37
|
+
password: default_test_keeper_password,
|
|
38
|
+
daemon_token_path: paths.daemon_token_path,
|
|
39
|
+
...overrides,
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Shared builder for TS-family backends (Deno + Node). Owns the common
|
|
43
|
+
* env baseline (NODE_ENV, HOST, PORT, in-memory PGlite, cookie keys,
|
|
44
|
+
* bootstrap token path) so per-backend factories only declare what
|
|
45
|
+
* genuinely differs.
|
|
46
|
+
*/
|
|
47
|
+
export const make_default_ts_backend_config = (opts) => {
|
|
48
|
+
const { name, port, start_command, database_url = 'memory://', extra_env, capabilities = ts_default_capabilities, paths = build_test_backend_paths(name), bootstrap_overrides, port_env_var = 'PORT', } = opts;
|
|
49
|
+
return {
|
|
50
|
+
name,
|
|
51
|
+
start_command,
|
|
52
|
+
base_url: `http://localhost:${port}`,
|
|
53
|
+
rpc_path: '/api/rpc',
|
|
54
|
+
ws_path: '/api/ws',
|
|
55
|
+
health_path: '/health',
|
|
56
|
+
bootstrap_path: '/api/account/bootstrap',
|
|
57
|
+
cookie_name: 'fuz_session',
|
|
58
|
+
startup_timeout_ms: 30_000,
|
|
59
|
+
env: {
|
|
60
|
+
NODE_ENV: 'development',
|
|
61
|
+
HOST: 'localhost',
|
|
62
|
+
[port_env_var]: String(port),
|
|
63
|
+
DATABASE_URL: database_url,
|
|
64
|
+
SECRET_FUZ_COOKIE_KEYS: default_test_cookie_keys,
|
|
65
|
+
FUZ_ALLOWED_ORIGINS: 'http://localhost:*',
|
|
66
|
+
FUZ_BOOTSTRAP_TOKEN_PATH: paths.bootstrap_token_path,
|
|
67
|
+
...extra_env,
|
|
68
|
+
},
|
|
69
|
+
bootstrap: build_default_bootstrap(paths, bootstrap_overrides),
|
|
70
|
+
capabilities,
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Shared builder for Rust-family backends. Owns the common env baseline
|
|
75
|
+
* (RUST_LOG, HOST, port, real Postgres, cookie keys, bootstrap token
|
|
76
|
+
* path, the `FUZ_TESTING_RESET_DB_ON_STARTUP=true` self-wipe gate) plus
|
|
77
|
+
* the 120s startup window for cargo's first-run build cost.
|
|
78
|
+
*/
|
|
79
|
+
export const make_default_rust_backend_config = (opts) => {
|
|
80
|
+
const { name, port, start_command, database_url, extra_env, capabilities = rust_default_capabilities, paths = build_test_backend_paths(name), bootstrap_overrides, port_env_var = 'PORT', rust_log = 'info', } = opts;
|
|
81
|
+
return {
|
|
82
|
+
name,
|
|
83
|
+
start_command,
|
|
84
|
+
base_url: `http://localhost:${port}`,
|
|
85
|
+
rpc_path: '/api/rpc',
|
|
86
|
+
ws_path: '/api/ws',
|
|
87
|
+
health_path: '/health',
|
|
88
|
+
bootstrap_path: '/api/account/bootstrap',
|
|
89
|
+
cookie_name: 'fuz_session',
|
|
90
|
+
startup_timeout_ms: 120_000,
|
|
91
|
+
env: {
|
|
92
|
+
RUST_LOG: rust_log,
|
|
93
|
+
HOST: 'localhost',
|
|
94
|
+
[port_env_var]: String(port),
|
|
95
|
+
DATABASE_URL: database_url,
|
|
96
|
+
SECRET_FUZ_COOKIE_KEYS: default_test_cookie_keys,
|
|
97
|
+
FUZ_ALLOWED_ORIGINS: 'http://localhost:*',
|
|
98
|
+
FUZ_BOOTSTRAP_TOKEN_PATH: paths.bootstrap_token_path,
|
|
99
|
+
// Self-wipe the auth-namespace schema before migrations on every
|
|
100
|
+
// boot. Read by `fuz_testing::reset_db_on_startup_if_env_set`,
|
|
101
|
+
// which the consumer's test binary invokes from its
|
|
102
|
+
// `pre_migration_hook` between pool creation and
|
|
103
|
+
// `fuz_db::run_migrations`. The `_testing_reset` RPC action
|
|
104
|
+
// (per-test reset) is orthogonal.
|
|
105
|
+
FUZ_TESTING_RESET_DB_ON_STARTUP: 'true',
|
|
106
|
+
...extra_env,
|
|
107
|
+
},
|
|
108
|
+
bootstrap: build_default_bootstrap(paths, bootstrap_overrides),
|
|
109
|
+
capabilities,
|
|
110
|
+
};
|
|
111
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Default test secrets for cross-process backend bootstrap.
|
|
4
|
+
*
|
|
5
|
+
* Every cross-backend consumer needs the same shape: a bootstrap token
|
|
6
|
+
* the harness writes to disk before spawn, a keeper username/password
|
|
7
|
+
* the harness POSTs to `/api/account/bootstrap`, and cookie keys the
|
|
8
|
+
* binary uses to construct its `Keyring`. The literals here are dev-only
|
|
9
|
+
* and protected by `assert_dev_env`; the binaries themselves throw on
|
|
10
|
+
* production load.
|
|
11
|
+
*
|
|
12
|
+
* Each constant is exported individually so consumers can override one
|
|
13
|
+
* without re-deriving the rest. Builders in `default_backend_configs.ts`
|
|
14
|
+
* thread these defaults into the `BackendConfig.bootstrap` block and the
|
|
15
|
+
* `SECRET_FUZ_COOKIE_KEYS` env entry; callers compose the
|
|
16
|
+
* `bootstrap_overrides` knob when they need a non-default keeper.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Fixed bootstrap token written to each backend's `token_path` before
|
|
22
|
+
* spawn. The test binary reads + consumes this via its
|
|
23
|
+
* `*_BOOTSTRAP_TOKEN_PATH` env var; the harness POSTs the same token to
|
|
24
|
+
* `/api/account/bootstrap` to mint the keeper account. Any 32+ char
|
|
25
|
+
* string works — the binary just compares bytes, no entropy required
|
|
26
|
+
* for tests.
|
|
27
|
+
*/
|
|
28
|
+
export declare const default_test_bootstrap_token = "test_bootstrap_token_for_cross_be";
|
|
29
|
+
/** Keeper username used by every cross-process test fixture. */
|
|
30
|
+
export declare const default_test_keeper_username = "keeper";
|
|
31
|
+
/** Keeper password used by every cross-process test fixture. */
|
|
32
|
+
export declare const default_test_keeper_password = "password_test_keeper";
|
|
33
|
+
/**
|
|
34
|
+
* Dev-only cookie keys (64+ chars). The test binary needs
|
|
35
|
+
* `SECRET_FUZ_COOKIE_KEYS` to construct its `Keyring`. Never used in
|
|
36
|
+
* production — the test binaries themselves throw on production load
|
|
37
|
+
* via `assert_dev_env`.
|
|
38
|
+
*/
|
|
39
|
+
export declare const default_test_cookie_keys = "dev_only_cookie_keys_for_cross_backend_tests_not_for_prod_use_xx";
|
|
40
|
+
//# sourceMappingURL=default_secrets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default_secrets.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/default_secrets.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,sCAAsC,CAAC;AAEhF,gEAAgE;AAChE,eAAO,MAAM,4BAA4B,WAAW,CAAC;AAErD,gEAAgE;AAChE,eAAO,MAAM,4BAA4B,yBAAyB,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,qEAC8B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Default test secrets for cross-process backend bootstrap.
|
|
4
|
+
*
|
|
5
|
+
* Every cross-backend consumer needs the same shape: a bootstrap token
|
|
6
|
+
* the harness writes to disk before spawn, a keeper username/password
|
|
7
|
+
* the harness POSTs to `/api/account/bootstrap`, and cookie keys the
|
|
8
|
+
* binary uses to construct its `Keyring`. The literals here are dev-only
|
|
9
|
+
* and protected by `assert_dev_env`; the binaries themselves throw on
|
|
10
|
+
* production load.
|
|
11
|
+
*
|
|
12
|
+
* Each constant is exported individually so consumers can override one
|
|
13
|
+
* without re-deriving the rest. Builders in `default_backend_configs.ts`
|
|
14
|
+
* thread these defaults into the `BackendConfig.bootstrap` block and the
|
|
15
|
+
* `SECRET_FUZ_COOKIE_KEYS` env entry; callers compose the
|
|
16
|
+
* `bootstrap_overrides` knob when they need a non-default keeper.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Fixed bootstrap token written to each backend's `token_path` before
|
|
22
|
+
* spawn. The test binary reads + consumes this via its
|
|
23
|
+
* `*_BOOTSTRAP_TOKEN_PATH` env var; the harness POSTs the same token to
|
|
24
|
+
* `/api/account/bootstrap` to mint the keeper account. Any 32+ char
|
|
25
|
+
* string works — the binary just compares bytes, no entropy required
|
|
26
|
+
* for tests.
|
|
27
|
+
*/
|
|
28
|
+
export const default_test_bootstrap_token = 'test_bootstrap_token_for_cross_be';
|
|
29
|
+
/** Keeper username used by every cross-process test fixture. */
|
|
30
|
+
export const default_test_keeper_username = 'keeper';
|
|
31
|
+
/** Keeper password used by every cross-process test fixture. */
|
|
32
|
+
export const default_test_keeper_password = 'password_test_keeper';
|
|
33
|
+
/**
|
|
34
|
+
* Dev-only cookie keys (64+ chars). The test binary needs
|
|
35
|
+
* `SECRET_FUZ_COOKIE_KEYS` to construct its `Keyring`. Never used in
|
|
36
|
+
* production — the test binaries themselves throw on production load
|
|
37
|
+
* via `assert_dev_env`.
|
|
38
|
+
*/
|
|
39
|
+
export const default_test_cookie_keys = 'dev_only_cookie_keys_for_cross_backend_tests_not_for_prod_use_xx';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
import { type RoleSchemaResult } from '../../auth/role_schema.js';
|
|
3
|
+
import { type SessionOptions } from '../../auth/session_cookie.js';
|
|
4
|
+
import { type RouteSpec } from '../../http/route_spec.js';
|
|
5
|
+
import type { AppSurfaceSpec, RpcEndpointSpec } from '../../http/surface.js';
|
|
6
|
+
import type { AppServerContext } from '../../server/app_server.js';
|
|
7
|
+
/**
|
|
8
|
+
* Session config — cookie name matches the binary's issued session cookie
|
|
9
|
+
* (`fuz_session`) so cookie-attribute assertions + jar extraction line up.
|
|
10
|
+
*/
|
|
11
|
+
export declare const spine_session_options: SessionOptions<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Built-in roles only — the standard spine registers no app-defined role
|
|
14
|
+
* specs. When the spine grows additional grantable roles, thread their
|
|
15
|
+
* registry through `create_role_schema` here so the admin suite picks up
|
|
16
|
+
* grant-path coverage.
|
|
17
|
+
*/
|
|
18
|
+
export declare const spine_roles: RoleSchemaResult;
|
|
19
|
+
/** RPC endpoint mount path — matches the binary's `/api/rpc`. */
|
|
20
|
+
export declare const SPINE_RPC_PATH = "/api/rpc";
|
|
21
|
+
/**
|
|
22
|
+
* Audit-log SSE stream path — `/api/admin` prefix + the
|
|
23
|
+
* `create_audit_log_route_specs` `/audit/stream` route. Matches the default
|
|
24
|
+
* `BackendConfig.sse_path` and the cross-process SSE suite's default. Only
|
|
25
|
+
* mounted by the TS spine binary (which wires `audit_log_sse`); the shared
|
|
26
|
+
* surface stub leaves `ctx.audit_sse` null so the snapshot stays SSE-free.
|
|
27
|
+
*/
|
|
28
|
+
export declare const SPINE_SSE_PATH = "/api/admin/audit/stream";
|
|
29
|
+
/**
|
|
30
|
+
* Factory-form RPC endpoints so the `app_settings_update` handler closes
|
|
31
|
+
* over the per-test `ctx.app_settings`. `create_app_server` (in the binary)
|
|
32
|
+
* owns live dispatch; the surface builder invokes the factory once with a
|
|
33
|
+
* stub ctx for setup-time path/method lookup, so the handler closures are
|
|
34
|
+
* never called across the process boundary.
|
|
35
|
+
*
|
|
36
|
+
* Test binaries append their own `_testing_reset` action to this endpoint's
|
|
37
|
+
* `actions` (see `testing_reset_actions.ts`); it is intentionally excluded
|
|
38
|
+
* here so it stays off the declared surface (the harness calls it directly
|
|
39
|
+
* over the daemon-token channel).
|
|
40
|
+
*/
|
|
41
|
+
export declare const spine_rpc_endpoints: (ctx: AppServerContext) => Array<RpcEndpointSpec>;
|
|
42
|
+
/**
|
|
43
|
+
* Account REST + signup route specs under `/api/account` (bootstrap
|
|
44
|
+
* auto-mounted by the surface builder / `create_app_server`), plus the
|
|
45
|
+
* audit-log SSE stream under `/api/admin` **only when `ctx.audit_sse` is
|
|
46
|
+
* set** (the TS spine binary passes `audit_log_sse: true`).
|
|
47
|
+
*
|
|
48
|
+
* The shared `create_spine_surface_spec()` builds its ctx with
|
|
49
|
+
* `audit_sse: null`, so the declared surface snapshot stays SSE-free and the
|
|
50
|
+
* Rust `spine_stub` cross test is unaffected — only the live TS binary mounts
|
|
51
|
+
* the stream at `SPINE_SSE_PATH`.
|
|
52
|
+
*/
|
|
53
|
+
export declare const create_spine_route_specs: (ctx: AppServerContext) => Array<RouteSpec>;
|
|
54
|
+
/**
|
|
55
|
+
* The `AppSurfaceSpec` for the standard spine surface — the wire-shape
|
|
56
|
+
* source the cross-process round-trip + RPC-round-trip suites validate
|
|
57
|
+
* against. `bootstrap: {mode: 'surface_only'}` mounts
|
|
58
|
+
* `POST /api/account/bootstrap`'s shape to match the binary (which wires
|
|
59
|
+
* bootstrap for real); the harness's `globalSetup` already consumed the
|
|
60
|
+
* live bootstrap, so the cross-process round-trip validates the binary's
|
|
61
|
+
* 409 against the route's declared error schema.
|
|
62
|
+
*/
|
|
63
|
+
export declare const create_spine_surface_spec: () => AppSurfaceSpec;
|
|
64
|
+
//# sourceMappingURL=default_spine_surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default_spine_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/default_spine_surface.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA6B9B,OAAO,EAAqB,KAAK,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAwB,KAAK,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAGxF,OAAO,EAAqB,KAAK,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAGjE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,MAAM,CAAwC,CAAC;AAElG;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,gBAAyC,CAAC;AAEpE,iEAAiE;AACjE,eAAO,MAAM,cAAc,aAAa,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,4BAA4B,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,GAAI,KAAK,gBAAgB,KAAG,KAAK,CAAC,eAAe,CAQhF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GAAI,KAAK,gBAAgB,KAAG,KAAK,CAAC,SAAS,CAkB/E,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,QAAO,cAM1C,CAAC"}
|