@fuzdev/fuz_app 0.180.0 → 0.182.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (389) hide show
  1. package/dist/actions/CLAUDE.md +38 -20
  2. package/dist/actions/action_rpc.d.ts +25 -6
  3. package/dist/actions/action_rpc.d.ts.map +1 -1
  4. package/dist/actions/action_rpc.js +56 -48
  5. package/dist/actions/action_types.d.ts +31 -13
  6. package/dist/actions/action_types.d.ts.map +1 -1
  7. package/dist/actions/action_types.js +1 -1
  8. package/dist/actions/notification_sender.d.ts +83 -0
  9. package/dist/actions/notification_sender.d.ts.map +1 -0
  10. package/dist/actions/notification_sender.js +85 -0
  11. package/dist/actions/perform_action.d.ts +13 -4
  12. package/dist/actions/perform_action.d.ts.map +1 -1
  13. package/dist/actions/perform_action.js +27 -18
  14. package/dist/actions/register_action_ws.d.ts +20 -2
  15. package/dist/actions/register_action_ws.d.ts.map +1 -1
  16. package/dist/actions/register_action_ws.js +17 -5
  17. package/dist/actions/ws_socket_session.d.ts +3 -0
  18. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  19. package/dist/actions/ws_socket_session.js +3 -2
  20. package/dist/auth/CLAUDE.md +84 -59
  21. package/dist/auth/account_actions.d.ts.map +1 -1
  22. package/dist/auth/account_actions.js +30 -3
  23. package/dist/auth/account_queries.d.ts +213 -2
  24. package/dist/auth/account_queries.d.ts.map +1 -1
  25. package/dist/auth/account_queries.js +255 -2
  26. package/dist/auth/account_route_schema.d.ts +26 -16
  27. package/dist/auth/account_route_schema.d.ts.map +1 -1
  28. package/dist/auth/account_route_schema.js +10 -24
  29. package/dist/auth/account_routes.d.ts +5 -7
  30. package/dist/auth/account_routes.d.ts.map +1 -1
  31. package/dist/auth/account_routes.js +110 -89
  32. package/dist/auth/admin_actions.d.ts.map +1 -1
  33. package/dist/auth/admin_actions.js +117 -25
  34. package/dist/auth/api_token_queries.d.ts +29 -12
  35. package/dist/auth/api_token_queries.d.ts.map +1 -1
  36. package/dist/auth/api_token_queries.js +42 -27
  37. package/dist/auth/audit_log_route_schema.d.ts +1 -1
  38. package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
  39. package/dist/auth/audit_log_routes.d.ts +1 -1
  40. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  41. package/dist/auth/audit_log_routes.js +10 -12
  42. package/dist/auth/audit_log_schema.js +4 -4
  43. package/dist/auth/bearer_auth.d.ts +4 -3
  44. package/dist/auth/bearer_auth.d.ts.map +1 -1
  45. package/dist/auth/bearer_auth.js +37 -32
  46. package/dist/auth/bootstrap_account.d.ts +65 -37
  47. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  48. package/dist/auth/bootstrap_account.js +115 -66
  49. package/dist/auth/bootstrap_route_schema.d.ts +6 -2
  50. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  51. package/dist/auth/bootstrap_route_schema.js +7 -2
  52. package/dist/auth/bootstrap_routes.d.ts +50 -33
  53. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  54. package/dist/auth/bootstrap_routes.js +109 -87
  55. package/dist/auth/bootstrap_token_store.d.ts +60 -0
  56. package/dist/auth/bootstrap_token_store.d.ts.map +1 -0
  57. package/dist/auth/bootstrap_token_store.js +39 -0
  58. package/dist/auth/credential_headers.d.ts +71 -0
  59. package/dist/auth/credential_headers.d.ts.map +1 -0
  60. package/dist/auth/credential_headers.js +100 -0
  61. package/dist/auth/daemon_token.d.ts +13 -1
  62. package/dist/auth/daemon_token.d.ts.map +1 -1
  63. package/dist/auth/daemon_token.js +14 -2
  64. package/dist/auth/daemon_token_middleware.d.ts +10 -11
  65. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  66. package/dist/auth/daemon_token_middleware.js +39 -30
  67. package/dist/auth/deps.d.ts +10 -11
  68. package/dist/auth/deps.d.ts.map +1 -1
  69. package/dist/auth/invite_queries.d.ts +18 -0
  70. package/dist/auth/invite_queries.d.ts.map +1 -1
  71. package/dist/auth/invite_queries.js +24 -0
  72. package/dist/auth/request_context.d.ts +97 -76
  73. package/dist/auth/request_context.d.ts.map +1 -1
  74. package/dist/auth/request_context.js +93 -104
  75. package/dist/auth/resolved_auth.d.ts +10 -5
  76. package/dist/auth/resolved_auth.d.ts.map +1 -1
  77. package/dist/auth/resolved_auth.js +2 -2
  78. package/dist/auth/role_grant_offer_action_specs.d.ts +2 -2
  79. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  80. package/dist/auth/role_grant_offer_action_specs.js +5 -3
  81. package/dist/auth/role_grant_offer_actions.d.ts +7 -11
  82. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  83. package/dist/auth/role_grant_offer_actions.js +97 -106
  84. package/dist/auth/role_grant_offer_ddl.d.ts +7 -1
  85. package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
  86. package/dist/auth/role_grant_offer_ddl.js +9 -2
  87. package/dist/auth/role_grant_offer_notifications.d.ts +87 -38
  88. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  89. package/dist/auth/role_grant_offer_notifications.js +75 -22
  90. package/dist/auth/role_grant_offer_queries.d.ts +143 -9
  91. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  92. package/dist/auth/role_grant_offer_queries.js +266 -66
  93. package/dist/auth/role_grant_offer_schema.js +1 -1
  94. package/dist/auth/role_grant_queries.d.ts +57 -10
  95. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  96. package/dist/auth/role_grant_queries.js +81 -22
  97. package/dist/auth/role_grant_sql.d.ts +21 -0
  98. package/dist/auth/role_grant_sql.d.ts.map +1 -1
  99. package/dist/auth/role_grant_sql.js +21 -0
  100. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  101. package/dist/auth/self_service_role_actions.js +9 -2
  102. package/dist/auth/session_cookie.d.ts +105 -25
  103. package/dist/auth/session_cookie.d.ts.map +1 -1
  104. package/dist/auth/session_cookie.js +124 -15
  105. package/dist/auth/session_middleware.d.ts +83 -54
  106. package/dist/auth/session_middleware.d.ts.map +1 -1
  107. package/dist/auth/session_middleware.js +92 -66
  108. package/dist/auth/session_queries.d.ts +95 -14
  109. package/dist/auth/session_queries.d.ts.map +1 -1
  110. package/dist/auth/session_queries.js +98 -19
  111. package/dist/auth/signup_route_schema.d.ts +5 -5
  112. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  113. package/dist/auth/signup_route_schema.js +4 -4
  114. package/dist/auth/signup_routes.d.ts.map +1 -1
  115. package/dist/auth/signup_routes.js +17 -14
  116. package/dist/auth/standard_rpc_actions.d.ts +6 -19
  117. package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
  118. package/dist/auth/standard_rpc_actions.js +5 -6
  119. package/dist/auth/token_scope.d.ts +6 -8
  120. package/dist/auth/token_scope.d.ts.map +1 -1
  121. package/dist/auth/token_scope.js +6 -9
  122. package/dist/dev/setup.d.ts +6 -1
  123. package/dist/dev/setup.d.ts.map +1 -1
  124. package/dist/dev/setup.js +42 -34
  125. package/dist/hono_context.d.ts +21 -0
  126. package/dist/hono_context.d.ts.map +1 -1
  127. package/dist/hono_context.js +17 -0
  128. package/dist/http/CLAUDE.md +156 -48
  129. package/dist/http/auth_shape.d.ts +4 -4
  130. package/dist/http/common_routes.js +1 -1
  131. package/dist/http/db_routes.d.ts +4 -3
  132. package/dist/http/db_routes.d.ts.map +1 -1
  133. package/dist/http/db_routes.js +14 -14
  134. package/dist/http/dev_route_error_check.d.ts +6 -3
  135. package/dist/http/dev_route_error_check.d.ts.map +1 -1
  136. package/dist/http/dev_route_error_check.js +6 -3
  137. package/dist/http/dev_set_cookie_check.d.ts +53 -0
  138. package/dist/http/dev_set_cookie_check.d.ts.map +1 -0
  139. package/dist/http/dev_set_cookie_check.js +80 -0
  140. package/dist/http/error_schemas.d.ts +45 -22
  141. package/dist/http/error_schemas.d.ts.map +1 -1
  142. package/dist/http/error_schemas.js +53 -26
  143. package/dist/http/header_lines.d.ts +42 -0
  144. package/dist/http/header_lines.d.ts.map +1 -0
  145. package/dist/http/header_lines.js +80 -0
  146. package/dist/http/host.d.ts +12 -9
  147. package/dist/http/host.d.ts.map +1 -1
  148. package/dist/http/host.js +25 -20
  149. package/dist/http/origin.d.ts +7 -22
  150. package/dist/http/origin.d.ts.map +1 -1
  151. package/dist/http/origin.js +11 -25
  152. package/dist/http/proxy.d.ts +1 -0
  153. package/dist/http/proxy.d.ts.map +1 -1
  154. package/dist/http/proxy.js +3 -0
  155. package/dist/http/request_headers.d.ts +95 -0
  156. package/dist/http/request_headers.d.ts.map +1 -0
  157. package/dist/http/request_headers.js +110 -0
  158. package/dist/http/request_target.d.ts +134 -0
  159. package/dist/http/request_target.d.ts.map +1 -0
  160. package/dist/http/request_target.js +193 -0
  161. package/dist/http/route_error_check.d.ts +4 -11
  162. package/dist/http/route_error_check.d.ts.map +1 -1
  163. package/dist/http/route_error_check.js +4 -21
  164. package/dist/http/route_result.d.ts +127 -23
  165. package/dist/http/route_result.d.ts.map +1 -1
  166. package/dist/http/route_result.js +97 -19
  167. package/dist/http/route_spec.d.ts +299 -83
  168. package/dist/http/route_spec.d.ts.map +1 -1
  169. package/dist/http/route_spec.js +548 -71
  170. package/dist/http/simple_request.d.ts +19 -14
  171. package/dist/http/simple_request.d.ts.map +1 -1
  172. package/dist/http/simple_request.js +17 -29
  173. package/dist/http/surface.d.ts +2 -0
  174. package/dist/http/surface.d.ts.map +1 -1
  175. package/dist/http/surface.js +4 -1
  176. package/dist/realtime/outbound_budget.d.ts +1 -2
  177. package/dist/realtime/outbound_budget.d.ts.map +1 -1
  178. package/dist/realtime/outbound_budget.js +1 -2
  179. package/dist/realtime/sse.d.ts +47 -17
  180. package/dist/realtime/sse.d.ts.map +1 -1
  181. package/dist/realtime/sse.js +115 -93
  182. package/dist/realtime/sse_constants.d.ts +7 -1
  183. package/dist/realtime/sse_constants.d.ts.map +1 -1
  184. package/dist/realtime/sse_constants.js +12 -1
  185. package/dist/realtime/sse_registry.d.ts +3 -3
  186. package/dist/realtime/sse_registry.js +3 -3
  187. package/dist/runtime/deps.d.ts +20 -4
  188. package/dist/runtime/deps.d.ts.map +1 -1
  189. package/dist/runtime/mock.d.ts +7 -1
  190. package/dist/runtime/mock.d.ts.map +1 -1
  191. package/dist/runtime/mock.js +33 -3
  192. package/dist/runtime/node.d.ts.map +1 -1
  193. package/dist/runtime/node.js +2 -1
  194. package/dist/runtime/secure_file.d.ts +71 -10
  195. package/dist/runtime/secure_file.d.ts.map +1 -1
  196. package/dist/runtime/secure_file.js +91 -11
  197. package/dist/server/app_backend.d.ts +0 -8
  198. package/dist/server/app_backend.d.ts.map +1 -1
  199. package/dist/server/app_backend.js +4 -4
  200. package/dist/server/app_server.d.ts +54 -33
  201. package/dist/server/app_server.d.ts.map +1 -1
  202. package/dist/server/app_server.js +69 -41
  203. package/dist/server/serve_fact_route.d.ts +3 -3
  204. package/dist/server/serve_fact_route.d.ts.map +1 -1
  205. package/dist/server/serve_fact_route.js +59 -55
  206. package/dist/server/static.d.ts +20 -0
  207. package/dist/server/static.d.ts.map +1 -1
  208. package/dist/server/static.js +56 -8
  209. package/dist/server/unmatched_route.d.ts +42 -0
  210. package/dist/server/unmatched_route.d.ts.map +1 -0
  211. package/dist/server/unmatched_route.js +64 -0
  212. package/dist/testing/CLAUDE.md +406 -1202
  213. package/dist/testing/app_server.d.ts +3 -1
  214. package/dist/testing/app_server.d.ts.map +1 -1
  215. package/dist/testing/app_server.js +5 -9
  216. package/dist/testing/auth_apps.d.ts.map +1 -1
  217. package/dist/testing/auth_apps.js +3 -2
  218. package/dist/testing/cross_backend/account_lifecycle.d.ts +11 -4
  219. package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
  220. package/dist/testing/cross_backend/account_lifecycle.js +320 -6
  221. package/dist/testing/cross_backend/build_test_backend_paths.d.ts +4 -1
  222. package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
  223. package/dist/testing/cross_backend/build_test_backend_paths.js +1 -1
  224. package/dist/testing/cross_backend/capabilities.d.ts +68 -5
  225. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  226. package/dist/testing/cross_backend/capabilities.js +20 -4
  227. package/dist/testing/cross_backend/cell_gated_create.js +1 -1
  228. package/dist/testing/cross_backend/conformance_case.d.ts +63 -21
  229. package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
  230. package/dist/testing/cross_backend/conformance_table.d.ts +54 -12
  231. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  232. package/dist/testing/cross_backend/conformance_table.js +179 -23
  233. package/dist/testing/cross_backend/cookie_attributes.js +1 -1
  234. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +7 -1
  235. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
  236. package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +3 -3
  237. package/dist/testing/cross_backend/credential_conformance.d.ts +196 -0
  238. package/dist/testing/cross_backend/credential_conformance.d.ts.map +1 -0
  239. package/dist/testing/cross_backend/credential_conformance.js +296 -0
  240. package/dist/testing/cross_backend/credential_conformance.json +1284 -0
  241. package/dist/testing/cross_backend/credential_conformance_wire.d.ts +40 -0
  242. package/dist/testing/cross_backend/credential_conformance_wire.d.ts.map +1 -0
  243. package/dist/testing/cross_backend/credential_conformance_wire.js +293 -0
  244. package/dist/testing/cross_backend/credential_header_robustness.d.ts +1 -3
  245. package/dist/testing/cross_backend/credential_header_robustness.d.ts.map +1 -1
  246. package/dist/testing/cross_backend/credential_header_robustness.js +24 -55
  247. package/dist/testing/cross_backend/credential_wire.d.ts +112 -0
  248. package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -0
  249. package/dist/testing/cross_backend/credential_wire.js +188 -0
  250. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
  251. package/dist/testing/cross_backend/default_backend_configs.js +22 -2
  252. package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -26
  253. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
  254. package/dist/testing/cross_backend/default_spine_surface.js +3 -7
  255. package/dist/testing/cross_backend/differential.d.ts +1 -1
  256. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  257. package/dist/testing/cross_backend/differential.js +3 -2
  258. package/dist/testing/cross_backend/differential_normalize.d.ts +23 -6
  259. package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
  260. package/dist/testing/cross_backend/differential_normalize.js +11 -5
  261. package/dist/testing/cross_backend/full_spine_mount.d.ts +4 -10
  262. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  263. package/dist/testing/cross_backend/full_spine_mount.js +11 -4
  264. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  265. package/dist/testing/cross_backend/identity_parity.js +4 -0
  266. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  267. package/dist/testing/cross_backend/in_process_setup.js +78 -4
  268. package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
  269. package/dist/testing/cross_backend/login_security.js +13 -10
  270. package/dist/testing/cross_backend/peer_ping_ws.d.ts +1 -1
  271. package/dist/testing/cross_backend/peer_ping_ws.js +2 -2
  272. package/dist/testing/cross_backend/request_header_conformance.d.ts +174 -0
  273. package/dist/testing/cross_backend/request_header_conformance.d.ts.map +1 -0
  274. package/dist/testing/cross_backend/request_header_conformance.js +196 -0
  275. package/dist/testing/cross_backend/request_header_conformance.json +1158 -0
  276. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts +39 -0
  277. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts.map +1 -0
  278. package/dist/testing/cross_backend/request_header_conformance_wire.js +284 -0
  279. package/dist/testing/cross_backend/request_target_conformance.d.ts +298 -0
  280. package/dist/testing/cross_backend/request_target_conformance.d.ts.map +1 -0
  281. package/dist/testing/cross_backend/request_target_conformance.js +186 -0
  282. package/dist/testing/cross_backend/request_target_conformance.json +3765 -0
  283. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +32 -0
  284. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -0
  285. package/dist/testing/cross_backend/request_target_conformance_wire.js +278 -0
  286. package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
  287. package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +173 -1
  288. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +5 -4
  289. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
  290. package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +185 -31
  291. package/dist/testing/cross_backend/rpc_adversarial.d.ts +6 -4
  292. package/dist/testing/cross_backend/rpc_adversarial.d.ts.map +1 -1
  293. package/dist/testing/cross_backend/rpc_adversarial.js +5 -2
  294. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -7
  295. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  296. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -5
  297. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  298. package/dist/testing/cross_backend/session_cap.js +82 -34
  299. package/dist/testing/cross_backend/session_cookie_effect.d.ts +43 -0
  300. package/dist/testing/cross_backend/session_cookie_effect.d.ts.map +1 -0
  301. package/dist/testing/cross_backend/session_cookie_effect.js +103 -0
  302. package/dist/testing/cross_backend/session_login.d.ts +24 -0
  303. package/dist/testing/cross_backend/session_login.d.ts.map +1 -0
  304. package/dist/testing/cross_backend/session_login.js +31 -0
  305. package/dist/testing/cross_backend/setup.d.ts +117 -0
  306. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  307. package/dist/testing/cross_backend/setup.js +193 -9
  308. package/dist/testing/cross_backend/simple_request.d.ts.map +1 -1
  309. package/dist/testing/cross_backend/simple_request.js +5 -0
  310. package/dist/testing/cross_backend/spine_suites.d.ts +9 -1
  311. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  312. package/dist/testing/cross_backend/spine_suites.js +88 -5
  313. package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
  314. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  315. package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
  316. package/dist/testing/cross_backend/sse_round_trip.d.ts +8 -5
  317. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  318. package/dist/testing/cross_backend/sse_round_trip.js +205 -64
  319. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  320. package/dist/testing/cross_backend/testing_backdoor.js +5 -2
  321. package/dist/testing/cross_backend/testing_credential_read.d.ts +165 -0
  322. package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -0
  323. package/dist/testing/cross_backend/testing_credential_read.js +175 -0
  324. package/dist/testing/cross_backend/testing_reset_actions.d.ts +19 -0
  325. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  326. package/dist/testing/cross_backend/testing_reset_actions.js +22 -6
  327. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  328. package/dist/testing/cross_backend/token_lifetime.js +58 -2
  329. package/dist/testing/cross_backend/transport_composition.d.ts +2 -4
  330. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
  331. package/dist/testing/cross_backend/transport_composition.js +13 -10
  332. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  333. package/dist/testing/cross_backend/ts_spine_backend_config.js +5 -3
  334. package/dist/testing/cross_backend/ws_endpoint.d.ts +11 -1
  335. package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
  336. package/dist/testing/cross_backend/ws_endpoint.js +19 -2
  337. package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -1
  338. package/dist/testing/cross_backend/ws_role_gated.js +2 -3
  339. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  340. package/dist/testing/cross_backend/ws_round_trip.js +28 -12
  341. package/dist/testing/cross_backend/xfail.d.ts +44 -11
  342. package/dist/testing/cross_backend/xfail.d.ts.map +1 -1
  343. package/dist/testing/cross_backend/xfail.js +68 -23
  344. package/dist/testing/data_exposure.d.ts.map +1 -1
  345. package/dist/testing/data_exposure.js +4 -3
  346. package/dist/testing/integration.d.ts +1 -2
  347. package/dist/testing/integration.d.ts.map +1 -1
  348. package/dist/testing/integration.js +14 -8
  349. package/dist/testing/integration_helpers.d.ts +50 -3
  350. package/dist/testing/integration_helpers.d.ts.map +1 -1
  351. package/dist/testing/integration_helpers.js +87 -9
  352. package/dist/testing/middleware.d.ts +3 -1
  353. package/dist/testing/middleware.d.ts.map +1 -1
  354. package/dist/testing/middleware.js +14 -7
  355. package/dist/testing/resolved_auth.d.ts +3 -1
  356. package/dist/testing/resolved_auth.d.ts.map +1 -1
  357. package/dist/testing/resolved_auth.js +4 -4
  358. package/dist/testing/round_trip.d.ts +6 -2
  359. package/dist/testing/round_trip.d.ts.map +1 -1
  360. package/dist/testing/round_trip.js +17 -6
  361. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  362. package/dist/testing/rpc_envelope_cases.js +7 -0
  363. package/dist/testing/rpc_helpers.d.ts +4 -2
  364. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  365. package/dist/testing/rpc_helpers.js +6 -1
  366. package/dist/testing/rpc_round_trip.d.ts +13 -2
  367. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  368. package/dist/testing/rpc_round_trip.js +25 -6
  369. package/dist/testing/schema_generators.d.ts +2 -2
  370. package/dist/testing/schema_generators.d.ts.map +1 -1
  371. package/dist/testing/schema_generators.js +4 -4
  372. package/dist/testing/stubs.d.ts +2 -2
  373. package/dist/testing/stubs.d.ts.map +1 -1
  374. package/dist/testing/stubs.js +13 -10
  375. package/dist/testing/transports/fetch_transport.d.ts +6 -3
  376. package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
  377. package/dist/testing/transports/fetch_transport.js +31 -19
  378. package/dist/testing/transports/raw_http.d.ts +61 -1
  379. package/dist/testing/transports/raw_http.d.ts.map +1 -1
  380. package/dist/testing/transports/raw_http.js +61 -1
  381. package/dist/testing/transports/ws_raw_client.d.ts +20 -0
  382. package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
  383. package/dist/testing/transports/ws_raw_client.js +10 -4
  384. package/dist/testing/transports/ws_transport.d.ts +21 -1
  385. package/dist/testing/transports/ws_transport.d.ts.map +1 -1
  386. package/dist/testing/transports/ws_transport.js +58 -20
  387. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  388. package/dist/testing/ws_round_trip.js +8 -4
  389. package/package.json +1 -1
