@fuzdev/fuz_app 0.183.0 → 0.185.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 (223) hide show
  1. package/dist/actions/CLAUDE.md +538 -1223
  2. package/dist/actions/action_codegen.d.ts +1 -1
  3. package/dist/actions/action_codegen.d.ts.map +1 -1
  4. package/dist/actions/action_codegen.js +3 -2
  5. package/dist/actions/connection_closer.d.ts +11 -9
  6. package/dist/actions/connection_closer.d.ts.map +1 -1
  7. package/dist/actions/connection_closer.js +11 -9
  8. package/dist/actions/frontend_rpc_client.d.ts +1 -1
  9. package/dist/actions/register_action_ws.d.ts +21 -1
  10. package/dist/actions/register_action_ws.d.ts.map +1 -1
  11. package/dist/actions/register_action_ws.js +2 -1
  12. package/dist/actions/ws_socket_session.d.ts +25 -4
  13. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  14. package/dist/actions/ws_socket_session.js +81 -25
  15. package/dist/auth/CLAUDE.md +433 -1048
  16. package/dist/auth/account_queries.d.ts +1 -1
  17. package/dist/auth/account_queries.js +1 -1
  18. package/dist/auth/account_routes.d.ts +4 -5
  19. package/dist/auth/account_routes.d.ts.map +1 -1
  20. package/dist/auth/account_routes.js +8 -10
  21. package/dist/auth/admin_actions.d.ts.map +1 -1
  22. package/dist/auth/admin_actions.js +10 -11
  23. package/dist/auth/api_token.d.ts +20 -3
  24. package/dist/auth/api_token.d.ts.map +1 -1
  25. package/dist/auth/api_token.js +28 -9
  26. package/dist/auth/api_token_queries.d.ts +2 -2
  27. package/dist/auth/api_token_queries.js +2 -2
  28. package/dist/auth/audit_log_routes.d.ts +1 -1
  29. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  30. package/dist/auth/audit_log_routes.js +3 -2
  31. package/dist/auth/audit_log_schema.d.ts +15 -9
  32. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  33. package/dist/auth/audit_log_schema.js +1 -2
  34. package/dist/auth/auth_guard_resolver.d.ts +1 -1
  35. package/dist/auth/auth_guard_resolver.js +1 -1
  36. package/dist/auth/bearer_auth.d.ts +2 -5
  37. package/dist/auth/bearer_auth.d.ts.map +1 -1
  38. package/dist/auth/bearer_auth.js +4 -13
  39. package/dist/auth/bootstrap_account.d.ts +13 -15
  40. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  41. package/dist/auth/bootstrap_account.js +9 -11
  42. package/dist/auth/bootstrap_routes.d.ts +20 -21
  43. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  44. package/dist/auth/bootstrap_routes.js +21 -19
  45. package/dist/auth/bootstrap_token_store.d.ts +3 -4
  46. package/dist/auth/bootstrap_token_store.d.ts.map +1 -1
  47. package/dist/auth/bootstrap_token_store.js +1 -1
  48. package/dist/auth/cleanup.d.ts +34 -3
  49. package/dist/auth/cleanup.d.ts.map +1 -1
  50. package/dist/auth/cleanup.js +11 -3
  51. package/dist/auth/daemon_token.d.ts +5 -1
  52. package/dist/auth/daemon_token.d.ts.map +1 -1
  53. package/dist/auth/daemon_token_middleware.d.ts +12 -8
  54. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  55. package/dist/auth/daemon_token_middleware.js +15 -21
  56. package/dist/auth/deps.d.ts +11 -0
  57. package/dist/auth/deps.d.ts.map +1 -1
  58. package/dist/auth/invite_queries.d.ts +51 -3
  59. package/dist/auth/invite_queries.d.ts.map +1 -1
  60. package/dist/auth/invite_queries.js +81 -6
  61. package/dist/auth/invite_schema.d.ts +2 -1
  62. package/dist/auth/invite_schema.d.ts.map +1 -1
  63. package/dist/auth/middleware.d.ts +2 -3
  64. package/dist/auth/middleware.d.ts.map +1 -1
  65. package/dist/auth/middleware.js +3 -3
  66. package/dist/auth/request_context.d.ts +3 -3
  67. package/dist/auth/request_context.js +3 -3
  68. package/dist/auth/role_grant_offer_actions.d.ts +2 -2
  69. package/dist/auth/role_grant_offer_actions.js +2 -2
  70. package/dist/auth/session_cookie.d.ts +82 -174
  71. package/dist/auth/session_cookie.d.ts.map +1 -1
  72. package/dist/auth/session_cookie.js +80 -130
  73. package/dist/auth/session_middleware.d.ts +8 -17
  74. package/dist/auth/session_middleware.d.ts.map +1 -1
  75. package/dist/auth/session_middleware.js +14 -23
  76. package/dist/auth/session_queries.d.ts +9 -14
  77. package/dist/auth/session_queries.d.ts.map +1 -1
  78. package/dist/auth/session_queries.js +8 -9
  79. package/dist/auth/signup_routes.d.ts.map +1 -1
  80. package/dist/auth/signup_routes.js +4 -6
  81. package/dist/db/CLAUDE.md +5 -3
  82. package/dist/dev/setup.d.ts +3 -1
  83. package/dist/dev/setup.d.ts.map +1 -1
  84. package/dist/dev/setup.js +3 -1
  85. package/dist/http/CLAUDE.md +315 -768
  86. package/dist/http/db_routes.d.ts +1 -1
  87. package/dist/http/db_routes.js +1 -1
  88. package/dist/http/origin.d.ts +7 -8
  89. package/dist/http/origin.d.ts.map +1 -1
  90. package/dist/http/origin.js +7 -8
  91. package/dist/http/pending_effects.d.ts +82 -4
  92. package/dist/http/pending_effects.d.ts.map +1 -1
  93. package/dist/http/pending_effects.js +82 -4
  94. package/dist/http/route_result.d.ts +1 -1
  95. package/dist/http/route_spec.d.ts +17 -14
  96. package/dist/http/route_spec.d.ts.map +1 -1
  97. package/dist/realtime/audit_log_sse.d.ts +1 -1
  98. package/dist/realtime/sse.d.ts +6 -25
  99. package/dist/realtime/sse.d.ts.map +1 -1
  100. package/dist/realtime/sse.js +4 -25
  101. package/dist/realtime/sse_constants.d.ts +1 -1
  102. package/dist/realtime/sse_constants.js +1 -1
  103. package/dist/server/app_backend.d.ts +4 -5
  104. package/dist/server/app_backend.d.ts.map +1 -1
  105. package/dist/server/app_backend.js +3 -1
  106. package/dist/server/app_server.d.ts +87 -76
  107. package/dist/server/app_server.d.ts.map +1 -1
  108. package/dist/server/app_server.js +111 -91
  109. package/dist/server/app_server_context.d.ts +1 -2
  110. package/dist/server/app_server_context.d.ts.map +1 -1
  111. package/dist/server/env.js +2 -2
  112. package/dist/server/shutdown_drain.d.ts +69 -0
  113. package/dist/server/shutdown_drain.d.ts.map +1 -0
  114. package/dist/server/shutdown_drain.js +77 -0
  115. package/dist/testing/CLAUDE.md +89 -57
  116. package/dist/testing/admin_integration.d.ts +4 -5
  117. package/dist/testing/admin_integration.d.ts.map +1 -1
  118. package/dist/testing/admin_integration.js +39 -23
  119. package/dist/testing/app_server.d.ts +3 -8
  120. package/dist/testing/app_server.d.ts.map +1 -1
  121. package/dist/testing/app_server.js +10 -9
  122. package/dist/testing/attack_surface.d.ts +1 -1
  123. package/dist/testing/attack_surface.d.ts.map +1 -1
  124. package/dist/testing/audit_completeness.d.ts +2 -3
  125. package/dist/testing/audit_completeness.d.ts.map +1 -1
  126. package/dist/testing/audit_completeness.js +1 -1
  127. package/dist/testing/cross_backend/bootstrap_backend.d.ts +3 -1
  128. package/dist/testing/cross_backend/bootstrap_backend.d.ts.map +1 -1
  129. package/dist/testing/cross_backend/bootstrap_backend.js +5 -1
  130. package/dist/testing/cross_backend/capability_mounts.d.ts.map +1 -1
  131. package/dist/testing/cross_backend/capability_mounts.js +16 -11
  132. package/dist/testing/cross_backend/conformance_table.d.ts +5 -6
  133. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  134. package/dist/testing/cross_backend/conformance_table.js +4 -4
  135. package/dist/testing/cross_backend/cookie_attributes.js +1 -1
  136. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +10 -1
  137. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
  138. package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +33 -7
  139. package/dist/testing/cross_backend/default_backend_configs.d.ts +3 -3
  140. package/dist/testing/cross_backend/default_spine_surface.d.ts +0 -6
  141. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
  142. package/dist/testing/cross_backend/default_spine_surface.js +4 -9
  143. package/dist/testing/cross_backend/differential.d.ts +2 -3
  144. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  145. package/dist/testing/cross_backend/differential.js +1 -1
  146. package/dist/testing/cross_backend/full_spine_mount.d.ts +1 -42
  147. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  148. package/dist/testing/cross_backend/full_spine_mount.js +45 -4
  149. package/dist/testing/cross_backend/in_process_setup.d.ts +7 -8
  150. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  151. package/dist/testing/cross_backend/in_process_setup.js +10 -13
  152. package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
  153. package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -1
  154. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +3 -4
  155. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  156. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +2 -2
  157. package/dist/testing/cross_backend/setup.d.ts +1 -1
  158. package/dist/testing/cross_backend/spawn_backend.d.ts +14 -0
  159. package/dist/testing/cross_backend/spawn_backend.d.ts.map +1 -1
  160. package/dist/testing/cross_backend/spawn_backend.js +56 -8
  161. package/dist/testing/cross_backend/spine_suites.d.ts +18 -16
  162. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  163. package/dist/testing/cross_backend/spine_suites.js +38 -18
  164. package/dist/testing/cross_backend/standard.d.ts +19 -84
  165. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  166. package/dist/testing/cross_backend/standard.js +8 -23
  167. package/dist/testing/cross_backend/standard_auth.d.ts +74 -0
  168. package/dist/testing/cross_backend/standard_auth.d.ts.map +1 -0
  169. package/dist/testing/cross_backend/standard_auth.js +28 -0
  170. package/dist/testing/cross_backend/standard_bundle.d.ts +48 -0
  171. package/dist/testing/cross_backend/standard_bundle.d.ts.map +1 -0
  172. package/dist/testing/cross_backend/standard_bundle.js +43 -0
  173. package/dist/testing/cross_backend/testing_credential_read.d.ts +10 -11
  174. package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -1
  175. package/dist/testing/cross_backend/testing_credential_read.js +12 -12
  176. package/dist/testing/cross_backend/testing_reset_actions.d.ts +46 -30
  177. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  178. package/dist/testing/cross_backend/testing_reset_actions.js +52 -31
  179. package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
  180. package/dist/testing/cross_backend/testing_server_bun.js +5 -4
  181. package/dist/testing/cross_backend/testing_server_core.d.ts +16 -3
  182. package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
  183. package/dist/testing/cross_backend/testing_server_core.js +22 -7
  184. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +6 -2
  185. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  186. package/dist/testing/cross_backend/ts_spine_backend_config.js +7 -3
  187. package/dist/testing/daemon_token_rotation.d.ts.map +1 -1
  188. package/dist/testing/daemon_token_rotation.js +2 -3
  189. package/dist/testing/error_coverage.d.ts +5 -0
  190. package/dist/testing/error_coverage.d.ts.map +1 -1
  191. package/dist/testing/error_coverage.js +2 -1
  192. package/dist/testing/integration.d.ts +6 -23
  193. package/dist/testing/integration.d.ts.map +1 -1
  194. package/dist/testing/integration.js +53 -83
  195. package/dist/testing/integration_helpers.d.ts +16 -0
  196. package/dist/testing/integration_helpers.d.ts.map +1 -1
  197. package/dist/testing/integration_helpers.js +29 -1
  198. package/dist/testing/middleware_gate_probes.d.ts +55 -1
  199. package/dist/testing/middleware_gate_probes.d.ts.map +1 -1
  200. package/dist/testing/middleware_gate_probes.js +69 -3
  201. package/dist/testing/rate_limiting.d.ts +2 -3
  202. package/dist/testing/rate_limiting.d.ts.map +1 -1
  203. package/dist/testing/rate_limiting.js +3 -3
  204. package/dist/testing/rpc_helpers.d.ts +1 -2
  205. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  206. package/dist/testing/rpc_helpers.js +3 -3
  207. package/dist/testing/rpc_round_trip.d.ts +2 -3
  208. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  209. package/dist/testing/rpc_round_trip.js +1 -1
  210. package/dist/testing/sse_round_trip.d.ts +2 -3
  211. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  212. package/dist/testing/sse_round_trip.js +2 -2
  213. package/dist/testing/stubs.d.ts +5 -6
  214. package/dist/testing/stubs.d.ts.map +1 -1
  215. package/dist/testing/stubs.js +10 -8
  216. package/dist/testing/test_app.d.ts +8 -5
  217. package/dist/testing/test_app.d.ts.map +1 -1
  218. package/dist/testing/test_app.js +7 -7
  219. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  220. package/dist/testing/ws_round_trip.js +3 -0
  221. package/dist/ui/ui_format.d.ts.map +1 -1
  222. package/dist/ui/ui_format.js +1 -2
  223. package/package.json +1 -1
