@fuzdev/fuz_app 0.184.0 → 0.186.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/dist/actions/CLAUDE.md +18 -3
  2. package/dist/actions/perform_action.d.ts.map +1 -1
  3. package/dist/actions/perform_action.js +36 -5
  4. package/dist/actions/register_action_ws.d.ts +14 -7
  5. package/dist/actions/register_action_ws.d.ts.map +1 -1
  6. package/dist/actions/ws_socket_session.d.ts +17 -4
  7. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  8. package/dist/actions/ws_socket_session.js +41 -7
  9. package/dist/auth/CLAUDE.md +18 -9
  10. package/dist/auth/account_queries.d.ts +53 -40
  11. package/dist/auth/account_queries.d.ts.map +1 -1
  12. package/dist/auth/account_queries.js +57 -50
  13. package/dist/auth/account_routes.d.ts.map +1 -1
  14. package/dist/auth/account_routes.js +59 -25
  15. package/dist/auth/admin_actions.d.ts.map +1 -1
  16. package/dist/auth/admin_actions.js +26 -9
  17. package/dist/auth/audit_emitter.js +2 -2
  18. package/dist/auth/audit_log_queries.d.ts +11 -3
  19. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  20. package/dist/auth/audit_log_queries.js +4 -4
  21. package/dist/auth/audit_log_routes.d.ts +1 -1
  22. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  23. package/dist/auth/audit_log_routes.js +3 -2
  24. package/dist/auth/audit_log_schema.js +1 -1
  25. package/dist/auth/auth_ddl.d.ts.map +1 -1
  26. package/dist/auth/auth_ddl.js +4 -0
  27. package/dist/auth/cleanup.d.ts +34 -3
  28. package/dist/auth/cleanup.d.ts.map +1 -1
  29. package/dist/auth/cleanup.js +12 -4
  30. package/dist/auth/migrations.d.ts.map +1 -1
  31. package/dist/auth/migrations.js +35 -0
  32. package/dist/auth/role_grant_offer_queries.d.ts +13 -13
  33. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  34. package/dist/auth/role_grant_offer_queries.js +12 -13
  35. package/dist/auth/role_grant_queries.d.ts +16 -9
  36. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  37. package/dist/auth/role_grant_queries.js +16 -9
  38. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  39. package/dist/auth/self_service_role_actions.js +15 -0
  40. package/dist/auth/session_queries.d.ts +24 -0
  41. package/dist/auth/session_queries.d.ts.map +1 -1
  42. package/dist/auth/session_queries.js +28 -0
  43. package/dist/db/CLAUDE.md +3 -3
  44. package/dist/db/cell_ddl.d.ts +8 -3
  45. package/dist/db/cell_ddl.d.ts.map +1 -1
  46. package/dist/db/cell_ddl.js +10 -5
  47. package/dist/http/CLAUDE.md +1 -1
  48. package/dist/http/body_limit.d.ts +4 -4
  49. package/dist/http/body_limit.js +4 -4
  50. package/dist/http/pending_effects.d.ts +8 -4
  51. package/dist/http/pending_effects.d.ts.map +1 -1
  52. package/dist/http/route_spec.d.ts +3 -3
  53. package/dist/http/route_spec.d.ts.map +1 -1
  54. package/dist/realtime/audit_log_sse.d.ts +1 -1
  55. package/dist/realtime/sse.d.ts +2 -2
  56. package/dist/realtime/sse.d.ts.map +1 -1
  57. package/dist/realtime/sse_constants.d.ts +1 -1
  58. package/dist/realtime/sse_constants.js +1 -1
  59. package/dist/server/app_server.d.ts +59 -71
  60. package/dist/server/app_server.d.ts.map +1 -1
  61. package/dist/server/app_server.js +52 -60
  62. package/dist/server/shutdown_drain.d.ts +69 -0
  63. package/dist/server/shutdown_drain.d.ts.map +1 -0
  64. package/dist/server/shutdown_drain.js +77 -0
  65. package/dist/testing/CLAUDE.md +197 -66
  66. package/dist/testing/admin_integration.d.ts +2 -2
  67. package/dist/testing/admin_integration.d.ts.map +1 -1
  68. package/dist/testing/admin_integration.js +36 -20
  69. package/dist/testing/app_server.d.ts +5 -7
  70. package/dist/testing/app_server.d.ts.map +1 -1
  71. package/dist/testing/app_server.js +5 -7
  72. package/dist/testing/auth_apps.d.ts +3 -1
  73. package/dist/testing/auth_apps.d.ts.map +1 -1
  74. package/dist/testing/auth_apps.js +22 -5
  75. package/dist/testing/cross_backend/backend_config.d.ts +8 -0
  76. package/dist/testing/cross_backend/backend_config.d.ts.map +1 -1
  77. package/dist/testing/cross_backend/backend_log.d.ts +71 -0
  78. package/dist/testing/cross_backend/backend_log.d.ts.map +1 -0
  79. package/dist/testing/cross_backend/backend_log.js +134 -0
  80. package/dist/testing/cross_backend/backend_swap.d.ts +41 -0
  81. package/dist/testing/cross_backend/backend_swap.d.ts.map +1 -0
  82. package/dist/testing/cross_backend/backend_swap.js +431 -0
  83. package/dist/testing/cross_backend/body_size_smuggling.js +3 -3
  84. package/dist/testing/cross_backend/bootstrap_backend.d.ts +3 -1
  85. package/dist/testing/cross_backend/bootstrap_backend.d.ts.map +1 -1
  86. package/dist/testing/cross_backend/bootstrap_backend.js +9 -5
  87. package/dist/testing/cross_backend/conformance_case.d.ts +11 -6
  88. package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
  89. package/dist/testing/cross_backend/conformance_case.js +4 -0
  90. package/dist/testing/cross_backend/conformance_principal.d.ts +2 -2
  91. package/dist/testing/cross_backend/conformance_principal.d.ts.map +1 -1
  92. package/dist/testing/cross_backend/conformance_principal.js +27 -10
  93. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +10 -1
  94. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
  95. package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +33 -7
  96. package/dist/testing/cross_backend/default_backend_configs.d.ts +38 -5
  97. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
  98. package/dist/testing/cross_backend/default_backend_configs.js +50 -15
  99. package/dist/testing/cross_backend/in_process_setup.d.ts +1 -1
  100. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  101. package/dist/testing/cross_backend/in_process_setup.js +53 -31
  102. package/dist/testing/cross_backend/revocation_drivers.d.ts +14 -2
  103. package/dist/testing/cross_backend/revocation_drivers.d.ts.map +1 -1
  104. package/dist/testing/cross_backend/revocation_drivers.js +36 -8
  105. package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
  106. package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -1
  107. package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +7 -0
  108. package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
  109. package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +4 -2
  110. package/dist/testing/cross_backend/setup.d.ts +44 -43
  111. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  112. package/dist/testing/cross_backend/setup.js +64 -62
  113. package/dist/testing/cross_backend/spawn_backend.d.ts +19 -1
  114. package/dist/testing/cross_backend/spawn_backend.d.ts.map +1 -1
  115. package/dist/testing/cross_backend/spawn_backend.js +138 -11
  116. package/dist/testing/cross_backend/spine_suites.d.ts +17 -14
  117. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  118. package/dist/testing/cross_backend/spine_suites.js +37 -15
  119. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  120. package/dist/testing/cross_backend/sse_round_trip.js +4 -2
  121. package/dist/testing/cross_backend/standard.d.ts +18 -82
  122. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  123. package/dist/testing/cross_backend/standard.js +6 -21
  124. package/dist/testing/cross_backend/standard_auth.d.ts +74 -0
  125. package/dist/testing/cross_backend/standard_auth.d.ts.map +1 -0
  126. package/dist/testing/cross_backend/standard_auth.js +28 -0
  127. package/dist/testing/cross_backend/standard_bundle.d.ts +48 -0
  128. package/dist/testing/cross_backend/standard_bundle.d.ts.map +1 -0
  129. package/dist/testing/cross_backend/standard_bundle.js +43 -0
  130. package/dist/testing/cross_backend/testing_reset_actions.d.ts +18 -6
  131. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  132. package/dist/testing/cross_backend/testing_reset_actions.js +23 -8
  133. package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
  134. package/dist/testing/cross_backend/testing_server_bun.js +7 -30
  135. package/dist/testing/cross_backend/testing_server_core.d.ts +16 -3
  136. package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
  137. package/dist/testing/cross_backend/testing_server_core.js +20 -4
  138. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +6 -2
  139. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  140. package/dist/testing/cross_backend/ts_spine_backend_config.js +7 -3
  141. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  142. package/dist/testing/cross_backend/ws_round_trip.js +4 -3
  143. package/dist/testing/data_exposure.d.ts +4 -1
  144. package/dist/testing/data_exposure.d.ts.map +1 -1
  145. package/dist/testing/data_exposure.js +93 -25
  146. package/dist/testing/db_invariants.d.ts +5 -5
  147. package/dist/testing/db_invariants.js +5 -5
  148. package/dist/testing/error_coverage.d.ts +5 -0
  149. package/dist/testing/error_coverage.d.ts.map +1 -1
  150. package/dist/testing/error_coverage.js +2 -1
  151. package/dist/testing/integration.d.ts +4 -20
  152. package/dist/testing/integration.d.ts.map +1 -1
  153. package/dist/testing/integration.js +49 -79
  154. package/dist/testing/integration_helpers.d.ts +16 -0
  155. package/dist/testing/integration_helpers.d.ts.map +1 -1
  156. package/dist/testing/integration_helpers.js +29 -1
  157. package/dist/testing/logged_errors.d.ts +61 -0
  158. package/dist/testing/logged_errors.d.ts.map +1 -0
  159. package/dist/testing/logged_errors.js +285 -0
  160. package/dist/testing/middleware_gate_probes.d.ts +55 -1
  161. package/dist/testing/middleware_gate_probes.d.ts.map +1 -1
  162. package/dist/testing/middleware_gate_probes.js +76 -3
  163. package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
  164. package/dist/testing/rpc_attack_surface.js +41 -16
  165. package/dist/testing/stubs.d.ts +5 -1
  166. package/dist/testing/stubs.d.ts.map +1 -1
  167. package/dist/testing/stubs.js +6 -3
  168. package/dist/testing/test_app.d.ts +39 -9
  169. package/dist/testing/test_app.d.ts.map +1 -1
  170. package/dist/testing/test_app.js +70 -12
  171. package/dist/testing/transports/fetch_transport.d.ts +10 -0
  172. package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
  173. package/dist/testing/transports/fetch_transport.js +13 -0
  174. package/package.json +4 -3