@@ -21,10 +21,11 @@ import '../assert_dev_env.js';
21
21
  *
22
22
  * Three cases mirror the upgrade route `register_action_ws` mounts (origin
23
23
  * check → `require_auth` → dispatch): an authenticated upgrade round-trips
24
- * `heartbeat` (the first case), and an anonymous upgrade and a
25
- * disallowed-origin upgrade are refused (after the spine-parity cases).
26
- * Per-connection auth is enforced at upgrade time (not per message), so the
27
- * negative cases assert the upgrade itself rejects rather than a per-message
24
+ * `heartbeat` (the first case), an anonymous upgrade is refused 401, and a
25
+ * disallowed-origin upgrade carrying the keeper's valid session is refused 403
26
+ * (after the spine-parity cases). Per-connection auth is enforced at upgrade
27
+ * time (not per message), so the negative cases assert the upgrade itself is
28
+ * refused, at its status (`WsUpgradeRefusedError`), rather than a per-message
28
29
  * error frame.
29
30
  *
30
31
  * Spine-parity cases follow the first. Both spines admit a connection only after
@@ -80,12 +81,12 @@ import '../assert_dev_env.js';
80
81
  * @module
81
82
  */
82
83
  import { assert, describe } from 'vitest';
83
- import { assert_rejects } from '@fuzdev/fuz_util/testing.ts';
84
84
  import { heartbeat_action_spec } from '../../actions/heartbeat.js';
