@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
@@ -196,8 +196,20 @@ module's TSDoc and pinned by the `query_shape` cross suite.
196
196
  `GET` with `?params=42` is a 401 on both spines and an authorized one is
197
197
  `invalid_params`.
198
198
  - **Errors.** A `ThrownJsonrpcError` (recognized by its realm-global brand,
199
- `http/CLAUDE.md` §JSON-RPC) keeps its code and data; any other throw is
200
- `internal_error` 500, its message the raw error only under `DEV`. A result
199
+ `http/CLAUDE.md` §JSON-RPC) keeps its code and data. Any other throw is
200
+ `internal_error` 500, its message the raw error only under `DEV`, unless
201
+ the request's `signal` has aborted (a WS `cancel`, the socket closing, an
202
+ HTTP client gone): then it is `request_cancelled`, in the authorization
203
+ phase and the handler alike, logged at debug when the throw is the
204
+ cancellation itself (the signal's reason or an `AbortError`) and at warn
205
+ when it is anything else — a fault that landed after the cancel.
206
+ **Twin difference:** the Rust dispatcher answers a handler's `Err` as
207
+ returned, so over WS, with a per-request `cancel` and the socket still open,
208
+ a Rust handler that bails with `internal_error` answers `internal_error` and
209
+ logs at error where the error is built (`internal_error_with_source`); the
210
+ twin's answer is `request_cancelled`. Rust can't twin the log, which is
211
+ written at construction, before the dispatcher sees the error; a Rust
212
+ handler bails with `request_cancelled`. A result
201
213
  that can't be serialized answers the same 500 rather than throwing: the
202
214
  action has committed by then, and a throw would discard the handler's
203
215
  `post_commit_effects` — the connection closes of a revocation that landed.
@@ -523,7 +535,10 @@ The rules a caller would miss:
523
535
  admits. A dead credential is closed `WS_CLOSE_SESSION_REVOKED`, a lost role
524
536
  `WS_CLOSE_PERMISSION_REVOKED`, a failed re-read `WS_CLOSE_INTERNAL_ERROR` —
525
537
  fail closed. A refused socket evicts nothing and runs neither hook
526
- (../../../docs/security.md §Connection Admission).
538
+ (../../../docs/security.md §Connection Admission). The open — the re-read
539
+ and `on_socket_open` — is held on `deps.request_tracker`, so a shutdown
540
+ landing in it waits rather than closing the database under it
541
+ (`http/CLAUDE.md` §Pending Effects).
527
542
  - **Frames wait for admission and `on_socket_open`.** Frames arriving earlier
528
543
  are queued (bounded; overflow closes 1008) and dispatched in order after, so
529
544
  an `on_socket_open` hook that awaits `registry.request_connection` on its
@@ -1 +1 @@
1
- {"version":3,"file":"perform_action.d.ts","sourceRoot":"","sources":["../../src/lib/actions/perform_action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAS,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGN,KAAK,YAAY,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAOtC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EAGvB,MAAM,oBAAoB,CAAC;AAkB5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAgC,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAInE;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,kEAAkE;IAClE,MAAM,EAAE,SAAS,CAAC;IAClB,qGAAqG;IACrG,UAAU,EAAE,OAAO,CAAC;IACpB,sDA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AkE;IAClE,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,uEAAuE;IACvE,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;CAChD;AAED;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAC9B;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhG;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAC1B,OAAO,kBAAkB,EACzB,MAAM,iBAAiB,KACrB,OAAO,CAAC,mBAAmB,CAgM7B,CAAC;AAyDF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GACnC,OAAO,SAAS,EAChB,QAAQ,aAAa,CAAC,WAAW,CAAC,EAClC,QAAQ,OAAO,KACb,kBAOF,CAAC;AA2EF;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,GAC1C,2BAA2B,aAAa,CAAC,MAAM,CAAC,KAC9C,kBAIA,CAAC;AAqEJ,0FAA0F;AAC1F,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,GACnC,IAAI,gBAAgB,EACpB,QAAQ,mBAAmB,EAC3B,QAAQ,MAAM,EACd,KAAK,MAAM,KACT,sBAkBF,CAAC"}
@@ -118,7 +118,7 @@ export const perform_action = async (input, deps) => {
118
118
  result = await apply_authorization_phase({ db }, account, action_auth, read_acting(action_auth, raw_params));
119
119
  }
120
120
  catch (err) {
121
- return thrown_error_result(err, `authorization phase error: ${spec.method}`, log);
121
+ return thrown_error_result(err, `authorization phase error: ${spec.method}`, log, signal);
122
122
  }
123
123
  if (!result.ok) {
124
124
  // an account removed since its credential was read: the dead
@@ -240,16 +240,30 @@ export const perform_action = async (input, deps) => {
240
240
  return await dispatch_with_post_commit_rollback(post_commit_effects, () => use_transaction ? db.transaction((tx) => execute(tx)) : execute(db));
241
241
  }
242
242
  catch (err) {
243
- return thrown_error_result(err, `unhandled action handler error: ${spec.method}`, log);
243
+ return thrown_error_result(err, `unhandled action handler error: ${spec.method}`, log, signal);
244
244
  }
245
245
  };
246
246
  /**
247
247
  * The dispatcher's answer to a thrown value: the JSON-RPC error it carries
248
248
  * (`to_thrown_jsonrpc_error` — a `ThrownJsonrpcError` from any copy of
249
- * fuz_app, or a failed pool checkout's `service_unavailable`), else a logged,
250
- * masked `internal_error`.
249
+ * fuz_app, or a failed pool checkout's `service_unavailable`); else, once the
250
+ * request's `signal` has aborted, `request_cancelled`, since nobody is waiting
251
+ * on the answer; else a logged, masked `internal_error`.
252
+ *
253
+ * A throw after the abort is logged by what it is. The cancellation itself
254
+ * (`is_cancellation`: the signal's own reason, or an `AbortError`) is the
255
+ * handler bailing as it should, at debug. Any other throw may be a genuine
256
+ * fault that happened to land after the cancel, so it is logged at warn:
257
+ * visible, but not an error line, since its caller has gone. A handler that
258
+ * bails on a cancel throws the cancellation (`ctx.signal.throwIfAborted()`) or
259
+ * `jsonrpc_errors.request_cancelled`.
260
+ *
261
+ * **Twin difference:** the Rust dispatcher answers a handler's `Err` as it is,
262
+ * so a Rust handler that returns `internal_error` after its cancel answers
263
+ * `internal_error`, logged at error where it was built (`actions/CLAUDE.md`
264
+ * §Errors).
251
265
  */
252
- const thrown_error_result = (err, context, log) => {
266
+ const thrown_error_result = (err, context, log, signal) => {
253
267
  const thrown = to_thrown_jsonrpc_error(err);
254
268
  if (thrown) {
255
269
  // a failed checkout is the server's to see, though the caller gets the 503
@@ -261,6 +275,15 @@ const thrown_error_result = (err, context, log) => {
261
275
  error: thrown
262
276
  };
263
277
  }
278
+ if (signal.aborted) {
279
+ if (is_cancellation(err, signal)) {
280
+ log.debug(`${context}: the request was cancelled`, err);
281
+ }
282
+ else {
283
+ log.warn(`${context} after its request was cancelled`, err);
284
+ }
285
+ return error_result(jsonrpc_error_messages.request_cancelled());
286
+ }
264
287
  log.error(context, err);
265
288
  // Raw exception messages can leak internals (paths, SQL, secrets in a
266
289
  // message) — surface them only in development; production falls back to
@@ -285,6 +308,14 @@ export const to_invalid_params_error = (input, issues, params) => {
285
308
  const issues_data = dev_only(() => ({ issues: to_wire_issues(issues) }));
286
309
  return jsonrpc_error_messages.invalid_params('invalid params', reason === undefined ? issues_data : { reason, ...issues_data });
287
310
  };
311
+ /**
312
+ * Whether a throw is the request's cancellation itself: the aborted signal's
313
+ * own reason (what `signal.throwIfAborted()` and a `fetch` given the signal
314
+ * reject with), or any `AbortError` (a `DOMException` from an API that names
315
+ * no reason).
316
+ */
317
+ const is_cancellation = (err, signal) => err === signal.reason ||
318
+ (typeof err === 'object' && err !== null && err.name === 'AbortError');
288
319
  const error_result = (error) => ({
289
320
  kind: 'error',
290
321
  error,
@@ -274,13 +274,20 @@ export interface RegisterActionWsOptions {
274
274
  */
275
275
  on_effect_error?: (error: unknown, context: EffectErrorContext) => void;
276
276
  /**
277
- * Where each message accepted for dispatch is held, from acceptance until
278
- * its handler has returned and its effect flush — run after the reply is
279
- * sent, so nothing else holds it — has settled. `create_app_server` passes
280
- * its view of `deps.request_tracker` (`create_request_tracker_view`), which
281
- * its HTTP requests share, so `AppServer.close` waits for a message as it
282
- * does a request. A message the tracker refuses (once closed) is answered
283
- * `service_unavailable` (`WS_SHUTTING_DOWN_MESSAGE`) and never dispatched.
277
+ * Where each socket's open and each message accepted for dispatch are
278
+ * held. The open — admission's credential re-read, `on_socket_open`, and
279
+ * the start of the queued frames' dispatch — is held from before the
280
+ * pending registration until it ends, on every path; a message from
281
+ * acceptance until its handler has returned and its effect flush — run
282
+ * after the reply is sent, so nothing else holds it — has settled.
283
+ * `create_app_server` passes its view of `deps.request_tracker`
284
+ * (`create_request_tracker_view`), which its HTTP requests share, so
285
+ * `AppServer.close` waits for an upgrade's re-read and a message as it
286
+ * does a request, and the database never closes under either within the
287
+ * drain bound. An open the closed tracker refuses holds nothing (under
288
+ * `AppServer.close` the registry closed first, so it is born closed); a message it refuses is
289
+ * answered `service_unavailable` (`WS_SHUTTING_DOWN_MESSAGE`) and never
290
+ * dispatched.
284
291
  * Required, so it can't be forgotten: a hand mount passes
285
292
  * `deps.request_tracker` (or one it drains before closing the database), or
286
293
  * `null` when it owns its shutdown otherwise (a test harness).
@@ -1 +1 @@
1
- {"version":3,"file":"register_action_ws.d.ts","sourceRoot":"","sources":["../../src/lib/actions/register_action_ws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAU,KAAK,MAAM,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAS5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAOvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAGN,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAEtB,MAAM,wBAAwB,CAAC;AAEhC;;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IACrD,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE;;;;;;;;OAQG;IACH,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C;;;;;;OAMG;IACH,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD;;;;;;;;;;;OAWG;IACH,mBAAmB,EAAE,kBAAkB,CAAC;IACxC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACxE;;;;;;;;;;;;;;;;;;OAkBG;IACH,eAAe,EAAE,cAAc,GAAG,IAAI,CAAC;CACvC;AAED,sCAAsC;AACtC,MAAM,WAAW,sBAAsB;IACtC,wEAAwE;IACxE,QAAQ,EAAE,kBAAkB,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,uBAAuB,KAAG,sBAyLrE,CAAC"}
@@ -67,9 +67,22 @@
67
67
  * `close_all_connections`) a refusal is `WS_CLOSE_GOING_AWAY` instead, so the
68
68
  * client reconnects rather than treating its credential as revoked: an upgrade
69
69
  * pending at the close-all is closed by it — and its abort makes the refusal
70
- * that follows the re-read send nothing more, even when the database closed
71
- * under that re-read — and one that registers after it is born closed and
72
- * skips the re-read (`ConnectionRegistry` module doc, "Shutdown").
70
+ * that follows the re-read send nothing more — and one that registers after
71
+ * it is born closed and skips the re-read (`ConnectionRegistry` module doc,
72
+ * "Shutdown").
73
+ *
74
+ * The open — admission with its re-read, `on_socket_open`, and the start of
75
+ * the queued frames' dispatch — is held on the `request_tracker` from before
76
+ * the pending registration until each queued frame has taken its own hold,
77
+ * on every path out (a refusal, a failed re-read, a hook that throws). So
78
+ * `AppServer.close` waits for a re-read the shutdown lands in, and the
79
+ * database closes after it, not under it — as the Rust spine's upgrade hold
80
+ * does, though that one lasts through the socket's close write
81
+ * (`http/CLAUDE.md` §Pending Effects). An `on_socket_open` that never returns holds
82
+ * the shutdown to `shutdown_drain_timeout_ms`; past that bound a re-read the
83
+ * closing database fails is still refused with nothing more sent. A tracker
84
+ * already closed holds nothing: under `AppServer.close` the registry closed
85
+ * first, so such an upgrade is born closed.
73
86
  *
74
87
  * Frames that arrive before admission are queued, not dispatched: nothing runs
75
88
  * on a credential that has not been re-read. They dispatch in arrival order
@@ -290,7 +303,7 @@ export interface WsSocketEndpoint {
290
303
  notification_sender: NotificationSender;
291
304
  /** Called when an eager pending effect of a frame's action rejects; `undefined` for none. */
292
305
  on_effect_error: ((error: unknown, context: EffectErrorContext) => void) | undefined;
293
- /** Where each message accepted for dispatch is held until its flush settles; `null` for nowhere. */
306
+ /** Where each socket's open (admission, `on_socket_open`) and each message accepted for dispatch are held, a message until its flush settles; `null` for nowhere. */
294
307
  request_tracker: RequestTracker | null;
295
308
  /** Roles the endpoint's upgrade is gated on; empty for an ungated endpoint. */
296
309
  required_roles: ReadonlyArray<RoleName>;
@@ -1 +1 @@
1
- {"version":3,"file":"ws_socket_session.d.ts","sourceRoot":"","sources":["../../src/lib/actions/ws_socket_session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4GG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,M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,qKAAqK;IACrK,eAAe,EAAE,cAAc,GAAG,IAAI,CAAC;IACvC,+EAA+E;IAC/E,cAAc,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;CACxC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC/B,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,mGAAmG;IACnG,cAAc,EAAE;QAAE,eAAe,EAAE,cAAc,GAAG,IAAI,CAAA;KAAE,GAAG,SAAS,CAAC;IACvE;;;;OAIG;IACH,QAAQ,EAAE,YAAY,CAAC;IACvB,gGAAgG;IAChG,eAAe,EAAE,cAAc,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GACnC,UAAU,gBAAgB,EAC1B,SAAS,eAAe,KACtB,QAwrBF,CAAC"}
@@ -67,9 +67,22 @@
67
67
  * `close_all_connections`) a refusal is `WS_CLOSE_GOING_AWAY` instead, so the
68
68
  * client reconnects rather than treating its credential as revoked: an upgrade
69
69
  * pending at the close-all is closed by it — and its abort makes the refusal
70
- * that follows the re-read send nothing more, even when the database closed
71
- * under that re-read — and one that registers after it is born closed and
72
- * skips the re-read (`ConnectionRegistry` module doc, "Shutdown").
70
+ * that follows the re-read send nothing more — and one that registers after
71
+ * it is born closed and skips the re-read (`ConnectionRegistry` module doc,
72
+ * "Shutdown").
73
+ *
74
+ * The open — admission with its re-read, `on_socket_open`, and the start of
75
+ * the queued frames' dispatch — is held on the `request_tracker` from before
76
+ * the pending registration until each queued frame has taken its own hold,
77
+ * on every path out (a refusal, a failed re-read, a hook that throws). So
78
+ * `AppServer.close` waits for a re-read the shutdown lands in, and the
79
+ * database closes after it, not under it — as the Rust spine's upgrade hold
80
+ * does, though that one lasts through the socket's close write
81
+ * (`http/CLAUDE.md` §Pending Effects). An `on_socket_open` that never returns holds
82
+ * the shutdown to `shutdown_drain_timeout_ms`; past that bound a re-read the
83
+ * closing database fails is still refused with nothing more sent. A tracker
84
+ * already closed holds nothing: under `AppServer.close` the registry closed
85
+ * first, so such an upgrade is born closed.
73
86
  *
74
87
  * Frames that arrive before admission are queued, not dispatched: nothing runs
75
88
  * on a credential that has not been re-read. They dispatch in arrival order
@@ -389,9 +402,10 @@ export const create_ws_socket_events = (endpoint, upgrade) => {
389
402
  recheck = await recheck_admission({ db }, { resolved, request_context: upgrade_context, required_roles });
390
403
  }
391
404
  catch (error) {
392
- // fail closed — never admitted unchecked. During shutdown the
393
- // database may close under the re-read; that is the shutdown's
394
- // refusal, not a failure.
405
+ // fail closed — never admitted unchecked. A shutdown that gave
406
+ // up on the held re-read at its drain bound may close the
407
+ // database under it; that is the shutdown's refusal, not a
408
+ // failure.
395
409
  if (registry.is_closing()) {
396
410
  log.info('ws upgrade admission: re-check ended by the shutdown', error);
397
411
  }
@@ -438,7 +452,25 @@ export const create_ws_socket_events = (endpoint, upgrade) => {
438
452
  was_admitted = true;
439
453
  return connection_id;
440
454
  };
455
+ // Admit the socket, run `on_socket_open`, and start the queued frames'
456
+ // dispatch, held on the tracker throughout (module doc, "Admission: the
457
+ // revocation race").
441
458
  const open_socket = async (ws) => {
459
+ // Synchronously, before the pending registration: a shutdown that
460
+ // starts while the re-read or the hook runs waits for both, so the
461
+ // database never closes under them. A closed tracker answers `null`
462
+ // and holds nothing — under `AppServer.close` the registry closed
463
+ // first, so the registration below is born closed and reads nothing.
464
+ const held = request_tracker?.accept() ?? null;
465
+ try {
466
+ await admit_and_open(ws);
467
+ }
468
+ finally {
469
+ // each queued frame's dispatch has taken its own hold by now
470
+ held?.finish(null);
471
+ }
472
+ };
473
+ const admit_and_open = async (ws) => {
442
474
  const connection_id = await admit_upgrade(ws);
443
475
  if (connection_id === null)
444
476
  return;
@@ -511,7 +543,9 @@ export const create_ws_socket_events = (endpoint, upgrade) => {
511
543
  json = parse_json_text(String(data));
512
544
  }
513
545
  catch (error) {
514
- log.error('JSON parse error:', error);
546
+ // a client's malformed frame is its own fault, answered `parse_error`: debug, as the
547
+ // HTTP RPC endpoint and the Rust spine log nothing for it
548
+ log.debug('JSON parse error:', error);
515
549
  send_error(null, jsonrpc_error_messages.parse_error());
516
550
  return;
517
551
  }
@@ -252,8 +252,10 @@ cannot disagree.
252
252
 
253
253
  One class order in every transaction — accounts, then offers, then grants and
254
254
  actors — and id order within a class. Every writer of an account takes its row
255
- first (two mints of one account take turns there, so the caps hold); a
256
- multi-row write locks its rows in one id-ordered statement before writing.
255
+ first (two mints of one account take turns there, so the caps hold) — a
256
+ delete and a purge after their last-admin guard, which an admin target's row
257
+ is locked within, then the guards again; a multi-row write locks its rows in
258
+ one id-ordered statement before writing.
257
259
  Each lock's strength and reason is on its query's TSDoc; the rule set:
258
260
  ../../../docs/security.md §Row Locks. `lock_pins.cross.test.ts` pins them on
259
261
  both spines (../../test/CLAUDE.md).
@@ -409,9 +411,13 @@ a mounting surface; protocol specs excluded.
409
411
  notified), deletes the unclaimed invites it issued, revokes its sessions and
410
412
  tokens, and writes the account row plus one per actor. Delete keeps the role
411
413
  grants, inert; purge is the keeper-only cascading delete with
412
- `confirm: true`. The target guards (never a keeper account, never the last
413
- active admin) and what an undelete restores are ../../../docs/security.md
414
- §Authorization.
414
+ `confirm: true`, taking the purge advisory lock first
415
+ (`query_account_purge_advisory_lock`) and running its guards again under
416
+ its row lock (`query_account_lock_for_purge`), and its cascade leaves the
417
+ provenance stamps (`granted_by`, `revoked_by`, `source_offer_id`, the
418
+ actor's) naming the purged ids. The target guards (never a keeper account,
419
+ never the last active admin) and what an undelete restores are
420
+ ../../../docs/security.md §Authorization.
415
421
  - **Failure rows on a miss.** `admin_session_revoke_all`,
416
422
  `admin_token_revoke_all`, account delete / purge and `invite_delete` write
417
423
  a failure row on a missing target, the probed id in metadata
@@ -550,8 +556,11 @@ a call. Caps and limits are on the spec modules.
550
556
  `auth/cleanup.ts`, twin of the Rust `fuz_auth::auth_cleanup`:
551
557
  `run_auth_cleanup` (one pass — the session sweep, which closes the swept
552
558
  sessions' connections, then the offer-expiry sweep, audited exactly once)
553
- and `start_auth_cleanup` (scheduled on `start_periodic`, `periodic.ts`). Off
554
- by default in `create_app_server`; run it in the process that holds the
555
- connections, never from another process against a live server's database.
556
- The rules are the module TSDoc and `periodic.ts`'s (whose `stop()` differs
559
+ and `start_auth_cleanup` (scheduled on `start_periodic`, `periodic.ts`).
560
+ `create_app_server`'s `auth_cleanup` is required, an `AuthCleanupSchedule`
561
+ (`{every_ms}` or `'off'`, twin of the Rust `fuz_auth::AuthCleanupSchedule`);
562
+ `AppServer.close` waits for a pass in progress within its drain bound and
563
+ counts one still running at the bound (`ShutdownDrainGivenUp.upkeep`). Run it
564
+ in the process that holds the connections, never from another process
565
+ against a live server's database. The rules are the module TSDoc and `periodic.ts`'s (whose `stop()` differs
557
566
  from the Rust shutdown); wiring is ../../../docs/usage.md §Auth cleanup.
@@ -89,11 +89,17 @@ export declare const query_account_by_username_or_email: (deps: QueryDeps, input
89
89
  * Pass the same hash the verify ran against — typically
90
90
  * `ctx.account.password_hash` from the request context.
91
91
  *
92
+ * A tombstoned account matches nothing either: a delete can commit between
93
+ * the authorization and the UPDATE, and a waiting UPDATE rereads the row the
94
+ * delete committed, so the change never lands on a deleted account. Twin of
95
+ * the Rust `query_update_account_password`.
96
+ *
92
97
  * @returns `true` if the row was updated, `false` if `expected_hash` no
93
98
  * longer matched (concurrent change won — caller should treat as a
94
- * stale-credential failure).
99
+ * stale-credential failure) or the account is deleted.
95
100
  * @mutates `account` row - updates `password_hash`, `updated_at`, and
96
- * `updated_by` only when the stored hash equals `expected_hash`
101
+ * `updated_by` only when the account is live and its stored hash equals
102
+ * `expected_hash`
97
103
  */
98
104
  export declare const query_update_account_password: (deps: QueryDeps, id: string, password_hash: string, updated_by: string | null, expected_hash: string) => Promise<boolean>;
99
105
  /**
@@ -150,43 +156,48 @@ export declare const query_account_lock_verified: (deps: QueryDeps, id: string,
150
156
  * cap — `query_account_lock_verified` has why, and what it conflicts with; a
151
157
  * token mint and a login of one account take turns too. A write that only
152
158
  * needs ordering against a delete takes `query_account_lock_live_many`, which
153
- * lets such writes run together. Twin of the Rust
159
+ * lets such writes run together. A delete takes it too, after its last-admin
160
+ * guard and before the guards' second pass (`account_delete` in
161
+ * `admin_actions.ts`): the guard reads whether the target is an admin
162
+ * unlocked. And `self_service_role_set` takes it first, so a toggle is refused
163
+ * on a removed account, or a removal waits for it. Twin of the Rust
154
164
  * `fuz_auth::query_account_lock_live`.
155
165
  *
156
- * @param deps - query dependencies (must be the mint's transaction)
157
- * @param id - the account the credential is for
166
+ * @param deps - query dependencies (must be the mint's, the delete's, or the toggle's transaction)
167
+ * @param id - the account the credential is for, or the account the delete removes
158
168
  * @returns `true` when the row is locked and not tombstoned, `false` when it was deleted or tombstoned
159
169
  */
160
170
  export declare const query_account_lock_live: (deps: QueryDeps, id: string) => Promise<boolean>;
161
171
  /**
162
- * Lock, for a purge, the account rows of every holder of an unrevoked global
163
- * `admin` grant and the purged account's own, in one statement, in id order,
164
- * `FOR NO KEY UPDATE`.
172
+ * The key of the advisory lock every purge takes
173
+ * (`query_account_purge_advisory_lock`): the ASCII of `fuz_` and `purg`.
165
174
  *
166
- * A purge's cascade writes rows of other accounts: it sets null the
167
- * `granted_by` and `revoked_by` of every grant the purged account's actors
168
- * named, admins' grants among them, in whatever order the plan walks them. A
169
- * last-admin guard of another removal takes admin accounts, actors and grants
170
- * in account-id order. A purge reaching an admin's grant before the guard does
171
- * and waiting on one the guard took could hold a row the guard waits on.
172
- * Holding every admin's account first, in the order the guard and
173
- * `query_account_lock_live_many` take account rows, another guard waits at its
174
- * first account holding nothing, and two purges take turns. The purged
175
- * account's row is taken in the same statement, so an offer create holding one
176
- * of these rows `FOR SHARE` and waiting on another meets them in the same order.
177
- * No `deleted_at` filter on either: a tombstoned admin's grant is written by
178
- * the cascade as well, and a purge removes a tombstoned account. The admins
179
- * are those the statement's snapshot sees; one made by a transaction that
180
- * commits after it starts is not among them. Cost: a purge waits behind
181
- * admins' logins, token creates and offers. Run first in the purge's
182
- * transaction, before the last-admin guard (an admin target's only) and
183
- * `query_account_lock_for_purge`.
184
- * Twin of the Rust `fuz_auth::account_queries::query_account_lock_admins_for_purge`.
175
+ * The two-`int4` form, `pg_advisory_xact_lock(int4, int4)`, a key space apart
176
+ * from the single-key form the migration runner's per-namespace
177
+ * `pg_advisory_lock(int4)` takes, so no namespace's hash can collide with it.
178
+ * Twin of the Rust `fuz_auth::account_queries::ACCOUNT_PURGE_ADVISORY_LOCK_KEY`.
179
+ */
180
+ export declare const ACCOUNT_PURGE_ADVISORY_LOCK_KEY: readonly [number, number];
181
+ /**
182
+ * Take, for a purge, the transaction-scoped advisory lock every purge takes,
183
+ * so two purges take turns.
184
+ *
185
+ * Two purges' cascades write rows both reach — the offers each account made to
186
+ * the other, accepted and declined as well as pending, and the invites each
187
+ * issued and the other claimed — in whatever order their plans walk them, and
188
+ * no row lock a purge takes ahead of its cascade covers every such row. Held
189
+ * from the purge's first statement, the lock makes a second purge wait before
190
+ * it holds any row. Only purges take it, and a purge takes it holding nothing,
191
+ * so it orders purges against each other and nothing else: every other writer
192
+ * meets a purge at the rows it locks after this — the last-admin guard's (an
193
+ * admin target's only), its account row (`query_account_lock_for_purge`), its
194
+ * offers. Released when the transaction ends. Run first in the purge's
195
+ * transaction. Twin of the Rust
196
+ * `fuz_auth::account_queries::query_account_purge_advisory_lock`.
185
197
  *
186
198
  * @param deps - query dependencies (must be the purge's transaction)
187
- * @param id - the account to purge
188
199
  */
189
- export declare const query_account_lock_admins_for_purge: (deps: QueryDeps, id: string) => Promise<void>;
200
+ export declare const query_account_purge_advisory_lock: (deps: QueryDeps) => Promise<void>;
190
201
  /**
191
202
  * Lock the account row of a revoke's revokee, by its actor, tombstoned or not,
192
203
  * `FOR NO KEY UPDATE`.
@@ -222,10 +233,13 @@ export declare const query_account_lock_for_revoke: (deps: QueryDeps, actor_id:
222
233
  * takes anyway: it conflicts with every other lock on the row, so a writer
223
234
  * holding one is waited out, and a writer arriving later waits for the purge
224
235
  * and then finds no row. No `deleted_at` filter — a purge removes a tombstoned
225
- * account too. Run after `query_account_lock_admins_for_purge`, which takes the
226
- * row `FOR NO KEY UPDATE` among every admin's in id order, and, for an admin
227
- * target, the last-admin guard, so this only strengthens a lock the purge
228
- * already holds. Twin of the Rust
236
+ * account too. Run after `query_account_purge_advisory_lock` and, for an admin
237
+ * target, the last-admin guard, which takes the row `FOR NO KEY UPDATE` among
238
+ * every admin's in id order, so for an admin this only strengthens a lock the
239
+ * purge already holds. The guards run again after it: they read whether the
240
+ * target is an admin unlocked, and a non-admin target's row is the first the
241
+ * purge holds of it, so an accept making it an admin commits before this lock
242
+ * is granted. Twin of the Rust
229
243
  * `fuz_auth::account_queries::query_account_lock_for_purge`.
230
244
  *
231
245
  * @param deps - query dependencies (must be the purge's transaction)
@@ -273,7 +287,7 @@ export declare const query_account_lock_live_many: (deps: QueryDeps, ids: Readon
273
287
  * by one recipient take turns, and the second claims after the first has
274
288
  * superseded its siblings. It conflicts with a delete's or a purge's first
275
289
  * write of the account (the soft-delete `UPDATE`,
276
- * `query_account_lock_admins_for_purge`, the last-admin guard), so a removal of
290
+ * `query_account_lock_for_purge`, the last-admin guard), so a removal of
277
291
  * the recipient waits here or is waited for whole, and never meets the accept
278
292
  * at its offers or its actor; with a revoke's `query_account_lock_for_revoke`,
279
293
  * so a revoke of the recipient's grant and the accept take turns; and with
@@ -285,12 +299,11 @@ export declare const query_account_lock_live_many: (deps: QueryDeps, ids: Readon
285
299
  * unlocked read after this one): every write that ends a grantor's global
286
300
  * `admin` takes the grantor's account row first — a revoke of the grant through
287
301
  * `query_account_lock_for_revoke` (whether or not its last-admin guard ran), a
288
- * delete through its write of the row, a purge through
289
- * `query_account_lock_admins_for_purge` and `query_account_lock_for_purge` — so
290
- * it either commits before the read, which sees it, or waits for the accept to
291
- * commit. A share lock on the account,
292
- * not on the grant, so a purge's cascade reaching the grant (its `granted_by`
293
- * naming an actor of the purged account) never waits on the accept.
302
+ * delete through its write of the row, a purge through the last-admin guard
303
+ * and `query_account_lock_for_purge` — so it either commits before the read,
304
+ * which sees it, or waits for the accept to commit. A share lock on the
305
+ * account, not on the grant: every removal takes the account first, so it
306
+ * waits there holding nothing the accept needs.
294
307
  *
295
308
  * Two statements, as the two strengths can't share one locking clause, the
296
309
  * lower id first — the order the last-admin guard
@@ -1 +1 @@
1
- {"version":3,"file":"account_queries.d.ts","sourceRoot":"","sources":["../../src/lib/auth/account_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQrD,OAAO,EAEN,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,MAAM,qBAAqB,CAAC;AAM7B;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,6JAYqB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,aAAa,6GASqB,CAAC;AAehD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAChC,MAAM,SAAS,EACf,OAAO,kBAAkB,KACvB,OAAO,CAAC,OAAO,CAQjB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAC/B,MAAM,SAAS,EACf,IAAI,MAAM,KACR,OAAO,CAAC,OAAO,GAAG,SAAS,CAK7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,GACrC,MAAM,SAAS,EACf,UAAU,MAAM,KACd,OAAO,CAAC,OAAO,GAAG,SAAS,CAK7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,SAAS,EACf,OAAO,MAAM,KACX,OAAO,CAAC,OAAO,GAAG,SAAS,CAK7B,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,kCAAkC,GAC9C,MAAM,SAAS,EACf,OAAO,MAAM,KACX,OAAO,CAAC,OAAO,GAAG,SAAS,CAS7B,CAAC;AAEF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