@@ -8,12 +8,13 @@ import '../assert_dev_env.js';
8
8
  * it succeeded; the suite opens the target's connections first and asserts
9
9
  * their close after. Each row says what it closes (`AccountRevocation.closes`):
10
10
  * the whole account, or only the session the revocation was sent on
11
- * (`POST /logout`), which leaves the account's other credentials' connections
12
- * open. `describe_cross_process_ws_tests` and
13
- * `describe_cross_process_sse_tests` iterate `create_account_revocations`. The
14
- * revocations that name a credential in their input (one session, one token),
15
- * a cap eviction, and those a suite drives differently (session revoke-all,
16
- * account delete) stay in their suites.
11
+ * (`POST /logout`, `account_session_revoke` of the current session), which
12
+ * leaves the account's other credentials' connections open.
13
+ * `describe_cross_process_ws_tests` and `describe_cross_process_sse_tests`
14
+ * iterate `create_account_revocations`. The revocations that name another
15
+ * credential in their input (a sibling session, one token), a cap eviction,
16
+ * and those a suite drives differently (session revoke-all, account delete)
17
+ * stay in their suites.
17
18
  *
18
19
  * The drivers are exported on their own for a consumer suite that closes a
19
20
  * transport of its own on the same revocations.
@@ -21,9 +22,10 @@ import '../assert_dev_env.js';
21
22
  * @module
22
23
  */
23
24
  import { assert } from 'vitest';
25
+ import { account_session_list_action_spec, account_session_revoke_action_spec, SessionListOutput, SessionRevokeOutput } from '../../auth/account_action_specs.js';
24
26
  import { account_purge_action_spec, admin_token_revoke_all_action_spec } from '../../auth/admin_action_specs.js';
25
27
  import { DEFAULT_TEST_PASSWORD } from '../test_credentials.js';
