@fuzdev/fuz_app 0.164.0 → 0.166.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 (112) hide show
  1. package/dist/actions/CLAUDE.md +2 -2
  2. package/dist/actions/action_event_data.d.ts +1 -1
  3. package/dist/actions/action_rpc.d.ts.map +1 -1
  4. package/dist/actions/action_rpc.js +24 -15
  5. package/dist/actions/action_spec.d.ts +2 -2
  6. package/dist/actions/perform_action.d.ts +2 -1
  7. package/dist/actions/perform_action.d.ts.map +1 -1
  8. package/dist/auth/account_action_specs.d.ts +8 -8
  9. package/dist/auth/account_route_schema.d.ts +197 -164
  10. package/dist/auth/account_route_schema.d.ts.map +1 -1
  11. package/dist/auth/account_route_schema.js +19 -17
  12. package/dist/auth/account_routes.d.ts.map +1 -1
  13. package/dist/auth/account_routes.js +285 -294
  14. package/dist/auth/admin_action_specs.d.ts +64 -64
  15. package/dist/auth/audit_log_route_schema.d.ts +16 -8
  16. package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
  17. package/dist/auth/audit_log_route_schema.js +4 -3
  18. package/dist/auth/audit_log_routes.d.ts +1 -1
  19. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  20. package/dist/auth/audit_log_routes.js +112 -111
  21. package/dist/auth/audit_log_schema.d.ts +22 -22
  22. package/dist/auth/bootstrap_route_schema.d.ts +46 -69
  23. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  24. package/dist/auth/bootstrap_route_schema.js +8 -7
  25. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  26. package/dist/auth/bootstrap_routes.js +100 -98
  27. package/dist/auth/role_grant_offer_action_specs.d.ts +4 -4
  28. package/dist/auth/signup_route_schema.d.ts +9 -4
  29. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  30. package/dist/auth/signup_route_schema.js +5 -3
  31. package/dist/auth/signup_routes.d.ts.map +1 -1
  32. package/dist/auth/signup_routes.js +170 -170
  33. package/dist/http/CLAUDE.md +50 -4
  34. package/dist/http/common_routes.d.ts +1 -1
  35. package/dist/http/common_routes.d.ts.map +1 -1
  36. package/dist/http/common_routes.js +13 -11
  37. package/dist/http/db_routes.d.ts.map +1 -1
  38. package/dist/http/db_routes.js +25 -28
  39. package/dist/http/error_schemas.d.ts +5 -1
  40. package/dist/http/error_schemas.d.ts.map +1 -1
  41. package/dist/http/error_schemas.js +5 -1
  42. package/dist/http/route_error_check.d.ts +21 -0
  43. package/dist/http/route_error_check.d.ts.map +1 -1
  44. package/dist/http/route_error_check.js +37 -1
  45. package/dist/http/route_result.d.ts +101 -0
  46. package/dist/http/route_result.d.ts.map +1 -0
  47. package/dist/http/route_result.js +56 -0
  48. package/dist/http/route_spec.d.ts +110 -6
  49. package/dist/http/route_spec.d.ts.map +1 -1
  50. package/dist/http/route_spec.js +82 -14
  51. package/dist/http/schema_helpers.d.ts +15 -1
  52. package/dist/http/schema_helpers.d.ts.map +1 -1
  53. package/dist/http/schema_helpers.js +12 -3
  54. package/dist/rate_limiter.d.ts +0 -9
  55. package/dist/rate_limiter.d.ts.map +1 -1
  56. package/dist/rate_limiter.js +0 -15
  57. package/dist/server/serve_fact_route.d.ts.map +1 -1
  58. package/dist/server/serve_fact_route.js +23 -21
  59. package/dist/server/surface_route.d.ts +1 -1
  60. package/dist/server/surface_route.d.ts.map +1 -1
  61. package/dist/server/surface_route.js +4 -2
  62. package/dist/testing/CLAUDE.md +80 -28
  63. package/dist/testing/admin_integration.js +1 -1
  64. package/dist/testing/adversarial_404.d.ts.map +1 -1
  65. package/dist/testing/adversarial_404.js +13 -8
  66. package/dist/testing/adversarial_input.js +2 -2
  67. package/dist/testing/assertions.d.ts +13 -3
  68. package/dist/testing/assertions.d.ts.map +1 -1
  69. package/dist/testing/assertions.js +21 -4
  70. package/dist/testing/attack_surface.d.ts +12 -0
  71. package/dist/testing/attack_surface.d.ts.map +1 -1
  72. package/dist/testing/attack_surface.js +8 -5
  73. package/dist/testing/cross_backend/in_process_setup.d.ts +7 -3
  74. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  75. package/dist/testing/cross_backend/in_process_setup.js +11 -4
  76. package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
  77. package/dist/testing/cross_backend/login_security.js +3 -2
  78. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  79. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +2 -6
  80. package/dist/testing/cross_backend/spine_suites.d.ts +3 -2
  81. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  82. package/dist/testing/cross_backend/spine_suites.js +5 -2
  83. package/dist/testing/cross_backend/standard.d.ts +31 -0
  84. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  85. package/dist/testing/cross_backend/standard.js +9 -3
  86. package/dist/testing/data_exposure.d.ts +7 -0
  87. package/dist/testing/data_exposure.d.ts.map +1 -1
  88. package/dist/testing/data_exposure.js +3 -3
  89. package/dist/testing/error_coverage.d.ts +35 -33
  90. package/dist/testing/error_coverage.d.ts.map +1 -1
  91. package/dist/testing/error_coverage.js +53 -43
  92. package/dist/testing/integration.d.ts +28 -1
  93. package/dist/testing/integration.d.ts.map +1 -1
  94. package/dist/testing/integration.js +51 -18
  95. package/dist/testing/integration_helpers.d.ts.map +1 -1
  96. package/dist/testing/integration_helpers.js +4 -15
  97. package/dist/testing/middleware_gate_probes.d.ts +90 -0
  98. package/dist/testing/middleware_gate_probes.d.ts.map +1 -0
  99. package/dist/testing/middleware_gate_probes.js +179 -0
  100. package/dist/testing/round_trip.d.ts +7 -0
  101. package/dist/testing/round_trip.d.ts.map +1 -1
  102. package/dist/testing/round_trip.js +3 -2
  103. package/dist/testing/schema_generators.d.ts +31 -9
  104. package/dist/testing/schema_generators.d.ts.map +1 -1
  105. package/dist/testing/schema_generators.js +53 -11
  106. package/dist/testing/stubs.d.ts +14 -3
  107. package/dist/testing/stubs.d.ts.map +1 -1
  108. package/dist/testing/stubs.js +21 -6
  109. package/dist/testing/transports/raw_http.d.ts +10 -2
  110. package/dist/testing/transports/raw_http.d.ts.map +1 -1
  111. package/dist/testing/transports/raw_http.js +10 -4
  112. package/package.json +1 -1
