@fuzdev/fuz_app 0.149.0 → 0.151.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 (650) hide show
  1. package/README.md +1 -1
  2. package/dist/actions/CLAUDE.md +327 -300
  3. package/dist/actions/action_bridge.d.ts +5 -79
  4. package/dist/actions/action_bridge.d.ts.map +1 -1
  5. package/dist/actions/action_bridge.js +4 -74
  6. package/dist/actions/action_codegen.d.ts +8 -166
  7. package/dist/actions/action_codegen.d.ts.map +1 -1
  8. package/dist/actions/action_codegen.js +19 -95
  9. package/dist/actions/action_dispatcher.d.ts +10 -0
  10. package/dist/actions/action_dispatcher.d.ts.map +1 -1
  11. package/dist/actions/action_dispatcher.js +9 -6
  12. package/dist/actions/action_event.d.ts +1 -2
  13. package/dist/actions/action_event.d.ts.map +1 -1
  14. package/dist/actions/action_event.js +7 -13
  15. package/dist/actions/action_event_helpers.d.ts +1 -40
  16. package/dist/actions/action_event_helpers.d.ts.map +1 -1
  17. package/dist/actions/action_event_helpers.js +1 -25
  18. package/dist/actions/action_event_types.d.ts +1 -1
  19. package/dist/actions/action_event_types.d.ts.map +1 -1
  20. package/dist/actions/action_rpc.d.ts +10 -215
  21. package/dist/actions/action_rpc.d.ts.map +1 -1
  22. package/dist/actions/action_rpc.js +56 -111
  23. package/dist/actions/action_spec.d.ts +2 -2
  24. package/dist/actions/action_spec.js +2 -2
  25. package/dist/actions/action_types.d.ts +229 -8
  26. package/dist/actions/action_types.d.ts.map +1 -1
  27. package/dist/actions/action_types.js +56 -5
  28. package/dist/actions/broadcast_api.d.ts +22 -17
  29. package/dist/actions/broadcast_api.d.ts.map +1 -1
  30. package/dist/actions/broadcast_api.js +16 -27
  31. package/dist/actions/cancel.d.ts +4 -13
  32. package/dist/actions/cancel.d.ts.map +1 -1
  33. package/dist/actions/cancel.js +5 -17
  34. package/dist/actions/compile_action_registry.d.ts +1 -2
  35. package/dist/actions/compile_action_registry.d.ts.map +1 -1
  36. package/dist/actions/connection_closer.d.ts +120 -50
  37. package/dist/actions/connection_closer.d.ts.map +1 -1
  38. package/dist/actions/connection_closer.js +139 -31
  39. package/dist/actions/{transports_ws_backend.d.ts → connection_registry.d.ts} +120 -132
  40. package/dist/actions/connection_registry.d.ts.map +1 -0
  41. package/dist/actions/{transports_ws_backend.js → connection_registry.js} +149 -152
  42. package/dist/actions/frontend_rpc_client.d.ts +52 -2
  43. package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
  44. package/dist/actions/frontend_rpc_client.js +42 -4
  45. package/dist/actions/peer_ping.d.ts +7 -9
  46. package/dist/actions/peer_ping.d.ts.map +1 -1
  47. package/dist/actions/peer_ping.js +6 -8
  48. package/dist/actions/peer_request.d.ts +6 -5
  49. package/dist/actions/peer_request.d.ts.map +1 -1
  50. package/dist/actions/peer_request.js +6 -5
  51. package/dist/actions/perform_action.d.ts +36 -28
  52. package/dist/actions/perform_action.d.ts.map +1 -1
  53. package/dist/actions/perform_action.js +60 -31
  54. package/dist/actions/protocol.d.ts +14 -0
  55. package/dist/actions/protocol.d.ts.map +1 -1
  56. package/dist/actions/protocol.js +18 -0
  57. package/dist/actions/register_action_ws.d.ts +137 -292
  58. package/dist/actions/register_action_ws.d.ts.map +1 -1
  59. package/dist/actions/register_action_ws.js +155 -903
  60. package/dist/actions/socket.svelte.d.ts +9 -0
  61. package/dist/actions/socket.svelte.d.ts.map +1 -1
  62. package/dist/actions/socket.svelte.js +16 -5
  63. package/dist/actions/transports.d.ts +88 -34
  64. package/dist/actions/transports.d.ts.map +1 -1
  65. package/dist/actions/transports.js +76 -76
  66. package/dist/actions/transports_http.d.ts +48 -12
  67. package/dist/actions/transports_http.d.ts.map +1 -1
  68. package/dist/actions/transports_http.js +75 -44
  69. package/dist/actions/transports_ws.d.ts +29 -0
  70. package/dist/actions/transports_ws.d.ts.map +1 -1
  71. package/dist/actions/transports_ws.js +34 -8
  72. package/dist/actions/ws_endpoint_spec.d.ts +53 -76
  73. package/dist/actions/ws_endpoint_spec.d.ts.map +1 -1
  74. package/dist/actions/ws_endpoint_spec.js +27 -10
  75. package/dist/actions/ws_outbound_writer.d.ts +3 -3
  76. package/dist/actions/ws_outbound_writer.js +3 -3
  77. package/dist/actions/ws_socket_session.d.ts +321 -0
  78. package/dist/actions/ws_socket_session.d.ts.map +1 -0
  79. package/dist/actions/ws_socket_session.js +783 -0
  80. package/dist/auth/CLAUDE.md +132 -68
  81. package/dist/auth/account_action_specs.d.ts +2 -0
  82. package/dist/auth/account_action_specs.d.ts.map +1 -1
  83. package/dist/auth/account_actions.d.ts +1 -1
  84. package/dist/auth/account_actions.d.ts.map +1 -1
  85. package/dist/auth/account_actions.js +9 -3
  86. package/dist/auth/account_queries.d.ts +10 -0
  87. package/dist/auth/account_queries.d.ts.map +1 -1
  88. package/dist/auth/account_queries.js +27 -17
  89. package/dist/auth/account_routes.d.ts +2 -1
  90. package/dist/auth/account_routes.d.ts.map +1 -1
  91. package/dist/auth/account_routes.js +14 -17
  92. package/dist/auth/account_schema.d.ts +5 -5
  93. package/dist/auth/account_schema.d.ts.map +1 -1
  94. package/dist/auth/account_schema.js +5 -2
  95. package/dist/auth/actor_lookup_actions.d.ts +1 -1
  96. package/dist/auth/actor_lookup_actions.d.ts.map +1 -1
  97. package/dist/auth/actor_lookup_actions.js +1 -1
  98. package/dist/auth/actor_lookup_queries.d.ts +3 -2
  99. package/dist/auth/actor_lookup_queries.d.ts.map +1 -1
  100. package/dist/auth/actor_lookup_queries.js +6 -3
  101. package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
  102. package/dist/auth/actor_search_action_specs.js +2 -1
  103. package/dist/auth/actor_search_actions.d.ts +1 -1
  104. package/dist/auth/actor_search_actions.d.ts.map +1 -1
  105. package/dist/auth/actor_search_actions.js +1 -1
  106. package/dist/auth/actor_search_queries.d.ts +10 -7
  107. package/dist/auth/actor_search_queries.d.ts.map +1 -1
  108. package/dist/auth/actor_search_queries.js +18 -11
  109. package/dist/auth/admin_action_specs.d.ts +4 -4
  110. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  111. package/dist/auth/admin_action_specs.js +7 -5
  112. package/dist/auth/admin_actions.d.ts +1 -1
  113. package/dist/auth/admin_actions.d.ts.map +1 -1
  114. package/dist/auth/admin_actions.js +47 -48
  115. package/dist/auth/all_cell_actions.d.ts +14 -3
  116. package/dist/auth/all_cell_actions.d.ts.map +1 -1
  117. package/dist/auth/all_cell_actions.js +2 -1
  118. package/dist/auth/api_token_queries.d.ts +1 -0
  119. package/dist/auth/api_token_queries.d.ts.map +1 -1
  120. package/dist/auth/api_token_queries.js +1 -0
  121. package/dist/auth/audit_emitter.d.ts +12 -6
  122. package/dist/auth/audit_emitter.d.ts.map +1 -1
  123. package/dist/auth/audit_emitter.js +11 -5
  124. package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
  125. package/dist/auth/audit_log_route_schema.js +3 -2
  126. package/dist/auth/audit_log_routes.d.ts +20 -11
  127. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  128. package/dist/auth/audit_log_routes.js +49 -29
  129. package/dist/auth/audit_log_schema.d.ts +14 -21
  130. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  131. package/dist/auth/audit_log_schema.js +19 -23
  132. package/dist/auth/bearer_auth.d.ts +7 -4
  133. package/dist/auth/bearer_auth.d.ts.map +1 -1
  134. package/dist/auth/bearer_auth.js +21 -15
  135. package/dist/auth/bootstrap_account.d.ts +25 -1
  136. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  137. package/dist/auth/bootstrap_account.js +37 -4
  138. package/dist/auth/bootstrap_routes.d.ts +3 -2
  139. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  140. package/dist/auth/bootstrap_routes.js +5 -4
  141. package/dist/auth/cell_action_helpers.d.ts +89 -0
  142. package/dist/auth/cell_action_helpers.d.ts.map +1 -0
  143. package/dist/auth/cell_action_helpers.js +113 -0
  144. package/dist/auth/cell_action_specs.d.ts +215 -15
  145. package/dist/auth/cell_action_specs.d.ts.map +1 -1
  146. package/dist/auth/cell_action_specs.js +103 -16
  147. package/dist/auth/cell_actions.d.ts +58 -27
  148. package/dist/auth/cell_actions.d.ts.map +1 -1
  149. package/dist/auth/cell_actions.js +206 -161
  150. package/dist/auth/cell_audit_actions.d.ts +1 -1
  151. package/dist/auth/cell_audit_actions.d.ts.map +1 -1
  152. package/dist/auth/cell_audit_actions.js +3 -12
  153. package/dist/auth/cell_audit_events.d.ts +1 -1
  154. package/dist/auth/cell_audit_events.d.ts.map +1 -1
  155. package/dist/auth/cell_audit_events.js +3 -2
  156. package/dist/auth/cell_audit_metadata.d.ts +12 -1
  157. package/dist/auth/cell_audit_metadata.d.ts.map +1 -1
  158. package/dist/auth/cell_audit_metadata.js +11 -1
  159. package/dist/auth/cell_field_actions.d.ts +1 -1
  160. package/dist/auth/cell_field_actions.d.ts.map +1 -1
  161. package/dist/auth/cell_field_actions.js +16 -66
  162. package/dist/auth/cell_grant_action_specs.d.ts +9 -2
  163. package/dist/auth/cell_grant_action_specs.d.ts.map +1 -1
  164. package/dist/auth/cell_grant_action_specs.js +10 -3
  165. package/dist/auth/cell_grant_actions.d.ts +105 -11
  166. package/dist/auth/cell_grant_actions.d.ts.map +1 -1
  167. package/dist/auth/cell_grant_actions.js +81 -56
  168. package/dist/auth/cell_grant_audit_metadata.d.ts +6 -3
  169. package/dist/auth/cell_grant_audit_metadata.d.ts.map +1 -1
  170. package/dist/auth/cell_grant_audit_metadata.js +7 -4
  171. package/dist/auth/cell_item_actions.d.ts +1 -1
  172. package/dist/auth/cell_item_actions.d.ts.map +1 -1
  173. package/dist/auth/cell_item_actions.js +21 -82
  174. package/dist/auth/cleanup.d.ts +1 -1
  175. package/dist/auth/cleanup.d.ts.map +1 -1
  176. package/dist/auth/cleanup.js +6 -3
  177. package/dist/auth/credential_deadline.d.ts +3 -3
  178. package/dist/auth/credential_deadline.js +3 -3
  179. package/dist/auth/credential_type_schema.d.ts +8 -7
  180. package/dist/auth/credential_type_schema.d.ts.map +1 -1
  181. package/dist/auth/credential_type_schema.js +8 -7
  182. package/dist/auth/daemon_token_middleware.d.ts +12 -6
  183. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  184. package/dist/auth/daemon_token_middleware.js +28 -17
  185. package/dist/auth/deps.d.ts +4 -4
  186. package/dist/auth/fail_floor.d.ts +55 -0
  187. package/dist/auth/fail_floor.d.ts.map +1 -0
  188. package/dist/auth/fail_floor.js +63 -0
  189. package/dist/auth/invite_queries.d.ts +3 -15
  190. package/dist/auth/invite_queries.d.ts.map +1 -1
  191. package/dist/auth/invite_queries.js +3 -21
  192. package/dist/auth/middleware.d.ts +12 -7
  193. package/dist/auth/middleware.d.ts.map +1 -1
  194. package/dist/auth/middleware.js +42 -29
  195. package/dist/auth/migrations.d.ts +5 -33
  196. package/dist/auth/migrations.d.ts.map +1 -1
  197. package/dist/auth/migrations.js +9 -16
  198. package/dist/auth/request_context.d.ts +101 -71
  199. package/dist/auth/request_context.d.ts.map +1 -1
  200. package/dist/auth/request_context.js +137 -140
  201. package/dist/auth/resolved_auth.d.ts +122 -36
  202. package/dist/auth/resolved_auth.d.ts.map +1 -1
  203. package/dist/auth/resolved_auth.js +89 -38
  204. package/dist/auth/role_grant_offer_action_specs.d.ts +117 -16
  205. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  206. package/dist/auth/role_grant_offer_action_specs.js +51 -16
  207. package/dist/auth/role_grant_offer_actions.d.ts +22 -11
  208. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  209. package/dist/auth/role_grant_offer_actions.js +72 -19
  210. package/dist/auth/role_grant_offer_notifications.d.ts +6 -5
  211. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  212. package/dist/auth/role_grant_offer_notifications.js +4 -3
  213. package/dist/auth/role_grant_offer_queries.d.ts +20 -5
  214. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  215. package/dist/auth/role_grant_offer_queries.js +40 -37
  216. package/dist/auth/role_grant_queries.d.ts +44 -76
  217. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  218. package/dist/auth/role_grant_queries.js +73 -118
  219. package/dist/auth/role_grant_sql.d.ts +42 -0
  220. package/dist/auth/role_grant_sql.d.ts.map +1 -0
  221. package/dist/auth/role_grant_sql.js +54 -0
  222. package/dist/auth/role_schema.d.ts +14 -8
  223. package/dist/auth/role_schema.d.ts.map +1 -1
  224. package/dist/auth/role_schema.js +6 -3
  225. package/dist/auth/scope_kind_schema.d.ts +1 -1
  226. package/dist/auth/scope_kind_schema.js +1 -1
  227. package/dist/auth/self_service_role_actions.d.ts +1 -1
  228. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  229. package/dist/auth/self_service_role_actions.js +21 -1
  230. package/dist/auth/session_queries.d.ts +2 -1
  231. package/dist/auth/session_queries.d.ts.map +1 -1
  232. package/dist/auth/session_queries.js +2 -1
  233. package/dist/auth/signup_routes.d.ts +2 -1
  234. package/dist/auth/signup_routes.d.ts.map +1 -1
  235. package/dist/auth/signup_routes.js +14 -13
  236. package/dist/auth/standard_rpc_actions.d.ts +1 -1
  237. package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
  238. package/dist/auth/token_scope.d.ts +19 -46
  239. package/dist/auth/token_scope.d.ts.map +1 -1
  240. package/dist/auth/token_scope.js +23 -41
  241. package/dist/db/CLAUDE.md +18 -6
  242. package/dist/db/cell_ddl.d.ts +5 -134
  243. package/dist/db/cell_ddl.d.ts.map +1 -1
  244. package/dist/db/cell_ddl.js +28 -17
  245. package/dist/db/cell_field_queries.d.ts +0 -13
  246. package/dist/db/cell_field_queries.d.ts.map +1 -1
  247. package/dist/db/cell_field_queries.js +0 -16
  248. package/dist/db/cell_grant_queries.d.ts +10 -5
  249. package/dist/db/cell_grant_queries.d.ts.map +1 -1
  250. package/dist/db/cell_grant_queries.js +13 -7
  251. package/dist/db/cell_item_queries.d.ts +0 -7
  252. package/dist/db/cell_item_queries.d.ts.map +1 -1
  253. package/dist/db/cell_item_queries.js +0 -10
  254. package/dist/db/cell_queries.d.ts +65 -55
  255. package/dist/db/cell_queries.d.ts.map +1 -1
  256. package/dist/db/cell_queries.js +85 -62
  257. package/dist/db/cell_view_sql.d.ts +1 -6
  258. package/dist/db/cell_view_sql.d.ts.map +1 -1
  259. package/dist/db/cell_view_sql.js +1 -2
  260. package/dist/db/fact_ddl.d.ts +5 -30
  261. package/dist/db/fact_ddl.d.ts.map +1 -1
  262. package/dist/db/fact_ddl.js +14 -13
  263. package/dist/db/fact_store.d.ts +11 -0
  264. package/dist/db/fact_store.d.ts.map +1 -1
  265. package/dist/db/fact_store.js +4 -1
  266. package/dist/db/migrate.d.ts +44 -6
  267. package/dist/db/migrate.d.ts.map +1 -1
  268. package/dist/db/migrate.js +63 -4
  269. package/dist/dev/setup.d.ts +18 -14
  270. package/dist/dev/setup.d.ts.map +1 -1
  271. package/dist/dev/setup.js +42 -39
  272. package/dist/env/dotenv.d.ts +2 -2
  273. package/dist/env/dotenv.js +2 -2
  274. package/dist/env/update_env_variable.d.ts +33 -21
  275. package/dist/env/update_env_variable.d.ts.map +1 -1
  276. package/dist/env/update_env_variable.js +54 -35
  277. package/dist/hono_context.d.ts +15 -90
  278. package/dist/hono_context.d.ts.map +1 -1
  279. package/dist/hono_context.js +9 -56
  280. package/dist/http/CLAUDE.md +35 -20
  281. package/dist/http/auth_shape.d.ts +1 -8
  282. package/dist/http/auth_shape.d.ts.map +1 -1
  283. package/dist/http/auth_shape.js +6 -12
  284. package/dist/http/body_limit.d.ts +3 -1
  285. package/dist/http/body_limit.d.ts.map +1 -1
  286. package/dist/http/body_limit.js +6 -1
  287. package/dist/http/common_routes.d.ts.map +1 -1
  288. package/dist/http/common_routes.js +3 -2
  289. package/dist/http/db_routes.d.ts +3 -3
  290. package/dist/http/db_routes.js +3 -3
  291. package/dist/http/error_schemas.d.ts +1 -2
  292. package/dist/http/error_schemas.d.ts.map +1 -1
  293. package/dist/http/error_schemas.js +1 -2
  294. package/dist/http/health_schema.d.ts +16 -0
  295. package/dist/http/health_schema.d.ts.map +1 -0
  296. package/dist/http/health_schema.js +12 -0
  297. package/dist/http/jsonrpc.d.ts +9 -0
  298. package/dist/http/jsonrpc.d.ts.map +1 -1
  299. package/dist/http/jsonrpc.js +17 -0
  300. package/dist/http/jsonrpc_errors.d.ts +22 -2
  301. package/dist/http/jsonrpc_errors.d.ts.map +1 -1
  302. package/dist/http/jsonrpc_errors.js +70 -23
  303. package/dist/http/jsonrpc_helpers.d.ts +60 -17
  304. package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
  305. package/dist/http/jsonrpc_helpers.js +67 -25
  306. package/dist/http/origin.d.ts +30 -1
  307. package/dist/http/origin.d.ts.map +1 -1
  308. package/dist/http/origin.js +46 -9
  309. package/dist/http/origin_wildcard.d.ts +97 -0
  310. package/dist/http/origin_wildcard.d.ts.map +1 -0
  311. package/dist/http/origin_wildcard.js +142 -0
  312. package/dist/http/pending_effects.d.ts +28 -0
  313. package/dist/http/pending_effects.d.ts.map +1 -1
  314. package/dist/http/pending_effects.js +32 -1
  315. package/dist/http/proxy.d.ts +4 -2
  316. package/dist/http/proxy.d.ts.map +1 -1
  317. package/dist/http/proxy.js +7 -2
  318. package/dist/http/route_spec.d.ts +4 -3
  319. package/dist/http/route_spec.d.ts.map +1 -1
  320. package/dist/http/route_spec.js +54 -45
  321. package/dist/http/surface.d.ts +4 -2
  322. package/dist/http/surface.d.ts.map +1 -1
  323. package/dist/http/surface.js +7 -4
  324. package/dist/http/surface_query.d.ts +9 -50
  325. package/dist/http/surface_query.d.ts.map +1 -1
  326. package/dist/http/surface_query.js +48 -94
  327. package/dist/realtime/audit_log_sse.d.ts +180 -0
  328. package/dist/realtime/audit_log_sse.d.ts.map +1 -0
  329. package/dist/realtime/audit_log_sse.js +154 -0
  330. package/dist/realtime/sse.d.ts +21 -6
  331. package/dist/realtime/sse.d.ts.map +1 -1
  332. package/dist/realtime/sse.js +33 -10
  333. package/dist/realtime/sse_constants.d.ts +29 -2
  334. package/dist/realtime/sse_constants.d.ts.map +1 -1
  335. package/dist/realtime/sse_constants.js +35 -2
  336. package/dist/realtime/{subscriber_registry.d.ts → sse_registry.d.ts} +12 -12
  337. package/dist/realtime/sse_registry.d.ts.map +1 -0
  338. package/dist/realtime/{subscriber_registry.js → sse_registry.js} +4 -4
  339. package/dist/schema_meta.d.ts +52 -1
  340. package/dist/schema_meta.d.ts.map +1 -1
  341. package/dist/schema_meta.js +123 -6
  342. package/dist/sensitivity.d.ts +9 -3
  343. package/dist/sensitivity.d.ts.map +1 -1
  344. package/dist/sensitivity.js +3 -2
  345. package/dist/server/app_backend.d.ts +8 -5
  346. package/dist/server/app_backend.d.ts.map +1 -1
  347. package/dist/server/app_backend.js +6 -12
  348. package/dist/server/app_server.d.ts +73 -54
  349. package/dist/server/app_server.d.ts.map +1 -1
  350. package/dist/server/app_server.js +115 -78
  351. package/dist/server/app_server_context.d.ts +1 -1
  352. package/dist/server/app_server_context.d.ts.map +1 -1
  353. package/dist/server/env.d.ts +24 -20
  354. package/dist/server/env.d.ts.map +1 -1
  355. package/dist/server/env.js +24 -34
  356. package/dist/server/serve_fact_route.d.ts +12 -16
  357. package/dist/server/serve_fact_route.d.ts.map +1 -1
  358. package/dist/server/serve_fact_route.js +59 -34
  359. package/dist/server/static.d.ts.map +1 -1
  360. package/dist/server/static.js +2 -2
  361. package/dist/testing/CLAUDE.md +213 -179
  362. package/dist/testing/admin_integration.d.ts.map +1 -1
  363. package/dist/testing/admin_integration.js +10 -19
  364. package/dist/testing/adversarial_headers.d.ts.map +1 -1
  365. package/dist/testing/adversarial_headers.js +8 -0
  366. package/dist/testing/app_server.d.ts +9 -75
  367. package/dist/testing/app_server.d.ts.map +1 -1
  368. package/dist/testing/app_server.js +31 -112
  369. package/dist/testing/attack_surface.d.ts.map +1 -1
  370. package/dist/testing/attack_surface.js +3 -4
  371. package/dist/testing/audit_completeness.d.ts.map +1 -1
  372. package/dist/testing/audit_completeness.js +4 -5
  373. package/dist/testing/auth_apps.d.ts +3 -3
  374. package/dist/testing/auth_apps.d.ts.map +1 -1
  375. package/dist/testing/auth_apps.js +9 -6
  376. package/dist/testing/connection_closer_helpers.d.ts +8 -16
  377. package/dist/testing/connection_closer_helpers.d.ts.map +1 -1
  378. package/dist/testing/connection_closer_helpers.js +7 -20
  379. package/dist/testing/cross_backend/action_manifest.d.ts +15 -4
  380. package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
  381. package/dist/testing/cross_backend/action_manifest.js +13 -3
  382. package/dist/testing/cross_backend/action_manifest_parity.d.ts +15 -7
  383. package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
  384. package/dist/testing/cross_backend/action_manifest_parity.js +8 -1
  385. package/dist/testing/cross_backend/actor_lookup.d.ts.map +1 -1
  386. package/dist/testing/cross_backend/actor_lookup.js +27 -0
  387. package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
  388. package/dist/testing/cross_backend/body_size.js +25 -22
  389. package/dist/testing/cross_backend/build_test_backend_paths.d.ts +22 -3
  390. package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
  391. package/dist/testing/cross_backend/build_test_backend_paths.js +34 -11
  392. package/dist/testing/cross_backend/capabilities.d.ts +15 -8
  393. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  394. package/dist/testing/cross_backend/cell_gated_create.d.ts.map +1 -1
  395. package/dist/testing/cross_backend/cell_gated_create.js +109 -13
  396. package/dist/testing/cross_backend/cell_grant_role.js +2 -2
  397. package/dist/testing/cross_backend/cell_grant_steward.d.ts +4 -0
  398. package/dist/testing/cross_backend/cell_grant_steward.d.ts.map +1 -0
  399. package/dist/testing/cross_backend/cell_grant_steward.js +120 -0
  400. package/dist/testing/cross_backend/cell_moderate.d.ts +7 -1
  401. package/dist/testing/cross_backend/cell_moderate.d.ts.map +1 -1
  402. package/dist/testing/cross_backend/cell_moderate.js +68 -4
  403. package/dist/testing/cross_backend/cell_ref_admission.d.ts.map +1 -1
  404. package/dist/testing/cross_backend/cell_ref_admission.js +18 -9
  405. package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
  406. package/dist/testing/cross_backend/cell_relations.js +21 -0
  407. package/dist/testing/cross_backend/conformance_table.d.ts +6 -1
  408. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  409. package/dist/testing/cross_backend/conformance_table.js +12 -10
  410. package/dist/testing/cross_backend/default_backend_configs.d.ts +18 -4
  411. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
  412. package/dist/testing/cross_backend/default_backend_configs.js +29 -9
  413. package/dist/testing/cross_backend/default_spine_surface.d.ts +7 -7
  414. package/dist/testing/cross_backend/default_spine_surface.js +2 -2
  415. package/dist/testing/cross_backend/differential.d.ts +7 -0
  416. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  417. package/dist/testing/cross_backend/differential.js +17 -0
  418. package/dist/testing/cross_backend/expected_schema.json +1 -0
  419. package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -1
  420. package/dist/testing/cross_backend/fact_serving.js +48 -0
  421. package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -4
  422. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  423. package/dist/testing/cross_backend/full_spine_mount.js +13 -5
  424. package/dist/testing/cross_backend/origin_scope.d.ts.map +1 -1
  425. package/dist/testing/cross_backend/origin_scope.js +5 -13
  426. package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
  427. package/dist/testing/cross_backend/peer_ping_ws.js +29 -4
  428. package/dist/testing/cross_backend/postgres_database.d.ts +32 -0
  429. package/dist/testing/cross_backend/postgres_database.d.ts.map +1 -1
  430. package/dist/testing/cross_backend/postgres_database.js +56 -1
  431. package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
  432. package/dist/testing/cross_backend/query_shape.js +18 -1
  433. package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
  434. package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +96 -2
  435. package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -2
  436. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
  437. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  438. package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +17 -5
  439. package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
  440. package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +5 -4
  441. package/dist/testing/cross_backend/session_cap.d.ts +8 -0
  442. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  443. package/dist/testing/cross_backend/session_cap.js +66 -2
  444. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  445. package/dist/testing/cross_backend/setup.js +5 -4
  446. package/dist/testing/cross_backend/spine_suites.d.ts +4 -1
  447. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  448. package/dist/testing/cross_backend/spine_suites.js +21 -0
  449. package/dist/testing/cross_backend/spine_surface_constants.d.ts +22 -7
  450. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  451. package/dist/testing/cross_backend/spine_surface_constants.js +22 -7
  452. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  453. package/dist/testing/cross_backend/sse_round_trip.js +4 -3
  454. package/dist/testing/cross_backend/standard.d.ts +6 -12
  455. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  456. package/dist/testing/cross_backend/test_cell_gated_create_authorize.d.ts +18 -19
  457. package/dist/testing/cross_backend/test_cell_gated_create_authorize.d.ts.map +1 -1
  458. package/dist/testing/cross_backend/test_cell_gated_create_authorize.js +66 -42
  459. package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts +8 -0
  460. package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts.map +1 -0
  461. package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.js +22 -0
  462. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  463. package/dist/testing/cross_backend/testing_backdoor.js +4 -6
  464. package/dist/testing/cross_backend/testing_origin_check.d.ts +1 -1
  465. package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
  466. package/dist/testing/cross_backend/testing_origin_check.js +1 -1
  467. package/dist/testing/cross_backend/testing_reset_actions.d.ts +10 -5
  468. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  469. package/dist/testing/cross_backend/testing_reset_actions.js +7 -6
  470. package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
  471. package/dist/testing/cross_backend/testing_server_bun.js +5 -4
  472. package/dist/testing/cross_backend/testing_server_core.d.ts +6 -7
  473. package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
  474. package/dist/testing/cross_backend/testing_server_core.js +1 -1
  475. package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
  476. package/dist/testing/cross_backend/testing_server_node.js +13 -2
  477. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  478. package/dist/testing/cross_backend/token_lifetime.js +68 -0
  479. package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
  480. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
  481. package/dist/testing/cross_backend/transport_composition.js +48 -6
  482. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +16 -2
  483. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  484. package/dist/testing/cross_backend/ts_spine_backend_config.js +11 -8
  485. package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
  486. package/dist/testing/cross_backend/ws_action_rate_limit.js +30 -12
  487. package/dist/testing/cross_backend/ws_connection_cap.d.ts.map +1 -1
  488. package/dist/testing/cross_backend/ws_connection_cap.js +5 -7
  489. package/dist/testing/cross_backend/ws_endpoint.d.ts +2 -3
  490. package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
  491. package/dist/testing/cross_backend/ws_envelope.d.ts +17 -0
  492. package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -0
  493. package/dist/testing/cross_backend/ws_envelope.js +172 -0
  494. package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts +16 -0
  495. package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts.map +1 -1
  496. package/dist/testing/cross_backend/ws_inbound_dispatch.js +8 -4
  497. package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
  498. package/dist/testing/cross_backend/ws_outbound_overflow.js +5 -8
  499. package/dist/testing/cross_backend/ws_role_gated.js +2 -2
  500. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  501. package/dist/testing/cross_backend/ws_round_trip.js +6 -4
  502. package/dist/{cli/daemon.d.ts → testing/daemon_info.d.ts} +15 -47
  503. package/dist/testing/daemon_info.d.ts.map +1 -0
  504. package/dist/testing/daemon_info.js +108 -0
  505. package/dist/testing/daemon_token_rotation.js +1 -1
  506. package/dist/testing/data_exposure.d.ts.map +1 -1
  507. package/dist/testing/data_exposure.js +3 -4
  508. package/dist/testing/db.js +2 -2
  509. package/dist/testing/integration.d.ts.map +1 -1
  510. package/dist/testing/integration.js +35 -65
  511. package/dist/testing/integration_helpers.d.ts +0 -15
  512. package/dist/testing/integration_helpers.d.ts.map +1 -1
  513. package/dist/testing/integration_helpers.js +2 -42
  514. package/dist/testing/middleware.d.ts +20 -12
  515. package/dist/testing/middleware.d.ts.map +1 -1
  516. package/dist/testing/middleware.js +49 -40
  517. package/dist/testing/rate_limiting.d.ts.map +1 -1
  518. package/dist/testing/rate_limiting.js +13 -22
  519. package/dist/testing/resolved_auth.d.ts +30 -0
  520. package/dist/testing/resolved_auth.d.ts.map +1 -0
  521. package/dist/testing/resolved_auth.js +41 -0
  522. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  523. package/dist/testing/rpc_envelope_cases.js +3 -0
  524. package/dist/testing/rpc_helpers.d.ts +1 -1
  525. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  526. package/dist/testing/rpc_helpers.js +2 -1
  527. package/dist/testing/sse_round_trip.d.ts +5 -4
  528. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  529. package/dist/testing/sse_round_trip.js +2 -2
  530. package/dist/testing/stubs.d.ts +2 -2
  531. package/dist/testing/stubs.d.ts.map +1 -1
  532. package/dist/testing/stubs.js +24 -21
  533. package/dist/testing/test_origin.d.ts +25 -0
  534. package/dist/testing/test_origin.d.ts.map +1 -0
  535. package/dist/testing/test_origin.js +28 -0
  536. package/dist/testing/transports/raw_http.d.ts +54 -0
  537. package/dist/testing/transports/raw_http.d.ts.map +1 -1
  538. package/dist/testing/transports/raw_http.js +58 -0
  539. package/dist/testing/transports/ws_raw_client.d.ts +8 -0
  540. package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
  541. package/dist/testing/transports/ws_raw_client.js +13 -0
  542. package/dist/testing/transports/ws_transport.d.ts +15 -2
  543. package/dist/testing/transports/ws_transport.d.ts.map +1 -1
  544. package/dist/testing/transports/ws_transport.js +4 -2
  545. package/dist/testing/ws_round_trip.d.ts +27 -25
  546. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  547. package/dist/testing/ws_round_trip.js +34 -26
  548. package/dist/ui/AccountSessions.svelte +48 -19
  549. package/dist/ui/AccountSessions.svelte.d.ts +2 -17
  550. package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
  551. package/dist/ui/AdminAccounts.svelte +6 -1
  552. package/dist/ui/AdminAuditLog.svelte +61 -22
  553. package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
  554. package/dist/ui/AdminInvites.svelte +1 -1
  555. package/dist/ui/AdminOverview.svelte +76 -37
  556. package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
  557. package/dist/ui/AdminRoleGrantHistory.svelte +6 -1
  558. package/dist/ui/AdminSessions.svelte +1 -1
  559. package/dist/ui/AppShell.svelte +3 -2
  560. package/dist/ui/AppShell.svelte.d.ts +3 -2
  561. package/dist/ui/AppShell.svelte.d.ts.map +1 -1
  562. package/dist/ui/CLAUDE.md +121 -35
  563. package/dist/ui/Datatable.svelte +33 -18
  564. package/dist/ui/Datatable.svelte.d.ts +2 -14
  565. package/dist/ui/Datatable.svelte.d.ts.map +1 -1
  566. package/dist/ui/OpenSignupToggle.svelte +10 -1
  567. package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
  568. package/dist/ui/PopoverButton.svelte +13 -8
  569. package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
  570. package/dist/ui/RoleGrantOfferForm.svelte +3 -2
  571. package/dist/ui/RoleGrantOfferForm.svelte.d.ts +3 -2
  572. package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
  573. package/dist/ui/RoleGrantOfferHistory.svelte +3 -3
  574. package/dist/ui/RoleGrantOfferInbox.svelte +19 -15
  575. package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
  576. package/dist/ui/SurfaceExplorer.svelte +66 -27
  577. package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
  578. package/dist/ui/account_sessions_state.svelte.d.ts +7 -14
  579. package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
  580. package/dist/ui/admin_accounts_state.svelte.d.ts +14 -9
  581. package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
  582. package/dist/ui/admin_accounts_state.svelte.js +6 -4
  583. package/dist/ui/admin_invites_state.svelte.d.ts +2 -2
  584. package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
  585. package/dist/ui/admin_rpc_adapters.d.ts +9 -9
  586. package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
  587. package/dist/ui/admin_rpc_adapters.js +9 -9
  588. package/dist/ui/app_settings_state.svelte.d.ts +2 -2
  589. package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
  590. package/dist/ui/audit_log_state.svelte.d.ts +70 -13
  591. package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
  592. package/dist/ui/audit_log_state.svelte.js +239 -47
  593. package/dist/ui/backend_probe.svelte.d.ts +93 -0
  594. package/dist/ui/backend_probe.svelte.d.ts.map +1 -0
  595. package/dist/ui/backend_probe.svelte.js +140 -0
  596. package/dist/ui/format_scope.d.ts +7 -7
  597. package/dist/ui/format_scope.d.ts.map +1 -1
  598. package/dist/ui/format_scope.js +4 -4
  599. package/dist/ui/keyed_async_slot.svelte.d.ts +2 -2
  600. package/dist/ui/keyed_async_slot.svelte.js +2 -2
  601. package/dist/ui/popover.svelte.d.ts +18 -19
  602. package/dist/ui/popover.svelte.d.ts.map +1 -1
  603. package/dist/ui/popover.svelte.js +103 -16
  604. package/dist/ui/role_grant_offers_state.svelte.d.ts +41 -46
  605. package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
  606. package/dist/ui/role_grant_offers_state.svelte.js +37 -19
  607. package/dist/ui/ui_format.d.ts +17 -0
  608. package/dist/ui/ui_format.d.ts.map +1 -1
  609. package/dist/ui/ui_format.js +20 -0
  610. package/package.json +2 -1
  611. package/dist/actions/register_ws_endpoint.d.ts +0 -79
  612. package/dist/actions/register_ws_endpoint.d.ts.map +0 -1
  613. package/dist/actions/register_ws_endpoint.js +0 -109
  614. package/dist/actions/transports_ws_auth_guard.d.ts +0 -94
  615. package/dist/actions/transports_ws_auth_guard.d.ts.map +0 -1
  616. package/dist/actions/transports_ws_auth_guard.js +0 -138
  617. package/dist/actions/transports_ws_backend.d.ts.map +0 -1
  618. package/dist/cli/args.d.ts +0 -55
  619. package/dist/cli/args.d.ts.map +0 -1
  620. package/dist/cli/args.js +0 -100
  621. package/dist/cli/config.d.ts +0 -47
  622. package/dist/cli/config.d.ts.map +0 -1
  623. package/dist/cli/config.js +0 -77
  624. package/dist/cli/daemon.d.ts.map +0 -1
  625. package/dist/cli/daemon.js +0 -181
  626. package/dist/cli/help.d.ts +0 -124
  627. package/dist/cli/help.d.ts.map +0 -1
  628. package/dist/cli/help.js +0 -215
  629. package/dist/cli/logger.d.ts +0 -46
  630. package/dist/cli/logger.d.ts.map +0 -1
  631. package/dist/cli/logger.js +0 -48
  632. package/dist/cli/util.d.ts +0 -36
  633. package/dist/cli/util.d.ts.map +0 -1
  634. package/dist/cli/util.js +0 -50
  635. package/dist/realtime/sse_auth_guard.d.ts +0 -197
  636. package/dist/realtime/sse_auth_guard.d.ts.map +0 -1
  637. package/dist/realtime/sse_auth_guard.js +0 -238
  638. package/dist/realtime/subscriber_registry.d.ts.map +0 -1
  639. package/dist/testing/bootstrap_success.d.ts +0 -29
  640. package/dist/testing/bootstrap_success.d.ts.map +0 -1
  641. package/dist/testing/bootstrap_success.js +0 -144
  642. package/dist/testing/mock_fs.d.ts +0 -20
  643. package/dist/testing/mock_fs.d.ts.map +0 -1
  644. package/dist/testing/mock_fs.js +0 -28
  645. package/dist/testing/standard.d.ts +0 -122
  646. package/dist/testing/standard.d.ts.map +0 -1
  647. package/dist/testing/standard.js +0 -73
  648. package/dist/testing/testing_rate_limiter.d.ts +0 -65
  649. package/dist/testing/testing_rate_limiter.d.ts.map +0 -1
  650. package/dist/testing/testing_rate_limiter.js +0 -80
