@ultimat3/cli 31.48.0 → 31.49.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 (260) hide show
  1. package/CLAUDE.md +30 -23
  2. package/README.md +96 -4
  3. package/package.json +29 -29
  4. package/src/api-registration.ts +28 -14
  5. package/src/app-load.ts +6 -1
  6. package/src/app-root.ts +7 -1
  7. package/src/clean-services.ts +142 -0
  8. package/src/cmd-auth.ts +3 -0
  9. package/src/cmd-clean-spec.ts +10 -3
  10. package/src/cmd-clean.ts +23 -9
  11. package/src/cmd-db-backfill.ts +6 -0
  12. package/src/cmd-db-branch.ts +10 -4
  13. package/src/cmd-db-recount.ts +5 -12
  14. package/src/cmd-db-rollback.ts +77 -0
  15. package/src/cmd-db-spec.ts +18 -2
  16. package/src/cmd-db-status.ts +5 -10
  17. package/src/cmd-db.ts +105 -33
  18. package/src/cmd-deploy-verify.ts +14 -6
  19. package/src/cmd-docs-topic.ts +94 -0
  20. package/src/cmd-docs.ts +15 -1
  21. package/src/cmd-doctor.ts +109 -41
  22. package/src/cmd-drill.ts +80 -18
  23. package/src/cmd-env.ts +30 -8
  24. package/src/cmd-errors-app.ts +63 -0
  25. package/src/cmd-errors.ts +50 -14
  26. package/src/cmd-generate.ts +17 -4
  27. package/src/cmd-heavy-spec.ts +9 -1
  28. package/src/cmd-heavy.ts +111 -27
  29. package/src/cmd-jobs.ts +27 -1
  30. package/src/cmd-merge-driver-spec.ts +12 -0
  31. package/src/cmd-merge-driver.ts +95 -0
  32. package/src/cmd-new.ts +23 -3
  33. package/src/cmd-policy-spec.ts +9 -1
  34. package/src/cmd-policy.ts +72 -17
  35. package/src/cmd-stop.ts +18 -4
  36. package/src/cmd-tasks-run.ts +87 -0
  37. package/src/cmd-tasks-spec.ts +10 -3
  38. package/src/cmd-tasks.ts +8 -5
  39. package/src/cmd-test.ts +2 -1
  40. package/src/cmd-upgrade-spec.ts +8 -1
  41. package/src/cmd-upgrade.ts +15 -1
  42. package/src/cmd-verify.ts +9 -41
  43. package/src/codemods/agents-doc-row.ts +73 -0
  44. package/src/codemods/define-error-leaf.ts +37 -12
  45. package/src/codemods/docs-many-agents.ts +11 -15
  46. package/src/codemods/docs-worker-commands.ts +26 -0
  47. package/src/codemods/index.ts +4 -0
  48. package/src/codemods/merge-drivers.ts +66 -0
  49. package/src/command.ts +3 -0
  50. package/src/db-applied-edits.ts +117 -0
  51. package/src/db-dev-wire.ts +18 -0
  52. package/src/db-diagnostics.ts +5 -10
  53. package/src/db-generate.ts +82 -7
  54. package/src/db-migrate-pass.ts +51 -0
  55. package/src/db-migrate-through-dev.ts +209 -0
  56. package/src/db-rollback-consent.ts +128 -0
  57. package/src/db-rollback-pass.ts +76 -0
  58. package/src/db-seed-generate.ts +5 -1
  59. package/src/db-seed.ts +7 -1
  60. package/src/deploy-verify-findings.ts +3 -0
  61. package/src/deploy-verify-grade.ts +3 -0
  62. package/src/deploy-verify-processes.ts +32 -0
  63. package/src/dev-boot.ts +3 -0
  64. package/src/dev-db-migrate.ts +155 -0
  65. package/src/dev-db-rollback.ts +33 -0
  66. package/src/dev-db-settled.ts +22 -0
  67. package/src/dev-lock-errors.ts +78 -0
  68. package/src/dev-lock-holder-dir.ts +64 -0
  69. package/src/dev-lock-live.ts +44 -0
  70. package/src/dev-lock.ts +59 -84
  71. package/src/dev-policy.ts +11 -8
  72. package/src/dev-rebuild-schema.ts +116 -13
  73. package/src/dev-rebuild.ts +13 -4
  74. package/src/dev-route-table.ts +7 -0
  75. package/src/dispatch.ts +21 -1
  76. package/src/doctor-api-listing.ts +114 -0
  77. package/src/doctor-guarded.ts +41 -0
  78. package/src/doctor-port.ts +90 -17
  79. package/src/doctor-probe.ts +36 -5
  80. package/src/doctor-processes-probe.ts +127 -0
  81. package/src/doctor-processes.ts +136 -0
  82. package/src/doctor-warnings.ts +17 -0
  83. package/src/error-codes-agents.ts +35 -0
  84. package/src/error-codes-processes.ts +30 -0
  85. package/src/error-codes-tooling.ts +2 -0
  86. package/src/error-codes.ts +12 -13
  87. package/src/errors-suite.ts +27 -0
  88. package/src/errors.ts +18 -22
  89. package/src/exercise-registration.ts +4 -3
  90. package/src/framework-env.ts +7 -3
  91. package/src/generate-files.ts +1 -0
  92. package/src/generate-grant-findings.ts +7 -5
  93. package/src/generate-grants.ts +9 -8
  94. package/src/generate-kinds.ts +30 -6
  95. package/src/generate-roles-file.ts +30 -0
  96. package/src/generate-slice-policy.ts +3 -3
  97. package/src/guards.ts +2 -2
  98. package/src/heavy-env.ts +2 -0
  99. package/src/heavy-errors.ts +18 -0
  100. package/src/heavy-holders.ts +78 -0
  101. package/src/heavy-ledger.ts +56 -14
  102. package/src/heavy-pressure.ts +104 -0
  103. package/src/heavy.ts +31 -13
  104. package/src/i18n-registration.ts +22 -2
  105. package/src/island-harness.ts +2 -2
  106. package/src/job-budget.ts +4 -2
  107. package/src/job-registration.ts +64 -8
  108. package/src/jobs-queue-known.ts +43 -0
  109. package/src/mcp-errors-agents.ts +20 -0
  110. package/src/mcp-errors-doctor.ts +27 -0
  111. package/src/mcp-errors-processes.ts +23 -0
  112. package/src/mcp-errors.ts +15 -29
  113. package/src/mcp-host.ts +2 -2
  114. package/src/merge-driver-catalog.ts +58 -0
  115. package/src/merge-driver-config.ts +43 -0
  116. package/src/merge-driver-lines.ts +140 -0
  117. package/src/merge-state.ts +105 -0
  118. package/src/messages-db.ts +22 -1
  119. package/src/messages-processes.ts +13 -0
  120. package/src/messages-upgrade.ts +6 -0
  121. package/src/messages.ts +54 -4
  122. package/src/output-findings.ts +48 -21
  123. package/src/parse.ts +37 -6
  124. package/src/policy-facts.ts +38 -21
  125. package/src/policy-row.ts +99 -0
  126. package/src/port-pair-free.ts +28 -0
  127. package/src/registry-lines.ts +110 -0
  128. package/src/registry.ts +2 -0
  129. package/src/retain-sweep.ts +1 -1
  130. package/src/role-replicator.ts +4 -1
  131. package/src/role-select.ts +86 -0
  132. package/src/role-start.ts +13 -55
  133. package/src/role-sync.ts +10 -5
  134. package/src/runtime-cache-frame.ts +46 -0
  135. package/src/runtime-cache-ttl.ts +23 -0
  136. package/src/runtime-cache.ts +33 -16
  137. package/src/runtime-database-ssl.ts +84 -0
  138. package/src/runtime-idempotency-scope.ts +16 -2
  139. package/src/runtime-jobs-share.ts +52 -0
  140. package/src/runtime-jobs.ts +43 -12
  141. package/src/runtime-queue.ts +18 -3
  142. package/src/runtime-services.ts +8 -1
  143. package/src/schema-drift.ts +19 -2
  144. package/src/schema-dump-drift.ts +4 -1
  145. package/src/serve-boot-probe.ts +30 -2
  146. package/src/serve-boot.ts +11 -1
  147. package/src/serve-env.ts +39 -3
  148. package/src/serve.ts +61 -10
  149. package/src/stop-run-start.ts +12 -0
  150. package/src/supervise-boot.ts +61 -0
  151. package/src/supervise-cgroup.ts +84 -0
  152. package/src/supervise-child.ts +206 -0
  153. package/src/supervise-count.ts +244 -0
  154. package/src/supervise-errors.ts +83 -0
  155. package/src/supervise-facts.ts +40 -0
  156. package/src/supervise-messages.ts +84 -0
  157. package/src/supervise-policy.ts +46 -0
  158. package/src/supervise-pool.ts +10 -0
  159. package/src/supervise-probe.ts +158 -0
  160. package/src/supervise-run.ts +54 -0
  161. package/src/supervise.ts +383 -0
  162. package/src/templates/generate-purge.ts +6 -6
  163. package/src/templates/guard-animated-layout-property.ts +2 -2
  164. package/src/templates/guard-bare-error.ts +1 -1
  165. package/src/templates/guard-error-declared.ts +2 -2
  166. package/src/templates/guard-focus-visible.ts +1 -1
  167. package/src/templates/guard-image-dimensions.ts +2 -2
  168. package/src/templates/guard-island-mount-clears.ts +1 -1
  169. package/src/templates/guard-native-confirm.ts +1 -1
  170. package/src/templates/guard-raw-breakpoint.ts +2 -2
  171. package/src/templates/guard-raw-colour.ts +2 -2
  172. package/src/templates/guard-raw-fetch.ts +1 -1
  173. package/src/templates/guard-raw-interval.ts +1 -1
  174. package/src/templates/guard-raw-length.ts +3 -3
  175. package/src/templates/guard-raw-motion.ts +1 -1
  176. package/src/templates/guard-raw-shadow.ts +1 -1
  177. package/src/templates/guard-raw-z-index.ts +1 -1
  178. package/src/templates/guard-released-forms.ts +54 -8
  179. package/src/templates/guard-repo-await-in-loop.ts +1 -1
  180. package/src/templates/guard-repo-raw-sql.ts +4 -4
  181. package/src/templates/guard-repo-unbounded.ts +1 -1
  182. package/src/templates/guard-runtime-pin.ts +1 -1
  183. package/src/templates/guard-semantic-interactive.ts +2 -2
  184. package/src/templates/guard-unbounded-fanout.ts +1 -1
  185. package/src/templates/guard-undeclared-custom-property.ts +3 -3
  186. package/src/templates/guard-undefined-style-class.ts +3 -3
  187. package/src/templates/guard-unzoned-date.ts +3 -3
  188. package/src/templates/query-slice.ts +82 -0
  189. package/src/templates/query.ts +76 -30
  190. package/src/templates/resource-page.ts +3 -2
  191. package/src/templates/scaffold-bin.ts +2 -0
  192. package/src/templates/scaffold-claude-commands.ts +6 -0
  193. package/src/templates/scaffold-claude.ts +4 -4
  194. package/src/templates/scaffold-container-compose.ts +47 -7
  195. package/src/templates/scaffold-docs.ts +7 -3
  196. package/src/templates/scaffold-gitattributes.ts +18 -1
  197. package/src/templates/scaffold-helm-templates.ts +9 -0
  198. package/src/templates/scaffold-repo.ts +4 -1
  199. package/src/templates/scaffold-test-services.ts +33 -11
  200. package/src/templates/shapes/offline.ts +0 -7
  201. package/src/templates/shapes/realtime.ts +2 -6
  202. package/src/templates/sign-in-action-tests.ts +6 -4
  203. package/src/templates/sign-in-challenge.ts +62 -0
  204. package/src/templates/sign-in-oidc-mfa.ts +31 -0
  205. package/src/templates/sign-in-oidc.ts +11 -3
  206. package/src/templates/sign-in-password.ts +18 -56
  207. package/src/test-shards.ts +114 -34
  208. package/src/test-verdict.ts +79 -0
  209. package/src/test-workers.ts +15 -0
  210. package/src/upgrade-gate-codemods.ts +5 -3
  211. package/src/upgrade-gate.ts +19 -1
  212. package/src/upgrade-merge-drivers.ts +25 -0
  213. package/src/upgrade-report.ts +18 -4
  214. package/src/upgrade-scope.ts +62 -0
  215. package/src/verify-checks.ts +2 -8
  216. package/src/verify-coverage-run.ts +4 -1
  217. package/src/verify-live.ts +38 -14
  218. package/src/verify-only.ts +67 -0
  219. package/src/verify-progress.ts +7 -3
  220. package/src/verify-run.ts +20 -2
  221. package/src/verify-services-stack.ts +165 -0
  222. package/src/verify-services.ts +84 -2
  223. package/src/verify-test-run.ts +6 -7
  224. package/src/verify-tests.ts +8 -2
  225. package/src/verify-typecheck.ts +25 -2
  226. package/wiki/Actions.md +2 -1
  227. package/wiki/Admin-Dashboard.md +2 -2
  228. package/wiki/Agents.md +5 -5
  229. package/wiki/Auth.md +15 -5
  230. package/wiki/Bare-VM.md +1 -1
  231. package/wiki/CI-Parallel-Gate.md +2 -1
  232. package/wiki/CLI-Reference.md +107 -40
  233. package/wiki/Caching-And-Invalidation.md +1 -1
  234. package/wiki/Client-Navigation.md +1 -1
  235. package/wiki/Configuration.md +10 -9
  236. package/wiki/Deployment.md +44 -4
  237. package/wiki/Entities-And-Migrations.md +5 -1
  238. package/wiki/FAQ.md +1 -1
  239. package/wiki/Getting-Started.md +2 -2
  240. package/wiki/Home.md +1 -1
  241. package/wiki/I18n.md +5 -3
  242. package/wiki/Installation.md +12 -11
  243. package/wiki/Jobs-And-Workflows.md +24 -4
  244. package/wiki/Known-Gaps.md +1 -1
  245. package/wiki/MCP-And-AI.md +8 -5
  246. package/wiki/Many-Agents.md +69 -2
  247. package/wiki/Migrations-And-Backfills.md +18 -0
  248. package/wiki/Notify.md +1 -1
  249. package/wiki/Observability.md +13 -0
  250. package/wiki/Queries-And-Live-Queries.md +2 -2
  251. package/wiki/Realtime.md +10 -1
  252. package/wiki/Routes-And-Render-Modes.md +1 -1
  253. package/wiki/Scheduled-Tasks.md +4 -1
  254. package/wiki/Testing.md +7 -4
  255. package/wiki/Timezones-And-Dates.md +5 -1
  256. package/wiki/Troubleshooting.md +1 -0
  257. package/wiki/Tutorial-01-First-App.md +3 -3
  258. package/wiki/Tutorial-02-First-Feature.md +1 -1
  259. package/wiki/Tutorial-03-Auth-And-Admin.md +7 -6
  260. package/wiki/Upgrading.md +37 -0
