@fuzdev/fuz_app 0.181.0 → 0.183.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/README.md +2 -0
  2. package/dist/actions/CLAUDE.md +28 -10
  3. package/dist/actions/action_rpc.d.ts +11 -1
  4. package/dist/actions/action_rpc.d.ts.map +1 -1
  5. package/dist/actions/action_rpc.js +3 -2
  6. package/dist/actions/action_types.d.ts +16 -1
  7. package/dist/actions/action_types.d.ts.map +1 -1
  8. package/dist/actions/action_types.js +1 -1
  9. package/dist/actions/notification_sender.d.ts +83 -0
  10. package/dist/actions/notification_sender.d.ts.map +1 -0
  11. package/dist/actions/notification_sender.js +85 -0
  12. package/dist/actions/perform_action.d.ts +9 -0
  13. package/dist/actions/perform_action.d.ts.map +1 -1
  14. package/dist/actions/perform_action.js +22 -13
  15. package/dist/actions/register_action_ws.d.ts +14 -0
  16. package/dist/actions/register_action_ws.d.ts.map +1 -1
  17. package/dist/actions/register_action_ws.js +3 -2
  18. package/dist/actions/ws_socket_session.d.ts +3 -0
  19. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  20. package/dist/actions/ws_socket_session.js +2 -1
  21. package/dist/auth/CLAUDE.md +113 -70
  22. package/dist/auth/account_actions.d.ts.map +1 -1
  23. package/dist/auth/account_actions.js +13 -3
  24. package/dist/auth/account_queries.d.ts +158 -16
  25. package/dist/auth/account_queries.d.ts.map +1 -1
  26. package/dist/auth/account_queries.js +189 -18
  27. package/dist/auth/account_routes.d.ts +6 -4
  28. package/dist/auth/account_routes.d.ts.map +1 -1
  29. package/dist/auth/account_routes.js +98 -92
  30. package/dist/auth/admin_actions.d.ts.map +1 -1
  31. package/dist/auth/admin_actions.js +93 -45
  32. package/dist/auth/api_token_queries.d.ts +13 -5
  33. package/dist/auth/api_token_queries.d.ts.map +1 -1
  34. package/dist/auth/api_token_queries.js +24 -9
  35. package/dist/auth/audit_emitter.d.ts +75 -84
  36. package/dist/auth/audit_emitter.d.ts.map +1 -1
  37. package/dist/auth/audit_emitter.js +83 -71
  38. package/dist/auth/audit_log_schema.d.ts +10 -5
  39. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  40. package/dist/auth/audit_log_schema.js +22 -6
  41. package/dist/auth/bearer_auth.d.ts.map +1 -1
  42. package/dist/auth/bearer_auth.js +3 -2
  43. package/dist/auth/bootstrap_account.d.ts +31 -13
  44. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  45. package/dist/auth/bootstrap_account.js +34 -15
  46. package/dist/auth/bootstrap_routes.d.ts +1 -1
  47. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  48. package/dist/auth/bootstrap_routes.js +7 -14
  49. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  50. package/dist/auth/daemon_token_middleware.js +12 -1
  51. package/dist/auth/deps.d.ts +18 -5
  52. package/dist/auth/deps.d.ts.map +1 -1
  53. package/dist/auth/deps.js +3 -2
  54. package/dist/auth/request_context.d.ts +73 -73
  55. package/dist/auth/request_context.d.ts.map +1 -1
  56. package/dist/auth/request_context.js +78 -96
  57. package/dist/auth/resolved_auth.d.ts +16 -11
  58. package/dist/auth/resolved_auth.d.ts.map +1 -1
  59. package/dist/auth/resolved_auth.js +6 -6
  60. package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
  61. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  62. package/dist/auth/role_grant_offer_action_specs.js +2 -1
  63. package/dist/auth/role_grant_offer_actions.d.ts +32 -12
  64. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  65. package/dist/auth/role_grant_offer_actions.js +91 -116
  66. package/dist/auth/role_grant_offer_notifications.d.ts +87 -38
  67. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  68. package/dist/auth/role_grant_offer_notifications.js +75 -22
  69. package/dist/auth/role_grant_offer_queries.d.ts +155 -18
  70. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  71. package/dist/auth/role_grant_offer_queries.js +262 -73
  72. package/dist/auth/role_grant_offer_schema.js +1 -1
  73. package/dist/auth/role_grant_queries.d.ts +43 -52
  74. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  75. package/dist/auth/role_grant_queries.js +50 -74
  76. package/dist/auth/role_grant_sql.d.ts +21 -0
  77. package/dist/auth/role_grant_sql.d.ts.map +1 -1
  78. package/dist/auth/role_grant_sql.js +21 -0
  79. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  80. package/dist/auth/self_service_role_actions.js +17 -21
  81. package/dist/auth/session_queries.d.ts +40 -16
  82. package/dist/auth/session_queries.d.ts.map +1 -1
  83. package/dist/auth/session_queries.js +68 -29
  84. package/dist/auth/signup_routes.d.ts.map +1 -1
  85. package/dist/auth/signup_routes.js +90 -38
  86. package/dist/auth/standard_rpc_actions.d.ts +6 -19
  87. package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
  88. package/dist/auth/standard_rpc_actions.js +5 -6
  89. package/dist/auth/token_scope.d.ts +1 -1
  90. package/dist/auth/token_scope.js +1 -1
  91. package/dist/db/sql_columns.d.ts +1 -1
  92. package/dist/db/sql_columns.js +1 -1
  93. package/dist/http/CLAUDE.md +22 -16
  94. package/dist/http/auth_shape.d.ts +1 -1
  95. package/dist/http/db_routes.d.ts +7 -22
  96. package/dist/http/db_routes.d.ts.map +1 -1
  97. package/dist/http/db_routes.js +72 -72
  98. package/dist/http/error_schemas.d.ts +9 -21
  99. package/dist/http/error_schemas.d.ts.map +1 -1
  100. package/dist/http/error_schemas.js +14 -24
  101. package/dist/http/pending_effects.d.ts +42 -4
  102. package/dist/http/pending_effects.d.ts.map +1 -1
  103. package/dist/http/pending_effects.js +34 -4
  104. package/dist/http/route_spec.d.ts +2 -2
  105. package/dist/server/app_backend.d.ts.map +1 -1
  106. package/dist/server/app_backend.js +3 -1
  107. package/dist/server/app_server.d.ts +69 -18
  108. package/dist/server/app_server.d.ts.map +1 -1
  109. package/dist/server/app_server.js +74 -10
  110. package/dist/server/serve_fact_route.d.ts +3 -3
  111. package/dist/server/serve_fact_route.js +12 -12
  112. package/dist/testing/CLAUDE.md +259 -790
  113. package/dist/testing/adversarial_404.d.ts +6 -1
  114. package/dist/testing/adversarial_404.d.ts.map +1 -1
  115. package/dist/testing/adversarial_404.js +38 -17
  116. package/dist/testing/app_server.d.ts +20 -140
  117. package/dist/testing/app_server.d.ts.map +1 -1
  118. package/dist/testing/app_server.js +48 -125
  119. package/dist/testing/audit_drift_guard.d.ts +11 -6
  120. package/dist/testing/audit_drift_guard.d.ts.map +1 -1
  121. package/dist/testing/audit_drift_guard.js +15 -8
  122. package/dist/testing/auth_apps.js +1 -1
  123. package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
  124. package/dist/testing/cross_backend/account_lifecycle.js +43 -0
  125. package/dist/testing/cross_backend/audit_cross_helpers.d.ts +12 -9
  126. package/dist/testing/cross_backend/audit_cross_helpers.d.ts.map +1 -1
  127. package/dist/testing/cross_backend/audit_cross_helpers.js +13 -14
  128. package/dist/testing/cross_backend/capabilities.d.ts +9 -6
  129. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  130. package/dist/testing/cross_backend/capabilities.js +11 -7
  131. package/dist/testing/cross_backend/capability_mounts.d.ts +103 -0
  132. package/dist/testing/cross_backend/capability_mounts.d.ts.map +1 -0
  133. package/dist/testing/cross_backend/capability_mounts.js +423 -0
  134. package/dist/testing/cross_backend/cell_moderate.js +2 -2
  135. package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
  136. package/dist/testing/cross_backend/cell_relations.js +12 -11
  137. package/dist/testing/cross_backend/conformance_principal.d.ts +54 -0
  138. package/dist/testing/cross_backend/conformance_principal.d.ts.map +1 -0
  139. package/dist/testing/cross_backend/conformance_principal.js +283 -0
  140. package/dist/testing/cross_backend/conformance_table.d.ts +2 -50
  141. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  142. package/dist/testing/cross_backend/conformance_table.js +2 -270
  143. package/dist/testing/cross_backend/credential_deadline.d.ts.map +1 -1
  144. package/dist/testing/cross_backend/credential_deadline.js +2 -0
  145. package/dist/testing/cross_backend/credential_wire.d.ts +1 -1
  146. package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -1
  147. package/dist/testing/cross_backend/db_state_diff.d.ts +72 -0
  148. package/dist/testing/cross_backend/db_state_diff.d.ts.map +1 -0
  149. package/dist/testing/cross_backend/db_state_diff.js +444 -0
  150. package/dist/testing/cross_backend/declared_skips.d.ts +68 -0
  151. package/dist/testing/cross_backend/declared_skips.d.ts.map +1 -0
  152. package/dist/testing/cross_backend/declared_skips.js +132 -0
  153. package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -26
  154. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
  155. package/dist/testing/cross_backend/default_spine_surface.js +2 -6
  156. package/dist/testing/cross_backend/differential.d.ts +11 -2
  157. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  158. package/dist/testing/cross_backend/differential.js +35 -11
  159. package/dist/testing/cross_backend/differential_normalize.d.ts +12 -0
  160. package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
  161. package/dist/testing/cross_backend/differential_normalize.js +16 -0
  162. package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -10
  163. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  164. package/dist/testing/cross_backend/full_spine_mount.js +4 -4
  165. package/dist/testing/cross_backend/in_process_setup.d.ts +22 -12
  166. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  167. package/dist/testing/cross_backend/in_process_setup.js +151 -134
  168. package/dist/testing/cross_backend/login_security.d.ts +12 -0
  169. package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
  170. package/dist/testing/cross_backend/login_security.js +21 -4
  171. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +0 -2
  172. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -1
  173. package/dist/testing/cross_backend/request_target_conformance_wire.js +3 -1
  174. package/dist/testing/cross_backend/revocation_drivers.d.ts +18 -5
  175. package/dist/testing/cross_backend/revocation_drivers.d.ts.map +1 -1
  176. package/dist/testing/cross_backend/revocation_drivers.js +18 -10
  177. package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts +1 -1
  178. package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts.map +1 -1
  179. package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
  180. package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +33 -1
  181. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +5 -4
  182. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
  183. package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +183 -30
  184. package/dist/testing/cross_backend/role_grant_participation.js +4 -4
  185. package/dist/testing/cross_backend/rpc_adversarial.js +1 -1
  186. package/dist/testing/cross_backend/session_cap.d.ts +2 -2
  187. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  188. package/dist/testing/cross_backend/session_cap.js +48 -16
  189. package/dist/testing/cross_backend/setup.d.ts +31 -1
  190. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  191. package/dist/testing/cross_backend/setup.js +32 -1
  192. package/dist/testing/cross_backend/spine_suites.d.ts +123 -12
  193. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  194. package/dist/testing/cross_backend/spine_suites.js +454 -57
  195. package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
  196. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  197. package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
  198. package/dist/testing/cross_backend/sse_round_trip.d.ts +9 -1
  199. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  200. package/dist/testing/cross_backend/sse_round_trip.js +123 -27
  201. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  202. package/dist/testing/cross_backend/testing_backdoor.js +4 -2
  203. package/dist/testing/cross_backend/testing_reset_actions.d.ts +59 -27
  204. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  205. package/dist/testing/cross_backend/testing_reset_actions.js +66 -42
  206. package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
  207. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
  208. package/dist/testing/cross_backend/transport_composition.js +7 -3
  209. package/dist/testing/cross_backend/ws_round_trip.d.ts +5 -0
  210. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  211. package/dist/testing/cross_backend/ws_round_trip.js +54 -8
  212. package/dist/testing/data_exposure.d.ts.map +1 -1
  213. package/dist/testing/data_exposure.js +3 -0
  214. package/dist/testing/db.d.ts +0 -32
  215. package/dist/testing/db.d.ts.map +1 -1
  216. package/dist/testing/db.js +0 -86
  217. package/dist/testing/db_entities.d.ts +14 -0
  218. package/dist/testing/db_entities.d.ts.map +1 -1
  219. package/dist/testing/db_entities.js +17 -0
  220. package/dist/testing/db_invariant_queries.d.ts +259 -0
  221. package/dist/testing/db_invariant_queries.d.ts.map +1 -0
  222. package/dist/testing/db_invariant_queries.js +400 -0
  223. package/dist/testing/db_invariants.d.ts +106 -0
  224. package/dist/testing/db_invariants.d.ts.map +1 -0
  225. package/dist/testing/db_invariants.gen.sql.d.ts +11 -0
  226. package/dist/testing/db_invariants.gen.sql.d.ts.map +1 -0
  227. package/dist/testing/db_invariants.gen.sql.js +13 -0
  228. package/dist/testing/db_invariants.js +141 -0
  229. package/dist/testing/db_invariants.sql +152 -0
  230. package/dist/testing/describe_db.d.ts +36 -0
  231. package/dist/testing/describe_db.d.ts.map +1 -0
  232. package/dist/testing/describe_db.js +71 -0
  233. package/dist/testing/integration.d.ts +6 -9
  234. package/dist/testing/integration.d.ts.map +1 -1
  235. package/dist/testing/integration.js +9 -13
  236. package/dist/testing/integration_helpers.d.ts +1 -1
  237. package/dist/testing/integration_helpers.d.ts.map +1 -1
  238. package/dist/testing/middleware.d.ts +1 -1
  239. package/dist/testing/middleware.js +5 -5
  240. package/dist/testing/rate_limiting.d.ts +1 -1
  241. package/dist/testing/rate_limiting.d.ts.map +1 -1
  242. package/dist/testing/rate_limiting.js +3 -2
  243. package/dist/testing/resolved_auth.d.ts +3 -1
  244. package/dist/testing/resolved_auth.d.ts.map +1 -1
  245. package/dist/testing/resolved_auth.js +4 -4
  246. package/dist/testing/role_grant_helpers.d.ts +1 -1
  247. package/dist/testing/role_grant_helpers.d.ts.map +1 -1
  248. package/dist/testing/round_trip.d.ts.map +1 -1
  249. package/dist/testing/round_trip.js +3 -0
  250. package/dist/testing/rpc_attack_surface.d.ts +8 -6
  251. package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
  252. package/dist/testing/rpc_attack_surface.js +69 -6
  253. package/dist/testing/rpc_round_trip.d.ts +1 -1
  254. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  255. package/dist/testing/rpc_round_trip.js +3 -0
  256. package/dist/testing/sse_round_trip.d.ts +1 -1
  257. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  258. package/dist/testing/sse_round_trip.js +13 -4
  259. package/dist/testing/stubs.d.ts +4 -2
  260. package/dist/testing/stubs.d.ts.map +1 -1
  261. package/dist/testing/stubs.js +15 -7
  262. package/dist/testing/test_app.d.ts +166 -0
  263. package/dist/testing/test_app.d.ts.map +1 -0
  264. package/dist/testing/test_app.js +124 -0
  265. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  266. package/dist/testing/ws_round_trip.js +8 -4
  267. package/package.json +1 -1