@@ -33,8 +33,8 @@ time (never runtime), where a throwing guard would break `vite build`.
33
33
  - `stub_mw` — pass-through middleware (`async (_c, next) => next()`).
34
34
  - `create_stub_app_deps()` — factory: fresh `AppDeps` with no-op keyring/password/`delete_file`, a `read_secure_file` that throws ENOENT (the no-token-file state), a `create_noop_stub` DB, silent `Logger`, no-op `audit`, an empty `connection_closer`.
35
35
  - `create_test_audit_emitter()` — no-op `AuditEmitter`; `emit` / `emit_role_grant_target` no-op, `emit_pool` resolves immediately, `notify` no-op, `add_listener` throws (use `create_recording_audit_emitter` for a listener-accepting emitter), `listener_count` returns 0, `drain_inflight` resolves immediately, `is_tracking_inflight` returns `false`.
36
- - `create_stub_audit_sse()` — no-op `AuditLogSse` for surface-test wiring without booting real SSE. `on_audit_event` no-op (nothing is broadcast); `required_role` is `admin`; `registry` is a fresh `SubscriberRegistry` (live `.count` / `.close_*` for registry-state tests, isolated per call). For real SSE plumbing build via `create_audit_log_sse` against `create_test_app`.
37
- - `create_stub_api_middleware({include_daemon_token?, origin_carve_outs?})` — stub `MiddlewareSpec[]` matching `create_auth_middleware_specs`'s output (origin/session/request_context/bearer_auth, optional daemon_token) for surface generation without booting real auth — the same names, paths, order, and declared `errors` (`origin` declares a 403; `bearer_auth` and `daemon_token` declare none, since both soft-fail through `next()`), pinned against the real factory by `auth/middleware.mounted.test.ts`. The surface merges middleware errors into every route under the path, so a stub declaring more would widen the test surface with statuses the live server never returns. Each spec gets its own pass-through handler (not the shared `stub_mw`), so `assert_middleware_stack_mounted` tells the layers apart. See `auth/CLAUDE.md` §Middleware for the real stack.
36
+ - `create_stub_audit_sse()` — no-op `AuditLogSse` for surface-test wiring without booting real SSE. `on_audit_event` no-op (nothing is broadcast); `required_role` is `admin`; `registry` is a fresh `SseRegistry` (live `.count` / `.close_*` for registry-state tests, isolated per call). For real SSE plumbing build via `create_audit_log_sse` against `create_test_app`.
37
+ - `create_stub_api_middleware({include_daemon_token?, origin_carve_outs?})` — stub `MiddlewareSpec[]` matching `create_auth_middleware_specs`'s output (origin, optional daemon_token, session, request_context, bearer_auth) for surface generation without booting real auth — the same names, paths, order, and declared `errors` (`origin` declares a 403; `bearer_auth` and `daemon_token` declare none, since both soft-fail through `next()`), pinned against the real factory by `auth/middleware.mounted.test.ts`. The surface merges middleware errors into every route under the path, so a stub declaring more would widen the test surface with statuses the live server never returns. Each spec gets its own pass-through handler (not the shared `stub_mw`), so `assert_middleware_stack_mounted` tells the layers apart. See `auth/CLAUDE.md` §Middleware for the real stack.
38
38
  - `create_stub_app_backend(options?)` — stub `AppBackend` with no database: `create_stub_app_deps()` (or `options.deps`), no migration results, a `close` that does nothing (or `options.close`). For assembling a server in tests that never reach the database.
