@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
@@ -0,0 +1,132 @@
1
+ import '../assert_dev_env.js';
2
+ /**
3
+ * Gated skips, and the check that holds them to a declared list.
4
+ *
5
+ * A cross suite skips a case when the backend lacks what the case needs —
6
+ * `test_if(capabilities.X, ...)`, or a suite `describe_spine_cross_suites`
7
+ * leaves out. Each such skip is registered by `test_skip_gated`, which tags
8
+ * the test it registers (`TaskMeta.fuz_gated_skip`). The tag is set at
9
+ * registration, so a `-t` filter or an `.only`, which skip tests later, never
10
+ * changes which tests carry it.
11
+ *
12
+ * `check_declared_skips(expected)` registers a closing test that reads every
13
+ * test under the suite it is called in and holds the tagged ones to
14
+ * `expected`, a test name path (describe titles and test name below that
15
+ * suite, joined with `' > '`) to the reason it skips here: an undeclared
16
+ * skip fails, as does an entry whose test was registered to run (stale) or
17
+ * that names no test at all. A skip the backend didn't mean — a capability
18
+ * flipped by mistake, a suite gating on a new flag — then fails the run
19
+ * rather than passing as one more skipped test.
20
+ *
21
+ * @module
22
+ */
23
+ import { assert, test } from 'vitest';
24
+ /** The name of the test `check_declared_skips` registers. */
25
+ export const DECLARED_SKIPS_CHECK_NAME = 'every gated skip is declared';
26
+ /**
27
+ * Register `fn` as a skipped test, tagged as a gated skip — the skip a backend
28
+ * owes a declaration for (`check_declared_skips`). `test_if` registers its
29
+ * skipped cases through it.
30
+ *
31
+ * @param name - the test name
32
+ * @param fn - the test body, never run
33
+ */
34
+ export const test_skip_gated = (name, fn) => {
35
+ test.skip(name, { meta: { fuz_gated_skip: true } }, fn);
36
+ };
37
+ /**
38
+ * Whether `task` was registered by `test_skip_gated`.
39
+ *
40
+ * @param task - a collected task
41
+ */
42
+ export const is_gated_skip = (task) => task.meta?.fuz_gated_skip === true;
43
+ /**
44
+ * Hold the collected tests' gated skips to `expected` — the pure half of
45
+ * `check_declared_skips`.
46
+ *
47
+ * @param expected - test name path to the reason it skips
48
+ * @param tests - every collected test under the checked suite
49
+ * @returns one line per problem: an undeclared skip, a declared skip
50
+ * registered to run, or a declared path naming no test
51
+ */
52
+ export const find_declared_skip_problems = (expected, tests) => {
53
+ const gated = new Set();
54
+ const running = new Set();
55
+ for (const t of tests)
56
+ (t.gated_skip ? gated : running).add(t.path);
57
+ const problems = [];
58
+ for (const path of gated) {
59
+ if (!(path in expected))
60
+ problems.push(`undeclared skip: ${path}`);
61
+ }
62
+ for (const path of Object.keys(expected)) {
63
+ if (gated.has(path))
64
+ continue;
65
+ problems.push(running.has(path)
66
+ ? `declared skip registered to run (stale — remove its entry): ${path}`
67
+ : `declared skip names no collected test (a renamed or removed test, a path missing a describe title, or a test a nested check owns): ${path}`);
68
+ }
69
+ return problems;
70
+ };
71
+ /**
72
+ * Validate `expected`'s reasons.
73
+ *
74
+ * @param expected - test name path to the reason it skips
75
+ * @param label - who passed it, for the error
76
+ * @throws Error - naming every entry with an empty reason
77
+ */
78
+ export const assert_declared_skip_reasons = (expected, label) => {
79
+ const missing = Object.entries(expected)
80
+ .filter(([, reason]) => typeof reason !== 'string' || reason.trim() === '')
81
+ .map(([path]) => path);
82
+ if (missing.length > 0) {
83
+ throw new Error(`${label}: every declared skip needs a reason — ${missing.join('; ')}`);
84
+ }
85
+ };
86
+ /** Whether `suite` holds a check of its own — a direct test named `DECLARED_SKIPS_CHECK_NAME`. */
87
+ const has_own_check = (suite) => suite.type === 'suite' &&
88
+ suite.tasks.some((t) => t.type === 'test' && t.name === DECLARED_SKIPS_CHECK_NAME);
89
+ /**
90
+ * Every test under `task`, as name paths starting with `prefix` — the check
91
+ * itself left out, and nothing below a suite with a check of its own, which
92
+ * owns its subtree.
93
+ */
94
+ const collect_tests = (task, prefix, self, out) => {
95
+ if (task === self)
96
+ return;
97
+ const path = [...prefix, task.name];
98
+ if (task.type === 'suite') {
99
+ if (has_own_check(task))
100
+ return;
101
+ for (const child of task.tasks)
102
+ collect_tests(child, path, self, out);
103
+ }
104
+ else {
105
+ out.push({ path: path.join(' > '), gated_skip: is_gated_skip(task) });
106
+ }
107
+ };
108
+ /**
109
+ * Register a closing test that holds every gated skip under the current suite
110
+ * (the enclosing `describe`, or the file) to `expected` — see the module doc.
111
+ * A nested suite with a check of its own owns its subtree: this check
112
+ * neither collects nor needs declared what sits below it.
113
+ * The paths are read from the collected tree when the test runs, so tests
114
+ * registered after the call count, and a filtered run checks the same paths
115
+ * as a whole one.
116
+ *
117
+ * @param expected - test name path below the current suite to the reason it
118
+ * skips on this backend; `{}` when nothing may skip
119
+ * @throws Error - at collection, on an entry with no reason
120
+ */
121
+ export const check_declared_skips = (expected) => {
122
+ assert_declared_skip_reasons(expected, 'check_declared_skips');
123
+ test(DECLARED_SKIPS_CHECK_NAME, (ctx) => {
124
+ // a task at a file's top level has no `suite`, only its `file`
125
+ const root = ctx.task.suite ?? ctx.task.file;
126
+ assert.strictEqual(root.type, 'suite', 'check_declared_skips: no enclosing suite');
127
+ const tests = [];
128
+ for (const child of root.tasks)
129
+ collect_tests(child, [], ctx.task, tests);
130
+ assert.deepEqual(find_declared_skip_problems(expected, tests), [], 'gated skips');
131
+ });
132
+ };
@@ -3,7 +3,8 @@ import type { AppSurfaceSpec } from '../../http/surface.js';
3
3
  import type { SessionOptions } from '../../auth/session_cookie.js';
