@fuzdev/fuz_app 0.181.0 → 0.183.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 (267) hide show
  1. package/README.md +2 -0
  2. package/dist/actions/CLAUDE.md +28 -10
  3. package/dist/actions/action_rpc.d.ts +11 -1
  4. package/dist/actions/action_rpc.d.ts.map +1 -1
  5. package/dist/actions/action_rpc.js +3 -2
  6. package/dist/actions/action_types.d.ts +16 -1
  7. package/dist/actions/action_types.d.ts.map +1 -1
  8. package/dist/actions/action_types.js +1 -1
  9. package/dist/actions/notification_sender.d.ts +83 -0
  10. package/dist/actions/notification_sender.d.ts.map +1 -0
  11. package/dist/actions/notification_sender.js +85 -0
  12. package/dist/actions/perform_action.d.ts +9 -0
  13. package/dist/actions/perform_action.d.ts.map +1 -1
  14. package/dist/actions/perform_action.js +22 -13
  15. package/dist/actions/register_action_ws.d.ts +14 -0
  16. package/dist/actions/register_action_ws.d.ts.map +1 -1
  17. package/dist/actions/register_action_ws.js +3 -2
  18. package/dist/actions/ws_socket_session.d.ts +3 -0
  19. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  20. package/dist/actions/ws_socket_session.js +2 -1
  21. package/dist/auth/CLAUDE.md +113 -70
  22. package/dist/auth/account_actions.d.ts.map +1 -1
  23. package/dist/auth/account_actions.js +13 -3
  24. package/dist/auth/account_queries.d.ts +158 -16
  25. package/dist/auth/account_queries.d.ts.map +1 -1
  26. package/dist/auth/account_queries.js +189 -18
  27. package/dist/auth/account_routes.d.ts +6 -4
  28. package/dist/auth/account_routes.d.ts.map +1 -1
  29. package/dist/auth/account_routes.js +98 -92
  30. package/dist/auth/admin_actions.d.ts.map +1 -1
  31. package/dist/auth/admin_actions.js +93 -45
  32. package/dist/auth/api_token_queries.d.ts +13 -5
  33. package/dist/auth/api_token_queries.d.ts.map +1 -1
  34. package/dist/auth/api_token_queries.js +24 -9
  35. package/dist/auth/audit_emitter.d.ts +75 -84
  36. package/dist/auth/audit_emitter.d.ts.map +1 -1
  37. package/dist/auth/audit_emitter.js +83 -71
  38. package/dist/auth/audit_log_schema.d.ts +10 -5
  39. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  40. package/dist/auth/audit_log_schema.js +22 -6
  41. package/dist/auth/bearer_auth.d.ts.map +1 -1
  42. package/dist/auth/bearer_auth.js +3 -2
  43. package/dist/auth/bootstrap_account.d.ts +31 -13
  44. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  45. package/dist/auth/bootstrap_account.js +34 -15
  46. package/dist/auth/bootstrap_routes.d.ts +1 -1
  47. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  48. package/dist/auth/bootstrap_routes.js +7 -14
  49. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  50. package/dist/auth/daemon_token_middleware.js +12 -1
  51. package/dist/auth/deps.d.ts +18 -5
  52. package/dist/auth/deps.d.ts.map +1 -1
  53. package/dist/auth/deps.js +3 -2
  54. package/dist/auth/request_context.d.ts +73 -73
  55. package/dist/auth/request_context.d.ts.map +1 -1
  56. package/dist/auth/request_context.js +78 -96
  57. package/dist/auth/resolved_auth.d.ts +16 -11
  58. package/dist/auth/resolved_auth.d.ts.map +1 -1
  59. package/dist/auth/resolved_auth.js +6 -6
  60. package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
  61. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  62. package/dist/auth/role_grant_offer_action_specs.js +2 -1
  63. package/dist/auth/role_grant_offer_actions.d.ts +32 -12
  64. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  65. package/dist/auth/role_grant_offer_actions.js +91 -116
  66. package/dist/auth/role_grant_offer_notifications.d.ts +87 -38
  67. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  68. package/dist/auth/role_grant_offer_notifications.js +75 -22
  69. package/dist/auth/role_grant_offer_queries.d.ts +155 -18
  70. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  71. package/dist/auth/role_grant_offer_queries.js +262 -73
  72. package/dist/auth/role_grant_offer_schema.js +1 -1
  73. package/dist/auth/role_grant_queries.d.ts +43 -52
  74. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  75. package/dist/auth/role_grant_queries.js +50 -74
  76. package/dist/auth/role_grant_sql.d.ts +21 -0
  77. package/dist/auth/role_grant_sql.d.ts.map +1 -1
  78. package/dist/auth/role_grant_sql.js +21 -0
  79. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  80. package/dist/auth/self_service_role_actions.js +17 -21
  81. package/dist/auth/session_queries.d.ts +40 -16
  82. package/dist/auth/session_queries.d.ts.map +1 -1
  83. package/dist/auth/session_queries.js +68 -29
  84. package/dist/auth/signup_routes.d.ts.map +1 -1
  85. package/dist/auth/signup_routes.js +90 -38
  86. package/dist/auth/standard_rpc_actions.d.ts +6 -19
  87. package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
  88. package/dist/auth/standard_rpc_actions.js +5 -6
  89. package/dist/auth/token_scope.d.ts +1 -1
  90. package/dist/auth/token_scope.js +1 -1
  91. package/dist/db/sql_columns.d.ts +1 -1
  92. package/dist/db/sql_columns.js +1 -1
  93. package/dist/http/CLAUDE.md +22 -16
  94. package/dist/http/auth_shape.d.ts +1 -1
  95. package/dist/http/db_routes.d.ts +7 -22
  96. package/dist/http/db_routes.d.ts.map +1 -1
  97. package/dist/http/db_routes.js +72 -72
  98. package/dist/http/error_schemas.d.ts +9 -21
  99. package/dist/http/error_schemas.d.ts.map +1 -1
  100. package/dist/http/error_schemas.js +14 -24
  101. package/dist/http/pending_effects.d.ts +42 -4
  102. package/dist/http/pending_effects.d.ts.map +1 -1
  103. package/dist/http/pending_effects.js +34 -4
  104. package/dist/http/route_spec.d.ts +2 -2
  105. package/dist/server/app_backend.d.ts.map +1 -1
  106. package/dist/server/app_backend.js +3 -1
  107. package/dist/server/app_server.d.ts +69 -18
  108. package/dist/server/app_server.d.ts.map +1 -1
  109. package/dist/server/app_server.js +74 -10
  110. package/dist/server/serve_fact_route.d.ts +3 -3
  111. package/dist/server/serve_fact_route.js +12 -12
  112. package/dist/testing/CLAUDE.md +259 -790
  113. package/dist/testing/adversarial_404.d.ts +6 -1
  114. package/dist/testing/adversarial_404.d.ts.map +1 -1
  115. package/dist/testing/adversarial_404.js +38 -17
  116. package/dist/testing/app_server.d.ts +20 -140
  117. package/dist/testing/app_server.d.ts.map +1 -1
  118. package/dist/testing/app_server.js +48 -125
  119. package/dist/testing/audit_drift_guard.d.ts +11 -6
  120. package/dist/testing/audit_drift_guard.d.ts.map +1 -1
  121. package/dist/testing/audit_drift_guard.js +15 -8
  122. package/dist/testing/auth_apps.js +1 -1
  123. package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
  124. package/dist/testing/cross_backend/account_lifecycle.js +43 -0
  125. package/dist/testing/cross_backend/audit_cross_helpers.d.ts +12 -9
  126. package/dist/testing/cross_backend/audit_cross_helpers.d.ts.map +1 -1
  127. package/dist/testing/cross_backend/audit_cross_helpers.js +13 -14
  128. package/dist/testing/cross_backend/capabilities.d.ts +9 -6
  129. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  130. package/dist/testing/cross_backend/capabilities.js +11 -7
  131. package/dist/testing/cross_backend/capability_mounts.d.ts +103 -0
  132. package/dist/testing/cross_backend/capability_mounts.d.ts.map +1 -0
  133. package/dist/testing/cross_backend/capability_mounts.js +423 -0
  134. package/dist/testing/cross_backend/cell_moderate.js +2 -2
  135. package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
  136. package/dist/testing/cross_backend/cell_relations.js +12 -11
  137. package/dist/testing/cross_backend/conformance_principal.d.ts +54 -0
  138. package/dist/testing/cross_backend/conformance_principal.d.ts.map +1 -0
  139. package/dist/testing/cross_backend/conformance_principal.js +283 -0
  140. package/dist/testing/cross_backend/conformance_table.d.ts +2 -50
  141. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  142. package/dist/testing/cross_backend/conformance_table.js +2 -270
  143. package/dist/testing/cross_backend/credential_deadline.d.ts.map +1 -1
  144. package/dist/testing/cross_backend/credential_deadline.js +2 -0
  145. package/dist/testing/cross_backend/credential_wire.d.ts +1 -1
  146. package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -1
  147. package/dist/testing/cross_backend/db_state_diff.d.ts +72 -0
  148. package/dist/testing/cross_backend/db_state_diff.d.ts.map +1 -0
  149. package/dist/testing/cross_backend/db_state_diff.js +444 -0
  150. package/dist/testing/cross_backend/declared_skips.d.ts +68 -0
  151. package/dist/testing/cross_backend/declared_skips.d.ts.map +1 -0
  152. package/dist/testing/cross_backend/declared_skips.js +132 -0
  153. package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -26
  154. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
  155. package/dist/testing/cross_backend/default_spine_surface.js +2 -6
  156. package/dist/testing/cross_backend/differential.d.ts +11 -2
  157. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  158. package/dist/testing/cross_backend/differential.js +35 -11
  159. package/dist/testing/cross_backend/differential_normalize.d.ts +12 -0
  160. package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
  161. package/dist/testing/cross_backend/differential_normalize.js +16 -0
  162. package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -10
  163. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  164. package/dist/testing/cross_backend/full_spine_mount.js +4 -4
  165. package/dist/testing/cross_backend/in_process_setup.d.ts +22 -12
  166. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  167. package/dist/testing/cross_backend/in_process_setup.js +151 -134
  168. package/dist/testing/cross_backend/login_security.d.ts +12 -0
  169. package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
  170. package/dist/testing/cross_backend/login_security.js +21 -4
  171. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +0 -2
  172. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -1
  173. package/dist/testing/cross_backend/request_target_conformance_wire.js +3 -1
  174. package/dist/testing/cross_backend/revocation_drivers.d.ts +18 -5
  175. package/dist/testing/cross_backend/revocation_drivers.d.ts.map +1 -1
  176. package/dist/testing/cross_backend/revocation_drivers.js +18 -10
  177. package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts +1 -1
  178. package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts.map +1 -1
  179. package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
  180. package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +33 -1
  181. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +5 -4
  182. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
  183. package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +183 -30
  184. package/dist/testing/cross_backend/role_grant_participation.js +4 -4
  185. package/dist/testing/cross_backend/rpc_adversarial.js +1 -1
  186. package/dist/testing/cross_backend/session_cap.d.ts +2 -2
  187. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  188. package/dist/testing/cross_backend/session_cap.js +48 -16
  189. package/dist/testing/cross_backend/setup.d.ts +31 -1
  190. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  191. package/dist/testing/cross_backend/setup.js +32 -1
  192. package/dist/testing/cross_backend/spine_suites.d.ts +123 -12
  193. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  194. package/dist/testing/cross_backend/spine_suites.js +454 -57
  195. package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
  196. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  197. package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
  198. package/dist/testing/cross_backend/sse_round_trip.d.ts +9 -1
  199. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  200. package/dist/testing/cross_backend/sse_round_trip.js +123 -27
  201. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  202. package/dist/testing/cross_backend/testing_backdoor.js +4 -2
  203. package/dist/testing/cross_backend/testing_reset_actions.d.ts +59 -27
  204. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  205. package/dist/testing/cross_backend/testing_reset_actions.js +66 -42
  206. package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
  207. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
  208. package/dist/testing/cross_backend/transport_composition.js +7 -3
  209. package/dist/testing/cross_backend/ws_round_trip.d.ts +5 -0
  210. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  211. package/dist/testing/cross_backend/ws_round_trip.js +54 -8
  212. package/dist/testing/data_exposure.d.ts.map +1 -1
  213. package/dist/testing/data_exposure.js +3 -0
  214. package/dist/testing/db.d.ts +0 -32
  215. package/dist/testing/db.d.ts.map +1 -1
  216. package/dist/testing/db.js +0 -86
  217. package/dist/testing/db_entities.d.ts +14 -0
  218. package/dist/testing/db_entities.d.ts.map +1 -1
  219. package/dist/testing/db_entities.js +17 -0
  220. package/dist/testing/db_invariant_queries.d.ts +259 -0
  221. package/dist/testing/db_invariant_queries.d.ts.map +1 -0
  222. package/dist/testing/db_invariant_queries.js +400 -0
  223. package/dist/testing/db_invariants.d.ts +106 -0
  224. package/dist/testing/db_invariants.d.ts.map +1 -0
  225. package/dist/testing/db_invariants.gen.sql.d.ts +11 -0
  226. package/dist/testing/db_invariants.gen.sql.d.ts.map +1 -0
  227. package/dist/testing/db_invariants.gen.sql.js +13 -0
  228. package/dist/testing/db_invariants.js +141 -0
  229. package/dist/testing/db_invariants.sql +152 -0
  230. package/dist/testing/describe_db.d.ts +36 -0
  231. package/dist/testing/describe_db.d.ts.map +1 -0
  232. package/dist/testing/describe_db.js +71 -0
  233. package/dist/testing/integration.d.ts +6 -9
  234. package/dist/testing/integration.d.ts.map +1 -1
  235. package/dist/testing/integration.js +9 -13
  236. package/dist/testing/integration_helpers.d.ts +1 -1
  237. package/dist/testing/integration_helpers.d.ts.map +1 -1
  238. package/dist/testing/middleware.d.ts +1 -1
  239. package/dist/testing/middleware.js +5 -5
  240. package/dist/testing/rate_limiting.d.ts +1 -1
  241. package/dist/testing/rate_limiting.d.ts.map +1 -1
  242. package/dist/testing/rate_limiting.js +3 -2
  243. package/dist/testing/resolved_auth.d.ts +3 -1
  244. package/dist/testing/resolved_auth.d.ts.map +1 -1
  245. package/dist/testing/resolved_auth.js +4 -4
  246. package/dist/testing/role_grant_helpers.d.ts +1 -1
  247. package/dist/testing/role_grant_helpers.d.ts.map +1 -1
  248. package/dist/testing/round_trip.d.ts.map +1 -1
  249. package/dist/testing/round_trip.js +3 -0
  250. package/dist/testing/rpc_attack_surface.d.ts +8 -6
  251. package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
  252. package/dist/testing/rpc_attack_surface.js +69 -6
  253. package/dist/testing/rpc_round_trip.d.ts +1 -1
  254. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  255. package/dist/testing/rpc_round_trip.js +3 -0
  256. package/dist/testing/sse_round_trip.d.ts +1 -1
  257. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  258. package/dist/testing/sse_round_trip.js +13 -4
  259. package/dist/testing/stubs.d.ts +4 -2
  260. package/dist/testing/stubs.d.ts.map +1 -1
  261. package/dist/testing/stubs.js +15 -7
  262. package/dist/testing/test_app.d.ts +166 -0
  263. package/dist/testing/test_app.d.ts.map +1 -0
  264. package/dist/testing/test_app.js +124 -0
  265. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  266. package/dist/testing/ws_round_trip.js +8 -4
  267. package/package.json +1 -1