@@ -11,6 +11,8 @@ import { generate_random_base64url } from '../crypto.js';
11
11
  import { create_session_cookie_value } from './session_cookie.js';
12
12
  import { columns_sql, iso8601_timestamp_expr, qualify_columns } from '../db/sql_columns.js';
13
13
  import { EXPIRES_IN_MS_SQL } from './credential_deadline.js';
14
+ /** The session lifetime in whole seconds, which the insert's interval spells. */
15
+ const AUTH_SESSION_LIFETIME_SECONDS = 30 * 24 * 60 * 60;
14
16
  /**
15
17
  * Session lifetime in milliseconds (30 days).
16
18
  *
@@ -19,7 +21,7 @@ import { EXPIRES_IN_MS_SQL } from './credential_deadline.js';
19
21
  * window renews a leaked cookie forever; see `docs/security.md` §Session
20
22
  * Security). The cookie's `SESSION_AGE_MAX` mirrors this value.
21
23
  */
22
- export const AUTH_SESSION_LIFETIME_MS = 30 * 24 * 60 * 60 * 1000;
24
+ export const AUTH_SESSION_LIFETIME_MS = AUTH_SESSION_LIFETIME_SECONDS * 1000;
23
25
  /**
24
26
  * Hash a session token to its storage key using blake3.
25
27
  *
@@ -41,20 +43,28 @@ export const generate_session_token = () => {
41
43
  return generate_random_base64url();
42
44
  };
43
45
  /**
44
- * Create a new auth session.
46
+ * `AUTH_SESSION_LIFETIME_MS` as the SQL interval the session insert adds to
47
+ * `NOW()` — `INTERVAL '2592000 seconds'`, the Rust spine's literal. Elapsed
48
+ * seconds, not `'30 days'`: a day interval is calendar time in the session's
49
+ * time zone, so a session crossing a DST change would live an hour more or
50
+ * less.
51
+ */
52
+ const AUTH_SESSION_LIFETIME_SQL = `INTERVAL '${AUTH_SESSION_LIFETIME_SECONDS} seconds'`;
53
+ /**
54
+ * Create a new auth session, expiring `AUTH_SESSION_LIFETIME_MS` after the
55
+ * database's `NOW()` — the clock the validity check (`expires_at > NOW()`)
56
+ * reads, and the one `created_at` takes, so the expiry sits a whole lifetime
57
+ * past the row's creation and every session one transaction creates shares
58
+ * it. Twin of the Rust `query_create_session`, same statement.
45
59
  *
46
60
  * @param deps - query dependencies
47
61
  * @param token_hash - blake3 hash of the session token (use `hash_session_token`)
48
62
  * @param account_id - the account this session belongs to
49
- * @param expires_at - when the session expires
50
63
  * @mutates `auth_session` table - inserts a row keyed by `token_hash`
51
64
  */