4
4
  import type { RpcEndpointsSuiteOption } from '../rpc_helpers.js';
5
5
  import type { ConformanceCase } from './conformance_case.js';
6
- import { type ConformancePrincipalConfig } from './conformance_table.js';
6
+ import type { ConformancePrincipalConfig } from './conformance_principal.js';
7
+ import { type DbStateProbe } from './db_state_diff.js';
7
8
  import type { SetupTest } from './setup.js';
8
9
  import type { WsEndpointTarget } from './ws_endpoint.js';
9
10
  /**
@@ -26,6 +27,13 @@ export interface DifferentialBackend {
26
27
  * suite throws at registration.
27
28
  */
28
29
  readonly ws?: WsEndpointTarget;
30
+ /**
31
+ * Reads the backend's database around each case, so the states the two
32
+ * backends are left in are compared too (module doc). Set on both or
33
+ * neither — set on one alone, the suite throws at registration. The suite
34
+ * closes it once its cases have run.
35
+ */
36
+ readonly db_state?: DbStateProbe;
29
37
  }
30
38
  /**
31
39
  * What a ledger entry matches: cases by name, or every case on a method —
@@ -65,7 +73,8 @@ export interface KnownDivergencePath {
65
73
  *
66
74
  * `what_differs` lists the normalized-response paths that differ
67
75
  * (`DifferentialDiff.path` — `status`, `headers.<name>`, `session_cookie`,
68
- * `body.error.data.reason`), each optionally with the value each side shows
76
+ * `body.error.data.reason`, and with `db_state` probes the database's,
77
+ * `db.audit_log[0].metadata.reason`), each optionally with the value each side shows
69
78
  * (`KnownDivergencePath`). A matched case may differ there and nowhere else.
70
79
  * An entry naming cases must still differ on each of them; one naming
71
80
  * methods, on at least one of its cases.
@@ -1 +1 @@
1
- {"version":3,"file":"differential.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/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AoD;IACpD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC5D,wEAAwE;IACxE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC7B;AAgBD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,6BAA6B,GACzC,OAAO,aAAa,CAAC,eAAe,CAAC,EACrC,QAAQ,aAAa,CAAC,eAAe,CAAC,KACpC,KAAK,CAAC,MAAM,CA0Bd,CAAC;AA6BF;;;;;;GAMG;AACH,eAAO,MAAM,uCAAuC,GACnD,SAAS,8BAA8B,KACrC,IA4HF,CAAC"}
@@ -27,6 +27,14 @@ import '../assert_dev_env.js';
27
27
  * letting a server choose would read as a `content-encoding` and `vary`
28
28
  * difference on every case.
29
29
  *
30
+ * With a `db_state` probe on both backends (`create_db_state_probe`), each
31
+ * case also compares what it left in the databases: each probe marks the
32
+ * audit sequence before the case's fixture and reads the normalized state
33
+ * after its answer (`normalize_db_state`), and the two states' differences
34
+ * join the answer's under `db.` (`diff_db_states`), so a write one backend
35
+ * makes and the other doesn't fails the case like an answer would. Both
36
+ * backends must then be on PostgreSQL the test process reaches.
37
+ *
30
38
  * A difference that is tracked and accepted goes in the **known-divergence
31
39
  * ledger** (`KnownDivergence`), matched by case names or by methods, naming
32
40
  * the paths that differ (`what_differs`), each optionally with the value each
@@ -47,9 +55,10 @@ import '../assert_dev_env.js';
47
55
  *
48
56
  * @module
49
57
  */