@@ -12,11 +12,12 @@ import { query_create_account_with_actor } from './account_queries.js';
12
12
  import { query_app_settings_load } from './app_settings_queries.js';
13
13
  import { query_invite_find_unclaimed_match_for_update, query_invite_claim_unscoped } from './invite_queries.js';
14
14
  import { create_signup_route_shape } from './signup_route_schema.js';
15
- import { get_route_input } from '../http/route_spec.js';
15
+ import { attach_route_handler, get_route_input } from '../http/route_spec.js';
16
+ import { route_fail, route_ok } from '../http/route_result.js';
16
17
  import { get_client_ip } from '../http/client_ip.js';
17
18
  import { rate_limit_ip_key } from '../http/ip_canonical.js';
18
- import { rate_limit_exceeded_response, reserve_optional } from '../rate_limiter.js';
19
- import { ERROR_NO_MATCHING_INVITE, ERROR_SIGNUP_CONFLICT } from '../http/error_schemas.js';
19
+ import { reserve_optional } from '../rate_limiter.js';
20
+ import { REST_NO_MATCHING_INVITE, REST_RATE_LIMIT_EXCEEDED, REST_SIGNUP_CONFLICT } from '../http/error_schemas.js';
20
21
  import { is_pg_unique_violation } from '../db/pg_error.js';
21
22
  import { start_fail_floor, warn_if_fail_floor_disabled } from './fail_floor.js';
22
23
  /**
@@ -40,7 +41,7 @@ export const DEFAULT_SIGNUP_FAIL_FLOOR_MS = 250;
40
41
  * guarantees.
41
42
  */
42
43
  export const DEFAULT_SIGNUP_FAIL_JITTER_MS = 25;
43
- // `create_signup_route_specs` spreads the shape and attaches the live handler
44
+ // `create_signup_route_specs` attaches the live handler to the shape
44
45
  // below.