26
- import { cross_rpc_call } from './cross_rpc.js';
28
+ import { cross_rpc_call, expect_output } from './cross_rpc.js';
27
29
  /**
28
30
  * POST a JSON body to a REST route on `account`'s session, asserting `200`.
29
31
  *
@@ -40,6 +42,24 @@ export const cross_post_as = async (fixture, account, path, body) => {
40
42
  });
41
43
  assert.strictEqual(res.status, 200, `POST ${path}: ${await res.text()}`);
42
44
  };
45
+ /**
46
+ * Revoke the session `account`'s requests are sent on (`account_session_revoke`
47
+ * on that session), asserting it was revoked: the session list, read on the
48
+ * same session, names it as the current one, so the id revoked is the one the
49
+ * caller holds rather than a sibling's.
50
+ *
51
+ * @param fixture - the per-test fixture whose fresh transport carries the requests
52
+ * @param rpc_path - the RPC endpoint path
53
+ * @param account - the account whose session cookie authenticates both calls
54
+ */
55
+ export const cross_session_revoke_current = async (fixture, rpc_path, account) => {
56
+ const headers = account.create_session_headers();
57
+ const { sessions } = expect_output(await cross_rpc_call(fixture.fresh_transport(), rpc_path, account_session_list_action_spec.method, undefined, headers), SessionListOutput);
58
+ const current = sessions.filter((session) => session.is_current);
59
+ assert.strictEqual(current.length, 1, `exactly one current session: ${JSON.stringify(sessions)}`);
60
+ const output = expect_output(await cross_rpc_call(fixture.fresh_transport(), rpc_path, account_session_revoke_action_spec.method, { session_id: current[0].id }, headers), SessionRevokeOutput);
61
+ assert.strictEqual(output.revoked, true, 'account_session_revoke revoked the current session');
62
+ };
43
63
  /**
44
64
  * Revoke every API token of `account_id` over the keeper's admin session
45
65
  * (`admin_token_revoke_all`), asserting success.
@@ -69,7 +89,8 @@ export const cross_account_purge = async (fixture, rpc_path, account_id) => {
69
89
  * The revocations of a target account's credentials both transport suites
70
90
  * drive: `admin_token_revoke_all`, `POST /password`, and `account_purge`
71
91
  * (gated on `capabilities.account_lifecycle`) close every connection of the
72
- * account; `POST /logout` closes only the connections of the session it ends.
92
+ * account; `POST /logout` and `account_session_revoke` of the caller's own
93
+ * session close only the connections of the session they end.
73
94
  *
74
95
  * @param options - the backend's capabilities and route paths
75
96
  * @returns the revocation rows, in a stable order
@@ -91,6 +112,13 @@ export const create_account_revocations = (options) => {
91
112
  closes: 'session',
92
113
  revoke: (fixture, target) => cross_post_as(fixture, target, logout_path, {})
93
114
  },
115
+ {
116
+ label: 'account_session_revoke',
117
+ slug: 'session_revoke',
118
+ gate: true,
119
+ closes: 'session',
120
+ revoke: (fixture, target) => cross_session_revoke_current(fixture, rpc_path, target)
121
+ },
94
122
  {
95
123
  label: 'POST /password',
96
124
  slug: 'password',
@@ -1 +1 @@
1
- {"version":3,"file":"rpc_success_fixtures.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/rpc_success_fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqC9B,OAAO,KAAK,EAAqB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAOlF,uDAAuD;AACvD,MAAM,WAAW,8BAA8B;IAC9C,gGAAgG;IAChG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iCAAiC,GAC7C,UAAS,8BAAmC,KAC1C,kBAwHF,CAAC"}
1
+ {"version":3,"file":"rpc_success_fixtures.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/rpc_success_fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAsC9B,OAAO,KAAK,EAAqB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAOlF,uDAAuD;AACvD,MAAM,WAAW,8BAA8B;IAC9C,gGAAgG;IAChG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iCAAiC,GAC7C,UAAS,8BAAmC,KAC1C,kBAwHF,CAAC"}
@@ -12,7 +12,8 @@ import '../assert_dev_env.js';
12
12
  *
13
13
  * Spine-generic: the fixtures use only standard RPC actions and the builtin
14
14
  * `ROLE_ADMIN`, so any consumer mounting `create_standard_rpc_actions` can
15
- * pass the map to `describe_standard_cross_process_tests` (as
15
+ * pass the map to `describe_spine_cross_suites` or
16
+ * `describe_standard_cross_process_tests` (as
16
17
  * `rpc_success_fixtures`) or `describe_rpc_round_trip_tests` (as
17
18
  * `success_fixtures`). Each fixture mints
18
19
  * its own accounts and calls as one of them, so none touches or calls as the
@@ -98,6 +98,13 @@ export interface SpineStubBackendConfigOptions {
98
98
  * `TsSpineBackendConfigOptions.db_audit_checkout_timeout_ms`.
99
99
  */
100
100
  readonly db_audit_checkout_timeout_ms?: number;
101
+ /**
102
+ * Whether the stub drops the database's `public` schema before its
103
+ * migrations on boot. Default `true`. `false` keeps what another backend
104
+ * left there — the backend swap (`backend_swap.ts`). Passed to
105
+ * `make_default_rust_backend_config`.
106
+ */
107
+ readonly reset_db_on_startup?: boolean;
101
108
  }