39
39
  - `create_stub_app_server_context(session_options)` — stub `AppServerContext` over `create_stub_app_backend()`; rate limiters null, `bootstrap_status.available: false`.
40
40
  - `create_test_app_surface_spec(options)` — builds an `AppSurfaceSpec` mirroring `create_app_server`'s route assembly, in its order (consumer routes, then bootstrap routes, RPC endpoint routes, and `GET /api/surface`, + stub middleware + surface generation). `GET /api/surface` is listed only with `surface_route: true`, as `create_app_server` mounts it only when opted in — pass the same value to both so the surface-derived suites probe it exactly when the live server serves it. `daemon_token: true` lists the `daemon_token` layer `create_app_server` mounts when given a `daemon_token_state` (`create_test_app` always passes one, and `default_in_process_suite_options` sets it, along with `app_options.surface_route`); `testing/test_app_server.db.test.ts` pins the stub's routes (order, auth, error schemas, applicable middleware) and middleware names against `create_test_app`'s for every `surface_route` setting. Its middleware list mirrors the real one — a stub `trusted_proxy` spec at `'*'`, then the stub auth stack — so every route's `applicable_middleware` starts with `trusted_proxy` (a route outside `/api/*` lists `['trusted_proxy', 'origin']`, since the origin check covers every path, and a route under an origin carve-out drops `origin`), as on the live server. `CreateTestAppSurfaceSpecOptions`: `session_options`, `create_route_specs`, `env_schema?`, `event_specs?`, `rpc_endpoints?`, `ws_endpoints?`, `allowed_origins?`, `origin_carve_outs?`, `transform_middleware?`, `bootstrap?`, `surface_route?`, `daemon_token?`. Throws, like `create_app_server`, on an endpoint path outside `AUTH_MIDDLEWARE_PATH` (`assert_endpoint_in_auth_scope`), on a route that reads or mints a credential outside it (`assert_credential_routes_in_auth_scope`), on an origin carve-out that overlaps that scope (`assert_origin_carve_outs_valid`), and on a `transform_middleware` that moves, drops, duplicates, reorders, wraps, or replaces the stub proxy spec or a stub auth spec (`assert_middleware_stack_mounted`); the transform receives shallow copies in a fresh array, so an in-place mutation can't slip past the check. Throws on a `ws_endpoints` spec with no `allowed_origins` of its own when no `allowed_origins` option is given (there is no server list to default from). Bootstrap is opt-in (symmetric with `create_app_server` — omit to skip; pass the same value as prod to mount routes at `bootstrap.route_prefix ?? '/api/account'`). Single source of truth for attack-surface tests — track `create_app_server` wiring changes here.
@@ -60,14 +60,18 @@ casts — the factory brands internally. Exported as `TestAccountOverrides` /
60
60
  - `create_test_context(role_grants?)` — `{account, actor, role_grants}`; pass `[{role: 'keeper'}, {role: 'admin'}]` for multi-role.
61
61
  - `create_test_raw_api_token(label?)` — a well-formed raw bearer value (`secret_fuz_token_` + `label` padded with `A` to 43 chars) that passes `is_api_token_shaped`, so a mocked-lookup test reaches token validation; distinct labels give distinct tokens.
62
62
  - `create_test_validated_api_token(overrides?)` — a `ValidatedApiToken` (what `query_validate_api_token` returns) with a `full` scope; override `scope` to test a narrowed one.
63
- - `create_test_audit_event(overrides?)` — `{id: 'evt-test', event_type: 'login', outcome: 'success', …}`, for SSE guard / audit tests.
63
+ - `create_test_audit_event(overrides?)` — `{id: 'evt-test', event_type: 'login', outcome: 'success', …}`, for revocation-guard / audit tests.
64
64
 
65
- ### `mock_fs.ts` — in-memory filesystem
65
+ ### `resolved_auth.ts` — `ResolvedAuth` factory
66
66
 
67
- `create_mock_fs(initial_files?) => {read_file, write_file, get_file}`.
68
- Missing-path reads throw an `Error` with `.code = 'ENOENT'` so callers
69
- exercise the same branches as `node:fs`. DI-based filesystem tests only;
70
- never replaces `node:fs` globally.
67
+ `create_test_resolved_auth({credential_type, account_id, session_id?,
68
+ api_token_id?, scope?, credential_deadline?})` — the `ResolvedAuth` arm for a
69
+ credential type, as the auth middleware builds it: a session's `session_hash`
70
+ is `hash_session_token(session_id)` (default a fresh uuid), an API token's id
71
+ defaults to a fresh uuid and its scope to `full`, a daemon token has no
72
+ deadline. For harnesses that preset `RESOLVED_AUTH_KEY` instead of running the
73
+ middleware — `create_test_app_from_specs`, `create_fake_hono_context`, the WS
74
+ harness's `connect`, `create_bearer_auth_test_app`'s `pre_context`.
71
75
 