85
85
  import { DEFAULT_WS_MAX_MESSAGE_BYTES, WS_CLOSE_MESSAGE_TOO_BIG, WS_CLOSE_MESSAGE_TOO_BIG_REASON, WS_CLOSE_SESSION_REVOKED, WS_CLOSE_SESSION_REVOKED_REASON } from '../../actions/transports.js';
86
86
  import { account_session_revoke_all_action_spec, account_token_create_action_spec, account_token_revoke_action_spec, TokenCreateOutput, TokenRevokeOutput } from '../../auth/account_action_specs.js';
87
87
  import { DEFAULT_MAX_TOKENS } from '../../auth/account_route_schema.js';
88
88
  import { account_delete_action_spec } from '../../auth/admin_action_specs.js';
89
+ import { ERROR_FORBIDDEN_ORIGIN } from '../../http/error_schemas.js';
89
90
  import { JSONRPC_ERROR_CODES } from '../../http/jsonrpc_errors.js';
90
91
  import { is_response_for } from '../transports/ws_client.js';
91
92
  import { create_admitted_ws_transport, create_ws_transport } from '../transports/ws_transport.js';
@@ -97,7 +98,7 @@ import { test_if } from './capabilities.js';
97
98
  import { cross_rpc_call, expect_output } from './cross_rpc.js';