45
46
  /**
46
47
  * Create signup route specs for account creation.
@@ -54,182 +55,181 @@ export const create_signup_route_specs = (deps, options) => {
54
55
  const { session_options, signup_ip_rate_limiter, signup_account_rate_limiter, signup_fail_floor_ms = DEFAULT_SIGNUP_FAIL_FLOOR_MS, signup_fail_jitter_ms = DEFAULT_SIGNUP_FAIL_JITTER_MS } = options;
55
56
  warn_if_fail_floor_disabled('signup', signup_fail_floor_ms, deps.log);
56
57
  return [
57
- {
58
- ...create_signup_route_shape({
59
- signup_account_rate_limited: signup_account_rate_limiter !== null
60
- }),
61
- handler: async (c, route) => {
62
- // Per-IP rate limit (before any work). 429 stays fast. Reserved,
63
- // not checked: the attempt counts against the cap until it settles
64
- // below, so a concurrent burst can't all pass before any of it
65
- // records — and the Argon2 hash every attempt pays is bounded with
66
- // it. The `finally` releases whatever no branch recorded.
67
- // keyed by the address's rate-limit key (an IPv6 client's /64)
68
- const ip_key = signup_ip_rate_limiter ? rate_limit_ip_key(get_client_ip(c)) : null;
69
- const ip_reserved = await reserve_optional(signup_ip_rate_limiter, ip_key, {
70
- signal: c.req.raw.signal
71
- });
72
- if (!ip_reserved.ok) {
73
- return rate_limit_exceeded_response(c, ip_reserved.retry_after);
58
+ attach_route_handler(create_signup_route_shape({
59
+ signup_account_rate_limited: signup_account_rate_limiter !== null
60
+ }), async (c, route) => {
61
+ // Per-IP rate limit (before any work). 429 stays fast. Reserved,
62
+ // not checked: the attempt counts against the cap until it settles
63
+ // below, so a concurrent burst can't all pass before any of it
64
+ // records — and the Argon2 hash every attempt pays is bounded with
65
+ // it. The `finally` releases whatever no branch recorded.
66
+ // keyed by the address's rate-limit key (an IPv6 client's /64)
67
+ const ip_key = signup_ip_rate_limiter ? rate_limit_ip_key(get_client_ip(c)) : null;
68
+ const ip_reserved = await reserve_optional(signup_ip_rate_limiter, ip_key, {
69
+ signal: c.req.raw.signal
70
+ });
71
+ if (!ip_reserved.ok) {
72
+ return route_fail(REST_RATE_LIMIT_EXCEEDED, { retry_after: ip_reserved.retry_after });
73
+ }
74
+ let account_reservation = null;
75
+ try {
76
+ const { username, password: pw, email } = get_route_input(c);
77
+ // Per-account rate limit (after input parsing, before DB work).
78
+ // 429 stays fast — same precedent as login.
79
+ const account_key = username.toLowerCase();
80
+ const account_reserved = await reserve_optional(signup_account_rate_limiter, account_key, { signal: c.req.raw.signal });
81
+ if (!account_reserved.ok) {
82
+ return route_fail(REST_RATE_LIMIT_EXCEEDED, {
83
+ retry_after: account_reserved.retry_after
84
+ });
74
85
  }
75
- let account_reservation = null;
86
+ account_reservation = account_reserved.reservation;
87
+ // Load the open-signup toggle fresh from the DB on every
88
+ // request — the authoritative source, so multiple server
89
+ // processes never serve a stale in-memory value. Its cost, and
90
+ // the hash below, are bounded per address by the per-IP
91
+ // reservation above: every classified failure and every
92
+ // successful open signup records it. What escapes is an
93
+ // invite-gated success (which spends an invite), a 5xx, and a
94
+ // request with no resolved client IP. The per-account limiter
95
+ // bounds retries of one username only.
96
+ const { open_signup } = await query_app_settings_load(route);
97
+ // Start the denial-time floor concurrently with failure work.
98
+ // Observed response time for 403 / 409 is `max(work, delay)`
99
+ // so the cheap `no_match` path (no Argon2, find returns
100
+ // nothing) and the expensive `signup_conflict` path (Argon2
101
+ // + tx + rollback) converge — closes the username-enumeration
102
+ // timing oracle. The same `start_fail_floor` as login. Started
103
+ // after rate-limit checks so 429 stays fast.
104
+ const delay = start_fail_floor(signup_fail_floor_ms, signup_fail_jitter_ms);
105
+ // Hash before the transaction so the connection isn't held
106
+ // across the ~100ms Argon2id. Paid on every attempt that gets
107
+ // here — bounded as described above.
108
+ const password_hash = await password.hash_password(pw);
109
+ // `invite` is assigned inside the tx by the FOR UPDATE find;
110
+ // captured at the outer scope so the failure-audit catch
111
+ // branch can still reference `invite.id` after the tx rolls
112
+ // back on PG unique violation.
113
+ let invite;
114
+ const emit_failure_audit = async (reason) => {
115
+ await deps.audit.emit(route, {
116
+ event_type: 'signup',
117
+ outcome: 'failure',
118
+ ip: get_client_ip(c),
119
+ metadata: {
120
+ username,
121
+ reason,
122
+ ...(invite && { invite_id: invite.id }),
123
+ ...(email != null && { email }),
124
+ ...(open_signup && { open_signup: true })
125
+ }
126
+ });
127
+ };
128
+ let result;
76
129
  try {
77
- const { username, password: pw, email } = get_route_input(c);
78
- // Per-account rate limit (after input parsing, before DB work).
79
- // 429 stays fast — same precedent as login.
80
- const account_key = username.toLowerCase();
81
- const account_reserved = await reserve_optional(signup_account_rate_limiter, account_key, { signal: c.req.raw.signal });
82
- if (!account_reserved.ok) {
83
- return rate_limit_exceeded_response(c, account_reserved.retry_after);
84
- }
85
- account_reservation = account_reserved.reservation;
86
- // Load the open-signup toggle fresh from the DB on every
87
- // request — the authoritative source, so multiple server
88
- // processes never serve a stale in-memory value. Its cost, and
89
- // the hash below, are bounded per address by the per-IP
90
- // reservation above: every classified failure and every
91
- // successful open signup records it. What escapes is an
92
- // invite-gated success (which spends an invite), a 5xx, and a
93
- // request with no resolved client IP. The per-account limiter
94
- // bounds retries of one username only.
95
- const { open_signup } = await query_app_settings_load(route);
96
- // Start the denial-time floor concurrently with failure work.
97
- // Observed response time for 403 / 409 is `max(work, delay)`
98
- // so the cheap `no_match` path (no Argon2, find returns
99
- // nothing) and the expensive `signup_conflict` path (Argon2
100
- // + tx + rollback) converge — closes the username-enumeration
101
- // timing oracle. The same `start_fail_floor` as login. Started
102
- // after rate-limit checks so 429 stays fast.
103
- const delay = start_fail_floor(signup_fail_floor_ms, signup_fail_jitter_ms);
104
- // Hash before the transaction so the connection isn't held
105
- // across the ~100ms Argon2id. Paid on every attempt that gets
106
- // here — bounded as described above.
107
- const password_hash = await password.hash_password(pw);
108
- // `invite` is assigned inside the tx by the FOR UPDATE find;
109
- // captured at the outer scope so the failure-audit catch
110
- // branch can still reference `invite.id` after the tx rolls
111
- // back on PG unique violation.
112
- let invite;
113
- const emit_failure_audit = async (reason) => {
114
- await deps.audit.emit(route, {
115
- event_type: 'signup',
116
- outcome: 'failure',
117
- ip: get_client_ip(c),
118
- metadata: {
119
- username,
120
- reason,
121
- ...(invite && { invite_id: invite.id }),
122
- ...(email != null && { email }),
123
- ...(open_signup && { open_signup: true })
130
+ result = await route.db.transaction(async (tx) => {
131
+ const tx_deps = { db: tx };
132
+ // Find + claim run inside the same transaction so the
133
+ // row lock makes them atomic. Concurrent signups for
134
+ // the same (username, email) tuple block on the lock
135
+ // and observe the post-commit state on retry — the
136
+ // loser's `find_for_update` returns no row (winner
137
+ // flipped `claimed_at`) and falls through to
138
+ // `ERROR_NO_MATCHING_INVITE`. No race window.
139
+ if (!open_signup) {
140
+ invite = await query_invite_find_unclaimed_match_for_update(tx_deps, email ?? null, username);
141
+ if (!invite) {
142
+ throw new NoMatchingInviteError();
124
143
  }
144
+ }
145
+ const { account, actor } = await query_create_account_with_actor(tx_deps, {
146
+ username,
147
+ password_hash,
148
+ email
125
149
  });
126
- };
127
- let result;
128
- try {
129
- result = await route.db.transaction(async (tx) => {
130
- const tx_deps = { db: tx };
131
- // Find + claim run inside the same transaction so the
132
- // row lock makes them atomic. Concurrent signups for
133
- // the same (username, email) tuple block on the lock
134
- // and observe the post-commit state on retry — the
135
- // loser's `find_for_update` returns no row (winner
136
- // flipped `claimed_at`) and falls through to
137
- // `ERROR_NO_MATCHING_INVITE`. No race window.
138
- if (!open_signup) {
139
- invite = await query_invite_find_unclaimed_match_for_update(tx_deps, email ?? null, username);
140
- if (!invite) {
141
- throw new NoMatchingInviteError();
142
- }
143
- }
144
- const { account, actor } = await query_create_account_with_actor(tx_deps, {
145
- username,
146
- password_hash,
147
- email
148
- });
149
- if (invite) {
150
- // FOR UPDATE held the row for the duration of the
151
- // tx, so no concurrent claim could flip `claimed_at`
152
- // between the find and this UPDATE. A miss means
153
- // that invariant broke — refuse loudly (the throw
154
- // rolls the account back) rather than mint an
155
- // account no invite admitted.
156
- const claimed = await query_invite_claim_unscoped(tx_deps, invite.id, account.id);
157
- if (!claimed) {
158
- throw new Error(`invite ${invite.id} was already claimed despite the FOR UPDATE lock`);
159
- }
150
+ if (invite) {
151
+ // FOR UPDATE held the row for the duration of the
152
+ // tx, so no concurrent claim could flip `claimed_at`
153
+ // between the find and this UPDATE. A miss means
154
+ // that invariant broke — refuse loudly (the throw
155
+ // rolls the account back) rather than mint an
156
+ // account no invite admitted.
157
+ const claimed = await query_invite_claim_unscoped(tx_deps, invite.id, account.id);
158
+ if (!claimed) {
159
+ throw new Error(`invite ${invite.id} was already claimed despite the FOR UPDATE lock`);
160
160
  }
161
- await create_session_and_set_cookie({
162
- keyring,
163
- deps: tx_deps,
164
- c,
165
- account_id: account.id,
166
- session_options
167
- });
168
- return { account, actor };
169
- });
170
- }
171
- catch (e) {
172
- if (e instanceof NoMatchingInviteError) {
173
- ip_reserved.reservation.record();
174
- account_reservation?.record();
175
- await emit_failure_audit('no_match');
176
- await delay;
177
- return c.json({ error: ERROR_NO_MATCHING_INVITE }, 403);
178
- }
179
- // Unique constraint violation: username or email already exists.
180
- if (is_pg_unique_violation(e)) {
181
- ip_reserved.reservation.record();
182
- account_reservation?.record();
183
- await emit_failure_audit('signup_conflict');
184
- await delay;
185
- return c.json({ error: ERROR_SIGNUP_CONFLICT }, 409);
186
161
  }
187
- // Unclassified failure (e.g. session create error, Argon2
188
- // fault on hash, DB outage mid-tx). Tx is rolled back so
189
- // no account persists, but the *attempt* should leave a
190
- // forensic trail — emit `outcome: 'failure'` with reason
191
- // `internal_error` before rethrowing. 5xx responses are
192
- // not floored: they aren't response-time-controlled
193
- // enumeration oracles.
194
- await emit_failure_audit('internal_error');
195
- throw e;
196
- }
197
- // Clear the account-grain bucket only — the IP aggregate stands.
198
- // This is the cheapest version of the spray path `RateLimiter.reset`
199
- // describes: where login at least costs the attacker a credential,
200
- // an open-signup deployment let an *unauthenticated* caller zero a
201
- // shared IP budget by creating throwaway accounts, and the
202
- // per-account limiter never applies to the attacker's own signups.
203
- account_reservation?.release();
204
- if (signup_account_rate_limiter)
205
- signup_account_rate_limiter.reset(account_key);
206
- // A successful *open* signup is charged to the IP bucket like a
207
- // failure: with no invite to spend, account creation is otherwise
208
- // unbounded from a single address — throwaway accounts, each one a
209
- // session and a row. An invite-gated success is bounded by the
210
- // invites an admin minted, so it records nothing (a class signing up
211
- // on its invites from one NAT egress would otherwise run the bucket
212
- // dry); the `finally` releases it.
213
- if (open_signup)
214
- ip_reserved.reservation.record();
215
- await deps.audit.emit(route, {
216
- event_type: 'signup',
217
- account_id: result.account.id,
218
- ip: get_client_ip(c),
219
- metadata: invite ? { invite_id: invite.id, username } : { open_signup: true, username }
220
- });
221
- return c.json({
222
- ok: true,
223
- account: { id: result.account.id, username: result.account.username },
224
- actor: { id: result.actor.id }
162
+ await create_session_and_set_cookie({
163
+ keyring,
164
+ deps: tx_deps,
165
+ c,
166
+ account_id: account.id,
167
+ session_options
168
+ });
169
+ return { account, actor };
225
170
  });
226
171
  }
227
- finally {
228
- ip_reserved.reservation.release();
229
- account_reservation?.release();
172
+ catch (e) {
173
+ if (e instanceof NoMatchingInviteError) {
174
+ ip_reserved.reservation.record();
175
+ account_reservation?.record();
176
+ await emit_failure_audit('no_match');
177
+ await delay;
178
+ return route_fail(REST_NO_MATCHING_INVITE);
179
+ }
180
+ // Unique constraint violation: username or email already exists.
181
+ if (is_pg_unique_violation(e)) {
182
+ ip_reserved.reservation.record();
183
+ account_reservation?.record();
184
+ await emit_failure_audit('signup_conflict');
185
+ await delay;
186
+ return route_fail(REST_SIGNUP_CONFLICT);
187
+ }
188
+ // Unclassified failure (e.g. session create error, Argon2
189
+ // fault on hash, DB outage mid-tx). Tx is rolled back so
190
+ // no account persists, but the *attempt* should leave a
191
+ // forensic trail — emit `outcome: 'failure'` with reason
192
+ // `internal_error` before rethrowing. 5xx responses are
193
+ // not floored: they aren't response-time-controlled
194
+ // enumeration oracles.
195
+ await emit_failure_audit('internal_error');
196
+ throw e;
230
197
  }
198
+ // Clear the account-grain bucket only — the IP aggregate stands.
199
+ // This is the cheapest version of the spray path `RateLimiter.reset`
200
+ // describes: where login at least costs the attacker a credential,
201
+ // an open-signup deployment let an *unauthenticated* caller zero a
202
+ // shared IP budget by creating throwaway accounts, and the
203
+ // per-account limiter never applies to the attacker's own signups.
204
+ account_reservation?.release();
205
+ if (signup_account_rate_limiter)
206
+ signup_account_rate_limiter.reset(account_key);
207
+ // A successful *open* signup is charged to the IP bucket like a
208
+ // failure: with no invite to spend, account creation is otherwise
209
+ // unbounded from a single address — throwaway accounts, each one a
210
+ // session and a row. An invite-gated success is bounded by the
211
+ // invites an admin minted, so it records nothing (a class signing up
212
+ // on its invites from one NAT egress would otherwise run the bucket
213
+ // dry); the `finally` releases it.
214
+ if (open_signup)
215
+ ip_reserved.reservation.record();
216
+ await deps.audit.emit(route, {
217
+ event_type: 'signup',
218
+ account_id: result.account.id,
219
+ ip: get_client_ip(c),
220
+ metadata: invite ? { invite_id: invite.id, username } : { open_signup: true, username }
221
+ });
222
+ return route_ok({
223
+ ok: true,
224
+ account: { id: result.account.id, username: result.account.username },
225
+ actor: { id: result.actor.id }
226
+ });
227
+ }
228
+ finally {
229
+ ip_reserved.reservation.release();
230
+ account_reservation?.release();
231
231
  }
232
- }
232
+ })
233
233
  ];
234
234
  };
235
235
  /**
@@ -14,11 +14,12 @@ effects, see ../../../docs/architecture.md.
14
14
 
15
15
  ## Module Map
16
16
 
17
- - `http/route_spec.ts` — `RouteSpec` + `apply_route_specs`, validation pipeline, transactions.
17
+ - `http/route_spec.ts` — `RouteSpec` + `apply_route_specs`, validation pipeline, transactions; `define_route`, `define_route_shape` + `attach_route_handler` (a handler checked against its route), `to_route_response`.
18
+ - `http/route_result.ts` — what a handler returns: `route_ok`, `route_fail`, `route_raw` (`RouteResult`). Hono-free (types only).
18
19
  - `http/auth_shape.ts` — canonical `RouteAuth` type + `AuthAxisState` + predicates + the registration-time checks: `assert_route_auth_invariants` (the cross-axis invariants 1, 3, 4) and `assert_route_auth_acting_biconditional` (invariant 2), both run by `apply_route_specs` and `compile_action_registry` on every spec.
19
20
  - `http/error_schemas.ts` — `ERROR_*` constants, the per-code REST error definitions (`rest_error`, `REST_*`), `derive_route_errors`, `to_error_schemas`.
20
21
  - `http/route_errors.ts` — the route error map: `RouteErrorMap`, `resolve_route_error_map`, `resolve_app_route_error_maps`, `get_route_error_map`.
21
- - `http/route_error_check.ts` — `check_route_error` (whether an error response is one its route's map declares, the rule the DEV error check and `assert_response_matches_spec` share; `ALWAYS_ACCEPTED_ERRORS`, `is_error_status`, `format_route_error_check`) `is_json_response`, and the test helpers' hono-free route lookup (`split_route_template` and `parse_route_param`, a template read segment by segment as Hono's `getPattern` reads it; `compile_route_path`; `to_mounted_routes`; `find_mounted_route`), whose reading `resolve_valid_path` also fills params by. Hono-free and `esm-env`-free.
22
+ - `http/route_error_check.ts` — `check_route_error` (whether an error response is one its route's map declares, the rule the DEV error check and `assert_response_matches_spec` share; `ALWAYS_ACCEPTED_ERRORS`, `is_error_status`, `format_route_error_check`) `is_json_response`, and the test helpers' hono-free route lookup (`split_route_template` and `parse_route_param`, a template read segment by segment as Hono's `getPattern` reads it; `compile_route_path`; `compile_route_param_pattern`, a `{re}` grouped and anchored as `compile_route_path` reads it — Hono's RegExpRouter reading, stricter than TrieRouter's ungrouped `^re$`; `decode_route_path`, a path as Hono's router decodes it; `to_mounted_routes`; `find_mounted_route`), whose reading `resolve_valid_path` also fills params by. Hono-free and `esm-env`-free.
22
23
  - `http/dev_route_error_check.ts` — `create_dev_route_error_check({route_specs, route_error_maps, log})`: the DEV-only outer error check, `null` outside DEV; `create_route_lookup`, its lookup by Hono's own router.
23
24
  - `http/schema_helpers.ts` — shared schema introspection (null/void/strict/surface/middleware-applies), and `to_void_params` / `to_input_params` / `json_has_own_proto_key` / `safe_parse_dropping_unknown_keys`.
24
25
  - `http/middleware_spec.ts` — `MiddlewareSpec` interface.
@@ -49,7 +50,7 @@ consumers.
49
50
  - `method` — `'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'`
50
51
  - `path` — Hono path (supports `:param` segments)
51
52
  - `auth: RouteAuth` — flat record `{account, actor, roles?, credential_types?, required_scope?}` from `http/auth_shape.ts`. `account` / `actor` are `'none' | 'optional' | 'required'`. `required_scope` names the capability a narrowed api token's scope must admit — `surface:<name>`, a non-RPC surface refused to every narrowed token (an `rpc:<method>` capability throws at registration: it is the dispatcher's per-method gate, which a route never reaches) — and is route-spec-only: `compile_action_registry` rejects it on an `ActionSpec`, where the dispatcher derives `rpc:<method>` from `spec.method`. Otherwise the same shape governs `ActionSpec.auth` (see `actions/CLAUDE.md`).
52
- - `handler: RouteHandler` — `(c: Context, route: RouteContext) => Response | Promise<Response>`
53
+ - `handler: RouteHandler` — `(c: Context, route: RouteContext) => RouteResult | Promise<RouteResult>`, a result the framework answers with (§Handlers and results)
53
54
  - `description` — free-text, surfaced in `AppSurface`
54
55
  - `params?: z.ZodObject | AnySchema` — strict-object schema for URL path params
55
56
  - `query?: z.ZodObject | AnySchema` — strict-object schema for URL query string
@@ -77,6 +78,50 @@ warns on non-strict objects because unknown keys are silently stripped by Zod
77
78
  4's default `z.object()` (and by fuz_schema's `strip_object`, kept by its
78
79
  `loose_object`); the warning names the library's strict form.
79
80
 
81
+ ### Handlers and results
82
+
83
+ A handler returns a result, not a `Response`; `apply_route_specs` builds the
84
+ response from it (`to_route_response`) inside any wrapping transaction, so a
85
+ result that can't become one (a bare `Response`, a result no factory made
86
+ such as `{ok: true}` without `value`, `undefined`, a body `JSON.stringify`
87
+ refuses) throws before the commit, rolls back, and discards the post-commit
88
+ effects:
89
+
90
+ - `route_ok(value)` — `value` as JSON at 200.
91
+ - `route_fail(def, fields?)` — `{error: def.code, ...fields}` at `def.status`,
92
+ with the headers `def` derives (`REST_RATE_LIMIT_EXCEEDED`'s `Retry-After`).
93
+ `fields` is absent for a bare code, optional when every field is, required
94
+ when any is.
95
+ - `route_raw(response)` — the response as it is, at any status: an empty body,
96
+ bytes, a stream, an SSE response, a JSON-RPC envelope (`c.body(json, status,
97
+ {'Content-Type': 'application/json'})`). A `Response` typed as `c.json`'s
98
+ return is refused: a JSON answer of the route's own is `route_ok` or
99
+ `route_fail`.
100
+
101
+ Headers and cookies a handler sets on `c` (`c.header`, `setCookie`) before it
102
+ returns carry onto the response the framework builds. A failure is plain data
103
+ (`ok: false`), so domain code and shared helpers fail without the context and
104
+ a handler forwards one (`if (!result.ok) return result`). A thrown error is
105
+ still the error catch's.
106
+
107
+ A spec is made by `define_route(spec)`, or by `attach_route_handler(shape,
108
+ handler)` over a `define_route_shape(shape)` — the split the hono-free
109
+ `*_route_schema.ts` shapes use. Each checks the handler at the definition
110
+ (`TypedRouteHandler`): `route_ok`'s value against the input side of `output`
111
+ (made readonly at every depth, `ReadonlyJson`, so `route_ok` keeps literals as
112
+ written), and each `route_fail` against what the route allows — its `errors`,
113
+ the derived codes a handler may itself give (`RouteHandlerDerivedErrors`: the
114
+ 401 and the auth 403s its `auth` derives, the 429 of a `rate_limit`), and the
115
+ catch layers' 500 `internal_error` and 503 `service_unavailable`
116
+ (`RouteAlwaysErrors`). A failure is allowed when an allowed definition at the
117
+ same status and code accepts its body, so the bare 401 passes where
118
+ `REST_AUTHENTICATION_REQUIRED_BOOTSTRAP` is declared, and the reverse. An
119
+ `errors` list typed `Array<RestErrorDef>` is refused (`KnownRouteErrors`).
120
+ `RouteSpec` carries a phantom brand, in the types only, that just these two
121
+ mint, so a spec literal doesn't typecheck; a spread of a spec keeps the brand
122
+ and is not checked again (the DEV error check covers a rewritten `auth` or
123
+ `errors`). At runtime they return the spec, or the shape with its handler.
124
+
80
125
  ### `RouteContext` — per-request deps
81
126
 
82
127
  The second handler argument is always a `RouteContext`:
@@ -120,7 +165,7 @@ wrapper). See `auth/signup_routes.ts`.
120
165
  4. **Authorization phase** — when `spec.auth.actor !== 'none'`, resolves the acting actor against the resolved credential's account (`get_resolved_auth`, set by the auth middleware) plus the `acting` selector (`validated_query.acting` on GETs; read off the raw body on mutations, since body validation now runs after the gates), builds `RequestContext` via `build_request_context`, and sets `REQUEST_CONTEXT_KEY`. When `auth.account !== 'none' && auth.actor === 'none'`, an account-only context is built. Resolution failures return 400 `ERROR_ACTOR_REQUIRED` (with `available[]`) or `ERROR_ACTOR_NOT_ON_ACCOUNT` (or 500 `ERROR_NO_ACTORS_ON_ACCOUNT` on signup-invariant violation, 500 `ERROR_ACCOUNT_VANISHED` on torn account/actor reads after a successful resolve). Public routes (`account: 'none' && actor: 'none'`) skip this phase entirely.
121
166
  5. **Post-authorization auth guards** — `require_role(roles)` (403 `ERROR_INSUFFICIENT_PERMISSIONS` with `required_roles: ReadonlyArray<string>`) when `auth.roles?.length`. The only gate in this phase, because it is the only one that reads `REQUEST_CONTEXT_KEY` (populated by step 4) rather than the auth middleware's own context vars. Multi-role specs admit any-of via `has_any_scoped_role(ctx, roles, null)`.
122
167
  6. **Input validation** — JSON body parsed + validated; mismatch returns 400 `ERROR_INVALID_JSON_BODY` (not JSON) or `ERROR_INVALID_REQUEST_BODY` (schema failure with `issues`). Every schema refusal's `issues` are `WireIssue`s (`to_wire_issues`, `schema_issues.ts`), sent under DEV only (`dev_only`). Skipped on GET and on a null input (`is_null_schema`: `z.null()` or `literal(null)`). The validated input lands on `c.var.validated_input`.
123
- 7. **Handler** — wrapped in transaction when `use_transaction` (see above), receives `RouteContext`
168
+ 7. **Handler** — wrapped in transaction when `use_transaction` (see above), receives `RouteContext`; its result becomes the response (`to_route_response`)
124
169
  8. **Error catch** — catches a thrown JSON-RPC error (`ThrownJsonrpcError`, recognized by brand through `to_thrown_jsonrpc_error`, so one from a second fuz_app copy maps too; a foreign error class carrying a JSON-RPC `code` falls to the generic path) → maps to HTTP status + the flat REST error body (`{error: <reason>, message?, ...rest_data}`); catches generic `Error` → 500 `{error: 'internal_error', message?}` (message only in DEV). The reason string comes from `err.data.reason` when set (consumer-supplied canonical reason override) or from `jsonrpc_error_code_to_name(err.code)` (e.g. `-32003 → 'not_found'`). The flat shape matches what middleware and direct handlers emit — REST callers see one envelope across every emit site, while the JSON-RPC dispatcher keeps its own `{jsonrpc, id, error: {code, message, data}}` envelope on the RPC mount.
125
170
  9. **DEV-only output validation** — a 2xx JSON body against `spec.output` (see below); error responses are the outer DEV error check's
126
171
 
@@ -286,6 +331,7 @@ Key helpers:
286
331
  - `is_strict_object_schema(schema)` — detects `z.strictObject()` by checking `schema.def.catchall instanceof z.ZodNever`, or a fuz_schema `object` (not `strip_object` / `loose_object`); a fuz_schema `pipe` is read through to its first schema when no stage is a `transform` (so a refined `object` reads strict), while any Zod `ZodPipe` — even `O.pipe(O)` with no transform — reads not strict
287
332
  - `schema_to_surface(schema, {io?, source?, on_unrepresentable?}?)` — throws first on a value of neither library (`assert_validation_schema`, naming `source`, so an assembled app's slot of neither library fails boot as registration would refuse it, not as an unwritable JSON Schema); Zod or fuz_schema → JSON Schema (`z.toJSONSchema` or fuz_schema's `to_json_schema`, by `is_schema`), on the side `io` names (`'output'` by default), with `$schema` and `default` keys stripped recursively (defaults may be non-deterministic; `$schema` is snapshot noise). `null` for a null or void schema. A part JSON Schema can't say (an output-side transform, a `z.custom()`, a fuz_schema `check`) is left out or written as `{}` (`unrepresentable: 'any'`) and reported to `on_unrepresentable`; a schema with nothing describable (`{}` from a schema other than `z.unknown()` / `z.any()`) or one an emitter refuses outright throws, prefixed with `source` — so a root-level transform output (`z.unknown().transform(f)` included), `z.custom()` or `z.date()` fails server assembly. It never answers `null` for a failure, which would read as "no input" and drop the schema from every suite that reads the surface
288
333
  - `middleware_applies(mw_path, route_path)` — Hono pattern matching: `'*'`, exact, `'/api/*'` prefix (handles `prefix.slice(0, -1)` so `/api/*` also matches the bare `/api`)
334
+ - `middleware_carves_out(spec, route_path)` — one of the layer's `carve_outs` applies to the route; the carve-out half of `middleware_spec_applies`, which `assert_full_middleware_stack` reads to relax a carved-out route's expected stack
289
335
  - `middleware_spec_applies(spec, route_path)` — the layer runs on the route: its `path` applies and none of its `carve_outs` does; what the route error map takes middleware definitions by
290
336
 
291
337
  ## Surface Generation
@@ -7,7 +7,7 @@
7
7
  * @module
8
8
  */