@@ -32,6 +32,7 @@ import type { Context, Hono } from 'hono';
32
32
  import type { UpgradeWebSocket } from 'hono/ws';
33
33
  import { type Logger as LoggerType } from '@fuzdev/fuz_util/log.ts';
34
34
  import type { RuntimeDeps } from '../../runtime/deps.js';
35
+ import { type ShutdownDrainGivenUp } from '../../server/shutdown_drain.js';
35
36
  /**
36
37
  * Adapter-built handle to a bound HTTP server.
37
38
  *
@@ -90,7 +91,15 @@ export interface TestingServerAdapter {
90
91
  pid: number;
91
92
  /** Register SIGINT/SIGTERM listeners that invoke `handler` once each. */
92
93
  register_shutdown_signals: (handler: () => Promise<void>) => void;
93
- /** Forceful exit on graceful-shutdown completion or fatal error. */
94
+ /**
95
+ * Forceful exit on graceful-shutdown completion or fatal error: `0` for a
96
+ * shutdown that drained everything, `1` for one that gave up or threw.
97
+ *
98
+ * A give-up's exit still waits for `BuiltTestingApp.close` to return, and
99
+ * that closes the database: on `pg`, `pool.end()` waits for a client a
100
+ * wedged handler holds, so the exit can wait past teardown's SIGKILL. The
101
+ * harness's default databases (pglet, PGlite) have no pool to wait on.
102
+ */
94
103
  exit: (code: number) => never;
