@fuzdev/fuz_app 0.182.0 → 0.183.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 (191) hide show
  1. package/README.md +2 -0
  2. package/dist/actions/CLAUDE.md +4 -4
  3. package/dist/auth/CLAUDE.md +58 -34
  4. package/dist/auth/account_routes.d.ts +5 -3
  5. package/dist/auth/account_routes.d.ts.map +1 -1
  6. package/dist/auth/account_routes.js +71 -66
  7. package/dist/auth/admin_actions.d.ts.map +1 -1
  8. package/dist/auth/admin_actions.js +22 -17
  9. package/dist/auth/audit_emitter.d.ts +75 -84
  10. package/dist/auth/audit_emitter.d.ts.map +1 -1
  11. package/dist/auth/audit_emitter.js +83 -71
  12. package/dist/auth/audit_log_schema.d.ts +10 -5
  13. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  14. package/dist/auth/audit_log_schema.js +22 -6
  15. package/dist/auth/bootstrap_account.d.ts +31 -13
  16. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  17. package/dist/auth/bootstrap_account.js +34 -15
  18. package/dist/auth/bootstrap_routes.d.ts +1 -1
  19. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  20. package/dist/auth/bootstrap_routes.js +7 -14
  21. package/dist/auth/deps.d.ts +8 -5
  22. package/dist/auth/deps.d.ts.map +1 -1
  23. package/dist/auth/deps.js +3 -2
  24. package/dist/auth/resolved_auth.d.ts +7 -7
  25. package/dist/auth/resolved_auth.d.ts.map +1 -1
  26. package/dist/auth/resolved_auth.js +4 -4
  27. package/dist/auth/role_grant_offer_actions.d.ts +25 -1
  28. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  29. package/dist/auth/role_grant_offer_actions.js +40 -33
  30. package/dist/auth/role_grant_offer_queries.d.ts +60 -4
  31. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  32. package/dist/auth/role_grant_offer_queries.js +79 -5
  33. package/dist/auth/role_grant_queries.d.ts +3 -52
  34. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  35. package/dist/auth/role_grant_queries.js +5 -80
  36. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  37. package/dist/auth/self_service_role_actions.js +11 -22
  38. package/dist/auth/session_queries.d.ts +6 -3
  39. package/dist/auth/session_queries.d.ts.map +1 -1
  40. package/dist/auth/session_queries.js +20 -11
  41. package/dist/auth/signup_routes.d.ts.map +1 -1
  42. package/dist/auth/signup_routes.js +90 -38
  43. package/dist/db/sql_columns.d.ts +1 -1
  44. package/dist/db/sql_columns.js +1 -1
  45. package/dist/http/CLAUDE.md +15 -10
  46. package/dist/http/db_routes.d.ts +7 -22
  47. package/dist/http/db_routes.d.ts.map +1 -1
  48. package/dist/http/db_routes.js +72 -72
  49. package/dist/http/pending_effects.d.ts +42 -4
  50. package/dist/http/pending_effects.d.ts.map +1 -1
  51. package/dist/http/pending_effects.js +34 -4
  52. package/dist/server/app_server.d.ts +43 -2
  53. package/dist/server/app_server.d.ts.map +1 -1
  54. package/dist/server/app_server.js +57 -3
  55. package/dist/testing/CLAUDE.md +255 -786
  56. package/dist/testing/adversarial_404.d.ts +6 -1
  57. package/dist/testing/adversarial_404.d.ts.map +1 -1
  58. package/dist/testing/adversarial_404.js +38 -17
  59. package/dist/testing/app_server.d.ts +20 -140
  60. package/dist/testing/app_server.d.ts.map +1 -1
  61. package/dist/testing/app_server.js +45 -124
  62. package/dist/testing/audit_drift_guard.d.ts +11 -6
  63. package/dist/testing/audit_drift_guard.d.ts.map +1 -1
  64. package/dist/testing/audit_drift_guard.js +15 -8
  65. package/dist/testing/cross_backend/audit_cross_helpers.d.ts +12 -9
  66. package/dist/testing/cross_backend/audit_cross_helpers.d.ts.map +1 -1
  67. package/dist/testing/cross_backend/audit_cross_helpers.js +13 -14
  68. package/dist/testing/cross_backend/capabilities.d.ts +9 -6
  69. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  70. package/dist/testing/cross_backend/capabilities.js +11 -7
  71. package/dist/testing/cross_backend/capability_mounts.d.ts +103 -0
  72. package/dist/testing/cross_backend/capability_mounts.d.ts.map +1 -0
  73. package/dist/testing/cross_backend/capability_mounts.js +423 -0
  74. package/dist/testing/cross_backend/cell_moderate.js +2 -2
  75. package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
  76. package/dist/testing/cross_backend/cell_relations.js +12 -11
  77. package/dist/testing/cross_backend/conformance_principal.d.ts +54 -0
  78. package/dist/testing/cross_backend/conformance_principal.d.ts.map +1 -0
  79. package/dist/testing/cross_backend/conformance_principal.js +283 -0
  80. package/dist/testing/cross_backend/conformance_table.d.ts +2 -50
  81. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  82. package/dist/testing/cross_backend/conformance_table.js +2 -270
  83. package/dist/testing/cross_backend/credential_deadline.d.ts.map +1 -1
  84. package/dist/testing/cross_backend/credential_deadline.js +2 -0
  85. package/dist/testing/cross_backend/credential_wire.d.ts +1 -1
  86. package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -1
  87. package/dist/testing/cross_backend/db_state_diff.d.ts +72 -0
  88. package/dist/testing/cross_backend/db_state_diff.d.ts.map +1 -0
  89. package/dist/testing/cross_backend/db_state_diff.js +444 -0
  90. package/dist/testing/cross_backend/declared_skips.d.ts +68 -0
  91. package/dist/testing/cross_backend/declared_skips.d.ts.map +1 -0
  92. package/dist/testing/cross_backend/declared_skips.js +132 -0
  93. package/dist/testing/cross_backend/differential.d.ts +11 -2
  94. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  95. package/dist/testing/cross_backend/differential.js +35 -11
  96. package/dist/testing/cross_backend/differential_normalize.d.ts +12 -0
  97. package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
  98. package/dist/testing/cross_backend/differential_normalize.js +16 -0
  99. package/dist/testing/cross_backend/in_process_setup.d.ts +22 -12
  100. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  101. package/dist/testing/cross_backend/in_process_setup.js +151 -134
  102. package/dist/testing/cross_backend/login_security.d.ts +12 -0
  103. package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
  104. package/dist/testing/cross_backend/login_security.js +21 -4
  105. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +0 -2
  106. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -1
  107. package/dist/testing/cross_backend/request_target_conformance_wire.js +3 -1
  108. package/dist/testing/cross_backend/revocation_drivers.d.ts +18 -5
  109. package/dist/testing/cross_backend/revocation_drivers.d.ts.map +1 -1
  110. package/dist/testing/cross_backend/revocation_drivers.js +18 -10
  111. package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts +1 -1
  112. package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts.map +1 -1
  113. package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
  114. package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +33 -1
  115. package/dist/testing/cross_backend/role_grant_participation.js +4 -4
  116. package/dist/testing/cross_backend/rpc_adversarial.js +1 -1
  117. package/dist/testing/cross_backend/session_cap.d.ts +2 -2
  118. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  119. package/dist/testing/cross_backend/session_cap.js +22 -11
  120. package/dist/testing/cross_backend/setup.d.ts +31 -1
  121. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  122. package/dist/testing/cross_backend/setup.js +32 -1
  123. package/dist/testing/cross_backend/spine_suites.d.ts +123 -12
  124. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  125. package/dist/testing/cross_backend/spine_suites.js +454 -57
  126. package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
  127. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  128. package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
  129. package/dist/testing/cross_backend/sse_round_trip.d.ts +9 -1
  130. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  131. package/dist/testing/cross_backend/sse_round_trip.js +123 -27
  132. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  133. package/dist/testing/cross_backend/testing_backdoor.js +4 -2
  134. package/dist/testing/cross_backend/testing_reset_actions.d.ts +59 -27
  135. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  136. package/dist/testing/cross_backend/testing_reset_actions.js +66 -42
  137. package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
  138. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
  139. package/dist/testing/cross_backend/transport_composition.js +7 -3
  140. package/dist/testing/cross_backend/ws_round_trip.d.ts +5 -0
  141. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  142. package/dist/testing/cross_backend/ws_round_trip.js +54 -8
  143. package/dist/testing/data_exposure.d.ts.map +1 -1
  144. package/dist/testing/data_exposure.js +3 -0
  145. package/dist/testing/db.d.ts +0 -32
  146. package/dist/testing/db.d.ts.map +1 -1
  147. package/dist/testing/db.js +0 -86
  148. package/dist/testing/db_entities.d.ts +14 -0
  149. package/dist/testing/db_entities.d.ts.map +1 -1
  150. package/dist/testing/db_entities.js +17 -0
  151. package/dist/testing/db_invariant_queries.d.ts +259 -0
  152. package/dist/testing/db_invariant_queries.d.ts.map +1 -0
  153. package/dist/testing/db_invariant_queries.js +400 -0
  154. package/dist/testing/db_invariants.d.ts +106 -0
  155. package/dist/testing/db_invariants.d.ts.map +1 -0
  156. package/dist/testing/db_invariants.gen.sql.d.ts +11 -0
  157. package/dist/testing/db_invariants.gen.sql.d.ts.map +1 -0
  158. package/dist/testing/db_invariants.gen.sql.js +13 -0
  159. package/dist/testing/db_invariants.js +141 -0
  160. package/dist/testing/db_invariants.sql +152 -0
  161. package/dist/testing/describe_db.d.ts +36 -0
  162. package/dist/testing/describe_db.d.ts.map +1 -0
  163. package/dist/testing/describe_db.js +71 -0
  164. package/dist/testing/integration.d.ts +6 -9
  165. package/dist/testing/integration.d.ts.map +1 -1
  166. package/dist/testing/integration.js +9 -13
  167. package/dist/testing/integration_helpers.d.ts +1 -1
  168. package/dist/testing/integration_helpers.d.ts.map +1 -1
  169. package/dist/testing/rate_limiting.d.ts +1 -1
  170. package/dist/testing/rate_limiting.d.ts.map +1 -1
  171. package/dist/testing/rate_limiting.js +3 -2
  172. package/dist/testing/role_grant_helpers.d.ts +1 -1
  173. package/dist/testing/role_grant_helpers.d.ts.map +1 -1
  174. package/dist/testing/round_trip.d.ts.map +1 -1
  175. package/dist/testing/round_trip.js +3 -0
  176. package/dist/testing/rpc_attack_surface.d.ts +8 -6
  177. package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
  178. package/dist/testing/rpc_attack_surface.js +69 -6
  179. package/dist/testing/rpc_round_trip.d.ts +1 -1
  180. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  181. package/dist/testing/rpc_round_trip.js +3 -0
  182. package/dist/testing/sse_round_trip.d.ts +1 -1
  183. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  184. package/dist/testing/sse_round_trip.js +13 -4
  185. package/dist/testing/stubs.d.ts +4 -2
  186. package/dist/testing/stubs.d.ts.map +1 -1
  187. package/dist/testing/stubs.js +10 -5
  188. package/dist/testing/test_app.d.ts +166 -0
  189. package/dist/testing/test_app.d.ts.map +1 -0
  190. package/dist/testing/test_app.js +124 -0
  191. package/package.json +1 -1