9
9
  import type { Logger } from '@fuzdev/fuz_util/log.ts';
10
- import type { RouteSpec } from './route_spec.js';
10
+ import { type RouteSpec } from './route_spec.js';
11
11
  import { type ExpectedSchema } from '../db/schema_ready.js';
12
12
  /**
13
13
  * Create a public health check route spec.
@@ -1 +1 @@
1
- {"version":3,"file":"common_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/common_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAcH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQjD,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,uBAAuB,CAAC;AAE/B;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAAO,SAQ1C,CAAC;AAKH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,oBAAoB,GAAI,KAAK,GAAG,GAAG,MAAM,KAAG,cAkBxD,CAAC;AAEF,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IACjC;;;;OAIG;IACH,QAAQ,EAAE,cAAc,CAAC;IACzB,gFAAgF;IAChF,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,iBAAiB,KAAG,SAgCpE,CAAC;AAEF,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IACnC,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,wFAAwF;IACxF,aAAa,EAAE,MAAM,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,GAAI,SAAS,mBAAmB,KAAG,SAQ7E,CAAC"}
1
+ {"version":3,"file":"common_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/common_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAcH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI/D,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,uBAAuB,CAAC;AAE/B;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAAO,SASzC,CAAC;AAKJ;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,oBAAoB,GAAI,KAAK,GAAG,GAAG,MAAM,KAAG,cAkBxD,CAAC;AAEF,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IACjC;;;;OAIG;IACH,QAAQ,EAAE,cAAc,CAAC;IACzB,gFAAgF;IAChF,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,iBAAiB,KAAG,SAgCpE,CAAC;AAEF,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IACnC,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,wFAAwF;IACxF,aAAa,EAAE,MAAM,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,GAAI,SAAS,mBAAmB,KAAG,SAS5E,CAAC"}
@@ -8,8 +8,10 @@
8
8
  */
