@fuzdev/fuz_app 0.180.0 → 0.181.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 (358) hide show
  1. package/dist/actions/CLAUDE.md +14 -14
  2. package/dist/actions/action_rpc.d.ts +14 -5
  3. package/dist/actions/action_rpc.d.ts.map +1 -1
  4. package/dist/actions/action_rpc.js +53 -46
  5. package/dist/actions/action_types.d.ts +15 -12
  6. package/dist/actions/action_types.d.ts.map +1 -1
  7. package/dist/actions/perform_action.d.ts +4 -4
  8. package/dist/actions/perform_action.d.ts.map +1 -1
  9. package/dist/actions/perform_action.js +6 -6
  10. package/dist/actions/register_action_ws.d.ts +6 -2
  11. package/dist/actions/register_action_ws.d.ts.map +1 -1
  12. package/dist/actions/register_action_ws.js +14 -3
  13. package/dist/actions/ws_socket_session.js +1 -1
  14. package/dist/auth/CLAUDE.md +36 -30
  15. package/dist/auth/account_actions.d.ts.map +1 -1
  16. package/dist/auth/account_actions.js +18 -1
  17. package/dist/auth/account_queries.d.ts +69 -0
  18. package/dist/auth/account_queries.d.ts.map +1 -1
  19. package/dist/auth/account_queries.js +82 -0
  20. package/dist/auth/account_route_schema.d.ts +26 -16
  21. package/dist/auth/account_route_schema.d.ts.map +1 -1
  22. package/dist/auth/account_route_schema.js +10 -24
  23. package/dist/auth/account_routes.d.ts +4 -6
  24. package/dist/auth/account_routes.d.ts.map +1 -1
  25. package/dist/auth/account_routes.js +86 -66
  26. package/dist/auth/admin_actions.d.ts.map +1 -1
  27. package/dist/auth/admin_actions.js +63 -14
  28. package/dist/auth/api_token_queries.d.ts +16 -7
  29. package/dist/auth/api_token_queries.d.ts.map +1 -1
  30. package/dist/auth/api_token_queries.js +18 -18
  31. package/dist/auth/audit_log_route_schema.d.ts +1 -1
  32. package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
  33. package/dist/auth/audit_log_routes.d.ts +1 -1
  34. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  35. package/dist/auth/audit_log_routes.js +10 -12
  36. package/dist/auth/audit_log_schema.js +4 -4
  37. package/dist/auth/bearer_auth.d.ts +4 -3
  38. package/dist/auth/bearer_auth.d.ts.map +1 -1
  39. package/dist/auth/bearer_auth.js +35 -31
  40. package/dist/auth/bootstrap_account.d.ts +65 -37
  41. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  42. package/dist/auth/bootstrap_account.js +115 -66
  43. package/dist/auth/bootstrap_route_schema.d.ts +6 -2
  44. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  45. package/dist/auth/bootstrap_route_schema.js +7 -2
  46. package/dist/auth/bootstrap_routes.d.ts +50 -33
  47. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  48. package/dist/auth/bootstrap_routes.js +109 -87
  49. package/dist/auth/bootstrap_token_store.d.ts +60 -0
  50. package/dist/auth/bootstrap_token_store.d.ts.map +1 -0
  51. package/dist/auth/bootstrap_token_store.js +39 -0
  52. package/dist/auth/credential_headers.d.ts +71 -0
  53. package/dist/auth/credential_headers.d.ts.map +1 -0
  54. package/dist/auth/credential_headers.js +100 -0
  55. package/dist/auth/daemon_token.d.ts +13 -1
  56. package/dist/auth/daemon_token.d.ts.map +1 -1
  57. package/dist/auth/daemon_token.js +14 -2
  58. package/dist/auth/daemon_token_middleware.d.ts +10 -11
  59. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  60. package/dist/auth/daemon_token_middleware.js +27 -29
  61. package/dist/auth/deps.d.ts +0 -11
  62. package/dist/auth/deps.d.ts.map +1 -1
  63. package/dist/auth/invite_queries.d.ts +18 -0
  64. package/dist/auth/invite_queries.d.ts.map +1 -1
  65. package/dist/auth/invite_queries.js +24 -0
  66. package/dist/auth/request_context.d.ts +26 -5
  67. package/dist/auth/request_context.d.ts.map +1 -1
  68. package/dist/auth/request_context.js +17 -10
  69. package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
  70. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  71. package/dist/auth/role_grant_offer_action_specs.js +3 -2
  72. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  73. package/dist/auth/role_grant_offer_actions.js +37 -14
  74. package/dist/auth/role_grant_offer_ddl.d.ts +7 -1
  75. package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
  76. package/dist/auth/role_grant_offer_ddl.js +9 -2
  77. package/dist/auth/role_grant_offer_queries.d.ts +56 -3
  78. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  79. package/dist/auth/role_grant_offer_queries.js +93 -8
  80. package/dist/auth/role_grant_queries.d.ts +7 -0
  81. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  82. package/dist/auth/role_grant_queries.js +8 -0
  83. package/dist/auth/session_cookie.d.ts +105 -25
  84. package/dist/auth/session_cookie.d.ts.map +1 -1
  85. package/dist/auth/session_cookie.js +124 -15
  86. package/dist/auth/session_middleware.d.ts +83 -54
  87. package/dist/auth/session_middleware.d.ts.map +1 -1
  88. package/dist/auth/session_middleware.js +92 -66
  89. package/dist/auth/session_queries.d.ts +64 -4
  90. package/dist/auth/session_queries.d.ts.map +1 -1
  91. package/dist/auth/session_queries.js +53 -4
  92. package/dist/auth/signup_route_schema.d.ts +5 -5
  93. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  94. package/dist/auth/signup_route_schema.js +4 -4
  95. package/dist/auth/signup_routes.d.ts.map +1 -1
  96. package/dist/auth/signup_routes.js +17 -14
  97. package/dist/auth/token_scope.d.ts +5 -7
  98. package/dist/auth/token_scope.d.ts.map +1 -1
  99. package/dist/auth/token_scope.js +5 -8
  100. package/dist/dev/setup.d.ts +6 -1
  101. package/dist/dev/setup.d.ts.map +1 -1
  102. package/dist/dev/setup.js +42 -34
  103. package/dist/hono_context.d.ts +21 -0
  104. package/dist/hono_context.d.ts.map +1 -1
  105. package/dist/hono_context.js +17 -0
  106. package/dist/http/CLAUDE.md +150 -43
  107. package/dist/http/auth_shape.d.ts +3 -3
  108. package/dist/http/common_routes.js +1 -1
  109. package/dist/http/db_routes.d.ts +4 -3
  110. package/dist/http/db_routes.d.ts.map +1 -1
  111. package/dist/http/db_routes.js +14 -14
  112. package/dist/http/dev_route_error_check.d.ts +6 -3
  113. package/dist/http/dev_route_error_check.d.ts.map +1 -1
  114. package/dist/http/dev_route_error_check.js +6 -3
  115. package/dist/http/dev_set_cookie_check.d.ts +53 -0
  116. package/dist/http/dev_set_cookie_check.d.ts.map +1 -0
  117. package/dist/http/dev_set_cookie_check.js +80 -0
  118. package/dist/http/error_schemas.d.ts +36 -1
  119. package/dist/http/error_schemas.d.ts.map +1 -1
  120. package/dist/http/error_schemas.js +39 -2
  121. package/dist/http/header_lines.d.ts +42 -0
  122. package/dist/http/header_lines.d.ts.map +1 -0
  123. package/dist/http/header_lines.js +80 -0
  124. package/dist/http/host.d.ts +12 -9
  125. package/dist/http/host.d.ts.map +1 -1
  126. package/dist/http/host.js +25 -20
  127. package/dist/http/origin.d.ts +7 -22
  128. package/dist/http/origin.d.ts.map +1 -1
  129. package/dist/http/origin.js +11 -25
  130. package/dist/http/proxy.d.ts +1 -0
  131. package/dist/http/proxy.d.ts.map +1 -1
  132. package/dist/http/proxy.js +3 -0
  133. package/dist/http/request_headers.d.ts +95 -0
  134. package/dist/http/request_headers.d.ts.map +1 -0
  135. package/dist/http/request_headers.js +110 -0
  136. package/dist/http/request_target.d.ts +134 -0
  137. package/dist/http/request_target.d.ts.map +1 -0
  138. package/dist/http/request_target.js +193 -0
  139. package/dist/http/route_error_check.d.ts +4 -11
  140. package/dist/http/route_error_check.d.ts.map +1 -1
  141. package/dist/http/route_error_check.js +4 -21
  142. package/dist/http/route_result.d.ts +127 -23
  143. package/dist/http/route_result.d.ts.map +1 -1
  144. package/dist/http/route_result.js +97 -19
  145. package/dist/http/route_spec.d.ts +298 -82
  146. package/dist/http/route_spec.d.ts.map +1 -1
  147. package/dist/http/route_spec.js +548 -71
  148. package/dist/http/simple_request.d.ts +19 -14
  149. package/dist/http/simple_request.d.ts.map +1 -1
  150. package/dist/http/simple_request.js +17 -29
  151. package/dist/http/surface.d.ts +2 -0
  152. package/dist/http/surface.d.ts.map +1 -1
  153. package/dist/http/surface.js +4 -1
  154. package/dist/realtime/outbound_budget.d.ts +1 -2
  155. package/dist/realtime/outbound_budget.d.ts.map +1 -1
  156. package/dist/realtime/outbound_budget.js +1 -2
  157. package/dist/realtime/sse.d.ts +47 -17
  158. package/dist/realtime/sse.d.ts.map +1 -1
  159. package/dist/realtime/sse.js +115 -93
  160. package/dist/realtime/sse_constants.d.ts +7 -1
  161. package/dist/realtime/sse_constants.d.ts.map +1 -1
  162. package/dist/realtime/sse_constants.js +12 -1
  163. package/dist/realtime/sse_registry.d.ts +3 -3
  164. package/dist/realtime/sse_registry.js +3 -3
  165. package/dist/runtime/deps.d.ts +20 -4
  166. package/dist/runtime/deps.d.ts.map +1 -1
  167. package/dist/runtime/mock.d.ts +7 -1
  168. package/dist/runtime/mock.d.ts.map +1 -1
  169. package/dist/runtime/mock.js +33 -3
  170. package/dist/runtime/node.d.ts.map +1 -1
  171. package/dist/runtime/node.js +2 -1
  172. package/dist/runtime/secure_file.d.ts +71 -10
  173. package/dist/runtime/secure_file.d.ts.map +1 -1
  174. package/dist/runtime/secure_file.js +91 -11
  175. package/dist/server/app_backend.d.ts +0 -8
  176. package/dist/server/app_backend.d.ts.map +1 -1
  177. package/dist/server/app_backend.js +1 -3
  178. package/dist/server/app_server.d.ts +28 -17
  179. package/dist/server/app_server.d.ts.map +1 -1
  180. package/dist/server/app_server.js +52 -34
  181. package/dist/server/serve_fact_route.d.ts.map +1 -1
  182. package/dist/server/serve_fact_route.js +49 -45
  183. package/dist/server/static.d.ts +20 -0
  184. package/dist/server/static.d.ts.map +1 -1
  185. package/dist/server/static.js +56 -8
  186. package/dist/server/unmatched_route.d.ts +42 -0
  187. package/dist/server/unmatched_route.d.ts.map +1 -0
  188. package/dist/server/unmatched_route.js +64 -0
  189. package/dist/testing/CLAUDE.md +404 -1200
  190. package/dist/testing/app_server.d.ts +3 -1
  191. package/dist/testing/app_server.d.ts.map +1 -1
  192. package/dist/testing/app_server.js +4 -10
  193. package/dist/testing/auth_apps.d.ts.map +1 -1
  194. package/dist/testing/auth_apps.js +2 -1
  195. package/dist/testing/cross_backend/account_lifecycle.d.ts +11 -4
  196. package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
  197. package/dist/testing/cross_backend/account_lifecycle.js +277 -6
  198. package/dist/testing/cross_backend/build_test_backend_paths.d.ts +4 -1
  199. package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
  200. package/dist/testing/cross_backend/build_test_backend_paths.js +1 -1
  201. package/dist/testing/cross_backend/capabilities.d.ts +68 -5
  202. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  203. package/dist/testing/cross_backend/capabilities.js +20 -4
  204. package/dist/testing/cross_backend/cell_gated_create.js +1 -1
  205. package/dist/testing/cross_backend/conformance_case.d.ts +63 -21
  206. package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
  207. package/dist/testing/cross_backend/conformance_table.d.ts +54 -12
  208. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  209. package/dist/testing/cross_backend/conformance_table.js +179 -23
  210. package/dist/testing/cross_backend/cookie_attributes.js +1 -1
  211. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +7 -1
  212. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
  213. package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +3 -3
  214. package/dist/testing/cross_backend/credential_conformance.d.ts +196 -0
  215. package/dist/testing/cross_backend/credential_conformance.d.ts.map +1 -0
  216. package/dist/testing/cross_backend/credential_conformance.js +296 -0
  217. package/dist/testing/cross_backend/credential_conformance.json +1284 -0
  218. package/dist/testing/cross_backend/credential_conformance_wire.d.ts +40 -0
  219. package/dist/testing/cross_backend/credential_conformance_wire.d.ts.map +1 -0
  220. package/dist/testing/cross_backend/credential_conformance_wire.js +293 -0
  221. package/dist/testing/cross_backend/credential_header_robustness.d.ts +1 -3
  222. package/dist/testing/cross_backend/credential_header_robustness.d.ts.map +1 -1
  223. package/dist/testing/cross_backend/credential_header_robustness.js +24 -55
  224. package/dist/testing/cross_backend/credential_wire.d.ts +112 -0
  225. package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -0
  226. package/dist/testing/cross_backend/credential_wire.js +188 -0
  227. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
  228. package/dist/testing/cross_backend/default_backend_configs.js +22 -2
  229. package/dist/testing/cross_backend/default_spine_surface.js +1 -1
  230. package/dist/testing/cross_backend/differential.d.ts +1 -1
  231. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  232. package/dist/testing/cross_backend/differential.js +3 -2
  233. package/dist/testing/cross_backend/differential_normalize.d.ts +23 -6
  234. package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
  235. package/dist/testing/cross_backend/differential_normalize.js +11 -5
  236. package/dist/testing/cross_backend/full_spine_mount.d.ts +1 -0
  237. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  238. package/dist/testing/cross_backend/full_spine_mount.js +7 -0
  239. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  240. package/dist/testing/cross_backend/identity_parity.js +4 -0
  241. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  242. package/dist/testing/cross_backend/in_process_setup.js +78 -4
  243. package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
  244. package/dist/testing/cross_backend/login_security.js +13 -10
  245. package/dist/testing/cross_backend/peer_ping_ws.d.ts +1 -1
  246. package/dist/testing/cross_backend/peer_ping_ws.js +2 -2
  247. package/dist/testing/cross_backend/request_header_conformance.d.ts +174 -0
  248. package/dist/testing/cross_backend/request_header_conformance.d.ts.map +1 -0
  249. package/dist/testing/cross_backend/request_header_conformance.js +196 -0
  250. package/dist/testing/cross_backend/request_header_conformance.json +1158 -0
  251. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts +39 -0
  252. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts.map +1 -0
  253. package/dist/testing/cross_backend/request_header_conformance_wire.js +284 -0
  254. package/dist/testing/cross_backend/request_target_conformance.d.ts +298 -0
  255. package/dist/testing/cross_backend/request_target_conformance.d.ts.map +1 -0
  256. package/dist/testing/cross_backend/request_target_conformance.js +186 -0
  257. package/dist/testing/cross_backend/request_target_conformance.json +3765 -0
  258. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +32 -0
  259. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -0
  260. package/dist/testing/cross_backend/request_target_conformance_wire.js +278 -0
  261. package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
  262. package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +173 -1
  263. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
  264. package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +2 -1
  265. package/dist/testing/cross_backend/rpc_adversarial.d.ts +6 -4
  266. package/dist/testing/cross_backend/rpc_adversarial.d.ts.map +1 -1
  267. package/dist/testing/cross_backend/rpc_adversarial.js +5 -2
  268. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -7
  269. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  270. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -5
  271. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  272. package/dist/testing/cross_backend/session_cap.js +56 -29
  273. package/dist/testing/cross_backend/session_cookie_effect.d.ts +43 -0
  274. package/dist/testing/cross_backend/session_cookie_effect.d.ts.map +1 -0
  275. package/dist/testing/cross_backend/session_cookie_effect.js +103 -0
  276. package/dist/testing/cross_backend/session_login.d.ts +24 -0
  277. package/dist/testing/cross_backend/session_login.d.ts.map +1 -0
  278. package/dist/testing/cross_backend/session_login.js +31 -0
  279. package/dist/testing/cross_backend/setup.d.ts +117 -0
  280. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  281. package/dist/testing/cross_backend/setup.js +193 -9
  282. package/dist/testing/cross_backend/simple_request.d.ts.map +1 -1
  283. package/dist/testing/cross_backend/simple_request.js +5 -0
  284. package/dist/testing/cross_backend/spine_suites.d.ts +9 -1
  285. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  286. package/dist/testing/cross_backend/spine_suites.js +88 -5
  287. package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
  288. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  289. package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
  290. package/dist/testing/cross_backend/sse_round_trip.d.ts +8 -5
  291. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  292. package/dist/testing/cross_backend/sse_round_trip.js +205 -64
  293. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  294. package/dist/testing/cross_backend/testing_backdoor.js +5 -2
  295. package/dist/testing/cross_backend/testing_credential_read.d.ts +165 -0
  296. package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -0
  297. package/dist/testing/cross_backend/testing_credential_read.js +175 -0
  298. package/dist/testing/cross_backend/testing_reset_actions.d.ts +19 -0
  299. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  300. package/dist/testing/cross_backend/testing_reset_actions.js +22 -6
  301. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  302. package/dist/testing/cross_backend/token_lifetime.js +58 -2
  303. package/dist/testing/cross_backend/transport_composition.d.ts +2 -4
  304. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
  305. package/dist/testing/cross_backend/transport_composition.js +13 -10
  306. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  307. package/dist/testing/cross_backend/ts_spine_backend_config.js +5 -3
  308. package/dist/testing/cross_backend/ws_endpoint.d.ts +11 -1
  309. package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
  310. package/dist/testing/cross_backend/ws_endpoint.js +19 -2
  311. package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -1
  312. package/dist/testing/cross_backend/ws_role_gated.js +2 -3
  313. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  314. package/dist/testing/cross_backend/ws_round_trip.js +28 -12
  315. package/dist/testing/cross_backend/xfail.d.ts +44 -11
  316. package/dist/testing/cross_backend/xfail.d.ts.map +1 -1
  317. package/dist/testing/cross_backend/xfail.js +68 -23
  318. package/dist/testing/data_exposure.d.ts.map +1 -1
  319. package/dist/testing/data_exposure.js +4 -3
  320. package/dist/testing/integration.d.ts +1 -2
  321. package/dist/testing/integration.d.ts.map +1 -1
  322. package/dist/testing/integration.js +14 -8
  323. package/dist/testing/integration_helpers.d.ts +50 -3
  324. package/dist/testing/integration_helpers.d.ts.map +1 -1
  325. package/dist/testing/integration_helpers.js +87 -9
  326. package/dist/testing/middleware.d.ts +2 -0
  327. package/dist/testing/middleware.d.ts.map +1 -1
  328. package/dist/testing/middleware.js +9 -2
  329. package/dist/testing/round_trip.d.ts +6 -2
  330. package/dist/testing/round_trip.d.ts.map +1 -1
  331. package/dist/testing/round_trip.js +17 -6
  332. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  333. package/dist/testing/rpc_envelope_cases.js +7 -0
  334. package/dist/testing/rpc_helpers.d.ts +4 -2
  335. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  336. package/dist/testing/rpc_helpers.js +6 -1
  337. package/dist/testing/rpc_round_trip.d.ts +13 -2
  338. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  339. package/dist/testing/rpc_round_trip.js +25 -6
  340. package/dist/testing/schema_generators.d.ts +2 -2
  341. package/dist/testing/schema_generators.d.ts.map +1 -1
  342. package/dist/testing/schema_generators.js +4 -4
  343. package/dist/testing/stubs.d.ts +2 -2
  344. package/dist/testing/stubs.d.ts.map +1 -1
  345. package/dist/testing/stubs.js +8 -8
  346. package/dist/testing/transports/fetch_transport.d.ts +6 -3
  347. package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
  348. package/dist/testing/transports/fetch_transport.js +31 -19
  349. package/dist/testing/transports/raw_http.d.ts +61 -1
  350. package/dist/testing/transports/raw_http.d.ts.map +1 -1
  351. package/dist/testing/transports/raw_http.js +61 -1
  352. package/dist/testing/transports/ws_raw_client.d.ts +20 -0
  353. package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
  354. package/dist/testing/transports/ws_raw_client.js +10 -4
  355. package/dist/testing/transports/ws_transport.d.ts +21 -1
  356. package/dist/testing/transports/ws_transport.d.ts.map +1 -1
  357. package/dist/testing/transports/ws_transport.js +58 -20
  358. package/package.json +1 -1
@@ -30,10 +30,10 @@ time (never runtime), where a throwing guard would break `vite build`.
30
30
  - `create_noop_stub<T>(label, overrides?)` — Proxy whose every method returns `async () => undefined`; `overrides` pins specific props.
31
31
  - `stub` — pre-built throwing stub labelled `'stub'`.
32
32
  - `create_stub_db()` — real `Db` whose `client.query` yields `{rows: []}` and `transaction(fn)` synchronously calls `fn(inner_stub_db)`. Safe for `apply_route_specs`'s declarative transaction wrapper.
33
- - `stub_handler()` — a fresh `Response('stub')` as a `route_raw` result, a handler that fits any route (`attach_route_handler(shape, stub_handler)`).
33
+ - `stub_handler()` — a `route_raw` text answer (`stub`), a handler that fits any route (`attach_route_handler(shape, stub_handler)`).
34
34
  - `stub_route_spec(shape)` — a spec for a surface that is described and never served: `shape` with a handler that throws when run (the spine routes of `create_rust_spine_consumer_surface_spec`).
35
35
  - `stub_mw` — pass-through middleware (`async (_c, next) => next()`).