@@ -32,7 +32,7 @@ x version # CLI version
32
32
  | `x dev` | all roles in one process: embedded services, sub-second reload, `/_x` mounted | shipped |
33
33
  | `x stop [--timeout 30s]` | stop this checkout's `x dev` (the pid its `.x/dev.lock` names, nothing else) and return once the next `x dev` can boot | shipped |
34
34
  | `x g <kind> <name>` | scaffold a primitive with its test | shipped |
35
- | `x db <sub>` | gen, migrate, reset, seed, branch, backfill, diagnostics | shipped |
35
+ | `x db <sub>` | gen, migrate, rollback, reset, seed, branch, backfill, diagnostics, recount, status | shipped |
36
36
  | `x verify [--only <step>[,<step>…] [--shard i/n [--timings f]] \| --changed [--base <ref>] [--dirty]] [--workers N] [--isolate]` · `x verify merge <part.json…>` · `x verify plan [--parts n]` | the gate — 21 steps, in this order: typecheck, lint, boundaries, filesize, package-shape, errors, unit, contract, live, job, exercise, e2e, eval, drift, contract-diff, budgets, seo, i18n, policy, manifest, roadmap. `--only <step>[,<step>…]` runs the named steps, in one process and in gate order, for an iteration loop and announces `NOT A GATE RUN` in the summary and in `--json` (`data.notAGateRun`, `data.only` — always a list), writing no floor file; an unknown name is refused with every valid name and the nearest match. **The gate is this command with no flag.** There is no `--skip` | shipped |
37
37
  | `x env [check\|example\|init]` | validate the process env against `envSchema`, regenerate `.env.example` from it, or write `.env.production` (`init --production`) | shipped |
38
38
  | `x secrets <sub>` | the committed encrypted secrets file: show, init, edit, set, rotate | shipped |
@@ -48,21 +48,21 @@ x version # CLI version
48
48
  | `x help` / `x version` | catalogue and version | shipped |
49
49
  | `x actions` / `x queries` / `x entities` | introspect the declaration registries | shipped |