95
104
  }
96
105
  /** What the core hands a `StartTestingServerOptions.build_app` seam. */
@@ -115,8 +124,10 @@ export interface BuiltTestingApp {
115
124
  * Tear down backend(s) + DB + any rotation on graceful shutdown. Called
116
125
  * after the listener stops accepting connections and before its drain is
117
126
  * awaited, so it must end live WebSockets (`AppServer.close` does).
127
+ * Resolves what the shutdown gave up on — `AppServer.close`'s report — and
128
+ * a report that gave up on anything exits the process `1`.
118
129
  */
119
- close: () => Promise<void>;
130
+ close: () => Promise<ShutdownDrainGivenUp>;
120
131
  }
121
132
  /** Options for `start_testing_server`. */
122
133
  export interface StartTestingServerOptions {
@@ -159,7 +170,9 @@ export declare const is_loopback_bind_host: (host: string) => boolean;
159
170
  * Boot a test-mode server using the supplied runtime adapter.
160
171
  *
161
172
  * Mirrors a production `start_server` at the surface level — stale-daemon
162
- * check, daemon-info write, bind, graceful shutdown — but the app is the
173
+ * check, daemon-info write, bind, graceful shutdown, exiting `1` when the
174
+ * shutdown gave up on work still running or threw, without waiting for the
175
+ * listener's drain behind a request it gave up on — but the app is the
163
176
  * caller's no-domain (or domain) `StartTestingServerOptions.build_app`
164
177
  * and the runtime boundary is the `TestingServerAdapter`. Refuses any
165
178
  * non-loopback bind host (the test binary must stay on loopback — see
@@ -1 +1 @@
1
- {"version":3,"file":"testing_server_core.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_core.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAU,KAAK,MAAM,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,4DAA4D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IACH,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACzE,0EAA0E;IAC1E,GAAG,CAAC,EAAE,UAAU,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,OAGpD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAU,SAAS,yBAAyB,KAAG,OAAO,CAAC,IAAI,CA4D3F,CAAC"}
1
+ {"version":3,"file":"testing_server_core.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_core.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAU,KAAK,MAAM,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAoB,KAAK,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAE7F;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,4DAA4D;AAC5D,MAAM,WAAW,uBAAuB;IACvC;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,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ACb,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACzE,0EAA0E;IAC1E,GAAG,CAAC,EAAE,UAAU,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,OAGpD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,GAAU,SAAS,yBAAyB,KAAG,OAAO,CAAC,IAAI,CAuE3F,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import '../assert_dev_env.js';
2
2
  import { Logger } from '@fuzdev/fuz_util/log.ts';
3
3
  import { write_daemon_info, read_daemon_info, is_daemon_running } from '../daemon_info.js';
4
+ import { shutdown_gave_up } from '../../server/shutdown_drain.js';
4
5
  /**
5
6
  * Loopback bind hosts — the only ones the test binary may serve on. It ships
6
7
  * deterministic dev secrets (fixed cookie keys + bootstrap token in
@@ -18,7 +19,9 @@ export const is_loopback_bind_host = (host) => {
18
19
  * Boot a test-mode server using the supplied runtime adapter.
19
20
  *
20
21
  * Mirrors a production `start_server` at the surface level — stale-daemon
21
- * check, daemon-info write, bind, graceful shutdown — but the app is the
22
+ * check, daemon-info write, bind, graceful shutdown, exiting `1` when the
23
+ * shutdown gave up on work still running or threw, without waiting for the
24
+ * listener's drain behind a request it gave up on — but the app is the
22
25
  * caller's no-domain (or domain) `StartTestingServerOptions.build_app`
23
26
  * and the runtime boundary is the `TestingServerAdapter`. Refuses any
24
27
  * non-loopback bind host (the test binary must stay on loopback — see
@@ -60,22 +63,34 @@ export const start_testing_server = async (options) => {
60
63
  adapter.exit(1);
61
64
  shutting_down = true;
62
65
  log.info('shutting down...');
66
+ let failed = false;
63
67
  try {
64
68
  // Stop accepting first so no new request reaches a closed DB, but
65
69
  // don't await the drain yet: live WebSockets hold it open until
66
70
  // `built.close()` ends them (`AppServer.close`), so awaiting it
67
71
  // first would wait on sockets nothing is closing. A request already
68
- // in flight when the signal lands may still see the backend close
69
- // under it — acceptable for a test binary, where shutdown follows
70
- // the suite.
72
+ // in flight when the signal lands is waited for by `AppServer.close`
73
+ // (behind `built.close()`), within its drain bound.
71
74
  const drained = server.shutdown();
72
- await built.close();
73
- await drained;
75
+ // awaited only on a clean close, below — never left unhandled
76
+ drained.catch(() => { });
77
+ const given_up = await built.close();
78
+ // `AppServer.close` has logged what it gave up on
79
+ failed = shutdown_gave_up(given_up);
80
+ // a request the drain gave up on still holds its connection, which
81
+ // the listener's close would wait on past teardown's SIGKILL — as
82
+ // the Rust spine's one bound covers its listener drain too
83
+ if (!failed)
84
+ await drained;
74
85
  }
75
86
  catch (error) {
76
87
  log.error('shutdown error:', error);
88
+ failed = true;
77
89
  }
78
- adapter.exit(0);
90
+ // a shutdown that went wrong is a failed exit, which the cross-backend
91
+ // teardown reports — twin of the Rust spine's
92
+ // `StartupError::ShutdownGivenUp`, which exits 1
93
+ adapter.exit(failed ? 1 : 0);
79
94
  };
80
95
  adapter.register_shutdown_signals(shutdown);
81
96
  };
@@ -92,8 +92,12 @@ export interface TsSpineBackendConfigOptions {
92
92
  readonly db_audit_checkout_timeout_ms?: number;
93
93
  }
94
94
  /**
95
- * `BackendConfig` for the Node TS spine binary — spawned via `gro run`
96
- * (Gro's TS loader resolves the entry's relative imports).
95
+ * `BackendConfig` for the Node TS spine binary — spawned on plain Node (type
96
+ * stripping, with the `development` condition the testing modules assert),
97
+ * not under `gro run`: gro's CLI passes a SIGTERM on to the task's process
98
+ * but then dies by the signal itself, without waiting for the server's exit
99
+ * code, so teardown — which holds the spawned process to exit `0` — would see
100
+ * a signal exit whatever the shutdown exited with.
97
101
  */
98
102
  export declare const ts_spine_node_backend_config: (options?: TsSpineBackendConfigOptions) => BackendConfig;
99
103
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ts_spine_backend_config.d.ts","sourceRoot":"","sources":["../../../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AAS,2BAAgC,KACvC,aAyBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GACvC,UAAS,2BAAgC,KACvC,aAyBF,CAAC"}
@@ -76,8 +76,12 @@ export const TS_SPINE_BUN_ENTRY = 'src/test/cross_backend/testing_spine_server_b
76
76
  */
77
77
  const login_rate_limit_env = (enable) => enable ? { [LOGIN_RATE_LIMIT_ENABLED_ENV]: 'true' } : {};
78
78
  /**
79
- * `BackendConfig` for the Node TS spine binary — spawned via `gro run`
80
- * (Gro's TS loader resolves the entry's relative imports).
79
+ * `BackendConfig` for the Node TS spine binary — spawned on plain Node (type
80
+ * stripping, with the `development` condition the testing modules assert),
81
+ * not under `gro run`: gro's CLI passes a SIGTERM on to the task's process
82
+ * but then dies by the signal itself, without waiting for the server's exit
83
+ * code, so teardown — which holds the spawned process to exit `0` — would see
84
+ * a signal exit whatever the shutdown exited with.
81
85
  */
82
86
  export const ts_spine_node_backend_config = (options = {}) => {
83
87
  const { port = TS_SPINE_NODE_DEFAULT_PORT, database_url, enable_login_rate_limit, name = 'ts_spine_node' } = options;
@@ -86,7 +90,7 @@ export const ts_spine_node_backend_config = (options = {}) => {
86
90
  ...make_default_ts_backend_config({
87
91
  name,
88
92
  port,
89
- start_command: ['gro', 'run', TS_SPINE_NODE_ENTRY],
93
+ start_command: ['node', '--conditions=development', TS_SPINE_NODE_ENTRY],
90
94
  database_url,
91
95
  paths,
92
96
  daemon_token_dir_env: TS_SPINE_DIR_ENV,
@@ -1 +1 @@
1
- {"version":3,"file":"daemon_token_rotation.d.ts","sourceRoot":"","sources":["../../src/lib/testing/daemon_token_rotation.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,KAA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BAAqB,CAAC;AACrD,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGvF,8DAA8D;AAC9D,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAEnD,iDAAiD;AACjD,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,iBAAiB,GAAG,QAAQ,CAAC,CAAC;AAE7F;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,GAC9B,SAAS,oBAAoB,EAC7B,YAAY,MAAM,EAClB,OAAO,MAAM,KACX,OAAO,CAAC,IAAI,CAId,CAAC;AAEF,yCAAyC;AACzC,MAAM,WAAW,0BAA0B;IAC1C;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,gDAAgD;AAChD,MAAM,WAAW,mBAAmB;IACnC,2EAA2E;IAC3E,KAAK,EAAE,gBAAgB,CAAC;IACxB,kGAAkG;IAClG,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,2BAA2B,GACvC,SAAS,oBAAoB,GAAG,YAAY,EAC5C,MAAM,SAAS,EACf,SAAS,0BAA0B,EACnC,KAAK,MAAM,KACT,OAAO,CAAC,mBAAmB,CAoD7B,CAAC"}
@@ -42,9 +42,8 @@ export const start_daemon_token_rotation = async (runtime, deps, options, log) =
42
42
  if (last_slash > 0) {
43
43
  await runtime.mkdir(token_path.slice(0, last_slash), { recursive: true });
44
44
  }
45
- // resolve keeper account (may be null pre-bootstrap; the middleware
46
- // lazily refreshes on the first null hit to cover the
47
- // rotation-starts-before-bootstrap case)
45
+ // resolve keeper account (null pre-bootstrap; the bootstrap route sets it
46
+ // once its account commits, given this state on `create_app_server`)
48
47
  const keeper_account_id = await resolve_keeper_account_id(deps);
49
48
  // generate initial token and write to disk
50
49
  const initial_token = generate_daemon_token();
@@ -15,6 +15,11 @@ export interface CoverageFilterOptions {
15
15
  ignore_routes?: Array<string>;
16
16
  /** HTTP status codes to skip. */
17
17
  ignore_statuses?: Array<number>;
18
+ /**
19
+ * Error codes to skip at any status — the codes another suite owns. A code
20
+ * names one status (`assert_error_code_status_consistency`).
21
+ */
22
+ ignore_codes?: ReadonlyArray<string>;
18
23
  }
19
24
  /**
20
25
  * Tracks which route × status (and route × status × code) combinations have
@@ -1 +1 @@
1
- {"version":3,"file":"error_coverage.d.ts","sourceRoot":"","sources":["../../src/lib/testing/error_coverage.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAmB7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGlF,gFAAgF;AAChF,MAAM,WAAW,cAAc;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;CACb;AAED,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACrC,kDAAkD;IAClD,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,iCAAiC;IACjC,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAChC;AAgDD;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,sBAAsB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,IAAI,CAAC;IAErE;;OAEG;gBACS,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,IAAI;IAIxE;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAa;IAE3C;;;;;;;;;;;;;O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AAM,CAAC;AAEtD,2CAA2C;AAC3C,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IAClE,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAYD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,GACjC,WAAW,sBAAsB,EACjC,aAAa,KAAK,CAAC,SAAS,CAAC,EAC7B,UAAU,oBAAoB,KAC5B,IAsBF,CAAC"}
@@ -31,6 +31,7 @@ import { find_route_spec, assert_response_matches_spec } from './integration_hel
31
31
  const walk_coverage = (collector, route_specs, options) => {
32
32
  const ignore_routes = new Set(options?.ignore_routes);
33
33
  const ignore_statuses = new Set(options?.ignore_statuses);
34
+ const ignore_codes = new Set(options?.ignore_codes);
34
35
  const entries = [];
35
36
  for (const spec of route_specs) {
36
37
  const route_key = format_route_key(spec);
@@ -39,7 +40,7 @@ const walk_coverage = (collector, route_specs, options) => {
39
40
  // a code with two shapes at one status is one path
40
41
  const seen = new Set();
41
42
  for (const { status, code } of get_route_error_map(collector.route_error_maps, spec).defs) {
42
- if (ignore_statuses.has(status))
43
+ if (ignore_statuses.has(status) || ignore_codes.has(code))
43
44
  continue;
44
45
  const status_key = `${spec.method} ${spec.path}:${status}`;
45
46
  const code_key = `${status_key}:${code}`;
@@ -1,5 +1,4 @@
1
1
  import './assert_dev_env.js';
2
- import type { SessionOptions } from '../auth/session_cookie.js';
3
2
  import { type RpcEndpointsSuiteOption } from './rpc_helpers.js';
4
3
  import { type UncoveredEntry } from './error_coverage.js';
5
4
  import type { AppSurfaceSpec } from '../http/surface.js';
@@ -29,11 +28,11 @@ export interface StandardIntegrationTestOptions {
29
28
  /** Backend capability declarations for capability-gated cases. */
30
29
  capabilities: BackendCapabilities;
31
30
  /**
32
- * Session config — needed to resolve factory-form `rpc_endpoints`
31
+ * The session cookie's name — needed to resolve factory-form `rpc_endpoints`
33
32
  * against a stub `AppServerContext` at setup time and to read
34
33
  * `cookie_name` for manual cookie composition in the session cases.
35
34
  */
36
- session_options: SessionOptions<string>;
35
+ session_cookie_name: string;
37
36
  /**
38
37
  * RPC endpoint specs — required. This suite dispatches
39
38
  * `account_verify`, `account_session_*`, and `account_token_*` via
@@ -56,24 +55,6 @@ export interface StandardIntegrationTestOptions {
56
55
  * denial-path drivers.
57
56
  */
58
57
  error_coverage_min?: number;
59
- /**
60
- * Base URL the backend is reachable at, or `null` in-process. The
61
- * middleware-gate probes write their heads to the socket when there is one
62
- * (`fetch` replaces a caller's `Host` and `Content-Length`), and go through
63
- * the fixture's transport when there isn't.
64
- */
65
- base_url: string | null;
66
- /**
67
- * The backend's request-body cap on every counted route but the RPC
68
- * endpoint, in bytes — the body-limit probe declares one byte more.
69
- * Default `SPINE_BODY_LIMIT_DEFAULT_BYTES`, the spines' default.
70
- */
71
- max_body_bytes?: number;
72
- /**
73
- * The backend's request-body cap on the RPC endpoint, in bytes, when it
74
- * isn't `max_body_bytes`.
75
- */
76
- rpc_max_body_bytes?: number;
77
58
  /**
78
59
  * Called once the suite's tests have run, with the declared error paths of
79
60
  * the counted routes it never observed, before the coverage floor is
@@ -89,8 +70,10 @@ export interface StandardIntegrationTestOptions {
89
70
  * revocation, password change (incl. API token revocation), origin
90
71
  * verification, bearer auth (incl. browser context discard on mutations),
91
72
  * token revocation, cross-account isolation, expired credential rejection,
92
- * signup invite edge cases, response body validation, and the middleware
93
- * gates each counted route's error map declares (`middleware_gate_probes.ts`).
73
+ * signup invite edge cases, and response body validation. The middleware
74
+ * gates each counted route's error map declares are
75
+ * `describe_middleware_gate_tests`' (`middleware_gate_probes.ts`), a suite of
76
+ * their own since over a socket they write raw request heads.
94
77
  *
95
78
  * Each test group asserts that required routes exist, failing with a descriptive
96
79
  * message if the consumer's route specs are misconfigured.
@@ -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,cAA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C;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;AAK1D;;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,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;;;;;;;;OAWG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACpE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,mCAAmC,GAC/C,SAAS,8BAA8B,KACrC,IAg+CF,CAAC"}
@@ -5,7 +5,7 @@ import './assert_dev_env.js';
5
5
  * `describe_standard_integration_tests` creates a composable test suite that
6
6
  * exercises the full middleware stack (origin, session, bearer_auth, request_context)
7
7
  * against a real database. Consumers call it with their route factory and
8
- * session config — all auth route tests come for free.
8
+ * session cookie name — all auth route tests come for free.
9
9
  *
10
10
  * Tests use `stub_password_deps` (deterministic hashing, no Argon2 overhead).
11
11
  * Login handlers call `verify_password(submitted, stored_hash)` which works because
@@ -18,7 +18,7 @@ import './assert_dev_env.js';
18
18
  */
19
19
  import { describe, test, assert, afterAll } from 'vitest';
20
20
  import { parse_or_throw } from '@fuzdev/fuz_schema/schema.ts';
21
- import { find_auth_route, assert_response_matches_spec, assert_no_error_info_leakage } from './integration_helpers.js';
21
+ import { find_auth_route, assert_response_matches_spec, assert_no_error_info_leakage, is_standard_integration_route, MIDDLEWARE_GATE_ERROR_CODES } from './integration_helpers.js';
22
22
  import { find_rpc_action, rpc_call_for_spec, require_rpc_endpoint_path, resolve_rpc_endpoints_for_setup } from './rpc_helpers.js';
23
23
  import { ErrorCoverageCollector, assert_error_coverage, DEFAULT_INTEGRATION_ERROR_COVERAGE } from './error_coverage.js';
24
24
  import { is_public_auth } from '../http/auth_shape.js';
@@ -30,7 +30,6 @@ import { assert_iso8601_seconds, assert_iso8601_seconds_nullable } from './cross
30
30
  import { DEFAULT_TEST_PASSWORD } from './test_credentials.js';
31
31
  import { create_test_request_headers, TEST_ORIGIN } from './test_origin.js';
32
32
  import { create_test_raw_api_token } from './entities.js';
33
- import { assert_middleware_gate_refusal, format_middleware_gate_probe, plan_middleware_gate_probes, send_middleware_gate_probe } from './middleware_gate_probes.js';
34
33
  /**
35
34
  * Standard integration test suite for fuz_app auth routes.
36
35
  *
@@ -38,8 +37,10 @@ import { assert_middleware_gate_refusal, format_middleware_gate_probe, plan_midd
38
37
  * revocation, password change (incl. API token revocation), origin
39
38
  * verification, bearer auth (incl. browser context discard on mutations),
40
39
  * token revocation, cross-account isolation, expired credential rejection,
41
- * signup invite edge cases, response body validation, and the middleware
42
- * gates each counted route's error map declares (`middleware_gate_probes.ts`).
40
+ * signup invite edge cases, and response body validation. The middleware
41
+ * gates each counted route's error map declares are
42
+ * `describe_middleware_gate_tests`' (`middleware_gate_probes.ts`), a suite of
43
+ * their own since over a socket they write raw request heads.
43
44
  *
44
45
  * Each test group asserts that required routes exist, failing with a descriptive
45
46
  * message if the consumer's route specs are misconfigured.
@@ -68,23 +69,15 @@ export const describe_standard_integration_tests = (options) => {
68
69
  // confusing test failure when `rpc_endpoints` is missing. Factory-form
69
70
  // callers are resolved with a stub ctx purely to extract the endpoint
70
71
  // path; the running backend handles live dispatch.
71
- const rpc_endpoints_for_setup = resolve_rpc_endpoints_for_setup(options.rpc_endpoints, options.session_options);
72
+ const rpc_endpoints_for_setup = resolve_rpc_endpoints_for_setup(options.rpc_endpoints, options.session_cookie_name);
72
73
  const rpc_path = require_rpc_endpoint_path(rpc_endpoints_for_setup);
73
74
  describe('standard_integration', () => {
74
- const { cookie_name } = options.session_options;
75
+ const cookie_name = options.session_cookie_name;
75
76
  // Error coverage tracking across test groups
76
77
  const error_collector = new ErrorCoverageCollector(options.surface_source.route_error_maps);
77
- // the auth routes this suite drives: login / logout / password, signup
78
- // (when wired), and the shared RPC endpoint — admin-role routes belong to
79
- // the admin suite
80
- const is_suite_auth_route = (s) => {
81
- if (s.auth.roles?.includes('admin') ?? false)
82
- return false;
83
- const rest_suffixes = ['/login', '/logout', '/password', '/signup'];
84
- if (rest_suffixes.some((suffix) => s.path.endsWith(suffix)))
85
- return true;
86
- return s.path === rpc_path;
87
- };
78
+ // the auth routes this suite drives — admin-role routes belong to the
79
+ // admin suite
80
+ const is_suite_auth_route = (s) => is_standard_integration_route(s, rpc_path);
88
81
  afterAll(() => {
89
82
  // Scope coverage to auth routes this suite actually exercises:
90
83
  // login / logout / password drivers + signup invite edge cases
@@ -97,8 +90,11 @@ export const describe_standard_integration_tests = (options) => {
97
90
  // the admin suite instead.
98
91
  const auth_routes = route_specs.filter(is_suite_auth_route);
99
92
  const scoped_routes = auth_routes.length > 0 ? auth_routes : route_specs;
100
- options.check_uncovered_errors?.(error_collector.uncovered(scoped_routes));
93
+ // the middleware gates' refusals are `describe_middleware_gate_tests`'
94
+ const filter = { ignore_codes: MIDDLEWARE_GATE_ERROR_CODES };
95
+ options.check_uncovered_errors?.(error_collector.uncovered(scoped_routes, filter));
101
96
  assert_error_coverage(error_collector, scoped_routes, {
97
+ ...filter,
102
98
  min_coverage: options.error_coverage_min ?? DEFAULT_INTEGRATION_ERROR_COVERAGE
103
99
  });
104
100
  });
@@ -391,7 +387,7 @@ export const describe_standard_integration_tests = (options) => {
391
387
  // it exercises the authoritative server-side DB-row expiry gate over
392
388
  // real auth resolution on every spine, not the cookie-payload gate a
393
389
  // backdated-payload forge hit here. The payload gate stays covered by
394
- // `parse_session`'s own unit tests.
390
+ // `parse_session_from_cookies`'s own unit tests.
395
391
  });
396
392
  // --- 4. Session revocation ---
397
393
  describe('session revocation', () => {
@@ -680,40 +676,43 @@ export const describe_standard_integration_tests = (options) => {
680
676
  });
681
677
  // --- 8. Cross-account isolation ---
682
678
  describe('cross-account isolation', () => {
683
- test('non-admin cannot access admin routes', async () => {
684
- const fixture = await options.setup_test();
685
- // admin routes are optional in the base suite — admin-specific coverage
686
- // lives in describe_standard_admin_integration_tests.
687
- //
688
- // Pick an admin REST route where a clean role-denial 403 is
689
- // reachable: account-grain (`actor: 'none'`, so the authorization
690
- // phase doesn't first demand an acting actor → `actor_required`)
691
- // and input/param/query-free (params and query still validate ahead
692
- // of the auth phase — only body validation moved behind the gates,
693
- // per the 401 → authz → 403 → 429 → 400 order). Admin surfaces are
694
- // RPC-first now; a consumer may expose no such REST route (fuz_app
695
- // itself, zzz) — then this REST-era check is a no-op and RPC denial
696
- // is covered by `describe_rpc_attack_surface_tests`.
697
- const admin_route = route_specs.find((s) => (s.auth.roles?.includes('admin') ?? false) &&
698
- s.auth.actor === 'none' &&
699
- !s.input &&
700
- !s.params &&
701
- !s.query);
702
- if (!admin_route)
703
- return;
704
- // Probe with a freshly-created account — it holds no admin role
705
- // (the keeper fixture behind `create_session_headers` does, so it
706
- // would pass the gate).
707
- const non_admin = await fixture.create_account({ username: 'non_admin_admin_probe' });
708
- const res = await fixture.transport(admin_route.path, {
709
- method: admin_route.method,
710
- headers: { cookie: `${cookie_name}=${non_admin.session_cookie}` }
711
- });
712
- assert.strictEqual(res.status, 403);
713
- await error_collector.assert_and_record(route_specs, admin_route.method, admin_route.path, res);
714
- const body = await res.json();
715
- assert.strictEqual(body.error, 'insufficient_permissions');
716
- });
679
+ // admin routes are optional in the base suite — admin-specific coverage
680
+ // lives in describe_standard_admin_integration_tests.
681
+ //
682
+ // Pick an admin REST route where a clean role-denial 403 is
683
+ // reachable: account-grain (`actor: 'none'`, so the authorization
684
+ // phase doesn't first demand an acting actor → `actor_required`)
685
+ // and input/param/query-free (params and query still validate ahead
686
+ // of the auth phase — only body validation moved behind the gates,
687
+ // per the 401 → authz → 403 → 429 → 400 order). Admin surfaces are
688
+ // RPC-first now; a consumer may expose no such REST route (fuz_app
689
+ // itself, zzz) — then this REST-era check isn't registered and RPC denial
690
+ // is covered by `describe_rpc_attack_surface_tests`.
691
+ const admin_route = route_specs.find((s) => (s.auth.roles?.includes('admin') ?? false) &&
692
+ s.auth.actor === 'none' &&
693
+ !s.input &&
694
+ !s.params &&
695
+ !s.query);
696
+ // registered only where such a route exists: a plain skip would leave the
697
+ // transcript differential's run partial (its stale-ledger check unjudged),
698
+ // and a gated one would owe every consumer an `expected_skips` entry
699
+ if (admin_route) {
700
+ test('non-admin cannot access admin routes', async () => {
701
+ const fixture = await options.setup_test();
702
+ // Probe with a freshly-created account — it holds no admin role
703
+ // (the keeper fixture behind `create_session_headers` does, so it
704
+ // would pass the gate).
705
+ const non_admin = await fixture.create_account({ username: 'non_admin_admin_probe' });
706
+ const res = await fixture.transport(admin_route.path, {
707
+ method: admin_route.method,
708
+ headers: { cookie: `${cookie_name}=${non_admin.session_cookie}` }
709
+ });
710
+ assert.strictEqual(res.status, 403);
711
+ await error_collector.assert_and_record(route_specs, admin_route.method, admin_route.path, res);
712
+ const body = await res.json();
713
+ assert.strictEqual(body.error, 'insufficient_permissions');
714
+ });
715
+ }
717
716
  test("user A cannot revoke user B's sessions", async () => {
718
717
  const fixture = await options.setup_test();
719
718
  // Create a second account
@@ -1052,35 +1051,6 @@ export const describe_standard_integration_tests = (options) => {
1052
1051
  }
1053
1052
  });
1054
1053
  });
1055
- // --- 12c. Middleware gates: each counted route's declared gates refuse ---
1056
- describe('middleware gates', () => {
1057
- // One probe per gate each counted route's error map declares — the
1058
- // origin check, the Rust spine's host gate, the body limit — each a
1059
- // bodiless head with no credential that the gate refuses before auth,
1060
- // rate limiting or body parsing. A gate the map doesn't declare on a
1061
- // route (a carve-out, a backend without the layer) gets no probe.
1062
- const probes = plan_middleware_gate_probes({
1063
- route_specs: route_specs.filter(is_suite_auth_route),
1064
- route_error_maps: options.surface_source.route_error_maps,
1065
- base_url: options.base_url,
1066
- max_body_bytes: options.max_body_bytes,
1067
- rpc_path,
1068
- rpc_max_body_bytes: options.rpc_max_body_bytes
1069
- });
1070
- // in-process the probes share one fixture's transport, made by the first
1071
- // to run; over a socket they need none, as they read and write no state
1072
- let in_process_transport = null;
1073
- const get_transport = () => (in_process_transport ??= options
1074
- .setup_test()
1075
- .then((fixture) => fixture.fresh_transport({ origin: null })));
1076
- for (const probe of probes) {
1077
- test(format_middleware_gate_probe(probe), async () => {
1078
- const transport = options.base_url === null ? await get_transport() : null;
1079
- const res = await send_middleware_gate_probe(probe, options.base_url, transport);
1080
- await assert_middleware_gate_refusal(probe, res, error_collector, route_specs);
1081
- });
1082
- }
1083
- });
1084
1054
  // --- 13. Password change revokes API tokens ---
1085
1055
  describe('password change revokes API tokens', () => {
1086
1056
  test('API tokens are invalidated after password change', async () => {
@@ -40,6 +40,22 @@ export type RestAuthRouteSuffix = (typeof rest_auth_route_suffixes)[number];
40
40
  * @throws Error if `suffix` is not in `rest_auth_route_suffixes`.
41
41
  */
42
42
  export declare const find_auth_route: (specs: Array<RouteSpec>, suffix: RestAuthRouteSuffix, method: RouteMethod) => RouteSpec | undefined;
43
+ /**
44
+ * The middleware gates' refusals: the origin check's, the host gate's and the
45
+ * body limit's. `describe_middleware_gate_tests` probes each on every counted
46
+ * route that declares it, so the integration suite's coverage leaves them out.
47
+ */
48
+ export declare const MIDDLEWARE_GATE_ERROR_CODES: ReadonlyArray<string>;
49
+ /**
50
+ * Whether the standard integration suite counts a route: login, logout,
51
+ * password and signup (when wired), and the shared RPC endpoint — the routes
52
+ * its error coverage is scoped to and `describe_middleware_gate_tests` probes.
53
+ * An admin-role route belongs to the admin suite.
54
+ *
55
+ * @param spec - the route
56
+ * @param rpc_path - the RPC endpoint's path
57
+ */
58
+ export declare const is_standard_integration_route: (spec: RouteSpec, rpc_path: string) => boolean;
43
59
  /**
44
60
  * Validate a response body against the route spec's declared schemas.
45
61
  *
@@ -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;AASvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AASjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAezD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,GAC3B,OAAO,KAAK,CAAC,SAAS,CAAC,EACvB,QAAQ,MAAM,EACd,MAAM,MAAM,KACV,SAAS,GAAG,SAcd,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,sEAM3B,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC3B,OAAO,KAAK,CAAC,SAAS,CAAC,EACvB,QAAQ,mBAAmB,EAC3B,QAAQ,WAAW,KACjB,SAAS,GAAG,SASd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,4BAA4B,GACxC,aAAa,KAAK,CAAC,SAAS,CAAC,EAC7B,QAAQ,MAAM,EACd,MAAM,MAAM,EACZ,UAAU,QAAQ,EAClB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;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,7 +9,7 @@ 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, ERROR_CREDENTIAL_TYPE_REQUIRED, ERROR_METHOD_NOT_ALLOWED, ERROR_ROUTE_NOT_FOUND, NOT_FOUND_TEXT } 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, REST_FORBIDDEN_HOST, REST_FORBIDDEN_ORIGIN, REST_INVALID_CONTENT_LENGTH, REST_PAYLOAD_TOO_LARGE } 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
15
  import { find_mounted_route, is_json_response, to_mounted_routes } from '../http/route_error_check.js';
@@ -83,6 +83,34 @@ export const find_auth_route = (specs, suffix, method) => {
83
83
  }
84
84
  return specs.find((s) => s.method === method && s.path.endsWith(suffix));
85
85
  };
86
+ /**
87
+ * The middleware gates' refusals: the origin check's, the host gate's and the
88
+ * body limit's. `describe_middleware_gate_tests` probes each on every counted
89
+ * route that declares it, so the integration suite's coverage leaves them out.
90
+ */
91
+ export const MIDDLEWARE_GATE_ERROR_CODES = [
92
+ REST_FORBIDDEN_ORIGIN.code,
93
+ REST_FORBIDDEN_HOST.code,
94
+ REST_PAYLOAD_TOO_LARGE.code,
95
+ REST_INVALID_CONTENT_LENGTH.code
96
+ ];
97
+ /**
98
+ * Whether the standard integration suite counts a route: login, logout,
99
+ * password and signup (when wired), and the shared RPC endpoint — the routes
100
+ * its error coverage is scoped to and `describe_middleware_gate_tests` probes.
101
+ * An admin-role route belongs to the admin suite.
102
+ *
103
+ * @param spec - the route
104
+ * @param rpc_path - the RPC endpoint's path
105
+ */
106
+ export const is_standard_integration_route = (spec, rpc_path) => {
107
+ if (spec.auth.roles?.includes('admin') ?? false)
108
+ return false;
109
+ const rest_suffixes = ['/login', '/logout', '/password', '/signup'];
110
+ if (rest_suffixes.some((suffix) => spec.path.endsWith(suffix)))
111
+ return true;
112
+ return spec.path === rpc_path;
113
+ };
86
114
  /**
87
115
  * Validate a response body against the route spec's declared schemas.
88
116
  *