@@ -17,14 +17,26 @@ import '../assert_dev_env.js';
17
17
  *
18
18
  * - `exclude` names a suite with the reason it can't run on this backend; the
19
19
  * reason is required and shows in the run as a skipped test, so a skip is
20
- * stated in code and visible in the report. `testing_backdoor` can't be
21
- * excluded, by suite or by case, nor its `capabilities.testing_backdoors`
22
- * changed: it checks the declaration the backdoor gating reads.
20
+ * stated in code and visible in the report. The suites in
21
+ * `UNEXCLUDABLE_SPINE_SUITES` can't be excluded, by suite or by case, and an
22
+ * override of one is held to an allowlist (`check_unexcludable_override`):
23
+ * `testing_backdoor` checks `capabilities.testing_backdoors`, which the
24
+ * backdoor gating reads, and takes only `extra_methods` and a dropped `ws`;
25
+ * `capability_mounts` checks the mount flags every suite gates on, takes
26
+ * nothing, and probes the paths the gated suites send to — the gated WS and
27
+ * readiness paths as `ws_role_gated` and `ready` run with them.
23
28
  * - `exclude_cases` names single tests of a suite that does run, each by its
24
29
  * name path (describe titles and test name, joined with `' > '`) with a
25
30
  * required reason; one `beforeEach` skips them at run time, so each shows as
26
31
  * skipped with its reason, and an entry matching no collected test of its
27
32
  * suite fails the closing check test.
33
+ * - `expected_skips` declares the gated skips the backend owes — the cases a
34
+ * suite skips because the backend lacks what they gate on (`test_if`), and
35
+ * the suites skipped for an undeclared backdoor — each by its name path with
36
+ * a required reason. When given, a closing test (`check_declared_skips`)
37
+ * fails on a gated skip it doesn't list and on an entry whose test runs or
38
+ * that names no test, so a skip is never only a skipped line in the report.
39
+ * An `exclude` entry declares its suite's skip itself.
28
40
  * - `overrides` replaces a suite's derived options, field by field (a shallow
29
41
  * merge over what the handle gives) — a role list the backend's WS upgrade
30
42
  * requires, an `xfail` for a tracked divergence, a narrower capability set.
@@ -53,7 +65,9 @@ import '../assert_dev_env.js';
53
65
  *
54
66
  * **Backdoors.** The backend's `capabilities.testing_backdoors` must declare
55
67
  * `SPINE_SUITES_REQUIRED_BACKDOORS` (the per-test reset and the audit
56
- * barrier), `_testing_put_fact` when it declares `fact_serving`, and
68
+ * barrier), `_testing_db_invariants` (the per-test invariant check) unless
69
+ * `setup.exclude_db_invariants` turns the check off with `all`,
70
+ * `_testing_put_fact` when it declares `fact_serving`, and
57
71
  * `_testing_room_evict` when it declares `rooms`; the call throws otherwise. A
58
72
  * suite every case of which drives another backdoor (`credential_conformance`,
59
73
  * `credential_deadline`, `origin_conformance`, `ws_outbound_overflow`) skips
@@ -83,6 +97,8 @@ import { describe_actor_lookup_cross_tests } from './actor_lookup.js';
83
97
  import { describe_app_settings_cross_tests } from './app_settings.js';
84
98
  import { describe_body_size_cross_tests } from './body_size.js';
85
99
  import { describe_body_size_smuggling_cross_tests } from './body_size_smuggling.js';
100
+ import { assert_declared_skip_reasons, check_declared_skips, test_skip_gated } from './declared_skips.js';
101
+ import { describe_capability_mounts_cross_tests, resolve_capability_mounts_target } from './capability_mounts.js';
86
102
  import { describe_cell_crud_cross_tests } from './cell_crud.js';
87
103
  import { describe_cell_gated_create_cross_tests } from './cell_gated_create.js';
88
104
  import { CELL_EDITOR_ROLE, CELL_ROLE_HOLDER_USERNAME, describe_cell_grant_role_cross_tests } from './cell_grant_role.js';
@@ -130,6 +146,7 @@ import { describe_ws_envelope_cross_tests } from './ws_envelope.js';
130
146
  import { describe_ws_outbound_overflow_cross_tests } from './ws_outbound_overflow.js';
131
147
  import { describe_ws_role_gated_cross_tests } from './ws_role_gated.js';
132
148
  import { describe_cross_process_ws_tests } from './ws_round_trip.js';