102
109
  /**
103
110
  * Build the `BackendConfig` for `testing_spine_stub`. Resolves the binary
@@ -1 +1 @@
1
- {"version":3,"file":"rust_spine_stub_backend_config.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/rust_spine_stub_backend_config.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAwC9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAezD,uGAAuG;AACvG,eAAO,MAAM,uBAAuB,oCAAoC,CAAC;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,6CAA6C,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,wCAAwC,6CAA6C,CAAC;AAuCnG,kGAAkG;AAClG,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD,8EAA8E;AAC9E,eAAO,MAAM,4BAA4B,eAAe,CAAC;AAEzD,0FAA0F;AAC1F,eAAO,MAAM,oCAAoC,sDACG,CAAC;AAErD,MAAM,WAAW,6BAA6B;IAC7C,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;;OAOG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC;;;;;;OAMG;IACH,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAC5C;;;;;OAKG;IACH,QAAQ,CAAC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACjD;;;;OAIG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CAC/C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,GAC1C,UAAS,6BAAkC,KACzC,aAoDF,CAAC"}
1
+ {"version":3,"file":"rust_spine_stub_backend_config.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/rust_spine_stub_backend_config.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAyC9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAezD,uGAAuG;AACvG,eAAO,MAAM,uBAAuB,oCAAoC,CAAC;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,6CAA6C,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,wCAAwC,6CAA6C,CAAC;AAuCnG,kGAAkG;AAClG,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD,8EAA8E;AAC9E,eAAO,MAAM,4BAA4B,eAAe,CAAC;AAEzD,0FAA0F;AAC1F,eAAO,MAAM,oCAAoC,sDACG,CAAC;AAErD,MAAM,WAAW,6BAA6B;IAC7C,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;;OAOG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC;;;;;;OAMG;IACH,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAC5C;;;;;OAKG;IACH,QAAQ,CAAC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACjD;;;;OAIG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IAC/C;;;;;OAKG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACvC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,GAC1C,UAAS,6BAAkC,KACzC,aAsDF,CAAC"}
@@ -30,7 +30,8 @@ import '../assert_dev_env.js';
30
30
  * (`FUZ_TESTING_RESET_DB_ON_STARTUP=true`, set by the Rust-family builder),
31
31
  * so no manual `DROP TABLE` between sessions is needed; per-test reset is
32
32
  * the orthogonal `_testing_reset` RPC action `default_cross_process_setup`
33
- * fires.
33
+ * fires. `reset_db_on_startup: false` boots it over the database as it finds
34
+ * it, for the backend swap (`backend_swap.ts`).
34
35
  *
35
36
  * @module
36
37
  */
@@ -109,7 +110,7 @@ export const RUST_SPINE_STUB_DEFAULT_DATABASE_URL = 'postgres://localhost/fuz_ap
109
110
  */
