@fuzdev/fuz_app 0.180.0 → 0.182.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 (389) hide show
  1. package/dist/actions/CLAUDE.md +38 -20
  2. package/dist/actions/action_rpc.d.ts +25 -6
  3. package/dist/actions/action_rpc.d.ts.map +1 -1
  4. package/dist/actions/action_rpc.js +56 -48
  5. package/dist/actions/action_types.d.ts +31 -13
  6. package/dist/actions/action_types.d.ts.map +1 -1
  7. package/dist/actions/action_types.js +1 -1
  8. package/dist/actions/notification_sender.d.ts +83 -0
  9. package/dist/actions/notification_sender.d.ts.map +1 -0
  10. package/dist/actions/notification_sender.js +85 -0
  11. package/dist/actions/perform_action.d.ts +13 -4
  12. package/dist/actions/perform_action.d.ts.map +1 -1
  13. package/dist/actions/perform_action.js +27 -18
  14. package/dist/actions/register_action_ws.d.ts +20 -2
  15. package/dist/actions/register_action_ws.d.ts.map +1 -1
  16. package/dist/actions/register_action_ws.js +17 -5
  17. package/dist/actions/ws_socket_session.d.ts +3 -0
  18. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  19. package/dist/actions/ws_socket_session.js +3 -2
  20. package/dist/auth/CLAUDE.md +84 -59
  21. package/dist/auth/account_actions.d.ts.map +1 -1
  22. package/dist/auth/account_actions.js +30 -3
  23. package/dist/auth/account_queries.d.ts +213 -2
  24. package/dist/auth/account_queries.d.ts.map +1 -1
  25. package/dist/auth/account_queries.js +255 -2
  26. package/dist/auth/account_route_schema.d.ts +26 -16
  27. package/dist/auth/account_route_schema.d.ts.map +1 -1
  28. package/dist/auth/account_route_schema.js +10 -24
  29. package/dist/auth/account_routes.d.ts +5 -7
  30. package/dist/auth/account_routes.d.ts.map +1 -1
  31. package/dist/auth/account_routes.js +110 -89
  32. package/dist/auth/admin_actions.d.ts.map +1 -1
  33. package/dist/auth/admin_actions.js +117 -25
  34. package/dist/auth/api_token_queries.d.ts +29 -12
  35. package/dist/auth/api_token_queries.d.ts.map +1 -1
  36. package/dist/auth/api_token_queries.js +42 -27
  37. package/dist/auth/audit_log_route_schema.d.ts +1 -1
  38. package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
  39. package/dist/auth/audit_log_routes.d.ts +1 -1
  40. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  41. package/dist/auth/audit_log_routes.js +10 -12
  42. package/dist/auth/audit_log_schema.js +4 -4
  43. package/dist/auth/bearer_auth.d.ts +4 -3
  44. package/dist/auth/bearer_auth.d.ts.map +1 -1
  45. package/dist/auth/bearer_auth.js +37 -32
  46. package/dist/auth/bootstrap_account.d.ts +65 -37
  47. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  48. package/dist/auth/bootstrap_account.js +115 -66
  49. package/dist/auth/bootstrap_route_schema.d.ts +6 -2
  50. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  51. package/dist/auth/bootstrap_route_schema.js +7 -2
  52. package/dist/auth/bootstrap_routes.d.ts +50 -33
  53. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  54. package/dist/auth/bootstrap_routes.js +109 -87
  55. package/dist/auth/bootstrap_token_store.d.ts +60 -0
  56. package/dist/auth/bootstrap_token_store.d.ts.map +1 -0
  57. package/dist/auth/bootstrap_token_store.js +39 -0
  58. package/dist/auth/credential_headers.d.ts +71 -0
  59. package/dist/auth/credential_headers.d.ts.map +1 -0
  60. package/dist/auth/credential_headers.js +100 -0
  61. package/dist/auth/daemon_token.d.ts +13 -1
  62. package/dist/auth/daemon_token.d.ts.map +1 -1
  63. package/dist/auth/daemon_token.js +14 -2
  64. package/dist/auth/daemon_token_middleware.d.ts +10 -11
  65. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  66. package/dist/auth/daemon_token_middleware.js +39 -30
  67. package/dist/auth/deps.d.ts +10 -11
  68. package/dist/auth/deps.d.ts.map +1 -1
  69. package/dist/auth/invite_queries.d.ts +18 -0
  70. package/dist/auth/invite_queries.d.ts.map +1 -1
  71. package/dist/auth/invite_queries.js +24 -0
  72. package/dist/auth/request_context.d.ts +97 -76
  73. package/dist/auth/request_context.d.ts.map +1 -1
  74. package/dist/auth/request_context.js +93 -104
  75. package/dist/auth/resolved_auth.d.ts +10 -5
  76. package/dist/auth/resolved_auth.d.ts.map +1 -1
  77. package/dist/auth/resolved_auth.js +2 -2
  78. package/dist/auth/role_grant_offer_action_specs.d.ts +2 -2
  79. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  80. package/dist/auth/role_grant_offer_action_specs.js +5 -3
  81. package/dist/auth/role_grant_offer_actions.d.ts +7 -11
  82. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  83. package/dist/auth/role_grant_offer_actions.js +97 -106
  84. package/dist/auth/role_grant_offer_ddl.d.ts +7 -1
  85. package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
  86. package/dist/auth/role_grant_offer_ddl.js +9 -2
  87. package/dist/auth/role_grant_offer_notifications.d.ts +87 -38
  88. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  89. package/dist/auth/role_grant_offer_notifications.js +75 -22
  90. package/dist/auth/role_grant_offer_queries.d.ts +143 -9
  91. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  92. package/dist/auth/role_grant_offer_queries.js +266 -66
  93. package/dist/auth/role_grant_offer_schema.js +1 -1
  94. package/dist/auth/role_grant_queries.d.ts +57 -10
  95. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  96. package/dist/auth/role_grant_queries.js +81 -22
  97. package/dist/auth/role_grant_sql.d.ts +21 -0
  98. package/dist/auth/role_grant_sql.d.ts.map +1 -1
  99. package/dist/auth/role_grant_sql.js +21 -0
  100. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  101. package/dist/auth/self_service_role_actions.js +9 -2
  102. package/dist/auth/session_cookie.d.ts +105 -25
  103. package/dist/auth/session_cookie.d.ts.map +1 -1
  104. package/dist/auth/session_cookie.js +124 -15
  105. package/dist/auth/session_middleware.d.ts +83 -54
  106. package/dist/auth/session_middleware.d.ts.map +1 -1
  107. package/dist/auth/session_middleware.js +92 -66
  108. package/dist/auth/session_queries.d.ts +95 -14
  109. package/dist/auth/session_queries.d.ts.map +1 -1
  110. package/dist/auth/session_queries.js +98 -19
  111. package/dist/auth/signup_route_schema.d.ts +5 -5
  112. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  113. package/dist/auth/signup_route_schema.js +4 -4
  114. package/dist/auth/signup_routes.d.ts.map +1 -1
  115. package/dist/auth/signup_routes.js +17 -14
  116. package/dist/auth/standard_rpc_actions.d.ts +6 -19
  117. package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
  118. package/dist/auth/standard_rpc_actions.js +5 -6
  119. package/dist/auth/token_scope.d.ts +6 -8
  120. package/dist/auth/token_scope.d.ts.map +1 -1
  121. package/dist/auth/token_scope.js +6 -9
  122. package/dist/dev/setup.d.ts +6 -1
  123. package/dist/dev/setup.d.ts.map +1 -1
  124. package/dist/dev/setup.js +42 -34
  125. package/dist/hono_context.d.ts +21 -0
  126. package/dist/hono_context.d.ts.map +1 -1
  127. package/dist/hono_context.js +17 -0
  128. package/dist/http/CLAUDE.md +156 -48
  129. package/dist/http/auth_shape.d.ts +4 -4
  130. package/dist/http/common_routes.js +1 -1
  131. package/dist/http/db_routes.d.ts +4 -3
  132. package/dist/http/db_routes.d.ts.map +1 -1
  133. package/dist/http/db_routes.js +14 -14
  134. package/dist/http/dev_route_error_check.d.ts +6 -3
  135. package/dist/http/dev_route_error_check.d.ts.map +1 -1
  136. package/dist/http/dev_route_error_check.js +6 -3
  137. package/dist/http/dev_set_cookie_check.d.ts +53 -0
  138. package/dist/http/dev_set_cookie_check.d.ts.map +1 -0
  139. package/dist/http/dev_set_cookie_check.js +80 -0
  140. package/dist/http/error_schemas.d.ts +45 -22
  141. package/dist/http/error_schemas.d.ts.map +1 -1
  142. package/dist/http/error_schemas.js +53 -26
  143. package/dist/http/header_lines.d.ts +42 -0
  144. package/dist/http/header_lines.d.ts.map +1 -0
  145. package/dist/http/header_lines.js +80 -0
  146. package/dist/http/host.d.ts +12 -9
  147. package/dist/http/host.d.ts.map +1 -1
  148. package/dist/http/host.js +25 -20
  149. package/dist/http/origin.d.ts +7 -22
  150. package/dist/http/origin.d.ts.map +1 -1
  151. package/dist/http/origin.js +11 -25
  152. package/dist/http/proxy.d.ts +1 -0
  153. package/dist/http/proxy.d.ts.map +1 -1
  154. package/dist/http/proxy.js +3 -0
  155. package/dist/http/request_headers.d.ts +95 -0
  156. package/dist/http/request_headers.d.ts.map +1 -0
  157. package/dist/http/request_headers.js +110 -0
  158. package/dist/http/request_target.d.ts +134 -0
  159. package/dist/http/request_target.d.ts.map +1 -0
  160. package/dist/http/request_target.js +193 -0
  161. package/dist/http/route_error_check.d.ts +4 -11
  162. package/dist/http/route_error_check.d.ts.map +1 -1
  163. package/dist/http/route_error_check.js +4 -21
  164. package/dist/http/route_result.d.ts +127 -23
  165. package/dist/http/route_result.d.ts.map +1 -1
  166. package/dist/http/route_result.js +97 -19
  167. package/dist/http/route_spec.d.ts +299 -83
  168. package/dist/http/route_spec.d.ts.map +1 -1
  169. package/dist/http/route_spec.js +548 -71
  170. package/dist/http/simple_request.d.ts +19 -14
  171. package/dist/http/simple_request.d.ts.map +1 -1
  172. package/dist/http/simple_request.js +17 -29
  173. package/dist/http/surface.d.ts +2 -0
  174. package/dist/http/surface.d.ts.map +1 -1
  175. package/dist/http/surface.js +4 -1
  176. package/dist/realtime/outbound_budget.d.ts +1 -2
  177. package/dist/realtime/outbound_budget.d.ts.map +1 -1
  178. package/dist/realtime/outbound_budget.js +1 -2
  179. package/dist/realtime/sse.d.ts +47 -17
  180. package/dist/realtime/sse.d.ts.map +1 -1
  181. package/dist/realtime/sse.js +115 -93
  182. package/dist/realtime/sse_constants.d.ts +7 -1
  183. package/dist/realtime/sse_constants.d.ts.map +1 -1
  184. package/dist/realtime/sse_constants.js +12 -1
  185. package/dist/realtime/sse_registry.d.ts +3 -3
  186. package/dist/realtime/sse_registry.js +3 -3
  187. package/dist/runtime/deps.d.ts +20 -4
  188. package/dist/runtime/deps.d.ts.map +1 -1
  189. package/dist/runtime/mock.d.ts +7 -1
  190. package/dist/runtime/mock.d.ts.map +1 -1
  191. package/dist/runtime/mock.js +33 -3
  192. package/dist/runtime/node.d.ts.map +1 -1
  193. package/dist/runtime/node.js +2 -1
  194. package/dist/runtime/secure_file.d.ts +71 -10
  195. package/dist/runtime/secure_file.d.ts.map +1 -1
  196. package/dist/runtime/secure_file.js +91 -11
  197. package/dist/server/app_backend.d.ts +0 -8
  198. package/dist/server/app_backend.d.ts.map +1 -1
  199. package/dist/server/app_backend.js +4 -4
  200. package/dist/server/app_server.d.ts +54 -33
  201. package/dist/server/app_server.d.ts.map +1 -1
  202. package/dist/server/app_server.js +69 -41
  203. package/dist/server/serve_fact_route.d.ts +3 -3
  204. package/dist/server/serve_fact_route.d.ts.map +1 -1
  205. package/dist/server/serve_fact_route.js +59 -55
  206. package/dist/server/static.d.ts +20 -0
  207. package/dist/server/static.d.ts.map +1 -1
  208. package/dist/server/static.js +56 -8
  209. package/dist/server/unmatched_route.d.ts +42 -0
  210. package/dist/server/unmatched_route.d.ts.map +1 -0
  211. package/dist/server/unmatched_route.js +64 -0
  212. package/dist/testing/CLAUDE.md +406 -1202
  213. package/dist/testing/app_server.d.ts +3 -1
  214. package/dist/testing/app_server.d.ts.map +1 -1
  215. package/dist/testing/app_server.js +5 -9
  216. package/dist/testing/auth_apps.d.ts.map +1 -1
  217. package/dist/testing/auth_apps.js +3 -2
  218. package/dist/testing/cross_backend/account_lifecycle.d.ts +11 -4
  219. package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
  220. package/dist/testing/cross_backend/account_lifecycle.js +320 -6
  221. package/dist/testing/cross_backend/build_test_backend_paths.d.ts +4 -1
  222. package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
  223. package/dist/testing/cross_backend/build_test_backend_paths.js +1 -1
  224. package/dist/testing/cross_backend/capabilities.d.ts +68 -5
  225. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  226. package/dist/testing/cross_backend/capabilities.js +20 -4
  227. package/dist/testing/cross_backend/cell_gated_create.js +1 -1
  228. package/dist/testing/cross_backend/conformance_case.d.ts +63 -21
  229. package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
  230. package/dist/testing/cross_backend/conformance_table.d.ts +54 -12
  231. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  232. package/dist/testing/cross_backend/conformance_table.js +179 -23
  233. package/dist/testing/cross_backend/cookie_attributes.js +1 -1
  234. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +7 -1
  235. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
  236. package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +3 -3
  237. package/dist/testing/cross_backend/credential_conformance.d.ts +196 -0
  238. package/dist/testing/cross_backend/credential_conformance.d.ts.map +1 -0
  239. package/dist/testing/cross_backend/credential_conformance.js +296 -0
  240. package/dist/testing/cross_backend/credential_conformance.json +1284 -0
  241. package/dist/testing/cross_backend/credential_conformance_wire.d.ts +40 -0
  242. package/dist/testing/cross_backend/credential_conformance_wire.d.ts.map +1 -0
  243. package/dist/testing/cross_backend/credential_conformance_wire.js +293 -0
  244. package/dist/testing/cross_backend/credential_header_robustness.d.ts +1 -3
  245. package/dist/testing/cross_backend/credential_header_robustness.d.ts.map +1 -1
  246. package/dist/testing/cross_backend/credential_header_robustness.js +24 -55
  247. package/dist/testing/cross_backend/credential_wire.d.ts +112 -0
  248. package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -0
  249. package/dist/testing/cross_backend/credential_wire.js +188 -0
  250. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
  251. package/dist/testing/cross_backend/default_backend_configs.js +22 -2
  252. package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -26
  253. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
  254. package/dist/testing/cross_backend/default_spine_surface.js +3 -7
  255. package/dist/testing/cross_backend/differential.d.ts +1 -1
  256. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  257. package/dist/testing/cross_backend/differential.js +3 -2
  258. package/dist/testing/cross_backend/differential_normalize.d.ts +23 -6
  259. package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
  260. package/dist/testing/cross_backend/differential_normalize.js +11 -5
  261. package/dist/testing/cross_backend/full_spine_mount.d.ts +4 -10
  262. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  263. package/dist/testing/cross_backend/full_spine_mount.js +11 -4
  264. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  265. package/dist/testing/cross_backend/identity_parity.js +4 -0
  266. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  267. package/dist/testing/cross_backend/in_process_setup.js +78 -4
  268. package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
  269. package/dist/testing/cross_backend/login_security.js +13 -10
  270. package/dist/testing/cross_backend/peer_ping_ws.d.ts +1 -1
  271. package/dist/testing/cross_backend/peer_ping_ws.js +2 -2
  272. package/dist/testing/cross_backend/request_header_conformance.d.ts +174 -0
  273. package/dist/testing/cross_backend/request_header_conformance.d.ts.map +1 -0
  274. package/dist/testing/cross_backend/request_header_conformance.js +196 -0
  275. package/dist/testing/cross_backend/request_header_conformance.json +1158 -0
  276. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts +39 -0
  277. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts.map +1 -0
  278. package/dist/testing/cross_backend/request_header_conformance_wire.js +284 -0
  279. package/dist/testing/cross_backend/request_target_conformance.d.ts +298 -0
  280. package/dist/testing/cross_backend/request_target_conformance.d.ts.map +1 -0
  281. package/dist/testing/cross_backend/request_target_conformance.js +186 -0
  282. package/dist/testing/cross_backend/request_target_conformance.json +3765 -0
  283. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +32 -0
  284. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -0
  285. package/dist/testing/cross_backend/request_target_conformance_wire.js +278 -0
  286. package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
  287. package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +173 -1
  288. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +5 -4
  289. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
  290. package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +185 -31
  291. package/dist/testing/cross_backend/rpc_adversarial.d.ts +6 -4
  292. package/dist/testing/cross_backend/rpc_adversarial.d.ts.map +1 -1
  293. package/dist/testing/cross_backend/rpc_adversarial.js +5 -2
  294. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -7
  295. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  296. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -5
  297. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  298. package/dist/testing/cross_backend/session_cap.js +82 -34
  299. package/dist/testing/cross_backend/session_cookie_effect.d.ts +43 -0
  300. package/dist/testing/cross_backend/session_cookie_effect.d.ts.map +1 -0
  301. package/dist/testing/cross_backend/session_cookie_effect.js +103 -0
  302. package/dist/testing/cross_backend/session_login.d.ts +24 -0
  303. package/dist/testing/cross_backend/session_login.d.ts.map +1 -0
  304. package/dist/testing/cross_backend/session_login.js +31 -0
  305. package/dist/testing/cross_backend/setup.d.ts +117 -0
  306. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  307. package/dist/testing/cross_backend/setup.js +193 -9
  308. package/dist/testing/cross_backend/simple_request.d.ts.map +1 -1
  309. package/dist/testing/cross_backend/simple_request.js +5 -0
  310. package/dist/testing/cross_backend/spine_suites.d.ts +9 -1
  311. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  312. package/dist/testing/cross_backend/spine_suites.js +88 -5
  313. package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
  314. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  315. package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
  316. package/dist/testing/cross_backend/sse_round_trip.d.ts +8 -5
  317. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  318. package/dist/testing/cross_backend/sse_round_trip.js +205 -64
  319. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  320. package/dist/testing/cross_backend/testing_backdoor.js +5 -2
  321. package/dist/testing/cross_backend/testing_credential_read.d.ts +165 -0
  322. package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -0
  323. package/dist/testing/cross_backend/testing_credential_read.js +175 -0
  324. package/dist/testing/cross_backend/testing_reset_actions.d.ts +19 -0
  325. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  326. package/dist/testing/cross_backend/testing_reset_actions.js +22 -6
  327. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  328. package/dist/testing/cross_backend/token_lifetime.js +58 -2
  329. package/dist/testing/cross_backend/transport_composition.d.ts +2 -4
  330. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
  331. package/dist/testing/cross_backend/transport_composition.js +13 -10
  332. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  333. package/dist/testing/cross_backend/ts_spine_backend_config.js +5 -3
  334. package/dist/testing/cross_backend/ws_endpoint.d.ts +11 -1
  335. package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
  336. package/dist/testing/cross_backend/ws_endpoint.js +19 -2
  337. package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -1
  338. package/dist/testing/cross_backend/ws_role_gated.js +2 -3
  339. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  340. package/dist/testing/cross_backend/ws_round_trip.js +28 -12
  341. package/dist/testing/cross_backend/xfail.d.ts +44 -11
  342. package/dist/testing/cross_backend/xfail.d.ts.map +1 -1
  343. package/dist/testing/cross_backend/xfail.js +68 -23
  344. package/dist/testing/data_exposure.d.ts.map +1 -1
  345. package/dist/testing/data_exposure.js +4 -3
  346. package/dist/testing/integration.d.ts +1 -2
  347. package/dist/testing/integration.d.ts.map +1 -1
  348. package/dist/testing/integration.js +14 -8
  349. package/dist/testing/integration_helpers.d.ts +50 -3
  350. package/dist/testing/integration_helpers.d.ts.map +1 -1
  351. package/dist/testing/integration_helpers.js +87 -9
  352. package/dist/testing/middleware.d.ts +3 -1
  353. package/dist/testing/middleware.d.ts.map +1 -1
  354. package/dist/testing/middleware.js +14 -7
  355. package/dist/testing/resolved_auth.d.ts +3 -1
  356. package/dist/testing/resolved_auth.d.ts.map +1 -1
  357. package/dist/testing/resolved_auth.js +4 -4
  358. package/dist/testing/round_trip.d.ts +6 -2
  359. package/dist/testing/round_trip.d.ts.map +1 -1
  360. package/dist/testing/round_trip.js +17 -6
  361. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  362. package/dist/testing/rpc_envelope_cases.js +7 -0
  363. package/dist/testing/rpc_helpers.d.ts +4 -2
  364. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  365. package/dist/testing/rpc_helpers.js +6 -1
  366. package/dist/testing/rpc_round_trip.d.ts +13 -2
  367. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  368. package/dist/testing/rpc_round_trip.js +25 -6
  369. package/dist/testing/schema_generators.d.ts +2 -2
  370. package/dist/testing/schema_generators.d.ts.map +1 -1
  371. package/dist/testing/schema_generators.js +4 -4
  372. package/dist/testing/stubs.d.ts +2 -2
  373. package/dist/testing/stubs.d.ts.map +1 -1
  374. package/dist/testing/stubs.js +13 -10
  375. package/dist/testing/transports/fetch_transport.d.ts +6 -3
  376. package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
  377. package/dist/testing/transports/fetch_transport.js +31 -19
  378. package/dist/testing/transports/raw_http.d.ts +61 -1
  379. package/dist/testing/transports/raw_http.d.ts.map +1 -1
  380. package/dist/testing/transports/raw_http.js +61 -1
  381. package/dist/testing/transports/ws_raw_client.d.ts +20 -0
  382. package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
  383. package/dist/testing/transports/ws_raw_client.js +10 -4
  384. package/dist/testing/transports/ws_transport.d.ts +21 -1
  385. package/dist/testing/transports/ws_transport.d.ts.map +1 -1
  386. package/dist/testing/transports/ws_transport.js +58 -20
  387. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  388. package/dist/testing/ws_round_trip.js +8 -4
  389. package/package.json +1 -1