98
99
  import { create_account_revocations } from './revocation_drivers.js';
99
100
  import { SPINE_ACCOUNT_LOGOUT_PATH, SPINE_ACCOUNT_PASSWORD_PATH } from './spine_surface_constants.js';
100
- import { open_session_ws } from './ws_endpoint.js';
101
+ import { assert_ws_upgrade_refused, open_session_ws } from './ws_endpoint.js';
101
102
  /** Origin guaranteed to fail the `http://localhost:*` allowlist the test backends run with. */
102
103
  const DISALLOWED_ORIGIN = 'http://disallowed.example';
103
104
  /**
@@ -241,13 +242,28 @@ export const describe_cross_process_ws_tests = (options) => {
241
242
  }
242
243
  });
243
244
  // Per-connection auth fires at upgrade time (`require_auth`), so an
244
- // anonymous socket never opens — the upgrade is refused outright.
245
- test_if(capabilities.ws, 'anonymous upgrade is refused', async () => {
246
- await assert_rejects(() => create_ws_transport({ base_url, ws_path, cookies: [], origin }));
245
+ // anonymous socket never opens — the upgrade is refused outright, as
246
+ // unauthenticated: any other failure (a crash, a wrong path) is not this.
247
+ test_if(capabilities.ws, 'anonymous upgrade is refused with 401', async () => {
248
+ await assert_ws_upgrade_refused(() => create_ws_transport({ base_url, ws_path, cookies: [], origin }), 401);
247
249
  });
248
- // Origin is checked before auth, so cookies are irrelevant here.
249
- test_if(capabilities.ws, 'disallowed-origin upgrade is refused', async () => {
250
- await assert_rejects(() => create_ws_transport({ base_url, ws_path, cookies: [], origin: DISALLOWED_ORIGIN }));
250
+ // The upgrade carries the keeper's valid session, so only the origin check
251
+ // can refuse it: a backend with none would admit the socket, and one
252
+ // checking origin after auth still answers 403 here, not 401.
253
+ test_if(capabilities.ws, 'disallowed-origin upgrade is refused with 403', async () => {
254
+ const fixture = await setup_test();
255
+ const refusal = await assert_ws_upgrade_refused(() => create_ws_transport({
256
+ base_url,
257
+ ws_path,
258
+ cookies: fixture.transport.cookies(),
259
+ origin: DISALLOWED_ORIGIN
260
+ }), 403);
261
+ // a runtime that drops an upgrade refusal's body (`ws_refusal_body`
262
+ // false) is held to the status alone; a body that is sent is asserted
263
+ if (capabilities.ws_refusal_body || refusal.body !== '') {
264
+ const body = JSON.parse(refusal.body);
265
+ assert.strictEqual(body.error, ERROR_FORBIDDEN_ORIGIN);
266
+ }
251
267
  });
252
268
  // Every revocation closes with 4001 "Session revoked" — the code and its
253
269
  // reason, so a dropped connection (1006) or a crash can't pass for one.
@@ -1,15 +1,48 @@
1
1
  import '../assert_dev_env.js';
2
2
  /**
3
- * Register `fn` as an expected-failure test. Passes while `fn` throws /
4
- * rejects; **fails** once `fn` succeeds (signalling the gap closed and the
5
- * marker should be removed).
3
+ * What the tracked failure looks like: a `RegExp` tested against the thrown
4
+ * error's message (`String(error)` for a non-`Error`), or a predicate over
5
+ * the thrown value.
6
+ */
7
+ export type XfailMatcher = RegExp | ((error: unknown) => boolean);
8
+ /** A tracked gap: its id, why it is deferred, and the failure it shows. */
9
+ export interface XfailMarker {
10
+ /**
11
+ * Descriptive id of the tracked gap (e.g. `'audit-log-sse-rust-spine'`) —
12
+ * a feature/behavior name, not a process/milestone label.
13
+ */
14
+ readonly tracking_id: string;
15
+ /** Why the case is deferred-by-design. */
16
+ readonly reason: string;
17
+ /** The failure the gap shows; any other failure is red. */
18
+ readonly fails_with: XfailMatcher;
19
+ }
20
+ /**
21
+ * Whether `error` is the failure `matcher` describes.
22
+ *
23
+ * @param matcher - the marker's `fails_with`
24
+ * @param error - the value the body threw
25
+ */
26
+ export declare const xfail_matches: (matcher: XfailMatcher, error: unknown) => boolean;
27
+ /**
28
+ * Run `fn` as an expected failure: resolves when it throws the tracked
29
+ * failure, throws when it throws anything else (wrapping the original as
30
+ * `cause`) or when it succeeds (the gap closed).
6
31
  *
7
- * @param tracking_id - descriptive id of the tracked gap (e.g.
8
- * `'audit-log-sse-rust-spine'`) — a feature/behavior name, not a
9
- * process/milestone label.
10
- * @param reason - why the case is deferred-by-design.
11
- * @param name - the assertion / test label.
12
- * @param fn - the test body (expected to throw/reject until the gap closes).
13
- */
14
- export declare const xfail_until: (tracking_id: string, reason: string, name: string, fn: () => void | Promise<void>) => void;
32
+ * @param marker - the tracked gap
33
+ * @param fn - the body, expected to throw the tracked failure until the gap closes
34
+ * @throws Error naming `marker.tracking_id` when `fn` succeeds or fails another way,
35
+ * or when the matcher throws (the matcher's error as `cause`)
36
+ */
37
+ export declare const run_xfail: (marker: XfailMarker, fn: () => void | Promise<void>) => Promise<void>;
38
+ /**
39
+ * Register `fn` as an expected-failure test. Passes while `fn` throws the
40
+ * tracked failure; **fails** on any other failure, and once `fn` succeeds
41
+ * (signalling the gap closed and the marker should be removed).
42
+ *
43
+ * @param marker - the tracked gap, with the failure it must show
44
+ * @param name - the assertion / test label
45
+ * @param fn - the test body (expected to throw the tracked failure until the gap closes)
46
+ */
47
+ export declare const xfail_until: (marker: XfailMarker, name: string, fn: () => void | Promise<void>) => void;
15
48
  //# sourceMappingURL=xfail.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"xfail.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/xfail.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAyB9B;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,GACvB,aAAa,MAAM,EACnB,QAAQ,MAAM,EACd,MAAM,MAAM,EACZ,IAAI,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAC5B,IAEF,CAAC"}
1
+ {"version":3,"file":"xfail.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/xfail.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA2B9B;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC;AAElE,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC3B;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC;CAClC;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,YAAY,EAAE,OAAO,OAAO,KAAG,OAKrE,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GACrB,QAAQ,WAAW,EACnB,IAAI,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAC5B,OAAO,CAAC,IAAI,CA6Bd,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GACvB,QAAQ,WAAW,EACnB,MAAM,MAAM,EACZ,IAAI,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAC5B,IAGF,CAAC"}
@@ -2,36 +2,81 @@ import '../assert_dev_env.js';
2
2
  /**
3
3
  * `xfail_until` — mark a deferred-by-design gap as an expected failure.
4
4
  *
5
- * A thin wrapper over vitest's `test.fails` that bakes a tracking id +
6
- * reason into the test label. Two properties make it the right tool for
7
- * declared gaps (distinct from in-scope gaps, which fail loud as a normal
8
- * red `test`):
5
+ * Registers a plain `test` that runs the body and requires it to fail the
6
+ * tracked way. Three properties make it the right tool for declared gaps
7
+ * (distinct from in-scope gaps, which fail loud as a normal red `test`):
9
8
  *
10
- * - **Visible** — the case shows in the report as a distinct expected
11
- * failure, not a silent `.skip`, so a deferred gap never disappears from
12
- * view.
13
- * - **Self-cleaning** — `test.fails` turns **red** the moment the body
14
- * stops throwing (i.e. the impl starts passing), forcing whoever closed
15
- * the gap to delete the marker. A `.skip` would rot silently; this can't.
9
+ * - **Visible** — the case shows in the report with its tracking id and
10
+ * reason in the label, not as a silent `.skip`, so a deferred gap never
11
+ * disappears from view.
12
+ * - **Specific** — the failure must be the tracked one (`XfailMarker.fails_with`).
13
+ * Any other throw — a typo'd method, a fixture error, an unrelated
14
+ * regression — is red, so the marker can't hide a failure it doesn't name.
15
+ * - **Self-cleaning** — the test turns **red** the moment the body stops
16
+ * throwing (the impl starts passing), forcing whoever closed the gap to
17
+ * delete the marker. A `.skip` would rot silently; this can't.
16
18
  *
17
- * Sibling to `test_if` in `testing/cross_backend/capabilities.ts`. No taxonomy — a one-line
18
- * marker with a tracking id and a reason, nothing more.
19
+ * Sibling to `test_if` in `testing/cross_backend/capabilities.ts`. No taxonomy — a
20
+ * tracking id, a reason, and the failure expected, nothing more.
19
21
  *
20
22
  * @module
21
23
  */
22
24
  import { test } from 'vitest';
23
25
  /**
24
- * Register `fn` as an expected-failure test. Passes while `fn` throws /
25
- * rejects; **fails** once `fn` succeeds (signalling the gap closed and the
26
- * marker should be removed).
26
+ * Whether `error` is the failure `matcher` describes.
27
27
  *
28
- * @param tracking_id - descriptive id of the tracked gap (e.g.
29
- * `'audit-log-sse-rust-spine'`) — a feature/behavior name, not a
30
- * process/milestone label.
31
- * @param reason - why the case is deferred-by-design.
32
- * @param name - the assertion / test label.
33
- * @param fn - the test body (expected to throw/reject until the gap closes).
28
+ * @param matcher - the marker's `fails_with`
29
+ * @param error - the value the body threw
34
30
  */
35
- export const xfail_until = (tracking_id, reason, name, fn) => {
36
- test.fails(`${name} [xfail_until ${tracking_id}: ${reason}]`, fn);
31
+ export const xfail_matches = (matcher, error) => {
32
+ if (typeof matcher === 'function')
33
+ return matcher(error);
34
+ const message = error instanceof Error ? error.message : String(error);
35
+ matcher.lastIndex = 0; // a `g` or `y` flag would otherwise carry state across calls
36
+ return matcher.test(message);
37
+ };
38
+ /**
39
+ * Run `fn` as an expected failure: resolves when it throws the tracked
40
+ * failure, throws when it throws anything else (wrapping the original as
41
+ * `cause`) or when it succeeds (the gap closed).
42
+ *
43
+ * @param marker - the tracked gap
44
+ * @param fn - the body, expected to throw the tracked failure until the gap closes
45
+ * @throws Error naming `marker.tracking_id` when `fn` succeeds or fails another way,
46
+ * or when the matcher throws (the matcher's error as `cause`)
47
+ */
48
+ export const run_xfail = async (marker, fn) => {
49
+ try {
50
+ await fn();
51
+ }
52
+ catch (error) {
53
+ const message = error instanceof Error ? error.message : String(error);
54
+ let matched;
55
+ try {
56
+ matched = xfail_matches(marker.fails_with, error);
57
+ }
58
+ catch (matcher_error) {
59
+ // a throwing matcher would otherwise surface alone, with no tracking id
60
+ // and the body's failure lost
61
+ throw new Error(`xfail_until ${marker.tracking_id}: the fails_with matcher threw on the body's ` +
62
+ `failure (${message}): ${matcher_error instanceof Error ? matcher_error.message : String(matcher_error)}`, { cause: matcher_error });
63
+ }
64
+ if (matched)
65
+ return;
66
+ throw new Error(`xfail_until ${marker.tracking_id}: failed, but not with the tracked failure ` +
67
+ `(${String(marker.fails_with)}): ${message}`, { cause: error });
68
+ }
69
+ throw new Error(`xfail_until ${marker.tracking_id}: gap closed — the body passed; remove the marker`);
70
+ };
71
+ /**
72
+ * Register `fn` as an expected-failure test. Passes while `fn` throws the
73
+ * tracked failure; **fails** on any other failure, and once `fn` succeeds
74
+ * (signalling the gap closed and the marker should be removed).
75
+ *
76
+ * @param marker - the tracked gap, with the failure it must show
77
+ * @param name - the assertion / test label
78
+ * @param fn - the test body (expected to throw the tracked failure until the gap closes)
79
+ */
80
+ export const xfail_until = (marker, name, fn) => {
81
+ test(`${name} [xfail_until ${marker.tracking_id}: ${marker.reason}]`, () => run_xfail(marker, fn));
37
82
  };
@@ -1 +1 @@
1
- {"version":3,"file":"data_exposure.d.ts","sourceRoot":"","sources":["../../src/lib/testing/data_exposure.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[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAyB7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKzD,OAAO,EAIN,KAAK,gBAAgB,EACrB,MAAM,wBAAwB,CAAC;AAehC,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,0BAA0B,CAAC;AAIvE;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,GAAI,QAAQ,OAAO,KAAG,GAAG,CAAC,MAAM,CAmC9E,CAAC;AA0HF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,yCAAyC,GACrD,gBAAgB,cAAc,EAC9B,mBAAkB,aAAa,CAAC,MAAM,CAA6B,EACnE,cAAc,aAAa,CAAC,MAAM,CAAC,KACjC,IAOF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wCAAwC,GACpD,gBAAgB,cAAc,EAC9B,oBAAmB,aAAa,CAAC,MAAM,CAA8B,EACrE,cAAc,aAAa,CAAC,MAAM,CAAC,KACjC,IAYF,CAAC;AAIF,kDAAkD;AAClD,MAAM,WAAW,uBAAuB;IACvC,kEAAkE;IAClE,UAAU,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,2FAA2F;IAC3F,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,iGAAiG;IACjG,iBAAiB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC1C;;;;OAIG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B;;;;OAIG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,GAAI,SAAS,uBAAuB,KAAG,IAqM/E,CAAC"}
@@ -25,7 +25,7 @@ import { create_test_request_headers } from './test_origin.js';
25
25
  import { resolve_valid_path, generate_valid_body, to_route_content_type } from './schema_generators.js';
26
26
  import { is_null_schema, is_strict_object_schema, schema_to_surface } from '../http/schema_helpers.js';
27
27
  import { is_keeper_auth, is_public_auth } from '../http/auth_shape.js';
28
- import { sensitive_field_blocklist, admin_only_field_blocklist, assert_no_sensitive_fields_in_json, pick_auth_headers } from './integration_helpers.js';
28
+ import { sensitive_field_blocklist, admin_only_field_blocklist, assert_no_sensitive_fields_in_json, pick_auth_headers, pick_auth_principal, to_principal_transport } from './integration_helpers.js';
29
29
  // --- Schema introspection ---
30
30
  /**
31
31
  * Recursively collect all property names from a JSON Schema.
@@ -258,7 +258,8 @@ export const describe_data_exposure_tests = (options) => {
258
258
  if (skip_set.has(route_key))
259
259
  continue;
260
260
  const url = resolve_valid_path(spec.path, spec.params, options.param_values?.[route_key]);
261
- const res = await fixture.transport(url, {
261
+ // a fresh jar: cross-process `fixture.transport` carries the keeper's cookie
262
+ const res = await fixture.fresh_transport()(url, {
262
263
  method: spec.method,
263
264
  headers: create_test_request_headers({
264
265
  'content-type': to_route_content_type(spec)
@@ -332,7 +333,7 @@ export const describe_data_exposure_tests = (options) => {
332
333
  headers: { ...headers, 'content-type': to_route_content_type(spec) },
333
334
  ...(body ? { body: JSON.stringify(body) } : {})
334
335
  };
335
- const res = await fixture.transport(url, request_init);
336
+ const res = await to_principal_transport(pick_auth_principal(spec.auth), fixture)(url, request_init);
336
337
  if (res.headers.get('Content-Type')?.includes('text/event-stream')) {
337
338
  await res.body?.cancel();
338
339
  continue;
@@ -37,8 +37,7 @@ export interface StandardIntegrationTestOptions {
37
37
  /**
38
38
  * RPC endpoint specs — required. This suite dispatches
39
39
  * `account_verify`, `account_session_*`, and `account_token_*` via
40
- * `rpc_call_for_spec` (the `/api/account/verify` REST route is a
41
- * status-only nginx shim with no payload). Hard-fails via
40
+ * `rpc_call_for_spec`. Hard-fails via
42
41
  * `require_rpc_endpoint_path` on setup so consumer projects see a
43
42
  * clear setup error instead of confusing test failures.
44
43
  *
@@ -1 +1 @@
1
- {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAuB7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMhE,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AAa7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAKpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAY1D;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;;;OAIG;IACH,UAAU,EAAE,SAAS,CAAC;IACtB;;;;;;;;;OASG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,kEAAkE;IAClE,YAAY,EAAE,mBAAmB,CAAC;IAClC;;;;OAIG;IACH,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC;;;;;;;;;;;;OAYG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACpE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,mCAAmC,GAC/C,SAAS,8BAA8B,KACrC,IA0/CF,CAAC"}
1
+ {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAuB7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMhE,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AAa7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAKpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAY1D;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;;;OAIG;IACH,UAAU,EAAE,SAAS,CAAC;IACtB;;;;;;;;;OASG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,kEAAkE;IAClE,YAAY,EAAE,mBAAmB,CAAC;IAClC;;;;OAIG;IACH,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC;;;;;;;;;;;OAWG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACpE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,mCAAmC,GAC/C,SAAS,8BAA8B,KACrC,IAggDF,CAAC"}
@@ -569,8 +569,10 @@ export const describe_standard_integration_tests = (options) => {
569
569
  describe('bearer auth', () => {
570
570
  test('valid bearer token authenticates', async () => {
571
571
  const fixture = await options.setup_test();
572
+ // a cookie-free transport: beside the keeper's session cookie the
573
+ // session leg would authenticate first and the bearer go unread
572
574
  const res = await rpc_call_for_spec({
573
- app: { request: fixture.transport },
575
+ app: { request: fixture.fresh_transport({ origin: null }) },
574
576
  path: rpc_path,
575
577
  spec: account_verify_action_spec,
576
578
  params: undefined,
@@ -798,9 +800,10 @@ export const describe_standard_integration_tests = (options) => {
798
800
  });
799
801
  assert.ok(revoke_res.ok, 'account_token_revoke should succeed');
800
802
  assert.strictEqual(revoke_res.result.revoked, false, 'Should not revoke another account token');
801
- // User B's bearer token should still work
803
+ // User B's bearer token should still work — cookie-free, or the
804
+ // keeper's session would answer for it
802
805
  const verify_b = await rpc_call_for_spec({
803
- app: { request: fixture.transport },
806
+ app: { request: fixture.fresh_transport({ origin: null }) },
804
807
  path: rpc_path,
805
808
  spec: account_verify_action_spec,
806
809
  params: undefined,
@@ -1025,7 +1028,9 @@ export const describe_standard_integration_tests = (options) => {
1025
1028
  const bearer_headers = fixture.create_bearer_headers({
1026
1029
  'content-type': 'application/json'
1027
1030
  });
1028
- const res = await fixture.fresh_transport()(password_route.path, {
1031
+ // no `Origin`: cross-process the transport's default one would discard
1032
+ // the bearer on its own, leaving the `Referer` untested
1033
+ const res = await fixture.fresh_transport({ origin: null })(password_route.path, {
1029
1034
  method: 'POST',
1030
1035
  headers: { ...bearer_headers, referer: `${TEST_ORIGIN}/admin` }
1031
1036
  });
@@ -1100,9 +1105,9 @@ export const describe_standard_integration_tests = (options) => {
1100
1105
  assert.ok(create_res.ok, 'account_token_create should succeed');
1101
1106
  const { token: raw_token } = create_res.result;
1102
1107
  assert.ok(raw_token, 'Expected raw token in create response');
1103
- // Verify bearer token works
1108
+ // Verify bearer token works — cookie-free, so the bearer is what authenticates
1104
1109
  const verify_before = await rpc_call_for_spec({
1105
- app: { request: fixture.transport },
1110
+ app: { request: fixture.fresh_transport({ origin: null }) },
1106
1111
  path: rpc_path,
1107
1112
  spec: account_verify_action_spec,
1108
1113
  params: undefined,
@@ -1123,9 +1128,10 @@ export const describe_standard_integration_tests = (options) => {
1123
1128
  const change_body = await change_res.json();
1124
1129
  assert.ok(typeof change_body.tokens_revoked === 'number', 'Expected tokens_revoked count');
1125
1130
  assert.ok(change_body.tokens_revoked >= 1, 'Expected at least 1 token revoked');
1126
- // Bearer token should now be invalid
1131
+ // Bearer token should now be invalid — cookie-free, so the 401 is the
1132
+ // bearer's and not the keeper's revoked session's
1127
1133
  const verify_after = await rpc_call_for_spec({
1128
- app: { request: fixture.transport },
1134
+ app: { request: fixture.fresh_transport({ origin: null }) },
1129
1135
  path: rpc_path,
1130
1136
  spec: account_verify_action_spec,
1131
1137
  params: undefined,
@@ -3,13 +3,14 @@ import type { RouteSpec, RouteMethod } from '../http/route_spec.js';
3
3
  import { type RouteErrorMap } from '../http/route_errors.js';
4
4
  import { type RouteAuth } from '../http/auth_shape.js';
5
5
  import type { TestAccount } from './app_server.js';
6
+ import type { RpcTestTransport } from './rpc_helpers.js';
6
7
  /**
7
8
  * Find the route spec a request reaches: the first in list (mount) order
8
9
  * whose method and path template match it, `HEAD` read as `GET` — the order
9
10
  * Hono dispatches by, which the DEV error check reads through Hono's own
10
11
  * router (`create_route_lookup`). This lookup is hono-free
11
12
  * (`find_mounted_route`), pinned against Hono by the route-lookup tests. The
12
- * path is read as Hono reads it: its pathname, percent-decoded.
13
+ * path is read as the server routes it: its pathname, nothing percent-decoded.
13
14
  *
14
15
  * A path template passed as the path (`/api/things/:id`, a segment that is
15
16
  * `*` or starts with `:`) finds its own spec first, outranking mount order.
@@ -25,7 +26,7 @@ export declare const find_route_spec: (specs: Array<RouteSpec>, method: string,
25
26
  * session/token CRUD, admin operations, and role_grant flows live on the RPC
26
27
  * surface and should be reached via `rpc_call`.
27
28
  */
28
- export declare const rest_auth_route_suffixes: readonly ["/login", "/logout", "/password", "/verify", "/signup", "/bootstrap"];
29
+ export declare const rest_auth_route_suffixes: readonly ["/login", "/logout", "/password", "/signup", "/bootstrap"];
29
30
  export type RestAuthRouteSuffix = (typeof rest_auth_route_suffixes)[number];
30
31
  /**
31
32
  * Find a REST auth route by suffix and method.
@@ -62,8 +63,14 @@ export declare const find_auth_route: (specs: Array<RouteSpec>, suffix: RestAuth
62
63
  * no schema applies: a 2xx on a route with a null output, or an error status
63
64
  * the map doesn't declare.
64
65
  *
66
+ * An answer no route gave never passes, whatever the route declares: a
67
+ * `405`, the JSON `route_not_found` 404, or the plain `NOT_FOUND_TEXT` 404
68
+ * (`server/unmatched_route.ts`) means the backend doesn't mount the route the
69
+ * spec describes.
70
+ *
65
71
  * @param route_error_maps - each route's error map, keyed `METHOD path` (`AppSurfaceSpec.route_error_maps`)
66
- * @throws Error if no route spec matches `method` + `path`, if the body fails
72
+ * @throws Error if no route spec matches `method` + `path`, if the backend
73
+ * answered for no route (the route isn't mounted), if the body fails
67
74
  * its output schema, if a JSON error is at a status the route's map lacks or
68
75
  * off its schema, or if the response is non-JSON despite a declared schema
69
76
  * for its status.
@@ -141,6 +148,35 @@ export declare const pick_auth_principal: (auth: RouteAuth) => AuthPrincipal;
141
148
  * @param admin_account - the account the `'admin'` principal calls as
142
149
  */
143
150
  export declare const to_principal_headers: (principal: AuthPrincipal, keeper: KeeperHeaderProvider, authed_account: TestAccount, admin_account: TestAccount) => Record<string, string>;
151
+ /** The two transports a fixture offers, as `to_principal_transport` reads them. */
152
+ export interface PrincipalTransports {
153
+ readonly transport: RpcTestTransport;
154
+ readonly fresh_transport: (options?: {
155
+ readonly origin?: string | null;
156
+ }) => RpcTestTransport;
157
+ }
158
+ /**
159
+ * The transport a principal's request goes through, so the request carries
160
+ * the principal's credential and nothing else. Cross-process
161
+ * `fixture.transport` adds the keeper's session cookie from its jar (unless
162
+ * the request names a `Cookie`) and a default `Origin`:
163
+ *
164
+ * - `'daemon_token'` goes cookie-free and without an `Origin`. Behind an
165
+ * `Origin` the daemon token is discarded as browser context and the
166
+ * keeper's cookie answers in its place, so a daemon-gated call is refused
167
+ * for its credential type and its success path goes unexercised.
168
+ * - `'public'` goes cookie-free with the default `Origin` kept, so a public
169
+ * route or method is called anonymously on both legs — over
170
+ * `fixture.transport` the keeper's cookie would ride along cross-process
171
+ * while in-process the call is anonymous.
172
+ * - `'admin'`, `'keeper'` and `'authed'` keep the fixture's transport: each
173
+ * sends a session `Cookie` header (`to_principal_headers`), which replaces
174
+ * the jar's.
175
+ *
176
+ * @param principal - the principal `pick_auth_principal` chose
177
+ * @param fixture - the fixture's transports
178
+ */
179
+ export declare const to_principal_transport: (principal: AuthPrincipal, fixture: PrincipalTransports) => RpcTestTransport;
144
180
  /**
145
181
  * Pick request headers matching a route spec's auth requirement
146
182
  * (`pick_auth_principal`, then `to_principal_headers`):
@@ -182,4 +218,15 @@ export declare const round_trip_uses_fresh_account: (principal: AuthPrincipal, s
182
218
  * error's `data.reason`
183
219
  */
184
220
  export declare const is_unauthenticated_refusal: (status: number, reason: unknown) => boolean;
221
+ /**
222
+ * Whether a response refuses the request for the channel its credential came
223
+ * on: a 403 reading `credential_type_required`. The round trips send each
224
+ * principal a credential its auth admits, so this answer to one of them means
225
+ * the credential was lost on the way or another answered in its place.
226
+ *
227
+ * @param status - the HTTP status
228
+ * @param reason - the refusal's reason: a REST body's `error`, a JSON-RPC
229
+ * error's `data.reason`
230
+ */
231
+ export declare const is_credential_type_refusal: (status: number, reason: unknown) => boolean;
185
232
  //# sourceMappingURL=integration_helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"integration_helpers.d.ts","sourceRoot":"","sources":["../../src/lib/testing/integration_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAW7B,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC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,SAAS,KAAG,aAKrD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAChC,WAAW,aAAa,EACxB,QAAQ,oBAAoB,EAC5B,gBAAgB,WAAW,EAC3B,eAAe,WAAW,KACxB,MAAM,CAAC,MAAM,EAAE,MAAM,CAavB,CAAC;AAEF,mFAAmF;AACnF,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,KAAK,gBAAgB,CAAC;CAC9F;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,sBAAsB,GAClC,WAAW,aAAa,EACxB,SAAS,mBAAmB,KAC1B,gBAWF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAC7B,MAAM,SAAS,EACf,QAAQ,oBAAoB,EAC5B,gBAAgB,WAAW,EAC3B,eAAe,WAAW,KACxB,MAAM,CAAC,MAAM,EAAE,MAAM,CACoE,CAAC;AAE7F;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,GACzC,WAAW,aAAa,EACxB,cAAc,OAAO,KACnB,OAAiD,CAAC;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GAAI,QAAQ,MAAM,EAAE,QAAQ,OAAO,KAAG,OACQ,CAAC;AAEtF;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GAAI,QAAQ,MAAM,EAAE,QAAQ,OAAO,KAAG,OACjB,CAAC"}
@@ -9,26 +9,26 @@ import { parse } from '@fuzdev/fuz_schema/schema.ts';
9
9
  import { is_null_schema } from '../http/schema_helpers.js';
10
10
  import { get_route_error_map } from '../http/route_errors.js';
11
11
  import { is_public_auth } from '../http/auth_shape.js';
12
- import { ERROR_AUTHENTICATION_REQUIRED } from '../http/error_schemas.js';
12
+ import { ERROR_AUTHENTICATION_REQUIRED, ERROR_CREDENTIAL_TYPE_REQUIRED, ERROR_METHOD_NOT_ALLOWED, ERROR_ROUTE_NOT_FOUND, NOT_FOUND_TEXT } from '../http/error_schemas.js';
13
13
  import { ROLE_ADMIN } from '../auth/role_schema.js';
14
14
  import { create_test_request_headers } from './test_origin.js';
15
- import { decode_route_path, find_mounted_route, is_json_response, to_mounted_routes } from '../http/route_error_check.js';
15
+ import { find_mounted_route, is_json_response, to_mounted_routes } from '../http/route_error_check.js';
16
16
  import { assert_error_response_declared } from './assertions.js';
17
17
  /** Each spec list's compiled routes, so a list is compiled once. */
18
18
  const mounted_routes_cache = new WeakMap();
19
19
  /**
20
- * A request path as Hono reads it: the URL's pathname (a query string
21
- * dropped, `.` and `..` segments resolved), percent-decoded as
22
- * `decode_route_path` decodes it.
20
+ * A request path as the assembled server routes it: the URL's pathname (a
21
+ * query string dropped, `.` and `..` segments resolved, as the TS runtimes
22
+ * resolve them), nothing percent-decoded (`get_request_path`).
23
23
  */
24
- const to_hono_path = (path) => decode_route_path(new URL(path, 'http://localhost').pathname);
24
+ const to_hono_path = (path) => new URL(path, 'http://localhost').pathname;
25
25
  /**
26
26
  * Find the route spec a request reaches: the first in list (mount) order
27
27
  * whose method and path template match it, `HEAD` read as `GET` — the order
28
28
  * Hono dispatches by, which the DEV error check reads through Hono's own
29
29
  * router (`create_route_lookup`). This lookup is hono-free
30
30
  * (`find_mounted_route`), pinned against Hono by the route-lookup tests. The
31
- * path is read as Hono reads it: its pathname, percent-decoded.
31
+ * path is read as the server routes it: its pathname, nothing percent-decoded.
32
32
  *
33
33
  * A path template passed as the path (`/api/things/:id`, a segment that is
34
34
  * `*` or starts with `:`) finds its own spec first, outranking mount order.
@@ -63,7 +63,6 @@ export const rest_auth_route_suffixes = [
63
63
  '/login',
64
64
  '/logout',
65
65
  '/password',
66
- '/verify',
67
66
  '/signup',
68
67
  '/bootstrap'
69
68
  ];
@@ -107,8 +106,14 @@ export const find_auth_route = (specs, suffix, method) => {
107
106
  * no schema applies: a 2xx on a route with a null output, or an error status
108
107
  * the map doesn't declare.
109
108
  *
109
+ * An answer no route gave never passes, whatever the route declares: a
110
+ * `405`, the JSON `route_not_found` 404, or the plain `NOT_FOUND_TEXT` 404
111
+ * (`server/unmatched_route.ts`) means the backend doesn't mount the route the
112
+ * spec describes.
113
+ *
110
114
  * @param route_error_maps - each route's error map, keyed `METHOD path` (`AppSurfaceSpec.route_error_maps`)
111
- * @throws Error if no route spec matches `method` + `path`, if the body fails
115
+ * @throws Error if no route spec matches `method` + `path`, if the backend
116
+ * answered for no route (the route isn't mounted), if the body fails
112
117
  * its output schema, if a JSON error is at a status the route's map lacks or
113
118
  * off its schema, or if the response is non-JSON despite a declared schema
114
119
  * for its status.
@@ -118,6 +123,7 @@ export const assert_response_matches_spec = async (route_specs, method, path, re
118
123
  if (!spec) {
119
124
  throw new Error(`No route spec found for ${method} ${path}`);
120
125
  }
126
+ await assert_route_answered(method, path, response);
121
127
  // the DEV error check's gate: only a JSON response has a body to check
122
128
  let body;
123
129
  let parsed = false;
@@ -154,6 +160,34 @@ export const assert_response_matches_spec = async (route_specs, method, path, re
154
160
  await assert_error_response_declared(get_route_error_map(route_error_maps, spec), spec.jsonrpc ?? false, response, `${method} ${path}`);
155
161
  }
156
162
  };
163
+ /**
164
+ * Throw when a response is what the server answers for no route — a `405`,
165
+ * the `route_not_found` 404, or the plain `NOT_FOUND_TEXT` 404 — so a route
166
+ * the backend doesn't mount can't pass for one that refused.
167
+ */
168
+ const assert_route_answered = async (method, path, response) => {
169
+ const unmounted = `${method} ${path} (${response.status}) was answered by no route — the backend doesn't mount it`;
170
+ if (response.status === 405)
171
+ throw new Error(`${unmounted}: ${ERROR_METHOD_NOT_ALLOWED}`);
172
+ if (response.status !== 404)
173
+ return;
174
+ const text = await response.clone().text();
175
+ if (is_json_response(response)) {
176
+ let body;
177
+ try {
178
+ body = JSON.parse(text);
179
+ }
180
+ catch {
181
+ return;
182
+ }
183
+ if (body?.error === ERROR_ROUTE_NOT_FOUND) {
184
+ throw new Error(`${unmounted}: ${ERROR_ROUTE_NOT_FOUND}`);
185
+ }
186
+ }
187
+ else if (text === NOT_FOUND_TEXT) {
188
+ throw new Error(`${unmounted}: ${JSON.stringify(NOT_FOUND_TEXT)}`);
189
+ }
190
+ };
157
191
  /** Fields in error responses that indicate information leakage. */
158
192
  const LEAKY_FIELD_PATTERNS = [
159
193
  'stack',
@@ -282,6 +316,39 @@ export const to_principal_headers = (principal, keeper, authed_account, admin_ac
282
316
  return authed_account.create_session_headers();
283
317
  }
284
318
  };
319
+ /**
320
+ * The transport a principal's request goes through, so the request carries
321
+ * the principal's credential and nothing else. Cross-process
322
+ * `fixture.transport` adds the keeper's session cookie from its jar (unless
323
+ * the request names a `Cookie`) and a default `Origin`:
324
+ *
325
+ * - `'daemon_token'` goes cookie-free and without an `Origin`. Behind an
326
+ * `Origin` the daemon token is discarded as browser context and the
327
+ * keeper's cookie answers in its place, so a daemon-gated call is refused
328
+ * for its credential type and its success path goes unexercised.
329
+ * - `'public'` goes cookie-free with the default `Origin` kept, so a public
330
+ * route or method is called anonymously on both legs — over
331
+ * `fixture.transport` the keeper's cookie would ride along cross-process
332
+ * while in-process the call is anonymous.
333
+ * - `'admin'`, `'keeper'` and `'authed'` keep the fixture's transport: each
334
+ * sends a session `Cookie` header (`to_principal_headers`), which replaces
335
+ * the jar's.
336
+ *
337
+ * @param principal - the principal `pick_auth_principal` chose
338
+ * @param fixture - the fixture's transports
339
+ */
340
+ export const to_principal_transport = (principal, fixture) => {
341
+ switch (principal) {
342
+ case 'daemon_token':
343
+ return fixture.fresh_transport({ origin: null });
344
+ case 'public':
345
+ return fixture.fresh_transport();
346
+ case 'admin':
347
+ case 'keeper':
348
+ case 'authed':
349
+ return fixture.transport;
350
+ }
351
+ };
285
352
  /**
286
353
  * Pick request headers matching a route spec's auth requirement
287
354
  * (`pick_auth_principal`, then `to_principal_headers`):
@@ -323,3 +390,14 @@ export const round_trip_uses_fresh_account = (principal, side_effects) => princi
323
390
  * error's `data.reason`
324
391
  */
325
392
  export const is_unauthenticated_refusal = (status, reason) => status === 401 && (reason === undefined || reason === ERROR_AUTHENTICATION_REQUIRED);
393
+ /**
394
+ * Whether a response refuses the request for the channel its credential came
395
+ * on: a 403 reading `credential_type_required`. The round trips send each
396
+ * principal a credential its auth admits, so this answer to one of them means
397
+ * the credential was lost on the way or another answered in its place.
398
+ *
399
+ * @param status - the HTTP status
400
+ * @param reason - the refusal's reason: a REST body's `error`, a JSON-RPC
401
+ * error's `data.reason`
402
+ */
403
+ export const is_credential_type_refusal = (status, reason) => status === 403 && reason === ERROR_CREDENTIAL_TYPE_REQUIRED;