110
111
  export const rust_spine_stub_backend_config = (options = {}) => {
111
112
  const { port = RUST_SPINE_STUB_DEFAULT_PORT, database_url = process.env[RUST_SPINE_STUB_DATABASE_URL_ENV] ||
112
- RUST_SPINE_STUB_DEFAULT_DATABASE_URL, binary_path = process.env[RUST_SPINE_STUB_BIN_ENV], enable_login_rate_limit, trusted_proxies, name = RUST_SPINE_STUB_DEFAULT_NAME } = options;
113
+ RUST_SPINE_STUB_DEFAULT_DATABASE_URL, binary_path = process.env[RUST_SPINE_STUB_BIN_ENV], enable_login_rate_limit, trusted_proxies, name = RUST_SPINE_STUB_DEFAULT_NAME, reset_db_on_startup } = options;
113
114
  if (!binary_path) {
114
115
  throw new Error(`rust_spine_stub_backend_config: no binary path — set ${RUST_SPINE_STUB_BIN_ENV} to a prebuilt ` +
115
116
  '`testing_spine_stub` binary (build it with `cargo build -p testing_spine_stub --profile cross-test`) ' +
@@ -133,6 +134,7 @@ export const rust_spine_stub_backend_config = (options = {}) => {
133
134
  // dir to `paths.root`, which makes that `paths.daemon_token_path`, the
134
135
  // file `spawn_backend` reads after the health probe.
135
136
  daemon_token_dir_env: 'FUZ_RUST_SPINE_STUB_DIR',
137
+ reset_db_on_startup,
136
138
  extra_env: {
137
139
  // Absolute path to the committed spine `expected_schema.json` — the
138
140
  // stub's `/ready` gate introspects the live DB against it. The SAME
@@ -101,9 +101,9 @@ export declare const to_test_account: (seeded: {
101
101
  * Transport-agnostic: in-process and cross-process producers return the
102
102
  * same shape. Behaviors that once needed raw backend access (keyring for
103
103
  * forging cookies) are reached through wire-shaped seams instead —
104
- * `mint_expired_session()` mints over the `_testing_mint_session` channel
105
- * cross-process and directly in-process, so suite bodies never branch on
106
- * the transport.
104
+ * `mint_expired_session()` expires a session over the
105
+ * `_testing_shorten_credential_expiry` channel cross-process and with its
106
+ * statement in-process, so suite bodies never branch on the transport.
107
107
  *
108
108
  * **Keeper ≠ admin.** `fixture.account` / `fixture.actor` refer to the
109
109
  * **fresh keeper** seeded per test. The keeper account holds
@@ -194,15 +194,16 @@ export interface TestFixture {
194
194
  readonly name: string;
195
195
  }>;
196
196
  /**
197
- * Forge an *expired server-side session* for the keeper account and
198
- * return the ready-to-send `Cookie` header value (`name=value`). The
199
- * minted `auth_session` row is backdated while the signed cookie payload
200
- * stays valid — so resolution clears the cookie-payload gate
201
- * (`parse_session_from_cookies`) and is refused at the authoritative DB-row gate
202
- * (`query_session_get_valid` — `WHERE expires_at > NOW()`). Backs the
203
- * `expired_session` conformance principal. In-process mints directly via
204
- * `mint_test_session`; cross-process drives the `_testing_mint_session`
205
- * RPC over the keeper's daemon-token channel (the driver has no keyring).
197
+ * Return the ready-to-send `Cookie` header value (`name=value`) of a
198
+ * session that authenticated and whose row is now past its `expires_at`:
199
+ * the signed cookie still verifies, so resolution clears the cookie gate
200
+ * (`parse_session_from_cookies`) and is refused at the authoritative
201
+ * DB-row gate (`query_session_get_valid` — `WHERE expires_at > NOW()`).
202
+ * Backs the `expired_session` conformance principal. The shape of
203
+ * `mint_expired_token`: a fresh account (`create_account`, so the keeper's
204
+ * own credentials live on) whose session is proven live, then expired as a
205
+ * real one is — `_testing_shorten_credential_expiry` and a wait
206
+ * cross-process, its statement and a backdate in-process.
206
207
  */
207
208
  readonly mint_expired_session: () => Promise<string>;
208
209
  /**
@@ -231,14 +232,16 @@ export interface TestFixture {
231
232
  * `expires_at`. Backs the `expired_token` conformance principal. Both
232
233
  * fixtures mint an account (`create_account`, so the keeper's own
233
234
  * credentials live on), prove its eternal token authenticates, then pull
234
- * the account's credential expiries in to `EXPIRED_TOKEN_SHORTEN_SECONDS`
235
+ * the account's credential expiries in to `EXPIRED_CREDENTIAL_SHORTEN_SECONDS`
235
236
  * from now with the statement behind `_testing_shorten_credential_expiry`
236
- * (`query_shorten_credential_expiry`), and wait `EXPIRED_TOKEN_WAIT_MS`, so
237
- * the row expires as a real one does: `expires_at` after `created_at`, then
238
- * passed. Cross-process the statement runs through the backdoor, which the
239
- * backend must mount. In-process it runs directly; backdating the expiry
240
- * into the past instead would skip the wait but leave `expires_at` before
241
- * `created_at`, a row no lifetime writes.
237
+ * (`query_shorten_credential_expiry`), so the row expires as a real one
238
+ * does: `expires_at` after `created_at`, then passed. Cross-process the
239
+ * statement runs through the backdoor, which the backend must mount, and
240
+ * the fixture waits `EXPIRED_CREDENTIAL_WAIT_MS`. In-process it runs directly
241
+ * and, holding the database, moves the account's credential rows back by
242
+ * that wait instead — every timestamp of each row, so `expires_at` stays
243
+ * after `created_at`, a row a lifetime writes. `mint_expired_session` is
244
+ * the same mint over the account's session.
242
245
  */
243
246
  readonly mint_expired_token: () => Promise<string>;
244
247
  /**
@@ -329,7 +332,6 @@ export interface RpcPathCapabilityGatedCrossSuiteOptions extends RpcPathCrossSui
329
332
  * keeper_transport,
330
333
  * keeper_daemon_transport: create_fetch_transport({
331
334
  * base_url: config.base_url,
332
- * initial_cookies: keeper.cookies,
333
335
  * origin: null,
334
336
  * }),
335
337
  * keeper_account: keeper.account,
@@ -348,9 +350,10 @@ export interface BootstrappedBackendHandle extends BackendHandle {
348
350
  /** Transport carrying the keeper session cookie + cookie jar. */
349
351
  readonly keeper_transport: FetchTransport;
350
352
  /**
351
- * Daemon-token transport for the keeper — same cookie jar as
352
- * `keeper_transport` but with `origin: null` so it sends no `Origin`
353
- * header. The daemon-token middleware discards the credential in a
353
+ * Daemon-token transport for the keeper — no cookie jar, so a daemon-token
354
+ * call carries that credential alone (a cookie beside it would authenticate
355
+ * as the keeper's session if the token failed), and `origin: null` so it
356
+ * sends no `Origin` header. The daemon-token middleware discards the credential in a
354
357
  * browser context (any `Origin` / `Referer`), so the `_testing_*`
355
358
  * daemon-token calls (`_testing_reset` / `_testing_schema_snapshot` /
356
359
  * `_testing_action_manifest` / `_testing_mint_session`) must route
@@ -542,29 +545,25 @@ export declare const capture_action_manifest: (handle: ReconstructedBootstrapped
542
545
  */
543
546
  export declare const capture_migration_tracker: (handle: ReconstructedBootstrappedBackendHandle) => Promise<MigrationTracker>;
544
547
  /**
545
- * Backdating offset (seconds) the `mint_expired_session` seam passes to
546
- * `mint_test_session` / `_testing_mint_session`. A minute in the past is
547
- * comfortably past `NOW()` for the DB-row expiry gate without depending on
548
- * clock precision.
549
- */
550
- export declare const EXPIRED_SESSION_OFFSET_SECONDS = -60;
551
- /**
552
- * The seconds `mint_expired_token` pulls a token's expiry in to — over
548
+ * The seconds `mint_expired_token` and `mint_expired_session` pull a
549
+ * credential's expiry in to — over
553
550
  * `_testing_shorten_credential_expiry` cross-process, with its statement
554
551
  * in-process — the backdoor's floor
555
552
  * (`TESTING_SHORTEN_CREDENTIAL_EXPIRY_MIN_SECONDS`, which this module does not
556
553
  * import: its module carries the in-process backend), so the wait is as short
557
554
  * as the backdoor allows; a floor raised past it fails the call loud.
558
555
  */
559
- export declare const EXPIRED_TOKEN_SHORTEN_SECONDS = 1;
556
+ export declare const EXPIRED_CREDENTIAL_SHORTEN_SECONDS = 1;
560
557
  /**
561
- * How long `mint_expired_token` waits after the shorten answers, on both
562
- * fixtures: the row's `expires_at` is `EXPIRED_TOKEN_SHORTEN_SECONDS` past the
558
+ * How long the cross-process `mint_expired_token` and `mint_expired_session`
559
+ * wait after the shorten answers: the row's `expires_at` is
560
+ * `EXPIRED_CREDENTIAL_SHORTEN_SECONDS` past the
563
561
  * database's `NOW()` of a statement that ran before the answer, so once this
564
562
  * much has passed on the same clock the row is expired when the token is sent.
565
- * The margin covers the timer firing early by its rounding.
563
+ * The margin covers the timer firing early by its rounding. The in-process
564
+ * fixture moves the rows back by it rather than waiting.
566
565
  */
567
- export declare const EXPIRED_TOKEN_WAIT_MS: number;
566
+ export declare const EXPIRED_CREDENTIAL_WAIT_MS: number;
568
567
  /** What `assert_credential_authenticates` sends and expects. */
569
568
  export interface AssertCredentialAuthenticatesOptions {
570
569
  /**
@@ -572,7 +571,7 @@ export interface AssertCredentialAuthenticatesOptions {
572
571
  * otherwise, since a cookie it carried would answer for the credential.
573
572
  */
574
573
  readonly transport: FetchTransport;
575
- /** The RPC endpoint `account_verify` is mounted on. */
574
+ /** The RPC endpoint `account_verify` (`account_verify_action_spec`) is mounted on. */
576
575
  readonly rpc_path: string;
577
576
  /** The credential, alone: a `cookie`, an `authorization`, or a daemon token. */
578
577
  readonly headers: Readonly<Record<string, string>>;
@@ -582,12 +581,14 @@ export interface AssertCredentialAuthenticatesOptions {
582
581
  readonly accessor: string;
583
582
  }
584
583
  /**
585
- * Prove a credential authenticates — `account_verify` answers 200 as the
586
- * expected account — before a fixture accessor kills it. A revoked or expired
587
- * credential reaches the same lookup a never-issued one does, so without this
588
- * a `mint_revoked_*` that minted nothing (or a token that never worked) would
589
- * pass every row its principal backs; with it, the principal's refusal can
590
- * only come from the revocation or the expiry.
584
+ * Prove a credential authenticates — `account_verify` answers 200 naming the
585
+ * expected account — before a fixture relies on it. A refusal reaches the same
586
+ * answer whether the credential was killed, never worked, or belongs to
587
+ * another account, so without this a `mint_revoked_*` that minted nothing, an
588
+ * expiry over a token that never worked, or a `scoped_token` minted on the
589
+ * wrong account would pass every row its principal backs; with it, the
590
+ * principal's refusal can only come from the state the fixture put it in (the
591
+ * revocation, the expiry, the scope).
591
592
  *
592
593
  * @param options - the transport, endpoint, credential and expected account
593
594
  * @throws Error naming the accessor when the credential does not answer as the account
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/setup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAQN,KAAK,KAAK,EACV,KAAK,SAAS,EACd,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAuB,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAKvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE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;IACjD,yEAAyE;IACzE,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC5D,gDAAgD;IAChD,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;QAAE,EAAE,EAAE,IAAI,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjE;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,yBAAyB,GACrC,QAAQ,SAAS;IAAE,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,EAEpE,cAAc,MAAM,EACpB,WAAW;IACV,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC5C,EACD,QAAQ;IACP,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjD,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;QAAE,EAAE,EAAE,IAAI,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjE,KACC,wBAAwB,CAAC,QAAQ,CAuDnC,CAAC;AA8TF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,2BAA2B,GACvC,QAAQ,sCAAsC,EAC9C,UAAU,wBAAwB,KAChC,SAwRF,CAAC"}
@@ -24,6 +24,7 @@ import '../assert_dev_env.js';
24
24
  import { array, boolean, literal, number, parse, string, strip_object } from '@fuzdev/fuz_schema/schema.ts';
25
25
  import { USERNAME_LENGTH_MAX, Uuid } from '../../primitive_schemas.js';
26
26
  import { format_issues } from '../../schema_issues.js';
27
+ import { account_verify_action_spec } from '../../auth/account_action_specs.js';
27
28
  import { DAEMON_TOKEN_HEADER } from '../../auth/daemon_token.js';
28
29
  import { DEFAULT_TEST_PASSWORD } from '../test_credentials.js';
29
30
  import { create_fetch_transport } from '../transports/fetch_transport.js';
@@ -89,13 +90,13 @@ export const reconstruct_bootstrapped_handle = (serialized) => ({
89
90
  base_url: serialized.config.base_url,
90
91
  initial_cookies: serialized.keeper_cookies
91
92
  }),
92
- // Same cookie jar but Origin-free so the daemon-token middleware doesn't
93
- // discard the credential as browser-context — used by the `_testing_*`
94
- // daemon-token calls (`_testing_reset` / `_testing_schema_snapshot` /
93
+ // Cookie-free and Origin-free, so a daemon-token call carries that
94
+ // credential alone and the daemon-token middleware doesn't discard it as
95
+ // browser-context — used by the `_testing_*` daemon-token calls
96
+ // (`_testing_reset` / `_testing_schema_snapshot` /
95
97
  // `_testing_action_manifest` / `_testing_mint_session`).
96
98
  keeper_daemon_transport: create_fetch_transport({
97
99
  base_url: serialized.config.base_url,
98
- initial_cookies: serialized.keeper_cookies,
99
100
  origin: null
100
101
  })
101
102
  });
@@ -251,40 +252,36 @@ export const capture_action_manifest = async (handle) => capture_via_daemon(hand
251
252
  */
252
253
  export const capture_migration_tracker = async (handle) => capture_via_daemon(handle, '_testing_migration_tracker', MigrationTracker);
253
254
  /**
254
- * Backdating offset (seconds) the `mint_expired_session` seam passes to
255
- * `mint_test_session` / `_testing_mint_session`. A minute in the past is
256
- * comfortably past `NOW()` for the DB-row expiry gate without depending on
257
- * clock precision.
258
- */
259
- export const EXPIRED_SESSION_OFFSET_SECONDS = -60;
260
- /** Structural subset of `_testing_mint_session`'s output. */
261
- const MintSessionResponseShape = strip_object({ session_cookie: string });
262
- /**
263
- * The seconds `mint_expired_token` pulls a token's expiry in to — over
255
+ * The seconds `mint_expired_token` and `mint_expired_session` pull a
256
+ * credential's expiry in to — over
264
257
  * `_testing_shorten_credential_expiry` cross-process, with its statement
265
258
  * in-process — the backdoor's floor
266
259
  * (`TESTING_SHORTEN_CREDENTIAL_EXPIRY_MIN_SECONDS`, which this module does not
267
260
  * import: its module carries the in-process backend), so the wait is as short
268
261
  * as the backdoor allows; a floor raised past it fails the call loud.
269
262
  */
270
- export const EXPIRED_TOKEN_SHORTEN_SECONDS = 1;
263
+ export const EXPIRED_CREDENTIAL_SHORTEN_SECONDS = 1;
271
264
  /**
272
- * How long `mint_expired_token` waits after the shorten answers, on both
273
- * fixtures: the row's `expires_at` is `EXPIRED_TOKEN_SHORTEN_SECONDS` past the
265
+ * How long the cross-process `mint_expired_token` and `mint_expired_session`
266
+ * wait after the shorten answers: the row's `expires_at` is
267
+ * `EXPIRED_CREDENTIAL_SHORTEN_SECONDS` past the
274
268
  * database's `NOW()` of a statement that ran before the answer, so once this
275
269
  * much has passed on the same clock the row is expired when the token is sent.
276
- * The margin covers the timer firing early by its rounding.
270
+ * The margin covers the timer firing early by its rounding. The in-process
271
+ * fixture moves the rows back by it rather than waiting.
277
272
  */
278
- export const EXPIRED_TOKEN_WAIT_MS = EXPIRED_TOKEN_SHORTEN_SECONDS * 1000 + 50;
273
+ export const EXPIRED_CREDENTIAL_WAIT_MS = EXPIRED_CREDENTIAL_SHORTEN_SECONDS * 1000 + 50;
279
274
  /** The account id an `account_verify` answer names, all a liveness check reads of it. */
280
275
  const VerifyResponseShape = strip_object({ id: string });
281
276
  /**
282
- * Prove a credential authenticates — `account_verify` answers 200 as the
283
- * expected account — before a fixture accessor kills it. A revoked or expired
284
- * credential reaches the same lookup a never-issued one does, so without this
285
- * a `mint_revoked_*` that minted nothing (or a token that never worked) would
286
- * pass every row its principal backs; with it, the principal's refusal can
287
- * only come from the revocation or the expiry.
277
+ * Prove a credential authenticates — `account_verify` answers 200 naming the
278
+ * expected account — before a fixture relies on it. A refusal reaches the same
279
+ * answer whether the credential was killed, never worked, or belongs to
280
+ * another account, so without this a `mint_revoked_*` that minted nothing, an
281
+ * expiry over a token that never worked, or a `scoped_token` minted on the
282
+ * wrong account would pass every row its principal backs; with it, the
283
+ * principal's refusal can only come from the state the fixture put it in (the
284
+ * revocation, the expiry, the scope).
288
285
  *
289
286
  * @param options - the transport, endpoint, credential and expected account
290
287
  * @throws Error naming the accessor when the credential does not answer as the account
@@ -298,13 +295,17 @@ export const assert_credential_authenticates = async (options) => {
298
295
  const response = await transport(rpc_path, {
299
296
  method: 'POST',
300
297
  headers: { 'Content-Type': 'application/json', ...headers },
301
- body: JSON.stringify({ jsonrpc: '2.0', method: 'account_verify', id: 'account_verify' })
298
+ body: JSON.stringify({
299
+ jsonrpc: '2.0',
300
+ method: account_verify_action_spec.method,
301
+ id: account_verify_action_spec.method
302
+ })
302
303
  });
303
304
  const body = (await response.json().catch(() => undefined));
304
305
  const parsed = parse(VerifyResponseShape, body?.result);
305
306
  if (response.status !== 200 || !parsed.ok || parsed.value.id !== account_id) {
306
- throw new Error(`${accessor}: the credential did not authenticate as account ${account_id} before it was ` +
307
- `killed — account_verify answered ${response.status} ${JSON.stringify(body)}`);
307
+ throw new Error(`${accessor}: the credential did not authenticate as account ${account_id} — ` +
308
+ `${account_verify_action_spec.method} answered ${response.status} ${JSON.stringify(body)}`);
308
309
  }
309
310
  };
310
311
  /** Structural subset of `account_token_create`'s output that the revoked-token mint reads. */
@@ -316,7 +317,7 @@ const SessionListResponseShape = strip_object({
316
317
  /** Structural subset of `account_*_revoke`'s output. */
317
318
  const RevokeResponseShape = strip_object({ revoked: literal(true) });
318
319
  /** Structural subset of `_testing_shorten_credential_expiry`'s output. */
319
- const ShortenResponseShape = strip_object({ api_tokens: number });
320
+ const ShortenResponseShape = strip_object({ sessions: number, api_tokens: number });
320
321
  /** Structural subset of `_testing_reset`'s output. */
321
322
  const TestingResetResponseShape = strip_object({
322
323
  account: strip_object({ id: Uuid, username: string }),
@@ -583,14 +584,14 @@ const create_keeper_transport = (handle, cookie_name, session_cookie) => create_
583
584
  initial_cookies: [`${cookie_name}=${session_cookie}`]
584
585
  });
585
586
  /**
586
- * Origin-free twin of `create_keeper_transport` — same fresh keeper cookie
587
- * jar but `origin: null` so the daemon-token middleware doesn't discard the
588
- * credential as browser-context. Used for the per-test `_testing_*`
589
- * daemon-token calls (the rebuilt handle's `keeper_daemon_transport`).
587
+ * The daemon-token twin of `create_keeper_transport`: no cookie jar, so a
588
+ * daemon-token call carries that credential alone, and `origin: null` so the
589
+ * daemon-token middleware doesn't discard the credential as browser-context.
590
+ * Used for the per-test `_testing_*` daemon-token calls (the rebuilt handle's
591
+ * `keeper_daemon_transport`).
590
592
  */
591
- const create_keeper_daemon_transport = (handle, cookie_name, session_cookie) => create_fetch_transport({
593
+ const create_keeper_daemon_transport = (handle) => create_fetch_transport({
592
594
  base_url: handle.config.base_url,
593
- initial_cookies: [`${cookie_name}=${session_cookie}`],
594
595
  origin: null
595
596
  });
596
597
  /**
@@ -649,10 +650,8 @@ export const default_cross_process_setup = (handle, options) => {
649
650
  // `session_cookie` for any keeper-acting calls this test makes
650
651
  // (e.g. `fixture.create_account()`'s `invite_create` step).
651
652
  const keeper_transport = create_keeper_transport(handle, cookie_name, keeper.session_cookie);
652
- // Origin-free twin for the per-test daemon-token calls — the original
653
- // `handle.keeper_daemon_transport` carries the wiped `globalSetup` keeper
654
- // cookie, so rebuild it against the freshly re-seeded keeper.
655
- const keeper_daemon_transport = create_keeper_daemon_transport(handle, cookie_name, keeper.session_cookie);
653
+ // a fresh cookie-free daemon-token transport per test
654
+ const keeper_daemon_transport = create_keeper_daemon_transport(handle);
656
655
  const refreshed_handle = {
657
656
  ...handle,
658
657
  keeper_transport,
@@ -692,6 +691,25 @@ export const default_cross_process_setup = (handle, options) => {
692
691
  for (const [username, seeded] of Object.entries(seeded_extras)) {
693
692
  extra_accounts[username] = to_test_account(seeded, cookie_name);
694
693
  }
694
+ // The expired-credential mints' shared shape: a fresh account, its
695
+ // credential proven live, then every credential of the account pulled
696
+ // in through the backdoor and waited out — refused for the expiry alone.
697
+ const mint_expired_account = async (accessor, kind, credential) => {
698
+ const other = await create_account();
699
+ await assert_credential_authenticates({
700
+ transport: create_fetch_transport({ base_url: handle.config.base_url, origin: null }),
701
+ rpc_path: handle.config.rpc_path,
702
+ headers: credential(other),
703
+ account_id: other.account.id,
704
+ accessor
705
+ });
706
+ const shortened = parse_capture_answer('_testing_shorten_credential_expiry', ShortenResponseShape, await rpc_via_transport(refreshed_handle.keeper_daemon_transport, handle.config.rpc_path, '_testing_shorten_credential_expiry', { account_id: other.account.id, seconds: EXPIRED_CREDENTIAL_SHORTEN_SECONDS }, handle.config.name, { [DAEMON_TOKEN_HEADER]: handle.daemon_token }));
707
+ if (shortened[kind] < 1) {
708
+ throw new Error(`${accessor}: _testing_shorten_credential_expiry(${handle.config.name}) shortened no ${kind}`);
709
+ }
710
+ await new Promise((resolve) => setTimeout(resolve, EXPIRED_CREDENTIAL_WAIT_MS));
711
+ return other;
712
+ };
695
713
  // Per-test transport — fresh jar carrying the new keeper's cookie
696
714
  // so requests authenticate as the keeper without callers having to
697
715
  // thread cookies manually. Tests acting as the fresh keeper use
@@ -724,17 +742,11 @@ export const default_cross_process_setup = (handle, options) => {
724
742
  const answer = await capture_via_daemon(refreshed_handle, '_testing_db_invariants', DbInvariantRows);
725
743
  assert_db_invariant_rows(answer.rows, handle.config.name, exclude_db_invariants);
726
744
  },
727
- // Forge over the wire — the cross-process driver has no keyring,
728
- // so `_testing_mint_session` mints the backdated row + signs the
729
- // cookie server-side over the keeper's daemon-token channel.
730
745
  mint_expired_session: async () => {
731
- const raw = await rpc_via_transport(refreshed_handle.keeper_daemon_transport, handle.config.rpc_path, '_testing_mint_session', { account_id: keeper.account.id, expires_in_seconds: EXPIRED_SESSION_OFFSET_SECONDS }, handle.config.name, { [DAEMON_TOKEN_HEADER]: handle.daemon_token });
732
- const parsed = parse(MintSessionResponseShape, raw);
733
- if (!parsed.ok) {
734
- throw new Error(`_testing_mint_session(${handle.config.name}) returned unexpected result: ` +
735
- `${JSON.stringify(raw)} (${format_issues(parsed.issues)})`);
736
- }
737
- return `${cookie_name}=${parsed.value.session_cookie}`;
746
+ const other = await mint_expired_account('mint_expired_session', 'sessions', (account) => ({
747
+ cookie: `${cookie_name}=${account.session_cookie}`
748
+ }));
749
+ return `${cookie_name}=${other.session_cookie}`;
738
750
  },
739
751
  mint_revoked_session: async () => {
740
752
  // a second keeper session over the production login, so the
@@ -786,19 +798,9 @@ export const default_cross_process_setup = (handle, options) => {
786
798
  return minted.token;
787
799
  },
788
800
  mint_expired_token: async () => {
789
- const other = await create_account();
790
- await assert_credential_authenticates({
791
- transport: create_fetch_transport({ base_url: handle.config.base_url, origin: null }),
792
- rpc_path: handle.config.rpc_path,
793
- headers: { authorization: `Bearer ${other.api_token}` },
794
- account_id: other.account.id,
795
- accessor: 'mint_expired_token'
796
- });
797
- const shortened = parse_capture_answer('_testing_shorten_credential_expiry', ShortenResponseShape, await rpc_via_transport(refreshed_handle.keeper_daemon_transport, handle.config.rpc_path, '_testing_shorten_credential_expiry', { account_id: other.account.id, seconds: EXPIRED_TOKEN_SHORTEN_SECONDS }, handle.config.name, { [DAEMON_TOKEN_HEADER]: handle.daemon_token }));
798
- if (shortened.api_tokens < 1) {
799
- throw new Error(`mint_expired_token: _testing_shorten_credential_expiry(${handle.config.name}) shortened no token`);
800
- }
801
- await new Promise((resolve) => setTimeout(resolve, EXPIRED_TOKEN_WAIT_MS));
801
+ const other = await mint_expired_account('mint_expired_token', 'api_tokens', (account) => ({
802
+ authorization: `Bearer ${account.api_token}`
803
+ }));
802
804
  return other.api_token;
803
805
  }
804
806
  };
@@ -28,7 +28,17 @@ import '../assert_dev_env.js';
28
28
  *
29
29
  * The child's stderr is kept as a bounded tail (`STDERR_TAIL_MAX_BYTES`):
30
30
  * a startup failure reports it with the exit code or signal, and an exit
31
- * after startup that teardown didn't cause is logged with it.
31
+ * after startup that teardown didn't cause is logged with it. With
32
+ * `config.log`, its stdout and stderr are also teed into `config.log.path`,
33
+ * and teardown fails on each error-level line there that no
34
+ * `config.log.allow_errors` entry matches (`backend_log.ts`).
35
+ *
36
+ * Teardown holds the backend to a clean exit: a spine whose graceful
37
+ * shutdown gave up on work still running, or threw, exits `1` (the TS core's
38
+ * `start_testing_server`, the Rust spine's `StartupError::ShutdownGivenUp`),
39
+ * and `teardown` rejects on anything but exit code `0` — naming the backend,
40
+ * its exit code or signal, and its stderr tail — as it does for a backend
41
+ * that exited during the run or had to be killed.
32
42
  *
33
43
  * Bootstrapping (`POST /api/account/bootstrap`) is a separate concern —
34
44
  * the caller composes `bootstrap()` from `testing/transports/bootstrap.ts`
@@ -59,6 +69,14 @@ export interface BackendHandle {
59
69
  * escalating to SIGKILL after a grace window. Idempotent — later calls
60
70
  * await the same exit. A descendant that left the group — spawned detached,
61
71
  * or one that called `setsid` — is out of reach and survives teardown.
72
+ *
73
+ * Rejects unless the child exited `0` on the SIGTERM: an exit code other
74
+ * than `0` (a shutdown that gave up or failed), an exit by signal (the
75
+ * SIGKILL escalation among them), an exit before teardown (already
76
+ * logged when it happened), or a group still running when teardown gave
77
+ * up. The error names the backend and the exit, with the stderr tail. With
78
+ * `config.log`, it also rejects on the error lines of the log no allowance
79
+ * names, listing them. The group is torn down either way.
62
80
  */
63
81
  readonly teardown: () => Promise<void>;
64
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"spawn_backend.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/spawn_backend.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAK9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIzD,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC7B,yFAAyF;IACzF,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,OAAO,C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