@@ -4,11 +4,16 @@ import type { AdversarialTestOptions } from './attack_surface.js';
4
4
  * Generate adversarial 404 response validation tests.
5
5
  *
6
6
  * For each route with `params` and a 404 definition of its own in `errors`:
7
- * 1. Creates a stub handler returning 404 with the first such definition's code
7
+ * 1. Creates a stub handler returning 404 with the first such definition's
8
+ * code and its body's fields, generated from its schema (`generate_valid_object`)
8
9
  * 2. Fires a request with valid-format params (nil UUIDs for UUID params)
9
10
  * 3. Validates response status is 404
10
11
  * 4. Validates the code is one the route's error map (`resolve_route_error_map`)
11
12
  * declares at 404, and the body parses against its 404 (`assert_error_schema_valid`)
13
+ *
14
+ * @param options - the app surface builder, roles, skips, and param values
15
+ * @throws Error at collection when a definition's fields can't be generated
16
+ * to pass its body schema, naming the route
12
17
  */
13
18
  export declare const describe_adversarial_404: (options: AdversarialTestOptions) => void;
14
19
  //# sourceMappingURL=adversarial_404.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adversarial_404.d.ts","sourceRoot":"","sources":["../../src/lib/testing/adversarial_404.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAuB7B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAOlE;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,sBAAsB,KAAG,IAkF1E,CAAC"}