149
+ import { DB_INVARIANTS_EXCLUDE_ALL } from '../db_invariant_queries.js';
133
150
  /**
134
151
  * Every shipped suite `describe_spine_cross_suites` runs, each named by its
135
152
  * module under `testing/cross_backend/` (`ws_round_trip` is
@@ -143,6 +160,7 @@ export const SUITE_NAMES = [
143
160
  'app_settings',
144
161
  'body_size',
145
162
  'body_size_smuggling',
163
+ 'capability_mounts',
146
164
  'cell_crud',
147
165
  'cell_gated_create',
148
166
  'cell_grant_role',
@@ -209,6 +227,40 @@ export const SPINE_SUITES_REQUIRED_BACKDOORS = Object.freeze([
209
227
  '_testing_reset',
210
228
  '_testing_drain_effects'
211
229
  ]);
230
+ /**
231
+ * The suites `describe_spine_cross_suites` runs on every backend, each with
232
+ * why: each checks declarations the other suites gate on, so neither `exclude`
233
+ * nor `exclude_cases` can name it, and an override can't change the
234
+ * declaration it reads.
235
+ */
236
+ export const UNEXCLUDABLE_SPINE_SUITES = Object.freeze({
237
+ capability_mounts: 'it checks the capability flags the other suites gate on',
238
+ testing_backdoor: 'it checks the capabilities.testing_backdoors declaration the other suites gate on'
239
+ });
240
+ /**
241
+ * The override keys each unexcludable suite admits — an allowlist, so an
242
+ * option added to the suite later is refused until it is classified here.
243
+ * Any key passes with the value the handle derives; beyond that, `free` keys
244
+ * take any value, `droppable` ones `undefined` too (dropping the cases they
245
+ * turn on), and `fixed` ones nothing else (`capabilities` compared flag for
246
+ * flag, a list as a multiset). Everything a
247
+ * fixed key or an unlisted one could move is what the suite checks against.
248
+ */
249
+ const UNEXCLUDABLE_OVERRIDE_KEYS = {
250
+ // every option is where the probes send or what they hold it to
251
+ capability_mounts: {
252
+ free: [],
253
+ droppable: [],
254
+ fixed: ['capabilities', 'rpc_path', 'base_url', 'ws_path', 'sse_path']
255
+ },
256
+ // a consumer's own seams, and dropping the socket cases — never moving
257
+ // them, which would send them to an endpoint the declaration doesn't name
258
+ testing_backdoor: {
259
+ free: ['extra_methods'],
260
+ droppable: ['ws'],
261
+ fixed: ['capabilities', 'rpc_path']
262
+ }
263
+ };
212
264
  /**
213
265
  * The suite options a handle's `config` supplies — the fields most cross
214
266
  * suites take beside `setup_test`. For a suite called on its own:
@@ -220,6 +272,60 @@ export const to_cross_suite_options = (handle) => {
220
272
  const { capabilities, base_url, rpc_path, ws_path, sse_path, cookie_name } = handle.config;
221
273
  return { capabilities, base_url, rpc_path, ws_path, sse_path, cookie_name };
222
274
  };
275
+ const TRANSCRIPT_WEBSOCKET = {
276
+ excluded: {
277
+ kind: 'websocket',
278
+ reason: 'opens WebSockets, whose frames the transcript does not record'
279
+ }
280
+ };
281
+ const TRANSCRIPT_RAW_SOCKET = {
282
+ excluded: {
283
+ kind: 'raw_socket',
284
+ reason: 'sends on raw sockets, outside the fixture transports the transcript records'
285
+ }
286
+ };
287
+ const TRANSCRIPT_SSE = {
288
+ excluded: {
289
+ kind: 'sse',
290
+ reason: 'reads the audit event stream, which the transcript records unread'
291
+ }
292
+ };
293
+ /**
294
+ * The roles of `ws_required_roles` the keeper must be seeded with so its
295
+ * session can open a socket — the builtins it already holds left out.
296
+ */
297
+ const to_keeper_ws_roles = (c) => (c.options.ws_required_roles ?? []).filter((role) => role !== ROLE_KEEPER && role !== ROLE_ADMIN);
298
+ /**
299
+ * The path each mount probe reads from a sibling suite — the suite gated on
300
+ * the flag, whose option names where the surface is mounted.
301
+ */
302
+ const MOUNT_PROBE_SIBLING_PATHS = [
303
+ { flag: 'ws_role_gated', suite: 'ws_role_gated', option: 'gated_ws_path' },
304
+ { flag: 'ready', suite: 'ready', option: 'ready_path' }
305
+ ];
306
+ /**
307
+ * The suites whose `exclude` and `overrides` entries a suite reads beside its
308
+ * own — the mount suite reads each probe's sibling — so a registration
309
+ * running the reader without them still reads those entries.
310
+ */
311
+ const SIBLING_READS = {
312
+ capability_mounts: MOUNT_PROBE_SIBLING_PATHS.map(({ suite }) => suite)
313
+ };
314
+ /**
315
+ * A note for each mount probe whose sibling suite the call excludes: the probe
316
+ * falls back to the spine default, and the remedy is the sibling's override.
317
+ */
318
+ const to_sibling_path_notes = (c) => {
319
+ const notes = {};
320
+ for (const { flag, suite, option } of MOUNT_PROBE_SIBLING_PATHS) {
321
+ if (c.options.exclude?.[suite] === undefined)
322
+ continue;
323
+ notes[flag] =
324
+ `'${suite}' is excluded, so this probe sends to the spine default; to probe the ` +
325
+ `backend's own path, un-exclude '${suite}' and set it there with \`overrides.${suite}.${option}\``;
326
+ }
327
+ return notes;
328
+ };
223
329
  /** The capability-gated RPC-path shape the cell suites and several others share. */
224
330
  const rpc_gated = (c, seed) => ({
225
331
  setup_test: c.setup(seed),
@@ -230,16 +336,19 @@ const SUITE_ENTRIES = {
230
336
  account_lifecycle: {
231
337
  derive: (c) => rpc_gated(c),
232
338
  describe: describe_account_lifecycle_cross_tests,
339
+ transcript: 'http',
233
340
  required: { setup_test: true, capabilities: true }
234
341
  },
235
342
  actor_lookup: {
236
343
  derive: (c) => ({ setup_test: c.setup(), rpc_path: c.config.rpc_path }),
237
344
  describe: describe_actor_lookup_cross_tests,
345
+ transcript: 'http',
238
346
  required: { setup_test: true }
239
347
  },
240
348
  app_settings: {
241
349
  derive: (c) => ({ setup_test: c.setup(), rpc_path: c.config.rpc_path }),
242
350
  describe: describe_app_settings_cross_tests,
351
+ transcript: 'http',
243
352
  required: { setup_test: true }
244
353
  },
245
354
  body_size: {
@@ -250,6 +359,7 @@ const SUITE_ENTRIES = {
250
359
  rpc_max_body_bytes: c.options.rpc_max_body_bytes
251
360
  }),
252
361
  describe: describe_body_size_cross_tests,
362
+ transcript: TRANSCRIPT_RAW_SOCKET,
253
363
  required: { setup_test: true, base_url: true }
254
364
  },
255
365
  body_size_smuggling: {
@@ -259,16 +369,44 @@ const SUITE_ENTRIES = {
259
369
  rpc_max_body_bytes: c.options.rpc_max_body_bytes
260
370
  }),
261
371
  describe: describe_body_size_smuggling_cross_tests,
372
+ transcript: TRANSCRIPT_RAW_SOCKET,
262
373
  required: { base_url: true }
263
374
  },
375
+ capability_mounts: {
376
+ // the keeper holds the upgrade's roles, so its session can open the
377
+ // socket the account-actions probe sends on; each path is the one the
378
+ // suites gated on its flag send to — the config's, and the gated WS and
379
+ // readiness paths of `ws_role_gated` and `ready` as they run (their
380
+ // defaults when excluded)
381
+ derive: (c) => ({
382
+ setup_test: c.setup({ extra_keeper_roles: to_keeper_ws_roles(c) }),
383
+ capabilities: c.config.capabilities,
384
+ ...resolve_capability_mounts_target({
385
+ base_url: c.config.base_url,
386
+ rpc_path: c.config.rpc_path,
387
+ ws_path: c.config.ws_path,
388
+ sse_path: c.config.sse_path,
389
+ gated_ws_path: c.options.exclude?.ws_role_gated === undefined
390
+ ? c.merged('ws_role_gated').gated_ws_path
391
+ : undefined,
392
+ ready_path: c.options.exclude?.ready === undefined ? c.merged('ready').ready_path : undefined
393
+ }),
394
+ path_notes: to_sibling_path_notes(c)
395
+ }),
396
+ describe: describe_capability_mounts_cross_tests,
397
+ transcript: TRANSCRIPT_WEBSOCKET,
398
+ required: { setup_test: true, capabilities: true, base_url: true }
399
+ },
264
400
  cell_crud: {
265
401
  derive: (c) => rpc_gated(c),
266
402
  describe: describe_cell_crud_cross_tests,
403
+ transcript: 'http',
267
404
  required: { setup_test: true, capabilities: true }
268
405
  },
269
406
  cell_gated_create: {
270
407
  derive: (c) => rpc_gated(c),
271
408
  describe: describe_cell_gated_create_cross_tests,
409
+ transcript: 'http',
272
410
  required: { setup_test: true, capabilities: true }
273
411
  },
274
412
  cell_grant_role: {
@@ -283,31 +421,37 @@ const SUITE_ENTRIES = {
283
421
  };
284
422
  },
285
423
  describe: describe_cell_grant_role_cross_tests,
424
+ transcript: 'http',
286
425
  required: { setup_test: true, capabilities: true }
287
426
  },
