@fuzdev/fuz_app 0.69.0 → 0.71.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/db/CLAUDE.md +3 -3
- package/dist/db/cell_history_ddl.d.ts +1 -1
- package/dist/db/cell_history_ddl.js +1 -1
- package/dist/db/fact_ddl.d.ts +11 -11
- package/dist/db/fact_ddl.d.ts.map +1 -1
- package/dist/db/fact_ddl.js +13 -13
- package/dist/db/fact_queries.d.ts +9 -9
- package/dist/db/fact_queries.d.ts.map +1 -1
- package/dist/db/fact_queries.js +18 -18
- package/dist/db/fact_store.d.ts +3 -3
- package/dist/db/fact_store.js +2 -2
- package/dist/testing/CLAUDE.md +16 -11
- package/dist/testing/cross_backend/create_cross_backend_global_setup.d.ts +57 -0
- package/dist/testing/cross_backend/create_cross_backend_global_setup.d.ts.map +1 -0
- package/dist/testing/cross_backend/create_cross_backend_global_setup.js +31 -0
- package/dist/testing/cross_backend/create_schema_parity_global_setup.d.ts +59 -0
- package/dist/testing/cross_backend/create_schema_parity_global_setup.d.ts.map +1 -0
- package/dist/testing/cross_backend/create_schema_parity_global_setup.js +27 -0
- package/dist/testing/cross_backend/default_backend_configs.d.ts +13 -0
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +4 -4
- package/dist/testing/cross_backend/make_cross_backend_project.d.ts +72 -0
- package/dist/testing/cross_backend/make_cross_backend_project.d.ts.map +1 -0
- package/dist/testing/cross_backend/make_cross_backend_project.js +51 -0
- package/dist/testing/cross_backend/setup.d.ts +16 -0
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +16 -0
- package/dist/testing/cross_backend/standard.d.ts +8 -0
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.js +1 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +71 -11
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +38 -5
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +20 -3
- package/dist/testing/schema_introspect.d.ts +74 -58
- package/dist/testing/schema_introspect.d.ts.map +1 -1
- package/dist/testing/schema_introspect.js +77 -15
- package/dist/testing/schema_parity.d.ts +7 -17
- package/dist/testing/schema_parity.d.ts.map +1 -1
- package/dist/testing/schema_parity.js +3 -37
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
import { bootstrap_backend } from './bootstrap_backend.js';
|
|
3
|
+
import { serialize_bootstrapped_handle } from './setup.js';
|
|
4
|
+
/**
|
|
5
|
+
* Build a vitest `globalSetup` default export that spawns both backends.
|
|
6
|
+
*/
|
|
7
|
+
export const create_schema_parity_global_setup = ({ configs, provide_keys = { a: 'parity_handle_a', b: 'parity_handle_b' }, }) => {
|
|
8
|
+
return async (project) => {
|
|
9
|
+
const a = await bootstrap_backend(configs.a());
|
|
10
|
+
// Tear `a` down if `b` fails to spawn — no orphaned child process.
|
|
11
|
+
let b;
|
|
12
|
+
try {
|
|
13
|
+
b = await bootstrap_backend(configs.b());
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
await a.teardown();
|
|
17
|
+
throw err;
|
|
18
|
+
}
|
|
19
|
+
const provide = project.provide;
|
|
20
|
+
provide(provide_keys.a, serialize_bootstrapped_handle(a));
|
|
21
|
+
provide(provide_keys.b, serialize_bootstrapped_handle(b));
|
|
22
|
+
return async () => {
|
|
23
|
+
await b.teardown();
|
|
24
|
+
await a.teardown();
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -70,6 +70,14 @@ export interface MakeDefaultTsBackendConfigOptions {
|
|
|
70
70
|
* override.
|
|
71
71
|
*/
|
|
72
72
|
readonly port_env_var?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Session cookie name the binary's `create_session_config` uses.
|
|
75
|
+
* Defaults to `'fuz_session'`. Must match the consumer's session config
|
|
76
|
+
* — the harness threads the `_testing_reset`-returned keeper cookie into
|
|
77
|
+
* its jar under this name, so a mismatch surfaces as 401s on the
|
|
78
|
+
* `create_account` path (e.g. fuz_forge uses `'fuz_forge_session'`).
|
|
79
|
+
*/
|
|
80
|
+
readonly cookie_name?: string;
|
|
73
81
|
}
|
|
74
82
|
/**
|
|
75
83
|
* Shared builder for TS-family backends (Deno + Node). Owns the common
|
|
@@ -111,6 +119,11 @@ export interface MakeDefaultRustBackendConfigOptions {
|
|
|
111
119
|
* (e.g. `'info,zzz_server=info,testing_zzz_server=info'`).
|
|
112
120
|
*/
|
|
113
121
|
readonly rust_log?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Session cookie name the binary uses. Defaults to `'fuz_session'`.
|
|
124
|
+
* Must match the consumer's session config (see the TS builder's note).
|
|
125
|
+
*/
|
|
126
|
+
readonly cookie_name?: string;
|
|
114
127
|
}
|
|
115
128
|
/**
|
|
116
129
|
* Shared builder for Rust-family backends. Owns the common env baseline
|
|
@@ -1 +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,mBASpC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,mBAStC,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;
|
|
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,mBASpC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,mBAStC,CAAC;AAeH,MAAM,WAAW,iCAAiC;IACjD,gFAAgF;IAChF,QAAQ,CAAC,IAAI,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C;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;IAC3B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,GAC5C,MAAM,mCAAmC,KACvC,aA4CF,CAAC"}
|
|
@@ -49,7 +49,7 @@ const build_default_bootstrap = (paths, overrides) => ({
|
|
|
49
49
|
* genuinely differs.
|
|
50
50
|
*/
|
|
51
51
|
export const make_default_ts_backend_config = (opts) => {
|
|
52
|
-
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;
|
|
52
|
+
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', cookie_name = 'fuz_session', } = opts;
|
|
53
53
|
return {
|
|
54
54
|
name,
|
|
55
55
|
start_command,
|
|
@@ -58,7 +58,7 @@ export const make_default_ts_backend_config = (opts) => {
|
|
|
58
58
|
ws_path: '/api/ws',
|
|
59
59
|
health_path: '/health',
|
|
60
60
|
bootstrap_path: '/api/account/bootstrap',
|
|
61
|
-
cookie_name
|
|
61
|
+
cookie_name,
|
|
62
62
|
startup_timeout_ms: 30_000,
|
|
63
63
|
env: {
|
|
64
64
|
NODE_ENV: 'development',
|
|
@@ -81,7 +81,7 @@ export const make_default_ts_backend_config = (opts) => {
|
|
|
81
81
|
* the 120s startup window for cargo's first-run build cost.
|
|
82
82
|
*/
|
|
83
83
|
export const make_default_rust_backend_config = (opts) => {
|
|
84
|
-
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;
|
|
84
|
+
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', cookie_name = 'fuz_session', } = opts;
|
|
85
85
|
return {
|
|
86
86
|
name,
|
|
87
87
|
start_command,
|
|
@@ -90,7 +90,7 @@ export const make_default_rust_backend_config = (opts) => {
|
|
|
90
90
|
ws_path: '/api/ws',
|
|
91
91
|
health_path: '/health',
|
|
92
92
|
bootstrap_path: '/api/account/bootstrap',
|
|
93
|
-
cookie_name
|
|
93
|
+
cookie_name,
|
|
94
94
|
startup_timeout_ms: 120_000,
|
|
95
95
|
env: {
|
|
96
96
|
RUST_LOG: rust_log,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic vitest project factory for cross-backend integration suites.
|
|
3
|
+
*
|
|
4
|
+
* One vitest project per spawned backend; each runs the consumer's shared
|
|
5
|
+
* `*.cross.test.ts` files against its own bootstrapped binary. The paired
|
|
6
|
+
* `create_cross_backend_global_setup` (in `global_setup.ts`) reads the
|
|
7
|
+
* project's `name` to pick which `BackendConfig` to spawn, so the project
|
|
8
|
+
* name is the single source of truth for backend selection.
|
|
9
|
+
*
|
|
10
|
+
* Consumers compose these into their `vite.config.ts`:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* const cross_backend_projects = process.env.FUZ_TEST_CROSS_BACKEND
|
|
14
|
+
* ? [
|
|
15
|
+
* make_cross_backend_project({name: 'cross_backend_ts_deno', global_setup: GLOBAL_SETUP}),
|
|
16
|
+
* make_cross_backend_project({name: 'cross_backend_rust', global_setup: GLOBAL_SETUP}),
|
|
17
|
+
* ]
|
|
18
|
+
* : [];
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* where `GLOBAL_SETUP = './src/test/cross_backend/global_setup.ts'`.
|
|
22
|
+
*
|
|
23
|
+
* This module is intentionally dependency-free and `assert_dev_env`-free:
|
|
24
|
+
* it runs at vite **config** time (including production builds, where the
|
|
25
|
+
* consumer gates the projects behind an env flag), so it must not pull in
|
|
26
|
+
* the DEV-only test runtime.
|
|
27
|
+
*
|
|
28
|
+
* @module
|
|
29
|
+
*/
|
|
30
|
+
export interface CrossBackendProjectOptions {
|
|
31
|
+
/**
|
|
32
|
+
* vitest project name. `create_cross_backend_global_setup` derives the
|
|
33
|
+
* backend name from it (by default stripping a `cross_backend_(ts_)?`
|
|
34
|
+
* prefix), so name projects `cross_backend_<backend>` (e.g.
|
|
35
|
+
* `cross_backend_rust`, `cross_backend_ts_deno`).
|
|
36
|
+
*/
|
|
37
|
+
readonly name: string;
|
|
38
|
+
/**
|
|
39
|
+
* Path to the consumer's vitest `globalSetup` module, relative to the
|
|
40
|
+
* consumer repo root (e.g. `'./src/test/cross_backend/global_setup.ts'`).
|
|
41
|
+
* That module is expected to export a `create_cross_backend_global_setup`
|
|
42
|
+
* result as its default.
|
|
43
|
+
*/
|
|
44
|
+
readonly global_setup: string;
|
|
45
|
+
/** Test-file globs. Default: `['src/test/cross_backend/*.cross.test.ts']`. */
|
|
46
|
+
readonly include?: ReadonlyArray<string>;
|
|
47
|
+
/** Globs to exclude from `include` (e.g. a backend-specific variant file). Default: `[]`. */
|
|
48
|
+
readonly exclude?: ReadonlyArray<string>;
|
|
49
|
+
/** vitest `sequence.groupOrder`. Default: `3` (runs after unit + db). */
|
|
50
|
+
readonly group_order?: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Build a single cross-backend vitest project config. Spread the results
|
|
54
|
+
* into `test.projects` in the consumer's `vite.config.ts`. `isolate: false`
|
|
55
|
+
* + `fileParallelism: false` because a project shares one spawned backend
|
|
56
|
+
* across its files.
|
|
57
|
+
*/
|
|
58
|
+
export declare const make_cross_backend_project: ({ name, global_setup, include, exclude, group_order, }: CrossBackendProjectOptions) => {
|
|
59
|
+
extends: true;
|
|
60
|
+
test: {
|
|
61
|
+
name: string;
|
|
62
|
+
include: Array<string>;
|
|
63
|
+
exclude: Array<string>;
|
|
64
|
+
globalSetup: Array<string>;
|
|
65
|
+
isolate: false;
|
|
66
|
+
fileParallelism: false;
|
|
67
|
+
sequence: {
|
|
68
|
+
groupOrder: number;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=make_cross_backend_project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make_cross_backend_project.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/make_cross_backend_project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAQH,MAAM,WAAW,0BAA0B;IAC1C;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,6FAA6F;IAC7F,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,yEAAyE;IACzE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GAAI,wDAMxC,0BAA0B,KAAG;IAC/B,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACvB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACvB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAC3B,OAAO,EAAE,KAAK,CAAC;QACf,eAAe,EAAE,KAAK,CAAC;QACvB,QAAQ,EAAE;YAAC,UAAU,EAAE,MAAM,CAAA;SAAC,CAAC;KAC/B,CAAC;CAYD,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic vitest project factory for cross-backend integration suites.
|
|
3
|
+
*
|
|
4
|
+
* One vitest project per spawned backend; each runs the consumer's shared
|
|
5
|
+
* `*.cross.test.ts` files against its own bootstrapped binary. The paired
|
|
6
|
+
* `create_cross_backend_global_setup` (in `global_setup.ts`) reads the
|
|
7
|
+
* project's `name` to pick which `BackendConfig` to spawn, so the project
|
|
8
|
+
* name is the single source of truth for backend selection.
|
|
9
|
+
*
|
|
10
|
+
* Consumers compose these into their `vite.config.ts`:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* const cross_backend_projects = process.env.FUZ_TEST_CROSS_BACKEND
|
|
14
|
+
* ? [
|
|
15
|
+
* make_cross_backend_project({name: 'cross_backend_ts_deno', global_setup: GLOBAL_SETUP}),
|
|
16
|
+
* make_cross_backend_project({name: 'cross_backend_rust', global_setup: GLOBAL_SETUP}),
|
|
17
|
+
* ]
|
|
18
|
+
* : [];
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* where `GLOBAL_SETUP = './src/test/cross_backend/global_setup.ts'`.
|
|
22
|
+
*
|
|
23
|
+
* This module is intentionally dependency-free and `assert_dev_env`-free:
|
|
24
|
+
* it runs at vite **config** time (including production builds, where the
|
|
25
|
+
* consumer gates the projects behind an env flag), so it must not pull in
|
|
26
|
+
* the DEV-only test runtime.
|
|
27
|
+
*
|
|
28
|
+
* @module
|
|
29
|
+
*/
|
|
30
|
+
/** Default test-file globs — the convention is `src/test/cross_backend/*.cross.test.ts`. */
|
|
31
|
+
const DEFAULT_INCLUDE = ['src/test/cross_backend/*.cross.test.ts'];
|
|
32
|
+
/** vitest `sequence.groupOrder` for cross-backend projects — after unit (1) + db (2). */
|
|
33
|
+
const DEFAULT_GROUP_ORDER = 3;
|
|
34
|
+
/**
|
|
35
|
+
* Build a single cross-backend vitest project config. Spread the results
|
|
36
|
+
* into `test.projects` in the consumer's `vite.config.ts`. `isolate: false`
|
|
37
|
+
* + `fileParallelism: false` because a project shares one spawned backend
|
|
38
|
+
* across its files.
|
|
39
|
+
*/
|
|
40
|
+
export const make_cross_backend_project = ({ name, global_setup, include = DEFAULT_INCLUDE, exclude = [], group_order = DEFAULT_GROUP_ORDER, }) => ({
|
|
41
|
+
extends: true,
|
|
42
|
+
test: {
|
|
43
|
+
name,
|
|
44
|
+
include: [...include],
|
|
45
|
+
exclude: [...exclude],
|
|
46
|
+
globalSetup: [global_setup],
|
|
47
|
+
isolate: false,
|
|
48
|
+
fileParallelism: false,
|
|
49
|
+
sequence: { groupOrder: group_order },
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -8,6 +8,7 @@ import { type RpcEndpointsSuiteOption } from '../rpc_helpers.js';
|
|
|
8
8
|
import { type BackendCapabilities } from './capabilities.js';
|
|
9
9
|
import type { AppSurfaceSpec } from '../../http/surface.js';
|
|
10
10
|
import { type FetchTransport } from '../transports/fetch_transport.js';
|
|
11
|
+
import type { SchemaSnapshot } from '../schema_introspect.js';
|
|
11
12
|
import type { BackendHandle } from './spawn_backend.js';
|
|
12
13
|
/**
|
|
13
14
|
* Options for `TestFixture.create_account` — mints an additional
|
|
@@ -321,6 +322,21 @@ export interface CrossProcessSetupOptions {
|
|
|
321
322
|
*/
|
|
322
323
|
readonly extra_accounts?: ReadonlyArray<ExtraAccountSpec>;
|
|
323
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* Capture a backend's schema snapshot over the `_testing_schema_snapshot`
|
|
327
|
+
* RPC action (keeper daemon-token channel). The canonical way for a
|
|
328
|
+
* cross-impl parity gate to read each backend's live schema — pair two
|
|
329
|
+
* calls with `assert_schema_snapshots_equal` (`testing/schema_parity.js`).
|
|
330
|
+
*
|
|
331
|
+
* `exclude_tables` drops documented divergences from both sides before
|
|
332
|
+
* comparison (e.g. a cell-primary Rust backend lacks tables the TS schema
|
|
333
|
+
* has). Each impl answers from its own introspection — TS via
|
|
334
|
+
* `query_schema_snapshot`, Rust via `fuz_db::query_schema_snapshot` — and
|
|
335
|
+
* the snapshot shapes match by design.
|
|
336
|
+
*/
|
|
337
|
+
export declare const capture_schema_snapshot: (handle: ReconstructedBootstrappedBackendHandle, options?: {
|
|
338
|
+
exclude_tables?: ReadonlyArray<string>;
|
|
339
|
+
}) => Promise<SchemaSnapshot>;
|
|
324
340
|
/**
|
|
325
341
|
* Build a `SetupTest` against a spawned + bootstrapped backend.
|
|
326
342
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/setup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAuB9B,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAE5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAC,gBAAgB,EAAE,sBAAsB,EAAC,MAAM,4BAA4B,CAAC;AACzF,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAIjE,OAAO,EAKN,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAGN,KAAK,uBAAuB,EAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA0B,KAAK,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACpF,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAyB,KAAK,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAC7F,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEtD;;;;;GAKG;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Ae,CAAC;IAC9B;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACjD;;;;;OAKG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CAChC;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,gCAAgC,GAAI,KAAK,CAAC,CAAC,SAAS,4BAA4B,EAC5F,SAAS,CAAC,KACR;IACF,UAAU,EAAE,SAAS,CAAC;IACtB,cAAc,EAAE,cAAc,CAAC;IAC/B,YAAY,EAAE,mBAAmB,CAAC;IAClC,eAAe,EAAE,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACtC,kBAAkB,EAAE,CAAC,CAAC,oBAAoB,CAAC,CAAC;IAC5C,aAAa,EAAE,CAAC,CAAC,eAAe,CAAC,CAAC;CA0BjC,CAAC"}
|
|
@@ -233,6 +233,22 @@ const rpc_via_transport = async (transport, rpc_path, method, params, backend_na
|
|
|
233
233
|
}
|
|
234
234
|
return raw.result;
|
|
235
235
|
};
|
|
236
|
+
/**
|
|
237
|
+
* Capture a backend's schema snapshot over the `_testing_schema_snapshot`
|
|
238
|
+
* RPC action (keeper daemon-token channel). The canonical way for a
|
|
239
|
+
* cross-impl parity gate to read each backend's live schema — pair two
|
|
240
|
+
* calls with `assert_schema_snapshots_equal` (`testing/schema_parity.js`).
|
|
241
|
+
*
|
|
242
|
+
* `exclude_tables` drops documented divergences from both sides before
|
|
243
|
+
* comparison (e.g. a cell-primary Rust backend lacks tables the TS schema
|
|
244
|
+
* has). Each impl answers from its own introspection — TS via
|
|
245
|
+
* `query_schema_snapshot`, Rust via `fuz_db::query_schema_snapshot` — and
|
|
246
|
+
* the snapshot shapes match by design.
|
|
247
|
+
*/
|
|
248
|
+
export const capture_schema_snapshot = async (handle, options = {}) => {
|
|
249
|
+
const raw = await rpc_via_transport(handle.keeper_transport, handle.config.rpc_path, '_testing_schema_snapshot', { exclude_tables: [...(options.exclude_tables ?? [])] }, handle.config.name, { [DAEMON_TOKEN_HEADER]: handle.daemon_token });
|
|
250
|
+
return raw;
|
|
251
|
+
};
|
|
236
252
|
/**
|
|
237
253
|
* Backdating offset (seconds) the `mint_expired_session` seam passes to
|
|
238
254
|
* `mint_test_session` / `_testing_mint_session`. A minute in the past is
|
|
@@ -86,6 +86,14 @@ export interface StandardCrossProcessTestOptions {
|
|
|
86
86
|
* `0` to skip the assertion entirely.
|
|
87
87
|
*/
|
|
88
88
|
error_coverage_min?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Forwarded to `describe_round_trip_validation` as `skip_routes`
|
|
91
|
+
* (`'METHOD /path'` keys). For consumer REST routes whose responses
|
|
92
|
+
* aren't JSON-with-an-output-schema and so can't be round-tripped — e.g.
|
|
93
|
+
* fuz_forge's git smart-HTTP routes (`git-upload-pack` / `git-receive-pack`
|
|
94
|
+
* / `info/refs`) which stream git protocol bytes.
|
|
95
|
+
*/
|
|
96
|
+
round_trip_skip_routes?: Array<string>;
|
|
89
97
|
}
|
|
90
98
|
/**
|
|
91
99
|
* Run the cross-process standard test bundle — integration, admin (when
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standard.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/standard.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAM1D,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAC,mBA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AE,mBAAmB,CAAC;IAClC,uFAAuF;IACvF,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC;;;;;OAKG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACvC;AAED;;;;GAIG;AACH,eAAO,MAAM,qCAAqC,GACjD,SAAS,+BAA+B,KACtC,IAsCF,CAAC"}
|
|
@@ -22,6 +22,7 @@ export const describe_standard_cross_process_tests = (options) => {
|
|
|
22
22
|
setup_test: options.setup_test,
|
|
23
23
|
surface_source: options.surface_source,
|
|
24
24
|
capabilities: options.capabilities,
|
|
25
|
+
skip_routes: options.round_trip_skip_routes,
|
|
25
26
|
});
|
|
26
27
|
describe_rpc_round_trip_tests({
|
|
27
28
|
setup_test: options.setup_test,
|
|
@@ -2,11 +2,12 @@ import '../assert_dev_env.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Test-binary RPC actions for cross-process integration tests.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Four daemon-token-authed actions, bundled by `create_testing_actions`:
|
|
6
6
|
* **`_testing_reset`** (DB wipe + keeper re-seed), **`_testing_drain_effects`**
|
|
7
|
-
* (audit barrier),
|
|
7
|
+
* (audit barrier), **`_testing_mint_session`** (forge an
|
|
8
8
|
* expired-by-construction server-side session for the expiry conformance
|
|
9
|
-
* cases)
|
|
9
|
+
* cases), and **`_testing_schema_snapshot`** (introspect the live schema for
|
|
10
|
+
* cross-impl parity diffing against a Rust backend's `fuz_db` snapshot).
|
|
10
11
|
*
|
|
11
12
|
* `_testing_reset` — full DB wipe + keeper re-seed + optional
|
|
12
13
|
* secondary-account seeding. The
|
|
@@ -62,6 +63,7 @@ import { type RpcAction } from '../../actions/action_rpc.js';
|
|
|
62
63
|
import type { AppDeps } from '../../auth/deps.js';
|
|
63
64
|
import type { SessionOptions } from '../../auth/session_cookie.js';
|
|
64
65
|
import type { DaemonTokenState } from '../../auth/daemon_token.js';
|
|
66
|
+
import type { Db } from '../../db/db.js';
|
|
65
67
|
/**
|
|
66
68
|
* The `_testing_reset` action spec.
|
|
67
69
|
*
|
|
@@ -212,6 +214,61 @@ export declare const testing_mint_session_action_spec: {
|
|
|
212
214
|
* `create_testing_actions`; in-process suites mount it directly).
|
|
213
215
|
*/
|
|
214
216
|
export declare const create_testing_drain_effects_action: () => RpcAction;
|
|
217
|
+
/**
|
|
218
|
+
* `_testing_schema_snapshot` — introspect the live database into a normalized
|
|
219
|
+
* `SchemaSnapshot` for cross-impl parity diffing. The cross-backend harness
|
|
220
|
+
* calls this on each backend, then `assert_schema_snapshots_equal`s the
|
|
221
|
+
* results (a Rust backend answers from `fuz_db::query_schema_snapshot`; the
|
|
222
|
+
* shapes match by design). Optional `exclude_tables` drops documented
|
|
223
|
+
* divergences from both sides before comparison.
|
|
224
|
+
*
|
|
225
|
+
* `auth` gates on the daemon-token credential, matching `_testing_reset`.
|
|
226
|
+
*/
|
|
227
|
+
export declare const testing_schema_snapshot_action_spec: {
|
|
228
|
+
readonly method: "_testing_schema_snapshot";
|
|
229
|
+
readonly kind: "request_response";
|
|
230
|
+
readonly initiator: "frontend";
|
|
231
|
+
readonly auth: {
|
|
232
|
+
readonly account: "required";
|
|
233
|
+
readonly actor: "none";
|
|
234
|
+
readonly credential_types: readonly ["daemon_token"];
|
|
235
|
+
};
|
|
236
|
+
readonly side_effects: false;
|
|
237
|
+
readonly input: z.ZodObject<{
|
|
238
|
+
exclude_tables: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
239
|
+
}, z.core.$strict>;
|
|
240
|
+
readonly output: z.ZodObject<{
|
|
241
|
+
tables: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
242
|
+
columns: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
243
|
+
data_type: z.ZodString;
|
|
244
|
+
udt_name: z.ZodString;
|
|
245
|
+
is_nullable: z.ZodBoolean;
|
|
246
|
+
column_default: z.ZodNullable<z.ZodString>;
|
|
247
|
+
is_identity: z.ZodBoolean;
|
|
248
|
+
}, z.core.$strip>>;
|
|
249
|
+
indexes: z.ZodArray<z.ZodObject<{
|
|
250
|
+
name: z.ZodString;
|
|
251
|
+
definition: z.ZodString;
|
|
252
|
+
}, z.core.$strip>>;
|
|
253
|
+
constraints: z.ZodArray<z.ZodObject<{
|
|
254
|
+
name: z.ZodString;
|
|
255
|
+
type: z.ZodString;
|
|
256
|
+
definition: z.ZodString;
|
|
257
|
+
}, z.core.$strip>>;
|
|
258
|
+
}, z.core.$strip>>;
|
|
259
|
+
sequences: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
260
|
+
data_type: z.ZodString;
|
|
261
|
+
}, z.core.$strip>>;
|
|
262
|
+
}, z.core.$strip>;
|
|
263
|
+
readonly async: true;
|
|
264
|
+
readonly description: "Test-binary only — introspect the live schema into a normalized snapshot for cross-impl parity diffing.";
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* Build the standalone `_testing_schema_snapshot` action. No deps —
|
|
268
|
+
* introspects `ctx.db` via `query_schema_snapshot`. Bundled by
|
|
269
|
+
* `create_testing_actions`; mount directly for in-process use.
|
|
270
|
+
*/
|
|
271
|
+
export declare const create_testing_schema_snapshot_action: () => RpcAction;
|
|
215
272
|
/** Options for `create_testing_actions`. */
|
|
216
273
|
export interface CreateTestingActionsOptions {
|
|
217
274
|
/**
|
|
@@ -229,15 +286,18 @@ export interface CreateTestingActionsOptions {
|
|
|
229
286
|
*/
|
|
230
287
|
readonly daemon_token_state: DaemonTokenState;
|
|
231
288
|
/**
|
|
232
|
-
* Consumer-supplied callback invoked after the auth-table reset
|
|
233
|
-
* `
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
289
|
+
* Consumer-supplied callback invoked after the auth-table reset, passed
|
|
290
|
+
* the same transactional `Db` the auth wipes ran on. DB-domain consumers
|
|
291
|
+
* (e.g. fuz_forge truncating its cell / fact / file tables) MUST use this
|
|
292
|
+
* `db` rather than a separately-pooled connection — under PGlite's single
|
|
293
|
+
* connection a second connection deadlocks against this still-open
|
|
294
|
+
* transaction. `testing_zzz_server` clears in-memory workspace registry +
|
|
295
|
+
* terminals + scoped-FS scratch (ignores `db`); `testing_spine_stub` has
|
|
296
|
+
* no domain layer and omits the option. Runs inside the same RPC dispatch
|
|
297
|
+
* as the auth-table writes, so a throw surfaces to the caller as a
|
|
298
|
+
* JSON-RPC error and the per-test fixture short-circuits.
|
|
239
299
|
*/
|
|
240
|
-
readonly reset_state?: () => Promise<void> | void;
|
|
300
|
+
readonly reset_state?: (db: Db) => Promise<void> | void;
|
|
241
301
|
}
|
|
242
302
|
/**
|
|
243
303
|
* Build the testing RPC actions for a test binary's registry.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing_reset_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_reset_actions.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B
|
|
1
|
+
{"version":3,"file":"testing_reset_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_reset_actions.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAa,KAAK,SAAS,EAAC,MAAM,6BAA6B,CAAC;AAEvE,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAC,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env.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Test-binary RPC actions for cross-process integration tests.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Four daemon-token-authed actions, bundled by `create_testing_actions`:
|
|
6
6
|
* **`_testing_reset`** (DB wipe + keeper re-seed), **`_testing_drain_effects`**
|
|
7
|
-
* (audit barrier),
|
|
7
|
+
* (audit barrier), **`_testing_mint_session`** (forge an
|
|
8
8
|
* expired-by-construction server-side session for the expiry conformance
|
|
9
|
-
* cases)
|
|
9
|
+
* cases), and **`_testing_schema_snapshot`** (introspect the live schema for
|
|
10
|
+
* cross-impl parity diffing against a Rust backend's `fuz_db` snapshot).
|
|
10
11
|
*
|
|
11
12
|
* `_testing_reset` — full DB wipe + keeper re-seed + optional
|
|
12
13
|
* secondary-account seeding. The
|
|
@@ -62,6 +63,7 @@ import { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
|
62
63
|
import { rpc_action } from '../../actions/action_rpc.js';
|
|
63
64
|
import { ROLE_ADMIN, ROLE_KEEPER } from '../../auth/role_schema.js';
|
|
64
65
|
import { auth_integration_truncate_tables } from '../db.js';
|
|
66
|
+
import { query_schema_snapshot, SchemaSnapshot } from '../schema_introspect.js';
|
|
65
67
|
import { create_test_account_with_credentials, mint_test_session, DEFAULT_TEST_PASSWORD, } from '../app_server.js';
|
|
66
68
|
/** Output shape for an individual seeded account (keeper or extra). */
|
|
67
69
|
const SeededAccountShape = z.strictObject({
|
|
@@ -188,6 +190,33 @@ export const testing_mint_session_action_spec = {
|
|
|
188
190
|
* `create_testing_actions`; in-process suites mount it directly).
|
|
189
191
|
*/
|
|
190
192
|
export const create_testing_drain_effects_action = () => rpc_action(testing_drain_effects_action_spec, async () => ({ ok: true }));
|
|
193
|
+
/**
|
|
194
|
+
* `_testing_schema_snapshot` — introspect the live database into a normalized
|
|
195
|
+
* `SchemaSnapshot` for cross-impl parity diffing. The cross-backend harness
|
|
196
|
+
* calls this on each backend, then `assert_schema_snapshots_equal`s the
|
|
197
|
+
* results (a Rust backend answers from `fuz_db::query_schema_snapshot`; the
|
|
198
|
+
* shapes match by design). Optional `exclude_tables` drops documented
|
|
199
|
+
* divergences from both sides before comparison.
|
|
200
|
+
*
|
|
201
|
+
* `auth` gates on the daemon-token credential, matching `_testing_reset`.
|
|
202
|
+
*/
|
|
203
|
+
export const testing_schema_snapshot_action_spec = {
|
|
204
|
+
method: '_testing_schema_snapshot',
|
|
205
|
+
kind: 'request_response',
|
|
206
|
+
initiator: 'frontend',
|
|
207
|
+
auth: { account: 'required', actor: 'none', credential_types: ['daemon_token'] },
|
|
208
|
+
side_effects: false,
|
|
209
|
+
input: z.strictObject({ exclude_tables: z.array(z.string()).optional() }),
|
|
210
|
+
output: SchemaSnapshot,
|
|
211
|
+
async: true,
|
|
212
|
+
description: 'Test-binary only — introspect the live schema into a normalized snapshot for cross-impl parity diffing.',
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Build the standalone `_testing_schema_snapshot` action. No deps —
|
|
216
|
+
* introspects `ctx.db` via `query_schema_snapshot`. Bundled by
|
|
217
|
+
* `create_testing_actions`; mount directly for in-process use.
|
|
218
|
+
*/
|
|
219
|
+
export const create_testing_schema_snapshot_action = () => rpc_action(testing_schema_snapshot_action_spec, async (input, ctx) => query_schema_snapshot(ctx.db, { exclude_tables: input.exclude_tables }));
|
|
191
220
|
/**
|
|
192
221
|
* Build the testing RPC actions for a test binary's registry.
|
|
193
222
|
*
|
|
@@ -279,9 +308,12 @@ export const create_testing_actions = (deps, options) => {
|
|
|
279
308
|
// of stale-id-then-refresh on the next call.
|
|
280
309
|
daemon_token_state.keeper_account_id = keeper.account.id;
|
|
281
310
|
// 7. Fire domain-state reset (zzz workspaces/terminals/scratch,
|
|
282
|
-
// or no-op for spine_stub).
|
|
311
|
+
// fuz_forge cell/fact/file truncation, or no-op for spine_stub).
|
|
312
|
+
// Pass the transactional `ctx.db` so DB-domain truncation runs
|
|
313
|
+
// on the same connection — a separate pool connection deadlocks
|
|
314
|
+
// against this open transaction under PGlite.
|
|
283
315
|
if (reset_state)
|
|
284
|
-
await reset_state();
|
|
316
|
+
await reset_state(ctx.db);
|
|
285
317
|
return { ...keeper, extra_accounts: extras };
|
|
286
318
|
}),
|
|
287
319
|
rpc_action(testing_mint_session_action_spec, async (input, ctx) => {
|
|
@@ -295,6 +327,7 @@ export const create_testing_actions = (deps, options) => {
|
|
|
295
327
|
return { session_cookie };
|
|
296
328
|
}),
|
|
297
329
|
create_testing_drain_effects_action(),
|
|
330
|
+
create_testing_schema_snapshot_action(),
|
|
298
331
|
];
|
|
299
332
|
};
|
|
300
333
|
/** Set of auth-namespace tables `_testing_reset` wipes. Mirrored by the coverage test. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAsB7B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAM9D,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAiB1B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAC,KAAK,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AACzE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAGxD;;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,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC;;;;;;;;;;;;OAYG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,mCAAmC,GAC/C,SAAS,8BAA8B,KACrC,
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAsB7B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAM9D,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAiB1B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAC,KAAK,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AACzE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAGxD;;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,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC;;;;;;;;;;;;OAYG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,mCAAmC,GAC/C,SAAS,8BAA8B,KACrC,IA60CF,CAAC"}
|
|
@@ -605,13 +605,30 @@ export const describe_standard_integration_tests = (options) => {
|
|
|
605
605
|
test('non-admin cannot access admin routes', async () => {
|
|
606
606
|
const fixture = await options.setup_test();
|
|
607
607
|
// admin routes are optional in the base suite — admin-specific coverage
|
|
608
|
-
// lives in describe_standard_admin_integration_tests
|
|
609
|
-
|
|
608
|
+
// lives in describe_standard_admin_integration_tests.
|
|
609
|
+
//
|
|
610
|
+
// Pick an admin REST route where a clean role-denial 403 is
|
|
611
|
+
// reachable: account-grain (`actor: 'none'`, so the authorization
|
|
612
|
+
// phase doesn't first demand an acting actor → `actor_required`)
|
|
613
|
+
// and input/param/query-free (so input validation doesn't 400
|
|
614
|
+
// first, per the 401 → 400 → 403 phase order). Admin surfaces are
|
|
615
|
+
// RPC-first now; a consumer may expose no such REST route (fuz_app
|
|
616
|
+
// itself, zzz) — then this REST-era check is a no-op and RPC denial
|
|
617
|
+
// is covered by `describe_rpc_attack_surface_tests`.
|
|
618
|
+
const admin_route = route_specs.find((s) => (s.auth.roles?.includes('admin') ?? false) &&
|
|
619
|
+
s.auth.actor === 'none' &&
|
|
620
|
+
!s.input &&
|
|
621
|
+
!s.params &&
|
|
622
|
+
!s.query);
|
|
610
623
|
if (!admin_route)
|
|
611
624
|
return;
|
|
625
|
+
// Probe with a freshly-created account — it holds no admin role
|
|
626
|
+
// (the keeper fixture behind `create_session_headers` does, so it
|
|
627
|
+
// would pass the gate).
|
|
628
|
+
const non_admin = await fixture.create_account({ username: 'non_admin_admin_probe' });
|
|
612
629
|
const res = await fixture.transport(admin_route.path, {
|
|
613
630
|
method: admin_route.method,
|
|
614
|
-
headers:
|
|
631
|
+
headers: { cookie: `${cookie_name}=${non_admin.session_cookie}` },
|
|
615
632
|
});
|
|
616
633
|
assert.strictEqual(res.status, 403);
|
|
617
634
|
const body = await res.json();
|