36
- - `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`.
36
+ - `create_stub_app_deps()` — factory: fresh `AppDeps` with a stub keyring (`sign` answers `<value>.stub_signature`, so an assembly's sample cookie mint runs; nothing else of it does anything), no-op password, a `create_noop_stub` DB, silent `Logger`, no-op `audit`, an empty `connection_closer`.
37
37
  - `create_test_audit_emitter()` — no-op `AuditEmitter`; `emit` / `emit_role_grant_target` / `emit_pool` resolve 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`.
38
38
  - `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`.
39
39
  - `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.
@@ -297,7 +297,7 @@ per-method auth shape.
297
297
  `format_action_manifest_diffs` / `assert_action_manifests_equal` (twin of
298
298
  `schema_parity.ts`) — asserts exact method-set + per-method input-shape and
299
299
  auth-shape parity. `ActionManifestDiff` kinds: `method_only_in`, `input_differs`, `side_effects_differ`,
300
- `rate_limit_differs`, `auth_field_differs`, `auth_list_differs`.
300
+ `rate_limit_differs`, `auth_field_differs`.
301
301
  - `cross_backend/setup.ts` `capture_action_manifest(handle)` — dumps a backend's
302
302
  manifest over the daemon-token `_testing_action_manifest` channel (twin of
303
303
  `capture_schema_snapshot`).
@@ -335,8 +335,13 @@ declarations (DDL, the method set), this compares answers. Each impl is the
335
335
  oracle for the other — a case the table pins by status alone, or an extra
336
336
  field a loose output schema passes on one spine, shows up as a difference.
337
337
 
338
- - `cross_backend/differential_normalize.ts` — `normalize_differential_response({status, headers, body})`
339
- → `DifferentialResponse` `{status, body, header_names}`. Volatile values
338
+ - `cross_backend/differential_normalize.ts` — `normalize_differential_response({status, headers, set_cookies, body}, session_cookie_name)`
339
+ → `DifferentialResponse` `{status, body, header_names, session_cookie}`.
340
+ `session_cookie` is the response's `SessionCookieEffect`, read by the
341
+ classifier the conformance runner uses (`'unrecognized'` for lines in no
342
+ known shape), so one spine clearing where the other doesn't, or minting
343
+ where the other clears, differs at the path `session_cookie` — header
344
+ names alone can't tell a clear from a mint. Volatile values
340
345
  become positional placeholders per kind (`VOLATILE_VALUE_PATTERNS`: API
341
346
  tokens, `tok_` token ids, lowercase UUIDs, `ISO8601_SECONDS` timestamps,
342
347
  bare 64-hex digests — matched inside any string, object keys included): the
@@ -353,7 +358,7 @@ field a loose output schema passes on one spine, shows up as a difference.
353
358
  `set-cookie` carries a fresh credential, and the contract header values are
354
359
  the conformance table's `expect.headers` + no-fingerprint floor.
355
360
  `diff_differential_responses(a, b)` → `DifferentialDiff[]`, one per leaf
356
- path (`status`, `headers.<name>`, `body.error.data.reason`; an object one
361
+ path (`status`, `headers.<name>`, `session_cookie`, `body.error.data.reason`; an object one
357
362
  side lacks diffs key by key, and an empty one against a missing one at its
358
363
  own path), `differential_path_covers(covered, path)`,
359
364
  `format_differential_diffs(diffs, labels)`.
@@ -375,8 +380,7 @@ field a loose output schema passes on one spine, shows up as a difference.
375
380
  difference. The per-case `expect` is not asserted —
376
381
  each backend's conformance leg holds it. `KnownDivergence` is the ledger
377
382
  row: `{case_name | method, tracking_id, reason, what_differs}`, the names a
378
- string or a list, `what_differs` the diff paths covered (a path covers
379
- everything under it), each a string or a `KnownDivergencePath`
383
+ string or a list, `what_differs` the diff paths covered (a path covers everything under it; a cookie difference where one side sends no `Set-Cookie` also differs at `headers.set-cookie`, so its entry names both), each a string or a `KnownDivergencePath`
380
384
  `{path, a?, b?}` pinning the value a side shows there (`undefined` for
381
385
  nothing). A pin is compared with the normalized leaf value at the differing
382
386
  path, so a placeholdered value never matches the raw one, an object pin
@@ -443,14 +447,13 @@ Structural invariants (options-free, universal):
443
447
  - `assert_error_code_status_consistency` — the same `const` error code (a definition's `literal`) never appears at two different HTTP statuses, read through every `anyOf` / `oneOf` branch.
444
448
 
445
449
  RPC / WS structural invariants (options-free, apply over `surface.rpc_endpoints`
450
+ and `surface.ws_endpoints`):
446
451
 
447
- - `surface.ws_endpoints`):
448
-
449
- * `assert_rpc_method_descriptions_present` — every RPC method on every endpoint has a non-empty `description`.
450
- * `assert_ws_method_descriptions_present` — every WS method on every endpoint has a non-empty `description`.
451
- * `assert_ws_endpoints_include_protocol_actions` — every WS endpoint includes `heartbeat` + `cancel` + `peer/ping` (the `protocol_actions` spread from `actions/protocol.ts`).
452
- * `assert_ws_notifications_have_null_auth` — WS method `kind === 'remote_notification' ⟺ auth === null`; guards against drift between spec union and surface emitter.
453
- * `assert_no_testing_methods` — no `_testing_*` backdoor action (`TESTING_METHOD_PREFIX`) appears as an RPC or WS method on the declared surface. The test-binary actions are live-mounted only; this guards against a future wiring change folding `create_testing_actions(...)` into the surface-generating registry.
452
+ - `assert_rpc_method_descriptions_present` — every RPC method on every endpoint has a non-empty `description`.
453
+ - `assert_ws_method_descriptions_present` — every WS method on every endpoint has a non-empty `description`.
454
+ - `assert_ws_endpoints_include_protocol_actions` — every WS endpoint includes `heartbeat` + `cancel` + `peer/ping` (the `protocol_actions` spread from `actions/protocol.ts`).
455
+ - `assert_ws_notifications_have_null_auth` — WS method `kind === 'remote_notification' ⟺ auth === null`; guards against drift between spec union and surface emitter.
456
+ - `assert_no_testing_methods` — no `_testing_*` backdoor action (`TESTING_METHOD_PREFIX`) appears as an RPC or WS method on the declared surface. The test-binary actions are live-mounted only; this guards against a future wiring change folding `create_testing_actions(...)` into the surface-generating registry.
454
457
 
455
458
  Per-endpoint duplicate method names and the auth-shape biconditional are
456
459
  already enforced at startup by `compile_action_registry` (see
@@ -512,7 +515,7 @@ adversarial/round-trip tests. A value that is no schema throws, naming it.
512
515
  - `detect_format(field_schema)` — `detect_json_schema_format` over `to_field_json_schema`: the `format`, `'pattern'` for a regex, or `null`.
513
516
  - `generate_valid_value(field, field_schema)` — base-type switch producing a valid sample (UUIDs → nil UUID, strings → `'xxxxxxxxxx'`, numbers → `1`, objects → `generate_valid_object` against the field schema, so a nested refinement is satisfied too, enums → first entry, records → `{}`, a void field → `undefined`, etc.). For branded-string refinements, walks a fallback chain synthesized from the `pattern` string the JSON Schema representation exposes: fixed-length hex (`^[0-9a-f]{N}$` — blake3 / sha256 / md5 digests; `0`.repeat(N)), prefix-lengthed slug (`^<prefix>_[A-Za-z0-9_-]{N}$` — `ApiTokenId`-style ids; `<prefix>_` + `x`.repeat(N)), absolute path prefix, URL prefix, two `/`-joined segments (an `owner/name` slug). First candidate the field accepts is used.
514
517
  - `generate_valid_string_param(field, field_schema)` — a string a URL-sourced field (route param, query value) accepts: the nil UUID for a UUID field, else the first of `test_value`, the generated valid value as a string, `1`, `0`, `true`, `false`, the field's JSON Schema `default` or lower bound as a string, each `min_value` / `max_value` bound anywhere in the schema as an integer (a string parsed into an integer whose range excludes the small candidates, as `db_routes`' `query_int` — bounds past a `transform`, which JSON Schema can't say) and a synthesized string the field accepts; `null` when none does. The params and query case generators build their base from it.
515
- - `resolve_valid_path(path, params_schema?, param_values?)` — swaps each whole param segment (`:name`, `:name{re}`, optional or not, read as Hono reads a template: `split_route_template` / `parse_route_param`) for a value the params schema accepts; a `:` inside a literal segment (`files:upload`) stays. Prefers `test_<name>` wherever the field schema admits it (the param name keeps failure messages readable); otherwise a UUID param takes the nil UUID and anything else is synthesized from the schema, percent-encoded. A synthesized value containing `/` is refused (it would route elsewhere) and falls back to `test_<name>`. A value in `param_values` (the route's entry of `RouteParamValues`, `'METHOD /path'` → param name → value, the option the path-resolving suites take) comes first, percent-encoded like the rest. A `:name{re}` param's value, supplied or generated, must match its pattern grouped and anchored, `^(?:re)$` (`compile_route_param_pattern`, over the value as Hono decodes it, `decode_route_path`) — Hono's RegExpRouter reading, the stricter of its routers', as TrieRouter leaves a top-level alternation ungrouped — else it throws naming the route and the param and pointing at `param_values`: no value is guessed from the pattern, and no route is skipped silently. A `param_values` entry naming no param of the path throws too, and so does a supplied `''`, `.` or `..` (the URL normalizes it away) or a lone surrogate. Supplied values are always encoded, so a `{re}` needing a literal `/` can't be met by one.
518
+ - `resolve_valid_path(path, params_schema?, param_values?)` — swaps each whole param segment (`:name`, `:name{re}`, optional or not, read as Hono reads a template: `split_route_template` / `parse_route_param`) for a value the params schema accepts; a `:` inside a literal segment (`files:upload`) stays. Prefers `test_<name>` wherever the field schema admits it (the param name keeps failure messages readable); otherwise a UUID param takes the nil UUID and anything else is synthesized from the schema, percent-encoded. A synthesized value containing `/` is refused (it would route elsewhere) and falls back to `test_<name>`. A value in `param_values` (the route's entry of `RouteParamValues`, `'METHOD /path'` → param name → value, the option the path-resolving suites take) comes first, percent-encoded like the rest. A `:name{re}` param's value, supplied or generated, must match its pattern grouped and anchored, `^(?:re)$` (`compile_route_param_pattern`, over the percent-encoded value the router matches) — Hono's RegExpRouter reading, the stricter of its routers', as TrieRouter leaves a top-level alternation ungrouped — else it throws naming the route and the param and pointing at `param_values`: no value is guessed from the pattern, and no route is skipped silently. A `param_values` entry naming no param of the path throws too, and so does a supplied `''`, `.` or `..` (the URL normalizes it away) or a lone surrogate. Supplied values are always encoded, so a `{re}` needing a literal `/` can't be met by one.
516
519
  - `to_route_content_type(route)` — the `Content-Type` a well-formed request to the route sends: `application/json`, or `application/octet-stream` for a `raw_body` route. Every `POST` route refuses anything else with 415 before its other gates, so every probe in the harnesses (auth, params and query fuzz, 404, data exposure, round trip) sends it, body or not.
517
520
  - `generate_valid_object(object_schema, schema) => {value, result}` — required and defaulted fields; when `schema` (refinements included) refuses those, each optional field alone in declaration order, the first that parses; failing that, the optional fields added cumulatively until it parses. Covers a `check` over optional fields (at least one of, exactly one of, both of) at any depth, and, where one optional field suffices, keeps the others (an `acting` declared first) out. Returns the last `parse` result (`GeneratedObject`) and leaves the throw to the caller, which renders its issues with `format_issues` (`schema_issues.ts`).
518
521
  - `generate_valid_object_with_field(object_schema, schema, base, field)` — a valid object carrying `field`, built from the valid `base`: `base` itself when it carries the field; else the field joins `base`, with the optional fields `base` omits filled as `generate_valid_object` fills them (a pair rule: `scope_kind` needs `scope_id`); failing that, the field replaces `base`'s optional fields, refilled around it (exactly one of: adding `slug` drops `id`). `null` when no object the generator builds carries the field. The body a single-fault case on a field the base omits changes.
@@ -520,15 +523,16 @@ adversarial/round-trip tests. A value that is no schema throws, naming it.
520
523
 
521
524
  ### `integration_helpers.ts` — route lookup + body checks
522
525
 
523
- - `find_route_spec(specs, method, path)` — the first spec in list (mount) order whose method and path template match, as Hono dispatches (the hono-free `find_mounted_route`; the DEV check reads Hono's own router), `HEAD` read as `GET`, the path read as Hono reads it (pathname, percent-decoded); a template passed as the path (a segment that is `*` or starts with `:`) finds its own spec first, outranking mount order.
524
- - `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).
525
- - `assert_response_matches_spec(specs, method, path, response, route_error_maps?)` — 2xx → validates against `spec.output`; an error status (400 and up) → `assert_error_response_declared` against the route's error map — the one in `route_error_maps` (`AppSurfaceSpec.route_error_maps`, middleware included), else the route's own: a status the map lacks throws (`Undeclared error status (S): METHOD path: …`), as does a body off its schema, with the DEV error check's exemptions (500 `internal_error`, 503 `service_unavailable`, a JSON-RPC envelope on a `jsonrpc` route). Non-JSON responses allowed only when no schema applies. The round trips and `ErrorCoverageCollector.assert_and_record` run through it.
526
+ - `find_route_spec(specs, method, path)` — the first spec in list (mount) order whose method and path template match, as Hono dispatches (the hono-free `find_mounted_route`; the DEV check reads Hono's own router), `HEAD` read as `GET`, the path read as the router reads it (the raw pathname, nothing decoded); a template passed as the path (a segment that is `*` or starts with `:`) finds its own spec first, outranking mount order.
527
+ - `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/signup/bootstrap remain on REST).
528
+ - `assert_response_matches_spec(specs, method, path, response, route_error_maps?)` — 2xx → validates against `spec.output`; an error status (400 and up) → `assert_error_response_declared` against the route's error map — the one in `route_error_maps` (`AppSurfaceSpec.route_error_maps`, middleware included), else the route's own: a status the map lacks throws (`Undeclared error status (S): METHOD path: …`), as does a body off its schema, with the DEV error check's exemptions (500 `internal_error`, 503 `service_unavailable`, a JSON-RPC envelope on a `jsonrpc` route). Non-JSON responses allowed only when no schema applies. The round trips and `ErrorCoverageCollector.assert_and_record` run through it. An answer no route gave — the app's 405 `method_not_allowed`, its JSON `route_not_found` 404, the plain-text `404 Not Found` — fails outright, even where the route declares a 404: a route on the surface that the backend doesn't mount is never a pass.
526
529
  - `assert_no_error_info_leakage(body, context)` — rejects field-name patterns (`stack`, `trace`, `sql`, …) + value patterns (`node_modules`, stack-like `at …`, `.ts:NN`).
527
530
  - `assert_rate_limit_retry_after_header(response, body)` — `Retry-After` numeric header equals `Math.ceil(body.retry_after)`.
528
531
  - `sensitive_field_blocklist` — `['password_hash', 'token_hash']`; never in any response body.
529
532
  - `admin_only_field_blocklist` — `['updated_by', 'created_by']`; never in non-admin response bodies.
530
533
  - `collect_json_keys_recursive(value)` — deep walk; returns `Set<string>` of every key at every nesting depth.
531
534
  - `assert_no_sensitive_fields_in_json(body, blocklist, context)` — rejects any key in the blocklist at any depth.
535
+ - `to_principal_transport(principal, fixture)` — the transport a principal's request goes through, so it carries that principal's credential and nothing else: cookie-free with no `Origin` for the daemon token, cookie-free for a public call, the fixture's own for a session principal (whose `Cookie` header replaces the jar's). A bearer or anonymous probe over the fixture's transport authenticates as the keeper, whose cookie its jar carries — send those through `fixture.fresh_transport()`.
532
536
  - `pick_auth_headers(spec, test_app, authed_account, admin_account)` — `RouteAuth` → appropriate test credentials; role `admin` uses `admin_account`, other roles use bootstrapped keeper, `keeper` uses daemon token.
533
537
 
534
538
  ## Attack surface suites
@@ -649,9 +653,10 @@ the response against declared schemas. DB-backed via `create_test_app`.
649
653
  Per-route test (`test.each`) — one line per route in the vitest output.
650
654
 
651
655
  Options: `{setup_test, surface_source, skip_routes?, input_overrides?, success_fixtures?, param_values?}`.
652
- Principals and the 401 check are the RPC round-trip's (`pick_auth_principal`;
653
- `assert_route_authenticated` over `is_unauthenticated_refusal`, reading the
654
- flat `error`), and a non-`GET` route called as the authed
656
+ Principals, their transports, and the 401 and credential-type checks are the
657
+ RPC round-trip's (`pick_auth_principal`, `to_principal_transport`;
658
+ `assert_route_authenticated` over `is_unauthenticated_refusal` and
659
+ `is_credential_type_refusal`, reading the flat `error`), and a non-`GET` route called as the authed
655
660
  account runs on a fresh account — a generated logout would otherwise end the
656
661
  shared session, leaving `/password` and every later authed route a vacuous
657
662
  401. `src/test/testing/round_trip.test.ts` pins both, the RPC test's twin.
@@ -684,7 +689,13 @@ rpc_endpoints, skip_methods?, input_overrides?, success_fixtures?}`.
684
689
  round-trip; `AuthPrincipal`): none for a public method, the keeper's daemon
685
690
  token when `credential_types` names it, the admin account's session for an
686
691
  admin-gated method, the keeper's session for another role, else the authed
687
- account's session. The 401 check is `is_unauthenticated_refusal`: a 401
692
+ account's session. The request goes through `to_principal_transport`, so a
693
+ spawned backend sees only the picked credential — over the fixture's own
694
+ transport it would discard a daemon token as browser context and answer for
695
+ the keeper's session cookie. A 403 `credential_type_required` therefore fails
696
+ (`is_credential_type_refusal`): the principal was picked because the method
697
+ admits its credential type, so a method no picked principal can reach goes in
698
+ `skip_methods`. The 401 check is `is_unauthenticated_refusal`: a 401
688
699
  reading `authentication_required` or naming no reason fails; a handler's own
689
700
  401 reason on an authenticated call (`invalid_credentials` for a wrong current
690
701
  password) passes. So a handler that answers 401 to a valid credential must name
@@ -842,7 +853,7 @@ these thematic areas:
842
853
 
843
854
  1. Login/logout lifecycle
844
855
  2. Login response body (strict schema)
845
- 3. Cookie attributes (HttpOnly, Secure-in-prod, SameSite)
856
+ 3. Cookie attributes (HttpOnly, Secure, SameSite, Path)
846
857
  4. Session security (tampering, forgery)
847
858
  5. Session revocation (self + revoke-all)
848
859
  6. Password change (revokes all sessions + API tokens)
@@ -1014,9 +1025,9 @@ One-shot transport:
1014
1025
  - `RpcTestTransport = (url, init) => Promise<Response>` — duck type `Hono.request` already satisfies.
1015
1026
  - `http_transport(app)` — adapter for anything with a `request()` method.
1016
1027
  - `RpcCallResult` — discriminated `{ok: true, status, headers, result}` / `{ok: false, status, headers, error: {code, message, data?}}`. `headers` is the lowercased-key response-header snapshot so callers can assert header-level properties (e.g. the conformance runner's no-fingerprint invariant).
1017
- - `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.
1028
+ - `headers_to_record(headers)` — snapshot a `Headers` into a lowercased-key `Record<string, string>` (multi-value collapses to the comma-joined form; `Set-Cookie` keeps only its last value — read `getSetCookie()` for cookies). Used by `rpc_call` and the conformance table's REST branch to thread response headers through for assertions.
1018
1029
  - `RpcCallArgs` — `{app, path, method, params?, params_json?, headers?, id?, verb?}`. `verb` defaults to `'POST'`; use `'GET'` for `side_effects: false` methods. `params_json` sends raw JSON text in place of `params` (exclusive with it) on either verb.
1019
- - `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.
1030
+ - `rpc_call_raw(args)` — the same request as `rpc_call`, the response unparsed: `RpcCallRawResult` `{status, headers, set_cookies, body}` with the whole envelope (`set_cookies` every `Set-Cookie` line in order — the headers snapshot folds them). `parse_rpc_call_result(raw, method)` turns it into an `RpcCallResult`; `rpc_call` is the two composed.
1020
1031
  - `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`.
1021
1032
  - `rpc_call_typed<T>(args, output_schema)` — parses the success `result` through the schema (`parse`); throws on envelope failure, error response, or schema mismatch. Use `rpc_call` when the test needs to assert on error shapes.
1022
1033
  - `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.
@@ -1040,7 +1051,7 @@ Registry lookups:
1040
1051
  - **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).
1041
1052
  - correct auth passes (not 401/403)
1042
1053
  - GET unauthenticated for `side_effects: false` reads
