@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
@@ -22,6 +22,15 @@ import '../assert_dev_env.js';
22
22
  * a row may pin further header expectations via `expect.headers`. Headers are
23
23
  * deliberately kept out of the equivalence-group `{status, body}` comparison.
24
24
  *
25
+ * On HTTP every response is also held to what it does to the session cookie:
26
+ * the row's `expect.set_cookie` — omitted meaning none — is matched against
27
+ * `classify_session_cookie_effect` of its `Set-Cookie` lines, which reads the
28
+ * clear and the mint through the spine's own formatters, with a floor behind
29
+ * it that no response outside 2xx mints one (`assert_session_cookie`). An RPC
30
+ * error row is held to its JSON-RPC `error.code` too, not just the status it
31
+ * answers. Rows that can't honestly run are refused at collection
32
+ * (`check_conformance_cases`).
33
+ *
25
34
  * Given `ws`, the runner sends each case as a frame on a WebSocket instead:
26
35
  * the principal opens an admitted socket and the frame meets the per-message
27
36
  * gates. The frame carries the same JSON-RPC envelope the HTTP body does, so
@@ -42,14 +51,16 @@ import '../assert_dev_env.js';
42
51
  */
43
52
  import { assert, describe, test } from 'vitest';
44
53
  import { parse } from '@fuzdev/fuz_schema/schema.ts';
45
- import { DAEMON_TOKEN_HEADER } from '../../auth/daemon_token.js';
54
+ import { DAEMON_TOKEN_HEADER, is_daemon_token_shaped } from '../../auth/daemon_token.js';
55
+ import { API_TOKEN_PREFIX, is_api_token_shaped } from '../../auth/api_token.js';
46
56
  import { find_auth_route, rest_auth_route_suffixes } from '../integration_helpers.js';
47
57
  import { find_rpc_action, headers_to_record, parse_rpc_call_result, rpc_call_raw, create_rpc_request_text, resolve_rpc_endpoints_for_setup } from '../rpc_helpers.js';
48
58
  import { account_token_create_action_spec } from '../../auth/account_action_specs.js';
49
- import { jsonrpc_error_code_to_http_status } from '../../http/jsonrpc_errors.js';
59
+ import { http_status_to_jsonrpc_error_code, jsonrpc_error_code_to_http_status } from '../../http/jsonrpc_errors.js';
50
60
  import { create_admitted_ws_transport } from '../transports/ws_transport.js';
51
61
  import { is_response_for } from '../transports/ws_client.js';
52
62
  import { SCOPED_TOKEN_ADMITTED_METHOD } from './conformance_case.js';
63
+ import { classify_session_cookie_effect, filter_session_set_cookies, find_session_cookie_mints } from './session_cookie_effect.js';
53
64
  import { mint_narrowed_api_token } from './narrowed_api_token.js';
54
65
  import { xfail_until } from './xfail.js';
55
66
  /**
@@ -69,9 +80,9 @@ export const resolve_conformance_rpc_endpoints = (options) => [
69
80
  ];
70
81
  /**
71
82
  * Principals that cannot hold a socket: each presents no usable credential
72
- * (`anonymous`, the browser-discarded and malformed bearers, the expired
73
- * session) or one the upgrade refuses (`scoped_token` — a narrowed token is
74
- * refused `surface:ws_upgrade`), so the upgrade answers before any frame.
83
+ * (`anonymous`, the browser-discarded and malformed bearers, the dead
84
+ * credentials) or one the upgrade refuses (`scoped_token` — a narrowed token
85
+ * is refused `surface:ws_upgrade`), so the upgrade answers before any frame.
75
86
  * The front-door table (`describe_transport_composition_cross_tests`) pins
76
87
  * those upgrade refusals.
77
88
  */
@@ -80,13 +91,20 @@ const WS_UNAVAILABLE_PRINCIPALS = new Set([
80
91
  'bearer_browser',
81
92
  'malformed_bearer',
82
93
  'expired_session',
94
+ 'tampered_cookie',
95
+ 'wrong_daemon',
96
+ 'unknown_bearer',
97
+ 'revoked_session',
98
+ 'revoked_token',
99
+ 'expired_token',
83
100
  'scoped_token'
84
101
  ]);
85
102
  /**
86
103
  * Whether a case can run over a WebSocket: an RPC method (not a REST auth
87
104
  * route), sent as `POST` (a `GET` row pins the HTTP query path), pinning no
88
- * header value (a frame has no headers; an absence pin holds vacuously), as
89
- * a principal that can hold a socket.
105
+ * header value and no session cookie effect (a frame has no headers; an
106
+ * absence pin, `'none'` included, holds vacuously), as a principal that can
107
+ * hold a socket.
90
108
  *
91
109
  * @param c - the case
92
110
  * @returns whether the WS leg runs it
@@ -94,6 +112,7 @@ const WS_UNAVAILABLE_PRINCIPALS = new Set([
94
112
  export const is_ws_conformance_case = (c) => !c.request.method.startsWith('/') &&
95
113
  (c.request.verb ?? 'POST') === 'POST' &&
96
114
  !Object.values(c.expect.headers ?? {}).some((value) => value !== null) &&
115
+ (c.expect.set_cookie ?? 'none') === 'none' &&
97
116
  !WS_UNAVAILABLE_PRINCIPALS.has(c.request.as);
98
117
  /**
99
118
  * A deliberately malformed `X-Daemon-Token` value for the `invalid_daemon`
@@ -105,6 +124,42 @@ export const is_ws_conformance_case = (c) => !c.request.method.startsWith('/') &
105
124
  * invalid-token path, not the browser-context discard.
106
125
  */