50
- import { assert, describe, test } from 'vitest';
58
+ import { afterAll, assert, describe, test } from 'vitest';
51
59
  import { is_ws_conformance_case, resolve_conformance_rpc_endpoints, send_conformance_case } from './conformance_table.js';
52
60
  import { diff_differential_responses, differential_path_covers, format_differential_diffs, normalize_differential_response } from './differential_normalize.js';
61
+ import { diff_db_states } from './db_state_diff.js';
53
62
  /**
54
63
  * Headers every HTTP request the differential sends carries, beneath the
55
64
  * principal's: `accept-encoding: identity`, so each backend answers
@@ -136,17 +145,29 @@ export const describe_differential_conformance_tests = (options) => {
136
145
  throw new Error(`differential: backend '${(a.ws ? b : a).name}' has no ws target while ` +
137
146
  `'${(a.ws ? a : b).name}' does — set ws on both backends or neither.`);
138
147
  }
148
+ if ((a.db_state === undefined) !== (b.db_state === undefined)) {
149
+ throw new Error(`differential: backend '${(a.db_state ? b : a).name}' has no db_state probe while ` +
150
+ `'${(a.db_state ? a : b).name}' does — set db_state on both backends or neither.`);
151
+ }
139
152
  const over_ws = a.ws !== undefined;
140
153
  const cases = over_ws ? options.cases.filter(is_ws_conformance_case) : options.cases;
141
- const send = async (backend, c) => normalize_differential_response(await send_conformance_case(c, {
142
- fixture: await backend.setup_test(),
143
- surface_source,
144
- ...(principals && { principals }),
145
- resolved_rpc_endpoints,
146
- request_headers: DIFFERENTIAL_REQUEST_HEADERS,
147
- ...(backend.ws && { ws: backend.ws })
148
- }), options.session_options.cookie_name);
154
+ const send = async (backend, c) => {
155
+ const mark = backend.db_state ? await backend.db_state.mark() : null;
156
+ const response = normalize_differential_response(await send_conformance_case(c, {
157
+ fixture: await backend.setup_test(),
158
+ surface_source,
159
+ ...(principals && { principals }),
160
+ resolved_rpc_endpoints,
161
+ request_headers: DIFFERENTIAL_REQUEST_HEADERS,
162
+ ...(backend.ws && { ws: backend.ws })
163
+ }), options.session_options.cookie_name);
164
+ const db_state = backend.db_state && mark ? await backend.db_state.read(mark) : null;
165
+ return { response, db_state };
166
+ };
149
167
  describe(options.suite_name ?? 'differential conformance', () => {
168
+ afterAll(async () => {
169
+ await Promise.all([a.db_state?.close(), b.db_state?.close()]);
170
+ });
150
171
  // per entry: the cases it matched, the ones that ran to a diff, and
151
172
  // whether any of them showed it
152
173
  const matched = new Map();
@@ -163,8 +184,11 @@ export const describe_differential_conformance_tests = (options) => {
163
184
  ? `${c.name} [known: ${known.map((d) => d.tracking_id).join(', ')}]`
164
185
  : c.name;
165
186
  test(label, async () => {
166
- const [response_a, response_b] = await Promise.all([send(a, c), send(b, c)]);
167
- const diffs = diff_differential_responses(response_a, response_b);
187
+ const [sent_a, sent_b] = await Promise.all([send(a, c), send(b, c)]);
188
+ const diffs = diff_differential_responses(sent_a.response, sent_b.response);
189
+ if (sent_a.db_state && sent_b.db_state) {
190
+ diffs.push(...diff_db_states(sent_a.db_state, sent_b.db_state));
191
+ }
168
192
  for (const d of known) {
169
193
  const names = ran.get(d) ?? new Set();
170
194
  names.add(c.name);
@@ -134,6 +134,18 @@ export interface DifferentialDiff {
134
134
  readonly a: unknown;
135
135
  readonly b: unknown;
136
136
  }
137
+ /**
138
+ * Every place two JSON values differ, one entry per leaf path under `path`,
139
+ * by the rules `DifferentialDiff` describes — what
140
+ * `diff_differential_responses` runs over two bodies, for comparing any other
141
+ * normalized value the same way.
142
+ *
143
+ * @param path - the root path the entries are named under
144
+ * @param a - one side's value
145
+ * @param b - the other's
146
+ * @returns the differences, empty when the values are equal
147
+ */
148
+ export declare const diff_differential_values: (path: string, a: unknown, b: unknown) => Array<DifferentialDiff>;
137
149
  /**
138
150
  * Every place two normalized responses differ, in a stable order: status,
139
151
  * then header names, then the session cookie's effect, then the body
@@ -1 +1 @@
1
- {"version":3,"file":"differential_normalize.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/differential_normalize.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAEN,KAAK,mBAAmB,EACxB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC,mBAAmB;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,mEAAmE;IACnE,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,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B,GACrC,OAAO,aAAa,CAAC,gBAAgB,CAAC,EACtC,QAAQ;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,KAChD,MAOU,CAAC"}
1
+ {"version":3,"file":"differential_normalize.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/differential_normalize.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAEN,KAAK,mBAAmB,EACxB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC,mBAAmB;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,mEAAmE;IACnE,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,mBAAmB,GAAG,cAAc,CAAC;CAC9D;AAED,gEAAgE;AAChE,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,yCAAyC;IACzC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACvB;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAMvD,CAAC;AAEF,4EAA4E;AAC5E,MAAM,WAAW,oBAAoB;IACpC,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,aAAa,CAAC,oBAAoB,CAUvE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,GAC3C,UAAU,uBAAuB,EACjC,qBAAqB,MAAM,KACzB,oBA4CF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;CACpB;AA6BD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GACpC,MAAM,MAAM,EACZ,GAAG,OAAO,EACV,GAAG,OAAO,KACR,KAAK,CAAC,gBAAgB,CAIxB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,GACvC,GAAG,oBAAoB,EACvB,GAAG,oBAAoB,KACrB,KAAK,CAAC,gBAAgB,CAexB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,KAAG,OAEoB,CAAC;AAE9F;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACrC,OAAO,aAAa,CAAC,gBAAgB,CAAC,EACtC,QAAQ;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,KAChD,MAOU,CAAC"}
@@ -110,6 +110,22 @@ const diff_values = (path, a, b, out) => {
110
110
  if (!Object.is(a, b))
111
111
  out.push({ path, a, b });
112
112
  };
113
+ /**
114
+ * Every place two JSON values differ, one entry per leaf path under `path`,
115
+ * by the rules `DifferentialDiff` describes — what
116
+ * `diff_differential_responses` runs over two bodies, for comparing any other
117
+ * normalized value the same way.
118
+ *
119
+ * @param path - the root path the entries are named under
120
+ * @param a - one side's value
121
+ * @param b - the other's
122
+ * @returns the differences, empty when the values are equal
123
+ */
124
+ export const diff_differential_values = (path, a, b) => {
125
+ const out = [];
126
+ diff_values(path, a, b, out);
127
+ return out;
128
+ };
113
129
  /**
114
130
  * Every place two normalized responses differ, in a stable order: status,
115
131
  * then header names, then the session cookie's effect, then the body
@@ -4,7 +4,8 @@ import type { AppSurfaceSpec } from '../../http/surface.js';
4
4
  import type { BootstrapServerOptions } from '../../server/app_server.js';
5
5
  import type { AppServerContext } from '../../server/app_server_context.js';
6
6
  import type { SessionOptions } from '../../auth/session_cookie.js';
7
- import { type CreateTestAppOptions, type SuiteAppOptions } from '../app_server.js';
7
+ import { type CreateTestAppOptions, type SuiteAppOptions } from '../test_app.js';
8
+ import { type DbInvariantExclusions } from '../db_invariant_queries.js';
8
9
  import { type RpcEndpointsSuiteOption } from '../rpc_helpers.js';
9
10
  import { type BackendCapabilities } from './capabilities.js';
10
11
  import { type SetupTest, type ExtraAccountSpec } from './setup.js';
@@ -49,9 +50,17 @@ export interface InProcessSetupOptions extends CreateTestAppOptions {
49
50
  * `_testing_reset` cradle so suite bodies read
50
51
  * `fixture.extra_accounts[username]` uniformly regardless of transport.
51
52
  *
53
+ * The keeper holds `options.roles`, or `create_test_app`'s default when
54
+ * omitted (`DEFAULT_TEST_KEEPER_ROLES` — keeper and admin, as a production
55
+ * bootstrap and the cross-process reset seed it). The database invariant
56
+ * check is the test app's: registered when the fixture is built inside a
57
+ * test, less `options.exclude_db_invariants`, and run on demand by
58
+ * `fixture.assert_db_invariants`. The exclusions are validated here, before
59
+ * any test runs.
60
+ *
52
61
  * The describe-level `auth_integration_truncate_tables` / WASM database
53
- * cache lifecycle stays in `create_default_db_factory` / `create_describe_db`
54
- * (`testing/db.ts`) — `default_in_process_setup` doesn't manage db state
62
+ * cache lifecycle stays in `create_default_db_factory` (`testing/db.ts`) /
63
+ * `create_describe_db` (`testing/describe_db.ts`) — `default_in_process_setup` doesn't manage db state
55
64
  * beyond what `create_test_app` already does.
56
65
  */