288
427
  cell_grant_steward: {
289
428
  derive: (c) => rpc_gated(c),
290
429
  describe: describe_cell_grant_steward_cross_tests,
430
+ transcript: 'http',
291
431
  required: { setup_test: true, capabilities: true }
292
432
  },
293
433
  cell_moderate: {
294
434
  derive: (c) => rpc_gated(c),
295
435
  describe: describe_cell_moderate_cross_tests,
436
+ transcript: 'http',
296
437
  required: { setup_test: true, capabilities: true }
297
438
  },
298
439
  cell_ref_admission: {
299
440
  derive: (c) => rpc_gated(c),
300
441
  describe: describe_cell_ref_admission_cross_tests,
442
+ transcript: 'http',
301
443
  required: { setup_test: true, capabilities: true }
302
444
  },
303
445
  cell_relations: {
304
446
  derive: (c) => rpc_gated(c),
305
447
  describe: describe_cell_relations_cross_tests,
448
+ transcript: 'http',
306
449
  required: { setup_test: true, capabilities: true }
307
450
  },
308
451
  cookie_attributes: {
309
452
  derive: (c) => ({ setup_test: c.setup(), cookie_name: c.config.cookie_name }),
310
453
  describe: describe_cookie_attributes_cross_tests,
454
+ transcript: 'http',
311
455
  required: { setup_test: true, cookie_name: true }
312
456
  },
313
457
  credential_deadline: {
@@ -321,6 +465,7 @@ const SUITE_ENTRIES = {
321
465
  ws_account_roles: c.options.ws_required_roles
322
466
  }),
323
467
  describe: describe_credential_deadline_cross_tests,
468
+ transcript: TRANSCRIPT_WEBSOCKET,
324
469
  required: { setup_test: true, capabilities: true, base_url: true, ws_path: true },
325
470
  backdoors: ['_testing_shorten_credential_expiry']
326
471
  },
@@ -333,6 +478,15 @@ const SUITE_ENTRIES = {
333
478
  rpc_path: c.config.rpc_path
334
479
  }),
335
480
  describe: describe_credential_conformance_cross_tests,
481
+ transcript: {
482
+ excluded: {
483
+ kind: 'embedded_secrets',
484
+ reason: "its header lines carry the backend's own credentials re-spelled inside strings — " +
485
+ 'signed under its cookie keys with a per-run expiry, percent-encoded, tampered — ' +
486
+ 'which no placeholder recognizes; every answer is a `_testing_credential_read` ' +
487
+ 'reading the suite already holds to the shared table'
488
+ }
489
+ },
336
490
  required: { setup_test: true, cookie_name: true, cookie_keys: true, daemon_token: true },
337
491
  backdoors: ['_testing_credential_read']
338
492
  },
@@ -352,6 +506,7 @@ const SUITE_ENTRIES = {
352
506
  ws_path: c.config.ws_path
353
507
  }),
354
508
  describe: describe_credential_conformance_wire_cross_tests,
509
+ transcript: TRANSCRIPT_RAW_SOCKET,
355
510
  required: {
356
511
  setup_test: true,
357
512
  capabilities: true,
@@ -367,6 +522,7 @@ const SUITE_ENTRIES = {
367
522
  rpc_path: c.config.rpc_path
368
523
  }),
369
524
  describe: describe_credential_header_robustness_cross_tests,
525
+ transcript: TRANSCRIPT_RAW_SOCKET,
370
526
  required: { base_url: true }
371
527
  },
372
528
  fact_serving: {
@@ -376,21 +532,25 @@ const SUITE_ENTRIES = {
376
532
  setup_test_multi_actor: c.setup({ extra_actors: ['second_persona'] })
377
533
  }),
378
534
  describe: describe_fact_serving_cross_tests,
535
+ transcript: 'http',
379
536
  required: { setup_test: true, capabilities: true }
380
537
  },
381
538
  identity_parity: {
382
539
  derive: (c) => ({ setup_test: c.setup() }),
383
540
  describe: describe_identity_parity_cross_tests,
541
+ transcript: 'http',
384
542
  required: { setup_test: true }
385
543
  },
386
544
  origin: {
387
545
  derive: (c) => ({ setup_test: c.setup(), rpc_path: c.config.rpc_path }),
388
546
  describe: describe_origin_cross_tests,
547
+ transcript: 'http',
389
548
  required: { setup_test: true }
390
549
  },
391
550
  origin_conformance: {
392
551
  derive: (c) => ({ setup_test: c.setup(), rpc_path: c.config.rpc_path }),
393
552
  describe: describe_origin_conformance_cross_tests,
553
+ transcript: 'http',
394
554
  required: { setup_test: true },
395
555
  backdoors: ['_testing_origin_check']
396
556
  },
@@ -401,6 +561,7 @@ const SUITE_ENTRIES = {
401
561
  base_url: c.config.base_url
402
562
  }),
403
563
  describe: describe_origin_scope_cross_tests,
564
+ transcript: TRANSCRIPT_RAW_SOCKET,
404
565
  required: { setup_test: true, capabilities: true }
405
566
  },
406
567
  peer_ping_ws: {
@@ -411,16 +572,19 @@ const SUITE_ENTRIES = {
411
572
  ws_path: c.config.ws_path
412
573
  }),
413
574
  describe: describe_peer_ping_ws_tests,
575
+ transcript: TRANSCRIPT_WEBSOCKET,
414
576
  required: { setup_test: true, capabilities: true, base_url: true, ws_path: true }
415
577
  },
416
578
  query_shape: {
417
579
  derive: (c) => rpc_gated(c),
418
580
  describe: describe_query_shape_cross_tests,
581
+ transcript: 'http',
419
582
  required: { setup_test: true, capabilities: true }
420
583
  },
421
584
  ready: {
422
585
  derive: (c) => ({ setup_test: c.setup(), capabilities: c.config.capabilities }),
423
586
  describe: describe_ready_cross_tests,
587
+ transcript: 'http',
424
588
  required: { setup_test: true, capabilities: true }
425
589
  },
426
590
  request_header_conformance_wire: {
@@ -436,6 +600,7 @@ const SUITE_ENTRIES = {
436
600
  ws_path: c.config.ws_path
437
601
  }),
438
602
  describe: describe_request_header_conformance_wire_cross_tests,
603
+ transcript: TRANSCRIPT_RAW_SOCKET,
439
604
  required: {
440
605
  setup_test: true,
441
606
  capabilities: true,
@@ -449,7 +614,7 @@ const SUITE_ENTRIES = {
449
614
  // (it already holds the builtin ones)
450
615
  derive: (c) => ({
451
616
  setup_test: c.setup({
452
- extra_keeper_roles: (c.options.ws_required_roles ?? []).filter((role) => role !== ROLE_KEEPER && role !== ROLE_ADMIN)
617
+ extra_keeper_roles: to_keeper_ws_roles(c)
453
618
  }),
454
619
  capabilities: c.config.capabilities,
455
620
  base_url: c.config.base_url,
@@ -458,6 +623,7 @@ const SUITE_ENTRIES = {
458
623
  sse_path: c.config.sse_path
459
624
  }),
460
625
  describe: describe_request_target_conformance_wire_cross_tests,
626
+ transcript: TRANSCRIPT_RAW_SOCKET,
461
627
  required: { setup_test: true, capabilities: true, base_url: true }
462
628
  },
463
629
  role_grant_offer_enumeration: {
@@ -471,6 +637,7 @@ const SUITE_ENTRIES = {
471
637
  rpc_path: c.config.rpc_path
472
638
  }),
473
639
  describe: describe_role_grant_offer_enumeration_cross_tests,
640
+ transcript: 'http',
474
641
  required: { setup_test: true }
475
642
  },
476
643
  role_grant_offer_lifecycle: {
@@ -480,6 +647,7 @@ const SUITE_ENTRIES = {
480
647
  role: c.options.suite_roles?.conferral
481
648
  }),
482
649
  describe: describe_role_grant_offer_lifecycle_cross_tests,
650
+ transcript: 'http',
483
651
  required: { setup_test: true }
484
652
  },