1043
- 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.
1054
+ 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`, a GET query holding an escape that doesn't decode → `invalid_request` on `id: null`, 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.
1044
1055
  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.
1045
1056
 
1046
1057
  Skips silently when `surface.rpc_endpoints` is empty. Uses stub deps — no
@@ -1056,7 +1067,7 @@ round-trip coverage from `describe_rpc_attack_surface_tests` +
1056
1067
  `<module>.rpc_suites.db.test.ts` mounting the opt-in factory on the RPC
1057
1068
  endpoint and calling both suites. See ../../test/CLAUDE.md §Composable
1058
1069
  Test Suites for the obligation note; existing
1059
- ../../test/auth/\*.rpc_suites.db.test.ts files are templates.
1070
+ `src/test/auth/*.rpc_suites.db.test.ts` files are templates.
1060
1071
 
1061
1072
  ## Cross-cutting conventions
1062
1073
 
@@ -1074,24 +1085,25 @@ points:
1074
1085
 
1075
1086
  The standard test suites take a unified
1076
1087
  `{setup_test, surface_source, capabilities}` shape so the same suite bodies
1077
- run against an in-process Hono harness today and against a spawned backend
1088
+ run against an in-process Hono harness and against a spawned backend
1078
1089
  over real HTTP — either the Rust spine (`zzz_server`, another consumer's
1079
1090
  spine server, or the non-domain `testing_spine_stub`) or a **TS** spine binary built on the
1080
1091
  test-server core below (fuz_app's own domain-free `testing_spine_server`, run
1081
1092
  on Node + Bun). In-process is the fast feedback path; cross-process is the
1082
1093
  source of truth for wire-shape conformance.
1083
1094
 
1084
- fuz_app's own spines run every single-backend suite below through one
1095
+ fuz_app's own spines run every single-backend suite through one
1085
1096
  `describe_spine_cross_suites` call, `src/test/cross_backend/spine_suites.cross.test.ts`
1086
- (§`cross_backend/spine_suites.ts`), so a suite's section names the suite, not a
1087
- file; the dual-spawn and limiter-enabled suites name their own files.
1097
+ (§`cross_backend/spine_suites.ts`); the dual-spawn and limiter-enabled suites
1098
+ have files of their own.
1088
1099
 
1089
1100
  ### Fixture protocol + capabilities
1090
1101
 
1091
1102
  - `testing/cross_backend/setup.ts` — `SetupTest` / `TestFixture` /
1092
1103
  `CreateTestAccountOptions` types (`fixture.create_account` and
1093
1104
  `fixture.extra_accounts` hand out `TestAccount`s from `app_server.ts`, built
1094
- by `to_test_account`),
1105
+ by `to_test_account`); the in-process setups live beside it in
1106
+ `testing/cross_backend/in_process_setup.ts`:
1095
1107
  `default_in_process_setup(options)` (wraps `create_test_app`; pass
1096
1108
  `migration_namespaces` for suites needing tables beyond the auth-only
1097
1109
  default — the cell parity suite passes `[CELL_MIGRATION_NS]`, and
@@ -1102,14 +1114,17 @@ file; the dual-spawn and limiter-enabled suites name their own files.
1102
1114
  `session_options` / `create_route_specs` / `rpc_endpoints` pass-through;
1103
1115
  call sites pass the output directly or spread it alongside
1104
1116
  suite-specific extras like `roles`, `skip_routes`, `input_overrides`,
1105
- `db_factories`). Also exports `BootstrappedBackendHandle` (a
1117
+ `db_factories`). `setup.ts` also exports `BootstrappedBackendHandle` (a
1106
1118
  `BackendHandle` enriched with the keeper's captured credentials) and
1107
1119
  `default_cross_process_setup(handle, options?)` — full runtime body.
1108
1120
  Every per-test invocation unconditionally fires `_testing_reset` over the
1109
1121
  keeper's daemon-token channel: wipes every auth-namespace row (no
1110
1122
  keeper-preserve filter), resets `app_settings` + `bootstrap_lock`, and
1111
1123
  inline-seeds a fresh keeper (`[ROLE_KEEPER, ROLE_ADMIN, ...extra_keeper_roles]`)
1112
- plus any declared `extra_accounts`. The fixture's `account` / `actor` /
1124
+ plus any declared `extra_accounts`; the seeds a backend answers with are
1125
+ matched to the request by username and actor name
1126
+ (`match_testing_reset_seeds`), and a missing, extra, or duplicated one
1127
+ throws naming the backend. The fixture's `account` / `actor` /
1113
1128
  cookies refresh to the new keeper on every call — in-process and
1114
1129
  cross-process both run against a freshly bootstrapped keeper per test.
1115
1130
  `fixture.create_account()` keeps a separate path: keeper-driven
@@ -1131,11 +1146,11 @@ file; the dual-spawn and limiter-enabled suites name their own files.
1131
1146
  `signup_path` / `login_path` (default `SPINE_ACCOUNT_SIGNUP_PATH` /
1132
1147
  `SPINE_ACCOUNT_LOGIN_PATH`, from `spine_surface_constants.ts`, which also
1133
1148
  carries the other account routes, `SPINE_WS_PATH`, and the prefix).
1134
- Caller-supplied `username`s pass through _as-is_ now that the DB
1135
- wipes between tests — hardcoded names like `'user_two'` work and the
1136
- earlier uniquification prefix is gone. Every `TestFixture` also exposes
1149
+ Caller-supplied `username`s pass through as given — the database is wiped
1150
+ between tests, so a hardcoded name like `'user_two'` never collides. Every
1151
+ `TestFixture` also exposes
1137
1152
  `fresh_transport({origin?: string | null})` — cookie-jar-free probe;
1138
- pass `{origin: null}` for bearer-only paths.
1153
+ pass `{origin: null}` for bearer-only paths. It also carries the conformance principals' mints — `mint_expired_session()`, and `mint_revoked_session()` / `mint_revoked_token()` / `mint_expired_token()` for the dead credentials, each proving its credential live through `assert_credential_authenticates` over a cookie-free transport before killing it; in-process they need `account_verify` on the setup's `rpc_endpoints`, and cross-process `mint_expired_token` needs `_testing_shorten_credential_expiry` mounted.
1139
1154
 
1140
1155
  **Keeper ≠ admin.** `fixture.account` is the keeper account holding
1141
1156
  `[ROLE_KEEPER, ROLE_ADMIN]` — the role split mirrors production
@@ -1150,11 +1165,15 @@ file; the dual-spawn and limiter-enabled suites name their own files.
1150
1165
  (the **gating** flags `ws` / `sse` / `cell_crud` / `cell_relations` /
1151
1166
  `cell_gated_create` / `account_lifecycle` / `fact_serving` /
1152
1167
  `fact_serving_admin_hash` / `ready` /
1153
- `account_status` / `peer_request` /
1168
+ `account_status` / `spine_fallback` / `host_gate` / `peer_request` /
1154
1169
  `ws_handshake_pipelining` / `ws_account_actions` /
1155
- `ws_role_gated` / `rooms` / `ws_refusal_body` — each has a `test_if`
1156
- reader (`ws_refusal_body` picks how the front-door table reads a WS
1157
- refusal instead); `peer_request` (server-initiated requests — the ActionPeer
1170
+ `ws_role_gated` / `rooms` — each read by `test_if` or a row's `requires` —
1171
+ the non-gating `ws_refusal_body` and `runtime_resolves_dot_segments`, which
1172
+ pick how a case reads its answer, and the list
1173
+ `ws_upgrade_runtime_refusals`, the upgrades the backend's runtime answers
1174
+ before the app runs (`['empty_host']` on `@hono/node-server`, `[]` on Bun
1175
+ and the Rust spine), which the request-header wire suite holds to exactly
1176
+ that answer; `peer_request` (server-initiated requests — the ActionPeer
1158
1177
  `peer/ping` round-trip) is `true` on fuz_app's Rust and TS spine presets
1159
1178
  (`ConnectionRegistry.request_connection`); a backend states it
1160
1179
  `true` once it wires the `peer/ping` HTTP + WS mount), `test_if(cond, name, fn)`
@@ -1173,8 +1192,13 @@ file; the dual-spawn and limiter-enabled suites name their own files.
1173
1192
  `make_default_{ts,rust}_backend_config` — so a config that leaves one out
1174
1193
  fails typecheck naming it, rather than silently skipping its suites. The
1175
1194
  family defaults carry the declared surface's mounts (`account_lifecycle`,
1176
- `account_status`) and the runtime-behavior flags (`ws_handshake_pipelining`,
1177
- `ws_refusal_body`) of the family's reference runtime — Node for TS, hyper
1195
+ `account_status`, and `spine_fallback` — an unmatched path outside the auth
1196
+ scope answered by the spine's own fallback, which a backend serving a static
1197
+ or SPA fallback of its own states `false`; and `host_gate`, the DNS-rebinding
1198
+ gate on, which a backend running with it off states `false`) and the
1199
+ runtime-behavior flags
1200
+ (`ws_handshake_pipelining`, `ws_refusal_body`, `ws_upgrade_runtime_refusals`,
1201
+ `runtime_resolves_dot_segments`) of the family's reference runtime — Node for TS, hyper
1178
1202
  for Rust; a backend on another runtime (Bun) overrides them. `cell_crud`
1179
1203
  gates the CRUD parity suite, `cell_relations` the relation / ACL / audit
1180
1204
  parity suite — both `true` on every backend that live-mounts the full cell
@@ -1224,7 +1248,7 @@ file; the dual-spawn and limiter-enabled suites name their own files.
1224
1248
  `account_status` gates the integration suite's `account status response body`
1225
1249
  case — `GET /api/account/status` is bundled into `create_account_route_specs`,
1226
1250
  so every spine serves it (`true`); the gate fails loud if a declaring backend
1227
- doesn't mount it (replacing the old runtime 404-sniff-skip).
1251
+ doesn't mount it.
1228
1252
  No flag covers the body-size smuggling probe: every backend closes the
1229
1253
  connection after an oversized-body 413 (at once on Node, Bun and the Rust
1230
1254
  spine), so the pipelined request
@@ -1281,8 +1305,8 @@ minus their in-process-only knobs (`create_route_specs`,
1281
1305
  One call that runs every shipped single-backend cross suite against one
1282
1306
  spawned backend: `describe_spine_cross_suites(handle, {surface_source,
1283
1307
  session_options, rpc_endpoints, live_rpc_endpoints?, roles?, setup?, exclude?,
1284
- exclude_cases?, overrides?, rpc_success_fixtures?, rpc_skip_methods?, rpc_input_overrides?,
1285
- rpc_max_body_bytes?, ws_max_message_bytes?})`.
1308
+ exclude_cases?, overrides?, suite_roles?, ws_required_roles?, rpc_success_fixtures?,
1309
+ rpc_skip_methods?, rpc_input_overrides?, rpc_max_body_bytes?, ws_max_message_bytes?})`.
1286
1310
  `live_rpc_endpoints` is the backend's whole live mount; given, `rpc_adversarial`
1287
1311
  also walks the methods it keeps off the declared surface. `rpc_input_overrides`
1288
1312
  reaches the standard bundle's RPC round-trip and `rpc_adversarial`'s
@@ -1343,6 +1367,7 @@ here never reaches it.
1343
1367
  `_testing_room_evict` when `rooms` is; the call throws otherwise. A suite
1344
1368
  every case of which drives another backdoor (`SuiteEntry.backdoors`:
1345
1369
  `credential_deadline` → `_testing_shorten_credential_expiry`,
1370
+ `credential_conformance` → `_testing_credential_read`,
1346
1371
  `origin_conformance` → `_testing_origin_check`, `ws_outbound_overflow` →
1347
1372
  `_testing_flood_notifications`) skips itself on a backend not declaring it,
1348
1373
  as a skipped test beside the excludes whose reason names the backdoor; an
@@ -1388,7 +1413,8 @@ here never reaches it.
1388
1413
  role-gated WS endpoint and its roles) default to the `SPINE_*` constants —
1389
1414
  a suite whose flag is off never reads them, and a backend mounting its own
1390
1415
  overrides them. Anything else comes from the config when it can
1391
- (`session_cookie_codec`'s `cookie_keys` from `SECRET_FUZ_COOKIE_KEYS`), else
1416
+ (the `cookie_keys` of `session_cookie_codec` and the two
1417
+ credential conformance suites, from `SECRET_FUZ_COOKIE_KEYS`), else
1392
1418
  from `overrides`; with neither, the call throws naming the suite and the
1393
1419
  field — provide it or exclude the suite.
1394
1420
 
@@ -1403,8 +1429,9 @@ seed on the default). A backend with only the builtin roles passes
1403
1429
  `{cell_grant: ROLE_KEEPER, conferral: ROLE_ADMIN}`: keeper reach is not admin
1404
1430
  reach, so every `cell_grant_role` arm still turns on the grant, while an admin
1405
1431
  views and edits every cell — `describe_cell_grant_role_cross_tests` refuses
1406
- `ROLE_ADMIN` — and the scoped-assign case of `role_grant_participation` skips
1407
- for a builtin. fuz_app's own wiring is
1432
+ `ROLE_ADMIN` — and the scoped-assign case of `role_grant_participation` and
1433
+ the scoped-revoke case of `role_grant_offer_notification_ws` skip for a
1434
+ builtin. fuz_app's own wiring is
1408
1435
  `src/test/cross_backend/spine_suites.cross.test.ts`.
1409
1436
 
1410
1437
  ### `cross_backend/rust_spine_consumer_surface.ts` — `create_rust_spine_consumer_surface_spec`
@@ -1415,7 +1442,7 @@ domain_action_specs, extra_rpc_actions?, roles?, exclude_methods?,
1415
1442
  rpc_path?, host_gate?})`, built on `create_test_app_surface_spec` from the hono-free route
1416
1443
  shapes. It declares `/health`, the `ACCOUNT_ROUTER_PATHS` under
1417
1444
  `/api/account` (`/status`, `/login`, `/logout`, `/password` — what
1418
- `fuz_auth::account_router` mounts, so the TS-only `/verify` stays off), signup,
1445
+ `fuz_auth::account_router` mounts), signup,
1419
1446
  bootstrap as a `surface_only` shape, the daemon-token layer the consumer test
1420
1447
  binaries wire, the host gate's `host` layer unless `host_gate: false` says the
1421
1448
  server turns the gate off (default on), and one RPC endpoint: the standard actions (over `roles`), the
@@ -1453,13 +1480,34 @@ wire-shape check passes green on even when behavior is wrong.
1453
1480
 
1454
1481
  - `conformance_case.ts` — the `ConformanceCase` type (types only; nothing parses a case):
1455
1482
  `{name, request: {method, params?, params_json?, as, acting?, verb?}, expect: {status,
1456
- error_reason?, fields?, headers?, equivalence_group?}, note?, xfail?}`. A case is **data** — `method`
1483
+ error_reason?, error_code?, fields?, headers?, set_cookie?, equivalence_group?}, note?, xfail?}`. A case is **data** — `method`
1457
1484
  resolves its `input`/`output` from the live registry (RPC) or `RouteSpec`
1458
- (the 6 REST auth routes), so the case never carries a schema. `as` is the
1485
+ (the REST auth routes), so the case never carries a schema. `as` is the
1459
1486
  closed `ConformancePrincipal` enum (`keeper` / `daemon` / `invalid_daemon` /
1460
1487
  `daemon_browser` / `token` / `bearer_browser` / `malformed_bearer` / `scoped_token` / `anonymous` /
1461
- `fresh_non_admin` / `role_holder` / `wrong_role` / `expired_session`) —
1488
+ `fresh_non_admin` / `role_holder` / `wrong_role` / `expired_session`, and
1489
+ the dead credentials `tampered_cookie` / `wrong_daemon` / `unknown_bearer` /
1490
+ `revoked_session` / `revoked_token` / `expired_token`) —
1462
1491
  fixture accessors, never inline credential minting.
1492
+ The dead credentials each ride a transport carrying nothing else, and each
1493
+ is well-formed, so the leg that refuses it is the one named:
1494
+ `tampered_cookie` is the keeper's cookie with its MAC changed (present and
1495
+ invalid — refused as anonymous and cleared); `wrong_daemon` a token-shaped
1496
+ `X-Daemon-Token` that is not the server's; `unknown_bearer` a token-shaped
1497
+ bearer no row matches; `revoked_session` a session that verified and was
1498
+ revoked (`fixture.mint_revoked_session()` — its cookie still verifies, so it
1499
+ is not cleared); `revoked_token` (`fixture.mint_revoked_token()`);
1500
+ `expired_token` a token past its `expires_at`
1501
+ (`fixture.mint_expired_token()` — on an account of its own, its expiry
1502
+ pulled in to `EXPIRED_TOKEN_SHORTEN_SECONDS` by the statement
1503
+ `_testing_shorten_credential_expiry` runs, `query_shorten_credential_expiry`,
1504
+ then one wait of `EXPIRED_TOKEN_WAIT_MS`, on both fixtures, so the row is
1505
+ one production could hold). Each of the three mints proves its credential
1506
+ live first — `assert_credential_authenticates`, an `account_verify` over a
1507
+ transport carrying only it — and that its revoke removed a row or its expiry rewrote one, and throws
1508
+ otherwise: revocation is a row delete, so without that a credential that
1509
+ never worked would pass as revoked. Each answers as `anonymous` does, row
1510
+ for row.
1463
1511
  `invalid_daemon` sends a malformed `X-Daemon-Token` alongside the keeper
1464
1512
  session cookie over a no-Origin transport: the middleware soft-fail-discards
1465
1513
  the daemon token (matching the Rust spine's `None`), auth falls through to the
@@ -1494,8 +1542,17 @@ error_reason?, fields?, headers?, equivalence_group?}, note?, xfail?}`. A case i
1494
1542
  `error_reason` is the imported
1495
1543
  `ERROR_*` constant (asserted against the RPC `error.data.reason` or the
1496
1544
  REST flat-body `error`; the dispatcher's 401 carries
1497
- `authentication_required`, and a denial with no reason — a handler's bare
1498
- `forbidden` — is pinned by `status`). `equivalence_group` is the
1545
+ `authentication_required`). `error_reason: null` pins a denial with no
1546
+ reason — a handler's bare `forbidden` — as carrying no `data.reason` (RPC
1547
+ only: a REST error body always names its code). On every RPC error row the
1548
+ runner also asserts the JSON-RPC `error.code`: `error_code` when the row
1549
+ names one, else the code the status maps to
1550
+ (`http_status_to_jsonrpc_error_code`) — several codes share a status, so a
1551
+ refusal under another one (`invalid_request` at 400) states it.
1552
+ `check_conformance_cases(cases)` (exported) runs when the table is
1553
+ described and throws on a row that can't mean anything: `error_reason: null`
1554
+ or `error_code` on a REST row, and a status outside 2xx beside a
1555
+ `set_cookie` that mints. `equivalence_group` is the
1499
1556
  **negative-space** axis: every case tagged with the same group string must
1500
1557
  produce a **byte-identical** normalized response (`{status, body}`),
1501
1558
  asserted per impl after the case loop. It promotes a masked pair
@@ -1511,7 +1568,19 @@ error_reason?, fields?, headers?, equivalence_group?}, note?, xfail?}`. A case i
1511
1568
  invariant on _every_ response (`conformance_table.ts` `FINGERPRINT_HEADERS`
1512
1569
  — `Server` / `X-Powered-By` / `WWW-Authenticate` must stay absent on both
1513
1570
  spines, so a framework upgrade adding one can't become a silent
1514
- backend-fingerprinting oracle). Headers are deliberately kept out of the
1571
+ backend-fingerprinting oracle).
1572
+ `set_cookie` is the **session cookie** axis, a `SessionCookieEffect`
1573
+ (`session_cookie_effect.ts`): `'none'`, `'clear'` (exactly the clearing
1574
+ line), `'set'` (exactly one minting line), `'clear_then_set'` (a login
1575
+ carrying a stale cookie). **Omitted means `'none'`**, so every row asserts
1576
+ it mints and clears nothing unless it says otherwise. The lines are compared
1577
+ byte for byte with the spine's own formatters
1578
+ (`classify_session_cookie_effect`; lines in no recognised shape fail the
1579
+ row) — so a drift in the TS formatter itself is caught by the Rust legs,
1580
+ `cookie_attributes` and the credential wire suite, which spell the lines
1581
+ themselves. Behind it sits a floor: a response that is not 2xx never mints
1582
+ a session cookie (`assert_session_cookie`, HTTP legs) — a backstop, since a
1583
+ row can't be written expecting a mint on a refusal. Headers are deliberately kept out of the
1515
1584
  `equivalence_group` `{status, body}` comparison (`Set-Cookie` / `Date` vary).
1516
1585
  - `conformance_table.ts` — `describe_conformance_table_tests({cases,
1517
1586
  setup_test, surface_source, capabilities, rpc_endpoints, live_rpc_endpoints?,
@@ -1527,12 +1596,14 @@ session_options, principals?, ws?, suite_name?})`. A case's RPC method
1527
1596
  whole mount built on stub deps for resolution only. Same `{setup_test, surface_source,
1528
1597
  capabilities}` protocol every Tier 1 suite uses, so **one case array runs
1529
1598
  both transports** — in-process (`gro test`) and cross-process (the gate,
1530
- each backend's real auth resolution). `resolve_conformance_principal` (exported) maps the five
1599
+ each backend's real auth resolution). `resolve_conformance_principal` (exported) maps the
1531
1600
  always-available principals to fixture accessors; `role_holder` /
1532
1601
  `wrong_role` read a seeded `extra_accounts` username named via
1533
1602
  `options.principals`. `send_conformance_case(c, {fixture, surface_source, principals?,
1534
1603
  resolved_rpc_endpoints, request_headers?})` (exported) is the send half — principal resolved,
1535
- request sent, the raw `{target, status, headers, body}` back unasserted; the
1604
+ request sent, the raw `{target, status, headers, set_cookies, body}` back
1605
+ unasserted (`set_cookies` every `Set-Cookie` line in order — a headers
1606
+ record folds them; `[]` on the WS leg); the
1536
1607
  table asserts on it, and the cross-backend differential compares two.
1537
1608
  `request_headers` go on the HTTP request beneath the principal's (the
1538
1609
  differential's identity encoding); the WS leg sends none.
@@ -1549,9 +1620,10 @@ capabilities}` protocol every Tier 1 suite uses, so **one case array runs
1549
1620
  `jsonrpc_error_code_to_http_status` (200 for a result) and every row holds
1550
1621
  unchanged. What WS loses is headers — the TS DEV-only `X-Fuz-Auth-Debug`
1551
1622
  among them. `is_ws_conformance_case(c)` (exported) is the filter: RPC, sent
1552
- `POST`, no header value pinned, a principal that can hold a socket — not
1553
- `anonymous` / `bearer_browser` / `malformed_bearer` / `expired_session`,
1554
- refused at the upgrade, nor `scoped_token`, refused `surface:ws_upgrade`
1623
+ `POST`, no header value pinned, a session cookie effect of `'none'`, a
1624
+ principal that can hold a socket — not
1625
+ `anonymous` / `bearer_browser` / `malformed_bearer` / `expired_session` or
1626
+ a dead credential, refused at the upgrade, nor `scoped_token`, refused `surface:ws_upgrade`
1555
1627
  there (a narrowed bearer can never send a frame, so no per-frame scope row
1556
1628
  exists; the front-door table pins the upgrade refusal). An equivalence
1557
1629
  group left with one member on the WS leg is dropped. Cross-process only.
@@ -1585,533 +1657,199 @@ capabilities}` protocol every Tier 1 suite uses, so **one case array runs
1585
1657
  live gates, and the Rust spine dispatches its own. Input-dependent handler
1586
1658
  checks stay hand-written rows. fuz_app spreads it into both conformance
1587
1659
  legs.
1588
- - `xfail.ts` — `xfail_until(tracking_id, reason, name, fn)`, a thin
1589
- `test.fails` wrapper for deferred-by-design rows (visible + self-cleaning:
1590
- turns red when the gap closes, forcing marker removal). In-scope gaps fail
1591
- loud as a normal `test`, not via this marker. Sibling to `test_if` in
1660
+ - `xfail.ts` — `xfail_until(marker, name, fn)` for deferred-by-design rows,
1661
+ `marker` an `XfailMarker` `{tracking_id, reason, fails_with}`. `fails_with`
1662
+ is required — a `RegExp` over the thrown message or a predicate over the
1663
+ thrown value — so the test passes only on the tracked failure: any other
1664
+ throw is red, and so is a body that passes (the gap closed; remove the
1665
+ marker). In-scope gaps fail loud as a normal `test`, not via this marker. Sibling to `test_if` in
1592
1666
  `capabilities.ts`.
1593
1667
 
1594
1668
  Wire from a `.db.test.ts` (in-process) and a `.cross.test.ts`
1595
- (cross-process) with the same case array — fuz_app's own runner-proof is
1596
- `../../test/cross_backend/conformance.{db,cross}.test.ts` sharing
1597
- `conformance_proof_cases.ts`, the generated auth rows, and
1598
- `conformance_admin_cases.ts` (offer list/history across accounts, invite
1599
- errors, pagination bounds on the admin lists); two checks the table can't
1600
- express ride beside it on both legs: the duplicate-invite refusal (two
1601
- requests, `describe_invite_duplicate_tests` in `invite_duplicate.ts`) and the
1602
- offer reads' cross-account refusal being identical for the keeper's real id
1603
- and the nil id (`describe_offer_cross_account_tests` in
1604
- `offer_cross_account.ts` — the existing id is known only to the fixture).
1605
- The cross legs pass the spine's live mount, so the table also runs
1606
- `conformance_actor_cases.ts` (`actor_lookup`'s empty-`ids` bound, the
1607
- `actor_search` scope gate) and `conformance_cell_cases.ts` (the cell refusals
1608
- one request reaches with no cell in place: `kind` inside `data`, `cell_get`
1609
- naming neither `id` nor `path`, the relation lists naming neither or both
1610
- endpoints — each `invalid_params` with its declared reason — a grant miss
1611
- `cell_grant_not_found`, the `cell_list` pagination bounds and enum-valued
1612
- filters, and the schema-first rows where a bad page or filter value must answer
1613
- before a handler's reason; `conformance_cell_cases.test.ts` requires a `{}` row
1614
- with a reason for every cell action whose input is marked
1615
- `empty_input_handler_guarded`), with the
1616
- generated rows over the off-surface methods; the in-process leg for those is
1617
- `conformance_off_surface.db.test.ts`, over an app mounting the cell surface
1618
- and the two resolvers. The cross leg runs the same cases
1619
- over WS too, and both legs run `conformance_acting_cases.ts` with the
1620
- generated rows on a keeper seeded with `extra_actors`: no `acting` or a
1621
- malformed one → 400 `actor_required`; the nil id, an unused id and another
1622
- account's real actor → one identical 400 `actor_not_on_account`; acting as
1623
- the extra actor (no grants) → 403 `insufficient_permissions` on an admin
1624
- method over a session and a bearer, and on the keeper-gated `account_purge`
1625
- over the daemon token; acting as the bootstrap actor passes the same gates.
1626
- The role gate reads the resolved actor's grants on both spines.
1627
-
1628
- ### `cross_backend/ws_round_trip.ts` — `describe_cross_process_ws_tests`
1629
-
1630
- Real-upgrade WebSocket coverage of a spawned backend — the cross-process
1631
- counterpart to the in-process `ws_round_trip.ts` harness, kept a separate
1632
- call (not folded into `describe_standard_cross_process_tests`) because it
1633
- needs raw `base_url` / `ws_path` the standard bundle doesn't carry, mirroring
1634
- how `describe_ws_round_trip_tests` sits beside the in-process suites. `describe_cross_process_ws_tests({setup_test, capabilities,
1635
- base_url, ws_path, origin?, rpc_path?, max_message_bytes?, logout_path?,
1636
- password_path?, max_tokens?, ws_account_roles?})` opens a live
1637
- `WebSocket` via `create_ws_transport` (the `ws` npm package) and asserts
1638
- cases against the upgrade route `register_action_ws` mounts (origin →
1639
- `require_auth` → dispatch): authed upgrade round-trips `heartbeat`,
1640
- requests sent the moment the socket opens are all answered (both spines admit a
1641
- connection only after re-reading its credential; frames that arrive first wait
1642
- for that, they are not dropped) — and, gated on
1643
- `capabilities.ws_handshake_pipelining`, the same with the ordering forced:
1644
- frames written in the same TCP write as the upgrade request (`connect_raw_ws`)
1645
- are all answered,
1646
- `heartbeat` admits only the parameterless shapes (a declared param →
1647
- `invalid_params`), a message past `max_message_bytes` (default
1648
- `DEFAULT_WS_MAX_MESSAGE_BYTES`) closes with `WS_CLOSE_MESSAGE_TOO_BIG`,
1649
- anonymous upgrade refused, disallowed-origin upgrade refused, and — gated on
1650
- `rpc_path` — a live socket drops when the account's sessions are revoked
1651
- mid-connection (`account_session_revoke_all` over the keeper session channel;
1652
- asserted via `WsClient.wait_for_close`) and when its account is deleted
1653
- (`account_delete` by the keeper, also gated on
1654
- `capabilities.account_lifecycle`), each with `WS_CLOSE_SESSION_REVOKED` and
1655
- `WS_CLOSE_SESSION_REVOKED_REASON`. The rest of the revocation table closes a second
1656
- account's socket with `WS_CLOSE_SESSION_REVOKED` and
1657
- `WS_CLOSE_SESSION_REVOKED_REASON`: `account_token_revoke` its revoked token's
1658
- bearer socket (a socket on its other token stays open);
1659
- `admin_token_revoke_all`, `POST /logout` (`logout_path`), `POST /password`
1660
- (`password_path`) and `account_purge` (also gated on
1661
- `capabilities.account_lifecycle`) its bearer and session sockets; and
1662
- `max_tokens` further mints (default `DEFAULT_MAX_TOKENS`; `null` skips) the
1663
- bearer socket of the token the cap evicts. The account-wide rows come from
1664
- `cross_backend/revocation_drivers.ts` (`create_account_revocations`, shared
1665
- with the SSE suite), and a case that opens several sockets closes whichever
1666
- opened when a later open fails. The second accounts are created holding
1667
- `ws_account_roles`, for a backend whose WS upgrade requires a role (an
1668
- admin-gated `/api/ws` refuses a roleless account). Per-connection auth is enforced **at upgrade
1669
- time**, so the negative upgrade cases assert the upgrade itself rejects, not
1670
- a per-message error; the close cases prove a revocation closes an
1671
- already-open socket, since per-message dispatch never re-checks credential
1672
- validity. Omit `rpc_path` to skip the close cases (consumers without the
1673
- standard account and admin actions on their RPC endpoint). Two cases are gated
1674
- on `capabilities.ws_account_actions` (the WS endpoint mounts the account
1675
- actions): a socket that revokes its own sessions over that socket is closed
1676
- with `WS_CLOSE_SESSION_REVOKED` and its reason after reading the reply to its request; and (with
1677
- `rpc_path`) a socket mints an API token over WS, and its `token_create` audit
1678
- row is read back after `_testing_drain_effects` — a WS reply can precede its
1679
- audit write, so the drain is the barrier (the binary mounts it via
1680
- `create_testing_actions`).
1681
- Otherwise **consumer-agnostic** — it drives only the `heartbeat` protocol action
1682
- (guaranteed on every WS endpoint by `assert_ws_endpoints_include_protocol_actions`),
1683
- so it validates the transport without touching domain WS methods. Gated on
1684
- `capabilities.ws`; cross-process only (needs a real bound socket — wire from
1685
- a `*.cross.test.ts`, never an in-process setup). Authed cookies come from the
1686
- fresh-per-test keeper via `fixture.transport.cookies()`, not the stale
1687
- globalSetup handle.
1688
-
1689
- ### `cross_backend/role_grant_offer_notification_ws.ts` — `describe_role_grant_offer_notification_ws_tests`
1690
-
1691
- Real-upgrade coverage of the consentful-role-grants WS notification fan-out —
1692
- the server-initiated notifications (`received` → recipient,
1693
- `accepted`/`declined` → grantor, `retracted` → recipient, flat
1694
- `role_grant_revoked` → revokee, global and scoped, and
1695
- `role_grant_offer_supersede` → each superseded sibling's grantor on **both**
1696
- the accept- and revoke-cascade paths).
1697
- `describe_role_grant_offer_notification_ws_tests({setup_test, capabilities,
1698
- base_url, ws_path, ws_required_roles?, scoped_role?, scope_kind?})` opens the
1699
- affected counterparty's socket
1700
- (`create_admitted_ws_transport` — a targeted notification reaches only an
1701
- admitted connection, and the handshake alone doesn't say it is one), drives the
1702
- lifecycle RPC over `fixture.transport`, then
1703
- strict-parses the delivered frame against its canonical `@fuzdev/fuz_schema`
1704
- params schema from `auth/role_grant_offer_notifications.ts` (`parse_or_throw`;
1705
- the guard against serialization drift — field / null / datetime / the flat
1706
- revoke shape with its `scope_kind` and `scope_id` / the supersede `reason` +
1707
- `cause_id`). The scoped-revoke case has the keeper assign `scoped_role`
1708
- (default `SPINE_PARTICIPANT_ROLE`; `spine_suites` passes
1709
- `suite_roles.conferral`) in a `scope_kind` scope (default `'space'`, `null`
1710
- for a builtin role, which skips the case), revokes it, and holds the frame to
1711
- that pair. Every case also opens a **bystander** — a third account's
1712
- admitted socket, party to nothing the case drives — and once the targeted
1713
- frame has landed sends a `heartbeat` on it and asserts it received nothing
1714
- but the answers to its own requests. The barrier is what makes the silence
1715
- mean something: both spines queue a fan-out to every recipient in one pass
1716
- with no await in it, and neither writes a response ahead of a notification
1717
- already queued for the same connection — the TS transport sends both through
1718
- one outbound queue, and the Rust loop writes a connection's queued frames
1719
- before a response (`flush_queued_frames`). So a frame the pass addressed to
1720
- the bystander reaches it ahead of the barrier's response. That is strict on TS,
1721
- which sends a fan-out in one synchronous closure. On Rust, `deliver_all` pushes
1722
- to recipients one after another on one worker while the target's connection
1723
- loop runs on another, so the target's frame can be written while the pass is
1724
- still pushing — a window the barrier's round trip outlasts in practice. The
1725
- check covers every pass of the drain: the Rust `PostCommitEffects::drain_all`
1726
- joins effects whose notify futures push synchronously, so every pass
1727
- completes in the drain's first poll. Unlike `describe_cross_process_ws_tests` (consumer-agnostic,
1728
- `heartbeat`-only), this drives a real **domain** notification family — but one
1729
- built from spine primitives only (accounts / role-grants / offers / WS), zero
1730
- consumer domain, so it lives here and runs against any backend that wires the
1731
- standard RPC actions' `notification_sender` and registers a WS socket: fuz_app's
1732
- own spine self-tests (`testing_spine_server`, whose `connection_registry` is threaded
1733
- as the sender via `spine_rpc_endpoints({notification_sender})`; the Rust
1734
- `testing_spine_stub`, which wires it natively) and downstream twin-impl
1735
- consumers (fuz_forge's Deno + Rust backends call it as a thin invocation).
1736
- Sends queue on the post-commit drain, so `WsClient.wait_for` polls + waits
1737
- (method + predicate filter ignores unrelated frames). Accounts are seeded with
1738
- `ROLE_ADMIN` (the only admin-grantable role) so they can open an admin-gated WS
1739
- where one exists (forge) and be offered the role; harmless on the auth-only
1740
- spine. A backend whose `ws_path` is gated on `ROLE_ADMIN` declares it in
1741
- `ws_required_roles`: the revoke case then revokes the revokee's only admin
1742
- grant and expects its socket to close with `WS_CLOSE_PERMISSION_REVOKED` (the
1743
- notification may or may not land first, and is held to the flat shape when it
1744
- does), where an ungated socket expects the frame. The offer/accept fixtures are `create_pending_role_grant_offer` /
1745
- `create_active_role_grant` (`cross_backend/role_grant_cross_helpers.ts`).
1746
- Gated on `capabilities.ws`; cross-process only. fuz_app's
1747
- `role_grant_offer_notification_ws_gated.cross.test.ts` runs it again over the
1748
- spine binaries' role-gated endpoint with `ws_required_roles` declared.
1749
-
1750
- ### `cross_backend/ws_role_gated.ts` — `describe_ws_role_gated_cross_tests`
1751
-
1752
- Real-upgrade parity for a **role-gated WebSocket losing its role**: a revoked
1753
- global grant of a role an endpoint's `required_roles` lists closes the account's
1754
- sockets on that endpoint with `WS_CLOSE_PERMISSION_REVOKED` (and its reason),
1755
- while the account's ungated socket on the same connection registry stays open,
1756
- dispatching, and receiving the account's pushes, and a re-upgrade is refused at
1757
- the gate (403); a scoped revoke of a listed role closes nothing — the case
1758
- first opens the gated socket on a global grant of `scoped_role` alone, which
1759
- proves the endpoint lists it. That a closed registration is sent nothing more
1760
- is beyond what a client sees once it has read the close frame; each spine's
1761
- transport tests pin it.
1762
- `describe_ws_role_gated_cross_tests({setup_test, capabilities, base_url,
1763
- ws_path, gated_ws_path, gated_roles, scoped_role, rpc_path?})` — `gated_roles`
1764
- must hold `ROLE_ADMIN` and `scoped_role` (a role an admin can grant scoped).
1765
- fuz_app's spine binaries mount `SPINE_ROLE_GATED_WS_PATH` gated on
1766
- `SPINE_ROLE_GATED_WS_ROLES` (`admin` + `participant`). Gated on
1767
- `capabilities.ws` and `capabilities.ws_role_gated`; cross-process only.
1768
-
1769
- ### `cross_backend/rooms_ws.ts` — `describe_rooms_ws_cross_tests`
1770
-
1771
- Real-upgrade parity for the **room verbs** (`actions/room_actions.ts`) and the
1772
- notifications their registry fans out: join, leave, send, state, and watch
1773
- round trips with each event's shape and its room's `seq` in order, and an
1774
- event never reaching the seat that caused it; the refusals' codes and reasons
1775
- (`room_not_found` for a denied and a missing room alike, a malformed room id
1776
- as the input schema's reasonless `invalid_params`, `room_not_joined`,
1777
- `room_member_not_found` — a seat addressing itself included — the payload and
1778
- state bounds in UTF-8 bytes, `room_full`, `room_watch_limit`, and
1779
- `method_not_found` over HTTP); exclusivity (one seat per actor, the newest
1780
- admitted winning, the displaced seat told `room_seat_lost` with `moved_to`,
1781
- a same-connection rejoin moving its own seat) and the rejoin tombstone
1782
- (`room_seat_moved` for a moved seat, a seat released by its disconnect
1783
- rejoined); eviction through `_testing_room_evict` by scope, actor in scope,
1784
- room, and actor, ending seats and watches alike; a closed socket's seat
1785
- leaving as `disconnected`; and the per-connection limiter's `rate_limited`
1786
- (`data.retry_after`), charged by escaped bytes, with a watch and a leave
1787
- still answered past the byte budget and another socket of the account holding
1788
- its own budget.
1789
- Codes and `data.reason` are compared, not messages; the room verbs'
1790
- action-manifest entries are the manifest parity gate's.
1791
- `describe_rooms_ws_cross_tests({setup_test, capabilities, base_url, ws_path,
1792
- rpc_path?})` — runs against a backend mounting the room verbs on `ws_path` over
1793
- an exclusive registry with `test_room_authorize` (`test_room_authorize.ts`, the
1794
- twin of the Rust stub's `TestRoomAuthorize`: the room id's prefix — `open:`,
1795
- `scoped:<scope>:`, `pair:`, `watch:`, `admin:` — picks the rule, `admin:`
1796
- reading the global grant live through the request's database) and the room
1797
- limiter at `DEFAULT_ROOM_RATE_LIMIT`, which `capabilities.rooms` declares.
1798
- Gated on `capabilities.ws` and `capabilities.rooms`; a backend declaring
1799
- `rooms` declares `_testing_room_evict` too, which the eviction case drives and
1800
- `describe_spine_cross_suites` requires; cross-process only. fuz_app's spine binaries mount it all
1801
- (`full_spine_mount.ts`: `create_spine_room_registry`, the verbs on both WS
1802
- endpoints, `_testing_room_evict` on RPC, and `_testing_reset` clearing the
1803
- rooms).
1804
-
1805
- ### `cross_backend/peer_ping_ws.ts` — `describe_peer_ping_ws_tests`
1806
-
1807
- The server→client **request/response** sibling of the notification suite above —
1808
- the machinery proof for ActionPeer. `peer/ping` is `initiator: both`; the
1809
- client→server direction already exists as `heartbeat`, this exercises the new
1810
- server→client one. The observable trigger is a client invoking the `peer/ping`
1811
- **action** over its own socket: the handler initiates a `peer/ping` request back
1812
- to that socket (`ctx.request_client`), awaits the client's echo, validates it
1813
- against `PingResponse`, and returns the validated shape — so one client RPC
1814
- drives the whole round-trip and every outcome (success / `Timeout` / wrong-shape
1815
- / client-error) surfaces as that RPC's wire response. The client attaches an
1816
- `on_request` responder **at construction** (the `create_ws_transport` seam) so
1817
- the inbound server-initiated request is answered as soon as it arrives; the
1818
- security negatives use the raw `WsClient.send` to inject unsolicited /
1819
- cross-connection frames. Cases: the positive round-trip plus
1820
- unsolicited-response rejection, per-connection id isolation (a second
1821
- socket's forged reply for the first's id, then a round-trip on the second
1822
- socket as a barrier, so the first's timeout is asserted to come after the
1823
- forged reply was read — never a deadline that ran out first), never-reply
1824
- `Timeout`, wrong-shape rejection, an undeclared reply key accepted and dropped
1825
- (both spines read the reply forward-compatibly), client-error forwarding, a
1826
- malformed client error read alike on both spines (a code off the base set —
1827
- a consumer's code, a fraction — is `internal_error`, a non-string message
1828
- `'peer error'`, `error: null` neither, a present `data` kept), and the HTTP
1829
- no-transport path. Gated on `capabilities.peer_request` — `true` on
1830
- both the Rust spine and the TS spine (the `ConnectionRegistry.request_connection`
1831
- path + `register_action_ws` response correlation); `peer/ping` is a protocol
1832
- action (manifest-excluded), so parity is behavioral here, not via the manifest
1833
- gate. Cross-process only.
1834
-
1835
- ### `cross_backend/ws_inbound_dispatch.ts` — `describe_ws_inbound_dispatch_cross_tests`
1836
-
1837
- Real-upgrade parity for the two refusals a WebSocket request meets ahead of
1838
- dispatch: a request whose id names a request still running on the socket →
1839
- `invalid_request` with `data.reason: 'duplicate_request_id'`, not dispatched
1840
- (the running request answers under its id as usual, and the id frees once it
1841
- has); and past the per-socket in-flight ceiling (128 on both spines) a new
1842
- request → `queue_overflow` with its id, not dispatched, the socket left open,
1843
- the duplicate check first. Requests are held in flight with `peer/ping` — the
1844
- client's responder withholds the server's ping echo until the test releases
1845
- it — so the suite gates on `capabilities.peer_request`.
1846
- `describe_ws_inbound_dispatch_cross_tests({setup_test, capabilities, base_url,
1847
- ws_path})`. The wire literals are independent copies of the producers'
1848
- constants, so a value changed on one spine fails here. Cross-process only.
1849
-
1850
- ### `cross_backend/ws_envelope.ts` — `describe_ws_envelope_cross_tests`
1851
-
1852
- Real-upgrade parity for the WS read loop's frame envelope — the socket twin of
1853
- `rpc_adversarial`'s HTTP envelope cases. A frame that is not JSON answers
1854
- `parse_error`, a scalar or bare-string frame and a batch array each answer
1855
- `invalid_request`, all with `id: null` and the socket left open; a
1856
- notification, a stray response matching no server-initiated request, and a
1857
- `cancel` (unknown id, malformed params, or a request in flight) answer no
1858
- frame. The in-flight cancel holds a `peer/ping` with
1859
- `create_holding_peer_ping_responder` (exported from `ws_inbound_dispatch.ts`)
1860
- and pins that the request still answers under its id — neither spine's
1861
- `peer/ping` observes its signal, so the cancel's effect is a consumer seam's
1862
- to pin. Silence is asserted positively: a `heartbeat` probe after the frames,
1863
- and nothing but its response after the mark. Gated on `capabilities.ws`, the
1864
- in-flight cancel also on `capabilities.peer_request`.
1865
- `describe_ws_envelope_cross_tests({setup_test, capabilities, base_url,
1866
- ws_path})`. Cross-process only.
1867
-
1868
- ### `cross_backend/ws_outbound_overflow.ts` — `describe_ws_outbound_overflow_cross_tests`
1869
-
1870
- Real-upgrade parity for the **per-connection outbound bound** — the byte
1871
- budget both spines hold a WebSocket's waiting frames to
1872
- (`ConnectionRegistry`'s `outbound_queue_bytes`, the Rust `fuz_realtime`
1873
- outbound queue; same default, same per-frame charge). The close code and its
1874
- reason are wire contract — a client reads `WS_CLOSE_OUTBOUND_OVERFLOW` as "you
1875
- fell behind, reconnect" — so this is the pin that runs on both.
1876
- `describe_ws_outbound_overflow_cross_tests({setup_test, capabilities, base_url,
1877
- ws_path, origin?, rpc_path?})` drives `_testing_flood_notifications`, which
1878
- queues a burst onto the caller's own connection in one synchronous run, so the
1879
- burst waits at once whether or not the client reads and the overflow is
1880
- deterministic. Cases: a burst within the budget arrives whole and in order
1881
- ahead of its response, the socket left open — a small one, and one of a few
1882
- mebibytes in megabyte frames, most of the default budget, which waits on the backend's write pump where megabyte frames outrun the socket's buffer (Node and Bun write the burst through, as observed); a burst far past it closes the
1883
- socket with the code and the exact reason, no response for the flooding request
1884
- arrives, and any flood frames that did arrive are a contiguous prefix of the
1885
- burst — while a second connection on the same account keeps dispatching; a
1886
- burst past the action's own size limit is refused `invalid_params` with the
1887
- socket left open; and, with `rpc_path`, the action over HTTP refuses
1888
- `invalid_params` with reason `no_connection`. Not asserted, because each
1889
- implementation decides them: how many frames accepted before the overflow
1890
- reach the client, and the boundary a burst of tiny frames overflows at. The
1891
- flood action is daemon-token-gated, so the flooding socket upgrades with the
1892
- daemon token and no `Origin` (`create_ws_transport`'s `origin: null`). The wire
1893
- literals are independent copies of the producers' constants. Gated on
1894
- `capabilities.ws`; cross-process only, and only for a backend that mounts the
1895
- flood action on its WS endpoint.
1896
-
1897
- ### `cross_backend/ws_connection_cap.ts` — `describe_ws_connection_cap_cross_tests`
1898
-
1899
- Real-upgrade parity for the **per-account WebSocket connection cap** — the
1900
- evict-oldest policy both spines apply (`ConnectionRegistry`'s
1901
- `max_connections_per_account`, the Rust `fuz_realtime` `ConnectionRegistry`).
1902
- The close code, its reason, and which socket closes are wire contract — a
1903
- client reads `WS_CLOSE_CONNECTION_LIMIT` as "superseded, don't reconnect" — so
1904
- this is the pin that runs on both.
1905
- `describe_ws_connection_cap_cross_tests({setup_test, capabilities, base_url,
1906
- ws_path, origin?, max_connections_per_account?})` opens every socket with the
1907
- fresh-per-test keeper's session cookies (one account), each answering a
1908
- `heartbeat` before the next opens (`create_admitted_ws_transport`) so the
1909
- backend registered them in order and
1910
- "oldest" names the same socket on both spines. Cases: one connection past the
1911
- cap closes exactly the oldest with `WS_CLOSE_CONNECTION_LIMIT` +
1912
- `WS_CLOSE_CONNECTION_LIMIT_REASON` while every other socket, the newest included, keeps
1913
- dispatching — and the session then upgrades again (a revoked session couldn't),
1914
- superseding the next-oldest; and a socket held open while a cap's worth of
1915
- others open and close in sequence is never evicted (a backend that leaks closed
1916
- connections in its registry counts them toward the cap, which is what this
1917
- catches). `max_connections_per_account` defaults to
1918
- `DEFAULT_MAX_CONNECTIONS_PER_ACCOUNT`, the cap both spines apply unless
1919
- overridden; pass the consumer's value when it sets one, `null` (cap disabled)
1920
- to skip. **Consumer-agnostic** like the WS round-trip suite (`heartbeat` only).
1921
- A separate call rather than more cases on that suite because each case opens
1922
- more than a cap's worth of real sockets. Gated on `capabilities.ws`;
1923
- cross-process only.
1924
-
1925
- ### `cross_backend/session_cap.ts` — `describe_session_cap_cross_tests`
1926
-
1927
- Parity for the per-account session cap over real HTTP: logging in past
1928
- `max_sessions` (default `DEFAULT_MAX_SESSIONS`) never refuses a login and
1929
- evicts the oldest session, and `account_session_list` marks each login's own
1930
- session `is_current` (none for a bearer or daemon-token caller, even with a
1931
- session cookie beside the daemon token).
1932
- `describe_session_cap_cross_tests({setup_test, max_sessions?, login_path?,
1933
- status_path?, rpc_path?, ws?, ws_account_actions?, ws_account_roles?})` —
1934
- pass `ws` (`{base_url, ws_path, origin?}`) to also assert that the evicted
1935
- session's socket is closed with `WS_CLOSE_SESSION_REVOKED` once the evicting
1936
- login commits; omitted, that case is skipped, so a caller passes it only for
1937
- a backend with `capabilities.ws`. `ws_account_actions`
1938
- (`capabilities.ws_account_actions`) also lists the sessions over a login's
1939
- socket and asserts its own row is the one current; `ws_account_roles` gives
1940
- the socket accounts' roles, for a backend whose WS upgrade requires one.
1941
- Cross-process only.
1942
-
1943
- ### `cross_backend/sse_round_trip.ts` — `describe_cross_process_sse_tests`
1944
-
1945
- Cross-process counterpart to the in-process `sse_round_trip.ts` harness —
1946
- opens a **real** streaming `fetch` against a spawned backend's audit-log SSE
1947
- endpoint via `create_sse_transport` (built-in `fetch` + `TextDecoder`, no
1948
- dep), threading the fresh-per-test keeper's session cookie. Kept a separate
1949
- call (not folded into `describe_standard_cross_process_tests`) for the same
1950
- reason the WS suite is — it needs raw `base_url` / `sse_path` the standard
1951
- bundle doesn't carry. The cases mirror the in-process audit-log self-test:
1952
- the stream emits the `: connected` comment; a minted secondary's sessions are
1953
- revoked over the keeper's admin channel (`admin_session_revoke_all`),
1954
- broadcasting one `session_revoke_all` audit `data:` frame **without** closing
1955
- the keeper's stream (target ≠ subscriber — secondary minted before the stream
1956
- opens so its `create_account` audit events stay off it); the subscriber's
1957
- _own_ sessions are revoked, all of them (`account_session_revoke_all`, the
1958
- account-wide close) and then just the one (`account_session_revoke`, the
1959
- session-scoped close), each dropping the live stream (asserted via
1960
- `SseTransport.wait_for_close`); the keeper soft-deletes a second admin whose
1961
- stream is open (`account_delete`, also gated on
1962
- `capabilities.account_lifecycle`), dropping it; `admin_token_revoke_all`,
1963
- `POST /logout` (`logout_path`), `POST /password` (`password_path`) and
1964
- `account_purge` (also gated on `capabilities.account_lifecycle`) of a second
1965
- admin each drop its stream — the rows `create_account_revocations`
1966
- (`cross_backend/revocation_drivers.ts`) shares with the WS suite; and one stream past the per-session cap
1967
- (`max_per_scope`, default `AUDIT_LOG_SSE_MAX_PER_SCOPE`; `null` skips) on one
1968
- session closes the oldest and leaves the rest open. The data-frame + close
1969
- cases gate on `rpc_path` (they drive the standard account/admin actions); all
1970
- cases gate on `capabilities.sse`. Cross-process only — wire from a
1971
- `*.cross.test.ts`. It runs on every fuz_app backend — the
1972
- TS spines wire `audit_log_sse` and the Rust `spine_stub` serves the same
1973
- stream.
1974
-
1975
- ### `cross_backend/revocation_drivers.ts` — shared revocation drivers
1976
-
1977
- The account-wide revocations both transport suites close a live connection on,
1978
- as one table: `create_account_revocations({capabilities, rpc_path,
1979
- logout_path, password_path})` → `AccountRevocation` rows (`{label, slug,
1980
- gate, revoke(fixture, target)}`) for `admin_token_revoke_all`, `POST /logout`,
1981
- `POST /password`, and `account_purge` (`gate` reads
1982
- `capabilities.account_lifecycle`). `revoke` asserts the revocation succeeded;
1983
- the target must hold `DEFAULT_TEST_PASSWORD`. A revocation added here is
1984
- covered on WS and SSE at once. The drivers stand alone too: `cross_post_as`
1985
- (a JSON `POST` on an account's session, asserting 200),
1986
- `cross_admin_token_revoke_all`, and `cross_account_purge` (over the daemon
1987
- token, no `Origin`).
1988
-
1989
- ### `cross_backend/cell_crud.ts` + `cell_relations.ts` + `cell_gated_create.ts` + `cell_moderate.ts` — cell parity suites
1990
-
1991
- The cell-layer parity coverage is split across two sibling suites. Cells
1992
- can't ride the generic `describe_rpc_round_trip_tests` (stateful verbs need a
1993
- real id threaded across calls; `cell_get` has a top-level `check`), so —
1994
- like ws/sse — the full cell surface **live-mounts** on the spine RPC path but
1995
- stays **off** `create_spine_surface_spec`, and these dedicated suites are the
1996
- cell validators (`describe_standard_cross_process_tests`' generic round-trip
1997
- never sees them). Both parse every success response against the verb's
1998
- **output** schema, so a TS↔Rust envelope drift fails the suite — not just a
1999
- payload-field drift. Call-site primitives (`cross_rpc_call` / `error_reason` /
2000
- `expect_output`) live in `cross_backend/cross_rpc.ts`, shared by every
2001
- stateful cross suite (`RpcResult` carries the HTTP `status` beside the
2002
- envelope; a reply that is no JSON object throws naming the method,
2003
- the HTTP status and the body's head), and every
2004
- suite that reads audit rows goes through `cross_backend/audit_cross_helpers.ts`
2005
- — `list_audit_events(fixture, params, rpc_path?)` drains
2006
- (`cross_drain_effects`, the `_testing_drain_effects` barrier, refusing an answer
2007
- without `tracked: true`) before it lists and parses, so no reader skips the
2008
- barrier and every read checks the barrier is live, and parses every row's metadata
2009
- (`assert_audit_event_metadata`, closed to undeclared keys when the fixture's
2010
- setup asked), so every reader holds the rows it reads to their event's
2011
- schema. A suite pinning a row's values uses `assert_audit_metadata_fields(fixture,
2012
- metadata, expected, absent?)` — each field compared on its own so a consumer's
2013
- added key passes, the `absent` keys refused, and the whole object compared only
2014
- when the fixture closed the world; the shared
2015
- options shape is `RpcPathCapabilityGatedCrossSuiteOptions` from
2016
- `cross_backend/setup.ts`. `cross_backend/wire_shapes.ts` carries
2017
- `assert_iso8601_seconds` / `assert_iso8601_seconds_nullable` — the byte-level
2018
- gate on the canonical second-precision UTC timestamp shape, which a
2019
- `string` output schema can't catch (a millisecond stamp parses fine).
2020
- The shared suites pin it on the account-status account + role grants, a
2021
- session, a minted + listed API token, a cell's `created_at` / `updated_at`,
2022
- an audit row, an admin account listing, and an offer's `created_at` /
2023
- `expires_at`. `cross_backend/setup.ts` carries the four bases every
2024
- imperative cross suite aliases: `CrossSuiteOptions` (`setup_test` alone),
2025
- `CapabilityGatedCrossSuiteOptions` (+ `capabilities` — `ready`),
2026
- `RpcPathCrossSuiteOptions` (+ `rpc_path?` — origin, body-size (which adds `base_url`), actor
2027
- lookup, app settings), and the intersection
2028
- `RpcPathCapabilityGatedCrossSuiteOptions` (every `cell_*` suite, query-shape,
2029
- token-scope surface, fact-serving, account lifecycle, testing backdoor). A suite takes the
2030
- capability-carrying variant only when it actually gates cases on a flag, so
2031
- the option type states whether the bundle is read.
2032
-
2033
- - **`describe_cell_crud_cross_tests`** (gates on `capabilities.cell_crud`) —
2034
- the create → get → update → delete → list lifecycle threading the id, plus
2035
- the CRUD authz matrix (owner CRUD; anon-public-only / private-404; non-owner
2036
- edit/read/delete → 404 IDOR mask; admin reaches any; dup active `path` → 409;
2037
- `path` write by non-admin → 403 on create + update; `cell_get` with no
2038
- id/path → `invalid_params`; null-auth `cell_list` `created_by` →
2039
- `invalid_params`; a `kind` at `CELL_KIND_LENGTH_MAX` stored whole, one
2040
- UTF-16 code unit past it → `invalid_params` on create and as a list filter;
2041
- `cell_list` pages honoring `limit` + `offset`, a page holding visible rows
2042
- only and filling to `limit` past a newer run of rows the caller can't see —
2043
- two owners' private cells, read by a non-owner and by anon — and an admin's
2044
- pages tiling every row; a `data` that is no `CellData` — a non-object, or a
2045
- non-string `label` / `summary` — refused 400 `invalid_params` with the
2046
- generic message and no reason (no `data` beyond a TS spine's DEV-only
2047
- `issues`, an array of `WireIssue`s) on `cell_create`, on `cell_update` of a
2048
- missing and of a hidden cell, and, with `cell_relations`, on `cell_clone`'s
2049
- `with_data_patch` — ahead of the 404 mask the same hidden-cell call answers
2050
- when well-typed, with the keeper's cell count unchanged; those cases run as
2051
- the keeper and plain accounts only, so a backend that refuses a non-admin
2052
- root cell can keep them through `exclude_cases` while excluding the rest).
2053
- - **`describe_cell_relations_cross_tests`** (gates on
2054
- `capabilities.cell_relations`) — the verbs beyond CRUD: grant lifecycle
2055
- (actor-shaped editor grant enables edit, manage-tier `cell_grant_list`,
2056
- revoke), the now-reachable `cell_visibility_manage_only` 403 (editor-grant
2057
- holder can't flip visibility), field set / forward+reverse list / idempotent
2058
- delete, item insert / ordered forward+reverse list / move / idempotent
2059
- delete, an insert or move onto a taken position → `cell_item_position_taken`
2060
- with the rows unchanged, clone shallow (shares edges) vs deep (clones children), and
2061
- manage-tier `cell_audit_list` (owner reads the timeline; a viewer-grant
2062
- holder who can `cell_get` still gets the IDOR 404). Only **actor-shaped**
2063
- grants are exercised — role-shaped principals need a closed role registry the
2064
- Rust spine deliberately lacks.
2065
- - **`describe_cell_gated_create_cross_tests`** (`cell_gated_create.ts`) +
2066
- **`describe_cell_moderate_cross_tests`** (`cell_moderate.ts`)
2067
- (gate on `capabilities.cell_gated_create`, **cross-only**; both build their
2068
- spaces on `TEST_SPACE_POLICY`, exported beside the authorizer in
2069
- `test_cell_gated_create_authorize.ts`) — the parent-aware
2070
- cell-creation authorizer (`CellCreateAuthorize`, **directory model**) +
2071
- the `cell_moderate` verb parity proofs. Both spines mount the same
2072
- `test_cell_gated_create_authorize` policy (its admin bypass and `min_role`
2073
- read the **global** grant): a `kind: 'space'` **root** is
2074
- admin-only (a non-admin → **403** `cell_create_forbidden`, and the same for a
2075
- non-admin `cell_clone` of a viewable space — clone runs the authorizer for
2076
- every cell it writes); a **contribution**
2077
- under a space is gated by the root's `policy[kind] = {min_role,
2078
- moderation_required}` (the root's manage-tier `policy` column), with
2079
- `moderation` set per the verdict (`pending`+private vs
2080
- `approved`+author-visibility); a **hidden** parent **404**-masks vs a
2081
- **visible** one **403**s; plain parentless creates stay open. The root policy
2082
- itself: `cell_policy_set` writes it (audited old and new), answers an
2083
- editor-grant holder 403 `cell_policy_manage_only` and a non-viewer the 404,
2084
- refuses a contribution `cell_policy_root_only`, and runs each policy through
2085
- the authorizer's `validate_policy` (`cell_policy_invalid`); an editor
2086
- rewriting the root's `data.policy` leaves moderation as the column says. The moderate
2087
- suite then proves the `pending → approved | rejected` transition and the
2088
- `approved → rejected` takedown: an admin (root manager) approves → public,
2089
- the **author** self-approve → 403 (anti-self-approval), a non-viewer → 404, reject → stays private, and a cell
2090
- with no governing root → 400 `cell_not_a_contribution` for any viewer, the
2091
- 404 mask first for a non-viewer; approval needs a pending post and rejection
2092
- a pending or approved one (the takedown), else 400 `cell_not_pending` — so a
2093
- root owner shown a private born-approved contribution can't publish it. It also
2094
- pins the moderation read gate (a pending or rejected post reaches no
2095
- non-steward reader past its author and admins on `cell_get`, `cell_list`,
2096
- `cell_item_list`, and fact serving, even flipped public or granted while
2097
- approved), `cell_grant_create`'s
2098
- 403 `cell_grant_unapproved`, and the steward arm (a non-admin root owner — a
2099
- non-`space` root the policy leaves open — reads the queue, `cell_get`, and
2100
- the fact, and moderates, but still 404s on clone and create-under). The
2101
- authorizer _behavior_ adds no method/wire shape, so schema + manifest parity
2102
- are **blind** to a divergence — these are the only gates that catch one (the
2103
- `cell_moderate` verb itself is manifest-covered). In-process hook coverage is
2104
- the standalone `auth/cell_create_authorize.db.test.ts` (these cross suites skip
2105
- in-process, where the default app mounts no authorizer).
2106
-
2107
- `cell_crud` / `cell_relations` gate `true` on TS + Rust (cells run on both, no
2108
- `.skip`); `cell_gated_create` is cross-only (the policy is a spine-binary
2109
- fixture). The in-process legs (plain `gro test`) for crud/relations
2110
- are `src/test/auth/cell_crud_parity.db.test.ts`
2111
-
2112
- - `cell_relations_parity.db.test.ts`, sharing the full-surface
2113
- `create_cell_parity_setup` (`cell_parity_helpers.ts`) which mounts every cell
2114
- verb and registers `cell_audit_events` through the audit factory.
1669
+ (cross-process) with the same case array. Two checks the table can't express
1670
+ ride beside it in fuz_app's wiring, on both legs: the duplicate-invite refusal
1671
+ (two requests, `describe_invite_duplicate_tests`) and the offer reads'
1672
+ cross-account refusal being identical for a real id and the nil id
1673
+ (`describe_offer_cross_account_tests` — the existing id is known only to the
1674
+ fixture). fuz_app's own case files and wiring are
1675
+ `src/test/cross_backend/conformance.{db,cross}.test.ts` and the
1676
+ `conformance_*_cases.ts` beside them.
1677
+
1678
+ ### Suite modules
1679
+
1680
+ Each `SUITE_NAMES` module in `cross_backend/` exports one
1681
+ `describe_<module>_cross_tests(options)`. The exceptions are `standard`
1682
+ (`describe_standard_cross_process_tests`), `ws_round_trip`
1683
+ (`describe_cross_process_ws_tests`), `sse_round_trip`
1684
+ (`describe_cross_process_sse_tests`), `peer_ping_ws`
1685
+ (`describe_peer_ping_ws_tests`) and `role_grant_offer_notification_ws`
1686
+ (`describe_role_grant_offer_notification_ws_tests`).
1687
+
1688
+ A suite's contract is its module's TSDoc — the cases and why each is
1689
+ imperative or a table row on the module or the `describe_*` function, the
1690
+ options on its options interface. `describe_spine_cross_suites` derives each
1691
+ suite's options from the handle and the inputs §`cross_backend/spine_suites.ts`
1692
+ lists; a suite called on its own starts from `to_cross_suite_options(handle)`.
1693
+
1694
+ One row per suite. "Gate" is the capability flags the suite's cases read
1695
+ (`BackendCapabilities`), or the `_testing_*` backdoor a suite skips itself
1696
+ without.
1697
+
1698
+ | suite | pins | gate |
1699
+ | --- | --- | --- |
1700
+ | `account_lifecycle` | soft delete → undelete, keeper-confirmed purge, the `cannot_delete_keeper` guard, session-only self-delete, a deleted account's credentials refused — and still refused after the undelete, a fresh login working; role grants kept through the delete and conferring again after the undelete, offers made to the account staying superseded, its unclaimed invites void (a claimed one untouched) — each audit row, the `include_deleted` listing; and, ungated, a password change ending every session and API token of the account while another account's stay live | `account_lifecycle` (all but the password case) |
1701
+ | `actor_lookup` | the keeper resolves its own actor in the leak-safe wire shape (the refusals are table rows) | — |
1702
+ | `app_settings` | an anonymous signup reads `open_signup` fresh after `app_settings_update` | — |
1703
+ | `body_size` | the 1 MiB body cap: cap+1 → 413 `payload_too_large`, exactly the cap not size-rejected, an over-cap chunked body → 413, no upload racing the close | — |
1704
+ | `body_size_smuggling` | raw socket: an oversized `POST` + a pipelined `GET` → at most one response; `Content-Length` beside `Transfer-Encoding` → close (Bun 1.4.3 is the tested floor) | — |
1705
+ | `cell_crud` | the CRUD lifecycle + authz matrix, each response parsed against its output schema, `cell_list` paging past hidden rows, mistyped `data` | `cell_crud` (clone cases also `cell_relations`) |
1706
+ | `cell_gated_create` | the parent-aware `CellCreateAuthorize`: admin-only `space` root, contributions gated by the root's `policy[kind]`, 404 on a hidden parent vs 403 on a visible one, `cell_policy_set` | `cell_gated_create` |
1707
+ | `cell_grant_role` | role-shaped `cell_grant`: holder admitted, non-holder excluded, unregistered role refused, the `cell_list shared_with:'me'` role arm | `cell_relations` |
1708
+ | `cell_grant_steward` | a scoped `participant` grant's holder revokes a role grant bound to its scope, audited `steward: true`; any other holder gets the 404 mask | `cell_relations` + `cell_gated_create` |
1709
+ | `cell_moderate` | the `cell_moderate` transitions and their refusals, the moderation read gate on every read path, the steward arm, `cell_clone` running the authorizer per cell | `cell_gated_create` (fact cases also `fact_serving`) |
1710
+ | `cell_ref_admission` | possession-gated fact refs: one refusal for stored and unstored hashes, holders by upload, clones per row, the admin bypass, the ref grammar | `fact_serving` (grant, item, clone cases also `cell_relations`) |
1711
+ | `cell_relations` | grant / field / item / clone / audit verbs, the relation-read visibility filter (a child the reader can't view is absent, never an edge), a clone dropping children its cloner can't view | `cell_relations` |
1712
+ | `cookie_attributes` | the session `Set-Cookie`: `HttpOnly; Secure; SameSite=Strict; Path=/` + `Max-Age` on login, none on a failed login, `Max-Age=0` with the same flags on logout | — |
1713
+ | `credential_deadline` | a socket on a session or an API token closes with `WS_CLOSE_SESSION_REVOKED` "Credential expired" at its credential's expiry; an audit stream on a session ends there | `ws`, `sse`; `_testing_shorten_credential_expiry` |
1714
+ | `credential_conformance` | every row of `credential_conformance.json` through `_testing_credential_read`: how the backend reads the session cookie, the bearer and the daemon token out of a request's header lines, and the lines it refuses as no header lines | `_testing_credential_read` |
1715
+ | `credential_conformance_wire` | raw socket: each row's header lines sent as an RPC `POST` and as a WebSocket upgrade — which credential authenticated (the account `account_verify` answers) and the exact clearing `Set-Cookie`, or none; the clear's scope, its order ahead of a login's new cookie, and a minted cookie authenticating as sent | `ws` (the upgrade leg; with `ws_account_actions` an accepted upgrade also answers `account_verify` on the socket, naming the credential) |
1716
+ | `request_header_conformance_wire` | raw socket: each row of `request_header_conformance.json` sent as an RPC `POST` and as a WebSocket upgrade — an empty, repeated or off-grammar `Origin`, `Host` or `Content-Type` refused with its code, any `Origin` or `Referer` line discarding a bearer or daemon token, the gates' order; the accounts and raw sends shared with the credential wire suite (`credential_wire.ts`). Assumes the backend's own origin allowed (`overrides` names another) | `ws` (the upgrade leg), `ws_refusal_body`, `ws_upgrade_runtime_refusals` (per row), `host_gate` (the rows the host gate refuses) |
1717
+ | `request_target_conformance_wire` | raw socket: each `wire` row of `request_target_conformance.json` sent as written — an escape that doesn't decode refused in each surface's shape (the RPC `GET`'s `invalid_request` envelope, 400 `invalid_query_params` on a REST query and the WS upgrade, 400 `invalid_route_params` on a path param, always JSON), the decodable controls echoed exactly, a route that reads no query refusing nothing in it; and the routing rows — a method a routed path doesn't serve → 405 with `Allow` (compared as a set, absent on a gate's refusal) and `method_not_allowed`, an unmatched path → `route_not_found` under `/api/` and the plain-text 404 elsewhere, an encoded or doubled-slash spelling of a routed path unrouted, dot segments per `runtime_resolves_dot_segments`. A row's `requires` is a list of capabilities and each requirement set is its own test, skipped when the backend doesn't declare it | `ws`, `sse`, `account_status`, `fact_serving`, `fact_serving_admin_hash`, `spine_fallback` (per row), `ws_refusal_body`, `runtime_resolves_dot_segments` |
1718
+ | `credential_header_robustness` | raw socket: an oversized or control-character credential header never escalates, smuggles a request, desyncs, or wedges the server (a duplicated one is `credential_conformance_wire`'s) | — |
1719
+ | `fact_serving` | `GET /api/cells/:cell_id/facts/:hash` per reference, the hardening headers, bodyless masked 404s; the admin-only `GET /api/facts/:hash` | `fact_serving` (bare-hash cases also `fact_serving_admin_hash`) |
1720
+ | `identity_parity` | `Username` / `UsernameProvided` / `Email` end to end: login canonicalization, username-or-email login, login input validation, ASCII-only creation, the `USERNAME_LENGTH_MIN`..`USERNAME_LENGTH_MAX` edges, email format — each by error reason | — |
1721
+ | `origin` | an absent `Origin` on `/api` passes (the foreign-`Origin` 403 is `transport_composition`'s) | — |
1722
+ | `origin_conformance` | every row of `origin_conformance.json` (allowlist parse, host, and match rows) through `_testing_origin_check` | `_testing_origin_check` |
1723
+ | `origin_scope` | the origin check off `/api`: a foreign `Origin` on `GET /ready` → 403 | `ready` (the `/ready` rows; the unrouted-path rows are ungated) |
1724
+ | `peer_ping_ws` | the server→client `peer/ping` round trip and its negatives (unsolicited response, id isolation, timeout, wrong shape, client error, no transport over HTTP) | `peer_request` |
1725
+ | `query_shape` | duplicate-key, unknown-key, and phase-order query semantics on the status route, the RPC `GET`, and the bare-hash fact route | `account_status`, `fact_serving_admin_hash` (per case) |
1726
+ | `ready` | anonymous `GET /ready` → `200 {ready: true}` over the committed `expected_schema.json` | `ready` |
1727
+ | `role_grant_offer_enumeration` | `role_grant_offer_accept`'s deliberate split: a nonexistent offer → 404 `role_grant_offer_not_found`, a sibling actor's on the caller's own account → 403 `role_grant_offer_actor_mismatch` | — |
1728
+ | `role_grant_offer_lifecycle` | a decline or retract by a non-party → 404 identical to a missing offer; of a decided offer → 400 `role_grant_offer_terminal`; an accept after a decline or a retract the same, granting nothing, and a replayed accept answering the first grant; one audit row per success, none per refusal; lost grantor authority supersedes pending offers; a recipient's delete supersedes every pending offer to it, and an offer to a deleted account or actor answers as one to a missing one | — |
1729
+ | `role_grant_offer_notification_ws` | each offer and role-grant notification strict-parsed against its params schema, with a bystander socket that must receive nothing behind a `heartbeat` barrier | `ws` |
1730
+ | `role_grant_participation` | the success paths of app-role conferral: assign + idempotency, a scoped assign, offer → accept, offer replay | — |
1731
+ | `role_grant_role_grammar` | an off-grammar `role` or scope kind on the grant verbs → `invalid_params` with no reason and no audit row | — |
1732
+ | `rooms_ws` | the room verbs and their notifications in `seq` order, the refusals' codes and reasons, exclusivity, eviction, disconnect, the per-connection limiter | `ws` + `rooms` |
1733
+ | `rpc_adversarial` | malformed envelopes and generated invalid params sent as a principal the method admits: status, code, echoed `id`, `data.reason` | — |
1734
+ | `session_cap` | a login past the per-account session cap evicts the oldest session and only it, closing its socket with the revoked reason while a kept session's socket stays open; the session list marks the caller's own | — (the socket case runs when given a `ws` target) |
1735
+ | `session_cookie_codec` | exactly one accepted spelling of a signed cookie: non-canonical signature or `expires_at` spellings refused | — |
1736
+ | `simple_request` | an untyped, CORS-safelisted, or non-JSON `POST` to a JSON route → 415 `unsupported_content_type` | — |
1737
+ | `sse_round_trip` | the audit stream: connect, a data frame, a close on each revocation of a stream proven admitted, a session-scoped revoke leaving a sibling session's stream open, the per-session stream cap | `sse` (delete and purge also `account_lifecycle`) |
1738
+ | `standard` | the `describe_standard_cross_process_tests` bundle: integration, admin, round trip, RPC round trip, data exposure | `account_status` (the status wire-shape case) |
1739
+ | `testing_backdoor` | the backdoor declaration, and every declared `_testing_*` action refusing anonymous, session, and bearer callers | `testing_backdoors` (the declaration) |
1740
+ | `token_lifetime` | the API token `lifetime` round trip: ttl mint → `expires_at` on create and list, an eternal control, bad lifetimes → 400, a bearer beside a winning daemon token or a winning session never touched, the request acting as the winner's account; an invalid daemon token falls through to the bearer beside it | — |
1741
+ | `token_scope_surface` | the `surface:<name>` half of token scoping: a narrowed bearer refused the audit stream and the bare-hash fact read, anonymous on the status read; scope outranks role | `sse`, `fact_serving_admin_hash`, `account_status` (per case) |
1742
+ | `transport_composition` | the front-door table over REST, RPC `POST` and `GET`, the WS upgrade, and the audit stream: foreign `Origin` → 403, over-cap length → 413, no credential → 401, a narrowed bearer → each surface's denial | `ws`, `sse`, `ws_refusal_body` (per row) |
1743
+ | `ws_connection_cap` | one socket past the per-account cap closes the oldest with `WS_CLOSE_CONNECTION_LIMIT` and nothing else; a closed connection frees its slot | `ws` |
1744
+ | `ws_envelope` | a parse error, a non-object frame, and a batch answered with `id: null`; a notification, a stray response, and `cancel` answered with silence | `ws` (in-flight `cancel` also `peer_request`) |
1745
+ | `ws_inbound_dispatch` | a reused live id → `duplicate_request_id`; one past the per-socket in-flight ceiling → `queue_overflow`, socket left open | `peer_request` |
1746
+ | `ws_outbound_overflow` | a burst within the outbound budget arrives whole and in order; one past it closes with `WS_CLOSE_OUTBOUND_OVERFLOW` while the account's other connection keeps dispatching | `ws`; `_testing_flood_notifications` |
1747
+ | `ws_role_gated` | a revoked global grant of a gating role closes the gated socket with `WS_CLOSE_PERMISSION_REVOKED`, leaves the ungated one open, and refuses a re-upgrade; a scoped revoke closes nothing | `ws` + `ws_role_gated` |
1748
+ | `ws_round_trip` | the real upgrade: `heartbeat`, frames sent at open and with the handshake, the message-size close, an anonymous upgrade refused 401 and a foreign-origin one with a valid session refused 403, a close on each revocation, a self-revoking socket, a WS mutation's audit row | `ws` (cases also `ws_handshake_pipelining`, `ws_account_actions`, `account_lifecycle`, `ws_refusal_body`) |
1749
+
1750
+ What the suites share:
1751
+
1752
+ - **Option bases** (`cross_backend/setup.ts`) — `CrossSuiteOptions`
1753
+ (`setup_test` alone), `CapabilityGatedCrossSuiteOptions` (+ `capabilities`),
1754
+ `RpcPathCrossSuiteOptions` (+ `rpc_path?`), and their intersection
1755
+ `RpcPathCapabilityGatedCrossSuiteOptions`. A suite takes a
1756
+ capability-carrying base only when it gates a case on a flag, so the option
1757
+ type states whether the bundle is read.
1758
+ - **`cross_backend/cross_rpc.ts`** — `cross_rpc_call` / `error_reason` /
1759
+ `expect_output`, the call-site primitives most stateful suites use.
1760
+ `RpcResult` carries the HTTP `status` beside the envelope; a reply that is no
1761
+ JSON object throws naming the method, the status and the body's head.
1762
+ - **`cross_backend/audit_cross_helpers.ts`** — `list_audit_events(fixture,
1763
+ params, rpc_path?)` drains first (`cross_drain_effects`, which refuses an
1764
+ answer without `tracked: true`), then lists and parses every row's metadata
1765
+ (`assert_audit_event_metadata`), so no reader skips the barrier.
1766
+ `assert_audit_metadata_fields(fixture, metadata, expected, absent?)` compares
1767
+ field by field, so a consumer's added key passes unless the fixture closed
1768
+ the world.
1769
+ - **`cross_backend/wire_shapes.ts`** — `assert_iso8601_seconds` /
1770
+ `assert_iso8601_seconds_nullable`, the byte-level check on the
1771
+ second-precision UTC shape, which the `Timestamp` schema alone doesn't hold
1772
+ a response to (a millisecond stamp parses).
1773
+ - **`cross_backend/revocation_drivers.ts`** — `create_account_revocations(...)`
1774
+ → `AccountRevocation` rows, the account-wide revocations the WS and SSE
1775
+ suites each close a live connection on, so a row added there is covered on
1776
+ both. The drivers stand alone too (`cross_post_as`,
1777
+ `cross_admin_token_revoke_all`, `cross_account_purge`).
1778
+ - **`cross_backend/ws_endpoint.ts`** — `WsEndpointTarget` and
1779
+ `open_session_ws` (see §Cross-process plumbing), and
1780
+ `assert_ws_upgrade_refused(open, status)`, which holds a refused upgrade to
1781
+ its HTTP status and returns the refusal for a body check. A suite that waits for a
1782
+ push or needs connections registered in a known order opens an admitted
1783
+ socket, and a silence is asserted behind a `heartbeat` round trip where the
1784
+ suite has one to send (`ws_role_gated`'s stays-open check is a bounded
1785
+ wait).
1786
+ - **`cross_backend/session_login.ts`** — `login_fresh_session(fixture,
1787
+ options)` logs an account in on a fresh transport, so its jar holds exactly
1788
+ that session's cookie.
1789
+ - **`cross_backend/role_grant_cross_helpers.ts`** —
1790
+ `create_pending_role_grant_offer` / `create_active_role_grant`, the offer and
1791
+ accept fixtures.
1792
+ - **`cross_backend/narrowed_api_token.ts`** — `mint_narrowed_api_token(...)`
1793
+ mints a method-scoped API token through the production `account_token_create`
1794
+ path; shared by the front-door table, the token-scope surface and
1795
+ fact-serving suites, and the conformance table's `scoped_token` principal.
1796
+ - **`cross_backend/fact_serving.ts`'s `cross_put_fact`** — seeds a fact through
1797
+ `_testing_put_fact`, with its optional `holder`.
1798
+ - **`cross_backend/ws_inbound_dispatch.ts`'s
1799
+ `create_holding_peer_ping_responder`** — holds a request in flight by
1800
+ withholding the `peer/ping` echo until released.
1801
+ - **Test policies** — `cross_backend/test_cell_gated_create_authorize.ts` (with
1802
+ `TEST_SPACE_POLICY`), `cross_backend/test_cell_grant_steward_revoke_authorize.ts`
1803
+ and `cross_backend/test_room_authorize.ts` are the policies the reference
1804
+ spine binaries mount, each the twin of the Rust stub's. A suite gated on
1805
+ `cell_gated_create` or `rooms` assumes them, which is why those flags are
1806
+ cross-only.
1807
+ - **Shared fixtures** — `cross_backend/credential_conformance.json` is the
1808
+ statement of how both spines read the three credential headers: read rows
1809
+ (`{name, lines, read, authenticates, clears_session_cookie}` — raw header
1810
+ lines, a name repeating where a row sends one twice, each leg's reading, and
1811
+ what a request carrying them does) and refused rows (lines the action
1812
+ refuses: no header line, or past its line and line-count caps). A line is bytes, one per character, and live values are
1813
+ `{placeholders}` each leg fills from its own keyring and credentials
1814
+ (`build_credential_conformance_placeholders`). No generator: edit the JSON
1815
+ by hand and copy the file over the other copy — the parity project fails
1816
+ unless the two are byte-identical. Keep it pure ASCII and tab-indented: a
1817
+ byte above `0x7E` or a control character is written as an escape
1818
+ (`\u00a0`, `\t`), since a raw U+00A0 or U+0085 is invisible in a diff:
1819
+ `load_credential_conformance()`,
1820
+ `to_credential_conformance_checks(table, placeholders)`,
1821
+ `assert_credential_conformance(...)`. Its legs: the TS unit leg
1822
+ through the action's input schema and `run_testing_credential_read`, the Rust unit leg in `fuz_testing`
1823
+ over a byte-identical copy it embeds, `_testing_credential_read` over the
1824
+ wire, and the raw-socket suite — and fuz_app's parity project holds the two
1825
+ copies byte-equal. `cross_backend/origin_conformance.json` is the
1826
+ statement of the origin allowlist grammar and matcher (parse, host, and match
1827
+ rows; edited by hand, never generated): `load_origin_conformance()`,
1828
+ `to_origin_conformance_checks(table)`, `assert_origin_conformance(...)`, run
1829
+ over the wire through `_testing_origin_check` and by the TS unit leg through
1830
+ `run_testing_origin_check`. `cross_backend/expected_schema.json` is the
1831
+ `/ready` contract both spines read — the TS spine through
1832
+ `create_spine_ready_route_spec`, which reads `SPINE_EXPECTED_SCHEMA_URL`, the
1833
+ Rust stub through `FUZ_RUST_SPINE_STUB_EXPECTED_SCHEMA_PATH` — regenerated
1834
+ and drift-guarded by `src/test/cross_backend/spine_expected_schema.db.test.ts`
1835
+ (`UPDATE_SCHEMA_READY=1`).
1836
+
1837
+ Conventions that hold across them:
1838
+
1839
+ - The transport suites (`ws_round_trip`, `ws_connection_cap`, `sse_round_trip`)
1840
+ drive no consumer domain: the `heartbeat` protocol action, the standard
1841
+ account and admin actions, and (for `ws_round_trip`'s audit case) the
1842
+ `_testing_drain_effects` barrier.
1843
+ - Cells, facts, rooms, `/ready`, WS and SSE live-mount on the spine binaries
1844
+ and stay off the declared surface, so the declared-surface suites never see
1845
+ them. They are covered by these suites and, given `live_rpc_endpoints`, by
1846
+ `rpc_adversarial` and the conformance table.
1847
+ - Wire literals a suite compares (close codes, reasons, error codes) are
1848
+ independent copies of the producers' constants where the suite says so, so a
1849
+ value changed on one spine fails.
1850
+ - `rpc_adversarial` sends its cases as a keeper holding every role a declared
1851
+ method gates on and a single actor; a suite seeding a second actor lists the
1852
+ actor-required methods in `skip_methods`.
2115
1853
 
2116
1854
  ### Cross-process plumbing (consumed by `*.cross.test.ts` suites)
2117
1855
 
@@ -2131,7 +1869,11 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
2131
1869
  `daemon_token_dir_env` names the env var the binary reads its daemon-token
2132
1870
  directory from, set to the `{dir}` whose `{dir}/run/daemon_token` is the
2133
1871
  bootstrap's `daemon_token_path` (`to_daemon_token_dir`, which throws for a
2134
- path in another layout).
1872
+ path in another layout). It is how a test binary learns the harness root:
1873
+ the bootstrap token sits in a directory of its own
1874
+ (`{dir}/bootstrap/bootstrap_token`, so the burn probe can make that
1875
+ directory unwritable without touching the rest), and its parent is not the
1876
+ root.
2135
1877
  - `testing/cross_backend/create_cross_backend_global_setup.ts` —
2136
1878
  `create_cross_backend_global_setup({configs, derive_name?, provide_key?,
2137
1879
  ensure_databases?, before_spawn?})`, the single-backend `globalSetup` maker:
@@ -2144,6 +1886,7 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
2144
1886
  (`ensure_database_for_url`), then the spawn. A second argument
2145
1887
  (`CrossBackendGlobalSetupDeps`) swaps the database creator and the spawn,
2146
1888
  for testing the setup itself.
1889
+ - `testing/cross_backend/bootstrap_backend.ts` / `create_dual_spawn_global_setup.ts` — spawn and bootstrap one backend, or two (`provide_keys`); `before_bootstrap(config)` runs once the backend is healthy and before its keeper bootstrap, for a probe of the pre-bootstrap window, and a throw from it tears the backend down and fails the setup.
2147
1890
  - `testing/cross_backend/cargo_binary.ts` — `prepare_cargo_binary({workspace_dir,
2148
1891
  package, bin?, profile?})` builds a Cargo binary (`cargo build -p --bin
2149
1892
  --profile`, output inherited, a failed build throws) unless
@@ -2187,7 +1930,8 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
2187
1930
  satisfying `RpcTestTransport`. Carries a name-keyed cookie jar that
2188
1931
  updates on every response's `Set-Cookie` and re-sends on every request;
2189
1932
  `Origin` defaults to `base_url` (`origin: null` disables for bearer-only
2190
- paths). Exposes `cookies()` so `ws_transport` can thread the session
1933
+ paths). A cookie cleared with `Max-Age` of zero or less leaves the jar, as
1934
+ it leaves a browser's. Exposes `cookies()` so `ws_transport` can thread the session
2191
1935
  cookie onto the WS upgrade.
2192
1936
  - `testing/transports/bootstrap.ts` — stateless `bootstrap({transport, config})`
2193
1937
  POSTs `/api/account/bootstrap` against the running binary, parses the
@@ -2207,8 +1951,8 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
2207
1951
  request (`{result}` / `{error}` / `undefined` to swallow), the path
2208
1952
  `describe_peer_ping_ws_tests` drives. With no `on_request` the seam is inert
2209
1953
  (a server-initiated request flows to `messages` as before).
2210
- - `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)
2211
- builds a real-upgrade WS client using the `ws` npm package (optional
1954
+ - `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; a refused upgrade rejects with `WsUpgradeRefusedError`, carrying the refusal's `status` and `body`), returning a `WsTransportClient` — a `WsClient` plus `send_text(text)`, which writes one frame verbatim (a frame that is not JSON).
1955
+ It builds a real-upgrade WS client using the `ws` npm package (optional
2212
1956
  peerDep; consumers wiring cross-process tests `npm install --save-dev ws`).
2213
1957
  Threads the keeper cookie onto the upgrade so per-action auth succeeds on
2214
1958
  the first message. `on_request` (attached at construction, before the upgrade
@@ -2233,7 +1977,7 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
2233
1977
  as the `Origin` — through `create_admitted_ws_transport` when `admitted`,
2234
1978
  `create_ws_transport` otherwise. The cookie is the account's static one, so
2235
1979
  a session rotated through `fixture.transport` upgrades stale.
2236
- - `testing/transports/ws_raw_client.ts` — `connect_raw_ws({port, hostname?, path, headers?, pipelined?})`
1980
+ - `testing/transports/ws_raw_client.ts` — `connect_raw_ws({port, hostname?, host?, path, headers?, header_lines?, pipelined?})` (`host: null` writes no `Host` line, so the caller's `header_lines` carry their own)
2237
1981
  → `RawWsClient` (`{frames, send_text, wait_for, destroy}`), a WebSocket client
2238
1982
  over a raw `node:net` socket for the two things a client library can't do:
2239
1983
  **withhold the close frame** (it never answers one) and put frames in the
@@ -2256,7 +2000,11 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
2256
2000
  `raw_http_parse_response` (the first response, `null` until its head and
2257
2001
  framed body are whole), `raw_http_count_responses` (unanchored status-line
2258
2002
  count, so a response concatenated after a body is seen),
2259
- `raw_http_first_status`, `raw_http_header_lines` (headers as CRLF lines),
2003
+ `raw_http_first_status`, `raw_http_error_code` (a JSON refusal's `error`), `raw_http_header_lines` (headers as CRLF lines),
2004
+ `raw_http_request` (a whole request framed from an array of header lines,
2005
+ written as given, so a name can repeat), `raw_http_header_values` (every
2006
+ value of one response header, in order — the parsed response keeps only the
2007
+ last, which loses all but one `Set-Cookie`),
2260
2008
  `raw_http_parse_json` (a body's JSON, `undefined` when it isn't), and
2261
2009
  `RAW_HTTP_READ_TIMEOUT_MS`, the suites' default read window.
2262
2010
  `raw_http_send_head(base_url, {method?, path, headers, content_length,
@@ -2293,9 +2041,9 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
2293
2041
  (`assert_surface_matches_snapshot`); it is not consumed at test runtime.
2294
2042
  - `testing/cross_backend/testing_reset_actions.ts` —
2295
2043
  `create_testing_actions(deps, options)` factory returning the
2296
- `_testing_reset` RPC action. Test binaries register it on their RPC
2297
- endpoint; `default_cross_process_setup` fires it unconditionally per
2298
- test. Handler first fires the consumer-supplied `reset_state(db)`
2044
+ `_testing_*` backdoor actions, `_testing_reset` among them. Test binaries
2045
+ register them on their RPC endpoint; `default_cross_process_setup` fires
2046
+ `_testing_reset` unconditionally per test. Its handler first fires the consumer-supplied `reset_state(db)`
2299
2047
  callback for domain-state reset — before the auth wipe, because domain
2300
2048
  rows depend on auth rows (a domain table with a restricting FK to `actor`
2301
2049
  must empty before the actor delete) — then DELETEs every auth-namespace
@@ -2376,6 +2124,23 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
2376
2124
  keeps an exact action-manifest gate; the spine binary appends it in
2377
2125
  `build_full_spine_rpc_actions`.
2378
2126
 
2127
+ In the hono-free sibling `testing/cross_backend/testing_credential_read.ts`,
2128
+ also **not** bundled: `_testing_credential_read`
2129
+ (`create_testing_credential_read_action(deps)`,
2130
+ `run_testing_credential_read(input, deps)`, `TestingCredentialReadInput` /
2131
+ `TestingCredentialReadOutput`) — reads a list of raw header lines as the
2132
+ credential legs would: `{session_cookie: 'absent' | 'invalid' | 'valid',
2133
+ bearer_token, daemon_token}`, the tokens as read or `null`. Pure: it runs
2134
+ the readers of `auth/credential_headers.ts` and the cookie verify, no
2135
+ database, and never the request's own headers. `lines` is capped
2136
+ (`TESTING_CREDENTIAL_READ_LINES_MAX` lines of at most
2137
+ `TESTING_CREDENTIAL_READ_LINE_LENGTH_MAX` characters, the same bounds on
2138
+ the Rust mirror), and every refusal of it — over a cap, or a line that is no
2139
+ header line: a control byte, DEL, a character above U+00FF, no `:` — is
2140
+ `invalid_params` with `ERROR_TESTING_CREDENTIAL_READ_LINE`. Appended in
2141
+ `build_full_spine_rpc_actions`; the Rust mirror is
2142
+ `fuz_testing::create_testing_credential_read_action_spec`.
2143
+
2379
2144
  Back in `testing_reset_actions.ts`, also **not** bundled:
2380
2145
  `_testing_shorten_credential_expiry`
2381
2146
  (`create_testing_shorten_credential_expiry_action()`) — pulls an account's
@@ -2406,337 +2171,6 @@ are `src/test/auth/cell_crud_parity.db.test.ts`
2406
2171
  complete action list plus its own spec. Daemon-token-gated like its siblings;
2407
2172
  the Rust mirror is `fuz_testing::create_testing_action_manifest_action_spec`.
2408
2173
 
2409
- ### Cell ref admission parity — `cross_backend/cell_ref_admission.ts`
2410
-
2411
- `describe_cell_ref_admission_cross_tests({setup_test, capabilities, rpc_path?})`
2412
- — possession-gated ref admission over real HTTP: a non-admin `cell_create`
2413
- naming a stored fact it never put and one naming an unstored hash get one
2414
- identical `403 cell_ref_not_held` (status + error body); a system-put fact is
2415
- refused too; the uploader's public cell serves the bytes to anyone; a second
2416
- actor putting identical bytes becomes a holder; an editor keeps refs another
2417
- writer introduced and is refused adding (or restoring a dropped) unheld one; a
2418
- shallow and a deep clone carry each row's source refs, while a patch adding an
2419
- unheld ref or moving a child's ref onto the root is refused; the keeper (a
2420
- global admin) is ungated; a grantee who read a fact through a granted cell
2421
- can't name its hash in a cell of its own, before or after the revoke; the ref
2422
- grammar is exact (prose, markup, `blake3:zz`, uppercase, object keys are not
2423
- refs); and a hidden cell's update, a create under a hidden parent, and a clone
2424
- of a hidden source answer `404` whatever `data` names. Facts are put through
2425
- `cross_put_fact` (exported by `fact_serving.ts`), whose `holder` maps onto
2426
- `_testing_put_fact`'s optional `holder` key. Gated on
2427
- `capabilities.fact_serving`; cross-process only. The in-process
2428
- cases are `src/test/auth/cell_ref_admission{,.fact_less}.db.test.ts`.
2429
-
2430
- ### Malformed-envelope and invalid-params parity — `cross_backend/rpc_adversarial.ts`
2431
-
2432
- `describe_rpc_adversarial_cross_tests({setup_test, surface_source, rpc_path?,
2433
- live_rpc_endpoints?, skip_methods?, input_overrides?, xfail_params?})` — the
2434
- envelope and params groups of `describe_rpc_attack_surface_tests`, sent over
2435
- `fixture.transport` to a spawned backend. The in-process groups run on stub
2436
- apps, while the Rust spine parses envelopes and params by hand and the
2437
- action-manifest parity gate
2438
- compares no param schemas, so this is what holds the spines to one answer.
2439
-
2440
- - **envelopes** — every `create_rpc_envelope_cases` case, one test each, on a
2441
- fresh fixture; status, code, echoed `id`, and `data.reason` per case, and a
2442
- guard test that the endpoint has both a read and an authenticated mutation to
2443
- carry them.
2444
- - **params** — one test per declared method, sending every
2445
- `generate_rpc_params_test_cases` case (seeded from the method's
2446
- `input_overrides` entry when it has one — the cases go as a single-actor
2447
- principal, so an override omits `acting`) and failing with the list of
2448
- cases not answered 400 `invalid_params` with the broken field's declared
2449
- `invalid_reason` as `data.reason` (`expected_invalid_reason`; none for an
2450
- undeclared field or a whole-body case). `xfail_params`
2451
- (`RpcParamsXfail` — `{method, labels, tracking_id, reason}`) moves the named
2452
- cases of a method into one `xfail_until` test each, for a known divergence on
2453
- one backend; the method's other cases keep their test, and an entry naming no
2454
- generated case fails. Pass it only for the backend that diverges — fuz_app
2455
- keys it on `RUST_SPINE_STUB_DEFAULT_NAME`.
2456
-
2457
- The authorized principal is the keeper on the first channel the method's auth
2458
- admits — its session, else its daemon token or API token over a no-`Origin`
2459
- transport — resolved through `resolve_conformance_principal`.
2460
- **Preconditions:** the keeper holds every role a declared method gates on
2461
- (`default_cross_process_setup` seeds `keeper` and `admin`; `extra_keeper_roles`
2462
- for others) and has a single actor. No generated body carries a valid `acting`,
2463
- and a malformed one reads as omitted ahead of validation on both spines, so a
2464
- single-actor keeper resolves its actor and validation refuses; a keeper with a
2465
- second actor answers `actor_required` first, so such a suite lists the
2466
- actor-required methods in `skip_methods`.
2467
-
2468
- **Off the declared surface.** `live_rpc_endpoints` (resolved) adds the methods
2469
- the endpoint at `rpc_path` live-mounts beyond the declared surface — cell
2470
- verbs, opt-in resolvers, `_testing_*` backdoors — to both groups: their
2471
- envelope cases in a group of their own, and a params test per method,
2472
- `_testing_*` included (a daemon-only backdoor goes with the keeper's daemon
2473
- token). fuz_app's spine self-test passes `create_spine_live_rpc_endpoints()`.
2474
- Skips `_testing_*` on the declared surface and `PROTOCOL_ACTION_METHODS`, which
2475
- `generate_rpc_auth_conformance_cases` skips too.
2476
- Ungated; cross-process only.
2477
-
2478
- ### Token-scope surface parity — `cross_backend/token_scope_surface.ts`
2479
-
2480
- `describe_token_scope_surface_cross_tests({setup_test, capabilities, rpc_path?,
2481
- sse_path?})` — the `surface:<name>` twin of the conformance slate's
2482
- `token_scope_cases`, which cover only the `rpc:<method>` arm. Token scoping's
2483
- RPC-only rule (_a narrowed api token reaches no non-RPC surface that reads
2484
- account data or carries authority_) is the
2485
- load-bearing half of the design and had **no** cross-impl gate: the schema gate
2486
- can't see it (no column), the action-manifest gate can't see it (no method), and
2487
- the spec-derived suites can't see it (REST routes, off the declared RPC surface).
2488
-
2489
- Mints a narrowed bearer through the production `account_token_create` path and
2490
- fires it at the two surfaces whose denial **body** is observable over plain
2491
- HTTP — the audit SSE stream (`capabilities.sse`) and the admin-only bare-hash
2492
- fact read (`capabilities.fact_serving_admin_hash`) — asserting the exact flat
2493
- `{error: 'token_scope_required', required_scope: 'surface:<name>'}` both spines
2494
- contract on (`token_scope_denied_body` ↔
2495
- `fuz_auth::token_scope_surface_denied_response`).
2496
-
2497
- The account status read (`capabilities.account_status`) answers anonymous
2498
- callers, so rule 3 there is the anonymous answer: a narrowed token on
2499
- `GET /api/account/status` gets the anonymous `401`, status and body byte for
2500
- byte, while the same account's full-scope bearer reads the account.
2501
-
2502
- One case has no prior pin anywhere: **scope outranks role**. A
2503
- narrowed token on an account that _also_ lacks the gating role must hear
2504
- `token_scope_required`, not `insufficient_permissions` — the observable the
2505
- TS↔Rust ordering divergence produced before both spines converged on running the
2506
- surface gate ahead of the role gate. Every other scoped-token probe uses the
2507
- keeper's token, whose account holds the role, so both orderings look identical
2508
- there; that is why the divergence survived as long as it did. Verified to
2509
- discriminate: dropping the route's `required_scope` turns it into a 403
2510
- `insufficient_permissions` + `required_roles`, exactly the pre-convergence shape.
2511
-
2512
- Two non-vacuity controls: the narrowed token must still reach the RPC method it
2513
- _does_ name, and a full bearer must get past the scope gate on the same route.
2514
- The WS upgrade is deliberately omitted — `create_ws_transport` threads cookies,
2515
- not bearer headers, and a refused upgrade's body isn't readable, so it can't
2516
- serve a body-parity gate (its per-spine coverage stays in the two surface
2517
- censuses). Cross-process only.
2518
-
2519
- ### Front-door contract — `cross_backend/transport_composition.ts`
2520
-
2521
- `describe_transport_composition_cross_tests({setup_test, capabilities, base_url,
2522
- rpc_path?, origin?, rest_path?, password_path?, ws_path?, sse_path?,
2523
- multi_actor?, rpc_max_body_bytes?})` — the per-transport
2524
- composition table: what each transport answers before per-action dispatch,
2525
- when one request trips several refusals. Rows are REST `POST` (session-only
2526
- `/api/account/logout`), RPC `POST`, RPC `GET`, the WS upgrade (gated on
2527
- `capabilities.ws`) and the audit stream (`capabilities.sse`); columns are a
2528
- foreign `Origin` with the keeper's session (→ 403 `forbidden_origin`), an
2529
- over-cap declared length with a foreign `Origin` and no credential (→ 413
2530
- `payload_too_large`, body-carrying rows only; one byte past the spine default,
2531
- or past `rpc_max_body_bytes` on the RPC row), no credential (→ 401
2532
- `authentication_required`), and a narrowed bearer with no `Origin` (→ 403
2533
- `token_scope_required` naming `rpc:<method>` on RPC and `surface:ws_upgrade` on
2534
- the upgrade; 403 `credential_type_required` on the session-only REST route and
2535
- audit stream); a `/password` cell pins that route's 401 beside `/logout`'s.
2536
- Each case asserts the status and the body — flat `{error}` or the JSON-RPC
2537
- envelope's `error.data`. A WS refusal's body is required where the backend
2538
- declares `capabilities.ws_refusal_body`; where it doesn't (Node's
2539
- `@hono/node-server` drops the body), an empty body passes on its status and a sent
2540
- one is still asserted. The table
2541
- is the exported `transport_composition_cases` data. `multi_actor:
2542
- {setup_test, xfail?}` adds `transport_composition_multi_actor_cases`, run on
2543
- a fixture whose keeper has `extra_actors`: the keeper's session upgrading with
2544
- no `?acting=` → 400 `actor_required` (flat body), the upgrade's actor
2545
- resolution on both spines. `xfail` is for a backend known to admit the
2546
- socket; fuz_app passes none. Given `base_url`, every
2547
- probe is written to the socket (`raw_http_exchange`) and an over-cap request
2548
- sends its head alone; with `base_url: null` the probes go through the
2549
- fixture's transport and only the WS upgrade rows skip — the WS-path rows
2550
- that ask for no upgrade gate on `capabilities.ws` alone. Not in the standard
2551
- bundle. fuz_app's in-process leg is `src/test/auth/transport_composition_parity.db.test.ts`.
2552
-
2553
- `cross_backend/narrowed_api_token.ts` — `mint_narrowed_api_token({app,
2554
- rpc_path, session_headers, methods, name?})` mints a method-scoped api token
2555
- through the production `account_token_create` path and returns the raw bearer
2556
- (throws when the mint is refused). Shared by the front-door table, the
2557
- token-scope surface suite, and the conformance table's `scoped_token`
2558
- principal.
2559
-
2560
- ### Credential deadline parity — `cross_backend/credential_deadline.ts`
2561
-
2562
- `describe_credential_deadline_cross_tests({setup_test, capabilities, base_url,
2563
- ws_path, sse_path?, rpc_path?, ws_account_roles?})` — a connection closes when the credential it
2564
- opened on expires: each case pulls a fresh account's credential expiries in to
2565
- two seconds with `_testing_shorten_credential_expiry` before the open, then
2566
- checks the connection still dispatches short of the deadline and closes at it.
2567
- A WebSocket on a session and one on an API token (`capabilities.ws`) close with
2568
- `WS_CLOSE_SESSION_REVOKED` and `WS_CLOSE_CREDENTIAL_EXPIRED_REASON`; an audit
2569
- stream on a session (`capabilities.sse`) ends; and a second seam call asking
2570
- for a later expiry moves nothing (the seam only shortens). API token × audit
2571
- stream is not reachable over the wire — the stock stream is session-only — so
2572
- the Rust spine pins it on a widened gate and the TS twin shares one deadline
2573
- wait across both transports. The cases run concurrently (`describe.concurrent`)
2574
- under one `setup_test()` for the suite, each on its own account, so a leg waits
2575
- out one deadline rather than one per case. `ws_account_roles` gives the
2576
- socket cases' accounts roles, for a backend whose WS upgrade requires one.
2577
- Cross-process only.
2578
-
2579
- ### Origin check scope parity — `cross_backend/origin_scope.ts`
2580
-
2581
- `describe_origin_scope_cross_tests({setup_test, capabilities, probe_path?,
2582
- base_url?, unrouted_status?})` — the origin check covers paths outside `/api`:
2583
- on `GET /ready` (`probe_path`), a foreign `Origin` → 403 `forbidden_origin`, an
2584
- absent or allowed one → 200, gated on `capabilities.ready`. On an unrouted
2585
- path, ungated: a foreign `Origin` → 403, an absent one passes to the fallback
2586
- (`unrouted_status`, default 404 — a backend whose fallback serves an SPA shell
2587
- passes 200; the in-process leg runs that shape too), and an over-cap `POST`
2588
- with a foreign `Origin` → 413. Runs both legs (the in-process
2589
- `cross_backend/origin_scope_parity.db.test.ts` + the cross-process
2590
- one call).
2591
-
2592
- ### Origin verification parity — `cross_backend/origin.ts`
2593
-
2594
- `describe_origin_cross_tests({setup_test, rpc_path?})` — the
2595
- imperative Origin-verification suite: absent `Origin` → request passes
2596
- (non-browser direct access); the disallowed-`Origin` 403 is the front-door
2597
- table's. Imperative (not a conformance-table row) because absent-Origin needs
2598
- `fresh_transport({origin: null})`. Runs both legs (the
2599
- in-process `auth/origin_parity.db.test.ts` + the cross-process
2600
- one call). The promotion surfaced a twin-impl divergence — the
2601
- Rust spine returned a plain-text body — now converged to the canonical TS
2602
- `{error: "forbidden_origin"}` via `fuz_http::forbidden_origin_response()`.
2603
-
2604
- ### Origin allowlist conformance — `cross_backend/origin_conformance.ts`
2605
-
2606
- `cross_backend/origin_conformance.json` is the shared table both spines' origin
2607
- allowlist must satisfy: **parse** rows `{raw, ok: true}` or `{raw, errors:
2608
- [{index?, kind}]}` (every refusal, 1-based position, `AllowedOriginsErrorKind`)
2609
- and **match** rows `{patterns, origin, allowed}` (`origin: null` — no
2610
- `Origin` — passes). A row may carry a `note`. `load_origin_conformance()` reads
2611
- and validates it (`OriginConformance`), `to_origin_conformance_checks(table)`
2612
- flattens it into `_testing_origin_check` inputs with their expected answers, and
2613
- `assert_origin_conformance(checks, answers, backend)` fails once listing every
2614
- row that disagrees. `describe_origin_conformance_cross_tests({setup_test,
2615
- rpc_path?})` sends every row to a backend's `_testing_origin_check` over the
2616
- keeper's daemon-token channel; the TS unit leg runs the same rows through
2617
- `run_testing_origin_check` (`src/test/http/origin.conformance.test.ts`), so the
2618
- Rust spine is held to the table without reading the file. Ungated; edit the
2619
- table by hand — it is the statement of the grammar, not generated output.
2620
-
2621
- ### CORS simple-request parity — `cross_backend/simple_request.ts`
2622
-
2623
- `describe_simple_request_cross_tests({setup_test, rpc_path?, login_path?, logout_path?})`
2624
- — a JSON route refuses any `POST` that isn't `application/json` with a flat
2625
- 415 `{error: 'unsupported_content_type'}` before reading a credential or the
2626
- body: the CORS-safelisted types in any spelling (`text/plain`, `Text/Plain`,
2627
- form-encoded, multipart) on RPC with a session, untyped RPC (a byte body, so
2628
- `fetch` adds no type), `application/octet-stream` / `+json` / empty-typed RPC
2629
- and login, form-encoded login, a forged `text/plain` logout with a session
2630
- (which must leave the session valid), and an untyped logout with no session
2631
- (415, not 401); a bodyless JSON logout reaches the auth check (401), and
2632
- `application/json` with a charset is dispatched. The TS spine checks per route
2633
- (`apply_route_specs`), the Rust spine in each JSON handler. Runs both legs:
2634
- the in-process `auth/simple_request_parity.db.test.ts` and the cross-process
2635
- one call.
2636
-
2637
- ### Query-string shape parity — `cross_backend/query_shape.ts`
2638
-
2639
- `describe_query_shape_cross_tests({setup_test, capabilities, rpc_path?})` —
2640
- the imperative duplicate-key / unknown-key / phase-order query-semantics
2641
- suite over the three spine surfaces that read a query:
2642
- `GET /api/account/status` (no query schema — duplicated `acting` first-wins,
2643
- unknown keys ignored, anonymous junk query → 401 never a query 400), the
2644
- JSON-RPC GET endpoint (`method` / `id` / `params` first-wins — a last-wins
2645
- reader dispatches a different method per backend on the same request), and
2646
- `GET /api/facts/:hash` (gated on `capabilities.fact_serving_admin_hash`; strict schema —
2647
- unknown key / malformed `acting` → 400 `invalid_query_params` **before** the
2648
- 401 guard, duplicated `acting` first-wins). Imperative because duplicated
2649
- query keys can't be expressed through the structured RPC helpers. Pinned
2650
- after the Rust spine's derived-serde `Query` extractors were converged onto
2651
- `fuz_http`'s `query_first` / `assert_known_query_keys` (a pre-handler
2652
- "duplicate field" 400 is an anonymously observable backend fingerprint).
2653
- Cross-process only — the per-surface in-process TS pins live beside each
2654
- module's own tests (`account_status.test.ts`, `action_rpc.test.ts`,
2655
- `serve_fact_route.db.test.ts`);
2656
-
2657
- ### Grant-verb role and scope-kind grammar parity — `cross_backend/role_grant_role_grammar.ts`
2658
-
2659
- `describe_role_grant_role_grammar_cross_tests({setup_test, rpc_path?})` — an
2660
- off-grammar `role` (uppercase, hyphen, digit, leading, trailing or consecutive
2661
- underscores, space, empty, or all lowercase and one character past the length
2662
- cap) on `role_grant_assign` and `role_grant_offer_create` answers
2663
- `invalid_params` with no `data.reason`, and after the refusals no
2664
- `role_grant_create` / `role_grant_offer_create` audit row carries one of those
2665
- strings. The control — an on-grammar role no registry holds, refused past
2666
- validation with `role_not_web_grantable` — keeps the audit read from being
2667
- vacuous, and the same refusal for a role exactly at the length cap pins that
2668
- boundary. An off-grammar `scope_kind` with its `scope_id` (the same grammar
2669
- and cap, `ScopeKindName`, among them `'GLOBAL'` with the all-zeros uuid, the
2670
- partial unique indexes' key for a global grant) is refused the same way and
2671
- recorded in no row; with an unregistered role, on-grammar ones (one at the cap)
2672
- are refused past validation with the verb's not-grantable reason. Exists
2673
- because the action-manifest parity gate captures no param
2674
- schemas while the Rust spine parses params by hand, and the grant verbs write
2675
- the role and `scope_kind` they refuse into their failure rows. Ungated; cross-process only (it
2676
- reads the audit log behind `_testing_drain_effects`).
2677
-
2678
- ### API-token lifetime parity — `cross_backend/token_lifetime.ts`
2679
-
2680
- `describe_token_lifetime_cross_tests({setup_test, rpc_path?})` — the
2681
- imperative round-trip on `account_token_create`'s required `lifetime` union:
2682
- a `{kind:'ttl', days}` mint returns and stores a bounded `expires_at`
2683
- (create output + `account_token_list` read-back), `{kind:'eternal'}` stores
2684
- NULL, an omitted or out-of-range lifetime 400s identically on both
2685
- spines, and a `name` at `API_TOKEN_NAME_LENGTH_MAX` mints and reads back whole
2686
- while one UTF-16 code unit past it is `invalid_params`. It pins the scope cap
2687
- as compact UTF-8 bytes at mint and at read: a two-byte scope at
2688
- `MAX_TOKEN_SCOPE_BYTES`, and an ASCII one under it whose printed `jsonb` text
2689
- is past it, mint, authenticate as bearers and list as `N methods`; one byte
2690
- past the cap is `invalid_params` with `ERROR_TOKEN_SCOPE_INVALID`. It also pins the
2691
- credential legs' order from stored state: a bearer sent beside a winning
2692
- daemon token keeps `last_used_at` null (never validated), against a token used
2693
- alone whose touch lands. Exists because the action-manifest parity gate captures no param
2694
- schemas while the Rust spine hand-parses params — a spine that silently
2695
- dropped the field would answer the same mint with a 200 and an eternal
2696
- token; only the stored-state read-back catches it. Ungated (mint + list are
2697
- on every spine's standard surface). Runs both legs
2698
- (`token_lifetime_parity.db.test.ts` + the cross-process one call).
2699
-
2700
- ### Readiness probe parity — `cross_backend/ready.ts`
2701
-
2702
- `describe_ready_cross_tests({setup_test, capabilities, ready_path?})` — the
2703
- imperative `/ready` deploy-gate suite: an anonymous, cookie-jar-free,
2704
- no-Origin `GET /ready` → `200 {ready: true}` on a clean spine bootstrap (the
2705
- deploy-poll shape a gate like zap uses). The `/ready` mechanism + its
2706
- drift → `503` path are per-impl unit tests already (TS `db/schema_ready.ts`,
2707
- Rust `fuz_db::schema_ready` / `fuz_http::ready`); this is the cross-impl
2708
- success-path gate. Gated on `capabilities.ready`. Imperative (not a
2709
- `conformance_table` row) because `/ready` is a public flat-REST route, not a
2710
- JSON-RPC envelope, and the probe needs `fresh_transport({origin: null})` —
2711
- the same reasons the sibling `cross_backend/origin.ts` suite is imperative.
2712
- Runs both legs (`cross_backend/ready_parity.db.test.ts` +
2713
- the cross-process one call).
2714
-
2715
- Both backends read the **same** committed
2716
- `testing/cross_backend/expected_schema.json` (column-presence is engine-portable,
2717
- so one fixture is the cross-impl contract): the TS spine via
2718
- `create_spine_ready_route_spec`, which reads the `SPINE_EXPECTED_SCHEMA_URL`
2719
- `import.meta.url` constant off `spine_surface_constants.ts`; the Rust
2720
- `testing_spine_stub` via the absolute path `rust_spine_stub_backend_config`
2721
- passes through `FUZ_RUST_SPINE_STUB_EXPECTED_SCHEMA_PATH`. The fixture covers the full
2722
- spine bootstrap (auth + cell + fact) and is regenerated +
2723
- drift-guarded by `src/test/cross_backend/spine_expected_schema.db.test.ts`
2724
- (`UPDATE_SCHEMA_READY=1`).
2725
-
2726
- ### Session cookie codec parity — `cross_backend/session_cookie_codec.ts`
2727
-
2728
- `describe_session_cookie_codec_cross_tests({setup_test, cookie_name,
2729
- cookie_keys, rpc_path?})` — both spines accept exactly one spelling of a signed
2730
- session cookie. The suite holds the backend's `SECRET_FUZ_COOKIE_KEYS`
2731
- (`cookie_keys`), signs `token:expires_at` itself, and probes `account_verify`
2732
- with: a signature whose final character carries non-zero trailing bits (the
2733
- same MAC under `atob`), an unpadded signature, and correctly signed
2734
- `expires_at` values `+N`, ` N`, `N.0` and one past `u64::MAX` — each refused
2735
- with `authentication_required`. Controls: re-signing the keeper cookie's
2736
- payload reproduces it byte for byte and it authenticates, and a leading-zero
2737
- `0N` authenticates (the `u64` bound is on the value, not the digit count).
2738
- Ungated; cross-process only.
2739
-
2740
2174
  ### Testing-backdoor declaration + credential gate — `cross_backend/testing_backdoor.ts`
2741
2175
 
2742
2176
  `describe_testing_backdoor_cross_tests({setup_test, capabilities, rpc_path?,
@@ -2792,161 +2226,27 @@ this suite stays for consumers whose backends mount the `_testing_*` actions
2792
2226
  without a conformance table over their live mount, and for the declaration
2793
2227
  check.
2794
2228
 
2795
- ### Identity-primitive parity — `cross_backend/identity_parity.ts`
2796
-
2797
- `describe_identity_parity_cross_tests({setup_test, login_path?, signup_path?, bootstrap_path?, password_path?})` —
2798
- the imperative suite pinning the identity primitives (`Username`,
2799
- `UsernameProvided`, `Email`) + login/signup input handling end-to-end over real
2800
- HTTP (flat REST `/login` + `/signup`, so imperative, not a `conformance_table`
2801
- row). The facets, each a TS↔Rust reimplementation pair that the spec-derived
2802
- round-trip / conformance suites never vary:
2803
-
2804
- - **Login canonicalization** — case-insensitive + whitespace-trim lookup
2805
- (`UsernameProvided` `.trim().toLowerCase()` + `LOWER(username)`), the trimmed
2806
- set being JS `String.prototype.trim`'s on every spine (U+FEFF padding trimmed,
2807
- U+0085 not), plus a Turkish-`İ` homograph **no-Unicode-fold-collision**
2808
- negative.
2809
- - **Username-or-email login** — an account created with an email logs in via
2810
- that email, case-insensitively both directions; username login still works;
2811
- non-existent email → 401. This is the corner that surfaced and closed the Rust
2812
- spine's username-only divergence (it now mirrors TS's
2813
- `query_account_by_username_or_email`).
2814
- - **Login input validation** — malformed login input → 400 `invalid_request_body`
2815
- on every spine: whitespace-only username (empty after trim), over-long username
2816
- (> 255), empty password, unknown body key (strict object). TS runs the full
2817
- `LoginInput` schema; the Rust spine enforces the same shape in
2818
- `account_login` (closed a cluster where three of these fell through to a
2819
- lookup-miss 401 on Rust and a whitespace-only identifier 401'd on TS). Asserted
2820
- by error reason, not just status.
2821
- - **ASCII-only creation invariant** — non-ASCII username → 400 at signup, and a
2822
- padded creation name (space, tab, U+0085) → 400, never trimmed into a legal
2823
- one — at signup, and at bootstrap (`bootstrap_path`, default
2824
- `/api/account/bootstrap`, `null` to skip), where the body is validated ahead
2825
- of the window check, so the 400 holds after bootstrap completed. There the
2826
- `token` past `BOOTSTRAP_TOKEN_LENGTH_MAX` UTF-16 code units is 400 and one at
2827
- it reaches the closed window's 403, ASCII, two-byte, and astral, so both
2828
- spines count code units, not bytes or scalar values.
2829
- - **Length + format regex parity** — both `[USERNAME_LENGTH_MIN,
2830
- USERNAME_LENGTH_MAX]` = `[3, 39]` boundary edges (just-outside → 400,
2831
- just-inside → 403 no-matching-invite) and the creation regex shape (leading
2832
- non-letter / trailing punctuation / embedded disallowed char → 400; mid-string
2833
- `_`/`-` accepted), catching an off-by-one or position bug in the TS
2834
- `Username` bounds and regex vs the Rust byte-scan `is_valid_username_for_creation`.
2835
- - **Email format (creation)** — the optional signup `email` validated to the
2836
- loose `local@domain.tld` shape (TS `Email`, `EMAIL_REGEX` + 254-byte
2837
- bound, Rust `is_valid_email`): malformed (no `@` / no domain dot / empty
2838
- side / dot at a domain edge, beside another dot inside it too / whitespace /
2839
- over-length) → 400, well-formed → 403 no-invite. Accepted siblings include
2840
- the single-char-TLD `a@b.c` and the consecutive dots inside a domain that
2841
- a stricter email grammar rejects — the deliberately-looser shared rule. **Closed a
2842
- real divergence**: the Rust spine previously length-checked the email only,
2843
- accepting any non-empty string TS rejected.
2844
- - **Malformed JSON body** — an unparseable (`{`) or non-object (`[]`) body typed
2845
- `application/json` → 400 `{error: "invalid_json_body"}` and nothing else, on
2846
- login, signup, bootstrap (ahead of its window check), and the password change
2847
- (`password_path`, default `/api/account/password`, `null` skips; parsed after
2848
- its credential and session-only gates, so the case sends a session and an
2849
- anonymous one still answers 401). A Rust backend needs the spine's
2850
- `parse_json_body`.
2851
-
2852
- Ungated (login + signup are on every spine). Runs both legs via the shared
2853
- `{setup_test}` protocol: in-process (`identity_parity.db.test.ts`, plain
2854
- `gro test`) and cross-process (the one call).
2855
- The accepted-case 403s rely on `create_spine_route_specs` zeroing
2856
- `signup_fail_floor_ms` (mirroring `login_fail_floor_ms: 0`) so they don't each
2857
- pay the 250ms denial floor.
2858
-
2859
- ### Login rate-limit + trusted-proxy parity — `cross_backend/login_security.ts`
2860
-
2861
- `describe_login_security_cross_tests({setup_test, login_path?})` — the imperative
2862
- suite pinning **login rate limiting + `X-Forwarded-For` client-IP resolution**
2863
- over real HTTP on both spines:
2864
-
2865
- - **per-IP limit fires** — `default_login_ip_rate_limit.max_attempts` (5, the
2866
- shared cap on both impls) failed logins from one forwarded IP → 401, the next →
2867
- `429` with the canonical `{error: "rate_limit_exceeded", retry_after}` body +
2868
- `Retry-After: ceil(retry_after)` header (TS
2869
- `route_fail(REST_RATE_LIMIT_EXCEEDED, {retry_after})` ↔ Rust
2870
- `route_response::rate_limit_exceeded`).
2871
- - **XFF keying** — exhaust one forwarded IP to 429, then a _distinct_ forwarded IP
2872
- → 401 (not 429), proving the limiter keys on the resolved `X-Forwarded-For` IP,
2873
- not the loopback TCP peer (a backend ignoring XFF would 429 the fresh IP too).
2874
- - **a malformed hop stops the walk** — after exhausting one forwarded IP, a
2875
- chain with that IP left of an `ip:port` entry → 401, not 429: the walk stops at
2876
- the malformed entry and keys on the connection IP (its audit row says so),
2877
- never on the client-written entry past it.
2878
- - **a success does not refund the per-IP budget** — the distributed-spray
2879
- backstop. Failed guesses against distinct usernames from one forwarded IP,
2880
- interleaved with the attacker's own successful logins, must still 429 within a
2881
- bounded total-request budget. Both spines used to clear the IP bucket on
2882
- success; only the account-grain bucket is forgiven now. The **budget bound** is
2883
- what makes this adversarial — a decrement-instead-of-zero implementation loops
2884
- to the iteration cap and fails here. Either leg may trip: the aggregate governs
2885
- the address, so once it fills the attacker's own login is refused too.
2886
-
2887
- **Cross-process only**, on a **dedicated dual-spawn project** (`cross_backend_security`
2888
- via `global_setup_login_security.ts`) — the limiters can't be enabled on a backend
2889
- the standard suites share (they fire many loopback logins a live limiter would
2890
- 429), so the standard backends keep every limiter null. Determinism without a
2891
- limiter reset: each case uses its own forwarded IP (a fresh bucket) plus its own
2892
- non-existent username; the spray case additionally mints its attacker account
2893
- over the setup path (loopback, no XFF), so minting can't touch the bucket under
2894
- test. Zero Rust code change — the stub's `FUZ_LOGIN_RATE_LIMIT_ENABLED`
2895
- and `FUZ_TRUSTED_PROXIES` env-gates were already wired; the TS side env-gates the
2896
- limiters in the binary, and `create_spine_route_specs` honors
2897
- `ctx.login_ip_rate_limiter`.
2898
- The in-process counterparts already exist (`describe_rate_limiting_tests` plus the
2899
- proxy middleware tests), so there's no in-process leg. `npm run test:cross:security`.
2900
- Cited property: `docs/security.md` §"Rate Limiting" + §"Trusted Proxy / Client IP".
2901
-
2902
- ### Action rate-limit parity over WS — `cross_backend/ws_action_rate_limit.ts`
2903
-
2904
- `describe_ws_action_rate_limit_cross_tests({setup_test, base_url, ws_path,
2905
- rpc_path?, max_attempts})` — the imperative suite pinning **action rate
2906
- limiting over a real WebSocket**, and its budget shared with HTTP RPC, on
2907
- backends started with small shared action limiters (`max_attempts` is the cap
2908
- they were started with, at least 2):
2909
-
2910
- - **account axis over WS** — `account_token_create` (`rate_limit: 'account'`
2911
- on both spines) with malformed params: `max_attempts` calls answer
2912
- `invalid_params` (the throttle runs before params validation, so they charge),
2913
- the next answers `rate_limited` with a positive `data.retry_after`.
2914
- - **one account bucket across transports** — calls split between HTTP RPC and
2915
- WS exhaust one budget; the call past it is refused on WS and on HTTP (`429`).
2916
- - **IP axis keyed by the forwarded client IP** — `peer/ping` (`rate_limit:
2917
- 'ip'`, public) with malformed params from one `X-Forwarded-For` address, over
2918
- anonymous HTTP and over a WS whose upgrade carried the header: refused past the
2919
- cap on both transports, while a second address keeps its own bucket on both.
2920
- - **account axis at the dispatchers** — `cell_create` (`rate_limit:
2921
- 'account'`, on both spines' RPC and WS mounts) with malformed params: refused
2922
- past the cap over HTTP (`429`) and over WS (`rate_limited`), calls split
2923
- between the two transports exhaust one budget, and a budget split between
2924
- `cell_create` and `account_token_create` is one bucket.
2925
-
2926
- Isolation without a limiter reset: each account case runs on the fresh keeper
2927
- the per-test `_testing_reset` seeds (a new account id), and the IP case uses
2928
- TEST-NET-2 addresses nothing else sends. The backends are started by the
2929
- `enable_action_rate_limit` + `action_rate_limit_max_attempts` options on both
2930
- backend configs (`ts_spine_*_backend_config`, `rust_spine_stub_backend_config`),
2931
- which set `ACTION_RATE_LIMIT_ENABLED_ENV` (`FUZ_ACTION_RATE_LIMIT_ENABLED`) and
2932
- `ACTION_RATE_LIMIT_MAX_ATTEMPTS_ENV` (`FUZ_ACTION_RATE_LIMIT_MAX_ATTEMPTS`) from
2933
- `spine_surface_constants.ts` — both spine binaries build one IP + one account
2934
- limiter (the action defaults' windows, the cap replacing both
2935
- `max_attempts`) shared by RPC and WS, and refuse to boot on a cap without the
2936
- flag. Off, neither spine builds an action limiter. Runs under the
2937
- `cross_backend_security` dual-spawn beside the login-security suite. The TS
2938
- spine and the Rust stub both charge every classed action — the auth families
2939
- included — in their dispatchers, after authorization and ahead of params
2940
- validation. The `account_token_create` cases pin an auth family's class (a
2941
- malformed `acting` selector, refused by the dispatcher's own params check,
2942
- still charged), the IP case the WS dispatcher's IP axis, and the `cell_create`
2943
- cases the account axis of a consumer-shaped spec, RPC and WS — reachable over WS on both spines because
2944
- the TS spine serves its full action set on `/api/ws`, as the Rust stub serves
2945
- one registry on both transports. The IP case's addresses are fixed per
2946
- process and their bucket outlives `_testing_reset`, so a vitest retry of it
2947
- would fail.
2948
- Cross-process only; fuz_app's own wiring is
2949
- `src/test/cross_backend/ws_action_rate_limit.cross.test.ts`.
2229
+ ### Limiter-enabled backends — `login_security.ts` + `ws_action_rate_limit.ts`
2230
+
2231
+ The two standalone suites that need live rate limiters, which no backend the
2232
+ standard suites share can have (those fire many loopback logins and actions a
2233
+ live limiter would refuse). A backend is started for them by the
2234
+ `enable_action_rate_limit` + `action_rate_limit_max_attempts` options on the
2235
+ spine backend configs, which set `ACTION_RATE_LIMIT_ENABLED_ENV`
2236
+ (`FUZ_ACTION_RATE_LIMIT_ENABLED`) and `ACTION_RATE_LIMIT_MAX_ATTEMPTS_ENV`
2237
+ (`FUZ_ACTION_RATE_LIMIT_MAX_ATTEMPTS`) from `spine_surface_constants.ts`, beside
2238
+ `enable_login_rate_limit` (`LOGIN_RATE_LIMIT_ENABLED_ENV`) and the
2239
+ trusted-proxy allowlist the login cases key on. Each spine binary then builds one
2240
+ IP and one account action limiter shared by its RPC and WS mounts, and refuses
2241
+ to boot on a cap without the flag.
2242
+
2243
+ Neither suite resets a limiter: each case isolates itself with its own
2244
+ forwarded IP or the fresh keeper `_testing_reset` seeds. The IP cases'
2245
+ addresses are fixed per process and their buckets outlive the reset, so a
2246
+ vitest retry of one fails. fuz_app runs both under the dual-spawn
2247
+ `cross_backend_security` project (`npm run test:cross:security`); the
2248
+ in-process limiter and proxy paths are `describe_rate_limiting_tests` and the
2249
+ proxy middleware tests.
2950
2250
 
2951
2251
  ### Timing overrides — `timing_env`
2952
2252
 
@@ -2970,90 +2270,6 @@ Cross-process only; fuz_app's own wiring is
2970
2270
  `src/test/cross_backend/db_checkout_timeout.cross.test.ts`, under the
2971
2271
  `cross_backend_timing` project.
2972
2272
 
2973
- ### Role-gated participation parity — `cross_backend/role_grant_participation.ts`
2974
-
2975
- The role-gated-participation capstone — TS↔Rust agreement that an **app-defined
2976
- role is conferred identically** on both spines. A `participant`
2977
- (`grant_paths: ['admin']`) app-role is registered on both spines (`spine_roles`
2978
- in `default_spine_surface.ts` + the Rust `testing_spine_stub`'s `RoleRegistry`,
2979
- which its auth and cell surfaces both read); the cross legs prove the three conferral properties agree.
2980
-
2981
- **Declarative-max, imperative-as-escape-hatch.** The single-request matrix is
2982
- declarative (`conformance_participation_cases.ts`, run via
2983
- `describe_conformance_table_tests`): **(a) grantability** —
2984
- `role_grant_assign` of `participant` passes the admin-grant-path gate and dies
2985
- _past_ it (404, nonexistent account) while a non-grantable role (`keeper`,
2986
- unregistered) is refused _at_ it (403 `role_not_web_grantable`), and the
2987
- `role_grant_offer_create` grant-path gate matches (403
2988
- `role_grant_offer_role_not_grantable`); **(b) admin-only conferral** — a
2989
- non-admin _holder_ of `participant` (and a fresh non-admin) can't offer it (403
2990
- `role_grant_offer_not_authorized` — no holder-propagation); **(c)
2991
- `role_grant_assign` is admin-only** — non-admin holder / fresh → 403
2992
- `insufficient_permissions` (dispatcher gate), anon → 401; plus the
2993
- `to_actor_id`-must-belong-to-`to_account_id` resolution arm (400
2994
- `role_grant_offer_actor_account_mismatch`); **(d) builtin roles are
2995
- global-only** — an unpaired `scope_kind` / `scope_id` → 400 on assign + offer,
2996
- a scoped `admin` → 400 `role_grant_builtin_scoped` on assign + offer, a builtin
2997
- offer from a non-global-admin → 403 `role_grant_offer_not_authorized`.
2998
-
2999
- `describe_role_grant_participation_cross_tests` (this module) is the **imperative
3000
- escape hatch** for the multi-step success paths a static row can't express (they
3001
- need a real recipient): admin **assigns** `participant` to a fresh account
3002
- (`{ok, role_grant_id}` + idempotent re-assign), admin **assigns** a scoped
3003
- `participant` whose `scope_kind` + `scope_id` round-trip through
3004
- `admin_account_list` (distinct from the global grant), and admin **offers**
3005
- `participant` → recipient **accepts** → a role_grant lands. The `role_holder`
3006
- principal is seeded via `extra_accounts: [{username, roles: ['participant']}]`
3007
- (bootstrap-cradle direct grant) and named through `principals.role_holder`.
3008
- The replay cases count audit rows behind `_testing_drain_effects`, so the
3009
- backend must mount it — every spine binary does; an in-process leg mounts
3010
- `create_testing_drain_effects_action` over an emitter built with
3011
- `track_inflight: true` (`conformance_participation.db.test.ts`).
3012
- `role` (default `SPINE_PARTICIPANT_ROLE`) names the role conferred, which must
3013
- be admin-grantable in the backend's registry; `scope_kind` (default `'space'`,
3014
- or `null` for a builtin role) is the scope the scoped-assign case uses, and
3015
- `null` skips it. A backend with only the builtin roles runs the suite with
3016
- `ROLE_ADMIN` — the scoped case skips, as a builtin is global-only.
3017
-
3018
- Both legs run in-process (`conformance_participation.db.test.ts`, plain
3019
- `gro test`) and cross-process (`conformance_participation.cross.test.ts`, TS
3020
- node/bun + Rust stub). Landing the TS `role_grant_assign` action also turned
3021
- the `cross_backend_parity` action-manifest gate green (it was Rust-only before).
3022
- Cited property: `docs/identity.md` + the role-gated-participation design
3023
- (admin-only conferral, immediate assign).
3024
-
3025
- ### Offer decline + retract refusals — `cross_backend/role_grant_offer_lifecycle.ts`
3026
-
3027
- `describe_role_grant_offer_lifecycle_cross_tests({setup_test, rpc_path?, role?})` —
3028
- the error paths of the two verbs that end a pending offer without a grant,
3029
- which the WS notification suite drives only on the happy path. Canonical
3030
- answers, from the handlers and the queries behind them
3031
- (`auth/role_grant_offer_actions.ts`, `auth/role_grant_offer_queries.ts`):
3032
-
3033
- - **not a party → 404** `not_found` with reason `role_grant_offer_not_found`.
3034
- Decline is scoped to the recipient account and retract to the grantor actor,
3035
- so a stranger, the grantor declining, or the recipient retracting hears what
3036
- a missing offer answers — the case compares the two refusals whole — and the
3037
- offer stays pending (`docs/security.md` §"404-over-403 is the general mask").
3038
- The scope check runs before the terminal check, so a stranger hears 404 on
3039
- a decided offer too.
3040
- - **decided → 400** `invalid_request` with reason `role_grant_offer_terminal`:
3041
- a decline or retract after an accept, a second decline, a second retract,
3042
- and either after the other.
3043
- - **audit**: a decline writes one `role_grant_offer_decline` row
3044
- (`account_id` / `actor_id` the recipient, `target_*` the grantor, metadata
3045
- `{offer_id, role, scope_id}` plus `reason` only when one was given), a
3046
- retract one `role_grant_offer_retract` row (the grantor, targeting the
3047
- recipient, no target actor on an account-grain offer); refusals write none.
3048
- Read through `list_audit_events`.
3049
-
3050
- The single-request rows — decline and retract of an id naming no offer → 404
3051
- — are in the conformance security slate, so the differential sends them to
3052
- both spines. The keeper is the grantor and offers `role` — an admin-grantable
3053
- role, `SPINE_PARTICIPANT_ROLE` by default; `ROLE_ADMIN` serves a backend with
3054
- only the builtin roles. Ungated. The
3055
- in-process leg is on the drained setup of `conformance_participation.db.test.ts`.
3056
-
3057
2273
  ### Building a TS test-server binary — `testing_server_core.ts` + adapters
3058
2274
 
3059
2275
  The reusable shape for standing up a **spawnable TS** cross-process test
@@ -3064,20 +2280,36 @@ re-roll the serve / daemon-info / drain boilerplate:
3064
2280
  - `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` (`probe_process`, signal 0 with no program spawned; another user's process or a pid naming no single process reads as not running).
3065
2281
  - `testing/cross_backend/testing_server_node.ts` — `create_node_testing_adapter()` (`@hono/node-server`'s `serve` and module-level `upgradeWebSocket`, over a `ws` `WebSocketServer`). Optional peer deps; only test binaries import them. `prepare_websocket` builds the `ws` server (`noServer: true`) with `maxPayload` at twice `max_message_bytes` (default `DEFAULT_WS_MAX_MESSAGE_BYTES`; `ws`'s own default is 100 MiB), and `serve` hands it to `@hono/node-server`, 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).
3066
2282
  - `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` + `ws`; `Bun.serve` is built in). Reuses `create_node_runtime` (Bun implements the `node:fs`/`node:process` surface). WS is module-level + stateless — the `websocket` handler is threaded into `serve`, where `Bun.serve` wants it. 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.
3067
- - `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.
2283
+ - `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`, `create_spine_ready_route_spec` (the `/ready` route over the committed `expected_schema.json`), `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.
3068
2284
  - `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, then the WS-only room verbs and `room_notification_actions`, 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 — and the stub's RPC dispatcher refuses its `ws_only` room verbs). `options.room_registry` is the registry the room verbs, `_testing_room_evict`, and `_testing_reset` (which clears it) share — the binary builds it with `create_spine_room_registry(connections)` (exclusive, the default bounds; the twin of the stub's `stub_room_registry`) over its WS endpoints' connection registry; omitted, one over a fresh connection registry serves enumeration. 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).
3069
2285
  - `testing/cross_backend/ts_spine_backend_config.ts` — `ts_spine_node_backend_config()` / `ts_spine_bun_backend_config()` presets (in-memory pglet, no external infra), the TS analog of `rust_spine_stub_backend_config()`.
3070
2286
 
3071
2287
  fuz_app's own binary wiring (`src/test/cross_backend/testing_spine_server{,_node,_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`/`_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.
3072
2288
 
2289
+ The TS spine binary serves the audit stream, `GET /api/admin/audit/stream`:
2290
+ `build_spine_app` passes `audit_log_sse: true` and `create_spine_route_specs`
2291
+ mounts `create_audit_log_route_specs({stream: ctx.audit_sse})` when
2292
+ `ctx.audit_sse` is set (keeps the shared surface snapshot SSE-free, since the surface stub ctx has
2293
+ `audit_sse: null`). `capabilities.sse` is a mount flag, so each config states
2294
+ it (`ts_spine_backend_config.ts` for the TS spines) and a consumer that doesn't
2295
+ wire `audit_log_sse` states `false`. The
2296
+ real-HTTP `transports/sse_transport.ts` feeds `describe_cross_process_sse_tests`.
2297
+
2298
+ The auth-cost handling for cross-process testing is consumer-side: each
2299
+ consumer ships a separate test binary wiring a fast-params
2300
+ `TestingArgon2idHasher` from a sibling Rust testing crate. Cross-process
2301
+ `bootstrap` + `create_account` are then plain RPC calls against the test
2302
+ binary — no DB-direct surgery in fuz_app's testing library, no runtime
2303
+ knobs in production code, no shared cookie key with the backend.
2304
+
3073
2305
  ### Live-method coverage reconciliation — `method_coverage.ts`
3074
2306
 
3075
2307
  `assert_rpc_method_coverage({live_methods, declared_methods, manifest})` keeps
3076
2308
  the **off-declared-surface** methods as drift-proof as the declared ones. The
3077
2309
  spec-derived suites auto-enumerate the declared surface, but a backend's live
3078
2310
  RPC endpoint also mounts methods kept off it (stateful cell verbs, opt-in
3079
- resolvers, `_testing_*` backdoors) that rely on hand-wired imperative suites —
3080
- nothing structurally guaranteed every live method was actually claimed by one.
2311
+ resolvers, `_testing_*` backdoors) that rely on hand-wired imperative suites,
2312
+ and nothing else guarantees every live method is claimed by one.
3081
2313
 
3082
2314
  The assertion diffs the live method set against a `MethodCoverageEntry`
3083
2315
  manifest both directions (a mounted-but-unclaimed method **and** a stale
@@ -3094,32 +2326,6 @@ wiring is the manifest `src/test/cross_backend/spine_method_coverage.ts` + the
3094
2326
  no-DB reconciliation test `spine_method_coverage.test.ts`, which enumerates
3095
2327
  `build_full_spine_rpc_actions` with stub deps against `create_spine_surface_spec`.
3096
2328
 
3097
- The in-process `ws_round_trip` harness stays (it drives the dispatcher
3098
- against a fake upgrade, no wire), but the real-upgrade coverage now lives in
3099
- the cross-process `cross_backend/ws_round_trip.ts` suite below — including
3100
- close-on-revoke (`WsClient.wait_for_close` asserts a live socket is dropped
3101
- once `account_session_revoke_all` commits).
3102
-
3103
- `audit_completeness` is in-process by design (FK-structural introspection
3104
- beyond the `audit_log_list` RPC reads — structurally in-process).
3105
-
3106
- **Cross-process SSE** is wired (see §`cross_backend/sse_round_trip.ts`
3107
- above). The TS spine binary serves `GET /api/admin/audit/stream` —
3108
- `build_spine_app` passes `audit_log_sse: true` and `create_spine_route_specs`
3109
- mounts `create_audit_log_route_specs({stream: ctx.audit_sse})` when
3110
- `ctx.audit_sse` is set (keeps the shared surface snapshot SSE-free, since the surface stub ctx has
3111
- `audit_sse: null`). `capabilities.sse` is scoped to the TS spine configs
3112
- (`ts_spine_backend_config.ts`), not the shared `ts_default_capabilities`,
3113
- which stays honest for consumers who don't wire `audit_log_sse`. The
3114
- real-HTTP `transports/sse_transport.ts` feeds `describe_cross_process_sse_tests`.
3115
-
3116
- The auth-cost handling for cross-process testing is consumer-side: each
3117
- consumer ships a separate test binary wiring a fast-params
3118
- `TestingArgon2idHasher` from a sibling Rust testing crate. Cross-process
3119
- `bootstrap` + `create_account` are then plain RPC calls against the test
3120
- binary — no DB-direct surgery in fuz_app's testing library, no runtime
3121
- knobs in production code, no shared cookie key with the backend.
3122
-
3123
2329
  ### cross_backend/bench/ — cross-impl measurement
3124
2330
 
3125
2331
  Generic primitive for cross-impl **measurement**: drive identical wire
@@ -3159,8 +2365,6 @@ in-memory pglet driver); TS-vs-Rust carries the pglet-vs-Postgres DB-layer cavea
3159
2365
  `format_cross_impl_json` (self-describing artifact: per backend×scenario
3160
2366
  percentiles off the raw-sample tail, budget, iteration count).
3161
2367
 
3162
- Tail honesty depends on a fuz_util change: `BenchmarkStats` computes order
3163
- statistics (min/max/p50–p99) on raw samples while central-tendency stats
3164
- stay MAD-cleaned — so p99 reflects real tail events. Deeper tiers (resource
3165
- sampling, workload corpora, load/soak) and the static-docs dashboard with
3166
- committed historical fixtures stay deferred until CI automation exists.
2368
+ The tail is real: fuz_util's `BenchmarkStats` computes the upper-tail order
2369
+ statistics on raw samples while the central-tendency stats stay MAD-cleaned,
2370
+ so p99 reflects real tail events.