@fuzdev/fuz_app 0.185.0 → 0.186.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/actions/CLAUDE.md +14 -2
  2. package/dist/actions/perform_action.d.ts.map +1 -1
  3. package/dist/actions/perform_action.js +36 -5
  4. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  5. package/dist/actions/ws_socket_session.js +3 -1
  6. package/dist/auth/CLAUDE.md +11 -5
  7. package/dist/auth/account_queries.d.ts +53 -40
  8. package/dist/auth/account_queries.d.ts.map +1 -1
  9. package/dist/auth/account_queries.js +57 -50
  10. package/dist/auth/account_routes.d.ts.map +1 -1
  11. package/dist/auth/account_routes.js +59 -25
  12. package/dist/auth/admin_actions.d.ts.map +1 -1
  13. package/dist/auth/admin_actions.js +26 -9
  14. package/dist/auth/audit_emitter.js +2 -2
  15. package/dist/auth/audit_log_queries.d.ts +11 -3
  16. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  17. package/dist/auth/audit_log_queries.js +4 -4
  18. package/dist/auth/audit_log_schema.js +1 -1
  19. package/dist/auth/auth_ddl.d.ts.map +1 -1
  20. package/dist/auth/auth_ddl.js +4 -0
  21. package/dist/auth/cleanup.js +1 -1
  22. package/dist/auth/migrations.d.ts.map +1 -1
  23. package/dist/auth/migrations.js +35 -0
  24. package/dist/auth/role_grant_offer_queries.d.ts +13 -13
  25. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  26. package/dist/auth/role_grant_offer_queries.js +12 -13
  27. package/dist/auth/role_grant_queries.d.ts +16 -9
  28. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  29. package/dist/auth/role_grant_queries.js +16 -9
  30. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  31. package/dist/auth/self_service_role_actions.js +15 -0
  32. package/dist/auth/session_queries.d.ts +24 -0
  33. package/dist/auth/session_queries.d.ts.map +1 -1
  34. package/dist/auth/session_queries.js +28 -0
  35. package/dist/db/CLAUDE.md +3 -3
  36. package/dist/db/cell_ddl.d.ts +8 -3
  37. package/dist/db/cell_ddl.d.ts.map +1 -1
  38. package/dist/db/cell_ddl.js +10 -5
  39. package/dist/http/body_limit.d.ts +4 -4
  40. package/dist/http/body_limit.js +4 -4
  41. package/dist/testing/CLAUDE.md +126 -27
  42. package/dist/testing/app_server.d.ts +5 -7
  43. package/dist/testing/app_server.d.ts.map +1 -1
  44. package/dist/testing/app_server.js +5 -7
  45. package/dist/testing/auth_apps.d.ts +3 -1
  46. package/dist/testing/auth_apps.d.ts.map +1 -1
  47. package/dist/testing/auth_apps.js +22 -5
  48. package/dist/testing/cross_backend/backend_config.d.ts +8 -0
  49. package/dist/testing/cross_backend/backend_config.d.ts.map +1 -1
  50. package/dist/testing/cross_backend/backend_log.d.ts +71 -0
  51. package/dist/testing/cross_backend/backend_log.d.ts.map +1 -0
  52. package/dist/testing/cross_backend/backend_log.js +134 -0
  53. package/dist/testing/cross_backend/backend_swap.d.ts +41 -0
  54. package/dist/testing/cross_backend/backend_swap.d.ts.map +1 -0
  55. package/dist/testing/cross_backend/backend_swap.js +431 -0
  56. package/dist/testing/cross_backend/body_size_smuggling.js +3 -3
  57. package/dist/testing/cross_backend/bootstrap_backend.js +4 -4
  58. package/dist/testing/cross_backend/conformance_case.d.ts +11 -6
  59. package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
  60. package/dist/testing/cross_backend/conformance_case.js +4 -0
  61. package/dist/testing/cross_backend/conformance_principal.d.ts +2 -2
  62. package/dist/testing/cross_backend/conformance_principal.d.ts.map +1 -1
  63. package/dist/testing/cross_backend/conformance_principal.js +27 -10
  64. package/dist/testing/cross_backend/default_backend_configs.d.ts +38 -5
  65. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
  66. package/dist/testing/cross_backend/default_backend_configs.js +50 -15
  67. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  68. package/dist/testing/cross_backend/in_process_setup.js +52 -30
  69. package/dist/testing/cross_backend/revocation_drivers.d.ts +14 -2
  70. package/dist/testing/cross_backend/revocation_drivers.d.ts.map +1 -1
  71. package/dist/testing/cross_backend/revocation_drivers.js +36 -8
  72. package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +7 -0
  73. package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
  74. package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +4 -2
  75. package/dist/testing/cross_backend/setup.d.ts +44 -43
  76. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  77. package/dist/testing/cross_backend/setup.js +64 -62
  78. package/dist/testing/cross_backend/spawn_backend.d.ts +7 -3
  79. package/dist/testing/cross_backend/spawn_backend.d.ts.map +1 -1
  80. package/dist/testing/cross_backend/spawn_backend.js +86 -7
  81. package/dist/testing/cross_backend/spine_suites.d.ts +1 -1
  82. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  83. package/dist/testing/cross_backend/spine_suites.js +4 -2
  84. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  85. package/dist/testing/cross_backend/sse_round_trip.js +4 -2
  86. package/dist/testing/cross_backend/testing_reset_actions.d.ts +7 -6
  87. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  88. package/dist/testing/cross_backend/testing_reset_actions.js +10 -8
  89. package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
  90. package/dist/testing/cross_backend/testing_server_bun.js +7 -31
  91. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  92. package/dist/testing/cross_backend/ws_round_trip.js +4 -3
  93. package/dist/testing/data_exposure.d.ts +4 -1
  94. package/dist/testing/data_exposure.d.ts.map +1 -1
  95. package/dist/testing/data_exposure.js +93 -25
  96. package/dist/testing/db_invariants.d.ts +5 -5
  97. package/dist/testing/db_invariants.js +5 -5
  98. package/dist/testing/logged_errors.d.ts +61 -0
  99. package/dist/testing/logged_errors.d.ts.map +1 -0
  100. package/dist/testing/logged_errors.js +285 -0
  101. package/dist/testing/middleware_gate_probes.d.ts.map +1 -1
  102. package/dist/testing/middleware_gate_probes.js +15 -8
  103. package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
  104. package/dist/testing/rpc_attack_surface.js +41 -16
  105. package/dist/testing/stubs.d.ts +5 -1
  106. package/dist/testing/stubs.d.ts.map +1 -1
  107. package/dist/testing/stubs.js +6 -3
  108. package/dist/testing/test_app.d.ts +40 -11
  109. package/dist/testing/test_app.d.ts.map +1 -1
  110. package/dist/testing/test_app.js +66 -9
  111. package/dist/testing/transports/fetch_transport.d.ts +10 -0
  112. package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
  113. package/dist/testing/transports/fetch_transport.js +13 -0
  114. package/package.json +4 -3