485
653
  role_grant_offer_notification_ws: {
@@ -492,6 +660,7 @@ const SUITE_ENTRIES = {
492
660
  scoped_role: c.options.suite_roles?.conferral
493
661
  }),
494
662
  describe: describe_role_grant_offer_notification_ws_tests,
663
+ transcript: TRANSCRIPT_WEBSOCKET,
495
664
  required: { setup_test: true, capabilities: true, base_url: true, ws_path: true }
496
665
  },
497
666
  role_grant_participation: {
@@ -501,11 +670,13 @@ const SUITE_ENTRIES = {
501
670
  role: c.options.suite_roles?.conferral
502
671
  }),
503
672
  describe: describe_role_grant_participation_cross_tests,
673
+ transcript: 'http',
504
674
  required: { setup_test: true }
505
675
  },
506
676
  role_grant_role_grammar: {
507
677
  derive: (c) => ({ setup_test: c.setup(), rpc_path: c.config.rpc_path }),
508
678
  describe: describe_role_grant_role_grammar_cross_tests,
679
+ transcript: 'http',
509
680
  required: { setup_test: true }
510
681
  },
511
682
  rooms_ws: {
@@ -517,6 +688,7 @@ const SUITE_ENTRIES = {
517
688
  rpc_path: c.config.rpc_path
518
689
  }),
519
690
  describe: describe_rooms_ws_cross_tests,
691
+ transcript: TRANSCRIPT_WEBSOCKET,
520
692
  required: { setup_test: true, capabilities: true, base_url: true, ws_path: true }
521
693
  },
522
694
  rpc_adversarial: {
@@ -529,6 +701,7 @@ const SUITE_ENTRIES = {
529
701
  input_overrides: c.options.rpc_input_overrides
530
702
  }),
531
703
  describe: describe_rpc_adversarial_cross_tests,
704
+ transcript: 'http',
532
705
  required: { setup_test: true, surface_source: true }
533
706
  },
534
707
  session_cap: {
@@ -540,6 +713,7 @@ const SUITE_ENTRIES = {
540
713
  ws_account_roles: c.options.ws_required_roles
541
714
  }),
542
715
  describe: describe_session_cap_cross_tests,
716
+ transcript: TRANSCRIPT_WEBSOCKET,
543
717
  required: { setup_test: true }
544
718
  },
545
719
  session_cookie_codec: {
@@ -550,11 +724,13 @@ const SUITE_ENTRIES = {
550
724
  rpc_path: c.config.rpc_path
551
725
  }),
552
726
  describe: describe_session_cookie_codec_cross_tests,
727
+ transcript: 'http',
553
728
  required: { setup_test: true, cookie_name: true, cookie_keys: true }
554
729
  },
555
730
  simple_request: {
556
731
  derive: (c) => ({ setup_test: c.setup(), rpc_path: c.config.rpc_path }),
557
732
  describe: describe_simple_request_cross_tests,
733
+ transcript: 'http',
558
734
  required: { setup_test: true }
559
735
  },
560
736
  sse_round_trip: {
@@ -563,9 +739,11 @@ const SUITE_ENTRIES = {
563
739
  capabilities: c.config.capabilities,
564
740
  base_url: c.config.base_url,
565
741
  sse_path: c.config.sse_path,
566
- rpc_path: c.config.rpc_path
742
+ rpc_path: c.config.rpc_path,
743
+ other_role: c.options.suite_roles?.conferral
567
744
  }),
568
745
  describe: describe_cross_process_sse_tests,
746
+ transcript: TRANSCRIPT_SSE,
569
747
  required: { setup_test: true, capabilities: true, base_url: true }
570
748
  },
571
749
  standard: {
@@ -587,6 +765,7 @@ const SUITE_ENTRIES = {
587
765
  rpc_max_body_bytes: c.options.rpc_max_body_bytes
588
766
  }),
589
767
  describe: describe_standard_cross_process_tests,
768
+ transcript: TRANSCRIPT_RAW_SOCKET,
590
769
  required: {
591
770
  setup_test: true,
592
771
  surface_source: true,
@@ -599,16 +778,19 @@ const SUITE_ENTRIES = {
599
778
  testing_backdoor: {
600
779
  derive: (c) => ({ ...rpc_gated(c), ws: c.ws }),
601
780
  describe: describe_testing_backdoor_cross_tests,
781
+ transcript: TRANSCRIPT_WEBSOCKET,
602
782
  required: { setup_test: true, capabilities: true }
603
783
  },
604
784
  token_lifetime: {
605
785
  derive: (c) => ({ setup_test: c.setup(), rpc_path: c.config.rpc_path }),
606
786
  describe: describe_token_lifetime_cross_tests,
787
+ transcript: 'http',
607
788
  required: { setup_test: true }
608
789
  },
609
790
  token_scope_surface: {
610
791
  derive: (c) => ({ ...rpc_gated(c), sse_path: c.config.sse_path }),
611
792
  describe: describe_token_scope_surface_cross_tests,
793
+ transcript: 'http',
612
794
  required: { setup_test: true, capabilities: true }
613
795
  },
614
796
  transport_composition: {
@@ -621,6 +803,7 @@ const SUITE_ENTRIES = {
621
803
  rpc_max_body_bytes: c.options.rpc_max_body_bytes
622
804
  }),
623
805
  describe: describe_transport_composition_cross_tests,
806
+ transcript: TRANSCRIPT_RAW_SOCKET,
624
807
  required: { setup_test: true, capabilities: true, base_url: true }
625
808
  },
626
809
  ws_connection_cap: {
@@ -631,6 +814,7 @@ const SUITE_ENTRIES = {
631
814
  ws_path: c.config.ws_path
632
815
  }),
633
816
  describe: describe_ws_connection_cap_cross_tests,
817
+ transcript: TRANSCRIPT_WEBSOCKET,
634
818
  required: { setup_test: true, capabilities: true, base_url: true, ws_path: true }
635
819
  },
636
820
  ws_envelope: {
@@ -641,6 +825,7 @@ const SUITE_ENTRIES = {
641
825
  ws_path: c.config.ws_path
642
826
  }),
643
827
  describe: describe_ws_envelope_cross_tests,
828
+ transcript: TRANSCRIPT_WEBSOCKET,
644
829
  required: { setup_test: true, capabilities: true, base_url: true, ws_path: true }
645
830
  },
646
831
  ws_inbound_dispatch: {
@@ -651,6 +836,7 @@ const SUITE_ENTRIES = {
651
836
  ws_path: c.config.ws_path
652
837
  }),
653
838
  describe: describe_ws_inbound_dispatch_cross_tests,
839
+ transcript: TRANSCRIPT_WEBSOCKET,
654
840
  required: { setup_test: true, capabilities: true, base_url: true, ws_path: true }
655
841
  },
656
842
  ws_outbound_overflow: {
@@ -662,6 +848,7 @@ const SUITE_ENTRIES = {
662
848
  rpc_path: c.config.rpc_path
663
849
  }),
664
850
  describe: describe_ws_outbound_overflow_cross_tests,
851
+ transcript: TRANSCRIPT_WEBSOCKET,
665
852
  required: { setup_test: true, capabilities: true, base_url: true, ws_path: true },
666
853
  backdoors: ['_testing_flood_notifications']
667
854
  },
@@ -678,6 +865,7 @@ const SUITE_ENTRIES = {
678
865
  scoped_role: SPINE_PARTICIPANT_ROLE
679
866
  }),
680
867
  describe: describe_ws_role_gated_cross_tests,
868
+ transcript: TRANSCRIPT_WEBSOCKET,
681
869
  required: {
682
870
  setup_test: true,
683
871
  capabilities: true,
@@ -699,16 +887,27 @@ const SUITE_ENTRIES = {
699
887
  max_message_bytes: c.options.ws_max_message_bytes
700
888
  }),
701
889
  describe: describe_cross_process_ws_tests,