52
- export const query_create_session = async (deps, token_hash, account_id, expires_at) => {
53
- await deps.db.query(`INSERT INTO auth_session (id, account_id, expires_at) VALUES ($1, $2, $3)`, [
54
- token_hash,
55
- account_id,
56
- expires_at.toISOString()
57
- ]);
65
+ export const query_create_session = async (deps, token_hash, account_id) => {
66
+ await deps.db.query(`INSERT INTO auth_session (id, account_id, expires_at)
67
+ VALUES ($1, $2, NOW() + ${AUTH_SESSION_LIFETIME_SQL})`, [token_hash, account_id]);
58
68
  };
59
69
  /**
60
70
  * The full `auth_session` column set, named explicitly so a row read fails
@@ -147,11 +157,20 @@ export const query_session_revoke_for_account = async (deps, token_hash, account
147
157
  /**
148
158
  * Revoke all sessions for an account.
149
159
  *
160
+ * Locks its rows in id order before it deletes them (`ORDER BY id FOR
161
+ * UPDATE`), as every multi-row delete of `auth_session` rows does — the cap's
162
+ * eviction, the expiry sweep, the revoke-all — so two of them reaching the
163
+ * same rows wait one on the other instead of deadlocking in the opposite
164
+ * orders their plans would otherwise walk. Twin of the Rust
165
+ * `fuz_auth::query_session_revoke_all_for_account`.
166
+ *
150
167
  * @returns the number of sessions revoked
151
168
  * @mutates `auth_session` table - deletes every row for `account_id`
152
169
  */
153
170
  export const query_session_revoke_all_for_account = async (deps, account_id) => {
154
- const rows = await deps.db.query(`DELETE FROM auth_session WHERE account_id = $1 RETURNING id`, [account_id]);
171
+ const rows = await deps.db.query(`DELETE FROM auth_session
172
+ WHERE id IN (SELECT id FROM auth_session WHERE account_id = $1 ORDER BY id FOR UPDATE)
173
+ RETURNING id`, [account_id]);
155
174
  return rows.length;
156
175
  };
157
176
  /**
@@ -166,21 +185,21 @@ export const query_session_list_for_account = async (deps, account_id, limit = 5
166
185
  * Keeps the newest `max_sessions` sessions and deletes the rest.
167
186
  *
168
187
  * Race safety: this function must run inside a transaction alongside the
169
- * INSERT that created the new session. All callers satisfy this requirement:
170
- * - The `account_token_create` RPC handler runs under the dispatcher's
171
- * transaction path because its spec declares `side_effects: true`
172
- * - `POST /login`, `POST /bootstrap` and `POST /signup` manage their own
173
- * transactions and pass the transaction-scoped `deps` to
174
- * `create_capped_session`
188
+ * INSERT that created the new session. Its one caller is
189
+ * `create_capped_session`, which `POST /login`, `POST /bootstrap` and
190
+ * `POST /signup` each run in a transaction of their own.
175
191
  *
176
192
  * The transaction makes one creator's INSERT + enforce_limit pair atomic, but it
177
193
  * does **not** serialize concurrent creators. Under Read Committed, two
178
194
  * transactions can't see each other's uncommitted session row, so each computes
179
195
  * its `OFFSET` eviction against a stale count, each preserves its own row, and
180
- * both commit above `max_sessions`. A transaction is necessary here but not
181
- * sufficient. Closing this needs one serialization point per
182
- * `(account_id, credential_kind)` — a locked parent row or a transaction-scoped
183
- * advisory lock — taken before count/evict/insert.
196
+ * both commit above `max_sessions` — and their two `DELETE`s lock the same old
197
+ * rows in orders the plan picks, so they can deadlock. A transaction is
198
+ * necessary here but not sufficient: a creator for an existing account first
199
+ * takes its account row `FOR NO KEY UPDATE` (`query_account_lock_verified`),
200
+ * which makes the creators of one account take turns, each counting the rows
201
+ * the one before committed. A creator for an account its own transaction just
202
+ * made needs none — no other can reach the account.
184
203
  *
185
204
  * Ordering is `created_at DESC, id DESC`. The `id` leg is a **stability**
186
205
  * tie-breaker, not a recency one: `created_at` defaults to `NOW()`, the
@@ -189,11 +208,17 @@ export const query_session_list_for_account = async (deps, account_id, limit = 5
189
208
  * `OFFSET` may keep a different set on two evaluations of the same rows. `id` is
190
209
  * the blake3 token hash, so the tie-break is arbitrary but deterministic; it
191
210
  * makes the survivors reproducible, it does not make the row just inserted a
192
- * guaranteed survivor. Only the serialization point above does that.
211
+ * guaranteed survivor. Only the account lock above does that.
193
212
  *
194
213
  * Expired-but-unreaped rows count toward the cap (the predicate is `account_id`
195
214
  * alone). Matches the Rust twin `query_session_enforce_limit`.
196
215
  *
216
+ * The victims are locked in id order before the delete (`ORDER BY id FOR
217
+ * UPDATE`), as every multi-row delete of `auth_session` rows locks them: a
218
+ * revoke-all or the expiry sweep reaching the same rows waits on the eviction,
219
+ * or the eviction on it, instead of the two deadlocking in whatever orders
220
+ * their plans walk (`query_session_revoke_all_for_account`).
221
+ *
197
222
  * Deleting a session row does not end the connections it opened: a WebSocket
198
223
  * keeps the authority it resolved at upgrade and an SSE stream never rechecks.
199
224
  * The returned ids are the token hashes those connections are registered
@@ -210,9 +235,14 @@ export const query_session_enforce_limit = async (deps, account_id, max_sessions
210
235
  const rows = await deps.db.query(`DELETE FROM auth_session
211
236
  WHERE id IN (
212
237
  SELECT id FROM auth_session
213
- WHERE account_id = $1
214
- ORDER BY created_at DESC, id DESC
215
- OFFSET $2
238
+ WHERE id IN (
239
+ SELECT id FROM auth_session
240
+ WHERE account_id = $1
241
+ ORDER BY created_at DESC, id DESC
242
+ OFFSET $2
243
+ )
244
+ ORDER BY id
245
+ FOR UPDATE
216
246
  ) RETURNING id`, [account_id, max_sessions]);
217
247
  return rows.map((row) => row.id);
218
248
  };
@@ -252,15 +282,19 @@ export const query_session_list_all_active = async (deps, limit = 200) => {
252
282
  * a concurrent pass gets a disjoint set. Run it in a transaction, as the
253
283
  * caller above does, so the ids are in hand before the delete commits — on a
254
284
  * pool-level `Db` a connection lost on the response leaves the rows deleted
255
- * and their ids unread. Served by `idx_auth_session_expires`. Twin of the
256
- * Rust `query_session_cleanup_expired`.
285
+ * and their ids unread. Served by `idx_auth_session_expires`. The rows are
286
+ * locked in id order before the delete, as every multi-row delete of
287
+ * `auth_session` rows locks them (`query_session_revoke_all_for_account`). Twin
288
+ * of the Rust `query_session_cleanup_expired`.
257
289
  *
258
290
  * @param deps - query dependencies (transaction-scoped, see above)
259
291
  * @returns the deleted sessions' ids (their token hashes), empty when nothing had expired
260
292
  * @mutates `auth_session` table - deletes every row past `expires_at`
261
293
  */
262
294
  export const query_session_cleanup_expired = async (deps) => {
263
- const rows = await deps.db.query(`DELETE FROM auth_session WHERE expires_at <= NOW() RETURNING id`);
295
+ const rows = await deps.db.query(`DELETE FROM auth_session
296
+ WHERE id IN (SELECT id FROM auth_session WHERE expires_at <= NOW() ORDER BY id FOR UPDATE)
297
+ RETURNING id`);
264
298
  return rows.map((row) => row.id);
265
299
  };
266
300
  /**
@@ -276,6 +310,12 @@ export const query_session_cleanup_expired = async (deps) => {
276
310
  * `session` target, as `POST /login` does. A caller that mints for an account
277
311
  * created in the same transaction (signup, bootstrap) evicts nothing.
278
312
  *
313
+ * A caller minting for an existing account first takes its row lock in the
314
+ * same transaction (`query_account_lock_verified`) and refuses on `false`: a
315
+ * password change or a delete in flight is ordered against the mint, and the
316
+ * account's mints take turns, which the cap counts on
317
+ * (`query_session_enforce_limit`).
318
+ *
279
319
  * @returns the signed cookie value and the evicted sessions' token hashes
280
320
  * @mutates `auth_session` table - inserts the new session row (and evicts older rows when `max_sessions` is set)
281
321
  */
@@ -283,8 +323,7 @@ export const create_capped_session = async (options) => {
283
323
  const { keyring, deps, account_id, session_options, max_sessions } = options;
284
324
  const session_token = generate_session_token();
285
325
  const token_hash = hash_session_token(session_token);
286
- const expires_at = new Date(Date.now() + AUTH_SESSION_LIFETIME_MS);
287
- await query_create_session(deps, token_hash, account_id, expires_at);
326
+ await query_create_session(deps, token_hash, account_id);
288
327
  const evicted = max_sessions != null ? await query_session_enforce_limit(deps, account_id, max_sessions) : [];
289
328
  const cookie_value = await create_session_cookie_value(keyring, session_token, session_options);
290
329
  return { cookie_value, evicted };
@@ -1 +1 @@
1
- {"version":3,"file":"signup_routes.d.ts","sourceRoot":"","sources":["../../src/lib/auth/signup_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAG7E,OAAO,EAAoB,KAAK,WAAW,EAA6B,MAAM,oBAAoB,CAAC;AACnG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAOlD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAGnE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,uBAAuB;IAClE;;;;;;;;;OASG;IACH,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,6FAA6F;IAC7F,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAID;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACrC,MAAM,gBAAgB,EACtB,SAAS,kBAAkB,KACzB,KAAK,CAAC,SAAS,CA2NjB,CAAC"}
1
+ {"version":3,"file":"signup_routes.d.ts","sourceRoot":"","sources":["../../src/lib/auth/signup_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAI7E,OAAO,EAAoB,KAAK,WAAW,EAA6B,MAAM,oBAAoB,CAAC;AACnG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAOlD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAGnE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,uBAAuB;IAClE;;;;;;;;;OASG;IACH,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,6FAA6F;IAC7F,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAID;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACrC,MAAM,gBAAgB,EACtB,SAAS,kBAAkB,KACzB,KAAK,CAAC,SAAS,CA2QjB,CAAC"}
@@ -15,6 +15,7 @@ import { query_invite_find_unclaimed_match_for_update, query_invite_claim_unscop
15
15
  import { create_signup_route_shape } from './signup_route_schema.js';
16
16
  import { attach_route_handler } from '../http/route_spec.js';
17
17
  import { route_fail, route_ok } from '../http/route_result.js';
18
+ import { transaction_with_post_commit_rollback } from '../http/pending_effects.js';
18
19
  import { rate_limit_ip_key } from '../http/ip_canonical.js';
19
20
  import { reserve_optional } from '../rate_limiter.js';
20
21
  import { REST_NO_MATCHING_INVITE, REST_RATE_LIMIT_EXCEEDED, REST_SIGNUP_CONFLICT } from '../http/error_schemas.js';
@@ -93,42 +94,88 @@ export const create_signup_route_specs = (deps, options) => {
93
94
  // invite-gated success (which spends an invite), a 5xx, and a
94
95
  // request with no resolved client IP. The per-account limiter
95
96
  // bounds retries of one username only.
96
- const { open_signup } = await query_app_settings_load(route);
97
- // Start the denial-time floor concurrently with failure work.
98
- // Observed response time for 403 / 409 is `max(work, delay)`
99
- // so the cheap `no_match` path (no Argon2, find returns
100
- // nothing) and the expensive `signup_conflict` path (Argon2
101
- // + tx + rollback) converge — closes the username-enumeration
102
- // timing oracle. The same `start_fail_floor` as login. Started
103
- // after rate-limit checks so 429 stays fast.
104
- const delay = start_fail_floor(signup_fail_floor_ms, signup_fail_jitter_ms);
105
- // Hash before the transaction so the connection isn't held
106
- // across the ~100ms Argon2id. Paid on every attempt that gets
107
- // here — bounded as described above.
108
- const password_hash = await password.hash_password(pw);
97
+ //
98
+ // A failure before the transaction (the settings load, the hash,
99
+ // the `BEGIN`) leaves the `internal_error` row Rust's
100
+ // pre-transaction failures write: no `invite_id` (no find has
101
+ // run) and no `open_signup` (the load may be what failed). 5xx
102
+ // is not floored. Both failure-row helpers log an emit that
103
+ // throws rather than throwing, so the answer is always the
104
+ // original error or refusal, never the emit's.
105
+ const log_failure_audit_error = (err) => {
106
+ deps.log.error('signup: the failure audit emit threw:', err);
107
+ };
108
+ const emit_pre_tx_failure_audit = async () => {
109
+ try {
110
+ await deps.audit.emit(route, {
111
+ event_type: 'signup',
112
+ outcome: 'failure',
113
+ ip: route.client_ip,
114
+ metadata: {
115
+ username,
116
+ reason: 'internal_error',
117
+ ...(email != null && { email })
118
+ }
119
+ });
120
+ }
121
+ catch (err) {
122
+ log_failure_audit_error(err);
123
+ }
124
+ };
125
+ let open_signup;
126
+ let password_hash;
127
+ let delay;
128
+ try {
129
+ ({ open_signup } = await query_app_settings_load(route));
130
+ // Start the denial-time floor concurrently with failure work.
131
+ // Observed response time for 403 / 409 is `max(work, delay)`
132
+ // so the cheap `no_match` path (no Argon2, find returns
133
+ // nothing) and the expensive `signup_conflict` path (Argon2
134
+ // + tx + rollback) converge — closes the username-enumeration
135
+ // timing oracle. The same `start_fail_floor` as login. Started
136
+ // after rate-limit checks so 429 stays fast.
137
+ delay = start_fail_floor(signup_fail_floor_ms, signup_fail_jitter_ms);
138
+ // Hash before the transaction so the connection isn't held
139
+ // across the ~100ms Argon2id. Paid on every attempt that gets
140
+ // here — bounded as described above.
141
+ password_hash = await password.hash_password(pw);
142
+ }
143
+ catch (e) {
144
+ await emit_pre_tx_failure_audit();
145
+ throw e;
146
+ }
109
147
  // `invite` is assigned inside the tx by the FOR UPDATE find;
110
148
  // captured at the outer scope so the failure-audit catch
111
149
  // branch can still reference `invite.id` after the tx rolls
112
150
  // back on PG unique violation.
113
151
  let invite;
114
152
  const emit_failure_audit = async (reason) => {
115
- await deps.audit.emit(route, {
116
- event_type: 'signup',
117
- outcome: 'failure',
118
- ip: route.client_ip,
119
- metadata: {
120
- username,
121
- reason,
122
- ...(invite && { invite_id: invite.id }),
123
- ...(email != null && { email }),
124
- ...(open_signup && { open_signup: true })
125
- }
126
- });
153
+ try {
154
+ await deps.audit.emit(route, {
155
+ event_type: 'signup',
156
+ outcome: 'failure',
157
+ ip: route.client_ip,
158
+ metadata: {
159
+ username,
160
+ reason,
161
+ ...(invite && { invite_id: invite.id }),
162
+ ...(email != null && { email }),
163
+ ...(open_signup && { open_signup: true })
164
+ }
165
+ });
166
+ }
167
+ catch (err) {
168
+ log_failure_audit_error(err);
169
+ }
127
170
  };
128
171
  let result;
172
+ // whether the transaction began: a failure before it (the
173
+ // `BEGIN` itself, a pool checkout) is a pre-transaction failure,
174
+ // whose row carries no `open_signup`, as on the Rust spine
175
+ let tx_began = false;
129
176
  try {
130
- result = await route.db.transaction(async (tx) => {
131
- const tx_deps = { db: tx };
177
+ result = await transaction_with_post_commit_rollback(route, async (tx_ctx) => {
178
+ tx_began = true;
132
179
  // Find + claim run inside the same transaction so the
133
180
  // row lock makes them atomic. Concurrent signups for
134
181
  // the same (username, email) tuple block on the lock
@@ -137,12 +184,12 @@ export const create_signup_route_specs = (deps, options) => {
137
184
  // flipped `claimed_at`) and falls through to
138
185
  // `ERROR_NO_MATCHING_INVITE`. No race window.
139
186
  if (!open_signup) {
140
- invite = await query_invite_find_unclaimed_match_for_update(tx_deps, email ?? null, username);
187
+ invite = await query_invite_find_unclaimed_match_for_update(tx_ctx, email ?? null, username);
141
188
  if (!invite) {
142
189
  throw new NoMatchingInviteError();
143
190
  }
144
191
  }
145
- const { account, actor } = await query_create_account_with_actor(tx_deps, {
192
+ const { account, actor } = await query_create_account_with_actor(tx_ctx, {
146
193
  username,
147
194
  password_hash,
148
195
  email
@@ -154,7 +201,7 @@ export const create_signup_route_specs = (deps, options) => {
154
201
  // that invariant broke — refuse loudly (the throw
155
202
  // rolls the account back) rather than mint an
156
203
  // account no invite admitted.
157
- const claimed = await query_invite_claim_unscoped(tx_deps, invite.id, account.id);
204
+ const claimed = await query_invite_claim_unscoped(tx_ctx, invite.id, account.id);
158
205
  if (!claimed) {
159
206
  throw new Error(`invite ${invite.id} was already claimed despite the FOR UPDATE lock`);
160
207
  }
@@ -164,11 +211,22 @@ export const create_signup_route_specs = (deps, options) => {
164
211
  // once the commit has landed
165
212
  const session = await create_capped_session({
166
213
  keyring,
167
- deps: tx_deps,
214
+ deps: tx_ctx,
168
215
  account_id: account.id,
169
216
  session_options
170
217
  });
171
218
  const set_cookie = session_cookie_header(session.cookie_value, session_options);
219
+ // the success row, last: a refused row rolls the account back
220
+ // and answers through the `internal_error` catch below
221
+ await deps.audit.emit(tx_ctx, {
222
+ event_type: 'signup',
223
+ actor_id: actor.id,
224
+ account_id: account.id,
225
+ ip: route.client_ip,
226
+ metadata: invite
227
+ ? { invite_id: invite.id, username }
228
+ : { open_signup: true, username }
229
+ });
172
230
  return { account, actor, set_cookie };
173
231
  });
174
232
  }
@@ -195,7 +253,7 @@ export const create_signup_route_specs = (deps, options) => {
195
253
  // `internal_error` before rethrowing. 5xx responses are
196
254
  // not floored: they aren't response-time-controlled
197
255
  // enumeration oracles.
198
- await emit_failure_audit('internal_error');
256
+ await (tx_began ? emit_failure_audit('internal_error') : emit_pre_tx_failure_audit());
199
257
  throw e;
200
258
  }
201
259
  // Clear the account-grain bucket only — the IP aggregate stands.
@@ -216,12 +274,6 @@ export const create_signup_route_specs = (deps, options) => {
216
274
  // dry); the `finally` releases it.
217
275
  if (open_signup)
218
276
  ip_reserved.reservation.record();
219
- await deps.audit.emit(route, {
220
- event_type: 'signup',
221
- account_id: result.account.id,
222
- ip: route.client_ip,
223
- metadata: invite ? { invite_id: invite.id, username } : { open_signup: true, username }
224
- });
225
277
  return route_ok({
226
278
  ok: true,
227
279
  account: { id: result.account.id, username: result.account.username },
@@ -9,11 +9,10 @@
9
9
  *
10
10
  * Option routing: shared `roles` flows to both admin and role-grant-offer;
11
11
  * `default_ttl_ms` and `authorize` go to role-grant-offer only; `max_tokens`
12
- * goes to account only;
13
- * `notification_sender` reaches role-grant-offer transparently (admin + account
14
- * ignore it). `deps.connection_closer` is read by admin, account, and
15
- * role-grant-offer, whose revocation handlers close live connections through
16
- * it.
12
+ * goes to account only. `deps.connection_closer` is read by admin, account,
13
+ * and role-grant-offer, whose revocation handlers close live connections
14
+ * through it. WS notifications go through each handler context's
15
+ * `notification_sender`, which the dispatcher supplies.
17
16
  *
18
17
  * Paired with `create_admin_rpc_adapters` on the UI side.
19
18
  *
@@ -23,7 +22,6 @@ import { type AdminActionOptions } from './admin_actions.js';
23
22
  import { type RoleGrantOfferActionOptions } from './role_grant_offer_actions.js';
24
23
  import { type AccountActionOptions } from './account_actions.js';
25
24
  import type { RevokingActionFactoryDeps } from './deps.js';
26
- import type { NotificationSender } from './role_grant_offer_notifications.js';
27
25
  import type { RpcAction } from '../actions/action_types.js';
28
26
  /**
29
27
  * Options for `create_standard_rpc_actions`.
@@ -36,17 +34,6 @@ import type { RpcAction } from '../actions/action_types.js';
36
34
  */
37
35
  export interface StandardRpcActionsOptions extends AdminActionOptions, RoleGrantOfferActionOptions, AccountActionOptions {
38
36
  }
39
- /**
40
- * Dependencies for `create_standard_rpc_actions`.
41
- *
42
- * Stack-standard `RevokingActionFactoryDeps` (`log`, `audit`,
43
- * `connection_closer`) plus an optional `notification_sender` consumed only by the
44
- * role-grant-offer sub-factory for WS fan-out. Admin and account
45
- * sub-factories ignore `notification_sender`.
46
- */
47
- export interface StandardRpcActionsDeps extends RevokingActionFactoryDeps {
48
- notification_sender?: NotificationSender | null;
49
- }
50
37
  /**
51
38
  * Build the combined admin + role-grant-offer + account RPC action set.
52
39
  *
@@ -55,9 +42,9 @@ export interface StandardRpcActionsDeps extends RevokingActionFactoryDeps {
55
42
  * and `create_account_actions(deps, {max_tokens})`. The shared `roles`
56
43
  * option flows to admin + role-grant-offer.
57
44
  *
58
- * @param deps - `StandardRpcActionsDeps` (`log`, `audit`, `connection_closer` from `RevokingActionFactoryDeps`; optional `notification_sender` for WS fan-out)
45
+ * @param deps - `RevokingActionFactoryDeps`: `log`, `audit`, `connection_closer`
59
46
  * @param options - role registry, role-grant-offer config, account config
60
47
  * @returns RPC actions to pass as `rpc_endpoints` or spread into `create_rpc_endpoint`
61
48
  */
62
- export declare const create_standard_rpc_actions: (deps: StandardRpcActionsDeps, options?: StandardRpcActionsOptions) => Array<RpcAction>;
49
+ export declare const create_standard_rpc_actions: (deps: RevokingActionFactoryDeps, options?: StandardRpcActionsOptions) => Array<RpcAction>;
63
50
  //# sourceMappingURL=standard_rpc_actions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"standard_rpc_actions.d.ts","sourceRoot":"","sources":["../../src/lib/auth/standard_rpc_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAwB,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAEN,KAAK,2BAA2B,EAChC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAA0B,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,WAAW,yBAChB,SAAQ,kBAAkB,EAAE,2BAA2B,EAAE,oBAAoB;CAAG;AAEjF;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAuB,SAAQ,yBAAyB;IACxE,mBAAmB,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAChD;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,GACvC,MAAM,sBAAsB,EAC5B,UAAS,yBAA8B,KACrC,KAAK,CAAC,SAAS,CAIjB,CAAC"}
1
+ {"version":3,"file":"standard_rpc_actions.d.ts","sourceRoot":"","sources":["../../src/lib/auth/standard_rpc_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAwB,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAEN,KAAK,2BAA2B,EAChC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAA0B,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,WAAW,yBAChB,SAAQ,kBAAkB,EAAE,2BAA2B,EAAE,oBAAoB;CAAG;AAEjF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,GACvC,MAAM,yBAAyB,EAC/B,UAAS,yBAA8B,KACrC,KAAK,CAAC,SAAS,CAIjB,CAAC"}
@@ -9,11 +9,10 @@
9
9
  *
10
10
  * Option routing: shared `roles` flows to both admin and role-grant-offer;
11
11
  * `default_ttl_ms` and `authorize` go to role-grant-offer only; `max_tokens`
12
- * goes to account only;
13
- * `notification_sender` reaches role-grant-offer transparently (admin + account
14
- * ignore it). `deps.connection_closer` is read by admin, account, and
15
- * role-grant-offer, whose revocation handlers close live connections through
16
- * it.
12
+ * goes to account only. `deps.connection_closer` is read by admin, account,
13
+ * and role-grant-offer, whose revocation handlers close live connections
14
+ * through it. WS notifications go through each handler context's
15
+ * `notification_sender`, which the dispatcher supplies.
17
16
  *
18
17
  * Paired with `create_admin_rpc_adapters` on the UI side.
19
18
  *
@@ -30,7 +29,7 @@ import { create_account_actions } from './account_actions.js';
30
29
  * and `create_account_actions(deps, {max_tokens})`. The shared `roles`
31
30
  * option flows to admin + role-grant-offer.
32
31
  *
33
- * @param deps - `StandardRpcActionsDeps` (`log`, `audit`, `connection_closer` from `RevokingActionFactoryDeps`; optional `notification_sender` for WS fan-out)
32
+ * @param deps - `RevokingActionFactoryDeps`: `log`, `audit`, `connection_closer`
34
33
  * @param options - role registry, role-grant-offer config, account config
35
34
  * @returns RPC actions to pass as `rpc_endpoints` or spread into `create_rpc_endpoint`
36
35
  */
@@ -115,7 +115,7 @@ export declare const token_scope_admits_method: (scope: TokenScope, method: stri
115
115
  * so it fits in one sentence a user can hold — *a scoped token is RPC-only*.
116
116
  * Placement is per site: a route that refuses anonymous callers declares
117
117
  * `auth.required_scope`, one that answers them reads the credential through
118
- * `get_public_account_id` and answers a narrowed token as anonymous, and the
118
+ * `get_public_account` and answers a narrowed token as anonymous, and the
119
119
  * surface census pins every site.
120
120
  */
121
121
  export declare const token_scope_admits_non_rpc: (scope: TokenScope) => boolean;
@@ -123,7 +123,7 @@ export const token_scope_admits_method = (scope, method) => scope.kind === 'full
123
123
  * so it fits in one sentence a user can hold — *a scoped token is RPC-only*.
124
124
  * Placement is per site: a route that refuses anonymous callers declares
125
125
  * `auth.required_scope`, one that answers them reads the credential through
126
- * `get_public_account_id` and answers a narrowed token as anonymous, and the
126
+ * `get_public_account` and answers a narrowed token as anonymous, and the
127
127
  * surface census pins every site.
128
128
  */
129
129
  export const token_scope_admits_non_rpc = (scope) => scope.kind === 'full';
@@ -9,7 +9,7 @@
9
9
  * `qualify_columns` for reads that alias the table, `omit_columns` for a
10
10
  * client-safe subset — rather than spelling a second column list, so the
11
11
  * drift guard on the base const (`assert_columns_match_live` in
12
- * `testing/db.ts`) covers every derived projection too. Twin of the Rust
12
+ * `testing/describe_db.ts`) covers every derived projection too. Twin of the Rust
13
13
  * spine's `*_COLUMNS` consts + `fuz_db::qualify_columns` / `omit_columns`.
14
14
  *
15
15
  * A read that needs a column rendered as something other than the bare
@@ -9,7 +9,7 @@
9
9
  * `qualify_columns` for reads that alias the table, `omit_columns` for a
10
10
  * client-safe subset — rather than spelling a second column list, so the
11
11
  * drift guard on the base const (`assert_columns_match_live` in
12
- * `testing/db.ts`) covers every derived projection too. Twin of the Rust
12
+ * `testing/describe_db.ts`) covers every derived projection too. Twin of the Rust
13
13
  * spine's `*_COLUMNS` consts + `fuz_db::qualify_columns` / `omit_columns`.
14
14
  *
15
15
  * A read that needs a column rendered as something other than the bare