9
9
  import { readFileSync } from 'node:fs';
10
10
  import { integer, literal, loose_object, min_value, number, object, pipe, string } from '@fuzdev/fuz_schema/schema.ts';
11
+ import { define_route } from './route_spec.js';
12
+ import { route_fail, route_ok } from './route_result.js';
11
13
  import { HEALTH_PATH, HealthResponse } from './health_schema.js';
12
- import { ERROR_DB_UNREACHABLE, ERROR_SCHEMA_DRIFT, REST_DB_UNREACHABLE, REST_SCHEMA_DRIFT } from './error_schemas.js';
14
+ import { REST_DB_UNREACHABLE, REST_SCHEMA_DRIFT } from './error_schemas.js';
13
15
  import { check_schema_drift, format_schema_drift } from '../db/schema_ready.js';
14
16
  /**
15
17
  * Create a public health check route spec.
@@ -17,11 +19,11 @@ import { check_schema_drift, format_schema_drift } from '../db/schema_ready.js';
17
19
  * Infrastructure endpoint for uptime monitors and load balancers.
18
20
  * Bootstrap availability is exposed via `/api/account/status` instead.
19
21
  */
20
- export const create_health_route_spec = () => ({
22
+ export const create_health_route_spec = () => define_route({
21
23
  method: 'GET',
22
24
  path: HEALTH_PATH,
23
25
  auth: { account: 'none', actor: 'none' },
24
- handler: (c) => c.json({ status: 'ok' }),
26
+ handler: () => route_ok({ status: 'ok' }),
25
27
  description: 'Health check',
26
28
  input: literal(null),
27
29
  output: HealthResponse
@@ -87,7 +89,7 @@ export const create_ready_route_spec = (options) => {
87
89
  throw new Error('create_ready_route_spec: `expected` is empty — a readiness gate with no expected ' +
88
90
  'tables passes for any live DB. Pass a non-empty expected column map.');
89
91
  }
90
- return {
92
+ return define_route({
91
93
  method: 'GET',
92
94
  path: '/ready',
93
95
  auth: { account: 'none', actor: 'none' },
@@ -95,22 +97,22 @@ export const create_ready_route_spec = (options) => {
95
97
  input: literal(null),
96
98
  output: object({ ready: literal(true) }),
97
99
  errors: [REST_SCHEMA_DRIFT, REST_DB_UNREACHABLE],
98
- handler: async (c, route) => {
100
+ handler: async (_c, route) => {
99
101
  try {
100
102
  const drift = await check_schema_drift(route.db, options.expected);
101
103
  if (drift.ok)
102
- return c.json({ ready: true });
104
+ return route_ok({ ready: true });
103
105
  // Detailed drift goes to the server log only — the public body stays a
104
106
  // minimal error code so the endpoint doesn't leak schema structure.
105
107
  options.log?.error(`[ready] schema drift detected:\n${format_schema_drift(drift)}`);
106
- return c.json({ error: ERROR_SCHEMA_DRIFT }, 503);
108
+ return route_fail(REST_SCHEMA_DRIFT);
107
109
  }
108
110
  catch (err) {
109
111
  options.log?.error('[ready] readiness check failed (db unreachable?):', err);
110
- return c.json({ error: ERROR_DB_UNREACHABLE }, 503);
112
+ return route_fail(REST_DB_UNREACHABLE);
111
113
  }
112
114
  }
113
- };
115
+ });
114
116
  };
115
117
  /**
116
118
  * Create an authenticated server status route spec.
@@ -118,11 +120,11 @@ export const create_ready_route_spec = (options) => {
118
120
  * Returns version and uptime. Unlike the public health check,
119
121
  * this requires authentication.
120
122
  */
121
- export const create_server_status_route_spec = (options) => ({
123
+ export const create_server_status_route_spec = (options) => define_route({
122
124
  method: 'GET',
123
125
  path: '/api/server/status',
124
126
  auth: { account: 'required', actor: 'none' },
125
- handler: (c) => c.json({ version: options.version, uptime_ms: options.get_uptime_ms() }),
127
+ handler: () => route_ok({ version: options.version, uptime_ms: options.get_uptime_ms() }),
126
128
  description: 'Server version and uptime',
127
129
  input: literal(null),
128
130
  output: loose_object({ version: string, uptime_ms: pipe(number, integer, min_value(0)) })
@@ -1 +1 @@
1
- {"version":3,"file":"db_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/db_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAsBtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAoBpF;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACpB;AAwCD,sDAAsD;AACtD,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,sDAAsD;AACtD,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAKrD,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO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