@quickback-dev/cli 0.31.1 → 0.34.2

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 (41) hide show
  1. package/dist/commands/compile.d.ts.map +1 -1
  2. package/dist/commands/compile.js +9 -1
  3. package/dist/commands/compile.js.map +1 -1
  4. package/dist/commands/migrations.d.ts +17 -0
  5. package/dist/commands/migrations.d.ts.map +1 -0
  6. package/dist/commands/migrations.js +328 -0
  7. package/dist/commands/migrations.js.map +1 -0
  8. package/dist/docs/content.d.ts.map +1 -1
  9. package/dist/docs/content.js +15 -10
  10. package/dist/docs/content.js.map +1 -1
  11. package/dist/index.js +7 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/lib/file-loader.d.ts +15 -0
  14. package/dist/lib/file-loader.d.ts.map +1 -1
  15. package/dist/lib/file-loader.js +27 -0
  16. package/dist/lib/file-loader.js.map +1 -1
  17. package/dist/lib/file-loader.test.js +22 -1
  18. package/dist/lib/file-loader.test.js.map +1 -1
  19. package/dist/skill/docs/changelog.md +758 -0
  20. package/dist/skill/docs/compiler/config/domains.md +26 -0
  21. package/dist/skill/docs/compiler/config/index.md +74 -3
  22. package/dist/skill/docs/compiler/config/single-tenant.md +1 -1
  23. package/dist/skill/docs/compiler/definitions/access.md +161 -9
  24. package/dist/skill/docs/compiler/definitions/actions.md +45 -1
  25. package/dist/skill/docs/stack/account-ui/features/admin.md +2 -2
  26. package/dist/skill/docs/stack/account-ui/hooks.md +4 -0
  27. package/dist/skill/docs/stack/auth/plugins/aws-ses.md +60 -0
  28. package/dist/skill/docs/stack/auth/plugins/aws-sns.md +169 -0
  29. package/dist/skill/docs/stack/auth/plugins/index.md +32 -0
  30. package/package.json +1 -1
  31. package/src/skill/docs/changelog.md +758 -0
  32. package/src/skill/docs/compiler/config/domains.md +26 -0
  33. package/src/skill/docs/compiler/config/index.md +74 -3
  34. package/src/skill/docs/compiler/config/single-tenant.md +1 -1
  35. package/src/skill/docs/compiler/definitions/access.md +161 -9
  36. package/src/skill/docs/compiler/definitions/actions.md +45 -1
  37. package/src/skill/docs/stack/account-ui/features/admin.md +2 -2
  38. package/src/skill/docs/stack/account-ui/hooks.md +4 -0
  39. package/src/skill/docs/stack/auth/plugins/aws-ses.md +60 -0
  40. package/src/skill/docs/stack/auth/plugins/aws-sns.md +169 -0
  41. package/src/skill/docs/stack/auth/plugins/index.md +32 -0