@@ -1,6 +1,7 @@
1
1
  import '../assert_dev_env.js';
2
2
  import type { BackendBootstrapConfig, BackendConfig } from './backend_config.js';
3
3
  import type { BackendCapabilities, FamilyDefaultCapabilities } from './capabilities.js';
4
+ import { type BackendLogAllowance } from './backend_log.js';
4
5
  import { type TestBackendPaths } from './build_test_backend_paths.js';
5
6
  /**
6
7
  * The `HOST` both builders bind a backend to — loopback IPv4, since
@@ -62,7 +63,23 @@ export declare const ts_default_capabilities: FamilyDefaultCapabilities;
62
63
  * behavior of hyper. Carries no `MountFlag` and no `testing_backdoors`.
63
64
  */
64
65
  export declare const rust_default_capabilities: FamilyDefaultCapabilities;
65
- export interface MakeDefaultTsBackendConfigOptions {
66
+ /** The backend log options both family builders take. */
67
+ export interface DefaultBackendLogOptions {
68
+ /**
69
+ * The file `spawn_backend` tees the backend's output into, checked at
70
+ * teardown (`BackendConfig.log`). Defaults to `backend.log` under the
71
+ * backend's temp root (`paths.root`); `null` keeps no log and checks
72
+ * nothing.
73
+ */
74
+ readonly log_path?: string | null;
75
+ /**
76
+ * Error lines the backend may log beside `SPINE_CROSS_SUITE_BACKEND_ERRORS`
77
+ * (what the shipped cross suites provoke on purpose) — what a consumer's
78
+ * own suites provoke, each with its reason.
79
+ */
80
+ readonly log_allow_errors?: ReadonlyArray<BackendLogAllowance>;
81
+ }
82
+ export interface MakeDefaultTsBackendConfigOptions extends DefaultBackendLogOptions {
66
83
  /** Diagnostic label; also names the tmpdir (`default_test_backend_paths`) when `paths` is omitted. */
67
84
  readonly name: string;
68
85
  /** TCP port the binary listens on. */
@@ -108,14 +125,22 @@ export interface MakeDefaultTsBackendConfigOptions {
108
125
  */
109
126
  readonly daemon_token_dir_env?: string;
110
127
  }
128
+ /**
129
+ * The `PUBLIC_LOG_LEVEL` a TS-family backend gets — `'warn'`, so its errors
130
+ * and warnings reach its output without a line per request. Set through the
131
+ * env, not a `Logger` level in `start_testing_server`, because fuz_util reads
132
+ * it as the default level of every `Logger` the binary builds, the app's own
133
+ * included. Override it with `extra_env`.
134
+ */
135
+ export declare const TS_BACKEND_LOG_LEVEL = "warn";
111
136
  /**
112
137
  * Shared builder for TS-family backends (Node + Bun). Owns the common
113
138
  * env baseline (NODE_ENV, HOST, PORT, in-memory pglet, cookie keys,
114
- * bootstrap token path) so per-backend factories only declare what
115
- * genuinely differs.
139
+ * bootstrap token path, `PUBLIC_LOG_LEVEL`) so per-backend factories only
140
+ * declare what genuinely differs.
116
141
  */
117
142
  export declare const make_default_ts_backend_config: (opts: MakeDefaultTsBackendConfigOptions) => BackendConfig;
118
- export interface MakeDefaultRustBackendConfigOptions {
143
+ export interface MakeDefaultRustBackendConfigOptions extends DefaultBackendLogOptions {
119
144
  /** Diagnostic label; also names the tmpdir (`default_test_backend_paths`) when `paths` is omitted. */
120
145
  readonly name: string;
121
146
  /** TCP port the binary listens on. */
@@ -130,6 +155,14 @@ export interface MakeDefaultRustBackendConfigOptions {
130
155
  readonly database_url: string;
131
156
  /** Merged on top of the generic env baseline; later keys win. */
132
157
  readonly extra_env?: Readonly<Record<string, string>>;
158
+ /**
159
+ * Whether the binary drops the database's `public` schema before its
160
+ * migrations on every boot (`FUZ_TESTING_RESET_DB_ON_STARTUP`, written
161
+ * `'true'` or `'false'`). Default `true`, so a run starts on an empty
162
+ * database. `false` for a binary booted over a database another backend
163
+ * left — the backend swap (`backend_swap.ts`).
164
+ */
165
+ readonly reset_db_on_startup?: boolean;
133
166
  /**
134
167
  * Every capability, stated: spread `rust_default_capabilities` and add each
135
168
  * `MountFlag` and the `testing_backdoors` list. Required, so a mount flag or
@@ -171,7 +204,7 @@ export interface MakeDefaultRustBackendConfigOptions {
171
204
  /**
172
205
  * Shared builder for Rust-family backends. Owns the common env baseline
173
206
  * (RUST_LOG, HOST, port, real Postgres, cookie keys, bootstrap token
174
- * path, the `FUZ_TESTING_RESET_DB_ON_STARTUP=true` self-wipe gate) plus
207
+ * path, the `FUZ_TESTING_RESET_DB_ON_STARTUP` self-wipe gate) plus
175
208
  * the 120s startup window for cargo's first-run build cost.
176
209
  */
177
210
  export declare const make_default_rust_backend_config: (opts: MakeDefaultRustBackendConfigOptions) => BackendConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"default_backend_configs.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/default_backend_configs.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqC9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAA8B,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAiBlG;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,cAAc,CAAC;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,mBAAmB,MAAM,KAAG,MAS/D,CAAC;AAcF,2CAA2C;AAC3C,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAC5C,QAAQ,CAAC,8BAA8B,CAAC,EAAE,MAAM,CAAC;CACjD;AAED;;;;;GAKG;AACH,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AgC,GAC5C,MAAM,mCAAmC,KACvC,aAkDF,CAAC"}
1
+ {"version":3,"file":"default_backend_configs.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/default_backend_configs.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA4C9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAEN,KAAK,mBAAmB,EAExB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAA8B,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAiBlG;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,cAAc,CAAC;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,mBAAmB,MAAM,KAAG,MAS/D,CAAC;AAcF,2CAA2C;AAC3C,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAC5C,QAAQ,CAAC,8BAA8B,CAAC,EAAE,MAAM,CAAC;CACjD;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GACjC,SAAS,yBAAyB,KAChC,MAAM,CAAC,MAAM,EAAE,MAAM,CAKtB,CAAC;AAEH,gCAAgC;AAChC,MAAM,WAAW,gBAAgB;IAChC,oFAAoF;IACpF,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C,6EAA6E;IAC7E,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC,iFAAiF;IACjF,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC,4FAA4F;IAC5F,QAAQ,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CAC/C;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,gBAAgB,KAAG,MAAM,C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by family:
13
13
  *
14
- * - **TS** — `'memory://'` (in-memory pglet), 30s startup window.
14
+ * Both also tee the backend's output into `backend.log` under its temp root
15
+ * and fail teardown on an error line no allowance names
16
+ * (`DefaultBackendLogOptions`, `backend_log.ts`).
17
+ *
18
+ * - **TS** — `'memory://'` (in-memory pglet), 30s startup window, and
19
+ * `PUBLIC_LOG_LEVEL` set to `TS_BACKEND_LOG_LEVEL` (the spawned binary
20
+ * inherits `VITEST`, which would turn every `Logger` off).
15
21
  * - **Rust** — caller-supplied real Postgres URL (an in-process WASM database isn't reachable
16
22
  * from `tokio-postgres`), 120s startup window (cargo first-build cost),
17
- * and the `FUZ_TESTING_RESET_DB_ON_STARTUP=true` self-wipe gate.
23
+ * and the `FUZ_TESTING_RESET_DB_ON_STARTUP` self-wipe gate, on unless
24
+ * `reset_db_on_startup: false`.
18
25
  *
19
26
  * Both builders default `port_env_var` to `'PORT'`. Consumers whose
20
27
  * binary reads a different name (e.g. zzz's `ZZZ_PORT`) override. Both bind
@@ -31,7 +38,8 @@ import '../assert_dev_env.js';
31
38
  *
32
39
  * @module
33
40
  */
34
- import { basename, dirname } from 'node:path';
41
+ import { basename, dirname, join } from 'node:path';
42
+ import { SPINE_CROSS_SUITE_BACKEND_ERRORS } from './backend_log.js';
35
43
  import { default_test_backend_paths } from './build_test_backend_paths.js';
36
44
  import { default_test_bootstrap_token, default_test_cookie_keys, default_test_keeper_password, default_test_keeper_username } from './default_secrets.js';
37
45
  import { ACTION_RATE_LIMIT_ENABLED_ENV, ACTION_RATE_LIMIT_MAX_ATTEMPTS_ENV, AUDIT_SSE_KEEP_ALIVE_MS_ENV, SPINE_ACCOUNT_BOOTSTRAP_PATH, SPINE_RPC_PATH, SPINE_WS_PATH, WS_RECEIVE_TIMEOUT_MS_ENV } from './spine_surface_constants.js';
@@ -170,11 +178,31 @@ const build_default_bootstrap = (paths, overrides) => ({
170
178
  daemon_token_path: paths.daemon_token_path,
171
179
  ...overrides
172
180
  });
181
+ /** The `BackendConfig.log` a builder sets, or none for `log_path: null`. */
182
+ const to_default_backend_log = (paths, options) => {
183
+ const { log_path = join(paths.root, 'backend.log'), log_allow_errors = [] } = options;
184
+ return log_path === null
185
+ ? {}
186
+ : {
187
+ log: {
188
+ path: log_path,
189
+ allow_errors: [...SPINE_CROSS_SUITE_BACKEND_ERRORS, ...log_allow_errors]
190
+ }
191
+ };
192
+ };
193
+ /**
194
+ * The `PUBLIC_LOG_LEVEL` a TS-family backend gets — `'warn'`, so its errors
195
+ * and warnings reach its output without a line per request. Set through the
196
+ * env, not a `Logger` level in `start_testing_server`, because fuz_util reads
197
+ * it as the default level of every `Logger` the binary builds, the app's own
198
+ * included. Override it with `extra_env`.
199
+ */
200
+ export const TS_BACKEND_LOG_LEVEL = 'warn';
173
201
  /**
174
202
  * Shared builder for TS-family backends (Node + Bun). Owns the common
175
203
  * env baseline (NODE_ENV, HOST, PORT, in-memory pglet, cookie keys,
176
- * bootstrap token path) so per-backend factories only declare what
177
- * genuinely differs.
204
+ * bootstrap token path, `PUBLIC_LOG_LEVEL`) so per-backend factories only
205
+ * declare what genuinely differs.
178
206
  */
179
207
  export const make_default_ts_backend_config = (opts) => {
180
208
  const { name, port, start_command, database_url = 'memory://', extra_env, capabilities, paths = default_test_backend_paths(name), bootstrap_overrides, port_env_var = 'PORT', cookie_name = 'fuz_session', daemon_token_dir_env } = opts;
@@ -200,21 +228,26 @@ export const make_default_ts_backend_config = (opts) => {
200
228
  // which boots only with the opt-in
201
229
  FUZ_ALLOW_ORIGIN_WILDCARDS: 'true',
202
230
  FUZ_BOOTSTRAP_TOKEN_PATH: paths.bootstrap_token_path,
231
+ // the spawned binary inherits `VITEST`, under which fuz_util's default
232
+ // log level is `'off'` — every `Logger` the binary builds would stay
233
+ // silent, and a backend's error logs would never reach its log file
234
+ PUBLIC_LOG_LEVEL: TS_BACKEND_LOG_LEVEL,
203
235
  ...daemon_token_dir_entry(daemon_token_dir_env, bootstrap),
204
236
  ...extra_env
205
237
  },
206
238
  bootstrap,
207
- capabilities
239
+ capabilities,
240
+ ...to_default_backend_log(paths, opts)
208
241
  };
209
242
  };
210
243
  /**
211
244
  * Shared builder for Rust-family backends. Owns the common env baseline
212
245
  * (RUST_LOG, HOST, port, real Postgres, cookie keys, bootstrap token
213
- * path, the `FUZ_TESTING_RESET_DB_ON_STARTUP=true` self-wipe gate) plus
246
+ * path, the `FUZ_TESTING_RESET_DB_ON_STARTUP` self-wipe gate) plus
214
247
  * the 120s startup window for cargo's first-run build cost.
215
248
  */
216
249
  export const make_default_rust_backend_config = (opts) => {
217
- const { name, port, start_command, database_url, extra_env, capabilities, paths = default_test_backend_paths(name), bootstrap_overrides, port_env_var = 'PORT', rust_log = 'info', cookie_name = 'fuz_session', daemon_token_dir_env } = opts;
250
+ const { name, port, start_command, database_url, extra_env, capabilities, paths = default_test_backend_paths(name), bootstrap_overrides, port_env_var = 'PORT', rust_log = 'info', cookie_name = 'fuz_session', daemon_token_dir_env, reset_db_on_startup = true } = opts;
218
251
  const bootstrap = build_default_bootstrap(paths, bootstrap_overrides);
219
252
  return {
220
253
  name,
@@ -238,16 +271,18 @@ export const make_default_rust_backend_config = (opts) => {
238
271
  FUZ_ALLOW_ORIGIN_WILDCARDS: 'true',
239
272
  FUZ_BOOTSTRAP_TOKEN_PATH: paths.bootstrap_token_path,
240
273
  // Self-wipe the auth-namespace schema before migrations on every
241
- // boot. Read by the hook `fuz_testing::startup_reset_hook` builds,
242
- // which the consumer's test binary passes as its
243
- // `pre_migration_hook`, run between pool creation and
244
- // `fuz_db::run_migrations`. The `_testing_reset` RPC action
245
- // (per-test reset) is orthogonal.
246
- FUZ_TESTING_RESET_DB_ON_STARTUP: 'true',
274
+ // boot, unless the caller turns it off. Read by the hook
275
+ // `fuz_testing::startup_reset_hook` builds, which the consumer's test
276
+ // binary passes as its `pre_migration_hook`, run between pool
277
+ // creation and `fuz_db::run_migrations`; `'false'` is a no-op there.
278
+ // Always written, so an inherited value never decides. The
279
+ // `_testing_reset` RPC action (per-test reset) is orthogonal.
280
+ FUZ_TESTING_RESET_DB_ON_STARTUP: reset_db_on_startup ? 'true' : 'false',
247
281
  ...daemon_token_dir_entry(daemon_token_dir_env, bootstrap),
248
282
  ...extra_env
249
283
  },
250
284
  bootstrap,
251
- capabilities
285
+ capabilities,
286
+ ...to_default_backend_log(paths, opts)
252
287
  };
253
288
  };
@@ -1 +1 @@
1
- {"version":3,"file":"in_process_setup.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/in_process_setup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqB9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAiB3E,OAAO,EAEN,KAAK,oBAAoB,EACzB,KAAK,eAAe,EAEpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAEN,KAAK,qBAAqB,EAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAA2B,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEtF,OAAO,EAMN,KAAK,SAAS,EAEd,KAAK,gBAAgB,EACrB,MAAM,YAAY,CAAC;AAepB;;;;;GAKG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IAClE;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC1D;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9C;;;OAGG;IACH,QAAQ,CAAC,kCAAkC,CAAC,EAAE,OAAO,CAAC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AAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACjD;;;OAGG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC;;;OAGG;IACH,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAC7C;;;OAGG;IACH,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C;;;;;OAKG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CAChC;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;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,mBAAmB,EAAE,CAAC,CAAC,qBAAqB,CAAC,CAAC;IAC9C,kBAAkB,EAAE,CAAC,CAAC,oBAAoB,CAAC,CAAC;IAC5C,aAAa,EAAE,CAAC,CAAC,eAAe,CAAC,CAAC;IAClC,QAAQ,EAAE,IAAI,CAAC;IACf,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CAsClC,CAAC"}
@@ -11,7 +11,7 @@ import { validate_db_invariant_exclusions } from '../db_invariant_queries.js';
11
11
  import { find_rpc_action, http_transport, resolve_rpc_endpoints_for_setup } from '../rpc_helpers.js';
12
12
  import { query_shorten_credential_expiry } from './testing_reset_actions.js';
13
13
  import { in_process_capabilities } from './capabilities.js';
14
- import { assert_credential_authenticates, EXPIRED_SESSION_OFFSET_SECONDS, EXPIRED_TOKEN_SHORTEN_SECONDS, EXPIRED_TOKEN_WAIT_MS, to_test_account } from './setup.js';
14
+ import { assert_credential_authenticates, EXPIRED_CREDENTIAL_SHORTEN_SECONDS, EXPIRED_CREDENTIAL_WAIT_MS, to_test_account } from './setup.js';
15
15
  /**
16
16
  * Wrap a Hono-style app into a `FetchTransport`-shaped object so the
17
17
  * shared `TestFixture.transport` type holds for both in-process and
@@ -24,6 +24,22 @@ const in_process_fetch_transport = (app) => {
24
24
  const transport = ((url, init) => call(url, init));
25
25
  return Object.assign(transport, { cookies: () => [] });
26
26
  };
27
+ /**
28
+ * Move every session and API token row of an account back by `ms` — each
29
+ * timestamp the row carries, so their order holds: what the rows would read
30
+ * had they been written `ms` earlier. How the in-process `mint_expired_token`
31
+ * and `mint_expired_session` stand in for the cross-process fixture's wait.
32
+ *
33
+ * @mutates `auth_session` and `api_token` - the account's rows' timestamps
34
+ */
35
+ const backdate_account_credentials = async (db, account_id, ms) => {
36
+ const shift = `($2::int4 * INTERVAL '1 millisecond')`;
37
+ await db.query(`UPDATE auth_session SET created_at = created_at - ${shift}, expires_at = expires_at - ${shift}
38
+ WHERE account_id = $1`, [account_id, ms]);
39
+ await db.query(`UPDATE api_token SET created_at = created_at - ${shift}, expires_at = expires_at - ${shift},
40
+ last_used_at = last_used_at - ${shift}
41
+ WHERE account_id = $1`, [account_id, ms]);
42
+ };
27
43
  /**
28
44
  * Build a `SetupTest` that creates a fresh `TestApp` per call via
29
45
  * `create_test_app` and projects it into the `TestFixture` shape.
@@ -96,6 +112,28 @@ export const default_in_process_setup = (options) => {
96
112
  const seeded_actor = await create_test_extra_actor(test_app.backend.deps.db, test_app.backend.account.id, name);
97
113
  extra_actors.push({ id: seeded_actor.id, name: seeded_actor.name });
98
114
  }
115
+ // The expired-credential mints' shared shape: a fresh account, its
116
+ // credential proven live, then every credential of the account pulled
117
+ // in with the expiry backdoor's statement — refused for the expiry alone.
118
+ const mint_expired_account = async (accessor, kind, credential) => {
119
+ const db = test_app.backend.deps.db;
120
+ const other = await test_app.create_account();
121
+ await assert_credential_authenticates({
122
+ transport: in_process_fetch_transport(test_app.app),
123
+ rpc_path: account_verify_rpc_path(accessor),
124
+ headers: credential(other),
125
+ account_id: other.account.id,
126
+ accessor
127
+ });
128
+ const shortened = await query_shorten_credential_expiry(db, other.account.id, EXPIRED_CREDENTIAL_SHORTEN_SECONDS);
129
+ if (shortened[kind] < 1)
130
+ throw new Error(`${accessor}: the expiry rewrote no ${kind} row`);
131
+ // in place of the cross-process wait: the account's credential rows
132
+ // moved back by it whole, as if minted, used and shortened that long
133
+ // ago — so `expires_at` lands past, still after `created_at`
134
+ await backdate_account_credentials(db, other.account.id, EXPIRED_CREDENTIAL_WAIT_MS);
135
+ return other;
136
+ };
99
137
  const fixture = {
100
138
  transport: in_process_fetch_transport(test_app.app),
101
139
  // In-process the wrapper is stateless and never auto-adds Origin —
@@ -112,24 +150,18 @@ export const default_in_process_setup = (options) => {
112
150
  extra_actors,
113
151
  reject_unknown_audit_metadata_keys: options.reject_unknown_audit_metadata_keys ?? false,
114
152
  assert_db_invariants: test_app.assert_db_invariants,
115
- // Forge directly against the live backend's DB + keyring — no wire
116
- // hop needed in-process.
117
153
  mint_expired_session: async () => {
118
- const { session_cookie } = await mint_test_session({
119
- db: test_app.backend.deps.db,
120
- keyring: test_app.backend.keyring,
121
- account_id: test_app.backend.account.id,
122
- expires_in_seconds: EXPIRED_SESSION_OFFSET_SECONDS
123
- });
124
- return `${cookie_name}=${session_cookie}`;
154
+ const other = await mint_expired_account('mint_expired_session', 'sessions', (account) => ({
155
+ cookie: `${cookie_name}=${account.session_cookie}`
156
+ }));
157
+ return `${cookie_name}=${other.session_cookie}`;
125
158
  },
126
- // The session mint writes what the Rust `_testing_mint_session` writes
127
- // (`mint_test_session`: a full lifetime past the database's `NOW()`);
128
- // the token mints, the revocations and the expiry go through the
129
- // queries the production paths (and the expiry backdoor) write with,
130
- // so the rows match what the cross-process accessors leave. Each
131
- // credential is proven live first, so its refusal can only be the
132
- // revocation or the expiry.
159
+ // The revoked-session mint writes its row with `mint_test_session` (a
160
+ // full lifetime past the database's `NOW()`); the token mints, the
161
+ // revocations and the expiries go through the queries the production
162
+ // paths (and the expiry backdoor) write with, so the rows match what
163
+ // the cross-process accessors leave. Each credential is proven live
164
+ // first, so its refusal can only be the revocation or the expiry.
133
165
  mint_revoked_session: async () => {
134
166
  const db = test_app.backend.deps.db;
135
167
  const account_id = test_app.backend.account.id;
@@ -170,19 +202,9 @@ export const default_in_process_setup = (options) => {
170
202
  return token;
171
203
  },
172
204
  mint_expired_token: async () => {
173
- const other = await test_app.create_account();
174
- await assert_credential_authenticates({
175
- transport: in_process_fetch_transport(test_app.app),
176
- rpc_path: account_verify_rpc_path('mint_expired_token'),
177
- headers: { authorization: `Bearer ${other.api_token}` },
178
- account_id: other.account.id,
179
- accessor: 'mint_expired_token'
180
- });
181
- const shortened = await query_shorten_credential_expiry(test_app.backend.deps.db, other.account.id, EXPIRED_TOKEN_SHORTEN_SECONDS);
182
- if (shortened.api_tokens < 1) {
183
- throw new Error('mint_expired_token: the expiry rewrote no token row');
184
- }
185
- await new Promise((resolve) => setTimeout(resolve, EXPIRED_TOKEN_WAIT_MS));
205
+ const other = await mint_expired_account('mint_expired_token', 'api_tokens', (account) => ({
206
+ authorization: `Bearer ${account.api_token}`
207
+ }));
186
208
  return other.api_token;
187
209
  }
188
210
  };
@@ -11,6 +11,17 @@ import type { TestFixture } from './setup.js';
11
11
  * @param body - the JSON request body
12
12
  */
13
13
  export declare const cross_post_as: (fixture: TestFixture, account: TestAccount, path: string, body: unknown) => Promise<void>;
14
+ /**
15
+ * Revoke the session `account`'s requests are sent on (`account_session_revoke`
16
+ * on that session), asserting it was revoked: the session list, read on the
17
+ * same session, names it as the current one, so the id revoked is the one the
18
+ * caller holds rather than a sibling's.
19
+ *
20
+ * @param fixture - the per-test fixture whose fresh transport carries the requests
21
+ * @param rpc_path - the RPC endpoint path
22
+ * @param account - the account whose session cookie authenticates both calls
23
+ */
24
+ export declare const cross_session_revoke_current: (fixture: TestFixture, rpc_path: string, account: TestAccount) => Promise<void>;
14
25
  /**
15
26
  * Revoke every API token of `account_id` over the keeper's admin session
16
27
  * (`admin_token_revoke_all`), asserting success.
@@ -36,7 +47,7 @@ export declare const cross_account_purge: (fixture: TestFixture, rpc_path: strin
36
47
  * - `account` — every connection of the target account, whatever credential
37
48
  * opened it
38
49
  * - `session` — only the connections of the session the revocation was sent on
39
- * (`TestAccount.create_session_headers`'s); the account's other sessions, its
50
+ * or names (`TestAccount.create_session_headers`'s); the account's other sessions, its
40
51
  * API tokens, and the daemon token stay valid, and their connections open
41
52
  */
42
53
  export type AccountRevocationCloses = 'account' | 'session';
@@ -75,7 +86,8 @@ export interface AccountRevocationsOptions {
75
86
  * The revocations of a target account's credentials both transport suites
76
87
  * drive: `admin_token_revoke_all`, `POST /password`, and `account_purge`
77
88
  * (gated on `capabilities.account_lifecycle`) close every connection of the
78
- * account; `POST /logout` closes only the connections of the session it ends.
89
+ * account; `POST /logout` and `account_session_revoke` of the caller's own
90
+ * session close only the connections of the session they end.
79
91
  *
80
92
  * @param options - the backend's capabilities and route paths
81
93
  * @returns the revocation rows, in a stable order
@@ -1 +1 @@
1
- {"version":3,"file":"revocation_drivers.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/revocation_drivers.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA+B9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GACzB,SAAS,WAAW,EACpB,SAAS,WAAW,EACpB,MAAM,MAAM,EACZ,MAAM,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,WAAW,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9E;AAED,sDAAsD;AACtD,MAAM,WAAW,yBAAyB;IACzC,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8BAA8B;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,uCAAuC;IACvC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GACtC,SAAS,yBAAyB,KAChC,aAAa,CAAC,iBAAiB,CA4CjC,CAAC"}
@@ -8,12 +8,13 @@ import '../assert_dev_env.js';
8
8
  * it succeeded; the suite opens the target's connections first and asserts
9
9
  * their close after. Each row says what it closes (`AccountRevocation.closes`):
10
10
  * the whole account, or only the session the revocation was sent on
11
- * (`POST /logout`), which leaves the account's other credentials' connections
12
- * open. `describe_cross_process_ws_tests` and
13
- * `describe_cross_process_sse_tests` iterate `create_account_revocations`. The
14
- * revocations that name a credential in their input (one session, one token),
15
- * a cap eviction, and those a suite drives differently (session revoke-all,
16
- * account delete) stay in their suites.
11
+ * (`POST /logout`, `account_session_revoke` of the current session), which
12
+ * leaves the account's other credentials' connections open.
13
+ * `describe_cross_process_ws_tests` and `describe_cross_process_sse_tests`
14
+ * iterate `create_account_revocations`. The revocations that name another
15
+ * credential in their input (a sibling session, one token), a cap eviction,
16
+ * and those a suite drives differently (session revoke-all, account delete)
17
+ * stay in their suites.
17
18
  *
18
19
  * The drivers are exported on their own for a consumer suite that closes a
19
20
  * transport of its own on the same revocations.
@@ -21,9 +22,10 @@ import '../assert_dev_env.js';
21
22
  * @module
22
23
  */
23
24
  import { assert } from 'vitest';
25
+ import { account_session_list_action_spec, account_session_revoke_action_spec, SessionListOutput, SessionRevokeOutput } from '../../auth/account_action_specs.js';
24
26
  import { account_purge_action_spec, admin_token_revoke_all_action_spec } from '../../auth/admin_action_specs.js';
25
27
  import { DEFAULT_TEST_PASSWORD } from '../test_credentials.js';
26
- import { cross_rpc_call } from './cross_rpc.js';
28
+ import { cross_rpc_call, expect_output } from './cross_rpc.js';
27
29
  /**
28
30
  * POST a JSON body to a REST route on `account`'s session, asserting `200`.
29
31
  *
@@ -40,6 +42,24 @@ export const cross_post_as = async (fixture, account, path, body) => {
40
42
  });
41
43
  assert.strictEqual(res.status, 200, `POST ${path}: ${await res.text()}`);
42
44
  };
45
+ /**
46
+ * Revoke the session `account`'s requests are sent on (`account_session_revoke`
47
+ * on that session), asserting it was revoked: the session list, read on the
48
+ * same session, names it as the current one, so the id revoked is the one the
49
+ * caller holds rather than a sibling's.
50
+ *
51
+ * @param fixture - the per-test fixture whose fresh transport carries the requests
52
+ * @param rpc_path - the RPC endpoint path
53
+ * @param account - the account whose session cookie authenticates both calls
54
+ */
55
+ export const cross_session_revoke_current = async (fixture, rpc_path, account) => {
56
+ const headers = account.create_session_headers();
57
+ const { sessions } = expect_output(await cross_rpc_call(fixture.fresh_transport(), rpc_path, account_session_list_action_spec.method, undefined, headers), SessionListOutput);
58
+ const current = sessions.filter((session) => session.is_current);
59
+ assert.strictEqual(current.length, 1, `exactly one current session: ${JSON.stringify(sessions)}`);
60
+ const output = expect_output(await cross_rpc_call(fixture.fresh_transport(), rpc_path, account_session_revoke_action_spec.method, { session_id: current[0].id }, headers), SessionRevokeOutput);
61
+ assert.strictEqual(output.revoked, true, 'account_session_revoke revoked the current session');
62
+ };
43
63
  /**
44
64
  * Revoke every API token of `account_id` over the keeper's admin session
45
65
  * (`admin_token_revoke_all`), asserting success.
@@ -69,7 +89,8 @@ export const cross_account_purge = async (fixture, rpc_path, account_id) => {
69
89
  * The revocations of a target account's credentials both transport suites
70
90
  * drive: `admin_token_revoke_all`, `POST /password`, and `account_purge`
71
91
  * (gated on `capabilities.account_lifecycle`) close every connection of the
72
- * account; `POST /logout` closes only the connections of the session it ends.
92
+ * account; `POST /logout` and `account_session_revoke` of the caller's own
93
+ * session close only the connections of the session they end.
73
94
  *
74
95
  * @param options - the backend's capabilities and route paths
75
96
  * @returns the revocation rows, in a stable order
@@ -91,6 +112,13 @@ export const create_account_revocations = (options) => {
91
112
  closes: 'session',
92
113
  revoke: (fixture, target) => cross_post_as(fixture, target, logout_path, {})
93
114
  },
115
+ {
116
+ label: 'account_session_revoke',
117
+ slug: 'session_revoke',
118
+ gate: true,
119
+ closes: 'session',
120
+ revoke: (fixture, target) => cross_session_revoke_current(fixture, rpc_path, target)
121
+ },
94
122
  {
95
123
  label: 'POST /password',
96
124
  slug: 'password',
@@ -98,6 +98,13 @@ export interface SpineStubBackendConfigOptions {
98
98
  * `TsSpineBackendConfigOptions.db_audit_checkout_timeout_ms`.
99
99
  */
100
100
  readonly db_audit_checkout_timeout_ms?: number;
101
+ /**
102
+ * Whether the stub drops the database's `public` schema before its
103
+ * migrations on boot. Default `true`. `false` keeps what another backend
104
+ * left there — the backend swap (`backend_swap.ts`). Passed to
105
+ * `make_default_rust_backend_config`.
106
+ */
107
+ readonly reset_db_on_startup?: boolean;
101
108
  }
102
109
  /**
103
110
  * Build the `BackendConfig` for `testing_spine_stub`. Resolves the binary
@@ -1 +1 @@
1
- {"version":3,"file":"rust_spine_stub_backend_config.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/rust_spine_stub_backend_config.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAwC9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAezD,uGAAuG;AACvG,eAAO,MAAM,uBAAuB,oCAAoC,CAAC;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,6CAA6C,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,wCAAwC,6CAA6C,CAAC;AAuCnG,kGAAkG;AAClG,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD,8EAA8E;AAC9E,eAAO,MAAM,4BAA4B,eAAe,CAAC;AAEzD,0FAA0F;AAC1F,eAAO,MAAM,oCAAoC,sDACG,CAAC;AAErD,MAAM,WAAW,6BAA6B;IAC7C,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;;OAOG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC;;;;;;OAMG;IACH,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAC5C;;;;;OAKG;IACH,QAAQ,CAAC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACjD;;;;OAIG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CAC/C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,GAC1C,UAAS,6BAAkC,KACzC,aAoDF,CAAC"}
1
+ {"version":3,"file":"rust_spine_stub_backend_config.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/rust_spine_stub_backend_config.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAyC9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAezD,uGAAuG;A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;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,GAC1C,UAAS,6BAAkC,KACzC,aAsDF,CAAC"}
@@ -30,7 +30,8 @@ import '../assert_dev_env.js';
30
30
  * (`FUZ_TESTING_RESET_DB_ON_STARTUP=true`, set by the Rust-family builder),
31
31
  * so no manual `DROP TABLE` between sessions is needed; per-test reset is
32
32
  * the orthogonal `_testing_reset` RPC action `default_cross_process_setup`
33
- * fires.
33
+ * fires. `reset_db_on_startup: false` boots it over the database as it finds
34
+ * it, for the backend swap (`backend_swap.ts`).
34
35
  *
35
36
  * @module
36
37
  */
@@ -109,7 +110,7 @@ export const RUST_SPINE_STUB_DEFAULT_DATABASE_URL = 'postgres://localhost/fuz_ap
109
110
  */
110
111
  export const rust_spine_stub_backend_config = (options = {}) => {
111
112
  const { port = RUST_SPINE_STUB_DEFAULT_PORT, database_url = process.env[RUST_SPINE_STUB_DATABASE_URL_ENV] ||
112
- RUST_SPINE_STUB_DEFAULT_DATABASE_URL, binary_path = process.env[RUST_SPINE_STUB_BIN_ENV], enable_login_rate_limit, trusted_proxies, name = RUST_SPINE_STUB_DEFAULT_NAME } = options;
113
+ RUST_SPINE_STUB_DEFAULT_DATABASE_URL, binary_path = process.env[RUST_SPINE_STUB_BIN_ENV], enable_login_rate_limit, trusted_proxies, name = RUST_SPINE_STUB_DEFAULT_NAME, reset_db_on_startup } = options;
113
114
  if (!binary_path) {
114
115
  throw new Error(`rust_spine_stub_backend_config: no binary path — set ${RUST_SPINE_STUB_BIN_ENV} to a prebuilt ` +
115
116
  '`testing_spine_stub` binary (build it with `cargo build -p testing_spine_stub --profile cross-test`) ' +
@@ -133,6 +134,7 @@ export const rust_spine_stub_backend_config = (options = {}) => {
133
134
  // dir to `paths.root`, which makes that `paths.daemon_token_path`, the
134
135
  // file `spawn_backend` reads after the health probe.
135
136
  daemon_token_dir_env: 'FUZ_RUST_SPINE_STUB_DIR',
137
+ reset_db_on_startup,
136
138
  extra_env: {
137
139
  // Absolute path to the committed spine `expected_schema.json` — the
138
140
  // stub's `/ready` gate introspects the live DB against it. The SAME