1
+ {"version":3,"file":"adversarial_404.d.ts","sourceRoot":"","sources":["../../src/lib/testing/adversarial_404.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAyB7B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAQlE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,sBAAsB,KAAG,IAkF1E,CAAC"}
@@ -2,9 +2,10 @@ import './assert_dev_env.js';
2
2
  /**
3
3
  * Adversarial 404 testing for routes with params and declared 404 error schemas.
4
4
  *
5
- * Creates stub handlers that return 404 with the declared error code,
6
- * fires requests with valid-format-but-nonexistent params (nil UUIDs),
7
- * and validates response bodies against the route's declared 404.
5
+ * Creates stub handlers that return 404 with the declared error code and
6
+ * fields generated from its body schema, fires requests with
7
+ * valid-format-but-nonexistent params (nil UUIDs), and validates response
8
+ * bodies against the route's declared 404.
8
9
  *
9
10
  * No DB needed — tests schema conformance of 404 responses, not real handlers.
10
11
  *
@@ -13,19 +14,25 @@ import './assert_dev_env.js';
13
14
  import { test, assert, describe } from 'vitest';
14
15
  import { route_fail } from '../http/route_result.js';
15
16
  import { format_route_key } from '../http/surface_query.js';
17
+ import { format_issues } from '../schema_issues.js';
16
18
  import { is_null_schema } from '../http/schema_helpers.js';
17
19
  import { assert_error_schema_valid } from './assertions.js';
18
20
  import { create_auth_test_apps, create_route_skip_filter, select_auth_app } from './auth_apps.js';
19
- import { resolve_valid_path, generate_valid_body, to_route_content_type } from './schema_generators.js';
21
+ import { resolve_valid_path, generate_valid_body, generate_valid_object, to_route_content_type } from './schema_generators.js';
20
22
  /**
21
23
  * Generate adversarial 404 response validation tests.
22
24
  *
23
25
  * For each route with `params` and a 404 definition of its own in `errors`:
24
- * 1. Creates a stub handler returning 404 with the first such definition's code
26
+ * 1. Creates a stub handler returning 404 with the first such definition's
27
+ * code and its body's fields, generated from its schema (`generate_valid_object`)
25
28
  * 2. Fires a request with valid-format params (nil UUIDs for UUID params)
26
29
  * 3. Validates response status is 404
27
30
  * 4. Validates the code is one the route's error map (`resolve_route_error_map`)
28
31
  * declares at 404, and the body parses against its 404 (`assert_error_schema_valid`)
32
+ *
33
+ * @param options - the app surface builder, roles, skips, and param values
34
+ * @throws Error at collection when a definition's fields can't be generated
35
+ * to pass its body schema, naming the route
29
36
  */
30
37
  export const describe_adversarial_404 = (options) => {
31
38
  const { build, roles } = options;
@@ -52,27 +59,22 @@ export const describe_adversarial_404 = (options) => {
52
59
  const not_found = spec.errors?.find((def) => def.status === 404);
53
60
  if (!not_found)
54
61
  continue;
55
- testable.push({ key, not_found, spec });
62
+ testable.push({ key, not_found, fields: generate_not_found_fields(key, not_found), spec });
56
63
  }
57
64
  if (testable.length === 0)
58
65
  return;
59
66
  describe('adversarial 404 response validation', () => {
60
67
  // Create stub specs: replace handlers for testable routes with 404 stubs
61
- const not_found_by_key = new Map();
68
+ const testable_by_key = new Map();
62
69
  for (const entry of testable) {
63
- not_found_by_key.set(entry.key, entry.not_found);
70
+ testable_by_key.set(entry.key, entry);
64
71
  }
65
72
  const stub_specs = route_specs.map((spec) => {
66
- const not_found = not_found_by_key.get(format_route_key(spec));
67
- if (!not_found)
73
+ const entry = testable_by_key.get(format_route_key(spec));
74
+ if (!entry)
68
75
  return spec;
69
- return {
70
- ...spec,
71
- // the code alone, `{error}` at 404: a stub has no fields to give
72
- handler: () =>
73
- // eslint-disable-next-line @typescript-eslint/no-generated-empty-object-type
74
- route_fail(not_found)
75
- };
76
+ const { not_found, fields } = entry;
77
+ return { ...spec, handler: () => route_fail(not_found, fields) };
76
78
  });
77
79
  const apps = create_auth_test_apps(stub_specs, roles);
78
80
  for (const { key, not_found, spec } of testable) {
@@ -102,3 +104,22 @@ export const describe_adversarial_404 = (options) => {
102
104
  }
103
105
  });
104
106
  };
107
+ /**
108
+ * The fields of a 404 body beside `error`, generated from the definition's
109
+ * schema, so a definition requiring a field (a `message`) gets a body its
110
+ * own schema accepts.
111
+ *
112
+ * @param key - the route's `METHOD path`, named in the error
113
+ * @param not_found - the route's 404 definition
114
+ * @returns the body's fields, `error` left to `route_fail`
115
+ * @throws Error when the generated body fails the definition's schema
116
+ */
117
+ const generate_not_found_fields = (key, not_found) => {
118
+ const { value, result } = generate_valid_object(not_found.schema, not_found.schema);
119
+ if (!result.ok) {
120
+ throw new Error(`describe_adversarial_404: can't generate the fields of ${key}'s 404 ` +
121
+ `'${not_found.code}': ${format_issues(result.issues)}`);
122
+ }
123
+ const { error: _error, ...fields } = value;
124
+ return fields;
125
+ };
@@ -1,19 +1,4 @@
1
1
  import './assert_dev_env.js';
2
- /**
3
- * Bootstrapped app server factory for integration tests.
4
- *
5
- * Creates a keeper account, API token, and signed session cookie on a
6
- * database. By default uses a cached in-memory pglet (one shared WASM instance
7
- * per loaded copy of `testing/db.ts` — once per run under the `db` project's
8
- * `isolate: false` + `fileParallelism: false`); pass `db` to use
9
- * an existing database (any driver) instead.
10
- *
11
- * Also provides `create_test_app` — a combined helper that creates both
12
- * a `TestAppServer` and a fully assembled Hono app with middleware and routes.
13
- *
14
- * @module
15
- */
16
- import type { Hono } from 'hono';
17
2
  import type { Uuid } from '../primitive_schemas.js';
18
3
  import { type Keyring } from '../auth/keyring.js';
19
4
  import type { Db, DbType } from '../db/db.js';
@@ -21,11 +6,7 @@ import type { PasswordHashDeps } from '../auth/password.js';
21
6
  import { type SessionOptions } from '../auth/session_cookie.js';
22
7
  import { type MigrationNamespace } from '../db/migrate.js';
23
8
  import { type AppBackend, type AuditFactory } from '../server/app_backend.js';
24
- import { type AppServer, type AppServerOptions, type BootstrapServerOptions } from '../server/app_server.js';
25
- import type { AppServerContext } from '../server/app_server_context.js';
26
- import type { AppSurface, AppSurfaceSpec } from '../http/surface.js';
27
- import type { RouteSpec } from '../http/route_spec.js';
28
- import type { RpcEndpointsSuiteOption } from './rpc_helpers.js';
9
+ import type { AppServerOptions } from '../server/app_server.js';
29
10
  /**
30
11
  * Fast password stub for tests that don't exercise login/password flows.
31
12
  *
@@ -33,6 +14,13 @@ import type { RpcEndpointsSuiteOption } from './rpc_helpers.js';
33
14
  * so auth bootstrap and session creation work without Argon2 overhead.
34
15
  */
35
16
  export declare const stub_password_deps: PasswordHashDeps;
17
+ /**
18
+ * The test keeper's roles when none are given — keeper and admin, what a
19
+ * production bootstrap (`bootstrap_account`) grants and the cross-process
20
+ * `_testing_reset` seeds, so a test database starts in a state production
21
+ * reaches. A test that needs a keeper without admin passes `roles`.
22
+ */
23
+ export declare const DEFAULT_TEST_KEEPER_ROLES: ReadonlyArray<string>;
36
24
  /** 64-hex-char test cookie secret — deterministic, never used in production. */
37
25
  export declare const TEST_COOKIE_SECRET: string;
38
26
  /**
@@ -126,7 +114,9 @@ export declare const mint_test_session: (options: MintTestSessionOptions) => Pro
126
114
  * Flips `bootstrap_lock.bootstrapped = true` so the post-insert DB state
127
115
  * matches a real bootstrap completion — production code can trust the
128
116
  * lock as the single signal without a belt-and-suspenders
129
- * `query_account_has_any` defense.
117
+ * `query_account_has_any` defense. Grants `options.roles`, or
118
+ * `DEFAULT_TEST_KEEPER_ROLES` (keeper and admin, as a real bootstrap) when
119
+ * omitted.
130
120
  *
131
121
  * @mutates the underlying `options.db` — inserts the account/actor/roles/
132
122
  * API token/session_cookie rows AND flips `bootstrap_lock.bootstrapped`.
@@ -191,7 +181,13 @@ export interface TestAppServerOptions {
191
181
  username?: string;
192
182
  /** Password for the bootstrapped account. Default: `DEFAULT_TEST_PASSWORD`. */
193
183
  password_value?: string;
194
- /** Roles to grant. Default: `[ROLE_KEEPER]`. */
184
+ /**
185
+ * Roles to grant the bootstrapped keeper. Default:
186
+ * `DEFAULT_TEST_KEEPER_ROLES` (`ROLE_KEEPER` and `ROLE_ADMIN`, as a
187
+ * production bootstrap grants). Override only for a test that needs a
188
+ * narrower keeper — one leaving no live admin breaks the
189
+ * `bootstrapped_without_live_admin` database invariant.
190
+ */
195
191
  roles?: Array<string>;
196
192
  /**
197
193
  * Build the bound `AuditEmitter` used by the test backend. Defaults to
@@ -215,7 +211,8 @@ export interface TestAppServerOptions {
215
211
  * Sets up:
216
212
  * - Auth tables (via the cached default factory, or reuses existing `db`)
217
213
  * - A keeper account with hashed password
218
- * - Role role_grants for each role in `options.roles`
214
+ * - Role grants for each role in `options.roles` (default
215
+ * `DEFAULT_TEST_KEEPER_ROLES`, keeper and admin)
219
216
  * - An API token for Bearer auth
220
217
  * - A session with a signed cookie value
221
218
  *
@@ -230,107 +227,6 @@ export interface TestAppServerOptions {
230
227
  * row, and flips `bootstrap_lock.bootstrapped` (`bootstrap_test_keeper`).
231
228
  */
232
229
  export declare const create_test_app_server: (options: TestAppServerOptions) => Promise<TestAppServer>;
233
- /**
234
- * Configuration for `create_test_app`.
235
- */
236
- export interface CreateTestAppOptions extends TestAppServerOptions {
237
- /** Route spec factory — called with the assembled `AppServerContext`. */
238
- create_route_specs: (context: AppServerContext) => Array<RouteSpec>;
239
- /**
240
- * RPC endpoints mounted by `create_app_server` — eager array or
241
- * `(ctx: AppServerContext) => Array<RpcEndpointSpec>` factory. Single
242
- * source of truth; the equivalent slot under `app_options` is `Omit`'d
243
- * so setup-time path lookup and runtime dispatch read from one place.
244
- * Symmetric with the suite-level `rpc_endpoints` option on
245
- * `describe_standard_admin_integration_tests` etc.
246
- */
247
- rpc_endpoints?: RpcEndpointsSuiteOption;
248
- /**
249
- * Bootstrap config — symmetric with `AppServerOptions.bootstrap`. Same
250
- * single-source-of-truth precedent as `rpc_endpoints`: setup-time surface
251
- * generation and runtime dispatch both read this slot, so the equivalent
252
- * field under `app_options` is `Omit`'d. Discriminated union over
253
- * `{mode: 'disabled' | 'surface_only' | 'live'}`. Omit (or pass
254
- * `{mode: 'disabled'}`) for the default — no bootstrap route mounted.
255
- */
256
- bootstrap?: BootstrapServerOptions;
257
- /**
258
- * Optional overrides for `AppServerOptions`. Excludes fields
259
- * `create_test_app` manages directly: `backend`, `session_options`,
260
- * `create_route_specs`, `rpc_endpoints`, `bootstrap` (top-level slots
261
- * above).
262
- */
263
- app_options?: SuiteAppOptions;
264
- }
265
- /**
266
- * `app_options` shape accepted by `create_test_app` and the DB-backed suite
267
- * helpers. Excludes fields the helpers manage directly — `backend` /
268
- * `session_options` / `create_route_specs` are constructed by the helper
269
- * itself; `rpc_endpoints` and `bootstrap` live on top-level options so
270
- * setup-time surface lookup and runtime dispatch read from one source of
271
- * truth.
272
- */
273
- export type SuiteAppOptions = Partial<Omit<AppServerOptions, 'backend' | 'session_options' | 'create_route_specs' | 'rpc_endpoints' | 'bootstrap'>>;
274
- /**
275
- * A bootstrapped test account with credentials.
276
- */
277
- export interface TestAccount {
278
- account: {
279
- id: Uuid;
280
- username: string;
281
- };
282
- actor: {
283
- id: Uuid;
284
- };
285
- /** Signed session cookie value. */
286
- session_cookie: string;
287
- /** Raw API token for Bearer auth. */
288
- api_token: string;
289
- /** Build request headers with this account's session cookie. */
290
- create_session_headers: (extra?: Record<string, string>) => Record<string, string>;
291
- /** Build request headers with this account's Bearer token. */
292
- create_bearer_headers: (extra?: Record<string, string>) => Record<string, string>;
293
- }
294
- /**
295
- * Args for `TestApp.create_account` — mint an additional account alongside the
296
- * keeper. Mirrors the cross-process `CreateTestAccountOptions` (the two
297
- * `create_account` paths share a shape so fixture call sites read identically),
298
- * kept local to avoid a cross-module cycle with `cross_backend/setup.ts`.
299
- */
300
- export interface CreateTestAppAccountArgs {
301
- username?: string;
302
- password_value?: string;
303
- roles?: Array<string>;
304
- /** Optional email stored on the account row — exercises the username-or-email login lookup. */
305
- email?: string;
306
- }
307
- /**
308
- * A fully assembled test app — Hono app + backend + helpers.
309
- */
310
- export interface TestApp {
311
- app: Hono;
312
- backend: TestAppServer;
313
- /**
314
- * The assembled `AppServer` — reach for what `create_app_server` built
315
- * beyond the fields lifted onto `TestApp`: `audit_sse` (with
316
- * `audit_log_sse` in `app_options`), the `ws_endpoints` transports,
317
- * `bootstrap_status`, `migration_results`.
318
- */
319
- server: AppServer;
320
- surface_spec: AppSurfaceSpec;
321
- surface: AppSurface;
322
- route_specs: Array<RouteSpec>;
323
- /** Build request headers with the bootstrapped session cookie. */
324
- create_session_headers: (extra?: Record<string, string>) => Record<string, string>;
325
- /** Build request headers with the bootstrapped Bearer token. */
326
- create_bearer_headers: (extra?: Record<string, string>) => Record<string, string>;
327
- /** Build request headers with the daemon token (keeper auth). */
328
- create_daemon_token_headers: (extra?: Record<string, string>) => Record<string, string>;
329
- /** Create an additional account with credentials. */
330
- create_account: (options?: CreateTestAppAccountArgs) => Promise<TestAccount>;
331
- /** Cleanup resources — `AppServer.close`: stops an opted-in auth cleanup schedule, closes live connections, disposes the limiters the server built and removes the audit listeners and closer members it added, then the backend's `close`. Idempotent. */
332
- cleanup: () => Promise<void>;
333
- }
334
230
  /**
335
231
  * The loopback `create_app_server` options an in-process test server takes:
336
232
  * the `TEST_ORIGIN` origin allowed (an exact list, parsed by
@@ -340,20 +236,4 @@ export interface TestApp {
340
236
  * varies.
341
237
  */
342
238
  export declare const create_loopback_app_server_options: () => Pick<AppServerOptions, "allowed_origins" | "proxy" | "env_schema">;
343
- /**
344
- * Create a fully assembled test app with a Hono server, middleware, and routes.
345
- *
346
- * Combines `create_test_app_server` + `create_app_server` into a single call.
347
- * Disables every rate limiter (`rate_limiters: 'disabled_for_testing'`) and
348
- * logging by default (test-friendly). A limiter passed through `app_options`
349
- * wins over the mode, so a rate-limit test enables just the one it pins.
350
- *
351
- * A fresh Hono app is created each call — middleware closures bind to the
352
- * server's deps (db, keyring), so reuse across servers is unsafe.
353
- * The expensive resource (the WASM database) is cached separately in `testing/db.ts`.
354
- *
355
- * @param options - test app configuration
356
- * @returns a `TestApp` ready for HTTP testing
357
- */
358
- export declare const create_test_app: (options: CreateTestAppOptions) => Promise<TestApp>;
359
239
  //# sourceMappingURL=app_server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app_server.d.ts","sourceRoot":"","sources":["../../src/lib/testing/app_server.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAGjC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIpD,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAU5D,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC7F,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG3E,OAAO,EAEN,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEN,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAC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CAC7B;AAwFD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,sBAAsB,GAClC,SAAS,oBAAoB,KAC3B,OAAO,CAAC,aAAa,CA2BvB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,kCAAkC,QAAO,IAAI,CACzD,gBAAgB,EAChB,iBAAiB,GAAG,OAAO,GAAG,YAAY,CAa1C,CAAC"}
@@ -1,25 +1,42 @@
1
1
  import './assert_dev_env.js';
2
+ /**
3
+ * Bootstrapped app server factory for integration tests.
4
+ *
5
+ * Creates a keeper account, API token, and signed session cookie on a
6
+ * database. By default uses a cached in-memory pglet (one shared WASM instance
7
+ * per loaded copy of `testing/db.ts` — once per run under the `db` project's
8
+ * `isolate: false` + `fileParallelism: false`); pass `db` to use
9
+ * an existing database (any driver) instead.
10
+ *
11
+ * Vitest-free, so the spawned spine binary, the reset actions and a
12
+ * consumer's test server build can import it — its import graph is held to
13
+ * that by `src/test/vitest_free_modules.test.ts`, which is why the
14
+ * vitest-bound database helpers live in `testing/describe_db.ts`. The fully
15
+ * assembled Hono app (`create_test_app`) lives in `testing/test_app.ts`.
16
+ *
17
+ * @module
18
+ */
2
19
  import { object } from '@fuzdev/fuz_schema/schema.ts';
3
20
  import { Logger } from '@fuzdev/fuz_util/log.ts';
4
21
  import { DEFAULT_TEST_PASSWORD } from './test_credentials.js';
5
- import { ROLE_KEEPER } from '../auth/role_schema.js';
22
+ import { ROLE_ADMIN, ROLE_KEEPER } from '../auth/role_schema.js';
6
23
  import { create_keyring } from '../auth/keyring.js';
7
24
  import { generate_api_token } from '../auth/api_token.js';
8
25
  import { query_create_account_with_actor } from '../auth/account_queries.js';
9
26
  import { query_create_role_grant } from '../auth/role_grant_queries.js';
10
- import { generate_session_token, hash_session_token, AUTH_SESSION_LIFETIME_MS, query_create_session } from '../auth/session_queries.js';
27
+ import { generate_session_token, hash_session_token, query_create_session } from '../auth/session_queries.js';
28
+ import { create_test_session_row } from './db_entities.js';
11
29
  import { query_create_api_token } from '../auth/api_token_queries.js';
12
30
  import { create_session_cookie_value } from '../auth/session_cookie.js';
13
31
  import { run_migrations } from '../db/migrate.js';
14
32
  import { AUTH_MIGRATION_NS } from '../auth/migrations.js';
15
33
  import { create_realtime_closer } from '../actions/connection_closer.js';
34
+ import { create_realtime_notification_sender } from '../actions/notification_sender.js';
16
35
  import { default_audit_factory } from '../server/app_backend.js';
17
- import { create_app_server } from '../server/app_server.js';
18
- import { generate_daemon_token, DAEMON_TOKEN_HEADER } from '../auth/daemon_token.js';
19
36
  import { create_default_db_factory } from './db.js';
20
37
  import { token_scope_full } from '../auth/token_scope.js';
21
38
  import { format_allowed_origins_error, parse_allowed_origins } from '../http/origin.js';
22
- import { create_test_request_headers, TEST_ORIGIN } from './test_origin.js';
39
+ import { TEST_ORIGIN } from './test_origin.js';
23
40
  /**
24
41
  * Fast password stub for tests that don't exercise login/password flows.
25
42
  *
@@ -31,6 +48,13 @@ export const stub_password_deps = {
31
48
  verify_password: async (p, h) => h === `stub_hash_${p}`,
32
49
  verify_dummy: async () => false
33
50
  };
51
+ /**
52
+ * The test keeper's roles when none are given — keeper and admin, what a
53
+ * production bootstrap (`bootstrap_account`) grants and the cross-process
54
+ * `_testing_reset` seeds, so a test database starts in a state production
55
+ * reaches. A test that needs a keeper without admin passes `roles`.
56
+ */
57
+ export const DEFAULT_TEST_KEEPER_ROLES = [ROLE_KEEPER, ROLE_ADMIN];
34
58
  /** 64-hex-char test cookie secret — deterministic, never used in production. */
35
59
  export const TEST_COOKIE_SECRET = 'a'.repeat(64);
36
60
  // Module-level default factory (pglet-wasm unless `set_default_db_factory` installed
@@ -102,16 +126,12 @@ export const create_test_account_with_credentials = async (options) => {
102
126
  // Create API token (account-scoped — acting actor is per-request)
103
127
  const { token: api_token, id: token_id, token_hash } = generate_api_token();
104
128
  await query_create_api_token(deps, token_id, account.id, 'test-cli', token_hash, token_scope_full());
105
- // Create session (account-scoped — acting actor is per-request).
106
- // Shares the mint primitive with `mint_test_session` / the
107
- // `_testing_mint_session` action; here with the standard 30-day lifetime.
108
- const { session_cookie } = await mint_test_session({
109
- db,
110
- keyring,
111
- session_options,
112
- account_id: account.id,
113
- expires_in_seconds: AUTH_SESSION_LIFETIME_MS / 1000
114
- });
129
+ // Create session (account-scoped — acting actor is per-request), through
130
+ // the production insert (`query_create_session`, the full lifetime on the
131
+ // database clock), as the Rust reset seeds through its production minter.
132
+ const session_token = generate_session_token();
133
+ await query_create_session({ db }, hash_session_token(session_token), account.id);
134
+ const session_cookie = await create_session_cookie_value(keyring, session_token, session_options);
115
135
  return {
116
136
  account: { id: account.id, username: account.username },
117
137
  actor: { id: actor.id },
@@ -136,8 +156,7 @@ export const mint_test_session = async (options) => {
136
156
  const { db, keyring, session_options, account_id, expires_in_seconds } = options;
137
157
  const session_token = generate_session_token();
138
158
  const session_hash = hash_session_token(session_token);
139
- const expires_at = new Date(Date.now() + expires_in_seconds * 1000);
140
- await query_create_session({ db }, session_hash, account_id, expires_at);
159
+ await create_test_session_row(db, session_hash, account_id, expires_in_seconds);
141
160
  const session_cookie = await create_session_cookie_value(keyring, session_token, session_options);
142
161
  return { session_cookie, session_hash };
143
162
  };
@@ -151,13 +170,18 @@ export const mint_test_session = async (options) => {
151
170
  * Flips `bootstrap_lock.bootstrapped = true` so the post-insert DB state
152
171
  * matches a real bootstrap completion — production code can trust the
153
172
  * lock as the single signal without a belt-and-suspenders
154
- * `query_account_has_any` defense.
173
+ * `query_account_has_any` defense. Grants `options.roles`, or
174
+ * `DEFAULT_TEST_KEEPER_ROLES` (keeper and admin, as a real bootstrap) when
175
+ * omitted.
155
176
  *
156
177
  * @mutates the underlying `options.db` — inserts the account/actor/roles/
157
178
  * API token/session_cookie rows AND flips `bootstrap_lock.bootstrapped`.
158
179
  */
159
180
  export const bootstrap_test_keeper = async (options) => {
160
- const result = await create_test_account_with_credentials(options);
181
+ const result = await create_test_account_with_credentials({
182
+ ...options,
183
+ roles: options.roles ?? [...DEFAULT_TEST_KEEPER_ROLES]
184
+ });
161
185
  // Lock flip — mirrors production `bootstrap_account` so test/prod write
162
186
  // semantics stay in parity.
163
187
  await options.db.query('UPDATE bootstrap_lock SET bootstrapped = true WHERE id = 1 AND bootstrapped = false');
@@ -218,7 +242,8 @@ const _build_test_backend = async (options) => {
218
242
  db,
219
243
  log: test_log,
220
244
  audit: audit_factory({ db, log: test_log }),
221
- connection_closer: create_realtime_closer()
245
+ connection_closer: create_realtime_closer(),
246
+ notification_sender: create_realtime_notification_sender()
222
247
  }
223
248
  };
224
249
  return { backend, keyring: keyring_result.keyring };
@@ -229,7 +254,8 @@ const _build_test_backend = async (options) => {
229
254
  * Sets up:
230
255
  * - Auth tables (via the cached default factory, or reuses existing `db`)
231
256
  * - A keeper account with hashed password
232
- * - Role role_grants for each role in `options.roles`
257
+ * - Role grants for each role in `options.roles` (default
258
+ * `DEFAULT_TEST_KEEPER_ROLES`, keeper and admin)
233
259
  * - An API token for Bearer auth
234
260
  * - A session with a signed cookie value
235
261
  *
@@ -244,7 +270,7 @@ const _build_test_backend = async (options) => {
244
270
  * row, and flips `bootstrap_lock.bootstrapped` (`bootstrap_test_keeper`).
245
271
  */
246
272
  export const create_test_app_server = async (options) => {
247
- const { session_options, password = stub_password_deps, username = 'keeper', password_value = DEFAULT_TEST_PASSWORD, roles = [ROLE_KEEPER] } = options;
273
+ const { session_options, password = stub_password_deps, username = 'keeper', password_value = DEFAULT_TEST_PASSWORD, roles } = options;
248
274
  const { backend, keyring } = await _build_test_backend(options);
249
275
  const bootstrapped = await bootstrap_test_keeper({
250
276
  db: backend.deps.db,
@@ -281,106 +307,3 @@ export const create_loopback_app_server_options = () => {
281
307
  env_schema: object({})
282
308
  };
283
309
  };
284
- /**
285
- * The `create_app_server` options both test-app builders share — a fresh
286
- * object per call, spread ahead of the per-builder options and `app_options`.
287
- */
288
- const test_app_options = () => ({
289
- ...create_loopback_app_server_options(),
290
- // every limiter off unless `app_options` passes one — a rate-limit test
291
- // enables just the limiter it pins
292
- rate_limiters: 'disabled_for_testing',
293
- await_pending_effects: true
294
- });
295
- /** Build request headers carrying `session_cookie` in the `cookie_name` cookie. */
296
- const create_session_headers_builder = (cookie_name, session_cookie) => (extra) => create_test_request_headers({ cookie: `${cookie_name}=${session_cookie}`, ...extra });
297
- /** Build request headers carrying `api_token` as a Bearer token. */
298
- const create_bearer_headers_builder = (api_token) => (extra) => ({
299
- host: 'localhost',
300
- authorization: `Bearer ${api_token}`,
301
- ...extra
302
- });
303
- /**
304
- * Create a fully assembled test app with a Hono server, middleware, and routes.
305
- *
306
- * Combines `create_test_app_server` + `create_app_server` into a single call.
307
- * Disables every rate limiter (`rate_limiters: 'disabled_for_testing'`) and
308
- * logging by default (test-friendly). A limiter passed through `app_options`
309
- * wins over the mode, so a rate-limit test enables just the one it pins.
310
- *
311
- * A fresh Hono app is created each call — middleware closures bind to the
312
- * server's deps (db, keyring), so reuse across servers is unsafe.
313
- * The expensive resource (the WASM database) is cached separately in `testing/db.ts`.
314
- *
315
- * @param options - test app configuration
316
- * @returns a `TestApp` ready for HTTP testing
317
- */
318
- export const create_test_app = async (options) => {
319
- const test_server = await create_test_app_server(options);
320
- // Daemon token state for keeper auth in tests.
321
- // Uses a static token (no rotation) — sufficient for request-level testing.
322
- const test_daemon_token = generate_daemon_token();
323
- const daemon_token_state = {
324
- current_token: test_daemon_token,
325
- previous_token: null,
326
- rotated_at: new Date(),
327
- keeper_account_id: test_server.account.id
328
- };
329
- const result = await create_app_server({
330
- ...test_app_options(),
331
- backend: test_server,
332
- session_options: options.session_options,
333
- daemon_token_state,
334
- rpc_endpoints: options.rpc_endpoints,
335
- bootstrap: options.bootstrap,
336
- // `auth_cleanup` stays at its default, off: a background pass would
337
- // delete rows and write audit rows mid-test. A suite that opts in
338
- // through `app_options` has the schedule stopped by `cleanup`.
339
- ...options.app_options,
340
- create_route_specs: options.create_route_specs
341
- });
342
- const { app, surface_spec } = result;
343
- const { cookie_name } = options.session_options;
344
- const { password = stub_password_deps } = options;
345
- const create_session_headers = create_session_headers_builder(cookie_name, test_server.session_cookie);
346
- const create_bearer_headers = create_bearer_headers_builder(test_server.api_token);
347
- const create_daemon_token_headers = (extra) => ({
348
- host: 'localhost',
349
- [DAEMON_TOKEN_HEADER]: test_daemon_token,
350
- ...extra
351
- });
352
- let account_counter = 0;
353
- const create_account = async (account_options) => {
354
- account_counter++;
355
- const bootstrapped = await create_test_account_with_credentials({
356
- db: test_server.deps.db,
357
- keyring: test_server.keyring,
358
- session_options: options.session_options,
359
- password,
360
- username: account_options?.username ?? `test_user_${account_counter}`,
361
- password_value: account_options?.password_value ?? DEFAULT_TEST_PASSWORD,
362
- roles: account_options?.roles ?? [],
363
- ...(account_options?.email !== undefined && { email: account_options.email })
364
- });
365
- return {
366
- ...bootstrapped,
367
- create_session_headers: create_session_headers_builder(cookie_name, bootstrapped.session_cookie),
368
- create_bearer_headers: create_bearer_headers_builder(bootstrapped.api_token)
369
- };
370
- };
371
- return {
372
- app,
373
- backend: test_server,
374
- server: result,
375
- surface_spec,
376
- surface: surface_spec.surface,
377
- route_specs: surface_spec.route_specs,
378
- create_session_headers,
379
- create_bearer_headers,
380
- create_daemon_token_headers,
381
- create_account,
382
- // the server's `close`, not the backend's: it also stops an auth cleanup
383
- // schedule a suite opted into
384
- cleanup: () => result.close()
385
- };
386
- };
@@ -4,22 +4,27 @@ import { type AuditLogEventJson, type AuditLogInput } from '../auth/audit_log_sc
4
4
  /**
5
5
  * Register per-test `beforeEach` + `afterEach` hooks that catch any audit
6
6
  * emission with a metadata shape that fails its `audit_metadata_schemas`
7
- * entry, an `event_type` not present in the active `AuditLogConfig`, or a
8
- * row the emitter failed to write.
7
+ * entry, an `event_type` not present in the active `AuditLogConfig`, a
8
+ * row the emitter failed to write, or a success row written outside a
9
+ * transaction (`emit` with none open, or `emit_pool`).
9
10
  *
10
11
  * The production validation in `query_audit_log` is fail-open — it bumps
11
12
  * process-wide counters and proceeds, so a regression that emits an
12
13
  * undeclared metadata field or a typo'd event-type lands a row that
13
14
  * passes downstream queries but breaks forensics. The emitter's pool write
14
15
  * is fail-open too: a refused `INSERT` is logged and counted, the request
15
- * succeeds, and the row is gone. Tests that exercise audit emits should fail
16
- * loudly when either happens.
16
+ * succeeds, and the row is gone. A success row belongs in the transaction of
17
+ * the change it reports; `emit` refuses one with no transaction open by
18
+ * throwing, which a caller can swallow, and `emit_pool` writes one on the
19
+ * pool. Tests that exercise audit emits should fail loudly when any of these
20
+ * happens.
17
21
  *
18
22
  * Call at the top of every `describe` / `describe_db` block that fires
19
23
  * audit writes through `deps.audit.emit`. Resets counters before each
20
24
  * test and asserts zero on completion. A test that makes a write fail on
21
25
  * purpose calls `reset_audit_write_failures` (`auth/audit_emitter.ts`) once
22
- * it has asserted the count.
26
+ * it has asserted the count, and one that writes a success row outside a
27
+ * transaction on purpose calls `reset_audit_success_outside_transaction`.
23
28
  *
24
29
  * Pair with `await_pending_effects: true` (the default for
25
30
  * `create_test_app`) so fire-and-forget audit writes have completed by
@@ -62,7 +67,7 @@ export interface RecordingAuditEmitter {
62
67
  * `listener_count` reports, and returns a remover with the production
63
68
  * semantics (per registration, idempotent) — registered listeners never fire,
64
69
  * since this emitter captures `emit` shapes, not fan-out. `drain_inflight` resolves at once
65
- * and `is_tracking_inflight` answers `false`: a recorded call writes nothing, so nothing is
70
+ * and `inflight_count` answers 0: a recorded call writes nothing, so nothing is
66
71
  * ever in flight.
67
72
  *
68
73
  * `emit` AND `emit_pool` both append to `calls`, so a test reads either
@@ -1 +1 @@
1
- {"version":3,"file":"audit_drift_guard.d.ts","sourceRoot":"","sources":["../../src/lib/testing/audit_drift_guard.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAmB7B,OAAO,EAGN,KAAK,YAAY,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGN,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;A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