890
+ transcript: TRANSCRIPT_WEBSOCKET,
702
891
  required: { setup_test: true, capabilities: true, base_url: true, ws_path: true }
703
892
  }
704
893
  };
705
- /** Concatenate a suite's seeding onto the base setup options. */
894
+ /** Merge two setups' invariant exclusions by name, to `all` alone when either excludes `all`. */
895
+ const merge_db_invariant_exclusions = (base, seed) => {
896
+ const all = base?.[DB_INVARIANTS_EXCLUDE_ALL] ?? seed?.[DB_INVARIANTS_EXCLUDE_ALL];
897
+ return all !== undefined ? { [DB_INVARIANTS_EXCLUDE_ALL]: all } : { ...base, ...seed };
898
+ };
899
+ /**
900
+ * Concatenate a suite's seeding onto the base setup options, and merge their
901
+ * database invariant exclusions by name — to `all` alone when either side
902
+ * excludes `all`, which a named entry beside it would make redundant.
903
+ */
706
904
  const merge_setup_options = (base, seed) => ({
707
905
  ...base,
708
906
  ...seed,
709
907
  extra_keeper_roles: [...(base?.extra_keeper_roles ?? []), ...(seed?.extra_keeper_roles ?? [])],
710
908
  extra_accounts: [...(base?.extra_accounts ?? []), ...(seed?.extra_accounts ?? [])],
711
- extra_actors: [...(base?.extra_actors ?? []), ...(seed?.extra_actors ?? [])]
909
+ extra_actors: [...(base?.extra_actors ?? []), ...(seed?.extra_actors ?? [])],
910
+ exclude_db_invariants: merge_db_invariant_exclusions(base?.exclude_db_invariants, seed?.exclude_db_invariants)
712
911
  });
713
912
  /**
714
913
  * The backdoors every case of `name` drives beyond
@@ -720,14 +919,25 @@ const merge_setup_options = (base, seed) => ({
720
919
  * @internal
721
920
  */
722
921
  export const get_spine_suite_backdoors = (name) => SUITE_ENTRIES[name].backdoors ?? [];
922
+ /**
923
+ * Whether fuz_app's transcript differential runs `name` — the transcript's
924
+ * suite list is the `'http'` ones.
925
+ *
926
+ * @param name - the suite
927
+ * @returns its `SuiteEntry.transcript`
928
+ * @internal Read by fuz_app's transcript differential — not stable API.
929
+ */
930
+ export const get_spine_suite_transcript = (name) => SUITE_ENTRIES[name].transcript;
723
931
  const is_suite_name = (name) => SUITE_NAMES.includes(name);
724
932
  /**
725
933
  * Each suite whose backdoors `declared` lacks, with the generated reason it is
726
- * skipped — the suites whose every case drives a backdoor (`SuiteEntry.backdoors`).
934
+ * skipped — the suites of `run` whose every case drives a backdoor (`SuiteEntry.backdoors`).
727
935
  */