57
66
  export declare const default_in_process_setup: (options: InProcessSetupOptions) => SetupTest;
@@ -75,14 +84,10 @@ export interface DefaultInProcessSuiteOptions {
75
84
  app_options?: SuiteAppOptions;
76
85
  /**
77
86
  * Additional roles to grant the bootstrapped keeper alongside
78
- * `ROLE_KEEPER` — additive, never replaces. The keeper account
79
- * always holds `ROLE_KEEPER` (otherwise daemon-token auth breaks);
80
- * pass extras here for suites that need additional role coverage.
81
- *
82
- * Admin-suite consumers pass `[ROLE_ADMIN]` so the default keeper
83
- * can hit admin-gated RPC methods.
84
- * `describe_standard_admin_integration_tests` and
85
- * `describe_audit_completeness_tests` need this.
87
+ * `DEFAULT_TEST_KEEPER_ROLES` (`ROLE_KEEPER` and `ROLE_ADMIN`, what a
88
+ * production bootstrap grants) — additive, never replaces. Pass extras
89
+ * here for suites that need additional role coverage; listing
90
+ * `ROLE_ADMIN` again is harmless.
86
91
  */
87
92
  extra_keeper_roles?: Array<string>;
88
93
  /**
@@ -103,6 +108,11 @@ export interface DefaultInProcessSuiteOptions {
103
108
  * `CrossProcessSetupOptions.reject_unknown_audit_metadata_keys`.
104
109
  */
105
110
  reject_unknown_audit_metadata_keys?: boolean;
111
+ /**
112
+ * Database invariants left unchecked after each test, each with its reason
113
+ * — see `CrossProcessSetupOptions.exclude_db_invariants`.
114
+ */
115
+ exclude_db_invariants?: DbInvariantExclusions;
106
116
  /**
107
117
  * Pre-built `AppSurfaceSpec` — overrides the default which calls
108
118
  * `create_test_app_surface_spec` against the same factory inputs.
@@ -133,7 +143,7 @@ export interface DefaultInProcessSuiteOptions {
133
143
  * describe_standard_admin_integration_tests({
134
144
  * ...default_in_process_suite_options({
135
145
  * session_options, create_route_specs, rpc_endpoints,
136
- * extra_keeper_roles: [ROLE_ADMIN],
146
+ * extra_keeper_roles: [MY_APP_ROLE],
137
147
  * }),
138
148
  * roles,
139
149
  * });
@@ -1 +1 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K,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;;;;;;;;;;OAUG;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;;;;;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,eAAe,EAAE,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACtC,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;CAqClC,CAAC"}
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,sBAAs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