50
50
  | `x jobs` | list, show, retry, cancel, remove and promote jobs; pause and resume a queue · `drain` was removed from the registry `As of 2026-11-15` ([Known gaps](Known-Gaps#open-by-decision)) | shipped |
51
- | `x tasks` | cron tasks, their timezone and their next run | shipped |
51
+ | `x tasks` | cron tasks, their timezone and their next run; fire one now | shipped |
52
52
  | `x policy` | which clause decided a permission, and why | shipped |
53
53
  | `x exercise [<name>] [--seed n\|random] [--shard i/n]` | run every action, query, job and route `load` once on generated rows, with no test written; the gate's `exercise` step | shipped |
54
54
  | `x drill [<name>] [--list] [--budget-ms n]` | the app's roles as real processes on real Postgres, Redis and NATS, each dependency faulted through a proxy, each role signalled, or every role started before `ROLE=migrate`, red on any framework contract that does not hold. Not a gate step: it needs the services | shipped |
55
55
  | `x i18n` | add, sync, check catalogs | shipped |
56
56
  | `x mail preview <id>` | render a mail's declared `preview` in every locale, nothing sent | shipped |
57
57
  | `x test <type>` | run one of the six test types, or the whole suite | shipped |
58
- | `x clean [--dry-run]` | remove what test runs leave behind: migrated test templates, `.x/cache`, stray `.x` folders, stale probe databases | shipped |
58
+ | `x clean [--dry-run] [--services]` | remove what test runs leave behind: migrated test templates, `.x/cache`, stray `.x` folders, stale probe databases; `--services` stops this checkout's test stack and lists the machine's others | shipped |
59
59
  | `x affected` | the workspaces a diff can have broken, transitively | shipped |
60
60
  | `x graph [--from <a> --to <b>]` · `x impact <file\|primitive\|entity>` | the app as one typed graph, each edge `declared`, `import` or `observed` · what an edit reaches | shipped |
61
61
  | `x client vendor <name>` · `x client customer --out <dir>` | one OpenAPI compiler, two clients: a third party's document into `apps/web/clients/<name>/` (`outbound()` + `t` schemas), or the app's own published document into a client with no framework import | shipped |
62
62
  | `x shot <route>` | photograph one route from a real browser, plus a `verdict.json` a picture cannot carry | shipped |
63
63
  | `x pr review\|resolve\|reply` | inline review threads — the ones `gh pr view --comments` does not show — plus every review verdict, every PR comment, and which review bots did not review | shipped |
64
64
  | `x ci` | the workflow runs for this branch, and the findings inside the failed step's log; `x ci tested`: whether a push reuses a green PR run | shipped |
65
- | `x errors explain <CODE>` | code → cause, fix, docs | shipped |
65
+ | `x errors explain <CODE>` | code → cause, fix, docs; inside an app, its own `defineError()` code → title, HTTP status and the declaring `file:line` | shipped |
66
66
  | `x docs "<question>"` | framework docs and this wiki, offline, from the install — the first lookup | shipped |
67
67
  | `x fix boundary <file>` | plan the minimal cut for an import that crossed a surface boundary (never rewrites) | shipped |
68
68
  | `x upgrade` | one major per run: exact pins, the Bun floor, `bun install`, the release's codemods, the gate, the section to read · `x upgrade codemods` | shipped |
@@ -72,7 +72,8 @@ x version # CLI version
72
72
  | `x cache graph\|bust <tag>\|clear` | the tag graph off the manifest (what each write evicts), a bust of one tag or every declared tag through the app's own tiers and bus · `stats` was removed `As of 2026-11-15` ([Known gaps](Known-Gaps#open-by-decision)) | shipped |
73
73
  | `x explain <query> [--input <json>] [--org <id>]` | one declared query run once on the dev database, every statement it sent planned by the `exercise` step's oracle | shipped |
74
74
  | `x profile <route> [--runs 20] [--top 10]` | a CPU profile of rendering one route in this process: the hottest functions, file and line | shipped |
75
- | `x heavy [status]` · `x heavy run [--label s] [--mb n] -- <command…>` | the machine's shared memory ledger: who runs, who is queued, load and memory; any command run inside one reservation, its exit code passed through | shipped |
75
+ | `x merge-driver install` · `x merge-driver run <base> <ours> <theirs> <path>` | installs the git merge drivers for this clone (a step of `bun run setup`); `run` is what git calls for a registry both branches changed. [Merging two features](Many-Agents#merging-two-features) | shipped |
76
+ | `x heavy [status]` · `x heavy run [--label s] [--mb n] [--max-wait s] -- <command…>` | the machine's shared memory ledger: who runs, who is queued, load and memory; any command run inside one reservation, its exit code passed through | shipped |
76
77
  | `x status [--url <origin>] [--samples n]` | the build each live worker runs (`x_job_workers`), and the build, status and role each sampled origin's `/readyz` answers | shipped |
77
78
 
78
79
  ## x new
@@ -225,6 +226,16 @@ stylesheet that names it with Sass `asset()`. Until 2026-09-27 only the edited r
225
226
  was re-imported (`?x-reload=<hash>`), and every component it imported stayed the cached one: `x dev`
226
227
  logged `reloaded` and rendered the old component until a restart.
227
228
 
229
+ **The database is part of the verdict, `As of 2026-11-19`.** While the migrations on disk are ahead
230
+ of the database `x dev` serves, or an applied one was edited since, its banner is `✗ dev ready`
231
+ (`ok: false` under `--json --once`) with `X_APP_MIGRATIONS_UNAPPLIED` (fix `x db migrate`; `x stop --json && x db migrate && x dev`
232
+ where this server cannot apply it) or `X_MIGRATION_CONFLICT`, on
233
+ `/_x` too; it still serves. `x db migrate` or `x db rollback` beside it is
234
+ applied by this dev server, and the finding clears with no restart. A schema finding appearing or
235
+ clearing (`X_DB_DRIFT` after `x db gen`) no longer restarts the child — an entity edit still does,
236
+ as a pinned module — so `x db gen "…" && x db migrate` runs against a server that is up; after it
237
+ the terminal prints an `hmr` line, not a fresh banner, and `/_x` holds the verdict.
238
+
228
239
  Without `--once` the process stays up until it is signalled. `Ctrl-C` runs the same three-phase
229
240
  drain a production `SIGTERM` runs — stop accepting, finish in-flight, close — and only then
230
241
  releases the embedded Postgres, the worker and the file watcher, so `.x/pgdata` is never left
@@ -295,7 +306,7 @@ replicator takes a slot on a shared database. With `DATABASE_URL` unset the embe
295
306
  serves no logical replication, so the role is refused, but `X_CLI_BAD_FLAG` now names the fix: set
296
307
  `DATABASE_URL` to a Postgres with `wal_level=logical`. With `DATABASE_URL` set, the role starts for
297
308
  real: advisory lock → `postgresChangeFeed()` → `changeFeedReplicator` → publish to the transport.
298
- Errors: `X_CLI_BAD_FLAG`, `X_PORT_IN_USE`, `X_ENV_MISSING`, `X_DB_DRIFT`.
309
+ Errors: `X_CLI_BAD_FLAG`, `X_PORT_IN_USE` (names the holder's pid and directory; its fix names a port pair that is free when asked), `X_ENV_MISSING`, `X_DB_DRIFT`.
299
310
 
300
311
  ## x stop
301
312
 
@@ -310,6 +321,7 @@ Ends **this checkout's** `x dev` and returns only once the next `x dev` there ca
310
321
  | a live `x dev` holds `.x/dev.lock` | SIGTERM to the pid the lock names, then wait for the pid to exit and the lock to clear | `{ stopped: true, pid, port, waitedMs, drained: true }` |
311
322
  | Windows | `kill` is TerminateProcess, so no drain runs; `x stop` clears the lock itself | `{ …, drained: false }` |
312
323
  | no lock, or a lock naming a dead pid | nothing is signalled, exit 0. A stale lock is left for the next `x dev`'s preflight to clear | `{ stopped: false }` |
324
+ | a lock naming a live pid that is not the `x dev` that wrote it (a reused pid) | nothing is signalled, exit 0; the lock is cleared, under the boot's own guard and only while it still holds the bytes judged. `x db reset`/`status`/`diagnostics`/`recount` treat such a lock as no holder anyway (`liveDevLockChecked`, `packages/cli/src/dev-lock-live.ts`). `As of 2026-11` | `{ stopped: false, stale: true }` |
313
325
  | the pid outlives `--timeout` | `X_DEV_STOP_TIMEOUT`, naming the pid; the lock stays | — |
314
326
 
315
327
  | Flag | Type | Default | Does |
@@ -397,6 +409,8 @@ is a word (`a-z`, `0-9`, `-`, `_`) or `[param]` / `[...rest]`; `..`, `.` and emp
397
409
 
398
410
  `resource` emits the whole slice — `entity`, `repo`, `policy`, `errors`, `service`, `actions`, `live`, `jobs`, `ui`, the form island, the plural route and a test beside each declaration — **38 files** on a dry run in an app scaffolded with its example slice, 40 on the real run after `bun run setup` (`x.manifest.json` and `openapi.json` re-projected; 41 dry with `--admin`) — and `x g resource` in a `--no-example` app, which also gains two `package.json` edits, writes 40 and 42 files (43 and 45 with `--admin`; `--live` is refused — a resource already ships a live query, and the flag belongs to `x g query`: `X_CLI_BAD_FLAG`, fix `x g query <name>-feed --feature <name> --live`), and **no migration**: `x db gen` is the only writer of `packages/db/migrations`, so a new slice is `x g resource <name>`, then `x db gen "create <table>"`, then `x db migrate`, then `x build --target static && x verify --only budgets` — the four commands the run prints, in that order (`data.next` under `--json`). **The plural route is reachable as written**, `As of 2026-10-01`: its `load` reads the list through the slice's query as the request's actor (no org in the URL), `AsyncRegion` renders ready, empty and refused, the form island is mounted, and the route declares `policy: { permission: '<name>:read' }`. Its `budget.js` is MEASURED on `x new`'s app (58,522 B, Bun 1.4.0) and carries the `measured:` / `why:` comment `bun run budget-raises` reads; an app that charges more to every document — `navigation: { client: [...] }` adds its router — is over it on the printed build, and the raise is that edit. The page sits in `apps/web/shared/shell.tsx` when the app has one. `backfill` emits a `backfill()` declaration with its `source()` and `handle()` to fill in — see [Migrations and backfills](Migrations-And-Backfills). **`x g query` and `x g backfill` read a table and never create one**, `As of 2026-11-02`: both name a slice holding an `entity.ts`, by `--feature <slice>` or by a name that is one, and neither finding it is `X_FEATURE_REQUIRED`, zero files written, its fix the closest slice's `--feature` line or `x g resource <name>`. `x g resource` and `x g entity` are what create a table. Every generator produces code that passes `x verify` unmodified, and writes it through the app's own Biome when the app has one: `node_modules/.bin/biome` over the TypeScript files that run created, best effort, never a failed `x g`. A slice whose `entity.ts` declares another table under its name gets no foundation from `x g action`/`x g mutator`, and `x g query` there is `X_QUERY_SLICE_ENTITY`. A written contract test reads its exercise from `apps/web/exercise.ts` (`target.contract({ exercise })`), and the same run inserts its entry there — once, the file created from `x new`'s when absent, `As of 2026-11-08`; a file that is not one `export const exercise = defineExercise({ … })` is `X_EXERCISE_FILE_UNEDITABLE`, the entry to paste in its `fix:`. Errors: `X_GENERATE_CONFLICT`, `X_DB_HANDLE_UNREGISTERED`, `X_FEATURE_UNKNOWN`, `X_FEATURE_REQUIRED`, `X_QUERY_SLICE_ENTITY`, `X_EXERCISE_FILE_UNEDITABLE`.
399
411
 
412
+ **A generated read answers the slice's `<Feature>View`, not the whole row** (`As of 2026-11-19`): `x g query` and `x g resource` project each row through `viewOf` in the query's `sql:` provider (`from<XView>(…)`), so no tenant column reaches the wire and a column added to the entity is published only by an edit to the view, live patches included. That holds when the run writes the scaffold entity or the slice's `entity.ts` declares `XView = x.$view([...])` over `id`, `title` and `createdAt` (the columns the read orders by); otherwise the read answers the row as before. Files generated earlier are untouched.
413
+
400
414
  **A name the templates would mangle is `X_CLI_BAD_FLAG` before anything is planned**, each with a `fix:` that runs: a reserved word or a leading digit; a letter outside ASCII (`Über` → `x g entity uber` — it was dropped to `ber`); an already-plural `resource`/`entity` name (`posts` → `x g resource post` — it became `entity('postses')`); and a name whose type spelling an emitted file also uses as a global or local type (`promise`, `omit`, `partial`, `row` → `x g resource promise-resource`).
401
415
 
402
416
  **`entity` and `resource` write a repo over the typed handle, and register the entity in it**, `As of 2026-10`. The generated `repo.ts` holds no `sql` literal, no row decoding and no tenant predicate of any kind — `byId(id)`, `list(limit)` and `insert(row)` read `db.<table>`, and the handle scopes each to the actor's org ([Entities and migrations](Entities-And-Migrations#the-repo)) — and a table is on the handle only when its entity is in the set `packages/db/src/client.ts` passes to `database()`. The generator makes that edit, and four more:
@@ -476,7 +490,7 @@ The synopsis above is `GENERATORS` in `packages/cli/src/cmd-generate.ts`, which
476
490
  ## x db
477
491
 
478
492
  ```bash
479
- x db gen "add publish_at" | migrate | reset
493
+ x db gen "add publish_at" [--merge-fork] | migrate | rollback [--steps n] | reset
480
494
  | seed [<name>] [--tier reference|dev] [--dry-run] [--json]
481
495
  | branch list | branch create <name> | branch delete <name>
482
496
  | backfill --list [--name n] [--status s] [--limit n] [--json]
@@ -488,10 +502,11 @@ x db gen "add publish_at" | migrate | reset
488
502
 
489
503
  | Subcommand | Does | Notes |
490
504
  |---|---|---|
491
- | `gen ["<name>"]` | diff the app's entities against what the migrations declare, write the next migration, then rewrite the schema dump | the message becomes the id's slug; left out it is `change`. **Opens no database of yours** — the diff reads the previous migration's snapshot, and the dump is replayed on a scratch database it boots and discards: the embedded one, restored from a snapshot under `.x/cache` after its first boot, or a real Postgres when a migration creates an extension PGlite cannot link ([the engine rule](Migrations-And-Backfills#extensions-and-the-scratch-database)). **Exit 1 with a migration written** is possible: the dump failed after the migration was generated, the summary and the finding both say so, and the next move is a bare `x db gen`, never the same message again. A bare `x db gen` with nothing to generate rewrites `packages/db/schema/` alone, which makes it `X_SCHEMA_DUMP_DRIFT`'s whole fix. When the app does not load, nothing is compared and the summary says so — *nothing was compared — the app did not load (N finding(s)); fix them, then run x db gen again* — never "no migration needed". `--json`: `data.schemaDump` = `{ directory, status, files, written, removed }`, `status` one of `written`, `unchanged`, `skipped` (no migration yet), `failed`. `--allow-destructive` lets it emit a drop whose `down` cannot restore the rows; `--rolling-unsafe` lets it drop a column never retired, for an app that stops before it starts → [A column drop takes two releases](Migrations-And-Backfills#a-column-drop-takes-two-releases) |
492
- | `migrate` | apply pending migrations, verify the result, then rewrite the schema dump | literally `ROLE=migrate`'s own `runMigrations` — which ends by diffing the live schema against the ledger it just wrote, on the connection it already holds. A difference is `X_DB_DRIFT` and a non-zero exit. Then, `x db migrate` only: the dump is regenerated as `gen` does, and the database is reopened to report any trigger, function, view, type or sequence no migration creates (`unexpected-object`, also `X_DB_DRIFT`). `--json` carries the same `data.schemaDump` |
505
+ | `gen ["<name>"]` | diff the app's entities against what the migrations declare, write the next migration, then rewrite the schema dump | One run at a time per checkout, `As of 2026-11`. The summary names the tables the migration touches (`data.tables`); a run with nothing to write names the newest migration (`data.newest`), which a concurrent run may have written. A forked chain is refused first (`X_MIGRATION_FORKED`). the message becomes the id's slug; left out it is `change`. **Writes to no database of yours** — the diff reads the previous migration's snapshot, and the dump is replayed on a scratch database it boots and discards: the embedded one, restored from a snapshot under `.x/cache` after its first boot, or a real Postgres when a migration creates an extension PGlite cannot link ([the engine rule](Migrations-And-Backfills#extensions-and-the-scratch-database)). **Exit 1 with a migration written** is possible: the dump failed after the migration was generated, the summary and the finding both say so, and the next move is a bare `x db gen`, never the same message again. A bare `x db gen` with nothing to generate rewrites `packages/db/schema/` alone, which makes it `X_SCHEMA_DUMP_DRIFT`'s whole fix. On the **embedded** database it first reads the ledger once (through a running `x dev`, else a read-only open of `.x/pgdata` when it exists; `As of 2026-11-19`): an applied migration whose SQL was edited since is `X_MIGRATION_CONFLICT`, exit 1, nothing written — the dump is never rewritten to match an edit. A ledger it cannot read is a printed line, never a refusal; an external `DATABASE_URL` is never dialled. A change that needs a step outside the transaction is written as two migrations, `<id>` and `<id>_concurrently`, and the summary names both. When the app does not load, nothing is compared and the summary says so — *nothing was compared — the app did not load (N finding(s)); fix them, then run x db gen again* — never "no migration needed". `--json`: `data.schemaDump` = `{ directory, status, files, written, removed }`, `status` one of `written`, `unchanged`, `skipped` (no migration yet), `failed`. `--allow-destructive` lets it emit a drop whose `down` cannot restore the rows; `--rolling-unsafe` lets it drop a column never retired, for an app that stops before it starts → [A column drop takes two releases](Migrations-And-Backfills#a-column-drop-takes-two-releases) |
506
+ | `migrate` | apply pending migrations, verify the result, then rewrite the schema dump | literally `ROLE=migrate`'s own `runMigrations` — which ends by diffing the live schema against the ledger it just wrote, on the connection it already holds. A difference is `X_DB_DRIFT` and a non-zero exit. Beside a live `x dev` holding the embedded database it is **applied by that dev server** (`POST /_x/db/migrate`, loopback and same-origin only), never by a second process: PGlite takes no lock of its own, and a second writer's tables are dropped by the holder's next write. The report, drift and dump are the same either way. The request sends `Sec-Fetch-Site: same-origin`, so an app's CSRF check admits it, and a holder still booting is waited for (up to 120 s; only a refused connection is retried, so a sent request is never sent twice). Applied that way, `x dev` serves the new schema without restarting. A holder that cannot answer (older server, dead port) or runs `database.rowSecurity` (it serves as `x_app`, which cannot migrate) is `X_DEV_ALREADY_RUNNING`, fix `x stop --json && x db migrate && x dev` (`As of 2026-11-19`; against an external `DATABASE_URL` it runs as always). Then, `x db migrate` only: the dump is regenerated as `gen` does, and the database is reopened to report any trigger, function, view, type or sequence no migration creates (`unexpected-object`, also `X_DB_DRIFT`). `--json` carries the same `data.schemaDump` |
507
+ | `rollback [--steps n]` | reverse the most recently applied migration(s), most recently applied first (`applied_at`, not id), by running each file's `-- down` half | default 1 (`--steps` is an integer ≥ 1, read before anything opens). The files stay, so each is pending again: `x db migrate` re-applies it, deleting its `.sql` / `.snapshot.json` / `.hash` drops the change. No `-- down` marker in the file: `X_MIGRATION_IRREVERSIBLE` (an empty `down` under the marker reverses with no statement). A ledger row whose file is gone: `X_MIGRATION_CONFLICT`. On a named deploy (staging or production, `NODE_ENV=production` included), an `ULTIMATE_ENV` that names no environment, or — whatever the environment — an external `DATABASE_URL` whose host is not this machine (loopback or a local socket): `X_MIGRATION_ROLLBACK_DESTRUCTIVE` until `ROLLBACK_ALLOW_DESTRUCTIVE` names every id it would reverse — judged under the migrate lock against the rows it is about to reverse. Beside a live embedded `x dev` it is run by that server (`POST /_x/db/rollback`), as `migrate` is; a request that reached it and lost its answer may have run, so its `X_DEV_ALREADY_RUNNING` fix is `x stop --json && x db status && x dev` — read the ledger, never the rollback again (only a refused connection repeats it). A change `gen` wrote as `<id>` + `<id>_concurrently` takes `--steps 2`; one step reverses the second half and names `<id>` as still applied. An index-only change is one non-transactional migration under the plain id, whole: no such line. `--json`: `data` = `{ reverted, steps, files }`. `As of 2026-11-19` |
493
508
  | `reset` | delete the embedded data directory, then migrate | **embedded database only** — against an external Postgres it exits `X_NOT_IMPLEMENTED` and tells you to drop and recreate it yourself |
494
- | `seed [<name>]` | apply the app's seeds — every one this environment takes, or the one named | **replayable**: a second run writes nothing and raises nothing, on Postgres as well as in memory. One transaction per seed, so one bad fixture graph cannot roll back the seeds that already landed. `--dry-run` reports what each would write and writes nothing |
509
+ | `seed [<name>]` | apply the app's seeds — every one this environment takes, or the one named | **replayable**: a second run writes nothing and raises nothing, on Postgres as well as in memory. One transaction per seed, so one bad fixture graph cannot roll back the seeds that already landed. `--dry-run` reports what each would write and writes nothing. Beside a live `x dev` holding the embedded database, `seed` (`--dry-run` and `--generate` included) is refused `X_DEV_ALREADY_RUNNING`, its fix `x stop --json && x db seed … && x dev` (`As of 2026-11-19`); `backfill --write` is refused the same way, `backfill` listing and dry runs are not |
495
510
  | `branch list` | every **managed** branch of this database: name, location, created-at, size | managed means this framework made it — external, a database carrying `createBranch()`'s `comment on database` marker; embedded, a `pgdata-<name>` directory. A branch cloned by the pre-1.2.x `psql` shell-out carries no marker, so it is absent here and `delete` refuses it → [Known gaps](Known-Gaps). `size` reads `unknown` on the embedded database — measuring it is a full directory walk. The delete path only touches what this lists |
496
511
  | `branch create <name>` | `CREATE DATABASE … TEMPLATE` copy-on-write clone (PGlite: a copied data directory) | the isolation an agent should use before migrating. An existing name is `X_BRANCH_EXISTS`, never an overwrite |
497
512
  | `branch delete <name>` | delete that branch database (PGlite: its `pgdata-<name>` directory) | a name `list` does not show is refused with `X_DB_BRANCH_FAILED` naming what it *would* have touched — that is the whole guard, and it is why there is no `--force` |
@@ -546,6 +561,8 @@ Two more facts about the set, both `As of 2026-08`:
546
561
  | `--name` | string | — | migration or branch name, or the backfill to filter the ledger by. Under `backfill --list` it is the **only** spelling of that filter: a positional there is a pass target in every other shape and is refused with `X_CLI_BAD_FLAG` rather than silently dropped |
547
562
  | `--allow-destructive` | boolean | `false` | let `gen` emit a DROP whose `down` cannot restore the rows. `X_MIGRATION_IRREVERSIBLE`'s own `fix:` line names it |
548
563
  | `--drop-redundant` | boolean | `false` | `gen`: leave out of the diff each implicit index (a column's own, from `.references()` or `.index()`) that another index, the primary key or a unique invariant already leads with, so the migration drops it `concurrently` in a non-transactional step you review. Never a default; once dropped, a plain `x db gen` does not rebuild it. A table with no migration yet keeps every index. `x doctor` lists what it would drop (`data.redundantIndexes`), `As of 2026-11-14` |
564
+ | `--merge-fork` | boolean | `false` | `gen`: the fix `X_MIGRATION_FORKED` prints. Rewrites the newest `.snapshot.json` to what the merged chain builds, then continues as any `gen`. Changes no SQL and deletes no migration. `--json`: `data.outcome` is `fork-merged` when no migration was needed, `data.forkRepairs` the objects corrected. Two migrations creating one object are still refused ([Two branches, one chain](Migrations-And-Backfills#two-branches-one-chain--x_migration_forked)) |
565
+ | `--steps` | integer ≥ 1 | `1` | `rollback` only: how many applied migrations to reverse, most recently applied first. `0`, a fraction or a word is `X_CLI_BAD_FLAG` before anything opens |
549
566
  | `--list` | boolean | `false` | `backfill`: print the ledger |
550
567
  | `--pending` | boolean | `false` | `backfill`: declared minus completed, judged in this `ULTIMATE_ENV`. Non-zero exit when anything is unswept |
551
568
  | `--all` | boolean | `false` | `backfill`: every pending sweep, isolated per name |
@@ -608,7 +625,7 @@ unappliable.
608
625
 
609
626
  **`x env init --production`** (`As of 30.0.0`) writes `.env.production`, the file `x deploy --method compose` reads: `ULTIMATE_ENV=production`, `IMAGE=ultimate-app:dev` (the tag `x build --target docker` makes), `POSTGRES_PASSWORD` and a `DATABASE_URL` naming the compose `db` service with it, `APP_URL` and `SYNC_URL` on localhost, and every secret the app declares or the framework refuses to boot without, 32 random bytes as hex each. Secrets are never printed: `--json` lists the key names (`data.written`). `.gitignore` gains `.env.production` first, the file is mode 600, and a second run refuses (`X_ENV_FILE_EXISTS`): the password is the one the database volume was initialised with. A required key nothing can derive is written empty, named in `data.unfilled`, and exits 1.
610
627
 
611
- **`x env check` over a table naming no environment** reads it as production, as the boot does, and its summary says `checked as production: no ULTIMATE_ENV named`. `x doctor` asks about this machine and stays quiet on that shell. On this machine: `ULTIMATE_ENV=development x env check`.
628
+ **`x env check` answers for one environment and says which** (`As of 2026-11-19`). Named — `ULTIMATE_ENV`, else `NODE_ENV` — it is checked as named, always. With neither set it is checked as **development**, the environment `x dev` in the same directory declares, and the summary ends `checked as development, as x dev runs here: no ULTIMATE_ENV named — a deploy: ULTIMATE_ENV=production x env check`. With neither set under `CI` it is checked as production, because the boot fails closed (`checked as production: no ULTIMATE_ENV named`). `--json` carries `data.environment`. For a deploy's answer, name it: `ULTIMATE_ENV=production x env check` — the scaffold's image sets `NODE_ENV=production`, and `x deploy`'s pre-flight fix is `NODE_ENV=production x env check --json`. A missing key's `X_ENV_MISSING` fix is the line to add, in the file that environment loads (`.env.development.local`, `.env.test.local`, `.env.production`).
612
629
 
613
630
  **The schema dump against the newest snapshot** (`As of 2026-11-02`, `drift`, no database) is `X_DB_DRIFT`: a column in `packages/db/schema/04_tables/<t>.sql` no snapshot records means an applied migration was edited and regenerated. A table hand-written SQL names is exempt.
614
631
 
@@ -630,7 +647,7 @@ pre-1.2.0 layout, and reading it as one would drop every table the pair exists t
630
647
 
631
648
  Errors, seed: `X_DECLARATION_UNKNOWN` (no seed of that name — the cause lists the ones there are), `X_CLI_BAD_FLAG` (an unknown `--tier`, one name declared twice, or a `dev` seed reached under `production` with no consent), and whatever the seed itself threw, reported per seed with the file it came from.
632
649
 
633
- Errors, schema: `X_DB_DRIFT`, `X_SCHEMA_DUMP_DRIFT`, `X_DB_GEN_FAILED`, `X_DB_MIGRATE_FAILED`, `X_DB_BRANCH_FAILED`, `X_MIGRATION_CONFLICT`, `X_MIGRATION_IRREVERSIBLE`, `X_MIGRATION_VIEW_DEPENDS`, `X_MIGRATE_CONCURRENT`, `X_NOT_IMPLEMENTED`. `X_DB_STUDIO_FAILED` is reserved and no longer thrown — `studio` left `x db` `As of 2026-11-15` ([Known gaps](Known-Gaps#open-by-decision)).
650
+ Errors, schema: `X_DB_DRIFT`, `X_SCHEMA_DUMP_DRIFT`, `X_DB_GEN_FAILED`, `X_DB_MIGRATE_FAILED`, `X_DB_BRANCH_FAILED`, `X_MIGRATION_CONFLICT`, `X_MIGRATION_FORKED`, `X_MIGRATION_IRREVERSIBLE`, `X_MIGRATION_VIEW_DEPENDS`, `X_MIGRATE_CONCURRENT`, `X_NOT_IMPLEMENTED`. `X_DB_STUDIO_FAILED` is reserved and no longer thrown — `studio` left `x db` `As of 2026-11-15` ([Known gaps](Known-Gaps#open-by-decision)).
634
651
 
635
652
  Errors, backfill: `X_BACKFILL_PENDING` (`--pending`, and the only one that is not a refusal — the sweep simply has not run), `X_BACKFILL_UNKNOWN`, `X_BACKFILL_ENVIRONMENT`, `X_BACKFILL_MIGRATION_PENDING`, `X_BACKFILL_APPLIED`, `X_BACKFILL_RUNNING`. All six are `@ultimat3/jobs`', carry a one-line runnable `fix:`, and are what a non-zero exit from these shapes means — full wording in [Error codes → `@ultimat3/jobs`](Error-Codes-jobs). `X_BACKFILL_STALLED` is the seventh and never reaches this command: it is raised by the pass, on a worker, so it surfaces through `x jobs show <id>`.
636
653
 
@@ -757,9 +774,24 @@ the env file's is your own server, and is never probed or second-guessed. The st
757
774
  running** (RAM only; the next run reuses it) and the step's warning says so, with the stop line,
758
775
  `docker compose -f docker/docker-compose.test.yml down`. No Docker, or a start that fails with no
759
776
  database answering: a warning carrying `X_TEST_SERVICES_UNAVAILABLE` and the start command as its
760
- fix, and the suites run exactly as before — a floor whose every live test then skipped is still
761
- `X_VERIFY_SUITE_VANISHED`.
762
- `packages/cli/src/verify-live.ts` decides when; `verify-services.ts` probes and starts.
777
+ fix, and the suites run exactly as before. When the floor holds `live` and that run executed no
778
+ test, `X_TEST_SERVICES_UNAVAILABLE` is the step's **finding**, first and red, with its working fix —
779
+ not `X_VERIFY_SUITE_VANISHED`, which is no longer added when the step already says why
780
+ (`As of 2026-11-19`). `--only live` with no floor, or a live run where some tests ran, keeps the
781
+ warning.
782
+ One stderr line names the stack: `services: started|reused <project>`, or `services: shared <project>
783
+ with <dir>` for another checkout of this app (same first commit or `origin`). A stack under this
784
+ project name started by a different app is refused before compose runs:
785
+ `X_TEST_SERVICES_UNAVAILABLE`, unless `ULTIMATE_TEST_SERVICES_SHARED=1` says the share is intended.
786
+ A **stopped** one is called stopped, never "already running", and its fix removes it by name:
787
+ `docker compose -p <project> down --volumes` (its data was in RAM), then `x verify --only live`. It
788
+ is reported, never taken over. `x new` (`As of 2026-11-19`) writes the compose `name:` as
789
+ `<app>-test-<8 hex of the scaffold directory's hash>` and picks the ports from name and directory,
790
+ so two scaffolds with one name on one machine get two stacks; an existing app keeps the `name:` its
791
+ compose file states, and a moved checkout keeps its scaffold-time name.
792
+ `x clean --services` stops the stack.
793
+ `packages/cli/src/verify-live.ts` decides when; `verify-services.ts` probes and starts;
794
+ `verify-services-stack.ts` reads whose stack it is.
763
795
 
764
796
  `--workers` widens the test steps only. `unit`, `contract`, `job` and `eval` run as
765
797
  `bun test --parallel=N`, each worker with its own database; `live` and `e2e` are serial by
@@ -826,7 +858,8 @@ test can fall between two steps.
826
858
  because a skipped step — or one gating against nothing — would read as a green gate over untested
827
859
  code. It gates on the drop from each eval's committed baseline, never on an absolute score —
828
860
  `ULTIMATE_EVAL_RECORD=1 x test eval` re-records those baselines so accepting a new number is a
829
- reviewable diff.
861
+ reviewable diff. `0`, `false`, `no`, `off` and empty (any case, trimmed) are off and gate; any
862
+ other value records (`As of 2026-11-19`, `packages/ai/src/eval-baseline.ts`).
830
863
 
831
864
  That flag and this step are mutually exclusive. `x verify` with `ULTIMATE_EVAL_RECORD` set is
832
865
  `X_EVAL_RECORDING` and the suite does not run: recording makes every eval write the numbers it
@@ -1006,7 +1039,7 @@ x deploy verify --url <origin> [--build <id>] [--window 60s] [--interval 5s] [--
1006
1039
  | queues | after the window, when `DATABASE_URL` is set. Expected: `jobs.queues` plus every registered job's queue. Served: a row not draining, of this build. Re-read until served or `--timeout`; a failed read keeps the last grade, and none landing is `X_DB_UNAVAILABLE` |
1007
1040
  | no `DATABASE_URL` | `queues.graded: false` and the summary says so. Never the embedded database, never counted as a pass |
1008
1041
 
1009
- `--json` `data`: `{ build, samples: { total, good, byBuild, byStatus, share, cached }, windowMs, queues: { graded, served, unserved: [{ queue, builds, depth }], idle } }`. `byStatus` counts a sample nothing answered as `unreachable`. `builds` names what the workers claiming that queue run (`unknown` for a row from before 30.0.0), so a stalled roll reads as one.
1042
+ `--json` `data`: `{ build, samples: { total, good, byBuild, byStatus, share, cached }, windowMs, queues: { graded, served, unserved: [{ queue, builds, depth }], idle, containers? } }`. `byStatus` counts a sample nothing answered as `unreachable`. `builds` names what the workers claiming that queue run (`unknown` for a row from before 30.0.0), so a stalled roll reads as one. `containers` (`As of 2026-11-19`, present when the registry was read): `[{ host, processes, slots }]`, this build's serving worker rows grouped by `host`, sorted — a container running `ULTIMATE_PROCESSES=N` is one `host` with `processes: N`, and `slots` is its `jobs.concurrency` total however the children split it ([Deployment](Deployment#processes-per-container)).
1010
1043
 
1011
1044
  Errors: `X_DEPLOY_BUILD_MISMATCH` (no sample carried the build), `X_DEPLOY_BUILD_UNSTAMPED` (2xx with no header, and no build ever named), `X_DEPLOY_UNSTABLE` (the build answered, the window never closed), `X_DEPLOY_QUEUE_UNSERVED` (one finding per queue), `X_CLI_BAD_FLAG`.
1012
1045
 
@@ -1128,7 +1161,7 @@ x auth seal-mfa [--json]
1128
1161
  One subcommand, and no default: a bare `x auth` is refused (`X_CLI_BAD_FLAG` names the subcommand), as `x db`, `x mcp` and `x pr` are — the one subcommand rewrites credential rows, and the read-only answer (how many are unsealed) is `x doctor`'s. `seal-mfa` seals every `x_users.mfa_secret` still stored
1129
1162
  in the clear, in place, under the app's master key (`As of 2026-10`). It is the one-shot an upgrade
1130
1163
  onto sealed second-factor secrets owes — `completeMfa` refuses a plaintext value with
1131
- `X_MFA_SECRET_UNSEALED`, whose fix is this command, and `x doctor` reports how many rows are left.
1164
+ `X_MFA_SECRET_UNSEALED`, whose fix is this command, and `x doctor` reports how many rows are left. Beside a live `x dev` holding the embedded database it is refused `X_DEV_ALREADY_RUNNING`, fix `x stop --json && x auth seal-mfa && x dev` (`As of 2026-11-19`).
1132
1165
 
1133
1166
  | | |
1134
1167
  |---|---|
@@ -1268,7 +1301,9 @@ whatever its bearer token was issued.
1268
1301
  | `ui.diff` | pixel-compare two PNGs the other `ui.*` tools wrote under `.x/shot/`; launches no browser | `dev:read` |
1269
1302
 
1270
1303
  `db.query` and `db.migrate` refuse structurally — multiple statements, a mutating keyword
1271
- (a data-modifying CTE included), a locking clause, `EXPLAIN ANALYZE`, a non-branch target —
1304
+ (a data-modifying CTE included), a locking clause, `EXPLAIN ANALYZE` (or `ANALYSE`), a banned
1305
+ function family (`pg_read_*`, `pg_copy_*`, `pg_backup_*`, `pg_restore_*`, … — [MCP and AI](MCP-And-AI)),
1306
+ a non-branch target —
1272
1307
  before the host runs anything. `db.explain` is where `ANALYZE` is allowed: it writes the `EXPLAIN`
1273
1308
  itself around a statement the same scan passed.
1274
1309
 
@@ -1287,6 +1322,8 @@ A tool this caller may not see is absent from `tools/list` and answers ToolNotFo
1287
1322
  x doctor [--port 3000] [--json]
1288
1323
  ```
1289
1324
 
1325
+ A taken port is judged by who holds it (`As of 2026-11-18`): from this checkout, or by a process the OS will not name, it is an `X_PORT_IN_USE` finding; from another checkout it is the same code as a warning in `data.warnings[]`, naming that directory, and the exit stays 0. Either way the fix names a port pair that is free when asked.
1326
+
1290
1327
  Checks Bun version, env completeness, source drift, **the newest migration's `.snapshot.json`**, port availability, PWA prerequisites and **embedded-Postgres readiness** — each failing check carries its own fix command.
1291
1328
 
1292
1329
  It also lists the copies of shipped guards the app's `guards/` still holds, each with `X_GUARD_VENDORED` beside the verdict in `data.warnings[]`: shipped guards run from the installed framework, so a copy runs in place of the shipped one and never receives a fix. `As of 31.28`. No shipped guard is ever missing, so `data.guards.missing` is always `[]`.
@@ -1307,6 +1344,9 @@ Warnings about how the app is held — beside the verdict, never in it: the exit
1307
1344
  | `X_FRAMEWORK_PIN_RANGE` | an `@ultimat3/*` dependency in any of the app's manifests is anything but an exact version or a `workspace:`/`file:`/`link:` path (`^31.0.0`, `*`, `latest`, `>=31 <32`; an `npm:` alias by its own spec), one finding per manifest | the exact version `bun install` resolved, at the line named; then `bun install` |
1308
1345
  | `X_ENV_NAME_RESERVED` | a name the app declares in `envSchema` or seals in `secrets.enc.json` is one `FRAMEWORK_ENV` (`@ultimat3/core`) lists as a `switch` or `internal` name — setting it for the app also switches that package's behaviour. Deploy-contract names (`DATABASE_URL`, `PORT`) and host names are not collisions | rename it `APP_<name>` (or delete it where the value is meant for the framework); then `x env example` |
1309
1346
  | `X_GUARD_VENDORED` (`As of 31.28`) | the app's `guards/` holds a copy of a shipped guard, which runs in place of the built-in one and never receives a fix — one per copy. `boundaries` lists it too | the resolving edit above |
1347
+ | `X_ACTION_UNREGISTERED` · `X_QUERY_UNREGISTERED` (`As of 2026-11-19`) | the app's API index lists actions or queries in `defineApi()`, and a loaded module exports one whose name no list carries — served by the module scan, missing from the typed `Api`. An app that lists none (scan only) is told nothing; a failed load is silent | the import line, as `X_JOB_UNREGISTERED` prints it: `import * as refundTicket from '../app/ticket/actions/refund-ticket';` in `apps/web/api/index.ts`, `refundTicket` added to `actions: [...]` there — then `x manifest` |
1348
+
1349
+ **Processes per container**, the same way (`As of 2026-11-19`): one line per role — the count a production container of it runs on this host under `ULTIMATE_PROCESSES` and the clamp that bound it, its pool plus LISTEN sessions as connections per container — then, when an external database answered, one container of each role against `max_connections`. `--json`: `data.processes` = `{ environment, cores, cpuBudget, migrateReq, roles: [{ role, count, binding, pool, listen, connections } | { role, refused }], connectionsOneOfEach, maxConnections }` (`cpuBudget`, `migrateReq`, `maxConnections` are `null` when unknown; `binding` is one of `environment`, `platform`, `role`, `cpu`, `memory`, `pool`, `shared-state`, `image`, `requested`; `refused` is the code an explicit count met). On a production or staging host only, two warnings join `data.warnings[]`: `X_PROCESSES_CPU_UNDECLARED` (no CPU quota on a multi-core host, so `auto` runs one process; fix `cpus:` on the service) and `X_PROCESSES_MIGRATE_REQ_OFF` (N > 1 with `net.ipv4.tcp_migrate_req` at 0, only where the knob exists — Linux ≥ 5.14; a kernel without it is told nothing; fix: uncomment the `sysctls:` line). A listing, never a finding ([Deployment](Deployment#processes-per-container)).
1310
1350
 
1311
1351
  **Redundant indexes**, the same way (`As of 2026-11-14`): each implicit index the entities describe that another index, the primary key or a unique invariant already leads with, still in the newest migration's snapshot, is one line — `<table>.<index> (<columns>) — <covering index>` — under a header naming `x db gen "drop redundant indexes" --drop-redundant`; `--json`: `data.redundantIndexes[]` = `{ table, name, columns, coveredBy }`, `[]` when none, absent when the app would not load or has no snapshot. A listing, never a finding: every write pays for each twice, and dropping it is a migration the app opts into.
1312
1352
 
@@ -1396,10 +1436,10 @@ x jobs [list|show <id>|retry <id>|cancel <id>|delete <id>|promote <id>|resolve-s
1396
1436
  | `delete <id>` | delete one job and its step records. An unknown id is `X_JOB_UNKNOWN`; a **running** job is refused with `X_JOB_NOT_REMOVABLE`, whose fix is `x jobs cancel <id> --json` — deleting the row under a body does not stop the body |
1397
1437
  | `promote <id>` | make a job waiting on its run time — delayed at enqueue, or backing off before a retry — due now. Anything else (due, running, finished, suspended in a `step.sleep`) is `X_JOB_NOT_PROMOTABLE`, naming the state |
1398
1438
  | `resolve-step <id> <step>` | answer a `once` step whose outcome is unknown (`X_STEP_OUTCOME_UNKNOWN`): `--ran --output '<json>'` records it `completed` — a replay returns that JSON, default `null` — and `--not-ran` records it `cleared`, so the next run calls it again. Exactly one of the two. Refused on a running job, or a step that did not start-and-not-complete (`X_STEP_NOT_RESOLVABLE`). Answers the job's trace; then `x jobs retry <id>` |
1399
- | `pause <queue>` | no worker claims from the queue; enqueues still land. A row every worker's next claim reads, so it holds **fleet-wide within one poll interval**. Idempotent. Answers the paused list as the queue now holds it |
1400
- | `resume <queue>` | undo it |
1439
+ | `pause <queue>` | no worker claims from the queue; enqueues still land. A row every worker's next claim reads, so it holds **fleet-wide within one poll interval**. Idempotent. Answers the paused list as the queue now holds it. A queue outside `jobs.queues` and the registered jobs' queues is `X_CLI_BAD_FLAG`, its fix the nearest name, before any row is written (`As of 2026-11-19`); an app that does not load is never refused on a guess |
1440
+ | `resume <queue>` | undo it; a queue that is paused always resumes, else the same queue check as `pause` |
1401
1441
 
1402
- `show`, `retry`, `cancel`, `delete` and `promote` each take **one id positional**, `resolve-step` an id and a step name; `pause` and `resume` take **one queue positional**. There is no bulk verb here — bulk is `requeueMany` / `removeMany` on `JobIntrospection`, which a dashboard calls. `--queue`, `--state`, `--name`, `--limit` and `--after` narrow `list` only. A bare `x jobs` is `list`. One verb each, no alias: `ls` and `rm` are `X_CLI_UNKNOWN_COMMAND` since 26.0.0.
1442
+ `show`, `retry`, `cancel`, `delete` and `promote` each take **one id positional**, `resolve-step` an id and a step name; `pause` and `resume` take **one queue positional**. Beside a live `x dev` holding the embedded database, the writing verbs (`retry`, `cancel`, `delete`, `promote`, `resolve-step`, `pause`, `resume`) are refused `X_DEV_ALREADY_RUNNING`, the fix stopping it, running the verb and starting it again; `list` and `show` still read (`As of 2026-11-19`). There is no bulk verb here — bulk is `requeueMany` / `removeMany` on `JobIntrospection`, which a dashboard calls. `--queue`, `--state`, `--name`, `--limit` and `--after` narrow `list` only. A bare `x jobs` is `list`. One verb each, no alias: `ls` and `rm` are `X_CLI_UNKNOWN_COMMAND` since 26.0.0.
1403
1443
 
1404
1444
  ```bash
1405
1445
  x jobs cancel 019ff1c5-0000-7000-8000-000000000001 --reason "wrong tenant" --json
@@ -1418,13 +1458,14 @@ A run refused by its concurrency key reads `state: failed` with `X_JOB_KEY_BUSY`
1418
1458
  ## x tasks
1419
1459
 
1420
1460
  ```bash
1421
- x tasks [list|show <name>] [--count n] [--json]
1461
+ x tasks [list|show <name>|run <name>] [--count n] [--production] [--json]
1422
1462
  ```
1423
1463
 
1424
1464
  | Subcommand | Does |
1425
1465
  |---|---|
1426
1466
  | `list` | every registered `task`: cron, timezone, catch-up policy, the jobs it enqueues, the occurrence it **last** fired and its next one |
1427
1467
  | `show <name>` | the same plus the cron in words and the next `--count` occurrences (default 5, max 50) |
1468
+ | `run <name>` | fire the task now: each job its occurrence enqueues goes onto the app's queue, through `TaskHandle.enqueue()` (the admin's run-now path). The scheduler's watermark is untouched, so the next scheduled occurrence still fires. Where the environment resolves `production` it fires only when asked by name — `--production`, or `ULTIMATE_TASK_RUN=<name>` for a container whose command line is fixed — as `x db seed --tier` / `ULTIMATE_SEED_TIER` do (`X_TASK_RUN_PRODUCTION` otherwise, nothing queued); beside an `x dev` holding the embedded database it is refused `X_DEV_ALREADY_RUNNING` with the stop–run–restart fix. `--json`: `data` = `{ task, jobs: [{ job, id, runId, deduped }] }`. `x g cron-job <name>` prints `bunx x tasks run <name>.schedule` as its next step. `As of 2026-11-19` |
1428
1469
 
1429
1470
  | `--json` field | Is |
1430
1471
  |---|---|
@@ -1645,27 +1686,34 @@ Errors: `X_DRILL_FAILED` (one per property that did not hold), `X_DRILL_SERVICE_
1645
1686
  ## x policy
1646
1687
 
1647
1688
  ```bash
1648
- x policy [list|explain <subject>] [--json]
1689
+ x policy [list|explain <subject> [--input '<json>']] [--json]
1649
1690
  ```
1650
1691
 
1651
1692
  | Subcommand | Does |
1652
1693
  |---|---|
1653
1694
  | `list` | every permission, the roles that grant it, and the actions and queries that enforce it — plus the permissions **nothing** enforces, which are grants that do nothing |
1654
- | `explain <subject>` | the allow/deny matrix, one row per actor per declaration — every declared role plus `anonymous`, evaluated once for each action or query that enforces the subject — naming the clause that decided and its reason |
1695
+ | `explain <subject>` | one row per actor per declaration — every declared role plus `anonymous`, for each action or query that enforces the subject — naming the clause that decided and its reason. Verdict `allow`, `deny`, or `needs input` |
1696
+
1697
+ | Flag | Does |
1698
+ |---|---|
1699
+ | `--input '<json>'` | `explain` only: the request's input, as one JSON argument. A predicate that reads input is decided on it. Not JSON is `X_CLI_BAD_FLAG`, reported by length; the value is never echoed back |
1655
1700
 
1656
1701
  `<subject>` resolves in order against a permission (`post:publish`), an action name (`publishPost`), a query name (`postFeed`), then an action's HTTP path (`/api/posts/publish`) — so the `fix:` line printed by an `X_FORBIDDEN` is runnable whichever of the four the throwing surface had to hand.
1657
1702
 
1658
1703
  ```bash
1659
- $ x policy explain publishPost
1660
- action publishPost — policy post:publish
1661
- actor verdict deciding reason
1662
- anonymous deny post:publish no actor for post:publish
1663
- author deny post:publish post:publish predicate returned false
1664
- reader deny post:publish actor lacks post:publish
1704
+ $ x policy explain closeTicket
1705
+ action closeTicket — policy ticket:write
1706
+ actor verdict deciding reason
1707
+ anonymous deny ticket:write no actor for ticket:write
1708
+ admin needs input ticket:write not denied — every actor-only clause passes, and ticket:write has a predicate that reads the request input
1709
+ viewer deny ticket:write actor lacks ticket:write
1665
1710
  evaluated with no request input and no row — a rule reading either decides again on the real request
1711
+ ✓ closeTicket — allowed for 0 of 3 actor evaluation(s); 1 not denied, decided by a predicate that reads the request input — x policy explain closeTicket --input '<the request input as JSON>'
1712
+
1713
+ $ x policy explain closeTicket --input '{"orgId":"0190…","ticketId":"0190…"}'
1666
1714
  ```
1667
1715
 
1668
- The verdict comes from `@ultimat3/policy`'s own `policyMatrix()` over the app's real `Policy` objects — the same evaluation the request path runs, never a second one. It runs **outside a request**, which is what the last line says: a rule reading input or a row decides again on the real call, so a `predicate returned false` here is a no-input verdict rather than a standing denial. A policy that cannot be evaluated at all outside a request — a predicate dereferencing `input.post.id` has nothing to dereference — reports `decidable: false` and prints that note in place of the table, never a table of invented denials.
1716
+ The verdict comes from `@ultimat3/policy`'s own `policyMatrix()` over the app's real `Policy` objects — the same evaluation the request path runs, never a second one. With no `--input` there is no request to read, so a predicate that reads one is **not decided**: the row says `needs input` (`verdict: "needs-input"`, `allowed: null` in `--json`, counted in `data.pending`), never `deny` (`As of 2026-11-19`). Reading is detected, not assumed: the predicate runs over a stand-in input that records being read, so one reading only the actor (`({ actor }) => …`) still decides. `deny` means what it says — no actor, no grant, or an actor-only predicate that refused. A row-level rule is evaluated with no row and decides again on the real request (`row?.ownerId === actor.id` still reads `deny` under that note). The actors carry no `orgId`, so an org-scoped predicate compares against `undefined` even with `--input`. With `--input`, a policy that throws on it (a field the JSON does not carry) reports `decidable: false` and a note in place of the table, never a table of invented denials.
1669
1717
 
1670
1718
  Errors: `X_DECLARATION_UNKNOWN`, `X_CLI_BAD_FLAG`.
1671
1719
 
@@ -1730,6 +1778,8 @@ x test [unit|contract|live|job|e2e|eval] [--filter path[,path…]] [--allow-empt
1730
1778
 
1731
1779
  The type rule is `x verify`'s, not a second one — so `x test contract` runs exactly what the gate's `contract` step runs. A selection that matches no files is `X_TEST_NO_FILES` (green with `--allow-empty`); an unknown type is `X_CLI_BAD_FLAG` naming the six and suggesting the nearest.
1732
1780
 
1781
+ **Exit codes, `As of 2026-11-19`.** `0`: at least one test ran and none failed. `1`: a test failed — `X_TEST_FAILED`, its cause naming the failing files (up to 5) and its fix rerunning the first one alone (`x test <type> --filter <file> --workers 1`; the whole reproduce line only when bun named no file; `data.reproduce` unchanged). **`1` too when every test the run selected skipped itself** (`ran 0`, `skipped N`): `bun test` exits 0 there, but nothing was checked. The summary reads `live — 0 test(s) ran: all 1 skipped themselves, so nothing was checked`; the finding is `X_TEST_FAILED`, its cause naming any unset `TEST_DATABASE_URL`, `TEST_REDIS_URL` or `TEST_NATS_URL` and its fix starting the test services, then the same selection — or, with nothing unset, a `grep -nE 'skip|needs:'` over the files. `x verify` is unaffected: its steps do not go through this verdict.
1782
+
1733
1783
  **In an app root `--affected` narrows by import closure, `As of 2026-11`** — every slice shares the `apps/web` workspace, so the workspace answer ran the whole app. The rule is `x affected`'s `data.tests`, never a second one: a test runs when its imports reach a changed file, transitively; a changed file the import graph cannot speak for (`app.config.ts`, `package.json`, a catalog, anything outside the app) runs every test; a discovered test outside the scanned globs always runs. `data.affected.tests` carries `{ app, all, reason, forcing, files: [{ path, why }] }` — `reason` is `closure: N changed file(s)` or `all: <forcing files>`, `why` is `closure`, `all` or `unmapped`. Outside an app root, `data.affected` has no `tests` and the workspace scope is unchanged.
1734
1784
 
1735
1785
  `--affected` narrows the FEEDBACK, never the gate. The GATE stays un-narrowable — `x verify` with no flag is the gate, and `x verify --only <step>` announces `NOT A GATE RUN` in both renderers precisely so a narrowed run can never be read as one — because a gate that can be scoped is a gate that can be scoped wrong. Nothing affected is **green with zero spawns**, not a failure: editing a `.md` should not fail a build. A failure's `fix:` carries `--affected --base <ref>` back with it, because `--affected` decides which files exist to run at all and a rerun without it selects the whole corpus.
@@ -1741,15 +1791,17 @@ The type rule is `x verify`'s, not a second one — so `x test contract` runs ex
1741
1791
  ## x clean
1742
1792
 
1743
1793
  ```bash
1744
- x clean [--dry-run] [--json]
1794
+ x clean [--dry-run] [--services] [--json]
1745
1795
  ```
1746
1796
 
1747
1797
  Every test leftover the framework knows of, cleared (`As of 27.3.0`): the migrated test-database templates under `.x/test-db`, the whole `.x/cache`, any `.x` folder below the app root, and — with `TEST_DATABASE_URL` set — every probe database whose run is over. `--dry-run` names them and removes nothing; `--json` carries `data.paths` and `data.databases`. Never touched: `.x/pgdata` (the dev database), `.x/storage`, the build output. The test runner sweeps the same set before every run, keeping the newest two of each cache, so `x clean` is for reclaiming the rest by hand. [Testing](Testing#database-state-and-what-a-run-leaves-behind) has the table.
1748
1798
 
1799
+ **`--services`** (`As of 2026-11-18`) also runs `docker compose -f docker/docker-compose.test.yml down --volumes` for this checkout's stack. A stack another existing checkout started is kept, with the line that stops it. Every other test stack on the machine is listed, never touched. `--dry-run` stops nothing. `--json`: `data.services` with `action` (`stopped`, `would-stop`, `kept`, `none`, `failed`), `project`, `services`, `owner`, and `others[]` (`project`, `status`, `root`, `gone`). Docker failing is `X_TEST_SERVICES_UNAVAILABLE`, exit 1.
1800
+
1749
1801
  ## x upgrade
1750
1802
 
1751
1803
  ```bash
1752
- x upgrade [--to <version>] [--dry-run] [--json]
1804
+ x upgrade [--to <version>] [--only <step>[,<step>…]] [--dry-run] [--json]
1753
1805
  x upgrade codemods --from <version> [--to <version>] [--dry-run] [--json]
1754
1806
  ```
1755
1807
 
@@ -1768,6 +1820,8 @@ One major per run, so each hop's gate attributes its red to that hop. `As of 30.
1768
1820
 
1769
1821
  A dry run refuses exactly what the real run would, then stops before step 4 — after previewing this CLI's codemods for the span, written nowhere. It never commits; `git diff` is the hop. Under `--json` fd 1 is one document, fd 2 a `{"upgrade":"<stage>"}` line per stage and a heartbeat a minute.
1770
1822
 
1823
+ `--only <step>[,<step>…]` (`As of 2026-11-19`): the last stage runs `x verify --only <steps> --json` in place of `x verify --json` — the list `x verify --only` takes, in the gate's order, refused the same way (`X_CLI_BAD_FLAG`, `fix:` the corrected `x upgrade --only …`), and refused with no `app.config.ts`, where no `x verify` runs. **Not the full gate**: `proof` is `verify-only`, `verify.notRun[]` names every step left out — of the installed CLI's gate, read off its `x verify plan --parts 1 --json` (this CLI's list when it has no plan), the summary says `NOT THE FULL GATE` and `then` names `x verify --only <notRun> --json` for CI. Every step named — of this CLI's gate, or of the installed one's — is the full gate, run and reported as one. Default: the full gate. The stages before it (codemods, manifest, doctor, guards, a Bun-floor hop's coverage rebaseline, exercise) run either way: each writes what the hop leaves.
1824
+
1771
1825
  `--to`: an exact release in the next major. Over a mixed set a run moves the LOWEST pins one major: `^19` beside `^29` is told `--to 20.x.y`, that hop rewrites only the pins at or below it (a pin above is never moved backwards) and names its walkthrough, `next` names the following hop, and the last one levels the set. A straggler jump straight to the highest major is `X_UPGRADE_HOP_TOO_WIDE`: it skipped every walkthrough between.
1772
1826
 
1773
1827
  | `data` field | Meaning |
@@ -1777,7 +1831,7 @@ A dry run refuses exactly what the real run would, then stops before step 4 —
1777
1831
  | `done` | verify's verdict, and the exit code follows it. `true` when already there, `false` on a dry run |
1778
1832
  | `dryRun` | nothing written, no gate run |
1779
1833
  | `app` | whether the root holds `app.config.ts` |
1780
- | `proof` | what `done` rests on: `verify`, `scripts` or `none` |
1834
+ | `proof` | what `done` rests on: `verify` (the full gate), `verify-only` (`--only`: some steps, the rest in `verify.notRun`), `scripts` or `none` |
1781
1835
  | `section` | `{ title, url, local }` in [Upgrading](Upgrading); `local` is the same section as an `x docs` topic, printed whole offline; `null` when no major is crossed |
1782
1836
  | `pins[]` | `{ file, name, from, to }` |
1783
1837
  | `bun` | `{ from, to, edited[], manual[] }`. `manual[]`: `{ path, line, text, why }`, a site only you can move, listed on every run |
@@ -1788,7 +1842,7 @@ A dry run refuses exactly what the real run would, then stops before step 4 —
1788
1842
  | `exerciseFloor` | `{ file, written }`: the `exercise` keys (`unprovenMax`, `statementsMax` ≥ 100) the hop's own `x exercise` measured, written into an `x.verify.json` that stated none, so the hop stays green and the floor only falls. A key the app already wrote is never touched; `null` when nothing was written |
1789
1843
  | `manifest` | `{ ok, findings[] }`. A failure does not stop the gate |
1790
1844
  | `exercise` | `{ reported, ok, findings[] }` from the hop's own `x exercise --json`, listed (and printed) before the gate's findings; each `fix` pastes as written. `reported: false`: the hop's CLI answered no exercise document — unknown, never a finding |
1791
- | `verify` | `{ ok, summary, failed[], findings[] }`, each finding `{ step?, code, cause, fix, at? }` |
1845
+ | `verify` | `{ ok, summary, failed[], findings[], only?, notRun? }`, each finding `{ step?, code, cause, fix, at? }`. `only[]` and `notRun[]` only under `--only`: the steps run, and the gate's steps this hop did not run |
1792
1846
  | `codemods` | `As of 2026-11-15`: `{ from, to, dryRun, source, applied[] }`, each `applied[]` a codemod that ran: `{ id, since, summary, changed[], skipped[] }`; a `skipped[]` entry is `{ path, reason, diff? }`, a file the codemod would not overwrite (the app edited it), with the template's change as a unified diff to make by hand. `source: installed` — the hop's own CLI applied its list; `driver` — that CLI predates codemods, so this one applied its own. `reinstalled: true` — a `package.json` differs after the codemods (read byte for byte, never off a codemod's report), so the hop ran `bun install` again before any gate stage; `x upgrade codemods` does the same by hand. `failure: { code, cause, fix }` — the installed CLI's codemods run failed for a reason other than lacking the subcommand: nothing applied, this CLI does not stand in, and the hop is not done. `null`: no app, or already at the target, where no codemod runs (`As of 2026-11-18`; `x upgrade codemods --from 0.0.0 --json` carries an app still holding an old template's copy) |
1793
1847
  | `superseded[]` | `As of 2026-11-15`: a workaround the hop's framework made unnecessary, read after the codemods — `{ code: X_SUPERSEDED_WORKAROUND, cause, fix, at }`. A warning, never the verdict |
1794
1848
  | `then` | the next thing to do, in a sentence naming the commands |
@@ -2066,6 +2120,8 @@ command rather than quoting the line. `docs` is `ERROR_DOCS_URL`, the same URL f
2066
2120
 
2067
2121
  `list` enumerates every registered code, and names under `data.unavailable` any package this process could not import — a list silently missing codes is worse than one that says which. An unregistered code is `X_ERROR_CODE_UNKNOWN` with the nearest real code as its fix; the command never invents an explanation.
2068
2122
 
2123
+ **An app's own codes answer inside the app** (`As of 2026-11-19`, `packages/cli/src/cmd-errors-app.ts`). A code the framework does not know is looked up after `loadApp` registers the app's `defineError()` declarations: the answer is the registered title, the `cause:` / `fix:` read off the declaration's text (never by constructing the error), `status`, and the declaring `file:line` as `site`; `--json` carries `{ code, title, cause, fix, docs, status, site }`. Framework codes pay no load. A near miss of a framework code keeps its suggestion. Otherwise `X_ERROR_CODE_UNKNOWN`, its fix inside an app `grep -rn <CODE> apps packages`, outside one `x errors list --json` naming the `--cwd` form.
2124
+
2069
2125
  ## x repro
2070
2126
 
2071
2127
  ```bash
@@ -2137,7 +2193,7 @@ x docs "<question|topic|symbol>" [--limit <n>] [--json]
2137
2193
  | this wiki, shipped in the `@ultimat3/cli` tarball (`wiki/`) — every page but Error codes | `wiki.<Page>`, `wiki.<Page>#<anchor>`, the anchor GitHub renders |
2138
2194
  | an `X_*` code | redirected to `x errors explain <CODE>`, the one way to a code |
2139
2195
 
2140
- A question is ranked; a `Page#anchor` topic (`x docs Upgrading#28x--2900-entry-by-entry`) prints that **whole section**, subsections included, and nothing past it. `x upgrade --json`'s `section.local` is that topic. A search hit carries a capped excerpt.
2196
+ A question is ranked; a `Page#anchor` topic (`x docs Upgrading#28x--2900-entry-by-entry`) prints that **whole section**, subsections included, and nothing past it. **`x docs <topic-id>`** (`As of 2026-11-19`) prints one topic's body: the id is what every search line starts with — `jobs.retry` (a module: its header comment, its exports, its file), `jobs.README#one-job-per-org-from-a-schedule` (a package guide: that whole section, subsections included), `wiki.Upgrading#<anchor>` (a wiki section). Quote an id that carries `#`. A search's last line is the command for its first hit (`x docs jobs.retry # any topic id above prints that section whole`); a query that is exactly a topic id answers that topic alone, not a ranked search. `x upgrade --json`'s `section.local` is that topic. A search hit carries a capped excerpt.
2141
2197
 
2142
2198
  A question is ranked by its task words too (`As of 31.22`): a synonyms table maps a word that names one task to the mechanism that does it — `paginate` → `keyset`, `poll`/`interval` → `pollEvery`/`visibleInterval`, `concurrency` → `mapBounded`, `latest` → `latestBy`, `typing` → `debounce`, `advisory` → `lockKeys`, `denormalize` → `countedIn`, `memoize` → `retryMemo` — and a page that exports the mechanism outranks prose about the task. The dev MCP's `docs.search` is this command.
2143
2199
 
@@ -2151,6 +2207,8 @@ x fix boundary <file> [--json]
2151
2207
 
2152
2208
  The minimal cut for an import that crossed a surface boundary — the command every `X_SURFACE_BOUNDARY` finding names in its `fix:` line. It prints a plan and **writes nothing**; there is no `--write`.
2153
2209
 
2210
+ `site-imports-app` (`X_BOUNDARY_SITE_TO_APP`) is one finding per crossing edge — the first import in the chain that lands on `app/` — reported at the file that writes it, with the chain from the `site/` entry in `cause`. Imports below the crossing are `app/ → app/` and are never reported, by the gate or here: one illegal import is one finding and one edit (`As of 2026-11-19`; `classify()`, `packages/render/src/surfaces.ts`).
2211
+
2154
2212
  For each violation involving the file it reports the offending edge, the full chain that makes it one, and the edit to make. For the `shared/` fattening case it generates the split: when exactly one surface reaches the module **and the module lands on the same surface as the file it imports**, the plan carries the `git mv` plus every import specifier that move invalidates — the move alone is not a repair, it just relocates the break. When two surfaces reach it, or when relocating would leave the forbidden edge exactly where it was, the module has to be cut by hand and the plan says so rather than guessing.
2155
2213
 
2156
2214
  `<file>` is app-root-relative, or any suffix that matches exactly one source file — the short form a `fix:` line emits. Errors: `X_FIX_TARGET_UNKNOWN` (with the nearest real path as its fix), `X_CLI_BAD_FLAG` on an ambiguous suffix.
@@ -2167,14 +2225,23 @@ For each violation involving the file it reports the offending edge, the full ch
2167
2225
 
2168
2226
  Every flag is read before the database opens: a refusal costs no boot.
2169
2227
 
2228
+ ## x merge-driver
2229
+
2230
+ `As of 2026-11-19`. `x merge-driver install [--json]` · `x merge-driver run <base> <ours> <theirs> <path>` — how two branches that each generated a feature merge with no hand edit. The rules and what stays a conflict: [Merging two features](Many-Agents#merging-two-features).
2231
+
2232
+ | Form | Does |
2233
+ |---|---|
2234
+ | `x merge-driver install` | writes `merge.x-registry.*` and `merge.x-generated.*` into `.git/config`; `data.installed: false` outside a git checkout. `bun run setup` runs it; `x doctor` warns `X_MERGE_DRIVER_UNSET` where it never ran |
2235
+ | `x merge-driver run` | what git invokes, with its temporary files. Exit 0 merged; exit 1 left the markers in the file and reports `X_MERGE_UNRESOLVED` |
2236
+
2170
2237
  ## x heavy
2171
2238
 
2172
- `As of 2026-11-18`. `x heavy [status] [--json]` · `x heavy run [--label s] [--mb n] [--json] -- <command…>` — the machine ledger every heavy run on this machine reserves its measured memory in, from any directory, in any repository. The rules, the weights and what stays outside: [Working with many agents](Many-Agents).
2239
+ `As of 2026-11-18`. `x heavy [status] [--json]` · `x heavy run [--label s] [--mb n] [--max-wait s] [--json] -- <command…>` — the machine ledger every heavy run on this machine reserves its measured memory in, from any directory, in any repository. The rules, the weights and what stays outside: [Working with many agents](Many-Agents).
2173
2240
 
2174
2241
  | Form | Answers |
2175
2242
  |---|---|
2176
- | `x heavy` / `x heavy status` | `data.holds` and `data.queue` (label, directory, MB, pid, age), `data.capacityMb`, `data.usedMb`, `data.coreCap`, `data.machine` (load, runnable tasks, available and usable memory); `data.enabled: false` with `data.off` naming why (`ci`, `test-run`, `disabled`, `unsupported`) |
2177
- | `x heavy run -- <command…>` | runs it inside one reservation of `--mb` (default: a monorepo typecheck). Exit code passed through, `128 + n` for a signal, 127 and `X_HEAVY_COMMAND_NOT_FOUND` for no such program. SIGTERM and SIGHUP are forwarded. Its summary goes to stderr, so stdout stays the command's; with `--json` the one document is on stdout and the command's stdout moves to stderr |
2243
+ | `x heavy` / `x heavy status` | `data.holds` and `data.queue` (label, directory, MB, pid, age; a hold adds `wrapperAlive` and `childPids`, the processes keeping it after its wrapper is gone), `data.capacityMb`, `data.usedMb`, `data.coreCap`, `data.cpuGate` (whether CPU pressure holds new runs back here), `data.machine` (load, runnable tasks, available and usable memory, `cpu`: `source` `psi`/`runnable`, `value`, `limit`, `busy`); `data.enabled: false` with `data.off` naming why (`ci`, `test-run`, `disabled`, `unsupported`) |
2244
+ | `x heavy run -- <command…>` | runs it inside one reservation of `--mb` (default: a monorepo typecheck). Exit code passed through, `128 + n` for a signal, 127 and `X_HEAVY_COMMAND_NOT_FOUND` for no such program. SIGTERM and SIGHUP are forwarded. Its summary goes to stderr, so stdout stays the command's; with `--json` the one document is on stdout and the command's stdout moves to stderr. `--max-wait <seconds>` (`0` to `604800`) bounds the queue: past it the command never starts, `X_HEAVY_WAIT_EXPIRED`, exit 75, `data.started: false` |
2178
2245
 
2179
2246
  ## x status
2180
2247
 
@@ -114,7 +114,7 @@ export const publishPost = action({
114
114
  |---|---|---|
115
115
  | Tier 1 request memo | drop entries carrying the tag | immediate, same request |
116
116
  | Tier 2 in-process LRU (**all instances**) | tag-invalidation message on NATS | ~ms, best-effort; a missed message costs a stale read until TTL, never a wrong write |
117
- | Tier 3 Redis | paged `ZSCAN` over the tag's sorted set, `UNLINK` per value key, `ZREM` of what died | immediate, inside the fan-out; 10k keys in 25 round trips |
117
+ | Tier 3 Redis | paged `ZSCAN` over the tag's sorted set, `ZREM` of what was read, `UNLINK` per value key, re-`ZADD … GT` (at its read score, never lowering a later fill's; Redis ≥ 6.2) of any member whose `UNLINK` was refused. Sweep before delete, `As of 2026-11`: a fill from another replica landing mid-bust can no longer be left in no bucket, stale for its whole TTL. An inbound broadcast skips this shared tier only when the sender's frame names the same namespace (same build); another build's, or an older pod's, busts it. `As of 2026-11-19` | immediate, inside the fan-out; 10k keys in 25 round trips |
118
118
  | ISR pages | routes whose `revalidate.tags` include the tag are marked stale → regenerated in background | next request serves stale, regen enqueued as a job |
119
119
  | CDN | purge by surrogate key through the configured `PurgeDriver` — a row bust purges `post:1` and `post`, a collection bust `e:post` and `post` | seconds; `stale-while-revalidate` covers the gap |
120
120
  | Live queries | the same commit already flows through logical replication | **independent path** — realtime does not depend on cache invalidation |
@@ -420,7 +420,7 @@ island that drops markup holding other islands (`As of 2026-10`, [Client data](C
420
420
 
421
421
  | Call | With the router | Without it (a `site/` page, a `'document'` page, the router's script blocked) |
422
422
  |---|---|---|
423
- | `navigate(url, { replace? })` | the router's own navigation: the server's gate and the answer decide swap, modal or full load. Another origin: a document load | `location.assign` / `location.replace` |
423
+ | `navigate(url, { replace? })` | the router's own navigation: the server's gate and the answer decide swap, modal or full load. Another origin: a document load. A fragment of the page on screen (same path and query, `#…`): the browser's own fragment navigation — it scrolls, fires `hashchange`, and no `ultimate:navigate` / `ultimate:navigated` (`As of 2026-11-19`; it refetched and swapped the page, disposing its islands) | `location.assign` / `location.replace` |
424
424
  | `refresh()` | the page fetched again (never from the prefetch cache) and swapped in with no history entry, at the visitor's scroll — for the same visitor: [below](#refresh-is-the-same-page). Under an open modal: nothing | `location.reload()` |
425
425
  | `scheduleRefresh()` | a `refresh()` once the visitor is idle, coalesced: [below](#scheduling-a-refresh) | nothing — a reload under a reader is the failure it prevents |
426
426
  | `openModal(path)` | `#<path>` over the page, pushed, so Back closes it. A path that is not a modal of this tab opens nothing, as a stale hash | `location.assign(path)`: the modal route's whole page |
@@ -48,7 +48,7 @@ Everything derivable from code is **not** in this file — routes, actions, poli
48
48
  | ~~`defaultTimeZone`~~ | — | — | **Deleted in 25.0.0** — read by nothing but its own validator, and an ambient zone is what the framework forbids. Pass the zone at the call: `formatDate(at, { locale, zone })`, `task({ tz })`, the actor's `tz` (`userActor({ id, locale, tz })`). Refused at boot like the two above |
49
49
  | ~~`defaultCurrency`~~ | — | — | **Deleted in 25.0.0** — read by nothing; every `Money` carries its own `currency`. An app that wants a default declares its own constant. Refused at boot like the three above |
50
50
  | `theme.defaultMode` | `'light' \| 'dark' \| 'system'` | `'system'` | what a visitor with no stored choice gets. The boot inlines the no-flash theme script into every document with this as its fallback and admits it to the CSP — `As of 20.2.0`; before that the key was read by nothing. ~~`theme.tokens`~~ was **deleted in 25.0.0** (read by nothing; the theme is `export const brand = defineTheme(…)` from `@ultimat3/ui` in `apps/web/shared/theme.ts`) and is refused at boot |
51
- | `roles` | `Role[]` | every `ROLE` | which runtime roles this app runs. Empty is `X_CONFIG_INVALID` |
51
+ | `roles` | `Role[]` | every `ROLE` | which runtime roles this app runs. A process started with a `ROLE` outside the list refuses to boot (`X_CONFIG_INVALID`, `meta.key: 'roles'`); `ROLE=migrate` is exempt, so `x db migrate` runs whatever the list says. Unset, every role may start. Empty is `X_CONFIG_INVALID`. `As of 2026-11` (before, the list was validated and read by nothing) — `packages/cli/src/serve-env.ts` |
52
52
 
53
53
  There is no `url` field. The canonical origin is an env key the app reads at its point of use (`APP_URL`), so the same image deploys to every environment.
54
54
 
@@ -59,11 +59,11 @@ There is no `url` field. The canonical origin is an env key the app reads at its
59
59
  | field | type | default | notes |
60
60
  |---|---|---|---|
61
61
  | `database.driver` | `'postgres'` | `'postgres'` | one driver; `postgresDriver()` from `@ultimat3/entity` is its only implementation |
62
- | `database.ssl` | `boolean` | `false` | `true` on managed Postgres |
62
+ | `database.ssl` | `boolean` | `false` | `true` on managed Postgres: the pool the boot opens (every serving role, `x dev`, the migrate step, `x db status`/`recount`/`diagnostics`) adds `sslmode=require` to `DATABASE_URL` and its replica's URL, so a server with no TLS is refused. Added only where no mode is stated: a URL's own `sslmode` (or `ssl`) and a set `PGSSLMODE` always win, in either direction; an empty `sslmode=` states nothing, and the names match case-insensitively (`As of 2026-11-19`) (`withRequiredTls`, `packages/cli/src/runtime-database-ssl.ts`). The same rule reaches every other pool, `As of 2026-11-19`: the replicator's `DATABASE_URL` and `REPLICATION_URL` sessions, `x doctor`'s database probes, `x db branch` and `x deploy verify`'s queue read (`withAppTls`). The embedded database has no wire and ignores it. `As of 2026-11`; before, the key was read by nothing |
63
63
  | `database.rowSecurity` | `boolean` | `false` | every `tenant:` table carries a forced row-security policy (`x db gen`), and a serving role Postgres exempts from it is refused at boot (`X_DB_ROW_SECURITY_BYPASSED`) |
64
64
  | `database.slowStatementMs` | whole ms ≥ 0 | unset: 500 | `As of 31.17.0`. A statement at or over it writes one `db.statement.slow` warn line in **production** — the normalised shape (never a bound value), duration, rows, the request/job id; one line per shape per 10 s, the rest counted as `suppressed`. `0` is off; `NaN`, a negative or a fraction is `X_CONFIG_INVALID` at boot. Outside production the line is off whatever the key says: a test suite's deliberately slow statements are not an incident |
65
65
  | ~~`database.urlEnv`~~ | — | — | **Deleted 2026-08.** Refused at boot since 25.0.0 (`X_CONFIG_INVALID`, naming the replacement). `@ultimat3/db`'s `client.ts` reads `process.env['DATABASE_URL']` as a hardcoded literal, so a different key here could never be honoured. Migration: delete the key; the connection string is `DATABASE_URL` |
66
- | ~~`database.poolSize`~~ | — | — | **Deleted 2026-08.** Refused at boot since 25.0.0 (`X_CONFIG_INVALID`, naming the replacement). A second, non-functioning spelling of `DATABASE_POOL_MAX`, which `baseClient()` layers over the role profile and which works. Migration: delete the key; set `DATABASE_POOL_MAX`. The sizing rule is unchanged — the pool is per PROCESS, so keep `replicas × poolMax` under Postgres `max_connections` |
66
+ | ~~`database.poolSize`~~ | — | — | **Deleted 2026-08.** Refused at boot since 25.0.0 (`X_CONFIG_INVALID`, naming the replacement). A second, non-functioning spelling of `DATABASE_POOL_MAX`, which `baseClient()` layers over the role profile and which works. Migration: delete the key; set `DATABASE_POOL_MAX`. The sizing rule: the pool is per CONTAINER (`As of 2026-11`: split across its processes, never multiplied — [Processes per container](Deployment#processes-per-container)), so keep `replicas × poolMax`, plus one LISTEN session per worker process, under Postgres `max_connections`; `x doctor` prints both per role |
67
67
  | ~~`database.schema`~~ | — | — | **Deleted 2026-08.** Refused at boot since 25.0.0 (`X_CONFIG_INVALID`, naming the replacement). Nothing emits `SET search_path`. Migration: delete the key; there is no replacement, and `entity()` tables live in `public` |
68
68
 
69
69
  Wiring the three instead would have needed a tier-0 → tier-1 read the tier table forbids. Deleting is axiom 3 applied to configuration: a value that produces neither a build error nor a runtime effect is worse than no field, because an SRE sets `poolSize: 3`, redeploys, and nothing changes.
@@ -134,10 +134,10 @@ There is no `auth.trustedOrigins` in either place, and passkeys are `defineAuth`
134
134
  |---|---|---|---|
135
135
  | ~~`jobs.driver`~~ | — | — | **Deleted in 5.0.0.** It accepted `'postgres' \| 'redis' \| 'nats'` and was read by nothing: boot always built the Postgres driver, so `jobs: { driver: 'redis' }` did not throw, did not warn, and silently gave you Postgres. Which driver runs is `jobs:` in `apps/<app>/runtime.ts` and only that — absent, the boot installs `postgresJobDriver()`; a test uses `installJobDriver(memoryJobDriver())` from `@ultimat3/jobs/adapter` ([Jobs and workflows](Jobs-And-Workflows)). Since 25.0.0 a config still writing it is refused at boot, `X_CONFIG_INVALID` naming that seam |
136
136
  | `jobs.queues` | `string[]` | `['default']` | the queue a `job()` naming none lands on (`['<name>-default']` until 31.0.0). A `worker` serves these **and** every queue a registered `job()` is enqueued on (the union, so a job naming no queue is never stranded on `default`). A Deployment that sets [`WORKER_QUEUES`](#env-vars) serves exactly that list instead. Empty is `X_CONFIG_INVALID` |
137
- | `jobs.concurrency` | `number \| Record<queue, number>` | `8` (`JOBS_CONCURRENCY_DEFAULT`) | slots per queue, per worker process. A number applies to every queue served; a table gives each its own (`{ banks: 4, 'banks-long': 2 }`), and a served queue the table does not name runs at `8`. `As of 25.0.0`. A count below 1 or not whole, an empty table or a blank queue name is `X_CONFIG_INVALID` naming the entry (`jobs.concurrency.banks`). An overlay's table replaces the base's whole |
138
- | `jobs.maxInFlight` | `number` | unset (no process cap) | runs one worker **process** holds at once across every queue it serves — Sidekiq's `concurrency`; `jobs.concurrency` still bounds each queue under it. At the cap the worker claims nothing; each run that ends frees one claim, given to the next queue in turn that has work, so no queue starves. `jobWorker`'s `maxInFlight`. `As of 2026-10-28`. Not a whole number of at least 1: `X_CONFIG_INVALID` |
139
- | `jobs.maxAttempts` | `number` | `5` | per-job `retry` overrides it |
140
- | `jobs.backoff` | `'exponential' \| 'fixed'` | `'exponential'` | **two values, not three** — there is no `'linear'` |
137
+ | `jobs.concurrency` | `number \| Record<queue, number>` | `8` (`JOBS_CONCURRENCY_DEFAULT`) | slots per queue, per worker **container** (`As of 2026-11`): a container running N processes splits each total across them, and a queue whose total is below N is served only by the children with index < total, so `concurrency: 1` stays serial across the container. One process per container (every container without a CPU budget) is the old meaning exactly. A number applies to every queue served; a table gives each its own (`{ banks: 4, 'banks-long': 2 }`), and a served queue the table does not name runs at `8`. `As of 25.0.0`. A count below 1 or not whole, an empty table or a blank queue name is `X_CONFIG_INVALID` naming the entry (`jobs.concurrency.banks`). An overlay's table replaces the base's whole |
138
+ | `jobs.maxInFlight` | `number` | unset (no cap) | runs one worker **container** holds at once across every queue it serves, split across its processes as `jobs.concurrency` is (`As of 2026-11`; a process past the total claims nothing) — Sidekiq's `concurrency`; `jobs.concurrency` still bounds each queue under it. At the cap the worker claims nothing; each run that ends frees one claim, given to the next queue in turn that has work, so no queue starves. `jobWorker`'s `maxInFlight`. `As of 2026-10-28`. Not a whole number of at least 1: `X_CONFIG_INVALID` |
139
+ | `jobs.maxAttempts` | `number` | `3` | attempts for a job that declares no `retry` — a factory's job whose `retry` was omitted (`purge()`, `backfill()`, `rollup()`, …). A plain `job()` requires `retry.attempts`, so it always states its own and this key never reaches it. Installed by the boot in every role (`installJobsRetry`, `packages/cli/src/runtime-jobs.ts`): the enqueuing process stamps `max_attempts` by the same policy the worker retries by. `As of 2026-11` (documented as `5` before, a value nothing read: 3 is what always ran). Below 1 or not whole: `X_CONFIG_INVALID` |
140
+ | `jobs.backoff` | `'exponential' \| 'fixed'` | `'exponential'` | the curve between attempts of a job that declares no `retry`, **and** of a `retry` that names no `backoff` (`retry: { attempts: 5 }` takes it); a job's own `retry.backoff` wins (`resolvedRetry`, `packages/jobs/src/retry-default.ts`, `As of 2026-11`). **Two values, not three** — there is no `'linear'` here; a job's own `retry.backoff` may still say `'linear'` |
141
141
  | `jobs.visibilityTimeoutMs` | `number` | `30000` | milliseconds, not a duration string. Lease length; expiry is how a killed worker's job resumes |
142
142
  | `jobs.doneRetentionMs` | `number` | `1209600000` (14 days, `JOBS_DONE_RETENTION_MS_DEFAULT`) | age (from the row's last settle, `updated_at`) past which the hourly `x.purge` deletes a `done` job and its `x_job_steps`. Batched: at most 50 batches of 1,000 rows per pass, each batch one statement plus a follow-up when two sweeps split a run, and one statement per pass for step records whose run has no row left. A job input can hold personal data (`mail.send`: the address and the body), so this has a default, unlike the inbox windows. `As of 2026-10-17` |
143
143
  | `jobs.deadRetentionMs` | `number` | `7776000000` (90 days, `JOBS_DEAD_RETENTION_MS_DEFAULT`) | the same for `dead`, `failed` and `cancelled` rows, which staff read to explain a failure. A live row (`ready`, `delayed`, `running`, `suspended`) is never deleted, and neither is one an unpublished `x_outbox` row or a `running` `x_backfills` row still names. Not a whole number of at least 1: `X_CONFIG_INVALID` |
@@ -226,7 +226,7 @@ its config into a variable first.
226
226
 
227
227
  | field | type | default | notes |
228
228
  |---|---|---|---|
229
- | `cache.defaultTtlMs` | `number` | `60000` | milliseconds, not a duration string |
229
+ | `cache.defaultTtlMs` | `number` | `60000` | milliseconds, not a duration string, at least 1 (`0` is `X_CONFIG_INVALID`: no rung holds a lease of no length). The lease of a value set with no `ttlMs`, on the `lru` and `redis` rungs the boot builds; a rung supplied in `runtime.ts`'s `cacheTiers` keeps its own |
230
230
  | `cache.tiers` | `CacheTierName[]` | `['request-memo', 'lru']` | `'request-memo' \| 'lru' \| 'redis' \| 'cdn'`; order is fixed regardless of listing order, an EMPTY list is refused (`X_CONFIG_INVALID`), and a rung the environment cannot supply refuses the boot |
231
231
  | ~~`cache.driver`~~ | — | — | **Deleted in 9.0.0.** Refused at boot since 25.0.0 (`X_CONFIG_INVALID`, naming the replacement). It was the second way to ask for Redis and the losing one: the ladder is built from `cache.tiers`, so `driver: 'redis'` beside `tiers: ['request-memo', 'lru']` asked for a rung nothing built. Name `redis` in `tiers` |
232
232
  | ~~`cache.urlEnv`~~ | — | — | **Deleted in 9.0.0** and refused at boot since 25.0.0, `database.urlEnv`'s defect verbatim: the Redis tier reads the literal `REDIS_URL`, so `urlEnv: 'MY_REDIS'` made nothing read `MY_REDIS` |
@@ -340,7 +340,7 @@ Only the exact environment `production` emits the configured robots groups and a
340
340
 
341
341
  ## `pwa`
342
342
 
343
- `offline` is a **block**, not a string, `As of 2026-08` — see [Upgrading](Upgrading). Three booleans, two blocks; every field is optional except `pwa.name`, `pwa.colors` and `pwa.offline.fallback`, which `enabled: true` makes required, and `pwa.vapid.subject`, which a `pwa.vapid` block does.
343
+ `offline` is a **block**, not a string, `As of 2026-08` — see [Upgrading](Upgrading). Three booleans, two blocks. Each switch — `enabled`, `backgroundSync`, `push` — must be a real `boolean`, checked even when `enabled` is false: `'false'`, `'true'` or `1` is `X_CONFIG_INVALID` (`As of 2026-11-19`; before, `enabled: 'false'` turned the PWA **on**). `pwa.categories` must be a list of strings, `pwa.offline.neverCache` entries strings, and `pwa.shortcuts` / `pwa.screenshots` lists, else `X_CONFIG_INVALID`. Every field is optional except `pwa.name`, `pwa.colors` and `pwa.offline.fallback`, which `enabled: true` makes required, and `pwa.vapid.subject`, which a `pwa.vapid` block does.
344
344
 
345
345
  ```ts
346
346
  pwa: {
@@ -783,6 +783,7 @@ One typed schema, declared with `defineEnv` at module scope **in `app.config.ts`
783
783
  | `ULTIMATE_STATE_DIR` | all, under `x dev` | no — default `<app>/.x` | relocates the whole of `.x/` (the embedded database, the local disk, the dev lock) for one process tree. The e2e step uses it to boot the app on a throwaway database beside a running `x dev` (`packages/cli/src/runtime-bindings.ts`). 21.0.0 |
784
784
  | `SYNC_URL` | `web` | no — unset dials `/_x/sync` on the page's own origin | where the page's one socket dials, rendered into every document as `<meta name="ultimate-sync">`. Must be `ws://` or `wss://`; anything else is `X_CONFIG_INVALID` at boot. **Required on the Compose rung**, where `sync` is published on its own port with no proxy in front: `SYNC_URL=ws://<host>:3001/_x/sync`. The shipped compose file refuses to start `web` without it. `x dev`, a combined-role container and the Helm chart's ingress all serve `/_x/sync` on the page origin, so they need nothing. `As of 2026-09-22` (21.0.0) |
785
785
  | `WORKER_QUEUES` | `worker` | no — unset or blank serves `jobs.queues` plus every registered job's queue | comma-separated, trimmed, deduplicated. Set, it is the EXACT list this worker claims — `jobs.queues` and the registered queues are not added (`As of 25.0.0`; documented here before then and read by nothing). An empty entry (`banks,,long`) is `X_CONFIG_INVALID` at boot; an entry that is neither in `jobs.queues` nor a registered job's queue — a typo, or a pattern such as `banks-*`, which is never expanded — is `X_WORKER_QUEUE_UNKNOWN` at worker start (`As of 29.0.0`). See [Splitting queues across Deployments](#jobs) |
786
+ | `ULTIMATE_PROCESSES` | `web`, `sync`, `worker` | no — unset, blank or `auto` | `As of 2026-11`: how many processes this production container runs on its one port. `auto` is the container's CPU quota in whole CPUs (1 with none declared), clamped by memory at 256 MiB per process, the pool, per-process state and the platform; a positive whole number is honoured and checked. Anything else is `X_PROCESSES_INVALID`. `x dev`, tests and every environment but `production`/`staging` run one process. Every clamp and refusal: [Processes per container](Deployment#processes-per-container) |
786
787
  | `NATS_URL` | `sync`, `replicator` | no — unset is in-process fanout | one node only; a second replica shares nothing. Unreachable → `X_TRANSPORT_UNAVAILABLE` at boot, not at readiness |
787
788
  | `NATS_KV_BUCKET` | `sync` | no — default `x_presence` | the JetStream KV bucket presence lives in. `[a-zA-Z0-9_-]+`; anything else is `X_TRANSPORT_PROTOCOL` at boot |
788
789
  | `REPLICATION_URL` | `replicator` | no — defaults to `DATABASE_URL` | the connection the WAL is read from; this role must have `REPLICATION` privilege |