@@ -1,5 +1,748 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.34.1 — May 24, 2026
4
+
5
+ Patch fixing a silent-skip bug in drizzle migration emission, plus a new
6
+ CLI subcommand for inspecting and repairing migration-state drift.
7
+
8
+ ### Compiler now fails loud on drizzle migration state drift
9
+
10
+ When `quickback/drizzle/<dialect>/meta/_journal.json` fell out of sync
11
+ with the on-disk `.sql` files — typically because someone hand-rolled a
12
+ migration without a journal bump, or because a prior compile collided
13
+ with an existing tag — drizzle-kit's diff base became stale and it
14
+ silently skipped emission. The compile reported success, no new `.sql`
15
+ was written for newly defined tables, and the next `wrangler deploy`
16
+ shipped a Worker that 500'd on every request touching those tables.
17
+
18
+ The compiler now runs a precheck before any drizzle-kit invocation and
19
+ refuses to compile when it detects any of:
20
+
21
+ - `.sql` files on disk with no matching entry in `_journal.json`
22
+ - journal entries that reference missing `.sql` files
23
+ - non-sequential `idx` values in `_journal.json`
24
+ - two `.sql` files sharing the same `idx`
25
+ - (for `auth/` and `features/` only) journal entries with no matching
26
+ `<idx>_snapshot.json` — drizzle-kit needs the snapshot as a diff base
27
+
28
+ Snapshot/journal drift that the previous `console.warn` only logged
29
+ server-side is now propagated to the CLI and printed under
30
+ "Compilation warnings".
31
+
32
+ ### New `quickback migrations doctor` CLI command
33
+
34
+ Two modes:
35
+
36
+ ```bash
37
+ quickback migrations doctor # diagnose
38
+ quickback migrations doctor --rebuild-journal # repair
39
+ ```
40
+
41
+ Diagnose walks `quickback/drizzle/{auth,features,files,webhooks,audit}/`,
42
+ prints a per-dir table (`.sql files`, `journal entries`, `snapshots`),
43
+ and flags every drift kind the compiler precheck enforces. Repair
44
+ rewrites `_journal.json` from on-disk `.sql` filenames in sorted order —
45
+ this is the recovery recipe users were applying by hand. Snapshot drift
46
+ on drizzle-kit dirs (`auth/`, `features/`) can only be repaired by
47
+ running `drizzle-kit introspect` against the live DB; the doctor prints
48
+ the exact command.
49
+
50
+ ### Upgrade path for projects in the broken state
51
+
52
+ Projects with existing drift will get a clear error message and an
53
+ explicit fix command on the next compile against v0.34.1:
54
+
55
+ ```
56
+ ✖ Drizzle migration state is inconsistent — refusing to compile.
57
+ Causes:
58
+ - quickback/drizzle/features: 7 .sql file(s) have no matching journal entry: ...
59
+ Fixes:
60
+ - Run `quickback migrations doctor` to diagnose, then
61
+ `quickback migrations doctor --rebuild-journal` to repair.
62
+ ```
63
+
64
+ No action needed for projects whose journals are already in sync.
65
+
66
+ ## v0.34.0 — May 23, 2026
67
+
68
+ Customizable email-OTP templates and a dedicated admin-create-user hook
69
+ — closes a longstanding gap where projects on `email.provider: 'aws-ses'`
70
+ had to live with the generic "Your password reset code is ..." copy for
71
+ admin-bootstrapped accounts.
72
+
73
+ ### Per-type email-OTP template overrides
74
+
75
+ Drop a `.ts` file at `quickback/email-templates/<name>.ts` that
76
+ default-exports `(input) => ({ subject, html, text })`, then reference
77
+ it from the new `plugins.emailOtp.templates` map. Missing keys fall
78
+ through to the package defaults from `@quickback-dev/better-auth-aws-ses`
79
+ — this is purely additive; existing `emailOtp: true` projects emit the
80
+ same code they did before.
81
+
82
+ ```ts title="quickback/quickback.config.ts"
83
+ defineAuth("better-auth", {
84
+ plugins: {
85
+ emailOtp: {
86
+ templates: {
87
+ 'forget-password': './email-templates/forget-password',
88
+ 'welcome': './email-templates/welcome',
89
+ },
90
+ },
91
+ },
92
+ });
93
+ ```
94
+
95
+ ```ts title="quickback/email-templates/welcome.ts"
96
+ export default function welcome({ otp, name, appName, appUrl }) {
97
+ const greeting = name ? `Hi ${name},` : 'Hi,';
98
+ return {
99
+ subject: `Welcome to ${appName} — set your password`,
100
+ html: `<h1>Welcome to ${appName}</h1><p>${greeting} use this code: <b>${otp}</b></p>`,
101
+ text: `${greeting}\n\nYour ${appName} code: ${otp}`,
102
+ };
103
+ }
104
+ ```
105
+
106
+ Recognized keys: `'sign-in' | 'email-verification' | 'forget-password' |
107
+ 'welcome'`. The first three map 1:1 to Better Auth's emailOTP `type`
108
+ enum.
109
+
110
+ ### Synthetic `welcome` routing — credential-row lookup
111
+
112
+ `'welcome'` has no native Better Auth OTP type. When configured, the
113
+ generated `sendVerificationOTP` callback queries the `account` table
114
+ for a `credential`-provider row for the recipient *before* rendering;
115
+ if the user has none (typical of an admin-plugin-created account
116
+ without a password), the send is rerouted through the welcome
117
+ template. Without a welcome template, those sends fall through to
118
+ `forget-password` — same behavior as before. DB-error path fails open
119
+ to the normal forget-password flow so a transient failure can't
120
+ deadlock the password-reset surface.
121
+
122
+ Provider scope: overrides are only honored on `email.provider:
123
+ 'aws-ses'`. The Cloudflare Email path uses the helper's own template
124
+ pipeline and ignores the new config.
125
+
126
+ ### New recognized hook: `after-admin-user-create.ts`
127
+
128
+ A virtual event that wires into the same Better Auth
129
+ `databaseHooks.user.create.after` slot as the generic
130
+ `after-user-create.ts`, but the generator gates the call on
131
+ `_baCtx?.context?.path` matching `/admin/create-user` so it only fires
132
+ when the row came from the admin plugin's create-user endpoint. Use it
133
+ for first-time-user provisioning (welcome email, default org
134
+ assignment, audit-log writes) without inspecting the BA context by
135
+ hand. The generic `after-user-create.ts` still runs for every signup,
136
+ including admin-created ones; the two coexist in a single merged
137
+ `after:` handler.
138
+
139
+ ```
140
+ quickback/hooks/
141
+ after-user-create.ts # every signup
142
+ after-admin-user-create.ts # admin-plugin /admin/create-user only
143
+ ```
144
+
145
+ ### File transport mirrors existing slots
146
+
147
+ The new `quickback/email-templates/` directory follows the same
148
+ pattern as `quickback/plugins/`, `quickback/hooks/`, and
149
+ `quickback/lib/`: the CLI walks the folder and uploads each `.ts` file
150
+ in a new `projectEmailTemplates` field on the compile request; the
151
+ better-auth provider stages referenced files into
152
+ `src/email-templates/<name>.ts` and emits default imports in
153
+ `src/lib/auth.ts`. Files not referenced by any template entry are
154
+ ignored — the CLI uploads the whole directory; the compiler picks only
155
+ what's needed. A relative path pointing at a file the CLI never
156
+ shipped fails compile fast with a "place the file at … and rerun"
157
+ hint.
158
+
159
+ See [AWS SES Plugin → Per-Type Template Overrides](/stack/auth/plugins/aws-ses#per-type-template-overrides)
160
+ and [Account UI → Hooks](/stack/account-ui/hooks#recognized-events).
161
+
162
+ ## v0.33.6 — May 22, 2026
163
+
164
+ Two compiler-side fixes for the queue-consumer / embedding surface and one
165
+ schema-emission bug that blocked `generateId: 'cuid'` projects.
166
+
167
+ ### Schema-emitted `createId()` now ships with a polyfill (no missing import)
168
+
169
+ When `providers.database.config.generateId` is set to `'cuid'`, the audit-
170
+ field injector emits an id column like
171
+ `id: text('id').primaryKey().$defaultFn(() => createId())`. Previously the
172
+ schema source referenced `createId` but no import landed, so `tsc` on the
173
+ generated project failed with `Cannot find name 'createId'`. Recurring
174
+ bug — every recompile re-emitted the broken file (the "do not edit"
175
+ banner doesn't protect from regeneration).
176
+
177
+ Fix: the injector now prepends a top-of-file polyfill backed by
178
+ `crypto.randomUUID()` — a Workers / Node 19+ / Bun global — instead of
179
+ trying to import `@paralleldrive/cuid2`. The package isn't bundled by
180
+ Quickback (per the [hooks doc](/stack/account-ui/hooks)'s "stick to
181
+ built-ins" guidance) and the schema-gen sandbox can't resolve project
182
+ node_modules anyway, so the polyfill is the only path that works
183
+ out-of-the-box.
184
+
185
+ ```ts title="Generated schema header (cuid strategy)"
186
+ import { sqliteTable, text } from 'drizzle-orm/sqlite-core';
187
+
188
+ // Polyfill — Quickback compiler does not ship @paralleldrive/cuid2 in
189
+ // generated projects, and the schema-gen sandbox can't see node_modules.
190
+ // crypto.randomUUID() is a Workers / Node 19+ / Bun global.
191
+ const createId = () => crypto.randomUUID();
192
+
193
+ export const widgets = sqliteTable('widgets', {
194
+ id: text('id').primaryKey().$defaultFn(() => createId()),
195
+ // ...
196
+ });
197
+ ```
198
+
199
+ If you want real cuid2 strings (collision-resistant, shorter than UUIDs)
200
+ you can still install `@paralleldrive/cuid2` and add the import yourself —
201
+ the injector honours an existing import and skips the polyfill.
202
+
203
+ ### queue-consumer.ts header reflects what the file actually does
204
+
205
+ Before v0.33.6 the generated `src/queue-consumer.ts` always carried the
206
+ preamble:
207
+
208
+ ```
209
+ * Queue Consumer for Embedding Jobs & Custom Queue Handlers
210
+ *
211
+ * Processes embedding jobs asynchronously using Workers AI and Vectorize.
212
+ * Also supports custom queue handlers defined in services/queues/.
213
+ ```
214
+
215
+ — even on projects with zero embedding features. Users on
216
+ custom-queue-only deployments would search for `EMBEDDINGS_QUEUE` /
217
+ Vectorize bindings that wrangler.toml correctly didn't emit, wasting
218
+ diagnostic time.
219
+
220
+ The preamble now reflects the actual surface:
221
+
222
+ | `hasEmbeddings` | `hasCustomHandlers` | Header |
223
+ |---|---|---|
224
+ | ✓ | ✓ | "Queue Consumer for Embedding Jobs & Custom Queue Handlers" |
225
+ | ✓ | — | "Queue Consumer for Embedding Jobs" |
226
+ | — | ✓ | "Queue Consumer for Custom Queue Handlers" + explicit "No embedding bindings (EMBEDDINGS_QUEUE / Vectorize / AI) are referenced" |
227
+ | — | — | "Queue Consumer Stub" (additionalQueues with no handler yet) |
228
+
229
+ ### Symmetric embedding detection prevents silent drift
230
+
231
+ The wrangler.toml emit path (`EMBEDDINGS_QUEUE` producer/consumer
232
+ declaration) and the queue-consumer.ts emit path (embedding handler code)
233
+ previously used two different functions to detect "this project has
234
+ embeddings": `hasEmbeddingsConfig` checked both `feature.resource.
235
+ embeddings` and `feature.tables[].resource.embeddings`;
236
+ `extractEmbeddingFeatures` only iterated the tables array. A feature
237
+ shape with feature-level embeddings sugar but no populated tables would
238
+ land in the wrangler binding while NOT landing in the consumer file
239
+ — silent drift.
240
+
241
+ `hasEmbeddingsConfig` is now defined as
242
+ `extractEmbeddingFeatures(...).length > 0`. The two stay in lock-step
243
+ by construction. `extractEmbeddingFeatures` now reads from both shapes
244
+ (tables-level when present, feature-level otherwise).
245
+
246
+ ## v0.33.5 — May 22, 2026
247
+
248
+ Two structural fixes that resolve recurring classes of bug for projects with
249
+ integer primary keys and for projects whose audit columns drift between
250
+ schema and database.
251
+
252
+ ### URL `:id` params coerce to Number when the PK column is integer
253
+
254
+ Per-id CRUD handlers (`GET /:id`, `PATCH /:id`, `DELETE /:id`, `PUT /:id`)
255
+ extracted the URL param as a string and passed it straight into
256
+ `eq(table.id, id)`. For resources with `integer().primaryKey()` columns —
257
+ triggered either by `generateId: 'serial'` on the database config or by
258
+ imported legacy schemas — every per-id route raised a downstream tsc
259
+ type error (integer ≠ string). One production project reported 249 such
260
+ errors across 30+ generated `*.routes.ts` files.
261
+
262
+ Generated handlers for integer-PK resources now emit:
263
+
264
+ ```ts
265
+ const __idRaw = c.req.param('id');
266
+ const id = Number(__idRaw);
267
+ if (!Number.isInteger(id)) {
268
+ return c.json(ValidationErrors.invalidInput([{
269
+ path: ['id'],
270
+ message: `Expected integer, got "${__idRaw}"`,
271
+ code: 'invalid_type',
272
+ }]), 400);
273
+ }
274
+ ```
275
+
276
+ Text-PK resources (the default and the recommended path) are unchanged.
277
+
278
+ A soft-deprecation warning now fires at compile time when
279
+ `providers.database.config.generateId === 'serial'` is set, nudging new
280
+ projects toward text-PK strategies (`'cuid'`, `'uuid'`, `'prefixed'`, or
281
+ the default). Existing serial-PK projects keep working.
282
+
283
+ ### Audit-field injection now runs for every dialect
284
+
285
+ The compiler auto-injects `created_at`, `modified_at`, `created_by`, and
286
+ `modified_by` columns into every feature table, and the scoped-db
287
+ runtime auto-fills them on insert. Until v0.33.5, the early injection
288
+ step in `parseCompilerInput` was gated on `targetDialect ===
289
+ 'postgresql'`. SQLite/D1 projects fell back to a later injection inside
290
+ `generateFeature`, which only fired when `feature.tables.length > 0` —
291
+ features arriving without a populated tables array (raw-drizzle shapes,
292
+ certain legacy migration tables) silently skipped audit injection.
293
+
294
+ Symptom: schemas claimed the columns existed (so the scoped-db proxy
295
+ tried to fill them on insert), but the database table didn't have them.
296
+ Inserts failed with "column doesn't exist." Users reported this for the
297
+ `user_preferences` table and, earlier, for `chat_reads` (the
298
+ `0028_chat_reads_id_column.sql` incident).
299
+
300
+ The early injection now runs for all dialects. `injectAuditFields` is
301
+ already idempotent, so the subsequent per-target injections in
302
+ `compilePureSQLTarget` and `feature-generator.ts` are no-ops when the
303
+ columns are already present. Net: every feature's schema source has
304
+ audit columns by the time drizzle-kit reads it, regardless of dialect
305
+ or feature shape.
306
+
307
+ Upgrade path: recompile against v0.33.5, commit the generated migration
308
+ that adds the missing audit columns, then `wrangler d1 migrations apply`.
309
+
310
+ ## v0.33.4 — May 21, 2026
311
+
312
+ Patch fixes covering upgrade-path bugs and OpenAPI spec/route divergence. No
313
+ new features or breaking changes.
314
+
315
+ ### OpenAPI emits CRUD endpoints only when the route emitter registers them
316
+
317
+ The OpenAPI emitter previously advertised `GET /`, `POST /`, `GET /:id`,
318
+ `PATCH /:id`, `DELETE /:id`, and the corresponding `/batch` operations on
319
+ every resource, regardless of which CRUD verbs were actually declared.
320
+ Clients generated from `openapi.json` then issued requests that fell
321
+ through to `ROUTE_NOT_FOUND` from the firewall layer — a silent contract
322
+ break for anyone whose code path was driven by openapi-typescript or
323
+ similar codegen.
324
+
325
+ Each gate now mirrors the route emitter exactly. A resource that only
326
+ declares `read + create + delete` (no `update`) gets no PATCH operations
327
+ in the spec. A write-only sink (`create` only, no `read`) gets no GET
328
+ operations. Same for batch variants — `POST /batch` only when
329
+ `crud.create` is set, `DELETE /batch` only when `crud.delete` is set,
330
+ etc.
331
+
332
+ If your generated client was calling these spurious endpoints, those
333
+ calls were already failing at runtime; this just removes them from the
334
+ spec.
335
+
336
+ ### Legacy D1 audit-timestamp migrations rewritten in place
337
+
338
+ Compilers ≤ v0.33.1 emitted
339
+ `DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))` for audit columns
340
+ (`created_at`, `modified_at`, etc.). Cloudflare D1 rejects this in
341
+ `ALTER TABLE ADD COLUMN` with `SQLITE_ERROR [code: 7500] "Cannot add a
342
+ column with non-constant default"`. v0.33.2 stopped emitting the
343
+ non-constant form, but pending unapplied legacy migration files on
344
+ upgrading projects still poisoned `wrangler d1 migrations apply` and
345
+ left the deploy stuck.
346
+
347
+ The D1 migration safety pass now retrofits these files in place,
348
+ replacing the strftime expression with the same `'1970-01-01T00:00:00.000Z'`
349
+ constant v0.33.2+ uses. The compile-time warning lists the affected
350
+ columns:
351
+
352
+ ```
353
+ ⚠ D1 helper adjusted features migrations for Cloudflare D1 safety:
354
+ 0004_early_dracula.sql [rewrote=applied_at,created_at,modified_at]
355
+ ```
356
+
357
+ Upgrade path: recompile against v0.33.4, commit the rewritten SQL, then
358
+ `wrangler d1 migrations apply` proceeds.
359
+
360
+ ### D1 helper warning is now actionable
361
+
362
+ The same migration safety pass auto-prepends `PRAGMA defer_foreign_keys
363
+ = on` to every drizzle table-rebuild migration — required on D1
364
+ because it doesn't honour `PRAGMA foreign_keys=OFF/ON` mid-migration the
365
+ way SQLite does. The pass used to surface this insertion as a warning
366
+ on every recompile, training users to ignore the warning entirely.
367
+
368
+ The PRAGMA is still inserted (it has to be), but no longer fires the
369
+ warning. Stripped Better Auth cleanup, reordered child-first DROPs, and
370
+ the new `rewrote=…` annotation above still warn — those are cases where
371
+ a human should look.
372
+
373
+ ### Reference: `account.appUrl` / `account.tenantPattern`
374
+
375
+ v0.33's redesigned dashboard org-card uses two new optional fields on
376
+ the `account` config to deep-link into the tenant's own app:
377
+
378
+ ```ts
379
+ // quickback.config.ts
380
+ account: {
381
+ // …existing fields
382
+ appUrl: 'https://app.example.com',
383
+ tenantPattern: '/{slug}',
384
+ }
385
+ ```
386
+
387
+ Both are typed in the config schema and baked into the Account SPA at
388
+ build time as `VITE_QUICKBACK_APP_URL` and `VITE_TENANT_URL_PATTERN`.
389
+ Without them, the dashboard falls back to a single-target card that
390
+ links to the account org-settings page (legacy v0.32 behaviour). Adding
391
+ them enables the two-zone layout with the external deep-link affordance.
392
+
393
+ (No code change in v0.33.4 — the fields shipped with v0.33.0 but weren't
394
+ called out in the changelog.)
395
+
396
+ ## v0.33.0 — May 21, 2026
397
+
398
+ ### Dedicated hostnames for `/auth/v1/*` and `/api/v1/*` (Shape 1)
399
+
400
+ Two new optional overrides let you carve specific backend surfaces onto dedicated hostnames, served by the same Worker:
401
+
402
+ ```ts
403
+ // quickback.config.ts
404
+ auth: { domain: 'auth.example.com' }, // /auth/v1/* lives here too
405
+ api: { domain: 'api.example.com' }, // /api/v1/* lives here too
406
+ ```
407
+
408
+ On the dedicated hostname, the hostname IS the namespace — `/v1/*` is a shortcut that the Worker-entry rewriter prepends with `/auth` or `/api` before route matching. So `https://api.example.com/v1/users` reaches the same handler as `https://quickback.example.com/api/v1/users`. Both forms work; the long form is also accepted on the dedicated host. Non-matching paths return a JSON 404 ("Not found on api.domain — this hostname serves /api/v1/* and the /v1/* shortcut only") — each hostname stays dedicated to its surface. `/health` and `/openapi.json` are explicit exceptions because monitoring/discovery agents expect them everywhere.
409
+
410
+ Both new domains:
411
+ - Get a `{ pattern, custom_domain: true }` route in `wrangler.toml`
412
+ - Join `trustedOrigins` (CORS allowlist)
413
+ - Join the cross-subdomain cookie inference (auto-enables `crossSubDomainCookies` when ≥2 same-parent subdomains are configured)
414
+ - Join CSP `connect-src` so SPAs can fetch from them
415
+
416
+ **Dual-reach:** all routes remain reachable at the unified backend host (see below) regardless of which dedicated hostnames are configured. The dedicated hostnames are aliases, never replacements.
417
+
418
+ ### `quickback.{baseDomain}` codified as the always-present unified backend
419
+
420
+ The compiler has always auto-inferred a `quickback.{baseDomain}` hostname when any subdomain is configured. v0.33 promotes this from inferred fallback to **load-bearing contract**:
421
+
422
+ - The unified backend hostname is GUARANTEED to exist when any custom subdomain (`account.domain`, `cms.domain`, `auth.domain`, `api.domain`, `apps.<n>.domain`) is set.
423
+ - Every compiler-emitted backend route (api, auth, storage, health, openapi, realtime, mcp, bundled SPAs, sysadmin endpoints) is reachable at the unified host, always.
424
+ - Per-surface domain overrides are additive (Shape 1) — they create more hostnames, never remove routes from the unified host.
425
+
426
+ This is forward-pointing: the future management layer can rely on a single discovery URL pattern (`https://quickback.{baseDomain}/...`) to find any backend regardless of how the operator split their surfaces onto subdomains.
427
+
428
+ Inference also extends to consider `auth.domain` and `api.domain` as domain sources, so a project configuring only one of them still derives `quickback.{baseDomain}` automatically. Explicit `config.domain` still wins over inference.
429
+
430
+ ### `compiler.routes` config block (scaffold — partial)
431
+
432
+ Optional path-prefix overrides for compiler-emitted system routes:
433
+
434
+ ```ts
435
+ compiler: {
436
+ routes: {
437
+ storage: '/files', // default '/storage'
438
+ broadcast: '/realtime', // default '/broadcast/v1'
439
+ mcp: '/agent', // default '/mcp'
440
+ health: '/_health', // default '/health'
441
+ openapi: '/openapi.yaml', // default '/openapi.json'
442
+ },
443
+ }
444
+ ```
445
+
446
+ **Status:** the config is validated and reaches the reserved-prefix registry (so SPA pass-through and compile-time collision detection already honor overrides), but the per-section route emitters still hardcode the defaults. Setting a non-default value today will produce a misconfigured Worker — the registry knows the new path but the actual `app.route('/storage/v1', …)` mount uses the old one. **Don't set these in production yet.** Per-section emit wiring lands in a follow-up.
447
+
448
+ `/api/v1/` and `/auth/v1/` are NOT configurable here — those are deep contracts touched by feature emitters, OpenAPI generation, generated clients, and BA's own basePath. The Shape 1 hostname overrides above are the supported way to relocate them.
449
+
450
+ ## v0.32.0 — May 21, 2026
451
+
452
+ ### Single-origin path-routed architecture
453
+
454
+ A modern Quickback project now runs on **one Cloudflare Worker behind one custom domain**, with the bundled Account and CMS SPAs path-mounted at `/account/` and `/cms/`, system routes at `/api/`, `/auth/`, `/storage/`, and the user's own SPAs anywhere else they want. No cross-subdomain cookies, zero CORS preflights, no separate `api.`/`account.`/`cms.` subdomains required:
455
+
456
+ ```ts
457
+ // quickback.config.ts
458
+ apps: { www: { domain: 'app.example.com' } }, // user's root SPA
459
+ account: true, // bundled at /account/
460
+ cms: true, // bundled at /cms/
461
+ // /api/, /auth/, /storage/, /openapi.json, /health all live here too
462
+ ```
463
+
464
+ The bug that previously broke this shape: when a hostname-mounted root SPA was configured (`apps.www.domain`), its middleware swallowed every path that wasn't in a hardcoded list (`/api/`, `/auth/`, `/admin/`, `/storage/`, `/health`). Requests to `/account/profile` got remapped to `/www/account/profile`, 404'd, then SPA-fallback'd to the wrong SPA. v0.32 introduces a **reserved-prefix registry** (`resolveReservedPrefixes` in `apps/compiler/src/generators/core/reserved-prefixes.ts`) as the single source of truth for what every catchall middleware must pass through:
465
+
466
+ - **System** (always present): `/api/`, `/auth/`, `/storage/`, `/health`, `/openapi.json`
467
+ - **Conditional** (only when feature is on): `/account/` (when `account: true`), `/cms/` (when `cms: true`), `/broadcast/v1/` (realtime), `/mcp` (MCP server)
468
+ - **User-contributed**: every `apps.<name>.path` for path-mounted apps
469
+
470
+ Path-mounted apps that collide with a system or bundled-SPA reservation throw a compile-time error naming both owners. `apps.api = { path: '/api' }` errors clearly instead of silently hijacking feature routes at runtime.
471
+
472
+ ### Admin URL namespace migration: `/admin/v1/*` → `/auth/v1/admin/*`
473
+
474
+ Quickback's legacy admin tier emitted three things under `/admin/v1/*`:
475
+
476
+ 1. A role-admit middleware that admitted both `'admin'` and `'sysadmin'` — contradicting the pseudo-role evaluator's strict-independence model (`ADMIN` admits `'admin'` only; `SYSADMIN` admits `'sysadmin'` only).
477
+ 2. `GET /admin/v1/organizations` — a thin proxy to Better Auth's own `/auth/v1/organization/list`.
478
+ 3. `GET /admin/v1/sysadmin/organizations` — cross-tenant org listing, sysadmin-only.
479
+
480
+ In v0.32, the first two are **removed** and the third **renames** to `GET /auth/v1/admin/list-organizations`. The new path sits under Better Auth's admin URL namespace (sibling of `/auth/v1/admin/list-users`, `/auth/v1/admin/ban-user`, etc.), follows BA's verb-noun convention, and keeps its sysadmin-only gate inside the handler — Quickback-emitted, not BA-mounted.
481
+
482
+ What this enables: `/admin/*` is no longer a reserved system prefix. Projects can mount their own admin SPA via `apps.admin = { path: '/admin' }` without colliding with anything.
483
+
484
+ What changes for callers:
485
+ - The bundled CMS SPA's sysadmin org switcher is updated in lockstep (no migration needed for projects using the SPA as-is).
486
+ - External callers of `/admin/v1/organizations` should migrate to BA's `/auth/v1/organization/list` (same behavior — caller's memberships).
487
+ - External callers of `/admin/v1/sysadmin/organizations` should migrate to `/auth/v1/admin/list-organizations`.
488
+ - Features that previously relied on the "admit both admin AND sysadmin" middleware should declare `access: { roles: ['ADMIN', 'SYSADMIN'] }` explicitly on each route.
489
+
490
+ The `ADMIN_ROUTE_FEATURES` carve-out in the compiler is also removed — feature routes always mount at `/api/v1/<feature>`, and admin-only behavior is enforced by per-operation `access: { roles: ['ADMIN'] }` at the resource level.
491
+
492
+ ### Two compiler bug fixes
493
+
494
+ - **Soft-delete index callback parameter bug.** The auto-index injector emitted hardcoded `t.<col>` references regardless of the existing extras callback's parameter name. When a user (or upstream transform) wrote `(table3) => ({ … })`, the appended composite-index entries referenced `t.organizationId, t.deletedAt` — `t` undefined inside the arrow scope, `ReferenceError` at module load. Fixed in `apps/compiler/src/utils/auto-indexes.ts` by capturing and reusing the callback's parameter name.
495
+ - **Reserved-word action filename collision.** Action discovery walks `actions/*.ts` and emits `import <name> from './actions/<name>'`. A user filename of `import.ts`, `delete.ts`, `await.ts`, `export.ts`, etc. produced `import import from './actions/import';` — a SyntaxError on module load. Fixed in `apps/compiler/src/codegen/discovered-actions.ts` by aliasing reserved-word and invalid-identifier filenames to `__action_<sanitized>` bindings while preserving the public action key (route emitters use bracket notation, so reserved-word keys are fine in the lookup map).
496
+
497
+ ## v0.29.0 — May 19, 2026
498
+
499
+ ### Opt-in `id` auto-injection (`compiler.injectId: 'auto'`)
500
+
501
+ Quickback's generated CRUD routes, FK extractor, relationship resolver, and `/:id` mount points all assume every feature table has an `id` primary key column. Authoring a table without one — common when porting an existing schema, or when a domain genuinely uses a compound or non-`id` PK — produced silent failures: routes that 404, batch operations that targeted the wrong rows, FK lookups that returned empty.
502
+
503
+ v0.29 adds an opt-in flag that auto-injects an `id` column into every feature table that doesn't already declare one. Same mechanism as the existing `createdAt`/`modifiedAt` injection — early-pass, idempotent, dialect-aware.
504
+
505
+ ```ts
506
+ // quickback.config.ts
507
+ compiler: {
508
+ injectId: 'auto', // off by default; opt in per project
509
+ }
510
+ ```
511
+
512
+ When `'auto'`:
513
+ - Tables with no `.primaryKey()` declared get `id: text("id").primaryKey().$defaultFn(() => createId())` (or the matching shape for `dbConfig.generateId` — `serial`, `uuid`, `prefixed`).
514
+ - Tables that already declare an `id` column (in any shape) are no-op — the injector is idempotent.
515
+ - Tables with a `.primaryKey()` on a non-`id` column raise a clear compile error that names the offending column and points at the v0.30 follow-up which will rewrite custom PKs to unique indexes automatically. v0.29 surfaces the conflict; v0.30 fixes it.
516
+
517
+ Default stays `false` so existing projects don't get migration churn. Opt in when you want to lean on every-table-has-id semantics across your schema.
518
+
519
+ ### Why this is opt-in (and what v0.30 changes)
520
+
521
+ The "every table has `id`" assumption is load-bearing across 68+ sites in the compiler — every CRUD emitter, the FK regex (`.references(() => target.id)`), the relationship resolver hydration block, the `/:id` route mounts. v0.29 only injects the column; v0.30 will close the remaining gaps:
522
+
523
+ - FK extraction migrates from `.id` regex to schema-aware metadata lookup, so tables with non-`id` PKs participate in FK display + relationship resolution.
524
+ - The PK→unique-index rewrite lands — tables with explicit non-`id` PKs auto-keep their uniqueness as a constraint while gaining the auto-injected `id`.
525
+ - The flag flips to default-on; opting out becomes the rare path.
526
+
527
+ v0.29 ships the foundation so projects can opt in today without waiting for the full structural pass.
528
+
529
+ ## v0.28.0 — May 19, 2026
530
+
531
+ ### INTERNAL pseudo-role: server-only schemas, unforgeable from HTTP
532
+
533
+ v0.27 had five pseudo-roles — `PUBLIC`, `AUTHENTICATED`, `USER`, `ADMIN`, `SYSADMIN` — and one structural gap: there was no way to mark a schema as "the server enumerates this; no user-facing route should ever read across tenants." Push subscriptions, personal access tokens, OAuth tokens, broadcast job tables — anywhere the server needs full visibility but users should only see their own row. The workaround was `firewall: { exception: true }` plus an out-of-band convention, which left auth on the schema looking incidental.
534
+
535
+ v0.28 adds **`INTERNAL`** as the sixth pseudo-role. Schemas with `roles: ['INTERNAL']` are reachable only by `AppContext` values where `ctx.internal === true` — a flag the HTTP auth middleware **never** sets. No session, JWT, header, query parameter, or body field populates it. The flag is reserved for compiler-emitted server-internal entry points (queue consumers, cron workers, server-side helpers that bypass HTTP entirely).
536
+
537
+ ```ts
538
+ // features/comms/push-subscriptions.ts
539
+ export default defineTable(push_subscriptions, {
540
+ firewall: [{ field: 'ownerId', equals: 'ctx.userId' }],
541
+ // User reads their own subscriptions via the standard CRUD route.
542
+ read: { access: { roles: ['USER'] } },
543
+ // Server enumerates ALL subscriptions for a broadcast — INTERNAL only.
544
+ crud: {
545
+ delete: { access: { roles: ['INTERNAL'] } },
546
+ },
547
+ });
548
+ ```
549
+
550
+ The split-surface pattern is the recommended shape: a user-facing access node uses `USER` / `AUTHENTICATED` / a real role; a server-only access node uses `INTERNAL`. Mixing INTERNAL with a user-facing pseudo-role on the **same** access node is a compile error — it almost always means the developer is confused about which side of the trust boundary they're on. The error names the cohabiting markers explicitly and points at the fix (split into separate access blocks).
551
+
552
+ The runtime stamping (queue consumer ctx, cron worker ctx) lands in a follow-up; v0.28 ships the declarative surface so projects can mark schemas accurately today. Until the stamping ships, server-internal code uses `unsafeDb` to enumerate INTERNAL surfaces — the security guarantee is in place because no HTTP-derived context can ever carry `ctx.internal === true`.
553
+
554
+ ### Reserved-name fix: SYSADMIN and INTERNAL added to ALWAYS_RESERVED
555
+
556
+ `SYSADMIN` was previously omitted from the `ALWAYS_RESERVED` set in `authz-schema.ts`. The runtime validator rejected `roles: ['SYSADMIN']` when `cms.sysadmin: true` wasn't set, but the **shadow-declaration path** — user code writing `authz.roles.SYSADMIN: { roles: [...] }` to silently change the pseudo-role's meaning — wasn't blocked. v0.28 closes that gap by adding both `SYSADMIN` and `INTERNAL` to the unconditionally-reserved set.
557
+
558
+ ### Per-table OWNER_SCOPE_RULES: explicit owner predicates no longer over-scope
559
+
560
+ When a user declared a non-canonical owner predicate on one table — e.g. `firewall: [{ field: 'linkedUserId', equals: 'ctx.userId' }]` — that column got promoted into the **project-global** `OWNER_SCOPE_RULES` list. Any other table in the project that happened to have a `linkedUserId` column (even as a plain FK reference, not for scoping) had the same `WHERE linkedUserId = ctx.userId` injected on every read, update, and delete. Silent over-scoping that surfaced only when a query returned the wrong rows.
561
+
562
+ v0.28 narrows the global list to the **canonical owner column** — the one matching `authDefaults.owner.column` (default `ownerId`). Explicit predicates on custom-named columns are honored on their declaring table via that table's own `buildFirewallConditions` helper, but stay per-table. Reads on other tables with the same column name are unaffected.
563
+
564
+ ```ts
565
+ // Before v0.28: linkedUserId on `comments` ALSO got the WHERE
566
+ // because `event_organizers` declared an explicit owner predicate.
567
+ export default defineTable(event_organizers, {
568
+ firewall: [{ field: 'linkedUserId', equals: 'ctx.userId' }],
569
+ });
570
+ export default defineTable(comments, {
571
+ // comments.linkedUserId is just an FK reference; we don't want it scoped.
572
+ firewall: [{ field: 'eventId', equals: 'ctx.activeOrgId' }],
573
+ });
574
+ ```
575
+
576
+ In v0.28, `event_organizers` queries get the per-table `linkedUserId = ctx.userId` predicate as before; `comments` queries are no longer mis-scoped.
577
+
578
+ If you genuinely want the same column to scope multiple tables (rare), declare the explicit firewall predicate on each table. The implicit "every table with this column gets scoped" behavior was the bug — explicit-per-table is the cure.
579
+
580
+ ## v0.27.0 — May 19, 2026
581
+
582
+ ### Narrow `ctx.<exposeAs>` typing for namespace-scoped actions
583
+
584
+ Since v0.23 the namespace middleware has hydrated `ctx.<exposeAs>` with the loaded resource row before each action runs. The static type of that field stayed `any` — runtime safety was solid, but autocomplete and typo-catching were missed opportunities.
585
+
586
+ v0.27 ships the second half: one **per-namespace `defineAction` helper** emitted alongside the standard one. Importing from the narrowed helper retypes `ctx.<exposeAs>` inside `execute({ ctx })` to the loaded row's `$inferSelect` shape. Nothing about discovery, routing, or runtime behavior changes — this is purely TypeScript ergonomics.
587
+
588
+ ```ts title="features/feeds/actions/feed-moments.ts"
589
+ // Before — ctx.event is `any`
590
+ import { defineAction } from '../.quickback/define-action';
591
+
592
+ // After — ctx.event is `typeof events.$inferSelect`
593
+ import { defineAction } from '../.quickback/define-action.event-scope';
594
+
595
+ export default defineAction({
596
+ path: '/event/:eventId/feed-moments',
597
+ method: 'POST',
598
+ input: z.object({ body: z.string() }),
599
+ access: { roles: ['attendee'] },
600
+ async execute({ ctx, input }) {
601
+ ctx.event.id // ✓ string, autocomplete works
602
+ ctx.event.startsAt // ✓ Date
603
+ ctx.event.idd // ✗ TS2339 — typo caught at compile time
604
+ },
605
+ });
606
+ ```
607
+
608
+ #### Where the file lives
609
+
610
+ The compiler emits one narrowed helper per `(feature, namespace)` pair where the feature owns at least one action whose `path:` falls under the namespace prefix. Filename is `define-action.<kebab(namespaceName)>.ts` (`eventScope` → `define-action.event-scope.ts`), sibling to the standard `define-action.ts`:
611
+
612
+ ```text
613
+ src/features/feeds/.quickback/
614
+ ├── define-action.ts # generic — standard fallback
615
+ └── define-action.event-scope.ts # ctx.event narrowed
616
+ ```
617
+
618
+ A feature contributing to multiple namespaces gets one helper per namespace. Each action picks the import that matches its path.
619
+
620
+ #### Opt-in, no breaking change
621
+
622
+ Actions that keep their existing `import { defineAction } from '../.quickback/define-action'` continue to compile unchanged. The `AppContext` index signature still admits `ctx.event` at type `any`; runtime hydration is unaffected. Flip imports per action at your own pace.
623
+
624
+ #### Compile-time advisory
625
+
626
+ When `quickback compile` sees a namespace-scoped action still importing the generic helper, it logs a one-line `[quickback:typing]` advisory pointing at the narrowed path:
627
+
628
+ ```text
629
+ [quickback:typing] action "feedMoments" in feature "feeds" lives under
630
+ namespace "eventScope" — switch its import to
631
+ `../.quickback/define-action.event-scope` for narrow ctx.<exposeAs> typing.
632
+ (Runtime behavior is unchanged; the narrowed helper only refines TS types.)
633
+ ```
634
+
635
+ Non-blocking — same family as `[quickback:authz]`.
636
+
637
+ #### Side fix
638
+
639
+ Repaired a latent off-by-one in the inlined `AppContext` import path that landed in the v0.26 helper prelude but hadn't been exercised against a recompiled project yet (`"../../lib/types"` → `"../../../lib/types"`). New compiles produce a helper whose `AppContext` import actually resolves.
640
+
641
+ #### Out of scope
642
+
643
+ Non-namespace standalone actions with relationship-based access keep their existing `(ctx.event as typeof events.$inferSelect)` body cast. Same per-relationship helper pattern would apply if the demand surfaces — defer until requested.
644
+
645
+ ## v0.26.0 — May 19, 2026
646
+
647
+ ### Bulk-grant namespace lanes: org admins and team members in one line
648
+
649
+ v0.25 widened `via:` to accept an array of relationship lanes — attendeeOf OR organizerOf, first match wins. That covers per-row authorization paths. v0.26 adds the missing piece: **bulk-grant lanes** for the "you work here, so you see everything in your scope" case. Org admins, team members, and other tenant-scoped staff no longer need a per-event relationship row to be authorized for a namespace.
650
+
651
+ ```ts
652
+ authz: {
653
+ namespaces: {
654
+ eventScope: {
655
+ prefix: '/event/:eventId',
656
+ via: [
657
+ 'attendeeOf', // per-event relationship
658
+ 'organizerOf', // per-event relationship
659
+ { roles: ['admin', 'owner'] }, // org-role bulk grant
660
+ { team: true }, // active-team-membership bulk grant
661
+ ],
662
+ },
663
+ },
664
+ }
665
+ ```
666
+
667
+ Lanes resolve in declaration order, first match wins. Per-row relationships and bulk-grant guards compose freely.
668
+
669
+ #### What each bulk-grant lane does
670
+
671
+ - **`{ roles: [...] }`** — passes when the caller's BA org-role for the namespace's loaded resource includes any listed role. The check is in-memory and short-circuits the relationship loop entirely. The loads-table firewall (scoped by `ctx.activeOrgId`) does the tenant isolation; this lane just adds the role precondition on top.
672
+ - **`{ team: true }`** — passes when `ctx.activeTeamId` is set. The loads-table firewall (which scopes by team for team-scoped tables) does the actual `events.teamId === ctx.activeTeamId` match during hydration. If the firewall returns no row, the request gets a contextual 404 explaining the row isn't visible to the current session — same ambiguous-by-design phrasing the firewall has always used to prevent cross-tenant ID probing.
673
+
674
+ #### Why this matters
675
+
676
+ Until v0.26, the only way to authorize an org admin for a namespace was to write `access.or: [{ via: 'attendeeOf' }, { roles: ['admin', 'owner'] }]` on every individual action under it. That OR-arm shim worked but defeated the purpose of namespaces — the whole point of hoisting the gate was to write the auth rule once. Now you do.
677
+
678
+ #### Rich deny payloads
679
+
680
+ The 403 response when every lane misses lists every path the caller could have taken — relationship names, role names, and `"team-membership"` for `{ team: true }` lanes — in the `required` field. A developer hitting an unexpected 403 sees the full set of authorization options they need to satisfy, not a generic "Insufficient permissions" wall.
681
+
682
+ The 404 from hydration (when the loads-table firewall filters the request out) now includes a hint explaining that the row may exist out of scope, and a `details` field with the resource name and key, so a developer working in their own environment has enough to debug.
683
+
684
+ #### Compile-time guards
685
+
686
+ - **Pure bulk-grant namespaces** (no relationship lane at all) are accepted as long as `loads:` + `exposeAs:` are declared directly on the namespace. With at least one relationship lane present, those fields are inherited from the relationship — declare them on the namespace itself only when no relationship lane is available to anchor hydration.
687
+ - **Heterogeneous `loads:` between relationship lanes is rejected** — `ctx.<exposeAs>` must always hydrate the same table regardless of which lane matched.
688
+ - **`namespace.loads` that disagrees with the inherited value is rejected** with a clear "drop one or align the other" message.
689
+
690
+ ## v0.25.0 — May 19, 2026
691
+
692
+ ### Multi-lane namespace gates: more than one way to be authorized
693
+
694
+ v0.24 lets you hoist a namespace gate to the project level via `authz.namespaces.<name>.via: 'attendeeOf'` — one relationship-resolver middleware running once per request for every action under `/event/:eventId/*`. That works when there's exactly one way to be authorized for the resource. It breaks the moment you have **two**: an attendee row and a per-event organizer row, say. The shim today is to OR the second check inside every individual action's `access` block, which puts you back to writing the gate over and over.
695
+
696
+ v0.25 widens `via:` to accept an array of relationship lanes. The middleware tries each in declaration order, and the first one whose subject row matches authorizes the request and hydrates `ctx.<exposeAs>`.
697
+
698
+ ```ts
699
+ authz: {
700
+ relationships: {
701
+ attendeeOf: {
702
+ from: 'guests',
703
+ subject: { column: 'linkedUserId', equals: 'ctx.userId' },
704
+ resource: { column: 'eventId' },
705
+ where: { status: 'confirmed' },
706
+ loads: 'events',
707
+ exposeAs: 'event',
708
+ },
709
+ // Per-event named organizers. The subject can be a user OUTSIDE
710
+ // the event's organization — e.g. a freelance event manager.
711
+ organizerOf: {
712
+ from: 'eventOrganizers',
713
+ subject: { column: 'linkedUserId', equals: 'ctx.userId' },
714
+ resource: { column: 'eventId' },
715
+ loads: 'events',
716
+ exposeAs: 'event',
717
+ },
718
+ },
719
+ namespaces: {
720
+ eventScope: {
721
+ prefix: '/event/:eventId',
722
+ via: ['attendeeOf', 'organizerOf'], // first match wins
723
+ },
724
+ },
725
+ }
726
+ ```
727
+
728
+ The thing this actually unlocks isn't "two checks instead of one." It's **per-event grants for users outside the owning organization** — external co-organizers, freelance event managers, partner staff. They don't need a `member` row in the event's org; they just need a row in `event_organizers` for that specific event. The horizontal axis (org / team membership) stays for "staff at this company"; the new vertical axis (per-event relationships) handles "specifically connected to this event," regardless of payroll.
729
+
730
+ #### Backward compatible
731
+
732
+ The string form keeps working — `via: 'attendeeOf'` is sugar for `via: ['attendeeOf']`. No existing namespaces break; opt into multi-lane by switching to the array form when you actually need it.
733
+
734
+ #### Compile-time guards
735
+
736
+ The validator rejects three things at parse time:
737
+
738
+ - **Undeclared lane names** — every entry in the array must resolve to an `authz.relationships[*]` declaration.
739
+ - **Lanes that disagree on `loads:` or `exposeAs:`** — if attendeeOf loads `events` as `ctx.event` and organizerOf loads `agendaItems` as `ctx.agendaItem`, downstream handlers can't predict what's in `ctx.<exposeAs>`. Lanes in one namespace must hydrate the same shape.
740
+ - **Empty arrays** — at least one lane is required (otherwise the namespace gate is meaningless).
741
+
742
+ #### Follow-up: v0.26 bulk-grant lanes (shipped same day — see above)
743
+
744
+ The full 4-lane shape adds heterogeneous `via:` arrays accepting `{ roles: ['admin', 'owner'] }` and `{ team: true }` entries, so org admins and team members get the gate without writing relationship rows. v0.25 was the foundation; [v0.26](#v0260--may-19-2026) lifted the existing per-action `access.or: [..., { roles: [...] }]` shim into the namespace and landed same-day.
745
+
3
746
  ## v0.24.0 — May 19, 2026
4
747
 
5
748
  ### Cross-feature namespaces: one hoisted gate, many features
@@ -78,6 +821,21 @@ Zero breaking changes. Nothing in v0.23 needs to change for v0.24 to land. The n
78
821
 
79
822
  The harvester runs after Zod schema validation but before route generation, so unused or misconfigured namespaces surface immediately as errors or warnings rather than as silently-broken routes.
80
823
 
824
+ #### Fixes shipped alongside
825
+
826
+ The first two were load-bearing for v0.23 namespaces to actually work — projects upgrading from a pre-fix v0.23 will see crashes/compile errors disappear on the v0.24 recompile.
827
+
828
+ - **No more dual emission of namespace-claimed standalone routes.** Pre-fix, an action with a cross-feature path like `/event/:eventId/agenda/list-my-agenda` emitted into both `src/index.ts` (without the namespace resolver) and the synthetic file (with it). The plain root copy in `src/index.ts` won every URL match and `ctx.<exposeAs>` was never hydrated — every request 500'd with `Cannot read properties of undefined (reading 'id')`. `extractStandaloneActions` now skips namespace-claimed actions; the synthetic namespace file is the sole emission.
829
+ - **Stripped-path validator no longer rejects namespace-claimed actions.** The synthetic file mounts at `/api/v1${namespace.prefix}` and strips the prefix from each action's local path. The per-action relationship-resolver was validating the *stripped* path for `:eventId`, finding nothing, and rejecting every namespace-mounted action with "action's surface exposes neither a path parameter ':eventId' nor an input field 'eventId'". `planRelationshipResolver` now receives the namespace's `via` and skips its surface-key check entirely — the hoisted middleware is the single source of truth.
830
+ - **Broadcaster DO migration tag consistent across `realtime.mode`.** Inline-mode emission was already going through `qb-do-${className}` + `new_sqlite_classes`. Separate-mode was still hardcoded `tag = "v1"` + `new_classes`, so flipping `realtime: { mode }` produced different migration tags for the same DO class and tripped CF error 10074 ("class already depended on") on cross-mode deploys. Both modes now emit `tag = "qb-do-Broadcaster"` + `new_sqlite_classes`.
831
+ - **Batch handler id arrays type-derive from the input parser.** Pre-fix, `validIds`, `recordMap`, and `validEntries` in bulk-delete / bulk-update / bulk-upsert were hardcoded `string[]` / `Map<string, any>` even when the table's PK column was `integer("id")` — 274× TS2769 in projects mixing string and integer PKs. Handlers now declare `type IdT = typeof ids[number]` (or `typeof records[number]['id']`) and use it for the local id types. Strings stay strings, integers stay integers, no emitter knowledge of the PK column type required.
832
+ - **`ctx` in action handlers is now `AppContext`, not `any`.** Both `StandaloneExecuteParams.ctx` and `RecordExecuteParams.ctx` in the generated `<feature>/.quickback/define-action.ts` are typed `AppContext`. AppContext keeps its `[key: string]: any` index signature so hydrated namespace keys (`ctx.event`, `ctx.<exposeAs>`) stay accessible without TS2339; named fields (`userId`, `activeOrgId`, `roles`, `authenticated`, `user`) get autocomplete and type-checking. Cleared ~49× TS2339 in generated projects.
833
+ - **`c.get('ctx') as AppContext` in every emitted route handler.** Pre-fix, `const ctx = c.get('ctx')` returned `any`, so `ctx.roles?.some(r => …)` left the callback parameter implicitly `any` — 16× TS7006. Now `ctx.roles` is `string[] | undefined`, `r` is `string`, no callback annotation needed.
834
+
835
+ #### Deferred (tracked, not blocking)
836
+
837
+ - Per-namespace narrow typing of `ctx.<exposeAs>` (so `ctx.event` resolves to `typeof events.$inferSelect` instead of `any`). The compiler emits a typed cast at the `execute()` call site in the routes file today, which type-checks the call but not the handler body. Full narrow typing requires per-namespace helper emission (one `define-action.<namespace>.ts` per namespace, or a generic param threading through the action config). Tracked separately.
838
+
81
839
  ---
82
840
 
83
841
  ## v0.23.0 — May 19, 2026