@@ -15,8 +15,9 @@ import { assert_row } from '../db/assert_row.js';
15
15
  import { columns_sql, qualify_columns } from '../db/sql_columns.js';
16
16
  import { ROLE_GRANT_OFFER_COLUMNS, role_grant_offer_expr, ROLE_GRANT_OFFER_SCOPE_KIND_GLOBAL_TOKEN, ROLE_GRANT_OFFER_SCOPE_SENTINEL_UUID, ROLE_GRANT_OFFER_WITH_GRANTOR_SELECT } from './role_grant_offer_ddl.js';
17
17
  import { query_create_role_grant, query_role_grant_by_id } from './role_grant_queries.js';
18
- import { offer_pending_predicate, role_grant_active_sql } from './role_grant_sql.js';
18
+ import { offer_pending_predicate, offer_rows_locked_in_id_order, role_grant_active_sql } from './role_grant_sql.js';
19
19
  import { query_audit_log } from './audit_log_queries.js';
20
+ import { query_account_lock_for_offer_accept, query_account_lock_live_many } from './account_queries.js';
20
21
  import { is_builtin_role, ROLE_ADMIN, ROLE_KEEPER } from './role_schema.js';
21
22
  /**
22
23
  * Error thrown by offer-lifecycle queries when the offer is in a non-pending
@@ -101,7 +102,8 @@ export class RoleGrantOfferBuiltinRefusedError extends Error {
101
102
  }
102
103
  /**
103
104
  * Error thrown when `query_role_grant_offer_create` is called with a
104
- * `to_actor_id` that does not exist or does not belong to `to_account_id`.
105
+ * `to_actor_id` that is no active actor of `to_account_id` — missing,
106
+ * tombstoned, or another account's.
105
107
  * Surfaces the actor↔account binding mismatch at the boundary instead of
106
108
  * letting the FK silently disagree with the recipient field.
107
109
  */