107
126
  const INVALID_DAEMON_TOKEN_VALUE = 'not-a-valid-daemon-token';
127
+ /**
128
+ * The `wrong_daemon` principal's token: well-shaped (43 base64url characters),
129
+ * so it passes the shape precheck and is refused by the compare — never the
130
+ * server's, whose tokens are random.
131
+ */
132
+ const WRONG_DAEMON_TOKEN_VALUE = 'A'.repeat(43);
133
+ /**
134
+ * The `unknown_bearer` principal's token: well-shaped (the prefix and 43
135
+ * base64url characters), so it costs the lookup no row answers.
136
+ */
137
+ const UNKNOWN_BEARER_TOKEN_VALUE = `${API_TOKEN_PREFIX}${'A'.repeat(43)}`;
138
+ if (!is_daemon_token_shaped(WRONG_DAEMON_TOKEN_VALUE)) {
139
+ throw new Error('conformance: WRONG_DAEMON_TOKEN_VALUE must be daemon-token-shaped');
140
+ }
141
+ if (!is_api_token_shaped(UNKNOWN_BEARER_TOKEN_VALUE)) {
142
+ throw new Error('conformance: UNKNOWN_BEARER_TOKEN_VALUE must be api-token-shaped');
143
+ }
144
+ /**
145
+ * The keeper's session cookie with its MAC corrupted: the first character of
146
+ * the signature (after the last `.`) changed, so the signature keeps its
147
+ * shape and the keyring refuses it on the compare, not the shape check.
148
+ */
149
+ const tamper_session_cookie = (cookie) => {
150
+ const dot = cookie.lastIndexOf('.');
151
+ const first = cookie[dot + 1];
152
+ if (dot === -1 || first === undefined) {
153
+ throw new Error(`conformance: principal 'tampered_cookie' found no signed session cookie`);
154
+ }
155
+ return `${cookie.slice(0, dot + 1)}${first === 'A' ? 'B' : 'A'}${cookie.slice(dot + 2)}`;
156
+ };
157
+ /** A dead bearer presented alone: no cookie, no `Origin`, so the token is looked up. */
158
+ const as_lone_bearer = (fixture, token) => ({
159
+ transport: fixture.fresh_transport({ origin: null }),
160
+ headers: { authorization: `Bearer ${token}` },
161
+ suppress_default_origin: true
162
+ });
108
163
  /**
109
164
  * Mint the `scoped_token` principal's narrowed bearer token over the
110
165
  * production `account_token_create` path.
@@ -137,9 +192,11 @@ const mint_scoped_token = async (fixture, resolved_rpc_endpoints) => {
137
192
  * Map a `ConformancePrincipal` onto the transport + headers it
138
193
  * authenticates with, reading exclusively from the per-test `TestFixture`.
139
194
  *
140
- * The five always-available principals resolve from fixture accessors;
141
- * `role_holder` / `wrong_role` read a seeded `extra_accounts` entry named
142
- * via `options.principals` (throws a clear setup error when unconfigured);
195
+ * The always-available principals resolve from fixture accessors (the dead
196
+ * credentials that need a server-side state — a revoked session or token, an
197
+ * expired token — from the fixture's `mint_*` seams); `role_holder` /
198
+ * `wrong_role` read a seeded `extra_accounts` entry named via
199
+ * `options.principals` (throws a clear setup error when unconfigured);
143
200
  * `scoped_token` mints its narrowed credential over the production path.
144
201
  * Also used outside the table by suites that send a principal's requests
145
202
  * themselves (`describe_rpc_adversarial_cross_tests`).
@@ -274,6 +331,34 @@ export const resolve_conformance_principal = async (fixture, as, principals, res
274
331
  actor_id: fixture.actor.id
275
332
  };
276
333
  }
334
+ case 'tampered_cookie': {
335
+ // fresh jar, so the tampered cookie is the only one sent
336
+ const { cookie } = fixture.create_session_headers();
337
+ if (!cookie)
338
+ throw new Error(`conformance: principal 'tampered_cookie' found no cookie`);
339
+ return {
340
+ transport: fixture.fresh_transport(),
341
+ headers: { cookie: tamper_session_cookie(cookie) }
342
+ };
343
+ }
344
+ case 'wrong_daemon':
345
+ // no Origin, so the token reaches the compare, not the browser-context discard
346
+ return {
347
+ transport: fixture.fresh_transport({ origin: null }),
348
+ headers: { [DAEMON_TOKEN_HEADER]: WRONG_DAEMON_TOKEN_VALUE },
349
+ suppress_default_origin: true
350
+ };
351
+ case 'unknown_bearer':
352
+ return as_lone_bearer(fixture, UNKNOWN_BEARER_TOKEN_VALUE);
353
+ case 'revoked_session':
354
+ return {
355
+ transport: fixture.fresh_transport(),
356
+ headers: { cookie: await fixture.mint_revoked_session() }
357
+ };
358
+ case 'revoked_token':
359
+ return as_lone_bearer(fixture, await fixture.mint_revoked_token());
360
+ case 'expired_token':
361
+ return as_lone_bearer(fixture, await fixture.mint_expired_token());
277
362
  case 'role_holder':
278
363
  case 'wrong_role': {
279
364
  const username = principals?.[as];
@@ -299,7 +384,9 @@ const assert_fields = (actual, fields, label) => {
299
384
  assert.ok(actual !== null && typeof actual === 'object', `${label}: expected an object to read fields from, got ${JSON.stringify(actual)}`);
300
385
  const record = actual;
301
386
  for (const [key, expected] of Object.entries(fields)) {
302
- assert.deepEqual(record[key], expected, `${label}: field '${key}'`);
387
+ // the actual value in the message: chai truncates the values it prints,
388
+ // and an `xfail` row's `fails_with` reads the message
389
+ assert.deepEqual(record[key], expected, `${label}: field '${key}' is ${JSON.stringify(record[key])}`);
303
390
  }
304
391
  };
305
392
  /**
@@ -377,6 +464,33 @@ const assert_response_headers = (headers, c) => {
377
464
  assert_expected_headers(headers, c.expect.headers, c.name);
378
465
  };
379
466
  const is_success_status = (status) => status >= 200 && status < 300;
467
+ /**
468
+ * Assert a response's session cookie lines against the row's
469
+ * `expect.set_cookie` (omitted, `'none'`), by the classification both the
470
+ * runner and the differential read (`classify_session_cookie_effect`) — the
471
+ * assertion that decides a row.
472
+ *
473
+ * Ahead of it runs the floor: a response that is not 2xx mints no session
474
+ * cookie (`find_session_cookie_mints`, which reads a mint in any shape). It is
475
+ * a backstop, not a second guarantee: `check_conformance_cases` refuses a
476
+ * non-2xx row expecting a mint, so on a row the table collected, a refusal
477
+ * that mints already fails the effect assertion. The floor names the cause
478
+ * plainly when it does, and holds for a caller asserting a row the collection
479
+ * never saw.
480
+ *
481
+ * @param sent - the response, with every `Set-Cookie` line
482
+ * @param c - the case
483
+ * @param cookie_name - the session cookie's name
484
+ */
485
+ export const assert_session_cookie = (sent, c, cookie_name) => {
486
+ if (!is_success_status(sent.status)) {
487
+ const mints = find_session_cookie_mints(sent.set_cookies, cookie_name);
488
+ assert.ok(mints.length === 0, `${c.name}: a ${sent.status} refusal minted a session cookie — ${JSON.stringify(mints)}`);
489
+ }
490
+ const expected = c.expect.set_cookie ?? 'none';
491
+ const actual = classify_session_cookie_effect(sent.set_cookies, cookie_name);
492
+ assert.strictEqual(actual, expected, `${c.name}: session cookie effect (its Set-Cookie lines: ${JSON.stringify(filter_session_set_cookies(sent.set_cookies, cookie_name))})`);
493
+ };
380
494
  /**
381
495
  * Resolve a case's principal on `fixture` and send its request, asserting
382
496
  * nothing about the response.
@@ -434,6 +548,7 @@ export const send_conformance_case = async (c, options) => {
434
548
  target: { kind: 'rest', route },
435
549
  status: response.status,
436
550
  headers: headers_to_record(response.headers),
551
+ set_cookies: response.headers.getSetCookie(),
437
552
  body
438
553
  };
439
554
  }
@@ -513,7 +628,7 @@ const send_ws_frame = async (method, params, params_json, principal, ws) => {
513
628
  : typeof code === 'number'
514
629
  ? jsonrpc_error_code_to_http_status(code)
515
630
  : 500;
516
- return { status, headers: {}, body };
631
+ return { status, headers: {}, set_cookies: [], body };
517
632
  }
518
633
  finally {
519
634
  await client.close().catch(() => { });
@@ -571,6 +686,9 @@ const run_case = async (c, options, resolved_rpc_endpoints) => {
571
686
  ...(options.ws && { ws: options.ws })
572
687
  });
573
688
  assert_response_headers(sent.headers, c);
689
+ // a frame carries no headers, so the cookie assertions are the HTTP legs'
690
+ if (!options.ws)
691
+ assert_session_cookie(sent, c, options.session_options.cookie_name);
574
692
  const normalized = sent.target.kind === 'rest'
575
693
  ? assert_rest_case(c, sent.target.route, sent)
576
694
  : assert_rpc_case(c, sent.target.action, sent);
@@ -595,15 +713,16 @@ const assert_rpc_case = (c, action, sent) => {
595
713
  return { status: res.status, body: res.result };
596
714
  }
597
715
  assert.ok(!res.ok, `${c.name}: expected error status ${c.expect.status} but got success`);
598
- assert.strictEqual(res.status, c.expect.status, `${c.name}: error status`);
599
- if (c.expect.error_reason !== undefined) {
600
- // A row that *declares* a reason must carry it — present AND equal —
601
- // mirroring the REST branch's unconditional `body.error` assertion. The
602
- // earlier skip-if-absent form let a backend that dropped the reason pass
603
- // a row declaring one, blessing a reason/forensic-parity divergence (the
604
- // IDOR-mask / privilege reason is exactly the distinguishing bit). Rows
605
- // whose denial genuinely has no reason (the bare `unauthenticated()` 401)
606
- // simply omit `error_reason` and are pinned by `status` above.
716
+ assert.strictEqual(res.status, c.expect.status, `${c.name}: error status (error ${JSON.stringify(res.error)})`);
717
+ // the code, not just the status it answers: several codes share a status
718
+ assert.strictEqual(res.error.code, c.expect.error_code ?? http_status_to_jsonrpc_error_code(c.expect.status), `${c.name}: error.code (error ${JSON.stringify(res.error)})`);
719
+ if (c.expect.error_reason === null) {
720
+ const { data } = res.error;
721
+ assert.ok(!(data !== null && typeof data === 'object' && Object.hasOwn(data, 'reason')), `${c.name}: error.data.reason expected absent, got ${JSON.stringify(data)}`);
722
+ }
723
+ else if (c.expect.error_reason !== undefined) {
724
+ // present AND equal: a backend that dropped the reason must not pass a row
725
+ // declaring one — the reason is the distinguishing bit of a mask
607
726
  const reason = res.error.data?.reason;
608
727
  assert.strictEqual(reason, c.expect.error_reason, `${c.name}: error.data.reason`);
609
728
  }
@@ -614,7 +733,7 @@ const assert_rpc_case = (c, action, sent) => {
614
733
  /** Assert a case targeting one of the 6 REST auth routes. */