72
76
  ### `db_entities.ts` — DB-backed entity factories
73
77
 
@@ -86,7 +90,10 @@ sort `created_at, id`, so a shared `created_at` would order them by random id;
86
90
  seeded through it, the account's first actor sorts first and the extras in
87
91
  insert order. `_testing_reset` and the in-process setup seed `extra_actors`
88
92
  with it, as the Rust reset does with `query_create_actor_with_clock_timestamp`,
89
- so both spines list a multi-actor keeper's actors in one order.
93
+ so both spines list a multi-actor keeper's actors in one order. The exception
94
+ is `query_admin_account_list`, whose actors sort `created_at, name, id`: it
95
+ keeps one actor per account, and a data key ahead of the random id picks the
96
+ same one on two backends holding the same rows (under the same text collation).
90
97
 
91
98
  `create_test_role_grant_direct(db, input)` wraps `query_create_role_grant`
92
99
  for tests needing an active role_grant seeded directly, bypassing the
@@ -119,15 +126,15 @@ mismatch.
119
126
 
120
127
  ### `connection_closer_helpers.ts` — `ConnectionCloser` test doubles
121
128
 
122
- - `create_recording_closer()` — `{closer, calls}`; every method on `closer` records `{method, id}` into `calls` and closes nothing (`close_sockets_for_role` records `{method: 'role', id, role}`, `close_all_sockets` `{method: 'all', id: null}`). To see a handler's closes, add it to the backend's closer (`ctx.deps.connection_closer.add(closer)`) or build the factory's deps with it. The closes are queued post-commit, so they have run by the time a `create_test_app` response is in hand (`await_pending_effects: true` flushes both queues).
123
- - `assert_close_call(call, method, id)` — pins `{method, id}` on a recorded close call; handles the missing-element case.
124
- - `RecordedClose` — `{method: 'session' | 'token' | 'account', id: string} | {method: 'role', id: string, role: string} | {method: 'all', id: null}`.
129
+ - `create_recording_closer()` — `{closer, calls}`; `closer.close_connections(target)` records the `target` and `close_all_connections()` records `{kind: 'all'}` into `calls`, closing nothing. To see a handler's closes, add it to the backend's closer (`ctx.deps.connection_closer.add(closer)`) or build the factory's deps with it. The closes are queued post-commit, so they have run by the time a `create_test_app` response is in hand (`await_pending_effects: true` flushes both queues).
130
+ - `assert_close_call(call, expected)` — pins a recorded close call to `expected` (`assert.deepEqual`); handles the missing-element case.
131
+ - `RecordedClose` — `ConnectionCloseTarget | {kind: 'all'}`.
125
132
  - `RecordingCloser` — `{closer, calls}`.
126
133
 
127
134
  ## Database — `db.ts`
128
135
 
129
136
  Factory builders for parameterized DB tests. Consumer projects pass their
130
- `init_schema` callback (which calls `run_migrations(db, [auth_migration_ns, ...app_migrations])`);
137
+ `init_schema` callback (which calls `run_migrations(db, [AUTH_MIGRATION_NS, ...app_migrations])`);
131
138
  factories accept any migration namespace set.
132
139
 
133
140
  - `DbFactory` — `{name, create, close, skip, skip_reason?}`.
@@ -163,9 +170,10 @@ fully assembled Hono app + the backend + helpers.
163
170
  Key module-scope values:
164
171
 
165
172
  - `stub_password_deps` — `PasswordHashDeps` hashing via `stub_hash_${password}` and verifying by equality. Deterministic, no Argon2 cost — use for every test not specifically exercising password hashing.