@@ -111,6 +113,36 @@ export class RoleGrantOfferActorAccountMismatchError extends Error {
111
113
  this.name = 'RoleGrantOfferActorAccountMismatchError';
112
114
  }
113
115
  }
116
+ /**
117
+ * Error thrown when the recipient is not an active account.
118
+ *
119
+ * By `query_role_grant_offer_create`: `to_account_id` names no account, a
120
+ * soft-deleted one, or one with no active actor. A deleted recipient and one
121
+ * that never existed are the one refusal, so a caller learns nothing from it
122
+ * that a missing id wouldn't tell; the handler answers it as
123
+ * `role_grant_assign` answers the same recipient. By `query_accept_offer`: the
124
+ * accepting account — the caller — was deleted or purged after its credential
125
+ * was read, and its handler answers the dead credential. Twin of the Rust
126
+ * `RoleGrantOfferError::RecipientNotActive`.
127
+ */
128
+ export class RoleGrantOfferRecipientNotActiveError extends Error {
129
+ constructor() {
130
+ super('the recipient is not an active account');
131
+ this.name = 'RoleGrantOfferRecipientNotActiveError';
132
+ }
133
+ }
134
+ /**
135
+ * Error thrown by `query_role_grant_offer_create` when the grantor is not an
136
+ * active account: its actor is missing or tombstoned, or its account
137
+ * soft-deleted — a delete that committed while the offer was in flight. Twin
138
+ * of the Rust `RoleGrantOfferError::GrantorNotActive`.
139
+ */
140
+ export class RoleGrantOfferGrantorNotActiveError extends Error {
141
+ constructor() {
142
+ super('the grantor is not an active account');
143
+ this.name = 'RoleGrantOfferGrantorNotActiveError';
144
+ }
145
+ }
114
146
  /**
115
147
  * Create a new role_grant offer, or refresh an existing pending offer for the
116
148
  * same `(to_account_id, role, scope_id, from_actor_id)` tuple.
@@ -133,11 +165,24 @@ export class RoleGrantOfferActorAccountMismatchError extends Error {
133
165
  * `query_accept_offer` rejects any actor other than the named one. Closes
134
166
  * the audit hole where offer-shape events would otherwise leave
135
167
  * `target_actor_id` null even when the recipient binding is known at
136
- * offer time. The actor↔account binding is verified here in one SELECT.
168
+ * offer time. A named actor must be an active actor of `to_account_id`.
169
+ *
170
+ * Both parties must be active accounts, checked here so every caller — the
171
+ * spine's handler and a consumer creating offers on its own path — gets the
172
+ * rule. Both account rows are read under `FOR SHARE` before the insert, in one
173
+ * statement in id order (`query_account_lock_live_many`): an account delete
174
+ * writes its tombstone first, so a delete committed before the read is waited
175
+ * for and seen (the offer is refused), and one after it waits for this
176
+ * transaction to commit and then supersedes the offer with the party's
177
+ * others. Run it inside the caller's transaction, which the lock
178
+ * spans. The self-target check comes first, so an offer to one's own account
179
+ * is refused as that whatever else it names.
137
180
  *
138
181
  * @mutates `role_grant_offer` table - inserts a new offer or upserts the matching pending row
139
182
  * @throws RoleGrantOfferSelfTargetError if the offering actor belongs to `to_account_id`
140
- * @throws RoleGrantOfferActorAccountMismatchError if `to_actor_id` is set but does not belong to `to_account_id`
183
+ * @throws RoleGrantOfferRecipientNotActiveError if `to_account_id` is missing, soft-deleted, or has no active actor
184
+ * @throws RoleGrantOfferActorAccountMismatchError if `to_actor_id` is set but is no active actor of `to_account_id`
185
+ * @throws RoleGrantOfferGrantorNotActiveError if the grantor's actor or account is missing or tombstoned
141
186
  */