728
- const to_backdoor_skips = (declared) => {
936
+ const to_backdoor_skips = (declared, run) => {
729
937
  const skips = new Map();
730
938
  for (const name of SUITE_NAMES) {
939
+ if (!run.has(name))
940
+ continue;
731
941
  const missing = get_spine_suite_backdoors(name).filter((m) => !declared.includes(m));
732
942
  if (missing.length > 0) {
733
943
  skips.set(name, `needs ${missing.map((m) => `\`${m}\``).join(', ')}, which capabilities.testing_backdoors doesn't declare`);
@@ -739,11 +949,29 @@ const to_backdoor_skips = (declared) => {
739
949
  * Refuse an exclude with an empty reason, an unknown suite name, a suite both
740
950
  * excluded and overridden, a backend missing a backdoor the suites share, an
741
951
  * exclude or override of a suite that skips itself for an undeclared
742
- * backdoor, any exclusion of `testing_backdoor`, and an `exclude_cases` entry
952
+ * backdoor, any exclusion of an `UNEXCLUDABLE_SPINE_SUITES` suite, and an `exclude_cases` entry
743
953
  * naming a suite the call doesn't run or carrying no reason — before anything
744
954
  * is registered.
745
955
  */
746
- const validate_spine_cross_suites_options = (options, declared, backdoor_skips, capabilities) => {
956
+ const validate_spine_cross_suites_options = (options, declared, backdoor_skips, capabilities, run) => {
957
+ // an entry for a suite the registration neither runs nor reads beside one it
958
+ // runs (`SIBLING_READS`) would be ignored silently; a case exclusion is read
959
+ // only by its own suite
960
+ const read = new Set(run);
961
+ for (const name of run)
962
+ for (const sibling of SIBLING_READS[name] ?? [])
963
+ read.add(sibling);
964
+ for (const [field, names, live] of [
965
+ ['exclude', Object.keys(options.exclude ?? {}), read],
966
+ ['overrides', Object.keys(options.overrides ?? {}), read],
967
+ ['exclude_cases', Object.keys(options.exclude_cases ?? {}), run]
968
+ ]) {
969
+ for (const name of names) {
970
+ if (is_suite_name(name) && !live.has(name)) {
971
+ throw new Error(`describe_spine_cross_suites: ${field} names '${name}', which the registration doesn't run`);
972
+ }
973
+ }
974
+ }
747
975
  if (options.rpc_input_overrides?.size) {
748
976
  // a key the round-trip (the declared surface) and `rpc_adversarial` (that
749
977
  // and the live mount) both lack would be ignored silently — a typo
@@ -776,9 +1004,9 @@ const validate_spine_cross_suites_options = (options, declared, backdoor_skips,
776
1004
  if (options.overrides?.[name] !== undefined) {
777
1005
  throw new Error(`describe_spine_cross_suites: '${name}' is both excluded and overridden`);
778
1006
  }
779
- if (name === 'testing_backdoor') {
780
- throw new Error("describe_spine_cross_suites: 'testing_backdoor' can't be excluded — it checks the " +
781
- 'capabilities.testing_backdoors declaration the other suites gate on');
1007
+ const unexcludable = UNEXCLUDABLE_SPINE_SUITES[name];
1008
+ if (unexcludable !== undefined) {
1009
+ throw new Error(`describe_spine_cross_suites: '${name}' can't be excluded — ${unexcludable}`);
782
1010
  }
783
1011
  const skip = backdoor_skips.get(name);
784
1012
  if (skip !== undefined) {
@@ -794,6 +1022,9 @@ const validate_spine_cross_suites_options = (options, declared, backdoor_skips,
794
1022
  throw new Error(`describe_spine_cross_suites: overrides names '${name}', which skips itself (${skip})`);
795
1023
  }
796
1024
  }
1025
+ if (options.expected_skips !== undefined) {
1026
+ assert_declared_skip_reasons(options.expected_skips, 'describe_spine_cross_suites: expected_skips');
1027
+ }
797
1028
  for (const [name, cases] of Object.entries(options.exclude_cases ?? {})) {
798
1029
  if (!is_suite_name(name)) {
799
1030
  throw new Error(`describe_spine_cross_suites: exclude_cases names unknown suite '${name}'`);
@@ -801,10 +1032,10 @@ const validate_spine_cross_suites_options = (options, declared, backdoor_skips,
801
1032
  if (options.exclude?.[name] !== undefined) {
802
1033
  throw new Error(`describe_spine_cross_suites: '${name}' is excluded, so its exclude_cases entries name nothing`);
803
1034
  }
804
- if (name === 'testing_backdoor') {
805
- throw new Error("describe_spine_cross_suites: exclude_cases can't name 'testing_backdoor' — it checks the " +
806
- 'capabilities.testing_backdoors declaration the other suites gate on, and a declared ' +
807
- 'backdoor failing its credential row is a bug, not a case to skip');
1035
+ const unexcludable = UNEXCLUDABLE_SPINE_SUITES[name];
1036
+ if (unexcludable !== undefined) {
1037
+ throw new Error(`describe_spine_cross_suites: exclude_cases can't name '${name}' — ${unexcludable}, ` +
1038
+ 'and a case of it failing is a wrong declaration or a bug, not a case to skip');
808
1039
  }
809
1040
  const skip = backdoor_skips.get(name);
810
1041
  if (skip !== undefined) {
@@ -825,6 +1056,12 @@ const validate_spine_cross_suites_options = (options, declared, backdoor_skips,
825
1056
  throw new Error(`describe_spine_cross_suites: capabilities.testing_backdoors must declare ${missing.join(', ')} ` +
826
1057
  '— every suite resets through _testing_reset and reads audit rows behind _testing_drain_effects');
827
1058
  }
1059
+ if (!declared.includes('_testing_db_invariants') &&
1060
+ options.setup?.exclude_db_invariants?.[DB_INVARIANTS_EXCLUDE_ALL] === undefined) {
1061
+ throw new Error('describe_spine_cross_suites: capabilities.testing_backdoors must declare ' +
1062
+ '_testing_db_invariants — every setup checks the database invariants through it after ' +
1063
+ `each test — or turn the check off with setup: {exclude_db_invariants: {${DB_INVARIANTS_EXCLUDE_ALL}: '<reason>'}}`);
1064
+ }
828
1065
  if (capabilities.fact_serving && !declared.includes('_testing_put_fact')) {
829
1066
  throw new Error('describe_spine_cross_suites: capabilities.fact_serving needs _testing_put_fact in ' +
830
1067
  'capabilities.testing_backdoors — the fact suites seed through it');
@@ -834,30 +1071,127 @@ const validate_spine_cross_suites_options = (options, declared, backdoor_skips,
834
1071
  'capabilities.testing_backdoors — the rooms suite evicts through it');
835
1072
  }
836
1073
  };
837
- const run_suite = (name, context) => {
838
- const entry = SUITE_ENTRIES[name];
839
- const derived = entry.derive(context);
1074
+ /**
1075
+ * Whether two option values are the same: primitives by identity, lists as
1076
+ * multisets, objects key by key. Names the keys that differ, for an object.
1077
+ */
1078
+ const differing_keys = (a, b) => {
1079
+ if (a === b)
1080
+ return [];
1081
+ if (Array.isArray(a) && Array.isArray(b)) {
1082
+ const key = (list) => list
1083
+ .map((v) => JSON.stringify(v))
1084
+ .sort()
1085
+ .join(',');
1086
+ return key(a) === key(b) ? [] : null;
1087
+ }
1088
+ if (a !== null && b !== null && typeof a === 'object' && typeof b === 'object') {
1089
+ const keys = new Set([...Object.keys(a), ...Object.keys(b)]);
1090
+ return [...keys].filter((k) => differing_keys(a[k], b[k])
1091
+ ?.length !== 0);
1092
+ }
1093
+ return null;
1094
+ };
1095
+ /**
1096
+ * Hold an override of an unexcludable suite to its allowlist
1097
+ * (`UNEXCLUDABLE_OVERRIDE_KEYS`): any key with its derived value passes, a
1098
+ * free key with any value, a droppable key with `undefined`, and every other
1099
+ * change throws. Other suites pass unchecked.
1100
+ *
1101
+ * @param name - the suite
1102
+ * @param patch - the override's patch, as merged over `derived`
1103
+ * @param derived - the options the handle gives
1104
+ * @throws Error - naming the key, on a fixed key moved or a key not admitted
1105
+ * @internal Used by `describe_spine_cross_suites` and its tests — not stable API.
1106
+ */
1107
+ export const check_unexcludable_override = (name, patch, derived) => {
1108
+ if (!(name in UNEXCLUDABLE_OVERRIDE_KEYS) || patch === undefined)
1109
+ return;
1110
+ const keys = UNEXCLUDABLE_OVERRIDE_KEYS[name];
1111
+ const free = new Set(keys.free);
1112
+ const fixed = new Set(keys.fixed);
1113
+ const droppable = new Set(keys.droppable);
1114
+ const why = UNEXCLUDABLE_SPINE_SUITES[name];
1115
+ for (const [key, value] of Object.entries(patch)) {
1116
+ const derived_value = derived[key];
1117
+ // an unchanged value is no override, whatever the key
1118
+ if (differing_keys(value, derived_value)?.length === 0)
1119
+ continue;
1120
+ if (free.has(key))
1121
+ continue;
1122
+ if (droppable.has(key) && value === undefined)
1123
+ continue;
1124
+ if (!fixed.has(key) && !droppable.has(key)) {
1125
+ const admitted = [
1126
+ ...keys.free,
1127
+ ...keys.droppable.map((k) => `${k} (unchanged or undefined)`),
1128
+ ...keys.fixed.map((k) => `${k} (unchanged)`)
1129
+ ];
1130
+ throw new Error(`describe_spine_cross_suites: overrides can't set '${name}' ${key} — ${why}; ` +
1131
+ `it admits ${admitted.length > 0 ? admitted.join(', ') : 'nothing'}`);
1132
+ }
1133
+ const differs = differing_keys(value, derived_value);
1134
+ throw new Error(`describe_spine_cross_suites: overrides can't change '${name}' ${key}` +
1135
+ `${differs?.length ? ` (${differs.join(', ')})` : ''} — ${why}`);
1136
+ }
1137
+ };
1138
+ /**
1139
+ * Derive a suite's options and merge its override over them — the allowlist
1140
+ * of an unexcludable suite checked — with no required-option check (a
1141
+ * sibling's read of them needs none).
1142
+ */
1143
+ const merge_suite_options = (name, context) => {
1144
+ const derived = SUITE_ENTRIES[name].derive(context);
840
1145
  const override = context.options.overrides?.[name];
841
1146
  const patch = typeof override === 'function' ? override(derived) : override;
842
- const suite_options = { ...derived, ...patch };
1147
+ check_unexcludable_override(name, patch, derived);
1148
+ const merged = { ...derived, ...patch };
1149
+ return context.wrap_setup_test
1150
+ ? wrap_setup_slots(derived, merged, context.wrap_setup_test)
1151
+ : merged;
1152
+ };
1153
+ /**
1154
+ * Wrap every setup in `merged` at a slot where `derived` held one `setup`
1155
+ * returned — top-level (`setup_test`, `setup_test_multi_actor`) or one object
1156
+ * down (`multi_actor.setup_test`) — whether the derived setup is still there
1157
+ * or an override replaced it. Only an object directly holding a derived setup
1158
+ * is rebuilt; every other value passes through as the same instance (a `Map`,
1159
+ * a class instance, the declared surface). A setup an override adds at a key
1160
+ * the derive never filled, or deeper than one object level, isn't wrapped.
1161
+ */
1162
+ const wrap_setup_slots = (derived, merged, { wrap, derived_setups }, depth = 0) => {
1163
+ const is_derived_setup = (v) => typeof v === 'function' && derived_setups.has(v);
1164
+ const out = { ...merged };
1165
+ for (const [key, held] of Object.entries(derived)) {
1166
+ const value = out[key];
1167
+ if (is_derived_setup(held)) {
1168
+ if (typeof value === 'function')
1169
+ out[key] = wrap(value);
1170
+ }
1171
+ else if (depth === 0 &&
1172
+ held !== null &&
1173
+ typeof held === 'object' &&
1174
+ !Array.isArray(held) &&
1175
+ Object.values(held).some(is_derived_setup) &&
1176
+ value !== null &&
1177
+ typeof value === 'object' &&
1178
+ !Array.isArray(value)) {
1179
+ out[key] = wrap_setup_slots(held, value, { wrap, derived_setups }, depth + 1);
1180
+ }
1181
+ }
1182
+ return out;
1183
+ };
1184
+ const run_suite = (name, context) => {
1185
+ const entry = SUITE_ENTRIES[name];
1186
+ const suite_options = context.merged(name);
843
1187
  for (const field of Object.keys(entry.required)) {
844
1188
  const value = suite_options[field];
845
1189
  if (value === undefined || value === '') {
1190
+ const remedy = UNEXCLUDABLE_SPINE_SUITES[name] === undefined
1191
+ ? `pass \`overrides.${name}\` with it or exclude '${name}' with a reason`
1192
+ : `pass \`overrides.${name}\` with it`;
846
1193
  throw new Error(`describe_spine_cross_suites: '${name}' needs \`${field}\`, which neither the handle ` +
847
- `nor the override gives — pass \`overrides.${name}\` with it or exclude '${name}' with a reason`);
848
- }
849
- }
850
- // the backdoor suite checks the declaration the gating read, so an override
851
- // can't hand it another; it reads nothing else of `capabilities`, so a copy
852
- // keeping the list passes
853
- if (name === 'testing_backdoor') {
854
- const checked = suite_options.capabilities
855
- .testing_backdoors;
856
- const declared = context.config.capabilities.testing_backdoors;
857
- // the same entries, each as often, in any order
858
- if ([...checked].sort().join(' ') !== [...declared].sort().join(' ')) {
859
- throw new Error("describe_spine_cross_suites: overrides can't change 'testing_backdoor' " +
860
- 'capabilities.testing_backdoors — it checks the declaration the other suites gate on');
1194
+ `nor the override gives — ${remedy}`);
861
1195
  }
862
1196
  }
863
1197
  entry.describe(suite_options);
@@ -969,39 +1303,56 @@ export const register_spine_case_exclusions = (exclude_cases, ranges) => {
969
1303
  });
970
1304
  };
971
1305
  /**
972
- * Run every shipped single-backend cross suite against one spawned backend —
973
- * see the module doc for what the options add and what stays outside.
1306
+ * `describe_spine_cross_suites` over a chosen set of suites, each suite's
1307
+ * `setup_test` passed through a wrapper — so another runner over the suites
1308
+ * (fuz_app's transcript differential) builds every suite's options as the
1309
+ * one call does and can't drift from it.
974
1310
  *
975
1311
  * @param handle - the backend, as `inject_backend_handle()` returns it
976
- * @param options - the declared surface, plus excludes, case exclusions and overrides
977
- * @throws Error - on an exclude with no reason, an unknown suite name, a suite
978
- * both excluded and overridden, an excluded `testing_backdoor` (or one of
979
- * its cases, or an override changing its `capabilities.testing_backdoors`), an exclude,
980
- * override or `exclude_cases` entry for a suite that skips itself or isn't
981
- * run, a backend not declaring `SPINE_SUITES_REQUIRED_BACKDOORS` (or
982
- * `_testing_put_fact` with `fact_serving`, or `_testing_room_evict` with
983
- * `rooms`), or a suite missing an input the
984
- * handle doesn't carry
1312
+ * @param options - as `describe_spine_cross_suites` takes them
1313
+ * @param registration - the suites to register and the setup wrapper
1314
+ * @throws Error - as `describe_spine_cross_suites`, and on an empty, unknown
1315
+ * or repeated name, or an `exclude`, override or `exclude_cases` entry for a
1316
+ * suite the registration neither runs nor reads
1317
+ * @internal Used by `describe_spine_cross_suites` and fuz_app's transcript differential — not stable API.
985
1318
  */
986
- export const describe_spine_cross_suites = (handle, options) => {
1319
+ export const register_spine_suites = (handle, options, registration) => {
1320
+ const run = to_registered_names(registration.names);
987
1321
  const config = to_cross_suite_options(handle);
988
1322
  const declared = config.capabilities.testing_backdoors;
989
- const backdoor_skips = to_backdoor_skips(declared);
990
- validate_spine_cross_suites_options(options, declared, backdoor_skips, config.capabilities);
1323
+ const backdoor_skips = to_backdoor_skips(declared, run);
1324
+ validate_spine_cross_suites_options(options, declared, backdoor_skips, config.capabilities, run);
1325
+ const derived_setups = new WeakSet();
1326
+ const merged = new Map();
991
1327
  const context = {
992
1328
  handle,
993
1329
  config,
994
1330
  options,
995
- setup: (seed) => default_cross_process_setup(handle, merge_setup_options(options.setup, seed)),
996
- ws: config.capabilities.ws ? { base_url: config.base_url, ws_path: config.ws_path } : undefined
1331
+ setup: (seed) => {
1332
+ const setup_test = default_cross_process_setup(handle, merge_setup_options(options.setup, seed));
1333
+ derived_setups.add(setup_test);
1334
+ return setup_test;
1335
+ },
1336
+ wrap_setup_test: registration.wrap_setup_test === undefined
1337
+ ? null
1338
+ : { wrap: registration.wrap_setup_test, derived_setups },
1339
+ ws: config.capabilities.ws ? { base_url: config.base_url, ws_path: config.ws_path } : undefined,
1340
+ merged: (name) => {
1341
+ if (!merged.has(name))
1342
+ merged.set(name, merge_suite_options(name, context));
1343
+ return merged.get(name);
1344
+ }
997
1345
  };
998
1346
  // each suite's top-level tasks, by index, so the case exclusions know which
999
1347
  // suite a test belongs to
1000
1348
  const collector = TestRunner.getCurrentSuite();
1001
1349
  const ranges = [];
1002
- const skipped = Object.entries(options.exclude ?? {});
1350
+ // an exclude of a suite the registration only reads (`SIBLING_READS`) shows
1351
+ // no skip: the suite wasn't to run here anyway
1352
+ const excluded_run = Object.entries(options.exclude ?? {}).filter(([name]) => run.has(name));
1353
+ const skipped = [...excluded_run];
1003
1354
  for (const name of SUITE_NAMES) {
1004
- if (options.exclude?.[name] !== undefined)
1355
+ if (!run.has(name) || options.exclude?.[name] !== undefined)
1005
1356
  continue;
1006
1357
  const skip = backdoor_skips.get(name);
1007
1358
  if (skip !== undefined) {
@@ -1016,9 +1367,55 @@ export const describe_spine_cross_suites = (handle, options) => {
1016
1367
  register_spine_case_exclusions(options.exclude_cases, ranges);
1017
1368
  }
1018
1369
  if (skipped.length > 0) {
1019
- describe('spine cross suites excluded on this backend', () => {
1370
+ describe(SPINE_SUITES_SKIPPED_TITLE, () => {
1020
1371
  for (const [name, reason] of skipped)
1021
- test.skip(`${name}: ${reason}`, () => { });
1372
+ test_skip_gated(`${name}: ${reason}`, () => { });
1022
1373
  });
1023
1374
  }
1375
+ if (options.expected_skips !== undefined) {
1376
+ // an exclude is its suite's declaration; a backdoor skip is owed one
1377
+ const excluded = Object.fromEntries(excluded_run.map(([name, reason]) => [
1378
+ `${SPINE_SUITES_SKIPPED_TITLE} > ${name}: ${reason}`,
1379
+ reason
1380
+ ]));
1381
+ check_declared_skips({ ...excluded, ...options.expected_skips });
1382
+ }
1383
+ };
1384
+ /** The suites a registration runs, refusing an empty, unknown or repeated name. */
1385
+ const to_registered_names = (names) => {
1386
+ if (names === undefined)
1387
+ return new Set(SUITE_NAMES);
1388
+ if (names.length === 0)
1389
+ throw new Error('register_spine_suites: names is empty');
1390
+ const run = new Set();
1391
+ for (const name of names) {
1392
+ if (!is_suite_name(name)) {
1393
+ throw new Error(`register_spine_suites: names lists unknown suite '${name}'`);
1394
+ }
1395
+ if (run.has(name))
1396
+ throw new Error(`register_spine_suites: names lists '${name}' twice`);
1397
+ run.add(name);
1398
+ }
1399
+ return run;
1400
+ };
1401
+ /**
1402
+ * Run every shipped single-backend cross suite against one spawned backend —
1403
+ * see the module doc for what the options add and what stays outside.
1404
+ *
1405
+ * @param handle - the backend, as `inject_backend_handle()` returns it
1406
+ * @param options - the declared surface, plus excludes, case exclusions and overrides
1407
+ * @throws Error - on an exclude or `expected_skips` entry with no reason, an unknown suite name, a suite
1408
+ * both excluded and overridden, an excluded `UNEXCLUDABLE_SPINE_SUITES` suite
1409
+ * (or one of its cases, or an override changing the declaration it checks), an exclude,
1410
+ * override or `exclude_cases` entry for a suite that skips itself or isn't
1411
+ * run, a backend not declaring `SPINE_SUITES_REQUIRED_BACKDOORS` (or
1412
+ * `_testing_db_invariants` without `setup.exclude_db_invariants.all`, or
1413
+ * `_testing_put_fact` with `fact_serving`, or `_testing_room_evict` with
1414
+ * `rooms`), or a suite missing an input the
1415
+ * handle doesn't carry
1416
+ */
1417
+ export const describe_spine_cross_suites = (handle, options) => {
1418
+ register_spine_suites(handle, options, {});
1024
1419
  };
1420
+ /** The `describe` holding one skipped test per suite the call leaves out. */
1421
+ export const SPINE_SUITES_SKIPPED_TITLE = 'spine cross suites excluded on this backend';