166
- - `create_loopback_app_server_options()` — the loopback `create_app_server` options an in-process test server takes (`localhost` origins, the loopback proxy trusted, an empty env schema), fresh per call; `create_test_app` and `create_test_app_for_bootstrap` spread it under their own defaults (`rate_limiters: 'disabled_for_testing'`, `await_pending_effects: true`).
173
+ - `TEST_ORIGIN` / `create_test_request_headers(extra?)` (from the dependency-free `testing/test_origin.ts`, so a cross-process suite reads them without the server assembly) — `'http://localhost:5173'`, the origin an in-process test request comes from (and `rpc_call`'s default `Origin`, cross-process too) and the one origin the loopback options allow, and the `{host: 'localhost', origin: TEST_ORIGIN}` pair every in-process request starts from, `extra` added after (the session headers builders are built on it).
174
+ - `create_loopback_app_server_options()` — the loopback `create_app_server` options an in-process test server takes (`TEST_ORIGIN` allowed, the loopback proxy trusted, an empty env schema), fresh per call; `create_test_app` spreads it under its own defaults (`rate_limiters: 'disabled_for_testing'`, `await_pending_effects: true`).
167
175
  - `TEST_COOKIE_SECRET` — 64-hex-char deterministic cookie secret. Produces a valid `Keyring` via `create_keyring`. Never used in production — the stub guard plus fixed value is the contract.
168
- - `fallback_db_factory` — module-level auth-only default factory (`create_default_db_factory`) `create_test_app_server` uses when no `db` is passed, reusing its driver's WASM cache. When `migration_namespaces` is supplied, a memoized sibling factory (keyed by namespace set) migrating `[auth_migration_ns, ...migration_namespaces]` is used instead — same shared WASM, extra tables.
176
+ - `fallback_db_factory` — module-level auth-only default factory (`create_default_db_factory`) `create_test_app_server` uses when no `db` is passed, reusing its driver's WASM cache. When `migration_namespaces` is supplied, a memoized sibling factory (keyed by namespace set) migrating `[AUTH_MIGRATION_NS, ...migration_namespaces]` is used instead — same shared WASM, extra tables.
169
177
 
170
178
  Two helpers share the "insert account + actor + roles + API token + session +
171
179
  cookie" flow, split by intent:
@@ -176,10 +184,6 @@ cookie" flow, split by intent:
176
184
  Both take `{db, keyring, session_options, password, username?, password_value?, roles?}`
177
185
  (shared `CreateTestAccountWithCredentialsOptions` / `BootstrapTestKeeperOptions`).
178
186
 
179
- For exercising the bootstrap success path end-to-end against an empty DB (no
180
- pre-keeper, lock unflipped), use `create_test_app_for_bootstrap` — pair with
181
- `describe_bootstrap_success_tests` for the consumer-runnable suite.
182
-
183
187
  Types:
184
188
 
185
189
  - `TestAppServer extends AppBackend` — adds `account`, `actor`, `api_token`, `session_cookie`, `keyring`, `cleanup()`.
@@ -187,11 +191,10 @@ Types:
187
191
  - `CreateTestAppOptions extends TestAppServerOptions` — adds `create_route_specs` (required), `rpc_endpoints?: RpcEndpointsSuiteOption` (top-level only — single source of truth, symmetric with the suite-level option), `bootstrap?: BootstrapServerOptions` (top-level only — same precedent as `rpc_endpoints`), and `app_options?: SuiteAppOptions` (`Partial<AppServerOptions>` excluding the five fields the helper manages: `backend`, `session_options`, `create_route_specs`, `rpc_endpoints`, `bootstrap`).
188
192
  - `TestAccount` — `{account, actor, session_cookie, api_token, create_session_headers, create_bearer_headers}`.
189
193
  - `TestApp` — `{app, backend, server, surface_spec, surface, route_specs, create_session_headers, create_bearer_headers, create_daemon_token_headers, create_account, cleanup}`. `server` is the assembled `AppServer`, for what `create_app_server` built beyond the lifted fields — `require_audit_sse(test_app.server)` with `audit_log_sse` in `app_options`, `test_app.server.ws_endpoints[path]` — instead of capturing them from a `create_route_specs` closure.
190
- - `CreateTestAppForBootstrapOptions` — `{session_options, create_route_specs, rpc_endpoints?, bootstrap: BootstrapLiveOptions, bootstrap_token, app_options?, db?, db_type?, password?, audit_factory?}`. `bootstrap` is required + narrowed to `live` mode (the helper exists for the success-path test).
191
- - `TestAppForBootstrap` — `{app, backend, server, surface_spec, surface, route_specs, create_request_headers, cleanup}`. No keeper credentials (test drives bootstrap itself).
192
194
 
193
195
  `create_test_app` hard-codes the test-friendly `AppServerOptions`:
194
- `allowed_origins: [/^http:\/\/localhost/]`, stub proxy pinned to `127.0.0.1`,
196
+ `allowed_origins` exactly `TEST_ORIGIN` (built by
197
+ `parse_allowed_origins`, as `create_app_server` requires), stub proxy pinned to `127.0.0.1`,
195
198
  `env_schema: z.object({})`, `rate_limiters: 'disabled_for_testing'` (every
196
199
  rate limiter `null` — a limiter passed through `app_options` wins over the
197
200
  mode, so a rate-limit test enables just the one it pins; the mode's stderr
@@ -199,14 +202,12 @@ banner prints once per module instance — once per test file in an isolated
199
202
  vitest project, once per run under `isolate: false`, ../../../docs/usage.md §Rate limiters), static daemon token state (no rotation, keeper already set),
200
203
  **`await_pending_effects: true`** (fire-and-forget effects complete before
201
204
  the response returns so tests can assert on side effects inline), and silent
202
- logger. Override via `app_options`. `create_test_app_for_bootstrap` disables
203
- the limiters the same way. `cleanup()` is the assembled server's idempotent
205
+ logger. Override via `app_options`. `cleanup()` is the assembled server's idempotent
204
206
  `close` — it also closes the server's live connections, disposes the
205
207
  limiters it built, and removes the audit listeners and closer members it
206
208
  added.
207
209
 
208
- `auth_cleanup` is left at its default, **off**, here and in
209
- `create_test_app_for_bootstrap`: a background pass would delete rows and
210
+ `auth_cleanup` is left at its default, **off**, here: a background pass would delete rows and
210
211
  write audit rows mid-test. A suite that opts in through `app_options` has the
211
212
  schedule stopped by `cleanup()`, which is the assembled server's `close`.
212
213
 
@@ -218,8 +219,8 @@ the WASM caching in `db.ts` is where the real savings are.
218
219
 
219
220
  Pre-built Hono apps at each auth level (public / authed / keeper / per-role)
220
221
  for attack-surface testing. No middleware stack — a single `/*` middleware
221
- injects `ACCOUNT_ID_KEY` + `REQUEST_CONTEXT_KEY` + `CREDENTIAL_TYPE_KEY`
222
- (default `'session'`) plus the `TEST_CONTEXT_PRESET_KEY` flag (so the
222
+ injects the `ResolvedAuth` (`RESOLVED_AUTH_KEY`, credential type default
223
+ `'session'`) + `REQUEST_CONTEXT_KEY` plus the `TEST_CONTEXT_PRESET_KEY` flag (so the
223
224
  dispatcher's authorization phase trusts the pre-baked context and skips its
224
225
  DB-backed actor resolution), then hands off to `apply_route_specs` with
225
226
  `fuz_auth_guard_resolver` + `create_fuz_authorization_handler`. Production
@@ -260,8 +261,9 @@ per-method auth shape.
260
261
 
261
262
  - `cross_backend/action_manifest.ts` — `ActionManifest` / `ActionManifestEntry`
262
263
  Zod schema (the `_testing_action_manifest` wire validator) + `build_action_manifest(specs)`,
263
- which normalizes each spec to `{method, side_effects, account, actor, roles,
264
- credential_types, rate_limit}` (auth axes pass through; `roles` /
264
+ which normalizes each spec to `{method, input, side_effects, account, actor, roles,
265
+ credential_types, rate_limit}` (`input` is `'void'` for a `z.void()` input, by
266
+ `is_void_schema`, else `'object'` — the Rust `InputShape`; auth axes pass through; `roles` /
265
267
  `credential_types` flatten to sorted arrays; `rate_limit` is the declared
266
268
  class or an explicit `null`, so a missing key reads as drift rather than a
267
269
  default). Twin of `schema_introspect.ts`. Excludes the protocol actions
@@ -272,8 +274,8 @@ credential_types, rate_limit}` (auth axes pass through; `roles` /
272
274
  including them would be a spurious cross-impl diff.
273
275
  - `cross_backend/action_manifest_parity.ts` — `diff_action_manifests` /
274
276
  `format_action_manifest_diffs` / `assert_action_manifests_equal` (twin of
275
- `schema_parity.ts`) — asserts exact method-set + per-method auth-shape parity.
276
- `ActionManifestDiff` kinds: `method_only_in`, `side_effects_differ`,
277
+ `schema_parity.ts`) — asserts exact method-set + per-method input-shape and
278
+ auth-shape parity. `ActionManifestDiff` kinds: `method_only_in`, `input_differs`, `side_effects_differ`,
277
279
  `rate_limit_differs`, `auth_field_differs`, `auth_list_differs`.
278
280
  - `cross_backend/setup.ts` `capture_action_manifest(handle)` — dumps a backend's
279
281
  manifest over the daemon-token `_testing_action_manifest` channel (twin of
@@ -345,7 +347,11 @@ field a loose output schema passes on one spine, shows up as a difference.
345
347
  one alone, registration throws. Per case, each backend's own `setup_test`
346
348
  (separate databases and keepers), the principal resolved and the request
347
349
  sent through `send_conformance_case` (`conformance_table.ts`), both answers
348
- normalized and diffed. The per-case `expect` is not asserted —
350
+ normalized and diffed. Every HTTP request carries
351
+ `DIFFERENTIAL_REQUEST_HEADERS` (`accept-encoding: identity`), so a runtime's
352
+ own compression (`Deno.serve` gzips for a request accepting it, as Node's
353
+ `fetch` sends by default) never reads as a `content-encoding` / `vary`
354
+ difference. The per-case `expect` is not asserted —
349
355
  each backend's conformance leg holds it. `KnownDivergence` is the ledger
350
356
  row: `{case_name | method, tracking_id, reason, what_differs}`, the names a
351
357
  string or a list, `what_differs` the diff paths covered (a path covers
@@ -489,8 +495,6 @@ Walks Zod schemas to generate valid values for adversarial/round-trip tests.
489
495
  - `find_route_spec(specs, method, path)` — exact match then parameterized match (`:foo` matches any segment).
490
496
  - `find_auth_route(specs, suffix, method)` — suffix-ending match for REST auth routes; decouples tests from consumer prefix. `suffix` is typed as `RestAuthRouteSuffix` and throws at runtime on unknown values (only login/logout/password/verify/signup/bootstrap remain on REST).
491
497
  - `assert_response_matches_spec(specs, method, path, response)` — 2xx → validates against `spec.output`; non-2xx → validates against merged error schemas for that status. Non-JSON responses allowed only when no schema applies.
492
- - `create_expired_test_cookie(keyring, session_options)` — validly signed cookie with `expires_at` in 1970.
493
- - `check_error_response_fields(body)` — returns the list of fields outside `KNOWN_SAFE_ERROR_FIELDS` (`error`, `issues`, `required_roles`, `required_credential_types`, `retry_after`, `has_references`, `ok`).
494
498
  - `assert_no_error_info_leakage(body, context)` — rejects field-name patterns (`stack`, `trace`, `sql`, …) + value patterns (`node_modules`, stack-like `at …`, `.ts:NN`).
495
499
  - `assert_rate_limit_retry_after_header(response, body)` — `Retry-After` numeric header equals `Math.ceil(body.retry_after)`.
496
500
  - `sensitive_field_blocklist` — `['password_hash', 'token_hash']`; never in any response body.
@@ -559,8 +563,15 @@ schema. No DB needed.
559
563
 
560
564
  ### `adversarial_headers.ts` — header injection suite
561
565
 
566
+ **Importing it mocks query modules for the whole test file.** It imports
567
+ `middleware.ts`, whose hoisted `vi.mock` replaces `api_token_queries`,
568
+ `account_queries`, and `role_grant_queries` with mocks in the importing
569
+ file — the bearer-path queries become `vi.fn()` stubs returning `undefined`,
570
+ and any other export of those modules throws on access. Keep the suite in its
571
+ own test file.
572
+
562
573
  `describe_standard_adversarial_headers(suite_name, options, allowed_origin, extra_cases?)`
563
- — 7 standard cases:
574
+ — the standard cases:
564
575
 
565
576
  1. bearer + rogue Origin → 403 `ERROR_FORBIDDEN_ORIGIN`
566
577
  2. bearer + allowed Origin → bearer silently discarded (browser context)
@@ -576,23 +587,23 @@ validation. Extra cases append to the standard list.
576
587
 
577
588
  ## Middleware stack — `middleware.ts`
578
589
 
579
- Module-level `vi.mock()` for the four query modules bearer auth touches:
590
+ Module-level `vi.mock()` for the query modules bearer auth touches:
580
591
  `api_token_queries`, `account_queries`, `role_grant_queries`. Because
581
592
  `vi.mock()` is hoisted, these run before any imports resolve — so any test
582
- file that imports from `middleware.ts` gets these mocks globally. Pair with
593
+ file that imports from `middleware.ts`, directly or through
594
+ `adversarial_headers.ts`, gets these mocks globally. Pair with
583
595
  `vi.restoreAllMocks()` in `afterEach` when mixing into `.db.test.ts` files.
584
596
 
585
597
  - `BearerAuthTestOptions`, `BearerAuthTestCase` — test-case table shape for the bearer auth runner.
586
598
  - `create_bearer_auth_mocks(tc)` — configures the module-level mocks per test case; returns spy references.
587
599
  - `TEST_CLIENT_IP = '127.0.0.1'` — IP set by the proxy stub in `create_bearer_auth_test_app`.
588
- - `create_bearer_auth_test_app(tc)` — Hono app with bearer middleware + echo route at `/api/test` returning `{ok, account_id, credential_type, api_token_id, token_scope, credential_deadline_in_ms, request_context_set}` (`credential_deadline_in_ms` — how far ahead `CREDENTIAL_DEADLINE_KEY` lies, `null` for none; `BearerAuthTestCase.expected_credential_deadline_ms` asserts it) — the account-grain identity bearer auth writes, plus a flag for tests that pre-populate `REQUEST_CONTEXT_KEY` via `pre_context`.
600
+ - `create_bearer_auth_test_app(tc)` — Hono app with bearer middleware + echo route at `/api/test` returning `{ok, resolved_auth, request_context_set}` — the `ResolvedAuth` bearer auth writes (`null` for none), its `credential_deadline` as how far ahead it lies (`null` for none; `BearerAuthTestCase.expected_credential_deadline_ms` asserts it), plus a flag for tests that pre-populate `REQUEST_CONTEXT_KEY` via `pre_context`. `assert_account_set` holds the value to exactly the `api_token` arm's fields.
589
601
  - `describe_bearer_auth_cases(suite_name, cases)` — table-driven runner; one `test()` per case; asserts status, error, body fields, `api_token_id`, context preservation.
590
602
  - `TEST_MIDDLEWARE_PATH = '/api/test'` — path used by the echo route in the stack factory.
591
603
  - `create_test_middleware_stack_app(options?)` — real proxy + origin + bearer middleware for integration-shape testing. Echo route returns `{ok, client_ip, has_context}`.
592
604
 
593
605
  The echo route under `create_bearer_auth_test_app` deliberately surfaces
594
- every middleware-written context variable (`ACCOUNT_ID_KEY`,
595
- `CREDENTIAL_TYPE_KEY`, `AUTH_API_TOKEN_ID_KEY`) — bearer middleware writes
606
+ the middleware-written `ResolvedAuth` (`get_resolved_auth`) — bearer middleware writes
596
607
  account-grain identity only; the dispatcher's authorization phase owns
597
608
  `REQUEST_CONTEXT_KEY`. The `request_context_set` flag covers the test-only
598
609
  `pre_context` injection path. When public auth surface gains a new context
@@ -694,7 +705,7 @@ method and assert the stream closes within 2s.
694
705
  `SseRouteTestSpec` per route: `{path, trigger, event_specs?, assert_closes_on_revoke?}`.
695
706
  A consumer registry closes on the revoke when its route joined it to the
696
707
  backend's closer (`ctx.deps.connection_closer.add(create_sse_connection_closer(registry, role))`)
697
- or when the suite's `on_audit_event` option wires a guard (e.g. `create_sse_auth_guard`); with
708
+ or when the suite's `on_audit_event` option wires a guard (e.g. `create_revocation_guard` over `create_sse_connection_closer(registry, role)`); with
698
709
  neither, the revoke assertion fails.
699
710
 
700
711
  Frame reading is delegated to the shared `create_sse_frame_reader`
@@ -706,16 +717,16 @@ streaming `fetch` body.
706
717
  ### `ws_round_trip.ts` — WebSocket harness (non-HTTP)
707
718
 
708
719
  In-process test driver for `register_action_ws`. Consumers pass specs +
709
- handlers, receive `{transport, connect()}` back. The full dispatch path is
720
+ handlers, receive `{registry, connect()}` back. The full dispatch path is
710
721
  exercised (per-action auth, input validation, `ctx.notify`, broadcast via
711
- `BackendWebsocketTransport`, close-on-revoke), but Hono's wire upgrade is
722
+ `ConnectionRegistry`, close-on-revoke), but Hono's wire upgrade is
712
723
  skipped — there is no server, so no runtime adapter; the cross-process suites
713
724
  cover real sockets.
714
725
 
715
726
  Three layers:
716
727
 
717
- 1. **Primitives** — `create_fake_ws(options?)` (a real `WSContext` over capture arrays `sends` / `closes`, plus `socket` — the fake runtime socket behind `ws.raw`, shaped like Node's `ws`: a `bufferedAmount` the transport's outbound writer reads for backpressure, `stalled` (start it with `{stalled: true}`) to model a client that stopped reading, and `terminate` / `terminated` for the frameless cut; `readyState` reads open until closed or terminated), `create_fake_hono_context(opts)`, `create_stub_upgrade()`, `MinimalActionEnvironment`, `dispatch_ws_message(on_message, event, ws)`. The fake context sets the keys the production auth middleware sets — `AUTH_SESSION_TOKEN_HASH_KEY` included, as `hash_session_token(auth_session_id)` — because the dispatcher reads the credential through `get_resolved_auth(c)`; a hand-built upgrade context must do the same. `create_stub_upgrade()` stands in for a runtime adapter's `upgradeWebSocket`: it passes a request without `Upgrade: websocket` to `next()`, and records an upgrade request — its real `Context` and the endpoint's events factory — in `upgrades`, answering `200`. So a test can send `app.request('/api/ws', {headers: {upgrade: 'websocket', cookie | authorization, origin, 'x-forwarded-for'}})` through an assembled app's whole middleware chain and build the socket's events from the `Context` that chain produced (`src/test/server/create_app_server_ws_endpoints.dispatch.db.test.ts`); `get_create_events()` still returns the last mounted factory, for a hand-built context.
718
- 2. **Harness** — `create_ws_test_harness({actions, transport?, heartbeat?, log?, on_socket_open?, on_socket_close?})` → `WsTestHarness`. `connect(identity?)` is async and resolves after the connection is admitted and `on_socket_open` completes, so broadcasts sent immediately after `await harness.connect()` reach the client. The harness pre-bakes its `RequestContext` (`TEST_CONTEXT_PRESET_KEY`), which also skips the admission credential re-read — there are no session or token rows behind a harness identity — so tests of the re-read itself drive `register_action_ws` with a real database and no preset (`src/test/actions/register_action_ws.admission.db.test.ts`). The harness threads its own `create_stub_db()` into the dispatcher's `db` slot so handlers declaring `side_effects: true` execute under the same transaction wrap they would in production (the stub's `transaction(fn)` synchronously calls `fn(stub_db)`); domain deps reach handlers via factory closures, the same way HTTP RPC factories already wire them. Audit fan-out runs through whatever `audit` emitter the consumer supplied to its action factory closure (typically `create_test_audit_emitter()` for unit harnesses).
728
+ 1. **Primitives** — `create_fake_ws(options?)` (a real `WSContext` over capture arrays `sends` / `closes`, plus `socket` — the fake runtime socket behind `ws.raw`, shaped like Node's `ws`: a `bufferedAmount` the registry's outbound writer reads for backpressure, `stalled` (start it with `{stalled: true}`) to model a client that stopped reading, and `terminate` / `terminated` for the frameless cut; `readyState` reads open until closed or terminated), `create_fake_hono_context(opts)`, `create_stub_upgrade()`, `MinimalActionEnvironment`, `dispatch_ws_message(on_message, event, ws)`. The fake context sets the `ResolvedAuth` the production auth middleware sets (`RESOLVED_AUTH_KEY`, built by `create_test_resolved_auth` — a session's hash as `hash_session_token(auth_session_id)`), because the dispatcher reads the credential through `get_resolved_auth(c)`; a hand-built upgrade context must do the same. `create_stub_upgrade()` stands in for a runtime adapter's `upgradeWebSocket`: it passes a request without `Upgrade: websocket` to `next()`, and records an upgrade request — its real `Context` and the endpoint's events factory — in `upgrades`, answering `200`. So a test can send `app.request('/api/ws', {headers: {upgrade: 'websocket', cookie | authorization, origin, 'x-forwarded-for'}})` through an assembled app's whole middleware chain and build the socket's events from the `Context` that chain produced (`src/test/server/create_app_server_ws_endpoints.dispatch.db.test.ts`); `get_create_events()` still returns the last mounted factory, for a hand-built context.
729
+ 2. **Harness** — `create_ws_test_harness({actions, registry?, receive_timeout?, log?, on_socket_open?, on_socket_close?})` → `WsTestHarness`. `connect(identity?)` is async and resolves after the connection is admitted and `on_socket_open` completes, so broadcasts sent immediately after `await harness.connect()` reach the client. The harness pre-bakes its `RequestContext` (`TEST_CONTEXT_PRESET_KEY`), which also skips the admission credential re-read — there are no session or token rows behind a harness identity — so tests of the re-read itself drive `register_action_ws` with a real database and no preset (`src/test/actions/register_action_ws.admission.db.test.ts`). The harness threads its own `create_stub_db()` into the dispatcher's `db` slot so handlers declaring `side_effects: true` execute under the same transaction wrap they would in production (the stub's `transaction(fn)` synchronously calls `fn(stub_db)`); domain deps reach handlers via factory closures, the same way HTTP RPC factories already wire them. Audit fan-out runs through whatever `audit` emitter the consumer supplied to its action factory closure (typically `create_test_audit_emitter()` for unit harnesses).
719
730
  3. **Round-trip helpers** — predicates + wire-frame types live in `transports/ws_client.ts` (shared with the cross-process `ws_transport.ts` impl): `is_notification(method)`, `is_notification_with<P>(method, match)` (type-guard combinator — narrows `wait_for` return type), `is_response_for(id)`, `JsonrpcNotificationFrame<P>` / `JsonrpcSuccessResponseFrame<R>` / `JsonrpcErrorResponseFrame<D>` (typed wire-frame shapes distinct from the runtime Zod schemas in `http/jsonrpc.ts` — generic over `params` / `result` / `data` so tests narrow without casts).
720
731
 
721
732
  `WsClient` (in `transports/ws_client.ts`):
@@ -908,60 +919,6 @@ Bootstrap audit logging is excluded because `create_test_app` doesn't
908
919
  provide the filesystem token state; covered separately in
909
920
  `bootstrap_account.db.test.ts`.
910
921
 
911
- ### `standard.ts` — `describe_standard_tests`
912
-
913
- Bundles every DB-backed suite carrying the standard option shape, each
914
- gated on its relevant config — silent-skip when the gate isn't met:
915
-
916
- - `integration` — always
917
- - `admin` — `roles` provided
918
- - `audit_completeness` — `roles` provided (proxy for consumer admin wiring; `rpc_endpoints` is bundle-required)
919
- - `bootstrap_success` — `bootstrap.mode === 'live'`
920
- - `round_trip` — always
921
- - `rpc_round_trip` — `rpc_endpoints` provided
922
- - `data_exposure` — always
923
- - `rate_limiting` — always (owns its own per-test setup, bypasses the fixture protocol — needs `create_route_specs` directly)
924
-
925
- Realization that lifted the bundle from 2 suites to 8: fold-in cost between
926
- suites is zero because each `describe_*` block owns its own setup via the
927
- `{setup_test, surface_source, capabilities}` protocol, so suites whose
928
- tests need opposite-shaped default DB state (e.g. the bootstrap-success
929
- suite needs an empty DB while the integration suite needs the
930
- pre-bootstrapped keeper) coexist in one bundle without cost. Each test
931
- invokes the right per-test fixture. Consumers wiring the standard surface
932
- call once instead of seven times; forgetting a suite no longer silently
933
- loses coverage.
934
-
935
- `rpc_success_fixtures`, `rpc_skip_methods` and `rpc_input_overrides`
936
- forward to the RPC round-trip's `success_fixtures`, `skip_methods` and
937
- `input_overrides` (same options on `describe_standard_cross_process_tests`;
938
- `describe_spine_cross_suites` also forwards `rpc_input_overrides` to
939
- `rpc_adversarial`) — `rpc_skip_methods` is the consumer escape hatch for a
940
- method the generic round-trip can't drive in its test wiring.
941
-
942
- `StandardTestOptions` requires `create_route_specs` (for rate_limiting) and
943
- `rpc_endpoints` (for admin/audit_completeness/rpc_round_trip); the admin
944
- suite's requirement is enforced at the type level so a missing
945
- `rpc_endpoints` is a compile error rather than a runtime throw. Optional
946
- `bootstrap` (top-level, same precedent as `rpc_endpoints`) feeds both the
947
- disabled/surface_only/live wire-shape gating and the bootstrap-success
948
- suite gate.
949
-
950
- Attack surface suites stay separate — their option shape is
951
- `{build, snapshot_path, expected_public_routes, ...}` rather than the
952
- shared `{setup_test, surface_source, capabilities}`. A peer
953
- `describe_standard_surface_tests` bundler lives for that side if/when
954
- needed.
955
-
956
- Cross-process counterpart: `cross_backend/standard.ts` —
957
- `describe_standard_cross_process_tests`. Different bundle because three of
958
- the eight in-process suites don't survive a process boundary
959
- (`rate_limiting` needs a fresh per-test `TestApp`, `audit_completeness`
960
- reads FK structure, `bootstrap_success` is one-shot per backend lifecycle);
961
- the cross-process bundle documents the omissions once upstream so
962
- per-consumer files don't repeat the bookkeeping. See the Cross-backend
963
- integration layer §`cross_backend/standard.ts` below.
964
-
965
922
  ## RPC helpers
966
923
 
967
924
  ### `rpc_helpers.ts` — envelope construction + response assertions
@@ -987,7 +944,7 @@ One-shot transport:
987
944
  - `headers_to_record(headers)` — snapshot a `Headers` into a lowercased-key `Record<string, string>` (multi-value collapses to the comma-joined form; `Set-Cookie` excluded). Used by `rpc_call` and the conformance table's REST branch to thread response headers through for assertions.
988
945
  - `RpcCallArgs` — `{app, path, method, params?, headers?, id?, verb?}`. `verb` defaults to `'POST'`; use `'GET'` for `side_effects: false` methods.
989
946
  - `rpc_call_raw(args)` — the same request as `rpc_call`, the response unparsed: `RpcCallRawResult` `{status, headers, body}` with the whole envelope. `parse_rpc_call_result(raw, method)` turns it into an `RpcCallResult`; `rpc_call` is the two composed.
990
- - `rpc_call(args)` — merges `RPC_CALL_DEFAULT_HEADERS` (`host: 'localhost'`, `origin: 'http://localhost:5173'`, `Content-Type: 'application/json'`) under caller headers. Envelope-shape violations throw; JSON-RPC errors return `{ok: false, error}` so callers assert on `error.code` / `error.data.reason`.
947
+ - `rpc_call(args)` — merges `RPC_CALL_DEFAULT_HEADERS` (`host: 'localhost'`, `origin: TEST_ORIGIN`, `Content-Type: 'application/json'`) under caller headers. Envelope-shape violations throw; JSON-RPC errors return `{ok: false, error}` so callers assert on `error.code` / `error.data.reason`.
991
948
  - `rpc_call_typed<T>(args, output_schema)` — parses the success `result` through the schema; throws on envelope failure, error response, or schema mismatch. Use `rpc_call` when the test needs to assert on error shapes.
992
949
  - `rpc_call_for_spec<TSpec>(args)` — spec-bound variant: takes `{..., spec, params}` in place of `{..., method, params}`. `params` is typed from `spec.input` and the success `result` is typed from `spec.output` (runtime-validated, same contract as `rpc_call_typed`). Error branch stays untyped (JSON-RPC `error.data` shapes vary per call site). Use at happy-path + denial-path call sites; fall back to `rpc_call` for adversarial tests that send deliberately-malformed params.
993
950
 
@@ -1010,7 +967,7 @@ Registry lookups:
1010
967
  - **keeper rejects non-daemon credentials** — session and api_token credentials are rejected even when the account has the keeper role (only `daemon_token` passes). The credential-type gate fires before the role gate (see `auth/CLAUDE.md` §Keeper auth shape).
1011
968
  - correct auth passes (not 401/403)
1012
969
  - GET unauthenticated for `side_effects: false` reads
1013
- 2. **RPC adversarial envelopes** — the fixed set `create_rpc_envelope_cases(endpoint, {skip_methods?})` builds, exercising the envelope parse, method lookup, and GET read restriction: non-JSON body → `parse_error`, wrong `jsonrpc` version, missing `jsonrpc` / `method` / `id`, batch array, non-object POST `params` → `invalid_request`, unknown method → `method_not_found`, GET missing `method`/`id` → `invalid_request`, GET invalid-JSON params → `invalid_params`, GET non-object params on **every** read (each of `RPC_NON_OBJECT_PARAMS`: a number, an array, a string, a boolean) → `invalid_params`, GET mutation method → `invalid_request`, plus three ordering cases sent with no credential (an anonymous GET mutation and an anonymous batch, both `invalid_request`, never 401; an anonymous GET with non-object params on a read requiring an identity, the 401 — params validation runs after authorization). Each case is sent by the app its method's auth admits (`select_auth_app`) and pins status, code, echoed `id`, and `data.reason` (exact where the dispatcher sets one, absent otherwise) via `assert_rpc_envelope_refusal`. The cases are data (`RpcEnvelopeCase`) in the hono-free `rpc_envelope_cases.ts`, shared with the cross-process `describe_rpc_adversarial_cross_tests`; `to_rpc_envelope_request` builds a case's request, and `rpc_get_side_effects_reason(method)` is the GET read restriction's reason.
970
+ 2. **RPC adversarial envelopes** — the fixed set `create_rpc_envelope_cases(endpoint, {skip_methods?})` builds, exercising the envelope parse, method lookup, and GET read restriction: non-JSON body → `parse_error`, wrong `jsonrpc` version, missing `jsonrpc` / `method` / `id`, a response-shaped body (`{jsonrpc, id, result}`) → `invalid_request` on `id: null`, batch array, non-object POST `params` → `invalid_request`, unknown method → `method_not_found`, GET missing `method`/`id` → `invalid_request`, GET invalid-JSON params → `invalid_params`, GET non-object params on **every** read (each of `RPC_NON_OBJECT_PARAMS`: a number, an array, a string, a boolean) → `invalid_params`, GET mutation method → `invalid_request`, plus three ordering cases sent with no credential (an anonymous GET mutation and an anonymous batch, both `invalid_request`, never 401; an anonymous GET with non-object params on a read requiring an identity, the 401 — params validation runs after authorization). Each case is sent by the app its method's auth admits (`select_auth_app`) and pins status, code, echoed `id`, and `data.reason` (exact where the dispatcher sets one, absent otherwise) via `assert_rpc_envelope_refusal`. The cases are data (`RpcEnvelopeCase`) in the hono-free `rpc_envelope_cases.ts`, shared with the cross-process `describe_rpc_adversarial_cross_tests`; `to_rpc_envelope_request` builds a case's request, and `rpc_get_side_effects_reason(method)` is the GET read restriction's reason.
1014
971
  3. **RPC adversarial params** — `generate_rpc_params_test_cases(input, options?)` (`rpc_envelope_cases.ts`): `generate_input_test_cases` minus its structural cases (a non-object `params` is refused at the envelope, not at params validation), taking the same `{base?, label?}`. Every case expects 400 `invalid_params` with `data.reason` the broken field's declared `invalid_reason` (`expected_invalid_reason`), absent for an undeclared field. Shared with the cross-process suite. `input_overrides` (method name → valid params) seeds a method's cases from that base; an override its schema refuses throws at collection, naming the method.
1015
972
 
1016
973
  Skips silently when `surface.rpc_endpoints` is empty. Uses stub deps — no
@@ -1066,7 +1023,7 @@ file; the dual-spawn and limiter-enabled suites name their own files.
1066
1023
  `migration_namespaces` for suites needing tables beyond the auth-only
1067
1024
  default — the cell parity suite passes `[CELL_MIGRATION_NS]`, and
1068
1025
  `create_test_app` provisions a per-test fresh db migrating
1069
- `[auth_migration_ns, ...migration_namespaces]`), and
1026
+ `[AUTH_MIGRATION_NS, ...migration_namespaces]`), and
1070
1027
  `default_in_process_suite_options(options)` (emits the full Tier 1 suite
1071
1028
  options bag: the `{setup_test, surface_source, capabilities}` triple plus
1072
1029
  `session_options` / `create_route_specs` / `rpc_endpoints` pass-through;
@@ -1126,7 +1083,7 @@ file; the dual-spawn and limiter-enabled suites name their own files.
1126
1083
  reader (`ws_refusal_body` picks how the front-door table reads a WS
1127
1084
  refusal instead); `peer_request` (server-initiated requests — the ActionPeer
1128
1085
  `peer/ping` round-trip) is `true` on fuz_app's Rust and TS spine presets
1129
- (`BackendWebsocketTransport.request_connection`); a backend states it
1086
+ (`ConnectionRegistry.request_connection`); a backend states it
1130
1087
  `true` once it wires the `peer/ping` HTTP + WS mount), `test_if(cond, name, fn)`
1131
1088
  for capability-gated cases, and `in_process_capabilities` preset. Only
1132
1089
  flags a suite reads are capabilities — a wiring fact that gates nothing is
@@ -1152,7 +1109,11 @@ file; the dual-spawn and limiter-enabled suites name their own files.
1152
1109
  plain CRUD would declare `cell_crud: true, cell_relations: false`.
1153
1110
  `cell_gated_create` gates `describe_cell_gated_create_cross_tests` +
1154
1111
  `describe_cell_moderate_cross_tests` (the parent-aware-creation-authorizer +
1155
- `cell_moderate` parity proofs); unlike `cell_crud`/`cell_relations`
1112
+ `cell_moderate` parity proofs) and, with `cell_relations`,
1113
+ `describe_cell_grant_steward_cross_tests` (the steward-revoke seam: a scoped
1114
+ `participant` grant stewards its scope under the
1115
+ `test_cell_grant_steward_revoke_authorize` policy mounted beside the create
1116
+ one); unlike `cell_crud`/`cell_relations`
1156
1117
  it is **cross-only** (`false` in-process) — `true` only on the reference
1157
1118
  spine binaries that live-mount the `test_cell_gated_create_authorize` policy
1158
1119
  (the TS spine `full_spine_mount` + the Rust `testing_spine_stub`), since the
@@ -1173,7 +1134,8 @@ file; the dual-spawn and limiter-enabled suites name their own files.
1173
1134
  `fact_holder` row, so a non-admin can reference what it seeds, and whose
1174
1135
  optional `external_url` writes a bare external row naming that URL, so the
1175
1136
  suite can pin that a URL naming another hash's file is refused) — it also
1176
- gates `describe_cell_ref_admission_cross_tests`. `fact_serving_admin_hash`
1137
+ gates `describe_cell_ref_admission_cross_tests` (its grant, item, and clone
1138
+ cases with `cell_relations`). `fact_serving_admin_hash`
1177
1139
  is the admin-only bare-hash route (`GET /api/facts/:hash`), its own flag
1178
1140
  because a backend can serve the cell-gated route alone: it gates the
1179
1141
  fact-serving suite's bare-hash cases (with `fact_serving`) and the bare-hash
@@ -1204,8 +1166,7 @@ file; the dual-spawn and limiter-enabled suites name their own files.
1204
1166
 
1205
1167
  ### `cross_backend/standard.ts` — `describe_standard_cross_process_tests`
1206
1168
 
1207
- Cross-process counterpart to `describe_standard_tests`. Wires the
1208
- cross-process-safe subset in one call:
1169
+ Wires the standard suites that run against a spawned backend in one call:
1209
1170
 
1210
1171
  - `integration` — always
1211
1172
  - `admin` — `roles` provided
@@ -1213,22 +1174,25 @@ cross-process-safe subset in one call:
1213
1174
  - `rpc_round_trip` — always
1214
1175
  - `data_exposure` — always
1215
1176
 
1216
- Three suites from the in-process bundle are omitted by design:
1217
- `rate_limiting` (needs a fresh per-test `TestApp` for tight rate-limiter
1218
- overrides; the spawned binary has no restart-per-test budget),
1219
- `audit_completeness` (reads FK structure that only the in-process backend
1220
- exposes; wire-level audit observability lives in the consumer's own audit
1221
- `.cross.test.ts`), `bootstrap_success` (bootstrap is one-shot per backend
1222
- lifecycle, already consumed by the consumer's `globalSetup`). The omission
1223
- rationale lives in the module doc once instead of repeating in each
1224
- consumer's `*.cross.test.ts`.
1177
+ Two in-process suites are omitted by design: `rate_limiting` (needs a fresh
1178
+ per-test `TestApp` for tight rate-limiter overrides; the spawned binary has no
1179
+ restart-per-test budget) and `audit_completeness` (reads FK structure that only
1180
+ the in-process backend exposes; wire-level audit observability lives in the
1181
+ consumer's own audit `.cross.test.ts`). The omission rationale lives in the
1182
+ module doc once instead of repeating in each consumer's `*.cross.test.ts`.
1183
+
1184
+ `rpc_success_fixtures`, `rpc_skip_methods` and `rpc_input_overrides`
1185
+ forward to the RPC round-trip's `success_fixtures`, `skip_methods` and
1186
+ `input_overrides` (`describe_spine_cross_suites` also forwards
1187
+ `rpc_input_overrides` to `rpc_adversarial`) — `rpc_skip_methods` is the
1188
+ consumer escape hatch for a method the generic round-trip can't drive in its
1189
+ test wiring.
1225
1190
 
1226
1191
  Hard-codes the cross-process-safe set with no `skip` knob; if a future
1227
1192
  consumer needs partial opt-out, add the knob then.
1228
- `StandardCrossProcessTestOptions` is shape-aligned with
1229
- `StandardTestOptions` minus the in-process-only knobs (`create_route_specs`,
1230
- `bootstrap`, `rate_limiting_app_options`, `bootstrap_token`) — those drive
1231
- the omitted suites.
1193
+ `StandardCrossProcessTestOptions` is the in-process suites' shared options
1194
+ minus their in-process-only knobs (`create_route_specs`,
1195
+ `rate_limiting_app_options`).
1232
1196
 
1233
1197
  ### `cross_backend/spine_suites.ts` — `describe_spine_cross_suites`
1234
1198
 
@@ -1484,19 +1448,20 @@ capabilities}` protocol every Tier 1 suite uses, so **one case array runs
1484
1448
  always-available principals to fixture accessors; `role_holder` /
1485
1449
  `wrong_role` read a seeded `extra_accounts` username named via
1486
1450
  `options.principals`. `send_conformance_case(c, {fixture, surface_source, principals?,
1487
- resolved_rpc_endpoints})` (exported) is the send half — principal resolved,
1451
+ resolved_rpc_endpoints, request_headers?})` (exported) is the send half — principal resolved,
1488
1452
  request sent, the raw `{target, status, headers, body}` back unasserted; the
1489
1453
  table asserts on it, and the cross-backend differential compares two.
1454
+ `request_headers` go on the HTTP request beneath the principal's (the
1455
+ differential's identity encoding); the WS leg sends none.
1490
1456
  **WS leg:** `ws: WsEndpointTarget` (`{base_url, ws_path, origin?}`) on
1491
1457
  either sends each case as one frame on an admitted socket the principal
1492
1458
  opens — its headers on the upgrade, no `Origin` where the HTTP leg
1493
- suppresses it, its own actor as `?acting=`. Only the TS spine resolves an
1494
- actor at the upgrade, refusing a multi-actor account's upgrade without
1495
- `?acting=` (400 `actor_required`); the Rust spine's upgrade resolves the
1496
- account and ignores it. Per-frame dispatch resolves each frame's `acting` on
1497
- both. The leg always sends `?acting=`, so it does not cover that
1498
- upgrade-level difference; the front-door table's multi-actor row does. The frame is the envelope the HTTP
1499
- body is (`perform_action_result_to_envelope` on TS), so the response reads
1459
+ suppresses it, its own actor as `?acting=`. Both spines resolve an actor at
1460
+ the upgrade, refusing a multi-actor account's upgrade without `?acting=`
1461
+ (400 `actor_required`), and per-frame dispatch resolves each frame's
1462
+ `acting` on both. The leg always sends `?acting=`, so it does not cover that
1463
+ upgrade refusal; the front-door table's multi-actor row does. The frame is the envelope the HTTP
1464
+ body is (`serialize_action_result` on TS), so the response reads
1500
1465
  `{status, headers: {}, body: frame}` with `status` the code's
1501
1466
  `jsonrpc_error_code_to_http_status` (200 for a result) and every row holds
1502
1467
  unchanged. What WS loses is headers — the TS DEV-only `X-Fuz-Auth-Debug`
@@ -1583,12 +1548,11 @@ Real-upgrade WebSocket coverage of a spawned backend — the cross-process
1583
1548
  counterpart to the in-process `ws_round_trip.ts` harness, kept a separate
1584
1549
  call (not folded into `describe_standard_cross_process_tests`) because it
1585
1550
  needs raw `base_url` / `ws_path` the standard bundle doesn't carry, mirroring
1586
- how `describe_ws_round_trip_tests` sits beside `describe_standard_tests`
1587
- in-process. `describe_cross_process_ws_tests({setup_test, capabilities,
1551
+ how `describe_ws_round_trip_tests` sits beside the in-process suites. `describe_cross_process_ws_tests({setup_test, capabilities,
1588
1552
  base_url, ws_path, origin?, rpc_path?, max_message_bytes?, logout_path?,
1589
1553
  password_path?, max_tokens?, ws_account_roles?})` opens a live
1590
1554
  `WebSocket` via `create_ws_transport` (the `ws` npm package) and asserts
1591
- cases against the upgrade stack `register_ws_endpoint` wires (origin →
1555
+ cases against the upgrade route `register_action_ws` mounts (origin →
1592
1556
  `require_auth` → dispatch): authed upgrade round-trips `heartbeat`,
1593
1557
  requests sent the moment the socket opens are all answered (both spines admit a
1594
1558
  connection only after re-reading its credential; frames that arrive first wait
@@ -1675,7 +1639,7 @@ completes in the drain's first poll. Unlike `describe_cross_process_ws_tests` (c
1675
1639
  built from spine primitives only (accounts / role-grants / offers / WS), zero
1676
1640
  consumer domain, so it lives here and runs against any backend that wires the
1677
1641
  standard RPC actions' `notification_sender` and registers a WS socket: fuz_app's
1678
- own spine self-tests (`testing_spine_server`, whose `ws_transport` is threaded
1642
+ own spine self-tests (`testing_spine_server`, whose `connection_registry` is threaded
1679
1643
  as the sender via `spine_rpc_endpoints({notification_sender})`; the Rust
1680
1644
  `testing_spine_stub`, which wires it natively) and downstream twin-impl
1681
1645
  consumers (fuz_forge's Deno + Rust backends call it as a thin invocation).
@@ -1698,7 +1662,7 @@ spine binaries' role-gated endpoint with `ws_required_roles` declared.
1698
1662
  Real-upgrade parity for a **role-gated WebSocket losing its role**: a revoked
1699
1663
  global grant of a role an endpoint's `required_roles` lists closes the account's
1700
1664
  sockets on that endpoint with `WS_CLOSE_PERMISSION_REVOKED` (and its reason),
1701
- while the account's ungated socket on the same transport stays open,
1665
+ while the account's ungated socket on the same connection registry stays open,
1702
1666
  dispatching, and receiving the account's pushes, and a re-upgrade is refused at
1703
1667
  the gate (403); a scoped revoke of a listed role closes nothing — the case
1704
1668
  first opens the gated socket on a global grant of `scoped_role` alone, which
@@ -1727,11 +1691,14 @@ drives the whole round-trip and every outcome (success / `Timeout` / wrong-shape
1727
1691
  the inbound server-initiated request is answered as soon as it arrives; the
1728
1692
  security negatives use the raw `WsClient.send` to inject unsolicited /
1729
1693
  cross-connection frames. Cases: the positive round-trip plus
1730
- unsolicited-response rejection, per-connection id isolation, never-reply
1694
+ unsolicited-response rejection, per-connection id isolation (a second
1695
+ socket's forged reply for the first's id, then a round-trip on the second
1696
+ socket as a barrier, so the first's timeout is asserted to come after the
1697
+ forged reply was read — never a deadline that ran out first), never-reply
1731
1698
  `Timeout`, wrong-shape rejection, an undeclared reply key accepted and dropped
1732
1699
  (both spines read the reply forward-compatibly), client-error forwarding, and
1733
1700
  the HTTP no-transport path. Gated on `capabilities.peer_request` — `true` on
1734
- both the Rust spine and the TS spine (the `BackendWebsocketTransport.request_connection`
1701
+ both the Rust spine and the TS spine (the `ConnectionRegistry.request_connection`
1735
1702
  path + `register_action_ws` response correlation); `peer/ping` is a protocol
1736
1703
  action (manifest-excluded), so parity is behavioral here, not via the manifest
1737
1704
  gate. Cross-process only.
@@ -1751,11 +1718,29 @@ it — so the suite gates on `capabilities.peer_request`.
1751
1718
  ws_path})`. The wire literals are independent copies of the producers'
1752
1719
  constants, so a value changed on one spine fails here. Cross-process only.
1753
1720
 
1721
+ ### `cross_backend/ws_envelope.ts` — `describe_ws_envelope_cross_tests`
1722
+
1723
+ Real-upgrade parity for the WS read loop's frame envelope — the socket twin of
1724
+ `rpc_adversarial`'s HTTP envelope cases. A frame that is not JSON answers
1725
+ `parse_error`, a scalar or bare-string frame and a batch array each answer
1726
+ `invalid_request`, all with `id: null` and the socket left open; a
1727
+ notification, a stray response matching no server-initiated request, and a
1728
+ `cancel` (unknown id, malformed params, or a request in flight) answer no
1729
+ frame. The in-flight cancel holds a `peer/ping` with
1730
+ `create_holding_peer_ping_responder` (exported from `ws_inbound_dispatch.ts`)
1731
+ and pins that the request still answers under its id — neither spine's
1732
+ `peer/ping` observes its signal, so the cancel's effect is a consumer seam's
1733
+ to pin. Silence is asserted positively: a `heartbeat` probe after the frames,
1734
+ and nothing but its response after the mark. Gated on `capabilities.ws`, the
1735
+ in-flight cancel also on `capabilities.peer_request`.
1736
+ `describe_ws_envelope_cross_tests({setup_test, capabilities, base_url,
1737
+ ws_path})`. Cross-process only.
1738
+
1754
1739
  ### `cross_backend/ws_outbound_overflow.ts` — `describe_ws_outbound_overflow_cross_tests`
1755
1740
 
1756
1741
  Real-upgrade parity for the **per-connection outbound bound** — the byte
1757
1742
  budget both spines hold a WebSocket's waiting frames to
1758
- (`BackendWebsocketTransport`'s `outbound_queue_bytes`, the Rust `fuz_realtime`
1743
+ (`ConnectionRegistry`'s `outbound_queue_bytes`, the Rust `fuz_realtime`
1759
1744
  outbound queue; same default, same per-frame charge). The close code and its
1760
1745
  reason are wire contract — a client reads `WS_CLOSE_OUTBOUND_OVERFLOW` as "you
1761
1746
  fell behind, reconnect" — so this is the pin that runs on both.
@@ -1783,7 +1768,7 @@ flood action on its WS endpoint.
1783
1768
  ### `cross_backend/ws_connection_cap.ts` — `describe_ws_connection_cap_cross_tests`
1784
1769
 
1785
1770
  Real-upgrade parity for the **per-account WebSocket connection cap** — the
1786
- evict-oldest policy both spines apply (`BackendWebsocketTransport`'s
1771
+ evict-oldest policy both spines apply (`ConnectionRegistry`'s
1787
1772
  `max_connections_per_account`, the Rust `fuz_realtime` `ConnectionRegistry`).
1788
1773
  The close code, its reason, and which socket closes are wire contract — a
1789
1774
  client reads `WS_CLOSE_CONNECTION_LIMIT` as "superseded, don't reconnect" — so
@@ -1794,8 +1779,8 @@ fresh-per-test keeper's session cookies (one account), each answering a
1794
1779
  `heartbeat` before the next opens (`create_admitted_ws_transport`) so the
1795
1780
  backend registered them in order and
1796
1781
  "oldest" names the same socket on both spines. Cases: one connection past the
1797
- cap closes exactly the oldest with `WS_CLOSE_CONNECTION_LIMIT` + reason
1798
- `connection limit` while every other socket, the newest included, keeps
1782
+ cap closes exactly the oldest with `WS_CLOSE_CONNECTION_LIMIT` +
1783
+ `WS_CLOSE_CONNECTION_LIMIT_REASON` while every other socket, the newest included, keeps
1799
1784
  dispatching — and the session then upgrades again (a revoked session couldn't),
1800
1785
  superseding the next-oldest; and a socket held open while a cap's worth of
1801
1786
  others open and close in sequence is never evicted (a backend that leaks closed
@@ -1812,14 +1797,18 @@ cross-process only.
1812
1797
 
1813
1798
  Parity for the per-account session cap over real HTTP: logging in past
1814
1799
  `max_sessions` (default `DEFAULT_MAX_SESSIONS`) never refuses a login and
1815
- evicts the oldest session.
1800
+ evicts the oldest session, and `account_session_list` marks each login's own
1801
+ session `is_current` (none for a bearer or daemon-token caller, even with a
1802
+ session cookie beside the daemon token).
1816
1803
  `describe_session_cap_cross_tests({setup_test, max_sessions?, login_path?,
1817
- status_path?, ws?, ws_account_roles?})` — pass `ws` (`{base_url, ws_path, origin?}`) to also
1818
- assert that the evicted session's socket is closed with
1819
- `WS_CLOSE_SESSION_REVOKED` once the evicting login commits; omitted, that case
1820
- is skipped, so a caller passes it only for a backend with `capabilities.ws`;
1821
- `ws_account_roles` gives that case's account roles, for a backend whose WS
1822
- upgrade requires one.
1804
+ status_path?, rpc_path?, ws?, ws_account_actions?, ws_account_roles?})` —
1805
+ pass `ws` (`{base_url, ws_path, origin?}`) to also assert that the evicted
1806
+ session's socket is closed with `WS_CLOSE_SESSION_REVOKED` once the evicting
1807
+ login commits; omitted, that case is skipped, so a caller passes it only for
1808
+ a backend with `capabilities.ws`. `ws_account_actions`
1809
+ (`capabilities.ws_account_actions`) also lists the sessions over a login's
1810
+ socket and asserts its own row is the one current; `ws_account_roles` gives
1811
+ the socket accounts' roles, for a backend whose WS upgrade requires one.
1823
1812
  Cross-process only.
1824
1813
 
1825
1814
  ### `cross_backend/sse_round_trip.ts` — `describe_cross_process_sse_tests`
@@ -1956,15 +1945,23 @@ the option type states whether the bundle is read.
1956
1945
  admin-only (a non-admin → **403** `cell_create_forbidden`, and the same for a
1957
1946
  non-admin `cell_clone` of a viewable space — clone runs the authorizer for
1958
1947
  every cell it writes); a **contribution**
1959
- under a space is gated by the root's `data.policy[kind] = {min_role,
1960
- moderation_required}`, with `moderation` set per the verdict (`pending`+private
1961
- vs `approved`+author-visibility); a **hidden** parent **404**-masks vs a
1962
- **visible** one **403**s; plain parentless creates stay open. The moderate
1963
- suite then proves the `pending → approved | rejected` transition: an admin
1964
- (root manager) approves → public, the **author** self-approve → 403
1965
- (anti-self-approval), a non-viewer → 404, reject → stays private, and a cell
1948
+ under a space is gated by the root's `policy[kind] = {min_role,
1949
+ moderation_required}` (the root's manage-tier `policy` column), with
1950
+ `moderation` set per the verdict (`pending`+private vs
1951
+ `approved`+author-visibility); a **hidden** parent **404**-masks vs a
1952
+ **visible** one **403**s; plain parentless creates stay open. The root policy
1953
+ itself: `cell_policy_set` writes it (audited old and new), answers an
1954
+ editor-grant holder 403 `cell_policy_manage_only` and a non-viewer the 404,
1955
+ refuses a contribution `cell_policy_root_only`, and runs each policy through
1956
+ the authorizer's `validate_policy` (`cell_policy_invalid`); an editor
1957
+ rewriting the root's `data.policy` leaves moderation as the column says. The moderate
1958
+ suite then proves the `pending → approved | rejected` transition and the
1959
+ `approved → rejected` takedown: an admin (root manager) approves → public,
1960
+ the **author** self-approve → 403 (anti-self-approval), a non-viewer → 404, reject → stays private, and a cell
1966
1961
  with no governing root → 400 `cell_not_a_contribution` for any viewer, the
1967
- 404 mask first for a non-viewer. It also
1962
+ 404 mask first for a non-viewer; approval needs a pending post and rejection
1963
+ a pending or approved one (the takedown), else 400 `cell_not_pending` — so a
1964
+ root owner shown a private born-approved contribution can't publish it. It also
1968
1965
  pins the moderation read gate (a pending or rejected post reaches no
1969
1966
  non-steward reader past its author and admins on `cell_get`, `cell_list`,
1970
1967
  `cell_item_list`, and fact serving, even flipped public or granted while
@@ -2038,7 +2035,12 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
2038
2035
  `createdb`'s stderr, never thrown), `ensure_database_for_url(url, deps?)` (the
2039
2036
  database a `postgres:` URL names; anything else left alone),
2040
2037
  `with_database_name`, `to_maintenance_database_url`, `redact_database_url`
2041
- (a URL fit to print), `is_postgres_url`. The harness creates a database only
2038
+ (a URL fit to print), `is_postgres_url`, and `empty_owned_database(url,
2039
+ {owned_name, label, hint?})` — drops and recreates the `public` schema of
2040
+ the one database a setup owns (any other name in the URL is refused before
2041
+ connecting), for a backend that does not wipe its own database; a missing
2042
+ database (`3D000`), an unreachable server or a role that cannot connect
2043
+ throws with what to check. The harness creates a database only
2042
2044
  when a setup asks, so a test role needs no `CREATEDB` grant otherwise.
2043
2045
  - `testing/cross_backend/spawn_backend.ts` — `spawn_backend(config) => BackendHandle`.
2044
2046
  Refuses a port that already accepts connections, writes the bootstrap
@@ -2074,7 +2076,7 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
2074
2076
  request (`{result}` / `{error}` / `undefined` to swallow), the path
2075
2077
  `describe_peer_ping_ws_tests` drives. With no `on_request` the seam is inert
2076
2078
  (a server-initiated request flows to `messages` as before).
2077
- - `testing/transports/ws_transport.ts` — `create_ws_transport({base_url, ws_path, cookies, origin?, on_request?, headers?})` (`origin: null` sends no `Origin`, which a daemon-token upgrade needs)
2079
+ - `testing/transports/ws_transport.ts` — `create_ws_transport({base_url, ws_path, cookies, origin?, on_request?, headers?})` (`origin: null` sends no `Origin`, which a daemon-token upgrade needs), returning a `WsTransportClient` — a `WsClient` plus `send_text(text)`, which writes one frame verbatim (a frame that is not JSON)
2078
2080
  builds a real-upgrade WS client using the `ws` npm package (optional
2079
2081
  peerDep; consumers wiring cross-process tests `npm install --save-dev ws`).
2080
2082
  Threads the keeper cookie onto the upgrade so per-action auth succeeds on
@@ -2107,7 +2109,9 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
2107
2109
  server's hands **with the handshake** (`pipelined` — written in the same TCP
2108
2110
  write as the upgrade request, so before the connection can have been
2109
2111
  admitted). Small unfragmented text frames only. Helpers `is_raw_ws_close`,
2110
- `raw_ws_close_code`, `RAW_WS_OPCODE_TEXT` / `_CLOSE`.
2112
+ `raw_ws_close_code`, `RAW_WS_OPCODE_TEXT` / `_CLOSE`, and
2113
+ `RAW_WS_UPGRADE_HEADERS` — an upgrade request's headers with RFC 6455's
2114
+ sample key, for probing an upgrade refusal through any HTTP client.
2111
2115
  - `testing/transports/raw_http.ts` — `raw_http_exchange(base_url, request_bytes, {read_timeout_ms, until?})`
2112
2116
  → `RawHttpExchange` (`{received, closed_by_server}`): writes caller-built
2113
2117
  HTTP/1.1 bytes to a raw `node:net` socket once and reads what the server
@@ -2123,10 +2127,18 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
2123
2127
  count, so a response concatenated after a body is seen),
2124
2128
  `raw_http_first_status`, `raw_http_header_lines` (headers as CRLF lines),
2125
2129
  `raw_http_parse_json` (a body's JSON, `undefined` when it isn't), and
2126
- `RAW_HTTP_READ_TIMEOUT_MS`, the suites' default read window. Shared by the
2127
- body-size, body-size smuggling, credential-header, origin-scope and
2128
- transport-composition suites, which take the 1 MiB cap they probe from
2129
- `SPINE_BODY_LIMIT_DEFAULT_BYTES` (`spine_surface_constants.ts`).
2130
+ `RAW_HTTP_READ_TIMEOUT_MS`, the suites' default read window.
2131
+ `raw_http_send_head(base_url, {method?, path, headers, content_length,
2132
+ read_timeout_ms?})` (`RawHttpHeadRequest`) is the over-cap probe built on
2133
+ them: the request head alone, declaring `content_length` body bytes and
2134
+ sending none, read until one whole response — so a server that refuses on
2135
+ the declared length answers and one that reads the body first fails on the
2136
+ read timeout. It writes `Host` and `Content-Length` itself (naming either in
2137
+ `headers` throws), defaults nothing else, and throws when no whole response
2138
+ arrives. The body-size, body-size smuggling, credential-header,
2139
+ origin-scope and transport-composition suites share this module; they take
2140
+ the 1 MiB cap they probe from `SPINE_BODY_LIMIT_DEFAULT_BYTES`
2141
+ (`spine_surface_constants.ts`).
2130
2142
  - `testing/transports/sse_frame_reader.ts` — `create_sse_frame_reader(reader, default_timeout_ms?)`,
2131
2143
  the transport-agnostic SSE framing core over a
2132
2144
  `ReadableStreamDefaultReader<Uint8Array>`: `\n\n` framing, per-read timeout,
@@ -2388,14 +2400,14 @@ one is still asserted. The table
2388
2400
  is the exported `transport_composition_cases` data. `multi_actor:
2389
2401
  {setup_test, xfail?}` adds `transport_composition_multi_actor_cases`, run on
2390
2402
  a fixture whose keeper has `extra_actors`: the keeper's session upgrading with
2391
- no `?acting=` → 400 `actor_required` (flat body), the TS upgrade's actor
2392
- resolution. The Rust spine's upgrade resolves no actor and admits the socket,
2393
- so fuz_app passes `xfail` (tracking id `rust-ws-upgrade-acting-fail-open`) for
2394
- the Rust stub only. Given `base_url`, every
2403
+ no `?acting=` → 400 `actor_required` (flat body), the upgrade's actor
2404
+ resolution on both spines. `xfail` is for a backend known to admit the
2405
+ socket; fuz_app passes none. Given `base_url`, every
2395
2406
  probe is written to the socket (`raw_http_exchange`) and an over-cap request
2396
2407
  sends its head alone; with `base_url: null` the probes go through the
2397
- fixture's transport and the WS rows skip. Not in the standard bundle. fuz_app's
2398
- in-process leg is `src/test/auth/transport_composition_parity.db.test.ts`.
2408
+ fixture's transport and only the WS upgrade rows skip — the WS-path rows
2409
+ that ask for no upgrade gate on `capabilities.ws` alone. Not in the standard
2410
+ bundle. fuz_app's in-process leg is `src/test/auth/transport_composition_parity.db.test.ts`.
2399
2411
 
2400
2412
  `cross_backend/narrowed_api_token.ts` — `mint_narrowed_api_token({app,
2401
2413
  rpc_path, session_headers, methods, name?})` mints a method-scoped api token
@@ -2524,7 +2536,10 @@ a `{kind:'ttl', days}` mint returns and stores a bounded `expires_at`
2524
2536
  (create output + `account_token_list` read-back), `{kind:'eternal'}` stores
2525
2537
  NULL, an omitted or out-of-range lifetime 400s identically on both
2526
2538
  spines, and a `name` at `API_TOKEN_NAME_LENGTH_MAX` mints and reads back whole
2527
- while one UTF-16 code unit past it is `invalid_params`. Exists because the action-manifest parity gate captures no param
2539
+ while one UTF-16 code unit past it is `invalid_params`. It also pins the
2540
+ credential legs' order from stored state: a bearer sent beside a winning
2541
+ daemon token keeps `last_used_at` null (never validated), against a token used
2542
+ alone whose touch lands. Exists because the action-manifest parity gate captures no param
2528
2543
  schemas while the Rust spine hand-parses params — a spine that silently
2529
2544
  dropped the field would answer the same mint with a 200 and an eternal
2530
2545
  token; only the stored-state read-back catches it. Ungated (mint + list are
@@ -2764,12 +2779,12 @@ limiter (the action defaults' windows, the cap replacing both
2764
2779
  `max_attempts`) shared by RPC and WS, and refuse to boot on a cap without the
2765
2780
  flag. Off, neither spine builds an action limiter. Runs under the
2766
2781
  `cross_backend_security` dual-spawn beside the login-security suite. The TS
2767
- spine charges every classed action in its dispatcher; the Rust stub charges
2768
- `account_token_create` and the other auth-family specs inside their handlers
2769
- and every other classed spec at its dispatcher states, the same limiter instances at both sites. So
2770
- the `account_token_create` cases pin the Rust in-handler site, the IP case the
2771
- Rust WS dispatcher's IP axis, and the `cell_create` cases the account axis of
2772
- both Rust dispatchers, RPC and WS — reachable over WS on both spines because
2782
+ spine and the Rust stub both charge every classed action — the auth families
2783
+ included — in their dispatchers, after authorization and ahead of params
2784
+ validation. The `account_token_create` cases pin an auth family's class (a
2785
+ malformed `acting` selector, refused by the dispatcher's own params check,
2786
+ still charged), the IP case the WS dispatcher's IP axis, and the `cell_create`
2787
+ cases the account axis of a consumer-shaped spec, RPC and WS — reachable over WS on both spines because
2773
2788
  the TS spine serves its full action set on `/api/ws`, as the Rust stub serves
2774
2789
  one registry on both transports. The IP case's addresses are fixed per
2775
2790
  process and their bucket outlives `_testing_reset`, so a vitest retry of it
@@ -2777,13 +2792,31 @@ would fail.
2777
2792
  Cross-process only; fuz_app's own wiring is
2778
2793
  `src/test/cross_backend/ws_action_rate_limit.cross.test.ts`.
2779
2794
 
2795
+ ### Timing overrides — `timing_env`
2796
+
2797
+ `audit_sse_keep_alive_ms` and `ws_receive_timeout_ms` on both spine backend
2798
+ configs (`ts_spine_*_backend_config`, `rust_spine_stub_backend_config`) replace
2799
+ the audit stream's keep-alive interval and the WS endpoints' receive timeout,
2800
+ through `timing_env` (`default_backend_configs.ts`), which sets
2801
+ `AUDIT_SSE_KEEP_ALIVE_MS_ENV` (`FUZ_AUDIT_SSE_KEEP_ALIVE_MS`) and
2802
+ `WS_RECEIVE_TIMEOUT_MS_ENV` (`FUZ_WS_RECEIVE_TIMEOUT_MS`) from
2803
+ `spine_surface_constants.ts`. Both spine binaries read them as a positive
2804
+ integer of ms up to 2³¹ − 1 and refuse to boot on anything else; unset keeps
2805
+ the defaults (`SSE_KEEP_ALIVE_INTERVAL_MS`, `DEFAULT_WS_RECEIVE_TIMEOUT`).
2806
+ fuz_app's `cross_backend_timing` project shortens both, so its suites watch
2807
+ each spine's timers fire within seconds.
2808
+ Cross-process only; fuz_app's own wiring is
2809
+ `src/test/cross_backend/sse_keep_alive.cross.test.ts` and
2810
+ `src/test/cross_backend/ws_receive_timeout.cross.test.ts`, under the
2811
+ `cross_backend_timing` project.
2812
+
2780
2813
  ### Role-gated participation parity — `cross_backend/role_grant_participation.ts`
2781
2814
 
2782
2815
  The role-gated-participation capstone — TS↔Rust agreement that an **app-defined
2783
2816
  role is conferred identically** on both spines. A `participant`
2784
2817
  (`grant_paths: ['admin']`) app-role is registered on both spines (`spine_roles`
2785
- in `default_spine_surface.ts` + the Rust `testing_spine_stub`'s `RoleRegistry`
2786
- and `known_roles`); the cross legs prove the three conferral properties agree.
2818
+ in `default_spine_surface.ts` + the Rust `testing_spine_stub`'s `RoleRegistry`,
2819
+ which its auth and cell surfaces both read); the cross legs prove the three conferral properties agree.
2787
2820
 
2788
2821
  **Declarative-max, imperative-as-escape-hatch.** The single-request matrix is
2789
2822
  declarative (`conformance_participation_cases.ts`, run via
@@ -2868,14 +2901,15 @@ binary (the TS analog of the Rust `testing_spine_stub`), so consumers don't
2868
2901
  re-roll the serve / daemon-info / WS-attach / drain boilerplate:
2869
2902
 
2870
2903
  - `testing/cross_backend/testing_server_core.ts` — `start_testing_server({adapter, daemon_name, host, port, app_version?, build_app})`. Owns the runtime-neutral orchestration: open-host refusal, stale-daemon check, daemon-info write, `serve`, post-serve WS attach, graceful shutdown. Domain-free — the app is the caller's `build_app(context: BuildTestingAppContext): Promise<BuiltTestingApp>` seam (`{app, close}`). WebSocket endpoints mount through `create_app_server`'s `ws_endpoints` on every runtime: the build calls `context.prepare_websocket({max_message_bytes?})`, which asks the adapter for a `PreparedWebsocket` (`{create_upgrade_websocket: (app) => UpgradeWebSocket, attach_to_server?}`) and returns its factory, to pass as `create_upgrade_websocket`; the core runs each `attach_to_server` once `serve` returns (Node's `injectWebSocket`). Shutdown starts the listener's `shutdown` (stop accepting), runs `close` — which must end live WebSockets, as `AppServer.close` does — then awaits the drain, since open sockets would otherwise hold it. Exports the `TestingServerAdapter` (`prepare_websocket: (options?: PrepareWebsocketOptions) => PreparedWebsocket`) / `ServeHandle` / `PreparedWebsocket` / `PrepareWebsocketOptions` / `BuildTestingAppContext` interfaces.
2871
- - `testing/cross_backend/testing_server_node.ts` — `create_node_testing_adapter()` (`@hono/node-server` + `@hono/node-ws`). Optional peer deps (like `ws`); only test binaries import them. Its factory sets the `ws` server's `maxPayload` to `max_message_bytes` (default `DEFAULT_WS_MAX_MESSAGE_BYTES`) — `@hono/node-ws` takes no option for it, and `ws`'s own default is 100 MiB — so an oversized message is refused at the frame layer (still `WS_CLOSE_MESSAGE_TOO_BIG`) before it is buffered whole. Bun's adapter sets twice it as its frame cap (see below); Deno takes no frame cap and keeps the per-message check alone.
2904
+ - `testing/daemon_info.ts` — the `~/.{name}/run/daemon.json` plumbing the core's stale-daemon check and daemon-info write use: `DaemonInfo` (a strict `@fuzdev/fuz_schema` object), `get_app_dir`, `get_daemon_info_path`, `write_daemon_info` (atomic), `read_daemon_info`, `is_daemon_running` (`kill -0`).
2905
+ - `testing/cross_backend/testing_server_node.ts` — `create_node_testing_adapter()` (`@hono/node-server` + `@hono/node-ws`). Optional peer deps (like `ws`); only test binaries import them. Its factory sets the `ws` server's `maxPayload` to twice `max_message_bytes` (default `DEFAULT_WS_MAX_MESSAGE_BYTES`) — `@hono/node-ws` takes no option for it, and `ws`'s own default is 100 MiB — so a grossly oversized message is refused at the frame layer (`WS_CLOSE_MESSAGE_TOO_BIG` with no reason) before it is buffered whole, while one just over the limit reaches the per-message check, which sends `WS_CLOSE_MESSAGE_TOO_BIG_REASON` as every other backend does. Bun's adapter sets the same multiple as its frame cap (see below); Deno takes no frame cap and keeps the per-message check alone.
2872
2906
  - `testing/cross_backend/testing_server_deno.ts` — `create_deno_testing_adapter()` (`Deno.serve` + `@hono/deno`, an optional peer dep; `Deno` declared locally so it typechecks under the Node toolchain). Spawn the entry with `--sloppy-imports` (Deno doesn't do `.js`→`.ts`; Gro's loader does, so the Node path needs no flag).
2873
2907
  - `testing/cross_backend/testing_server_bun.ts` — `create_bun_testing_adapter()` (`Bun.serve` + `@hono/bun`'s module-level `getConnInfo`, `upgradeWebSocket`, and `websocket`; `Bun.serve` declared locally so it typechecks under the Node toolchain). Needs the optional `@hono/bun` peer dep (the counterpart to Node's `@hono/node-server` + `@hono/node-ws`; `Bun.serve` is built in), and Bun resolves `.js`→`.ts` natively (no flag, unlike Deno). Reuses `create_node_runtime` (Bun implements the `node:fs`/`node:process` surface). WS is module-level + stateless (like Deno) — the `websocket` handler is threaded into `serve`, where `Bun.serve` wants it, so no post-serve attach. It carries `maxPayloadLength` at twice `max_message_bytes` rather than Bun's 16 MiB default: past its cap Bun drops the socket without a close frame (1006), so the headroom leaves a message just over the limit to the per-message check (`WS_CLOSE_MESSAGE_TOO_BIG`, as on Node), while a grossly oversized one is refused before Bun buffers it whole.
2874
2908
  - `testing/cross_backend/default_spine_surface.ts` — the canonical no-domain spine surface (account/admin/audit/signup + bootstrap): `spine_session_options`, `spine_roles`, `create_spine_route_specs`, `spine_rpc_endpoints`, `create_spine_surface_spec`. This is the **declared** surface — the `create_standard_rpc_actions` bundle the spec-derived suites auto-enumerate. It passes `daemon_token: true` (both spine binaries mount the daemon-token layer) and leaves `GET /api/surface` at its default, off — the TS spine binary does too, and the Rust `testing_spine_stub` serves none. Shared by the spine_stub cross test, the TS cross tests, and the binary.
2875
2909
  - `testing/cross_backend/full_spine_mount.ts` — `build_full_spine_rpc_actions(deps, options)` — the **full** live RPC mount: the declared bundle **plus** the off-declared-surface families the binary live-mounts (`_testing_*` backdoors, the cell verb set, the opt-in `actor_lookup` / `actor_search` resolvers). `build_full_spine_mount(deps, options)` builds it once for both of the binary's endpoints, returning `FullSpineMount` (`{rpc_actions, ws_actions}`): the WS list is `protocol_actions` plus every RPC action not already among them, twinning the Rust `testing_spine_stub`, which serves one registry on RPC and WS (the one difference is `cancel` — a registered protocol action on TS, owned by the read loop on Rust). Single-sources the mount so the binary and the `spine_method_coverage` reconciliation test build the same list. `create_spine_live_rpc_endpoints()` wraps the list, built on stub deps, as one endpoint at `SPINE_RPC_PATH` — the `live_rpc_endpoints` value the conformance table, the differential and the auth-row generator resolve off-surface methods from (no handler built there runs).
2876
2910
  - `testing/cross_backend/ts_spine_backend_config.ts` — `ts_spine_node_backend_config()` / `ts_spine_deno_backend_config()` / `ts_spine_bun_backend_config()` presets (in-memory pglet, no external infra), the TS analog of `rust_spine_stub_backend_config()`.
2877
2911
 
2878
- fuz_app's own binary wiring (`src/test/cross_backend/testing_spine_server{,_node,_deno,_bun}.ts`) is the worked example: ~one `build_app` over `create_app_backend` + `create_app_server` (`rate_limiters: 'disabled_for_testing'` plus whichever login / action limiters its env toggles built, `build_full_spine_mount`'s two lists on one `rpc_endpoints` entry and two `ws_endpoints` entries — `/api/ws` and the role-gated `SPINE_ROLE_GATED_WS_PATH` — sharing one `transport`, which is also the role-grant-offer `notification_sender`), reusing `default_spine_surface`. `src/test/cross_backend/testing_spine_server.db.test.ts` builds it with the Node adapter in-process and asserts its surface lists both WS endpoints (the gated one with its `required_roles`) and passes the surface invariants. The `_node`/`_deno`/`_bun` entries differ only in which adapter they wire — `build_spine_app` is runtime-agnostic. It leaves `create_app_server`'s `auth_cleanup` off, as the Rust `testing_spine_stub` leaves its twin unscheduled: a background pass would delete rows and write audit rows under a running suite. A consumer's cross-process test binary may schedule it when nothing its suites seed is already expired (the conformance table's `expired_session` principal seeds a backdated session row); an in-process harness leaves it off.
2912
+ fuz_app's own binary wiring (`src/test/cross_backend/testing_spine_server{,_node,_deno,_bun}.ts`) is the worked example: ~one `build_app` over `create_app_backend` + `create_app_server` (`rate_limiters: 'disabled_for_testing'` plus whichever login / action limiters its env toggles built, `build_full_spine_mount`'s two lists on one `rpc_endpoints` entry and two `ws_endpoints` entries — `/api/ws` and the role-gated `SPINE_ROLE_GATED_WS_PATH` — sharing one `registry`, which is also the role-grant-offer `notification_sender`), reusing `default_spine_surface`. `src/test/cross_backend/testing_spine_server.db.test.ts` builds it with the Node adapter in-process and asserts its surface lists both WS endpoints (the gated one with its `required_roles`) and passes the surface invariants. The `_node`/`_deno`/`_bun` entries differ only in which adapter they wire — `build_spine_app` is runtime-agnostic. It leaves `create_app_server`'s `auth_cleanup` off, as the Rust `testing_spine_stub` leaves its twin unscheduled: a background pass would delete rows and write audit rows under a running suite. A consumer's cross-process test binary may schedule it when nothing its suites seed is already expired (the conformance table's `expired_session` principal seeds a backdated session row); an in-process harness leaves it off.
2879
2913
 
2880
2914
  ### Live-method coverage reconciliation — `method_coverage.ts`
2881
2915