@fuzdev/fuz_app 0.175.0 → 0.176.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/README.md +3 -2
- package/dist/actions/CLAUDE.md +10 -8
- package/dist/actions/ws_outbound_writer.d.ts +8 -8
- package/dist/actions/ws_outbound_writer.d.ts.map +1 -1
- package/dist/actions/ws_outbound_writer.js +8 -11
- package/dist/auth/keyring.d.ts +1 -1
- package/dist/auth/keyring.js +1 -1
- package/dist/db/CLAUDE.md +9 -0
- package/dist/db/fact_disk_storage.d.ts +3 -2
- package/dist/db/fact_disk_storage.d.ts.map +1 -1
- package/dist/db/fact_disk_storage.js +2 -1
- package/dist/db/postgres_url.d.ts +95 -0
- package/dist/db/postgres_url.d.ts.map +1 -0
- package/dist/db/postgres_url.js +167 -0
- package/dist/dev/setup.d.ts +101 -33
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +174 -71
- package/dist/env/dotenv.d.ts +1 -1
- package/dist/env/dotenv.d.ts.map +1 -1
- package/dist/env/dotenv.js +2 -3
- package/dist/http/CLAUDE.md +1 -1
- package/dist/http/body_limit.d.ts +10 -16
- package/dist/http/body_limit.d.ts.map +1 -1
- package/dist/http/body_limit.js +10 -16
- package/dist/runtime/deps.d.ts +81 -45
- package/dist/runtime/deps.d.ts.map +1 -1
- package/dist/runtime/deps.js +7 -2
- package/dist/runtime/mock.d.ts +63 -16
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +75 -35
- package/dist/runtime/node.d.ts +3 -2
- package/dist/runtime/node.d.ts.map +1 -1
- package/dist/runtime/node.js +20 -72
- package/dist/runtime/process_id.d.ts +24 -0
- package/dist/runtime/process_id.d.ts.map +1 -0
- package/dist/runtime/process_id.js +27 -0
- package/dist/runtime/secure_file.d.ts +8 -30
- package/dist/runtime/secure_file.d.ts.map +1 -1
- package/dist/runtime/secure_file.js +23 -51
- package/dist/server/app_server.d.ts +2 -2
- package/dist/server/static.d.ts +1 -1
- package/dist/testing/CLAUDE.md +28 -27
- package/dist/testing/cross_backend/backend_config.d.ts +7 -7
- package/dist/testing/cross_backend/backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/bench/bench_report.d.ts +2 -2
- package/dist/testing/cross_backend/bench/bench_report.js +2 -2
- package/dist/testing/cross_backend/body_size_smuggling.d.ts.map +1 -1
- package/dist/testing/cross_backend/body_size_smuggling.js +1 -4
- package/dist/testing/cross_backend/bootstrap_backend.d.ts +1 -1
- package/dist/testing/cross_backend/capabilities.d.ts +2 -2
- package/dist/testing/cross_backend/create_cross_backend_global_setup.d.ts +2 -2
- package/dist/testing/cross_backend/create_cross_backend_global_setup.js +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +2 -2
- package/dist/testing/cross_backend/default_backend_configs.d.ts +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +4 -4
- package/dist/testing/cross_backend/differential.d.ts +2 -2
- package/dist/testing/cross_backend/differential.js +6 -6
- package/dist/testing/cross_backend/fact_serving.js +1 -1
- package/dist/testing/cross_backend/make_cross_backend_project.d.ts +2 -2
- package/dist/testing/cross_backend/make_cross_backend_project.js +1 -1
- package/dist/testing/cross_backend/origin_conformance.json +1 -1
- package/dist/testing/cross_backend/postgres_database.d.ts +7 -21
- package/dist/testing/cross_backend/postgres_database.d.ts.map +1 -1
- package/dist/testing/cross_backend/postgres_database.js +24 -35
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +10 -12
- package/dist/testing/cross_backend/testing_server_core.d.ts +13 -17
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +7 -17
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +0 -51
- package/dist/testing/cross_backend/ws_outbound_overflow.js +2 -2
- package/dist/testing/daemon_info.d.ts +11 -6
- package/dist/testing/daemon_info.d.ts.map +1 -1
- package/dist/testing/daemon_info.js +11 -8
- package/dist/testing/middleware_gate_probes.js +2 -2
- package/package.json +4 -9
- package/dist/runtime/deno.d.ts +0 -21
- package/dist/runtime/deno.d.ts.map +0 -1
- package/dist/runtime/deno.js +0 -191
- package/dist/testing/cross_backend/testing_server_deno.d.ts +0 -5
- package/dist/testing/cross_backend/testing_server_deno.d.ts.map +0 -1
- package/dist/testing/cross_backend/testing_server_deno.js +0 -38
package/dist/runtime/node.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Node.js implementation of `RuntimeDeps`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Backed by Node.js APIs. Used for running servers on Node and Bun (which
|
|
5
|
+
* implements the `node:*` surface this module touches) and for tests (vitest
|
|
6
|
+
* runs in Node).
|
|
6
7
|
*
|
|
7
8
|
* @module
|
|
8
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/runtime/node.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/runtime/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,WAAW,CAAC;AAIzD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC/B,OAAM,aAAa,CAAC,MAAM,CAAyB,KACjD,WA0ID,CAAC"}
|
package/dist/runtime/node.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Node.js implementation of `RuntimeDeps`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Backed by Node.js APIs. Used for running servers on Node and Bun (which
|
|
5
|
+
* implements the `node:*` surface this module touches) and for tests (vitest
|
|
6
|
+
* runs in Node).
|
|
6
7
|
*
|
|
7
8
|
* @module
|
|
8
9
|
*/
|
|
9
10
|
import { Buffer } from 'node:buffer';
|
|
10
|
-
import { spawn } from 'node:child_process';
|
|
11
11
|
import { createReadStream, createWriteStream } from 'node:fs';
|
|
12
12
|
import { stat, mkdir, readFile, readdir, writeFile, rename, rm, open } from 'node:fs/promises';
|
|
13
13
|
import process from 'node:process';
|
|
14
14
|
import { Readable } from 'node:stream';
|
|
15
15
|
import { pipeline } from 'node:stream/promises';
|
|
16
16
|
import { load_secure_file_node } from './secure_file.js';
|
|
17
|
+
import { assert_process_id } from './process_id.js';
|
|
17
18
|
/**
|
|
18
19
|
* Create a `RuntimeDeps` backed by Node.js APIs.
|
|
19
20
|
*
|
|
@@ -31,6 +32,21 @@ export const create_node_runtime = (args = process.argv.slice(2)) => ({
|
|
|
31
32
|
args,
|
|
32
33
|
cwd: () => process.cwd(),
|
|
33
34
|
exit: (code) => process.exit(code),
|
|
35
|
+
probe_process: (pid) => {
|
|
36
|
+
assert_process_id(pid);
|
|
37
|
+
try {
|
|
38
|
+
process.kill(pid, 0);
|
|
39
|
+
return 'running';
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
const code = error.code;
|
|
43
|
+
if (code === 'ESRCH')
|
|
44
|
+
return 'not_found';
|
|
45
|
+
if (code === 'EPERM')
|
|
46
|
+
return 'not_permitted';
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
},
|
|
34
50
|
// === Local File System ===
|
|
35
51
|
stat: async (path) => {
|
|
36
52
|
try {
|
|
@@ -58,7 +74,7 @@ export const create_node_runtime = (args = process.argv.slice(2)) => ({
|
|
|
58
74
|
read_file_stream: async (path) => {
|
|
59
75
|
// `createReadStream` is lazy — a missing file surfaces as a stream `error`
|
|
60
76
|
// event at consume time, not at the call. `stat` first so we honor the
|
|
61
|
-
// interface's eager-throw contract (matching
|
|
77
|
+
// interface's eager-throw contract (matching the mock).
|
|
62
78
|
await stat(path);
|
|
63
79
|
return Readable.toWeb(createReadStream(path));
|
|
64
80
|
},
|
|
@@ -107,74 +123,6 @@ export const create_node_runtime = (args = process.argv.slice(2)) => ({
|
|
|
107
123
|
remove: (path, options) => rm(path, options),
|
|
108
124
|
// === HTTP ===
|
|
109
125
|
fetch: globalThis.fetch,
|
|
110
|
-
// === Local Commands ===
|
|
111
|
-
run_command: (cmd, args, options) => {
|
|
112
|
-
return new Promise((resolve) => {
|
|
113
|
-
const proc = spawn(cmd, args, {
|
|
114
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
115
|
-
cwd: options?.cwd
|
|
116
|
-
});
|
|
117
|
-
const stdout_chunks = [];
|
|
118
|
-
const stderr_chunks = [];
|
|
119
|
-
let timed_out = false;
|
|
120
|
-
let done = false;
|
|
121
|
-
const finish = (result) => {
|
|
122
|
-
if (done)
|
|
123
|
-
return;
|
|
124
|
-
done = true;
|
|
125
|
-
if (timer !== null)
|
|
126
|
-
clearTimeout(timer);
|
|
127
|
-
if (options?.signal)
|
|
128
|
-
options.signal.removeEventListener('abort', on_abort);
|
|
129
|
-
resolve(result);
|
|
130
|
-
};
|
|
131
|
-
const on_abort = () => {
|
|
132
|
-
proc.kill();
|
|
133
|
-
};
|
|
134
|
-
const timer = options?.timeout_ms !== undefined
|
|
135
|
-
? setTimeout(() => {
|
|
136
|
-
timed_out = true;
|
|
137
|
-
proc.kill();
|
|
138
|
-
}, options.timeout_ms)
|
|
139
|
-
: null;
|
|
140
|
-
if (options?.signal) {
|
|
141
|
-
if (options.signal.aborted)
|
|
142
|
-
proc.kill();
|
|
143
|
-
else
|
|
144
|
-
options.signal.addEventListener('abort', on_abort, { once: true });
|
|
145
|
-
}
|
|
146
|
-
proc.stdout.on('data', (chunk) => stdout_chunks.push(chunk));
|
|
147
|
-
proc.stderr.on('data', (chunk) => stderr_chunks.push(chunk));
|
|
148
|
-
proc.on('error', (error) => {
|
|
149
|
-
finish({
|
|
150
|
-
success: false,
|
|
151
|
-
code: 1,
|
|
152
|
-
stdout: '',
|
|
153
|
-
stderr: `Failed to execute command: ${error.message}`
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
proc.on('close', (code) => {
|
|
157
|
-
const result = {
|
|
158
|
-
success: code === 0 && !timed_out,
|
|
159
|
-
code: code ?? 1,
|
|
160
|
-
stdout: Buffer.concat(stdout_chunks).toString('utf-8').trim(),
|
|
161
|
-
stderr: Buffer.concat(stderr_chunks).toString('utf-8').trim()
|
|
162
|
-
};
|
|
163
|
-
if (options?.timeout_ms !== undefined)
|
|
164
|
-
result.timed_out = timed_out;
|
|
165
|
-
finish(result);
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
},
|
|
169
|
-
run_command_inherit: (cmd, args) => {
|
|
170
|
-
return new Promise((resolve) => {
|
|
171
|
-
const proc = spawn(cmd, args, {
|
|
172
|
-
stdio: 'inherit'
|
|
173
|
-
});
|
|
174
|
-
proc.on('error', () => resolve(1));
|
|
175
|
-
proc.on('close', (code) => resolve(code ?? 1));
|
|
176
|
-
});
|
|
177
|
-
},
|
|
178
126
|
// === Terminal I/O ===
|
|
179
127
|
stdout_write: async (data) => {
|
|
180
128
|
return new Promise((resolve, reject) => {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process ID validation shared by the `probe_process` implementations and
|
|
3
|
+
* their callers.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
/** The largest process ID: `pid_t` is a signed 32-bit integer. */
|
|
8
|
+
export declare const PROCESS_ID_MAX = 2147483647;
|
|
9
|
+
/**
|
|
10
|
+
* Whether `pid` names one process: a positive integer within `pid_t` range.
|
|
11
|
+
* 0 and negative numbers name process groups (`kill(0, …)` signals the
|
|
12
|
+
* caller's own group, `kill(-1, …)` every process it may signal).
|
|
13
|
+
*
|
|
14
|
+
* @param pid - the candidate process ID
|
|
15
|
+
*/
|
|
16
|
+
export declare const is_process_id: (pid: number) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Refuse a `pid` that doesn't name one process (`is_process_id`).
|
|
19
|
+
*
|
|
20
|
+
* @param pid - the candidate process ID
|
|
21
|
+
* @throws RangeError when `pid` is not a positive integer within `pid_t` range
|
|
22
|
+
*/
|
|
23
|
+
export declare const assert_process_id: (pid: number) => void;
|
|
24
|
+
//# sourceMappingURL=process_id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process_id.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/runtime/process_id.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,kEAAkE;AAClE,eAAO,MAAM,cAAc,aAAgB,CAAC;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,OACc,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,IAI/C,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process ID validation shared by the `probe_process` implementations and
|
|
3
|
+
* their callers.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
/** The largest process ID: `pid_t` is a signed 32-bit integer. */
|
|
8
|
+
export const PROCESS_ID_MAX = 2_147_483_647;
|
|
9
|
+
/**
|
|
10
|
+
* Whether `pid` names one process: a positive integer within `pid_t` range.
|
|
11
|
+
* 0 and negative numbers name process groups (`kill(0, …)` signals the
|
|
12
|
+
* caller's own group, `kill(-1, …)` every process it may signal).
|
|
13
|
+
*
|
|
14
|
+
* @param pid - the candidate process ID
|
|
15
|
+
*/
|
|
16
|
+
export const is_process_id = (pid) => Number.isInteger(pid) && pid > 0 && pid <= PROCESS_ID_MAX;
|
|
17
|
+
/**
|
|
18
|
+
* Refuse a `pid` that doesn't name one process (`is_process_id`).
|
|
19
|
+
*
|
|
20
|
+
* @param pid - the candidate process ID
|
|
21
|
+
* @throws RangeError when `pid` is not a positive integer within `pid_t` range
|
|
22
|
+
*/
|
|
23
|
+
export const assert_process_id = (pid) => {
|
|
24
|
+
if (!is_process_id(pid)) {
|
|
25
|
+
throw new RangeError(`not a process ID: ${pid} (a positive integer up to ${PROCESS_ID_MAX})`);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -10,14 +10,11 @@
|
|
|
10
10
|
* ratifies the shape zap produces; a hand-placed `0644` file fails at boot
|
|
11
11
|
* instead of being read.
|
|
12
12
|
*
|
|
13
|
-
* The
|
|
14
|
-
* `create_node_runtime().read_secure_file`)
|
|
15
|
-
*
|
|
16
|
-
* the
|
|
17
|
-
*
|
|
18
|
-
* `assert_secure_mode` / `assert_secure_size` / `read_secure_bounded` helpers,
|
|
19
|
-
* and the mock through the mode and size ones, so the checks — and their
|
|
20
|
-
* operator-facing messages — can't drift between runtimes.
|
|
13
|
+
* The real implementation lives here (`load_secure_file_node`, wired as
|
|
14
|
+
* `create_node_runtime().read_secure_file`), and the mock honors the mode/size
|
|
15
|
+
* checks over its in-memory map (it has no file types). Both refuse through
|
|
16
|
+
* the shared `assert_secure_mode` / `assert_secure_size` helpers, so the
|
|
17
|
+
* checks — and their operator-facing messages — can't drift between them.
|
|
21
18
|
*
|
|
22
19
|
* @module
|
|
23
20
|
*/
|
|
@@ -27,19 +24,12 @@
|
|
|
27
24
|
* `MAX_SECURE_FILE_SIZE`.
|
|
28
25
|
*/
|
|
29
26
|
export declare const MAX_SECURE_FILE_SIZE = 4096;
|
|
30
|
-
/**
|
|
31
|
-
* Refuse anything but a regular file — a FIFO, device node, socket, or
|
|
32
|
-
* directory at the secret's path.
|
|
33
|
-
*
|
|
34
|
-
* @throws Error naming the path
|
|
35
|
-
*/
|
|
36
|
-
export declare const assert_secure_regular_file: (path: string, is_file: boolean) => void;
|
|
37
27
|
/**
|
|
38
28
|
* Refuse any group/other-accessible mode (only `0600`/`0400` pass).
|
|
39
29
|
*
|
|
40
|
-
* Callers own the platform gating:
|
|
41
|
-
* modes aren't meaningful (
|
|
42
|
-
*
|
|
30
|
+
* Callers own the platform gating: `load_secure_file_node` skips the check
|
|
31
|
+
* where modes aren't meaningful (Windows); the mock checks its simulated modes
|
|
32
|
+
* unconditionally.
|
|
43
33
|
*
|
|
44
34
|
* @throws Error naming the path, the offending mode, and the `chmod` fix
|
|
45
35
|
*/
|
|
@@ -50,18 +40,6 @@ export declare const assert_secure_mode: (path: string, mode: number) => void;
|
|
|
50
40
|
* @throws Error naming the path, the size, and the cap
|
|
51
41
|
*/
|
|
52
42
|
export declare const assert_secure_size: (path: string, size: number) => void;
|
|
53
|
-
/**
|
|
54
|
-
* Drain `read_chunk` into a cap-bounded buffer.
|
|
55
|
-
*
|
|
56
|
-
* Reads up to cap + 1 bytes so a file growing between stat and read is still
|
|
57
|
-
* caught (the stat-time size check alone races). `read_chunk` fills the given
|
|
58
|
-
* target from the file's current position and returns the bytes read
|
|
59
|
-
* (`null`/`0` = EOF) — the seam that lets the Node and Deno handle APIs share
|
|
60
|
-
* one loop.
|
|
61
|
-
*
|
|
62
|
-
* @throws Error when more than `MAX_SECURE_FILE_SIZE` bytes arrive
|
|
63
|
-
*/
|
|
64
|
-
export declare const read_secure_bounded: (path: string, read_chunk: (target: Uint8Array) => Promise<number | null>) => Promise<Uint8Array>;
|
|
65
43
|
/**
|
|
66
44
|
* Read a secret file with fail-loud checks (Node implementation).
|
|
67
45
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secure_file.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/runtime/secure_file.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"secure_file.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/runtime/secure_file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAUzC;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,IAM/D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,IAI/D,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,qBAAqB,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,UAAU,CAkC5E,CAAC"}
|
|
@@ -10,14 +10,11 @@
|
|
|
10
10
|
* ratifies the shape zap produces; a hand-placed `0644` file fails at boot
|
|
11
11
|
* instead of being read.
|
|
12
12
|
*
|
|
13
|
-
* The
|
|
14
|
-
* `create_node_runtime().read_secure_file`)
|
|
15
|
-
*
|
|
16
|
-
* the
|
|
17
|
-
*
|
|
18
|
-
* `assert_secure_mode` / `assert_secure_size` / `read_secure_bounded` helpers,
|
|
19
|
-
* and the mock through the mode and size ones, so the checks — and their
|
|
20
|
-
* operator-facing messages — can't drift between runtimes.
|
|
13
|
+
* The real implementation lives here (`load_secure_file_node`, wired as
|
|
14
|
+
* `create_node_runtime().read_secure_file`), and the mock honors the mode/size
|
|
15
|
+
* checks over its in-memory map (it has no file types). Both refuse through
|
|
16
|
+
* the shared `assert_secure_mode` / `assert_secure_size` helpers, so the
|
|
17
|
+
* checks — and their operator-facing messages — can't drift between them.
|
|
21
18
|
*
|
|
22
19
|
* @module
|
|
23
20
|
*/
|
|
@@ -37,23 +34,12 @@ export const MAX_SECURE_FILE_SIZE = 4096;
|
|
|
37
34
|
* The mock runtime checks unconditionally — its modes are simulated.
|
|
38
35
|
*/
|
|
39
36
|
const modes_apply = process.platform !== 'win32';
|
|
40
|
-
/**
|
|
41
|
-
* Refuse anything but a regular file — a FIFO, device node, socket, or
|
|
42
|
-
* directory at the secret's path.
|
|
43
|
-
*
|
|
44
|
-
* @throws Error naming the path
|
|
45
|
-
*/
|
|
46
|
-
export const assert_secure_regular_file = (path, is_file) => {
|
|
47
|
-
if (!is_file) {
|
|
48
|
-
throw new Error(`not a regular file: ${path}`);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
37
|
/**
|
|
52
38
|
* Refuse any group/other-accessible mode (only `0600`/`0400` pass).
|
|
53
39
|
*
|
|
54
|
-
* Callers own the platform gating:
|
|
55
|
-
* modes aren't meaningful (
|
|
56
|
-
*
|
|
40
|
+
* Callers own the platform gating: `load_secure_file_node` skips the check
|
|
41
|
+
* where modes aren't meaningful (Windows); the mock checks its simulated modes
|
|
42
|
+
* unconditionally.
|
|
57
43
|
*
|
|
58
44
|
* @throws Error naming the path, the offending mode, and the `chmod` fix
|
|
59
45
|
*/
|
|
@@ -72,29 +58,6 @@ export const assert_secure_size = (path, size) => {
|
|
|
72
58
|
throw new Error(`secure file too large: ${path} (${size} bytes, max ${MAX_SECURE_FILE_SIZE})`);
|
|
73
59
|
}
|
|
74
60
|
};
|
|
75
|
-
/**
|
|
76
|
-
* Drain `read_chunk` into a cap-bounded buffer.
|
|
77
|
-
*
|
|
78
|
-
* Reads up to cap + 1 bytes so a file growing between stat and read is still
|
|
79
|
-
* caught (the stat-time size check alone races). `read_chunk` fills the given
|
|
80
|
-
* target from the file's current position and returns the bytes read
|
|
81
|
-
* (`null`/`0` = EOF) — the seam that lets the Node and Deno handle APIs share
|
|
82
|
-
* one loop.
|
|
83
|
-
*
|
|
84
|
-
* @throws Error when more than `MAX_SECURE_FILE_SIZE` bytes arrive
|
|
85
|
-
*/
|
|
86
|
-
export const read_secure_bounded = async (path, read_chunk) => {
|
|
87
|
-
const buffer = new Uint8Array(MAX_SECURE_FILE_SIZE + 1);
|
|
88
|
-
let total = 0;
|
|
89
|
-
while (total < buffer.length) {
|
|
90
|
-
const n = await read_chunk(buffer.subarray(total));
|
|
91
|
-
if (n === null || n === 0)
|
|
92
|
-
break;
|
|
93
|
-
total += n;
|
|
94
|
-
}
|
|
95
|
-
assert_secure_size(path, total);
|
|
96
|
-
return buffer.subarray(0, total);
|
|
97
|
-
};
|
|
98
61
|
/**
|
|
99
62
|
* Read a secret file with fail-loud checks (Node implementation).
|
|
100
63
|
*
|
|
@@ -128,15 +91,24 @@ export const load_secure_file_node = async (path) => {
|
|
|
128
91
|
}
|
|
129
92
|
try {
|
|
130
93
|
const s = await handle.stat();
|
|
131
|
-
|
|
94
|
+
if (!s.isFile())
|
|
95
|
+
throw new Error(`not a regular file: ${path}`);
|
|
132
96
|
if (modes_apply)
|
|
133
97
|
assert_secure_mode(path, s.mode);
|
|
134
98
|
assert_secure_size(path, s.size);
|
|
135
|
-
//
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
99
|
+
// read up to cap + 1 bytes so a file growing between stat and read is
|
|
100
|
+
// still caught (the stat-time size check alone races); `position: null`
|
|
101
|
+
// reads sequentially from the handle's own cursor
|
|
102
|
+
const buffer = new Uint8Array(MAX_SECURE_FILE_SIZE + 1);
|
|
103
|
+
let total = 0;
|
|
104
|
+
while (total < buffer.length) {
|
|
105
|
+
const { bytesRead } = await handle.read(buffer, total, buffer.length - total, null);
|
|
106
|
+
if (bytesRead === 0)
|
|
107
|
+
break;
|
|
108
|
+
total += bytesRead;
|
|
109
|
+
}
|
|
110
|
+
assert_secure_size(path, total);
|
|
111
|
+
return buffer.subarray(0, total);
|
|
140
112
|
}
|
|
141
113
|
finally {
|
|
142
114
|
await handle.close();
|
|
@@ -330,10 +330,10 @@ export interface AppServerOptions {
|
|
|
330
330
|
* A factory rather than the helper itself because Node's adapter needs
|
|
331
331
|
* the app: `@hono/node-ws` has no module-level helper, only
|
|
332
332
|
* `createNodeWebSocket({app})`, and `create_app_server` is what builds
|
|
333
|
-
* the app.
|
|
333
|
+
* the app. Bun's ignores the argument:
|
|
334
334
|
*
|
|
335
335
|
* ```ts
|
|
336
|
-
* import {upgradeWebSocket} from '@hono/
|
|
336
|
+
* import {upgradeWebSocket} from '@hono/bun';
|
|
337
337
|
* create_upgrade_websocket: () => upgradeWebSocket,
|
|
338
338
|
* ```
|
|
339
339
|
*
|
package/dist/server/static.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface ServeStaticOptions {
|
|
|
20
20
|
/**
|
|
21
21
|
* Factory function that creates a static file serving middleware.
|
|
22
22
|
*
|
|
23
|
-
* Matches the signature of `serveStatic` from `@hono/
|
|
23
|
+
* Matches the signature of `serveStatic` from `@hono/node-server/serve-static` and `@hono/bun`.
|
|
24
24
|
*/
|
|
25
25
|
export type ServeStaticFactory = (options: ServeStaticOptions) => MiddlewareHandler;
|
|
26
26
|
/**
|
package/dist/testing/CLAUDE.md
CHANGED
|
@@ -261,7 +261,7 @@ middleware never sets `TEST_CONTEXT_PRESET_KEY`, and only the symbol counts
|
|
|
261
261
|
### `schema_parity.ts` — `assert_schema_snapshots_equal`
|
|
262
262
|
|
|
263
263
|
- `diff_schema_snapshots(a, b)` — structured `Array<SchemaDiff>` between two snapshots; empty array means parity holds.
|
|
264
|
-
- `format_schema_diffs(diffs, labels?)` — human-readable multi-line rendering; labels name the impl on each side (e.g., `{a: '
|
|
264
|
+
- `format_schema_diffs(diffs, labels?)` — human-readable multi-line rendering; labels name the impl on each side (e.g., `{a: 'ts', b: 'rust'}`).
|
|
265
265
|
- `assert_schema_snapshots_equal(a, b, labels?)` — throws on drift with a fully-formatted diff message.
|
|
266
266
|
- `SchemaDiff` — tagged-union per drift kind: `table_only_in`, `column_only_in`, `column_field_differs`, `index_only_in`, `index_definition_differs`, `constraint_only_in`, `constraint_differs`, `sequence_only_in`, `sequence_data_type_differs`, `enum_only_in`, `enum_labels_differ` (enum labels compared positionally — declared order is significant).
|
|
267
267
|
- `diff_migration_trackers(a, b)` / `format_migration_tracker_diffs(diffs, labels?)` / `assert_migration_trackers_equal(a, b, labels?)` — the migration-identity twins of the snapshot diff/format/assert, over two `MigrationTracker`s. `MigrationTrackerDiff` is keyed on `(namespace, name)` (the `schema_version` PK): `tracker_row_only_in` (a migration rename or namespace re-partition) and `tracker_sequence_differs` (a re-order).
|
|
@@ -313,12 +313,12 @@ DB, snapshot, then compare:
|
|
|
313
313
|
|
|
314
314
|
```ts
|
|
315
315
|
await drop_recreate_db('app_test');
|
|
316
|
-
await spawn_backend(
|
|
317
|
-
const
|
|
316
|
+
await spawn_backend(ts_config);
|
|
317
|
+
const snapshot_ts = await query_schema_snapshot(db);
|
|
318
318
|
await drop_recreate_db('app_test');
|
|
319
319
|
await spawn_backend(rust_config);
|
|
320
320
|
const snapshot_rust = await query_schema_snapshot(db);
|
|
321
|
-
assert_schema_snapshots_equal(
|
|
321
|
+
assert_schema_snapshots_equal(snapshot_ts, snapshot_rust, { a: 'ts', b: 'rust' });
|
|
322
322
|
```
|
|
323
323
|
|
|
324
324
|
Each impl's _own_ tests still gate its DDL correctness independently — this
|
|
@@ -366,8 +366,8 @@ field a loose output schema passes on one spine, shows up as a difference.
|
|
|
366
366
|
sent through `send_conformance_case` (`conformance_table.ts`), both answers
|
|
367
367
|
normalized and diffed. Every HTTP request carries
|
|
368
368
|
`DIFFERENTIAL_REQUEST_HEADERS` (`accept-encoding: identity`), so a runtime's
|
|
369
|
-
own compression (
|
|
370
|
-
|
|
369
|
+
own compression (for a request accepting gzip, as Node's `fetch` sends by
|
|
370
|
+
default) never reads as a `content-encoding` / `vary`
|
|
371
371
|
difference. The per-case `expect` is not asserted —
|
|
372
372
|
each backend's conformance leg holds it. `KnownDivergence` is the ledger
|
|
373
373
|
row: `{case_name | method, tracking_id, reason, what_differs}`, the names a
|
|
@@ -1074,7 +1074,7 @@ run against an in-process Hono harness today and against a spawned backend
|
|
|
1074
1074
|
over real HTTP — either the Rust spine (`zzz_server`, another consumer's
|
|
1075
1075
|
spine server, or the non-domain `testing_spine_stub`) or a **TS** spine binary built on the
|
|
1076
1076
|
test-server core below (fuz_app's own domain-free `testing_spine_server`, run
|
|
1077
|
-
on Node +
|
|
1077
|
+
on Node + Bun). In-process is the fast feedback path; cross-process is the
|
|
1078
1078
|
source of truth for wire-shape conformance.
|
|
1079
1079
|
|
|
1080
1080
|
fuz_app's own spines run every single-backend suite below through one
|
|
@@ -1171,7 +1171,7 @@ file; the dual-spawn and limiter-enabled suites name their own files.
|
|
|
1171
1171
|
family defaults carry the declared surface's mounts (`account_lifecycle`,
|
|
1172
1172
|
`account_status`) and the runtime-behavior flags (`ws_handshake_pipelining`,
|
|
1173
1173
|
`ws_refusal_body`) of the family's reference runtime — Node for TS, hyper
|
|
1174
|
-
for Rust; a backend on another runtime (
|
|
1174
|
+
for Rust; a backend on another runtime (Bun) overrides them. `cell_crud`
|
|
1175
1175
|
gates the CRUD parity suite, `cell_relations` the relation / ACL / audit
|
|
1176
1176
|
parity suite — both `true` on every backend that live-mounts the full cell
|
|
1177
1177
|
surface (TS spine binary, in-process app, Rust stub). A backend mounting only
|
|
@@ -1218,11 +1218,11 @@ file; the dual-spawn and limiter-enabled suites name their own files.
|
|
|
1218
1218
|
doesn't mount it (replacing the old runtime 404-sniff-skip).
|
|
1219
1219
|
No flag covers the body-size smuggling probe: every backend closes the
|
|
1220
1220
|
connection after an oversized-body 413 (at once on Node, Bun and the Rust
|
|
1221
|
-
spine
|
|
1221
|
+
spine), so the pipelined request
|
|
1222
1222
|
goes unanswered. Bun 1.4.3 is the tested floor — an older Bun kept the
|
|
1223
1223
|
connection and served the next request, correctly framed, and fails the probe.
|
|
1224
1224
|
`ws_handshake_pipelining` gates the WS round-trip suite's
|
|
1225
|
-
frames-with-the-handshake case (`true` Node/
|
|
1225
|
+
frames-with-the-handshake case (`true` Node/Rust — frames written in the
|
|
1226
1226
|
same TCP write as the upgrade request reach the socket; `false` Bun, which
|
|
1227
1227
|
answers such a request `400` when the upgrade follows an asynchronous check,
|
|
1228
1228
|
as it does behind auth, and `false` in-process, where there is no socket to
|
|
@@ -1292,8 +1292,8 @@ here never reaches it.
|
|
|
1292
1292
|
exhaust), and the `conformance_table` runner (the consumer's own cases).
|
|
1293
1293
|
`src/test/testing/cross_backend/spine_suites.test.ts` imports every module
|
|
1294
1294
|
under `cross_backend/` and holds the two lists to the ones exporting a
|
|
1295
|
-
`describe_*` function, whatever the export form (the Bun
|
|
1296
|
-
which
|
|
1295
|
+
`describe_*` function, whatever the export form (the Bun adapter,
|
|
1296
|
+
which loads only on its own runtime, is held to naming no `describe_` at
|
|
1297
1297
|
all), so a new suite fails until it is registered or stated standalone; the
|
|
1298
1298
|
dispatch table
|
|
1299
1299
|
is a `Record<SuiteName, …>`, so a registered name without an entry fails
|
|
@@ -1833,7 +1833,7 @@ queues a burst onto the caller's own connection in one synchronous run, so the
|
|
|
1833
1833
|
burst waits at once whether or not the client reads and the overflow is
|
|
1834
1834
|
deterministic. Cases: a burst within the budget arrives whole and in order
|
|
1835
1835
|
ahead of its response, the socket left open — a small one, and one of a few
|
|
1836
|
-
mebibytes in megabyte frames, most of the default budget, which waits on the backend's write pump where megabyte frames outrun the socket's buffer (
|
|
1836
|
+
mebibytes in megabyte frames, most of the default budget, which waits on the backend's write pump where megabyte frames outrun the socket's buffer (Node and Bun write the burst through, as observed); a burst far past it closes the
|
|
1837
1837
|
socket with the code and the exact reason, no response for the flooding request
|
|
1838
1838
|
arrives, and any flood frames that did arrive are a contiguous prefix of the
|
|
1839
1839
|
burst — while a second connection on the same account keeps dispatching; a
|
|
@@ -2071,7 +2071,7 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
|
|
|
2071
2071
|
|
|
2072
2072
|
- `testing/cross_backend/backend_config.ts` — `BackendConfig` +
|
|
2073
2073
|
`BackendBootstrapConfig` interfaces. Consumer factories
|
|
2074
|
-
(`
|
|
2074
|
+
(`node_backend_config()`, `rust_backend_config()`,
|
|
2075
2075
|
`rust_spine_stub_backend_config()`) produce these; fuz_app ships
|
|
2076
2076
|
`rust_spine_stub_backend_config()` as a convenience preset for the non-domain
|
|
2077
2077
|
third spine consumer, but otherwise backend-specific paths and env are a
|
|
@@ -2112,13 +2112,15 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
|
|
|
2112
2112
|
rebuild (`rebuild_rust_spine_stub`) is built on it.
|
|
2113
2113
|
- `testing/cross_backend/postgres_database.ts` — `ensure_database(database,
|
|
2114
2114
|
server_url?, deps?)` (idempotent `createdb` on the server the URL names, its
|
|
2115
|
-
password passed in the environment
|
|
2116
|
-
|
|
2115
|
+
password passed in the environment, run by a synchronous `execFileSync`
|
|
2116
|
+
since a vitest global setup is no task root; argv, password env and the
|
|
2117
|
+
already-exists predicate from `db/postgres_url.ts`, the dev helpers' too;
|
|
2118
|
+
`createdb`'s already-exists refusal is the quiet success case, and any other failure
|
|
2117
2119
|
is reported through `deps.warn` — `console.warn` by default — with
|
|
2118
2120
|
`createdb`'s stderr, never thrown), `ensure_database_for_url(url, deps?)` (the
|
|
2119
2121
|
database a `postgres:` URL names; anything else left alone),
|
|
2120
|
-
`with_database_name`, `
|
|
2121
|
-
|
|
2122
|
+
`with_database_name`, `redact_database_url` (a URL fit to print, its other
|
|
2123
|
+
query pairs as written), `is_postgres_url`, and `empty_owned_database(url,
|
|
2122
2124
|
{owned_name, label, hint?})` — drops and recreates the `public` schema of
|
|
2123
2125
|
the one database a setup owns (any other name in the URL is refused before
|
|
2124
2126
|
connecting), for a backend that does not wipe its own database; a missing
|
|
@@ -2961,7 +2963,7 @@ or `null` for a builtin role) is the scope the scoped-assign case uses, and
|
|
|
2961
2963
|
|
|
2962
2964
|
Both legs run in-process (`conformance_participation.db.test.ts`, plain
|
|
2963
2965
|
`gro test`) and cross-process (`conformance_participation.cross.test.ts`, TS
|
|
2964
|
-
node/
|
|
2966
|
+
node/bun + Rust stub). Landing the TS `role_grant_assign` action also turned
|
|
2965
2967
|
the `cross_backend_parity` action-manifest gate green (it was Rust-only before).
|
|
2966
2968
|
Cited property: `docs/identity.md` + the role-gated-participation design
|
|
2967
2969
|
(admin-only conferral, immediate assign).
|
|
@@ -3005,15 +3007,14 @@ binary (the TS analog of the Rust `testing_spine_stub`), so consumers don't
|
|
|
3005
3007
|
re-roll the serve / daemon-info / WS-attach / drain boilerplate:
|
|
3006
3008
|
|
|
3007
3009
|
- `testing/cross_backend/testing_server_core.ts` — `start_testing_server({adapter, daemon_name, host, port, app_version?, build_app})`. Owns the runtime-neutral orchestration: open-host refusal, stale-daemon check, daemon-info write, `serve`, post-serve WS attach, graceful shutdown. Domain-free — the app is the caller's `build_app(context: BuildTestingAppContext): Promise<BuiltTestingApp>` seam (`{app, close}`). WebSocket endpoints mount through `create_app_server`'s `ws_endpoints` on every runtime: the build calls `context.prepare_websocket({max_message_bytes?})`, which asks the adapter for a `PreparedWebsocket` (`{create_upgrade_websocket: (app) => UpgradeWebSocket, attach_to_server?}`) and returns its factory, to pass as `create_upgrade_websocket`; the core runs each `attach_to_server` once `serve` returns (Node's `injectWebSocket`). Shutdown starts the listener's `shutdown` (stop accepting), runs `close` — which must end live WebSockets, as `AppServer.close` does — then awaits the drain, since open sockets would otherwise hold it. Exports the `TestingServerAdapter` (`prepare_websocket: (options?: PrepareWebsocketOptions) => PreparedWebsocket`) / `ServeHandle` / `PreparedWebsocket` / `PrepareWebsocketOptions` / `BuildTestingAppContext` interfaces.
|
|
3008
|
-
- `testing/daemon_info.ts` — the `~/.{name}/run/daemon.json` plumbing the core's stale-daemon check and daemon-info write use: `DaemonInfo` (a strict `@fuzdev/fuz_schema` object), `get_app_dir`, `get_daemon_info_path`, `write_daemon_info` (atomic), `read_daemon_info`, `is_daemon_running` (`
|
|
3009
|
-
- `testing/cross_backend/testing_server_node.ts` — `create_node_testing_adapter()` (`@hono/node-server` + `@hono/node-ws`). Optional peer deps (like `ws`); only test binaries import them. Its factory sets the `ws` server's `maxPayload` to twice `max_message_bytes` (default `DEFAULT_WS_MAX_MESSAGE_BYTES`) — `@hono/node-ws` takes no option for it, and `ws`'s own default is 100 MiB — so a grossly oversized message is refused at the frame layer (`WS_CLOSE_MESSAGE_TOO_BIG` with no reason) before it is buffered whole, while one just over the limit reaches the per-message check, which sends `WS_CLOSE_MESSAGE_TOO_BIG_REASON` as every other backend does. Bun's adapter sets the same multiple as its frame cap (see below)
|
|
3010
|
-
- `testing/cross_backend/
|
|
3011
|
-
- `testing/cross_backend/testing_server_bun.ts` — `create_bun_testing_adapter()` (`Bun.serve` + `@hono/bun`'s module-level `getConnInfo`, `upgradeWebSocket`, and `websocket`; `Bun.serve` declared locally so it typechecks under the Node toolchain). Needs the optional `@hono/bun` peer dep (the counterpart to Node's `@hono/node-server` + `@hono/node-ws`; `Bun.serve` is built in). Reuses `create_node_runtime` (Bun implements the `node:fs`/`node:process` surface). WS is module-level + stateless (like Deno) — the `websocket` handler is threaded into `serve`, where `Bun.serve` wants it, so no post-serve attach. It carries `maxPayloadLength` at twice `max_message_bytes` rather than Bun's 16 MiB default: past its cap Bun drops the socket without a close frame (1006), so the headroom leaves a message just over the limit to the per-message check (`WS_CLOSE_MESSAGE_TOO_BIG`, as on Node), while a grossly oversized one is refused before Bun buffers it whole.
|
|
3010
|
+
- `testing/daemon_info.ts` — the `~/.{name}/run/daemon.json` plumbing the core's stale-daemon check and daemon-info write use: `DaemonInfo` (a strict `@fuzdev/fuz_schema` object), `get_app_dir`, `get_daemon_info_path`, `write_daemon_info` (atomic), `read_daemon_info`, `is_daemon_running` (`probe_process`, signal 0 with no program spawned; another user's process or a pid naming no single process reads as not running).
|
|
3011
|
+
- `testing/cross_backend/testing_server_node.ts` — `create_node_testing_adapter()` (`@hono/node-server` + `@hono/node-ws`). Optional peer deps (like `ws`); only test binaries import them. Its factory sets the `ws` server's `maxPayload` to twice `max_message_bytes` (default `DEFAULT_WS_MAX_MESSAGE_BYTES`) — `@hono/node-ws` takes no option for it, and `ws`'s own default is 100 MiB — so a grossly oversized message is refused at the frame layer (`WS_CLOSE_MESSAGE_TOO_BIG` with no reason) before it is buffered whole, while one just over the limit reaches the per-message check, which sends `WS_CLOSE_MESSAGE_TOO_BIG_REASON` as every other backend does. Bun's adapter sets the same multiple as its frame cap (see below).
|
|
3012
|
+
- `testing/cross_backend/testing_server_bun.ts` — `create_bun_testing_adapter()` (`Bun.serve` + `@hono/bun`'s module-level `getConnInfo`, `upgradeWebSocket`, and `websocket`; `Bun.serve` declared locally so it typechecks under the Node toolchain). Needs the optional `@hono/bun` peer dep (the counterpart to Node's `@hono/node-server` + `@hono/node-ws`; `Bun.serve` is built in). Reuses `create_node_runtime` (Bun implements the `node:fs`/`node:process` surface). WS is module-level + stateless — the `websocket` handler is threaded into `serve`, where `Bun.serve` wants it, so no post-serve attach. It carries `maxPayloadLength` at twice `max_message_bytes` rather than Bun's 16 MiB default: past its cap Bun drops the socket without a close frame (1006), so the headroom leaves a message just over the limit to the per-message check (`WS_CLOSE_MESSAGE_TOO_BIG`, as on Node), while a grossly oversized one is refused before Bun buffers it whole.
|
|
3012
3013
|
- `testing/cross_backend/default_spine_surface.ts` — the canonical no-domain spine surface (account/admin/audit/signup + bootstrap): `spine_session_options`, `spine_roles`, `create_spine_route_specs`, `spine_rpc_endpoints`, `create_spine_surface_spec`. This is the **declared** surface — the `create_standard_rpc_actions` bundle the spec-derived suites auto-enumerate. It passes `daemon_token: true` (both spine binaries mount the daemon-token layer) and leaves `GET /api/surface` at its default, off — the TS spine binary does too, and the Rust `testing_spine_stub` serves none. Shared by the spine_stub cross test, the TS cross tests, and the binary.
|
|
3013
3014
|
- `testing/cross_backend/full_spine_mount.ts` — `build_full_spine_rpc_actions(deps, options)` — the **full** live RPC mount: the declared bundle **plus** the off-declared-surface families the binary live-mounts (`_testing_*` backdoors, the cell verb set, the opt-in `actor_lookup` / `actor_search` resolvers). `build_full_spine_mount(deps, options)` builds it once for both of the binary's endpoints, returning `FullSpineMount` (`{rpc_actions, ws_actions}`): the WS list is `protocol_actions` plus every RPC action not already among them, twinning the Rust `testing_spine_stub`, which serves one registry on RPC and WS (the one difference is `cancel` — a registered protocol action on TS, owned by the read loop on Rust). Single-sources the mount so the binary and the `spine_method_coverage` reconciliation test build the same list. `create_spine_live_rpc_endpoints()` wraps the list, built on stub deps, as one endpoint at `SPINE_RPC_PATH` — the `live_rpc_endpoints` value the conformance table, the differential and the auth-row generator resolve off-surface methods from (no handler built there runs).
|
|
3014
|
-
- `testing/cross_backend/ts_spine_backend_config.ts` — `ts_spine_node_backend_config()` / `
|
|
3015
|
+
- `testing/cross_backend/ts_spine_backend_config.ts` — `ts_spine_node_backend_config()` / `ts_spine_bun_backend_config()` presets (in-memory pglet, no external infra), the TS analog of `rust_spine_stub_backend_config()`.
|
|
3015
3016
|
|
|
3016
|
-
fuz_app's own binary wiring (`src/test/cross_backend/testing_spine_server{,_node,
|
|
3017
|
+
fuz_app's own binary wiring (`src/test/cross_backend/testing_spine_server{,_node,_bun}.ts`) is the worked example: ~one `build_app` over `create_app_backend` + `create_app_server` (`rate_limiters: 'disabled_for_testing'` plus whichever login / action limiters its env toggles built, `build_full_spine_mount`'s two lists on one `rpc_endpoints` entry and two `ws_endpoints` entries — `/api/ws` and the role-gated `SPINE_ROLE_GATED_WS_PATH` — sharing one `registry`, which is also the role-grant-offer `notification_sender`), reusing `default_spine_surface`. `src/test/cross_backend/testing_spine_server.db.test.ts` builds it with the Node adapter in-process and asserts its surface lists both WS endpoints (the gated one with its `required_roles`) and passes the surface invariants. The `_node`/`_bun` entries differ only in which adapter they wire — `build_spine_app` is runtime-agnostic. It leaves `create_app_server`'s `auth_cleanup` off, as the Rust `testing_spine_stub` leaves its twin unscheduled: a background pass would delete rows and write audit rows under a running suite. A consumer's cross-process test binary may schedule it when nothing its suites seed is already expired (the conformance table's `expired_session` principal seeds a backdated session row); an in-process harness leaves it off.
|
|
3017
3018
|
|
|
3018
3019
|
### Live-method coverage reconciliation — `method_coverage.ts`
|
|
3019
3020
|
|
|
@@ -3077,8 +3078,8 @@ no stats engine reinvented. fuz_app ships the primitive; consumers wire
|
|
|
3077
3078
|
scenarios + the run.
|
|
3078
3079
|
fuz_app also ships its **own** `npm run benchmark:cross-impl`
|
|
3079
3080
|
(`src/benchmarks/cross_impl.bench.ts`) on the back of its TS spine binary —
|
|
3080
|
-
ts-node + ts-
|
|
3081
|
-
is set). The
|
|
3081
|
+
ts-node + ts-bun (+ the Rust `spine_stub` when `FUZ_TESTING_RUST_SPINE_STUB_BIN`
|
|
3082
|
+
is set). The two TS runtimes are apples-to-apples with each other (same
|
|
3082
3083
|
in-memory pglet driver); TS-vs-Rust carries the pglet-vs-Postgres DB-layer caveat
|
|
3083
3084
|
(documented in the run). The artifact (`*.latest.json`) is gitignored.
|
|
3084
3085
|
|
|
@@ -5,7 +5,7 @@ import '../assert_dev_env.js';
|
|
|
5
5
|
* `BackendConfig` describes a spawnable test binary — argv, mount paths,
|
|
6
6
|
* env vars, bootstrap credentials, daemon-token discovery path, declared
|
|
7
7
|
* capabilities. Consumer projects ship per-backend factories
|
|
8
|
-
* (`
|
|
8
|
+
* (`node_backend_config()`, `rust_backend_config()`,
|
|
9
9
|
* `rust_spine_stub_backend_config()`) that produce this shape; `spawn_backend`
|
|
10
10
|
* consumes it.
|
|
11
11
|
*
|
|
@@ -13,8 +13,8 @@ import '../assert_dev_env.js';
|
|
|
13
13
|
* (operational dep on `testing_spine_stub` — path-based discovery, no
|
|
14
14
|
* `package.json` coupling to the stub's source package). Otherwise backend-specific
|
|
15
15
|
* knowledge (binary paths, port choices, env vars) is a consumer
|
|
16
|
-
* concern; fuz_app's testing library knows nothing about
|
|
17
|
-
*
|
|
16
|
+
* concern; fuz_app's testing library knows nothing about Cargo or a
|
|
17
|
+
* consumer's binary beyond that preset.
|
|
18
18
|
*
|
|
19
19
|
* @module
|
|
20
20
|
*/
|
|
@@ -51,17 +51,17 @@ export interface BackendBootstrapConfig {
|
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* Configuration for one spawnable test backend. Consumer factories
|
|
54
|
-
* (`
|
|
54
|
+
* (`node_backend_config()`, `rust_backend_config()`) produce these and
|
|
55
55
|
* the runner consumes them through `spawn_backend`.
|
|
56
56
|
*
|
|
57
|
-
* Path defaults match the standard fuz_app surface —
|
|
58
|
-
* (`zzz_server`, `fuz_forge_server`, `testing_spine_stub`) all converge on
|
|
57
|
+
* Path defaults match the standard fuz_app surface — the TS spine and the Rust
|
|
58
|
+
* spine servers (`zzz_server`, `fuz_forge_server`, `testing_spine_stub`) all converge on
|
|
59
59
|
* `/api/account/{bootstrap,login,logout,password}`,
|
|
60
60
|
* `/api/rpc`, `/api/ws`, `/health`. Override only when a backend
|
|
61
61
|
* deliberately diverges (which it shouldn't, per the contract).
|
|
62
62
|
*/
|
|
63
63
|
export interface BackendConfig {
|
|
64
|
-
/** Diagnostic label (`"
|
|
64
|
+
/** Diagnostic label (`"ts_spine_node"`, `"rust"`, `"spine_stub"`). Surfaces in test output. */
|
|
65
65
|
readonly name: string;
|
|
66
66
|
/** argv passed to the spawn. The first entry is the binary path. */
|
|
67
67
|
readonly start_command: ReadonlyArray<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend_config.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/backend_config.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,sBAAsB;IACtC,qFAAqF;IACrF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;;;;;OAOG;IACH,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC7B
|
|
1
|
+
{"version":3,"file":"backend_config.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/backend_config.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,sBAAsB;IACtC,qFAAqF;IACrF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;;;;;OAOG;IACH,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC7B,+FAA+F;IAC/F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9C,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,+CAA+C;IAC/C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,6DAA6D;IAC7D,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,6DAA6D;IAC7D,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;CAC3C"}
|