615
734
  const assert_rest_case = (c, route, sent) => {
616
735
  const { status, body } = sent;
617
- assert.strictEqual(status, c.expect.status, `${c.name}: status`);
736
+ assert.strictEqual(status, c.expect.status, `${c.name}: status (body ${JSON.stringify(body)})`);
618
737
  if (is_success_status(c.expect.status)) {
619
738
  const parsed = parse(route.output, body);
620
739
  assert.ok(parsed.ok, `${c.name}: body does not match route output: ${JSON.stringify(parsed.ok ? undefined : parsed.issues)}`);
@@ -627,6 +746,42 @@ const assert_rest_case = (c, route, sent) => {
627
746
  assert_fields(body, c.expect.fields, c.name);
628
747
  return { status, body };
629
748
  };
749
+ /**
750
+ * Refuse the rows a table can't honestly run, before any is sent, each throw
751
+ * naming the case:
752
+ *
753
+ * - a REST row pinning `error_reason: null` — a REST error body always names
754
+ * its code in `error`, so the row pins that code instead;
755
+ * - a REST row setting `error_code`, which only a JSON-RPC envelope carries;
756
+ * - a row whose status is not 2xx expecting the session cookie minted
757
+ * (`set_cookie` `'set'` or `'clear_then_set'`) — no refusal may mint one,
758
+ * so the row contradicts the floor `assert_session_cookie` holds every
759
+ * response to.
760
+ *
761
+ * `describe_conformance_table_tests` runs it at collection.
762
+ *
763
+ * @param cases - the cases a table would run
764
+ * @throws Error naming the first case that can't be written
765
+ */
766
+ export const check_conformance_cases = (cases) => {
767
+ for (const c of cases) {
768
+ const rest = c.request.method.startsWith('/');
769
+ if (rest && c.expect.error_reason === null) {
770
+ throw new Error(`conformance: case '${c.name}' pins error_reason null on a REST route, whose error ` +
771
+ `body always names its code in \`error\` — pin the code instead.`);
772
+ }
773
+ if (rest && c.expect.error_code !== undefined) {
774
+ throw new Error(`conformance: case '${c.name}' sets error_code on a REST route, whose error body ` +
775
+ `carries no JSON-RPC code — pin error_reason instead.`);
776
+ }
777
+ const set_cookie = c.expect.set_cookie ?? 'none';
778
+ if (!is_success_status(c.expect.status) &&
779
+ (set_cookie === 'set' || set_cookie === 'clear_then_set')) {
780
+ throw new Error(`conformance: case '${c.name}' expects a ${c.expect.status} that mints the session ` +
781
+ `cookie (set_cookie '${set_cookie}') — no refusal may mint one.`);
782
+ }
783
+ }
784
+ };
630
785
  /**
631
786
  * Register a `describe` block running every `ConformanceCase` as a
632
787
  * vitest `test` (or `xfail_until` for deferred-by-design rows). Drives
@@ -641,6 +796,7 @@ export const describe_conformance_table_tests = (options) => {
641
796
  // the group assertions execute last, after every member has recorded.
642
797
  const equivalence_groups = new Map();
643
798
  const cases = options.ws ? options.cases.filter(is_ws_conformance_case) : options.cases;
799
+ check_conformance_cases(options.cases);
644
800
  const group_sizes = new Map();
645
801
  for (const c of cases) {
646
802
  const group = c.expect.equivalence_group;
@@ -664,7 +820,7 @@ export const describe_conformance_table_tests = (options) => {
664
820
  }
665
821
  };
666
822
  if (c.xfail) {
667
- xfail_until(c.xfail.tracking_id, c.xfail.reason, label, body);
823
+ xfail_until(c.xfail, label, body);
668
824
  }
669
825
  else {
670
826
  test(label, body);
@@ -13,7 +13,7 @@ import '../assert_dev_env.js';
13
13
  * legitimately differs per request and per impl), so the attribute contract
14
14
  * had no cross-backend pin: the TS spine's attributes were covered by
15
15
  * `session_cookie.ts`'s own tests, but the Rust spine's `sign_session_cookie`
16
- * / `clear_session_cookie` strings were asserted nowhere. This suite closes
16
+ * / `format_session_clear_cookie` strings were asserted nowhere. This suite closes
17
17
  * that gap on both impls by parsing the raw `Set-Cookie` and asserting the
18
18
  * attributes directly. Three properties:
19
19
  *
@@ -56,9 +56,15 @@ export interface DualSpawnGlobalSetupOptions {
56
56
  readonly a: string;
57
57
  readonly b: string;
58
58
  };
59
+ /**
60
+ * Run against each backend once it is healthy and before its keeper
61
+ * bootstrap — `bootstrap_backend`'s `before_bootstrap`, for a probe of the
62
+ * pre-bootstrap window. Omit for none.
63
+ */
64
+ readonly before_bootstrap?: (config: BackendConfig) => Promise<void>;
59
65
  }
60
66
  /**
61
67
  * Build a vitest `globalSetup` default export that spawns both backends.
62
68
  */
63
- export declare const create_dual_spawn_global_setup: ({ configs, provide_keys }: DualSpawnGlobalSetupOptions) => ((project: TestProject) => Promise<() => Promise<void>>);
69
+ export declare const create_dual_spawn_global_setup: ({ configs, provide_keys, before_bootstrap }: DualSpawnGlobalSetupOptions) => ((project: TestProject) => Promise<() => Promise<void>>);
64
70
  //# sourceMappingURL=create_dual_spawn_global_setup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create_dual_spawn_global_setup.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/create_dual_spawn_global_setup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIzD,MAAM,WAAW,2BAA2B;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,aAAa,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,aAAa,CAAA;KAAE,CAAC;IACvF;;;;;;OAMG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACnE;AAED;;GAEG;AACH,eAAO,MAAM,8BAA8B,GAAI,2BAG5C,2BAA2B,KAAG,CAAC,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAmBvF,CAAC"}
1
+ {"version":3,"file":"create_dual_spawn_global_setup.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/create_dual_spawn_global_setup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIzD,MAAM,WAAW,2BAA2B;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,aAAa,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,aAAa,CAAA;KAAE,CAAC;IACvF;;;;;;OAMG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrE;AAED;;GAEG;AACH,eAAO,MAAM,8BAA8B,GAAI,6CAI5C,2BAA2B,KAAG,CAAC,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAmBvF,CAAC"}
@@ -4,13 +4,13 @@ import { serialize_bootstrapped_handle } from './setup.js';
4
4
  /**
5
5
  * Build a vitest `globalSetup` default export that spawns both backends.
6
6
  */
7
- export const create_dual_spawn_global_setup = ({ configs, provide_keys = { a: 'parity_handle_a', b: 'parity_handle_b' } }) => {
7
+ export const create_dual_spawn_global_setup = ({ configs, provide_keys = { a: 'parity_handle_a', b: 'parity_handle_b' }, before_bootstrap }) => {
8
8
  return async (project) => {
9
- const a = await bootstrap_backend(configs.a());
9
+ const a = await bootstrap_backend(configs.a(), { before_bootstrap });
10
10
  // Tear `a` down if `b` fails to spawn — no orphaned child process.
11
11
  let b;
12
12
  try {
13
- b = await bootstrap_backend(configs.b());
13
+ b = await bootstrap_backend(configs.b(), { before_bootstrap });
14
14
  }
15
15
  catch (err) {
16
16
  await a.teardown();
@@ -0,0 +1,196 @@
1
+ import '../assert_dev_env.js';
2
+ import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
3
+ import { type Keyring } from '../../auth/keyring.js';
4
+ import type { SetupTest } from './setup.js';
5
+ import { TestingCredentialReadOutput } from './testing_credential_read.js';
6
+ /**
7
+ * A read row: header lines, each leg's reading of them, and the observable
8
+ * outcome of a request carrying them.
9
+ */
10
+ export declare const CredentialConformanceRow: import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
11
+ name: import("@fuzdev/fuz_schema/schema.ts").StringSchema;
12
+ lines: import("@fuzdev/fuz_schema/schema.ts").ArraySchema<import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
13
+ read: import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
14
+ session_cookie: import("@fuzdev/fuz_schema/schema.ts").OneOfSchema<readonly ["absent", "invalid", "valid"]>;
15
+ bearer_token: import("@fuzdev/fuz_schema/schema.ts").NullableSchema<import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
16
+ daemon_token: import("@fuzdev/fuz_schema/schema.ts").NullableSchema<import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
17
+ }>;
18
+ /** The credential that authenticates the request, `null` when none does. */
19
+ authenticates: import("@fuzdev/fuz_schema/schema.ts").NullableSchema<import("@fuzdev/fuz_schema/schema.ts").OneOfSchema<readonly ["session", "api_token", "daemon_token"]>>;
20
+ /** Whether the response carries the clearing session `Set-Cookie`. */
21
+ clears_session_cookie: import("@fuzdev/fuz_schema/schema.ts").BooleanSchema;
22
+ note: import("@fuzdev/fuz_schema/schema.ts").OptionalSchema<import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
23
+ }>;
24
+ export type CredentialConformanceRow = Infer<typeof CredentialConformanceRow>;
25
+ /** A refused row: lines `_testing_credential_read` refuses — no header lines, or past its caps. */
26
+ export declare const CredentialConformanceRefusedRow: import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
27
+ name: import("@fuzdev/fuz_schema/schema.ts").StringSchema;
28
+ lines: import("@fuzdev/fuz_schema/schema.ts").ArraySchema<import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
29
+ reason: import("@fuzdev/fuz_schema/schema.ts").LiteralSchema<"invalid_header_line">;
30
+ note: import("@fuzdev/fuz_schema/schema.ts").OptionalSchema<import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
31
+ }>;
32
+ export type CredentialConformanceRefusedRow = Infer<typeof CredentialConformanceRefusedRow>;
33
+ /** The conformance table, a `@fuzdev/fuz_schema` `object`. */
34
+ export declare const CredentialConformance: import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
35
+ rows: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<{
36
+ name: string;
37
+ lines: string[];
38
+ read: {
39
+ session_cookie: "invalid" | "absent" | "valid";
40
+ bearer_token: string | null;
41
+ daemon_token: string | null;
42
+ };
43
+ authenticates: "session" | "api_token" | "daemon_token" | null;
44
+ clears_session_cookie: boolean;
45
+ note?: string | undefined;
46
+ }[], import("@fuzdev/fuz_schema/schema.ts").ArraySchema<import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
47
+ name: import("@fuzdev/fuz_schema/schema.ts").StringSchema;
48
+ lines: import("@fuzdev/fuz_schema/schema.ts").ArraySchema<import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
49
+ read: import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
50
+ session_cookie: import("@fuzdev/fuz_schema/schema.ts").OneOfSchema<readonly ["absent", "invalid", "valid"]>;
51
+ bearer_token: import("@fuzdev/fuz_schema/schema.ts").NullableSchema<import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
52
+ daemon_token: import("@fuzdev/fuz_schema/schema.ts").NullableSchema<import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
53
+ }>;
54
+ /** The credential that authenticates the request, `null` when none does. */
55
+ authenticates: import("@fuzdev/fuz_schema/schema.ts").NullableSchema<import("@fuzdev/fuz_schema/schema.ts").OneOfSchema<readonly ["session", "api_token", "daemon_token"]>>;
56
+ /** Whether the response carries the clearing session `Set-Cookie`. */
57
+ clears_session_cookie: import("@fuzdev/fuz_schema/schema.ts").BooleanSchema;
58
+ note: import("@fuzdev/fuz_schema/schema.ts").OptionalSchema<import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
59
+ }>>>;
60
+ refused: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<{
61
+ name: string;
62
+ lines: string[];
63
+ reason: "invalid_header_line";
64
+ note?: string | undefined;
65
+ }[], import("@fuzdev/fuz_schema/schema.ts").ArraySchema<import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
66
+ name: import("@fuzdev/fuz_schema/schema.ts").StringSchema;
67
+ lines: import("@fuzdev/fuz_schema/schema.ts").ArraySchema<import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
68
+ reason: import("@fuzdev/fuz_schema/schema.ts").LiteralSchema<"invalid_header_line">;
69
+ note: import("@fuzdev/fuz_schema/schema.ts").OptionalSchema<import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
70
+ }>>>;
71
+ }>;
72
+ export type CredentialConformance = Infer<typeof CredentialConformance>;
73
+ /** The committed table, resolved relative to this module. */
74
+ export declare const CREDENTIAL_CONFORMANCE_URL: URL;
75
+ /**
76
+ * Read and validate the committed conformance table.
77
+ *
78
+ * @returns the parsed table
79
+ * @throws Error when the file doesn't match `CredentialConformance`
80
+ */
81
+ export declare const load_credential_conformance: () => CredentialConformance;
82
+ /** The placeholder names a row may use, each written `{name}` in the table. */
83
+ export declare const CREDENTIAL_CONFORMANCE_PLACEHOLDERS: readonly ["cookie_name", "cookie_name_upper", "session_cookie", "session_cookie_percent_encoded", "session_cookie_bad_mac", "session_cookie_expired", "session_cookie_empty_identity", "session_cookie_rowless", "api_token", "daemon_token"];
84
+ /** A placeholder name — see `CREDENTIAL_CONFORMANCE_PLACEHOLDERS`. */
85
+ export type CredentialConformancePlaceholder = (typeof CREDENTIAL_CONFORMANCE_PLACEHOLDERS)[number];
86
+ /** The value each placeholder takes on one leg. */
87
+ export type CredentialConformancePlaceholders = Readonly<Record<CredentialConformancePlaceholder, string>>;
88
+ /** What `build_credential_conformance_placeholders` builds the values from. */
89
+ export interface CredentialConformancePlaceholderInput {
90
+ /** The session cookie's name. */
91
+ readonly cookie_name: string;
92
+ /**
93
+ * A signed session cookie value the reader's keyring verifies — on a live
94
+ * backend, one whose `auth_session` row exists.
95
+ */
96
+ readonly session_cookie: string;
97
+ /** A well-formed API token — on a live backend, one that authenticates. */
98
+ readonly api_token: string;
99
+ /** A well-formed daemon token — on a live backend, the keeper's. */
100
+ readonly daemon_token: string;
101
+ /** The keyring the reader verifies with, to sign the other cookie spellings. */
102
+ readonly keyring: Keyring;
103
+ }
104
+ /**
105
+ * Build one leg's placeholder values: the given live credentials, and the
106
+ * cookie spellings derived from them or signed with the reader's keyring.
107
+ *
108
+ * - `session_cookie_percent_encoded` — `encodeURIComponent` of the valid
109
+ * cookie, what a framework's cookie serializer writes;
110
+ * - `session_cookie_bad_mac` — the valid cookie with its signature's first
111
+ * character changed;
112
+ * - `session_cookie_expired` — a signed payload whose expiry is an hour gone;
113
+ * - `session_cookie_empty_identity` — a signed payload with no identity;
114
+ * - `session_cookie_rowless` — a signed, unexpired payload naming a session
115
+ * token no row holds.
116
+ *
117
+ * @param input - the live credentials and the keyring
118
+ * @returns the value of every placeholder
119
+ * @throws Error when a derived spelling would equal the valid cookie, which would make its row vacuous
120
+ */
121
+ export declare const build_credential_conformance_placeholders: (input: CredentialConformancePlaceholderInput) => Promise<CredentialConformancePlaceholders>;
122
+ /**
123
+ * Fill a table string's `{placeholders}`.
124
+ *
125
+ * @param text - a header line or an expected token
126
+ * @param placeholders - the leg's values
127
+ * @returns `text` with each placeholder replaced
128
+ * @throws Error on a `{name}` that is no known placeholder
129
+ */
130
+ export declare const fill_credential_conformance_placeholders: (text: string, placeholders: CredentialConformancePlaceholders) => string;
131
+ /** One read row with its placeholders filled. */
132
+ export interface CredentialConformanceCheck {
133
+ /** The row's name, for a failure message. */
134
+ readonly label: string;
135
+ /** The row as the table states it. */
136
+ readonly row: CredentialConformanceRow;
137
+ /** The row's lines, filled. */
138
+ readonly lines: Array<string>;
139
+ /** The row's `read`, its tokens filled. */
140
+ readonly expected: TestingCredentialReadOutput;
141
+ }
142
+ /**
143
+ * Fill every read row's lines and expected tokens.
144
+ *
145
+ * @param table - the conformance table
146
+ * @param placeholders - the leg's values
147
+ * @returns one check per read row, in table order
148
+ */
149
+ export declare const to_credential_conformance_checks: (table: CredentialConformance, placeholders: CredentialConformancePlaceholders) => Array<CredentialConformanceCheck>;
150
+ /**
151
+ * Compare each check's reading with its expectation and fail once, listing
152
+ * every row that disagrees. Tokens are named by placeholder in the message,
153
+ * never printed.
154
+ *
155
+ * @param checks - the table's checks
156
+ * @param answers - the reading each check got, in order
157
+ * @param backend - the name the failure message gives the answerer
158
+ */
159
+ export declare const assert_credential_conformance: (checks: ReadonlyArray<CredentialConformanceCheck>, answers: ReadonlyArray<unknown>, backend: string) => void;
160
+ /** Options for `describe_credential_conformance_cross_tests`. */
161
+ export interface CredentialConformanceCrossTestOptions {
162
+ /** Per-test fixture producer (cross-process). */
163
+ readonly setup_test: SetupTest;
164
+ /** The spine's session cookie name (`handle.config.cookie_name`). */
165
+ readonly cookie_name: string;
166
+ /**
167
+ * The backend's `SECRET_FUZ_COOKIE_KEYS` value
168
+ * (`handle.config.env.SECRET_FUZ_COOKIE_KEYS`) — the suite signs the cookie
169
+ * spellings the table names with its primary key.
170
+ */
171
+ readonly cookie_keys: string;
172
+ /** A valid daemon token (keeper) — `handle.daemon_token`. */
173
+ readonly daemon_token: string;
174
+ /** JSON-RPC endpoint path. Default `SPINE_RPC_PATH`. */
175
+ readonly rpc_path?: string;
176
+ }
177
+ /**
178
+ * Build the keyring a backend verifies cookies with, from its
179
+ * `SECRET_FUZ_COOKIE_KEYS` value.
180
+ *
181
+ * @param cookie_keys - the backend's `SECRET_FUZ_COOKIE_KEYS`
182
+ * @throws Error when the value is no valid keyring
183
+ */
184
+ export declare const create_credential_conformance_keyring: (cookie_keys: string) => Keyring;
185
+ /**
186
+ * Register the credential conformance suite: every row of the committed
187
+ * table, sent to the backend's `_testing_credential_read` action over the
188
+ * keeper's daemon-token channel, must get the reading the table names, and
189
+ * every refused row the `invalid_params` refusal with its reason. The suite
190
+ * skips itself on a backend that doesn't declare the action.
191
+ *
192
+ * The lines travel as JSON strings, each character one byte, so a row with a
193
+ * non-ASCII byte reaches the action as it would reach a handler.
194
+ */
195
+ export declare const describe_credential_conformance_cross_tests: (options: CredentialConformanceCrossTestOptions) => void;
196
+ //# sourceMappingURL=credential_conformance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential_conformance.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/credential_conformance.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA+C9B,OAAO,EAaN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAEzD,OAAO,EAEN,2BAA2B,EAE3B,MAAM,8BAA8B,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;IAIpC,4EAA4E;;IAE5E,sEAAsE;;;EAGrE,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE9E,mGAAmG;AACnG,eAAO,MAAM,+BAA+B;;;;;EAK1C,CAAC;AACH,MAAM,MAAM,+BAA+B,GAAG,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAE5F,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;QAlBjC,4EAA4E;;QAE5E,sEAAsE;;;;;;;;;;;;;;;EAmBrE,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAExE,6DAA6D;AAC7D,eAAO,MAAM,0BAA0B,EAAE,GAGxC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,QAAO,qBAI7C,CAAC;AAEH,+EAA+E;AAC/E,eAAO,MAAM,mCAAmC,+OAWtC,CAAC;AAEX,sEAAsE;AACtE,MAAM,MAAM,gCAAgC,GAAG,CAAC,OAAO,mCAAmC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpG,mDAAmD;AACnD,MAAM,MAAM,iCAAiC,GAAG,QAAQ,CACvD,MAAM,CAAC,gCAAgC,EAAE,MAAM,CAAC,CAChD,CAAC;AAEF,+EAA+E;AAC/E,MAAM,WAAW,qCAAqC;IACrD,iCAAiC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,2EAA2E;IAC3E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oEAAoE;IACpE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC1B;AAUD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,yCAAyC,GACrD,OAAO,qCAAqC,KAC1C,OAAO,CAAC,iCAAiC,CAsB3C,CAAC;AAIF;;;;;;;GAOG;AACH,eAAO,MAAM,wCAAwC,GACpD,MAAM,MAAM,EACZ,cAAc,iCAAiC,KAC7C,MAMA,CAAC;AAEJ,iDAAiD;AACjD,MAAM,WAAW,0BAA0B;IAC1C,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,QAAQ,CAAC,GAAG,EAAE,wBAAwB,CAAC;IACvC,+BAA+B;IAC/B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,EAAE,2BAA2B,CAAC;CAC/C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,GAC5C,OAAO,qBAAqB,EAC5B,cAAc,iCAAiC,KAC7C,KAAK,CAAC,0BAA0B,CAchC,CAAC;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,GACzC,QAAQ,aAAa,CAAC,0BAA0B,CAAC,EACjD,SAAS,aAAa,CAAC,OAAO,CAAC,EAC/B,SAAS,MAAM,KACb,IAiBF,CAAC;AAeF,iEAAiE;AACjE,MAAM,WAAW,qCAAqC;IACrD,iDAAiD;IACjD,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,qEAAqE;IACrE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC,GAAI,aAAa,MAAM,KAAG,OAM3E,CAAC;AAyBF;;;;;;;;;GASG;AACH,eAAO,MAAM,2CAA2C,GACvD,SAAS,qCAAqC,KAC5C,IAkDF,CAAC"}