142
187
  export const query_role_grant_offer_create = async (deps, input) => {
143
188
  // Self-target check resolves the **grantor** actor's account and
@@ -153,11 +198,26 @@ export const query_role_grant_offer_create = async (deps, input) => {
153
198
  if (grantor && grantor.account_id === input.to_account_id) {
154
199
  throw new RoleGrantOfferSelfTargetError();
155
200
  }
156
- if (input.to_actor_id != null) {
157
- const target = await deps.db.query_one(`SELECT account_id FROM actor WHERE id = $1`, [input.to_actor_id]);
158
- if (!target || target.account_id !== input.to_account_id) {
159
- throw new RoleGrantOfferActorAccountMismatchError();
160
- }
201
+ // Both parties' account rows, locked in one statement in id order — the
202
+ // order the last-admin guard locks its rows in, so the two never wait on
203
+ // each other — then judged recipient first, grantor second.
204
+ const live = await query_account_lock_live_many(deps, grantor ? [input.to_account_id, grantor.account_id] : [input.to_account_id]);
205
+ // The recipient: a live account with an active actor (the named one, when
206
+ // an actor is named).
207
+ if (!live.has(input.to_account_id)) {
208
+ throw new RoleGrantOfferRecipientNotActiveError();
209
+ }
210
+ const recipient_actors = await deps.db.query(`SELECT id FROM actor WHERE account_id = $1 AND deleted_at IS NULL`, [input.to_account_id]);
211
+ if (recipient_actors.length === 0) {
212
+ throw new RoleGrantOfferRecipientNotActiveError();
213
+ }
214
+ if (input.to_actor_id != null && !recipient_actors.some((a) => a.id === input.to_actor_id)) {
215
+ throw new RoleGrantOfferActorAccountMismatchError();
216
+ }
217
+ // The grantor: a live actor of a live account.
218
+ const grantor_actor = await deps.db.query_one(`SELECT id FROM actor WHERE id = $1 AND deleted_at IS NULL`, [input.from_actor_id]);
219
+ if (!grantor || !grantor_actor || !live.has(grantor.account_id)) {
220
+ throw new RoleGrantOfferGrantorNotActiveError();
161
221
  }
162
222
  const row = await deps.db.query_one(`INSERT INTO role_grant_offer
163
223
  (from_actor_id, to_account_id, to_actor_id, role, scope_kind, scope_id, message, expires_at)
@@ -298,8 +358,11 @@ export const query_role_grant_offer_history_for_account = async (deps, account_i
298
358
  * caller's `role_grant_offer_expire` audit inserts — committed together, or
299
359
  * rolled back together so the next sweep retries. Concurrent sweeps claim
300
360
  * disjoint rows: a row another sweep has stamped but not committed blocks on
301
- * its row lock, then fails the re-checked `expire_audited_at IS NULL`.
302
- * `cleanup_expired_role_grant_offers` is the caller.
361
+ * its row lock, then fails the re-checked `expire_audited_at IS NULL`. The
362
+ * rows are locked in id order (`offer_rows_locked_in_id_order`), as every
363
+ * multi-row offer write takes them, so a sweep and a delete, purge, revoke or
364
+ * accept over the same expired offers never wait on each other in opposite
365
+ * orders. `cleanup_expired_role_grant_offers` is the caller.
303
366
  *
304
367
  * @mutates `role_grant_offer` rows - stamps `expire_audited_at` on each claimed row
305
368
  */
@@ -307,9 +370,7 @@ export const query_role_grant_offer_sweep_expired = async (deps) => {
307
370
  return deps.db.query(`WITH claimed AS (
308
371
  UPDATE role_grant_offer
309
372
  SET expire_audited_at = NOW()
310
- WHERE ${offer_pending_predicate('')}
311
- AND expires_at <= NOW()
312
- AND expire_audited_at IS NULL
373
+ WHERE ${offer_rows_locked_in_id_order('', `${offer_pending_predicate('')} AND expires_at <= NOW() AND expire_audited_at IS NULL`)}
313
374
  -- raw columns; the outer select formats them
314
375
  RETURNING ${columns_sql(ROLE_GRANT_OFFER_COLUMNS)}
315
376
  )
@@ -322,14 +383,14 @@ export const query_role_grant_offer_sweep_expired = async (deps) => {
322
383
  * actor of an active account — the authority a builtin-role offer needs at the
323
384
  * moment its grant is minted.
324
385
  *
325
- * A locking read: `FOR SHARE OF rg` takes a share lock on the grant row that
326
- * admits, so a concurrent revoke (an `UPDATE` of that row) is strictly ordered
327
- * against this accept — it either commits first, and the recheck of the locked
328
- * row sees `revoked_at` set and excludes it, or it waits for this transaction
329
- * to commit the grant it authorized. A plain `EXISTS` could read the grant as
330
- * active while a revoke commits in between. The actor and account tombstones
331
- * are read but not locked — ordering a delete racing an accept isn't worth
332
- * locking two more tables. Twin of the Rust `grantor_holds_global_admin`.
386
+ * An unlocked read, run after `query_account_lock_for_offer_accept` has taken
387
+ * the grantor's account row `FOR SHARE` in the accept's transaction: every
388
+ * write that ends a grantor's global `admin` takes that row first — a revoke of
389
+ * the grant through `query_account_lock_for_revoke`, a delete through its write
390
+ * of the row, a purge through `query_account_lock_admins_for_purge` and
391
+ * `query_account_lock_for_purge` — so one that committed first is
392
+ * seen here (each statement reads afresh), and one that came later waits for
393
+ * the accept to commit. Twin of the Rust `grantor_holds_global_admin`.
333
394
  */
334
395
  const query_grantor_holds_global_admin = async (deps, grantor_actor_id) => {
335
396
  const row = await deps.db.query_one(`SELECT 1 AS held FROM role_grant rg
@@ -341,8 +402,7 @@ const query_grantor_holds_global_admin = async (deps, grantor_actor_id) => {
341
402
  AND ${role_grant_active_sql('rg')}
342
403
  AND act.deleted_at IS NULL
343
404
  AND a.deleted_at IS NULL
344
- LIMIT 1
345
- FOR SHARE OF rg`, [grantor_actor_id, ROLE_ADMIN]);
405
+ LIMIT 1`, [grantor_actor_id, ROLE_ADMIN]);
346
406
  return row != null;
347
407
  };
348
408
  /**
@@ -358,9 +418,29 @@ const query_grantor_holds_global_admin = async (deps, grantor_actor_id) => {
358
418
  * creating a duplicate or throwing — while that grant is still held. A grant
359
419
  * revoked since the accept, or gone, makes the offer terminal.
360
420
  *
421
+ * Lock order — accounts, then offers, then the grant: the recipient's account
422
+ * row (and, for an unscoped `admin` offer, the grantor's) in id order
423
+ * (`query_account_lock_for_offer_accept`), then the offer and the pending
424
+ * siblings it supersedes in one id-ordered claim, then the grant insert. The
425
+ * accounts first, as every removal of either account takes them first, so a
426
+ * removal and an accept never meet at the offers, the actor, or a grant a
427
+ * purge's cascade reaches; two accepts by one recipient take turns. The
428
+ * offers in id order, as every transaction that writes several offer rows
429
+ * locks them all first in one id-ordered statement (a delete, a purge, a
430
+ * revoke, the expiry sweep). The grantor's authority is read unlocked after
431
+ * the grantor's account lock — the invariant it rests on: every write that
432
+ * ends a grantor's global `admin` takes the grantor's account row first (a
433
+ * revoke of the grant through `query_account_lock_for_revoke`, whether or not
434
+ * its last-admin guard ran; a delete through its write of the row; a purge
435
+ * through `query_account_lock_admins_for_purge` and
436
+ * `query_account_lock_for_purge`; the DB browser's delete, which takes none of
437
+ * them, excepted).
438
+ *
361
439
  * Error map:
362
440
  * - `RoleGrantOfferNotFoundError` — offer does not exist, or belongs to a
363
441
  * different recipient (IDOR guard). The offer row is untouched.
442
+ * - `RoleGrantOfferRecipientNotActiveError` — the recipient's account was
443
+ * deleted or purged since the caller's credential was read.
364
444
  * - `RoleGrantOfferAlreadyTerminalError` — offer is declined, retracted, or
365
445
  * superseded; or accepted, and its grant revoked, gone, or bound to another
366
446
  * actor.
@@ -368,8 +448,8 @@ const query_grantor_holds_global_admin = async (deps, grantor_actor_id) => {
368
448
  * - `RoleGrantOfferActorMismatchError` — actor-targeted offer, different actor.
369
449
  * - `RoleGrantOfferBuiltinRefusedError` — a builtin-role offer that must not
370
450
  * mint: `keeper` at all, a builtin bound to a scope, or one whose grantor no
371
- * longer holds an active global `admin` (read under `FOR SHARE`). The offer
372
- * stays pending.
451
+ * longer holds an active global `admin` (read under the grantor's account
452
+ * lock). The offer stays pending.
373
453
  *
374
454
  * Sibling supersede is what closes the "accept a pre-revoke sibling offer
375
455
  * to bypass a revoke" path: once A is accepted, B/C/... can no longer be
@@ -380,6 +460,7 @@ const query_grantor_holds_global_admin = async (deps, grantor_actor_id) => {
380
460
  * @mutates `role_grant_offer` siblings - stamps `superseded_at` on every other pending offer for the tuple
381
461
  * @mutates `audit_log` table - emits `role_grant_offer_accept` + `role_grant_create` + one `role_grant_offer_supersede` per sibling
382
462
  * @throws RoleGrantOfferNotFoundError if the offer is missing or belongs to another recipient
463
+ * @throws RoleGrantOfferRecipientNotActiveError if the recipient's account is deleted or gone
383
464
  * @throws RoleGrantOfferAlreadyTerminalError if the offer is declined, retracted, or superseded, or accepted with its grant revoked, gone, or bound to another actor
384
465
  * @throws RoleGrantOfferExpiredError if the offer is pending but past `expires_at`
385
466
  * @throws RoleGrantOfferActorMismatchError if the offer is actor-targeted to a different actor
@@ -388,29 +469,57 @@ const query_grantor_holds_global_admin = async (deps, grantor_actor_id) => {
388
469
  */
389
470
  export const query_accept_offer = async (deps, input) => {
390
471
  const { offer_id, to_account_id, actor_id, ip } = input;
391
- // Claim the offer with a row-level lock. Subsequent concurrent callers
392
- // block on the lock until this transaction commits/rolls back; after commit
393
- // they see the new state (accepted or terminal) and branch idempotently.
394
- // We defer writing `accepted_at` until the role_grant row exists — the
395
- // `role_grant_offer_role_grant_iff_accepted` CHECK constraint demands both be set
396
- // (or neither) at row-visibility time.
472
+ // The grantor, role and scope are written once with the offer and never
473
+ // updated, so they are read without a lock: they name the rows to lock.
474
+ // Everything the claim checks is checked on the claimed row.
475
+ const head = await deps.db.query_one(`SELECT o.from_actor_id, o.role, o.scope_id, grantor.account_id AS from_account_id
476
+ FROM role_grant_offer o
477
+ JOIN actor grantor ON grantor.id = o.from_actor_id
478
+ WHERE o.id = $1 AND o.to_account_id = $2`, [offer_id, to_account_id]);
479
+ if (!head) {
480
+ throw new RoleGrantOfferNotFoundError(offer_id);
481
+ }
482
+ // An unscoped `admin` offer's grantor must still hold a global `admin` when
483
+ // the grant is minted.
484
+ const needs_grantor_admin = head.role === ROLE_ADMIN && head.scope_id === null;
485
+ if (!(await query_account_lock_for_offer_accept(deps, to_account_id, needs_grantor_admin ? head.from_account_id : null))) {
486
+ throw new RoleGrantOfferRecipientNotActiveError();
487
+ }
488
+ const grantor_holds_admin = needs_grantor_admin
489
+ ? await query_grantor_holds_global_admin(deps, head.from_actor_id)
490
+ : null;
491
+ // Claim the offer and every pending sibling it may supersede — one
492
+ // statement, in id order. A concurrent caller on any of these rows blocks
493
+ // until this transaction ends, then sees the new state. No sibling can be
494
+ // added meanwhile: an offer to the recipient takes its account row, which
495
+ // this transaction holds. We defer writing `accepted_at` until the
496
+ // role_grant row exists — the `role_grant_offer_role_grant_iff_accepted`
497
+ // CHECK constraint demands both be set (or neither) at row-visibility time.
397
498
  //
398
- // Trailing `expires_at > NOW() AS still_valid` rides on the FOR UPDATE row
399
- // so the expiry branch below compares the **raw** column on Postgres' clock
400
- // — the projected `expires_at` is floored to the second, so comparing it in
499
+ // Trailing `expires_at > NOW() AS still_valid` rides on the locked row so
500
+ // the expiry branch below compares the **raw** column on Postgres' clock —
501
+ // the projected `expires_at` is floored to the second, so comparing it in
401
502
  // JS would report expiry up to a second early. Twin of the Rust
402
503
  // `query_accept_offer`'s `o.expires_at > NOW() AS still_valid`.
403
- const locked_row = await deps.db.query_one(`SELECT ${columns_sql(ROLE_GRANT_OFFER_COLUMNS, role_grant_offer_expr(''))},
404
- role_grant_offer.expires_at > NOW() AS still_valid
405
- FROM role_grant_offer
406
- WHERE id = $1 AND to_account_id = $2
407
- FOR UPDATE`, [offer_id, to_account_id]);
504
+ const claimed = await deps.db.query(`SELECT ${qualify_columns(ROLE_GRANT_OFFER_COLUMNS, 'o', role_grant_offer_expr('o'))},
505
+ o.expires_at > NOW() AS still_valid,
506
+ grantor.account_id AS from_account_id
507
+ FROM role_grant_offer o
508
+ JOIN actor grantor ON grantor.id = o.from_actor_id
509
+ WHERE o.to_account_id = $2
510
+ AND (o.id = $1
511
+ OR (o.role = $3 AND o.scope_id IS NOT DISTINCT FROM $4
512
+ AND ${offer_pending_predicate('o')}))
513
+ ORDER BY o.id
514
+ FOR UPDATE OF o`, [offer_id, to_account_id, head.role, head.scope_id]);
515
+ const locked_row = claimed.find((row) => row.id === offer_id);
408
516
  if (!locked_row) {
409
517
  throw new RoleGrantOfferNotFoundError(offer_id);
410
518
  }
411
- // `still_valid` is the comparison result, not a column of the offer — split
412
- // it off so `locked` stays exactly `ROLE_GRANT_OFFER_COLUMNS`.
413
- const { still_valid, ...locked } = locked_row;
519
+ const sibling_ids = claimed.filter((row) => row.id !== offer_id).map((row) => row.id);
520
+ // `still_valid` and `from_account_id` are not columns of the offer — split
521
+ // them off so `locked` stays exactly `ROLE_GRANT_OFFER_COLUMNS`.
522
+ const { still_valid, from_account_id, ...locked } = locked_row;
414
523
  if (locked.accepted_at) {
415
524
  // Already accepted (a replay, or a race winner already committed);
416
525
  // return the pre-existing role_grant.
@@ -432,6 +541,7 @@ export const query_accept_offer = async (deps, input) => {
432
541
  return {
433
542
  role_grant,
434
543
  offer: locked,
544
+ from_account_id,
435
545
  created: false,
436
546
  superseded_offers: [],
437
547
  audit_events: []
@@ -442,7 +552,7 @@ export const query_accept_offer = async (deps, input) => {
442
552
  }
443
553
  // Expiry check AFTER the accepted-path: a validly-accepted offer past its
444
554
  // expires_at still returns the role_grant idempotently. Only pending offers
445
- // past expiry reach this branch. `still_valid` rode on the FOR UPDATE row
555
+ // past expiry reach this branch. `still_valid` rode on the claimed row
446
556
  // above, so the comparison stays on the raw column and Postgres' clock.
447
557
  if (!still_valid) {
448
558
  throw new RoleGrantOfferExpiredError(offer_id);
@@ -482,7 +592,9 @@ export const query_accept_offer = async (deps, input) => {
482
592
  // Builtin roles are global-only.
483
593
  refusal = 'scoped';
484
594
  }
485
- else if (!(await query_grantor_holds_global_admin(deps, locked.from_actor_id))) {
595
+ else if (grantor_holds_admin !== true) {
596
+ // read under the grantor's account lock before the claim, on the same
597
+ // immutable grantor the claimed row carries
486
598
  refusal = 'grantor_not_authorized';
487
599
  }
488
600
  if (refusal !== null) {
@@ -515,23 +627,22 @@ export const query_accept_offer = async (deps, input) => {
515
627
  WHERE id = $1
516
628
  RETURNING ${columns_sql(ROLE_GRANT_OFFER_COLUMNS, role_grant_offer_expr(''))}`, [locked.id, role_grant.id]);
517
629
  const offer = assert_row(offer_accepted, 'mark offer accepted');
518
- // Supersede sibling pending offers for the same (to_account, role, scope).
519
- // Forecloses the "accept this other sibling later to get the role back
520
- // after a revoke" path — any pending offer for this tuple at accept time
521
- // is obsoleted by the accept. CTE joins `actor` to surface each sibling's
522
- // grantor `account_id` for the caller's notification fan-out.
523
- const superseded = await deps.db.query(`WITH updated AS (
524
- UPDATE role_grant_offer
525
- SET superseded_at = NOW()
526
- WHERE to_account_id = $1
527
- AND role = $2
528
- AND scope_id IS NOT DISTINCT FROM $3
529
- AND id <> $4
530
- AND ${offer_pending_predicate('')}
531
- -- raw columns; the outer grantor select formats them
532
- RETURNING ${columns_sql(ROLE_GRANT_OFFER_COLUMNS)}
533
- )
534
- ${ROLE_GRANT_OFFER_WITH_GRANTOR_SELECT}`, [to_account_id, offer.role, offer.scope_id, offer.id]);
630
+ // Supersede the sibling pending offers for the same (to_account, role,
631
+ // scope), the rows the claim locked. Forecloses the "accept this other
632
+ // sibling later to get the role back after a revoke" path — any pending
633
+ // offer for this tuple at accept time is obsoleted by the accept. CTE joins
634
+ // `actor` to surface each sibling's grantor `account_id` for the caller's
635
+ // notification fan-out.
636
+ const superseded = sibling_ids.length === 0
637
+ ? []
638
+ : await deps.db.query(`WITH updated AS (
639
+ UPDATE role_grant_offer
640
+ SET superseded_at = NOW()
641
+ WHERE id = ANY($1) AND ${offer_pending_predicate('')}
642
+ -- raw columns; the outer grantor select formats them
643
+ RETURNING ${columns_sql(ROLE_GRANT_OFFER_COLUMNS)}
644
+ )
645
+ ${ROLE_GRANT_OFFER_WITH_GRANTOR_SELECT}`, [sibling_ids]);
535
646
  // Emit audit events in-transaction (atomic with the role_grant insert).
536
647
  // The `RETURNING` after the SET guarantees `offer.resulting_role_grant_id === role_grant.id`.
537
648
  // Accept binds the actor deterministically — populate both target
@@ -594,6 +705,7 @@ export const query_accept_offer = async (deps, input) => {
594
705
  return {
595
706
  role_grant,
596
707
  offer,
708
+ from_account_id,
597
709
  created: true,
598
710
  superseded_offers: superseded,
599
711
  audit_events: [offer_accept_event, role_grant_create_event, ...supersede_events]
@@ -609,8 +721,11 @@ export const query_accept_offer = async (deps, input) => {
609
721
  * (`account_delete` / `account_purge`, every actor of the account) end the
610
722
  * grantor's outgoing pending offers in the same transaction. Each row carries
611
723
  * the grantor's `from_account_id`, as every supersede cascade's does; the
612
- * caller emits a `role_grant_offer_supersede` audit event per entry, and the
613
- * revoke caller also sends the supersede notification. Twin of the Rust
724
+ * caller emits a `role_grant_offer_supersede` audit event per entry and
725
+ * queues its notifications (`queue_supersede_notifications`). The rows are
726
+ * taken in id order; a caller that writes other offers too locks them all
727
+ * first (`query_role_grant_offer_lock_for_account_removal`,
728
+ * `query_role_grant_offer_lock_for_revoke`). Twin of the Rust
614
729
  * `query_role_grant_offer_supersede_outgoing`.
615
730
  *
616
731
  * @param deps - query dependencies
@@ -624,10 +739,95 @@ export const query_role_grant_offer_supersede_outgoing = async (deps, from_actor
624
739
  return deps.db.query(`WITH updated AS (
625
740
  UPDATE role_grant_offer
626
741
  SET superseded_at = NOW()
627
- WHERE from_actor_id = ANY($1)
628
- AND ${offer_pending_predicate('')}
742
+ WHERE ${offer_rows_locked_in_id_order('', `from_actor_id = ANY($1) AND ${offer_pending_predicate('')}`)}
629
743
  -- raw columns; the outer grantor select formats them
630
744
  RETURNING ${columns_sql(ROLE_GRANT_OFFER_COLUMNS)}
631
745
  )
632
746
  ${ROLE_GRANT_OFFER_WITH_GRANTOR_SELECT}`, [from_actor_ids]);
633
747
  };
748
+ /**
749
+ * Supersede every pending offer **made to** `to_account_id` — the
750
+ * recipient-side cascade of an account delete or purge.
751
+ *
752
+ * An undelete restores the account, so an offer left pending through the
753
+ * delete would come back with it and could then be accepted; superseding it
754
+ * in the delete's transaction makes it terminal for good. Matching on
755
+ * `to_account_id` alone covers the actor-addressed offers too: an offer's
756
+ * `to_actor_id` is bound to its `to_account_id` at create. Each row carries
757
+ * the grantor's `from_account_id`, as every supersede cascade's does; the
758
+ * caller emits a `role_grant_offer_supersede` audit event per entry and
759
+ * queues its notifications (`queue_supersede_notifications`). The rows are
760
+ * taken in id order, after the caller's
761
+ * `query_role_grant_offer_lock_for_account_removal`. Twin of the Rust
762
+ * `query_role_grant_offer_supersede_incoming`.
763
+ *
764
+ * @param deps - query dependencies
765
+ * @param to_account_id - the recipient account whose pending offers end
766
+ * @returns the superseded offers, each with its grantor's account
767
+ * @mutates `role_grant_offer` rows - stamps `superseded_at` on every pending offer to `to_account_id`
768
+ */
769
+ export const query_role_grant_offer_supersede_incoming = async (deps, to_account_id) => {
770
+ return deps.db.query(`WITH updated AS (
771
+ UPDATE role_grant_offer
772
+ SET superseded_at = NOW()
773
+ WHERE ${offer_rows_locked_in_id_order('', `to_account_id = $1 AND ${offer_pending_predicate('')}`)}
774
+ -- raw columns; the outer grantor select formats them
775
+ RETURNING ${columns_sql(ROLE_GRANT_OFFER_COLUMNS)}
776
+ )
777
+ ${ROLE_GRANT_OFFER_WITH_GRANTOR_SELECT}`, [to_account_id]);
778
+ };
779
+ /**
780
+ * Lock every pending offer an account removal supersedes — the ones its actors
781
+ * made and the ones made to it — in one statement, in id order.
782
+ *
783
+ * A delete or a purge writes those offers in two statements, the outgoing
784
+ * then the incoming; taken that way, each could hold rows another writer of
785
+ * both sets (a revoke of the account's grant, the expiry sweep) waits on while
786
+ * waiting on rows that writer holds. Locked together first, in the order every
787
+ * multi-row offer write takes its rows, the two supersedes then write rows
788
+ * this transaction already holds. No offer to or from the account can be made
789
+ * meanwhile: an offer create takes both parties' account rows, which the
790
+ * removal has written or locked. Twin of the Rust
791
+ * `query_role_grant_offer_lock_for_account_removal`.
792
+ *
793
+ * @param deps - query dependencies (must be the removal's transaction)
794
+ * @param to_account_id - the removed account
795
+ * @param from_actor_ids - the removed account's actors
796
+ * @mutates `role_grant_offer` rows - row-locks every pending offer to the account or from its actors
797
+ */
798
+ export const query_role_grant_offer_lock_for_account_removal = async (deps, to_account_id, from_actor_ids) => {
799
+ await deps.db.query(`SELECT id FROM role_grant_offer
800
+ WHERE (to_account_id = $1 OR from_actor_id = ANY($2))
801
+ AND ${offer_pending_predicate('')}
802
+ ORDER BY id
803
+ FOR UPDATE`, [to_account_id, from_actor_ids]);
804
+ };
805
+ /**
806
+ * Lock every pending offer `role_grant_revoke` supersedes — the revokee
807
+ * account's incoming offers of the revoked grant's role and scope, and every
808
+ * offer the revokee's actor made — in one statement, in id order.
809
+ *
810
+ * Taken after the revokee's account row (`query_account_lock_for_revoke`),
811
+ * which keeps any new offer to or from the account out, and before the grant's
812
+ * update: an accept claims its offers before it inserts its grant (whose unique
813
+ * slot waits on a revoke's uncommitted update of the same grant), so a revoke
814
+ * updating the grant first and then reaching the offers the accept holds would
815
+ * close a cycle. Then the revoke's two supersedes write rows it already holds,
816
+ * in the order every multi-row offer write takes its rows. Twin of the Rust
817
+ * `query_role_grant_offer_lock_for_revoke`.
818
+ *
819
+ * @param deps - query dependencies (must be the revoke's transaction)
820
+ * @param actor_id - the revokee actor
821
+ * @param role - the revoked grant's role
822
+ * @param scope_id - the revoked grant's scope, `null` for global
823
+ * @mutates `role_grant_offer` rows - row-locks the pending offers the revoke supersedes
824
+ */
825
+ export const query_role_grant_offer_lock_for_revoke = async (deps, actor_id, role, scope_id) => {
826
+ await deps.db.query(`SELECT id FROM role_grant_offer
827
+ WHERE ((to_account_id = (SELECT account_id FROM actor WHERE id = $1)
828
+ AND role = $2 AND scope_id IS NOT DISTINCT FROM $3)
829
+ OR from_actor_id = $1)
830
+ AND ${offer_pending_predicate('')}
831
+ ORDER BY id
832
+ FOR UPDATE`, [actor_id, role, scope_id]);
833
+ };
@@ -59,7 +59,7 @@ export const RoleGrantOfferJson = meta(object({
59
59
  description: 'ISO timestamp when the grantor retracted the offer.'
60
60
  }),
61
61
  superseded_at: meta(nullable(Timestamp), {
62
- description: 'ISO timestamp when this offer was obsoleted by a sibling accept or by revoke of the resulting role_grant.'
62
+ description: 'ISO timestamp when a cascade ended this pending offer: a sibling accept, a revoke of the recipient’s grant of its role and scope, an admin revoke of any grant of its grantor’s actor, the removal of either party’s account, or the teardown of its scope.'
63
63
  }),
64
64
  resulting_role_grant_id: meta(nullable(UuidSchema), {
65
65
  description: 'Role grant produced by accepting this offer. `null` until/unless accepted.'
@@ -115,6 +115,18 @@ export interface RevokeRoleGrantResult {
115
115
  * offer becomes terminal at revoke time. A fresh post-revoke grant
116
116
  * requires the grantor to call `query_role_grant_offer_create` again.
117
117
  *
118
+ * The revokee's account row is locked first (`FOR NO KEY UPDATE`, the lock
119
+ * `query_account_lock_for_revoke` takes), so no offer to or from the account is
120
+ * made, and none accepted, while the revoke runs: the offers it locks are the
121
+ * offers it writes. Then those offers, in id order, before the grant is
122
+ * updated: an accept claims its offers before it inserts its grant, and that
123
+ * insert waits on an uncommitted update of the same grant, so the grant first
124
+ * and the offers second would close a cycle with it. A caller that supersedes
125
+ * the revokee's outgoing offers too (`role_grant_revoke`) takes the account row
126
+ * and then every offer it writes in one statement first
127
+ * (`query_role_grant_offer_lock_for_revoke`); the locks here then find rows
128
+ * the transaction already holds.
129
+ *
118
130
  * @param deps - query dependencies
119
131
  * @param role_grant_id - the role_grant to revoke
120
132
  * @param actor_id - the actor that must own the role_grant
@@ -159,7 +171,7 @@ export declare const query_account_has_global_role: (deps: QueryDeps, account_id
159
171
  * Like `query_account_has_global_role`, but only counts the grant when the
160
172
  * **account and the granting actor are both active** (`deleted_at IS NULL`).
161
173
  * Used by the last-admin branch of the removability guard: a soft-deleted admin
162
- * can't log in and is excluded from `query_count_active_accounts_with_global_role_for_update`,
174
+ * can't log in and is excluded from `query_count_active_accounts_with_global_role_locked`,
163
175
  * so the guard must use the same active predicate when testing whether the
164
176
  * *target* is an admin — otherwise removing an already-tombstoned admin is
165
177
  * falsely blocked as `cannot_delete_last_admin`. Soft-delete does **not** revoke
@@ -205,11 +217,39 @@ export declare const query_actor_has_active_global_role: (deps: QueryDeps, actor
205
217
  * guard could fail-open and let the last usable admin be removed).
206
218
  *
207
219
  * **Locks** every counted `role_grant`, `actor`, and `account` row
208
- * (`FOR UPDATE`) until the caller's transaction ends, so two guards racing to
209
- * remove the last two admins serialize: the second waits for the first to
210
- * commit, re-reads the rows it changed, and counts one. Run it inside the
211
- * transaction that does the removal. Twin of the Rust
212
- * `query_count_active_accounts_with_global_role_for_update`.
220
+ * `FOR NO KEY UPDATE` until the caller's transaction ends. That conflicts with
221
+ * another guard, so two guards racing to remove the last two admins serialize:
222
+ * the second waits for the first to commit, re-reads the rows it changed, and
223
+ * counts one. It conflicts with every write that lowers the count — a revoke's
224
+ * or a soft delete's `UPDATE` of a counted row, a purge's `DELETE` — and with
225
+ * the locks a credential mint, an offer, an invite and an offer accept (its
226
+ * recipient's row and its grantor's, `query_account_lock_for_offer_accept`)
227
+ * take on the account row. Run it inside the transaction that does the
228
+ * removal.
229
+ *
230
+ * It does not conflict with a foreign key's `FOR KEY SHARE` — the lock an
231
+ * insert or update naming a counted row takes (an accept's new grant naming its
232
+ * grantor, a cell's `created_by`). Such a write only adds a reference: it never
233
+ * lowers the count, so the guard fails closed — what it counted is at most what
234
+ * will stand, and a removal it allows leaves an admin. A purge that deletes a
235
+ * row such a write names still takes `FOR UPDATE` and waits for it.
236
+ *
237
+ * A purge's cascade writes admin rows too — it sets null the `granted_by` of
238
+ * every grant the purged account's actors granted, admins' grants among them,
239
+ * in the order its plan walks them — so a purge takes every admin's account
240
+ * row first, with its own, in one id-ordered statement
241
+ * (`query_account_lock_admins_for_purge`), and runs this count after it only
242
+ * when its target is an admin: another guard then waits at its first account
243
+ * holding nothing.
244
+ * Twin of the Rust `query_count_active_accounts_with_global_role_locked`.
245
+ *
246
+ * The rows are locked in id order — account, then actor, then grant — as the
247
+ * sort returns them: each account's row, its actors' and its grants' before
248
+ * the next account's. `query_account_lock_live_many` and
249
+ * `query_account_lock_for_offer_accept` take account rows in the same order,
250
+ * so an offer or an accept between two admins and an admin's removal never
251
+ * wait on each other's rows in opposite orders. Ids never change, so no
252
+ * concurrent update can move a row the sort has placed.
213
253
  *
214
254
  * `exclude_role_grant_id` leaves one grant out of the count, so a revoke asks
215
255
  * whether any active admin account would remain without that grant — an
@@ -223,7 +263,7 @@ export declare const query_actor_has_active_global_role: (deps: QueryDeps, actor
223
263
  * @returns the number of distinct active accounts with an active global `role` grant
224
264
  * @mutates `role_grant` / `actor` / `account` rows - row-locks the counted rows for the transaction
225
265
  */
226
- export declare const query_count_active_accounts_with_global_role_for_update: (deps: QueryDeps, role: string, exclude_role_grant_id?: Uuid | null) => Promise<number>;
266
+ export declare const query_count_active_accounts_with_global_role_locked: (deps: QueryDeps, role: string, exclude_role_grant_id?: Uuid | null) => Promise<number>;
227
267
  /**
228
268
  * Find the account ID of an account that holds an active **global** role_grant
229
269
  * for a given role.
@@ -266,7 +306,9 @@ export interface RevokeForScopeResult {
266
306
  /**
267
307
  * Every pending offer at the scope — tuple-matched and orphan, undifferentiated
268
308
  * — superseded in the same cascade. Each entry carries its grantor's
269
- * `from_account_id` for `role_grant_offer_supersede` notification fan-out.
309
+ * `from_account_id`, as every supersede cascade's does; no
310
+ * `role_grant_offer_supersede` notification carries `scope_destroyed`, so a
311
+ * scope teardown tells no one.
270
312
  *
271
313
  * The caller is responsible for emitting `role_grant_offer_supersede` audit
272
314
  * events with `reason: 'scope_destroyed'` and `cause_id: <destroyed scope row id>`
@@ -287,7 +329,12 @@ export interface RevokeForScopeResult {
287
329
  * attached to the destroyed scope is cleaned up.
288
330
  *
289
331
  * Both updates run as separate statements inside the caller's transaction,
290
- * the `role_grant` revoke first. The two halves are
332
+ * the scope's pending offers locked in id order first, then the `role_grant`
333
+ * revoke, then the supersede of the offers that lock returned — offers before
334
+ * grants, as `query_revoke_role_grant` takes them. No account row keeps a new
335
+ * offer at the scope out (the scope's offers span accounts), so the supersede
336
+ * writes only the rows it locked: an offer made at the scope after the lock is
337
+ * left pending rather than taken out of order. The two halves are
291
338
  * independent — orphan pending offers can exist at a scope with no active
292
339
  * role_grants, so the supersede half always runs even when no role_grant was
293
340
  * revoked.
@@ -298,7 +345,7 @@ export interface RevokeForScopeResult {
298
345
  * @param reason - optional free-form reason, stamped on `role_grant.revoked_reason`.
299
346
  * @returns the revoked role_grants (with `account_id` for fan-out) and superseded offers (with `from_account_id` for fan-out)
300
347
  * @mutates `role_grant` table - sets `revoked_at`/`revoked_by`/`revoked_reason` on every active row at `scope_id`
301
- * @mutates `role_grant_offer` table - stamps `superseded_at` on every pending row at `scope_id`
348
+ * @mutates `role_grant_offer` table - stamps `superseded_at` on every pending row at `scope_id` its lock took
302
349
  */
303
350
  export declare const query_role_grant_revoke_for_scope: (deps: QueryDeps, scope_id: Uuid, revoked_by: Uuid | null, reason?: string | null) => Promise<RevokeForScopeResult>;
304
351
  //# sourceMappingURL=role_grant_queries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"role_grant_queries.d.ts","sourceRoot":"","sources":["../../src/lib/auth/role_grant_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAS3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGpE;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,0KAaoB,CAAC;AAcpD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG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