@ultimat3/cli 31.48.0 → 31.50.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.
- package/CLAUDE.md +30 -23
- package/README.md +96 -4
- package/package.json +30 -30
- package/src/api-registration.ts +45 -14
- package/src/api-routes.ts +1 -0
- package/src/app-load.ts +7 -3
- package/src/app-openapi.ts +7 -1
- package/src/app-root.ts +7 -1
- package/src/budgets.ts +2 -1
- package/src/clean-services.ts +142 -0
- package/src/cmd-auth.ts +3 -0
- package/src/cmd-clean-spec.ts +10 -3
- package/src/cmd-clean.ts +23 -9
- package/src/cmd-db-backfill.ts +6 -0
- package/src/cmd-db-branch.ts +10 -4
- package/src/cmd-db-recount.ts +5 -12
- package/src/cmd-db-rollback.ts +77 -0
- package/src/cmd-db-spec.ts +18 -2
- package/src/cmd-db-status.ts +5 -10
- package/src/cmd-db.ts +105 -33
- package/src/cmd-deploy-verify.ts +14 -6
- package/src/cmd-docs-topic.ts +94 -0
- package/src/cmd-docs.ts +15 -1
- package/src/cmd-doctor.ts +109 -41
- package/src/cmd-drill.ts +80 -18
- package/src/cmd-env.ts +30 -8
- package/src/cmd-errors-app.ts +63 -0
- package/src/cmd-errors.ts +50 -14
- package/src/cmd-generate.ts +17 -4
- package/src/cmd-heavy-spec.ts +9 -1
- package/src/cmd-heavy.ts +111 -27
- package/src/cmd-i18n.ts +33 -1
- package/src/cmd-jobs.ts +27 -1
- package/src/cmd-merge-driver-spec.ts +12 -0
- package/src/cmd-merge-driver.ts +95 -0
- package/src/cmd-new.ts +23 -3
- package/src/cmd-policy-spec.ts +9 -1
- package/src/cmd-policy.ts +72 -17
- package/src/cmd-stop.ts +18 -4
- package/src/cmd-tasks-run.ts +87 -0
- package/src/cmd-tasks-spec.ts +10 -3
- package/src/cmd-tasks.ts +8 -5
- package/src/cmd-test.ts +2 -1
- package/src/cmd-upgrade-spec.ts +8 -1
- package/src/cmd-upgrade.ts +15 -1
- package/src/cmd-verify.ts +9 -41
- package/src/codemods/agents-doc-row.ts +73 -0
- package/src/codemods/define-error-leaf.ts +37 -12
- package/src/codemods/docs-many-agents.ts +11 -15
- package/src/codemods/docs-worker-commands.ts +26 -0
- package/src/codemods/engine-fs.ts +9 -2
- package/src/codemods/index.ts +4 -0
- package/src/codemods/merge-drivers.ts +147 -0
- package/src/command.ts +3 -0
- package/src/db-applied-edits.ts +117 -0
- package/src/db-dev-wire.ts +18 -0
- package/src/db-diagnostics.ts +5 -10
- package/src/db-generate.ts +82 -7
- package/src/db-migrate-pass.ts +51 -0
- package/src/db-migrate-through-dev.ts +209 -0
- package/src/db-rollback-consent.ts +128 -0
- package/src/db-rollback-pass.ts +76 -0
- package/src/db-seed-generate.ts +5 -1
- package/src/db-seed.ts +7 -1
- package/src/deploy-verify-findings.ts +3 -0
- package/src/deploy-verify-grade.ts +3 -0
- package/src/deploy-verify-processes.ts +32 -0
- package/src/dev-boot.ts +3 -0
- package/src/dev-db-migrate.ts +155 -0
- package/src/dev-db-rollback.ts +33 -0
- package/src/dev-db-settled.ts +22 -0
- package/src/dev-lock-errors.ts +78 -0
- package/src/dev-lock-holder-dir.ts +64 -0
- package/src/dev-lock-live.ts +44 -0
- package/src/dev-lock.ts +59 -84
- package/src/dev-policy.ts +11 -8
- package/src/dev-rebuild-schema.ts +116 -13
- package/src/dev-rebuild.ts +13 -4
- package/src/dev-route-table.ts +7 -0
- package/src/dispatch.ts +21 -1
- package/src/doctor-api-listing.ts +114 -0
- package/src/doctor-guarded.ts +41 -0
- package/src/doctor-port.ts +90 -17
- package/src/doctor-probe.ts +36 -5
- package/src/doctor-processes-probe.ts +127 -0
- package/src/doctor-processes.ts +136 -0
- package/src/doctor-warnings.ts +17 -0
- package/src/error-codes-agents.ts +35 -0
- package/src/error-codes-processes.ts +30 -0
- package/src/error-codes-tooling.ts +2 -0
- package/src/error-codes.ts +12 -13
- package/src/errors-suite.ts +27 -0
- package/src/errors.ts +18 -22
- package/src/exercise-registration.ts +4 -3
- package/src/exercise-services.ts +13 -3
- package/src/framework-env.ts +7 -3
- package/src/framework-schema.ts +15 -5
- package/src/generate-files.ts +1 -0
- package/src/generate-grant-findings.ts +7 -5
- package/src/generate-grants.ts +9 -8
- package/src/generate-kinds.ts +30 -6
- package/src/generate-roles-file.ts +30 -0
- package/src/generate-slice-policy.ts +3 -3
- package/src/guard-sources.ts +1 -2
- package/src/guards.ts +2 -2
- package/src/heavy-env.ts +2 -0
- package/src/heavy-errors.ts +18 -0
- package/src/heavy-holders.ts +78 -0
- package/src/heavy-ledger.ts +56 -14
- package/src/heavy-pressure.ts +104 -0
- package/src/heavy.ts +31 -13
- package/src/i18n-registration.ts +22 -2
- package/src/island-harness.ts +2 -2
- package/src/job-budget.ts +4 -2
- package/src/job-registration.ts +64 -8
- package/src/jobs-queue-known.ts +43 -0
- package/src/mcp-errors-agents.ts +20 -0
- package/src/mcp-errors-doctor.ts +27 -0
- package/src/mcp-errors-processes.ts +23 -0
- package/src/mcp-errors.ts +15 -29
- package/src/mcp-host.ts +2 -2
- package/src/merge-driver-catalog.ts +58 -0
- package/src/merge-driver-config.ts +43 -0
- package/src/merge-driver-lines.ts +140 -0
- package/src/merge-state.ts +105 -0
- package/src/messages-db.ts +22 -1
- package/src/messages-processes.ts +13 -0
- package/src/messages-upgrade.ts +10 -0
- package/src/messages.ts +54 -4
- package/src/output-findings.ts +48 -21
- package/src/page-navigation.ts +5 -2
- package/src/parse.ts +37 -6
- package/src/policy-facts.ts +38 -21
- package/src/policy-row.ts +99 -0
- package/src/port-pair-free.ts +28 -0
- package/src/pwa-artifacts.ts +1 -1
- package/src/registry-lines.ts +110 -0
- package/src/registry.ts +2 -0
- package/src/retain-sweep.ts +1 -1
- package/src/retained-assets-boot.ts +1 -1
- package/src/role-replicator.ts +4 -1
- package/src/role-select.ts +86 -0
- package/src/role-start.ts +13 -55
- package/src/role-sync.ts +10 -5
- package/src/runtime-assets-site.ts +2 -2
- package/src/runtime-assets.ts +1 -1
- package/src/runtime-cache-frame.ts +46 -0
- package/src/runtime-cache-ttl.ts +23 -0
- package/src/runtime-cache.ts +33 -16
- package/src/runtime-database-ssl.ts +84 -0
- package/src/runtime-idempotency-scope.ts +16 -2
- package/src/runtime-jobs-share.ts +52 -0
- package/src/runtime-jobs.ts +43 -12
- package/src/runtime-queue.ts +18 -3
- package/src/runtime-render-document.ts +1 -2
- package/src/runtime-services.ts +8 -1
- package/src/schema-drift.ts +19 -2
- package/src/schema-dump-drift.ts +4 -1
- package/src/serve-boot-probe.ts +30 -2
- package/src/serve-boot.ts +11 -1
- package/src/serve-env.ts +39 -3
- package/src/serve.ts +61 -10
- package/src/site-asset-routes.ts +2 -2
- package/src/site-assets.ts +5 -158
- package/src/stop-run-start.ts +12 -0
- package/src/supervise-boot.ts +61 -0
- package/src/supervise-cgroup.ts +84 -0
- package/src/supervise-child.ts +206 -0
- package/src/supervise-count.ts +244 -0
- package/src/supervise-errors.ts +83 -0
- package/src/supervise-facts.ts +40 -0
- package/src/supervise-messages.ts +84 -0
- package/src/supervise-policy.ts +46 -0
- package/src/supervise-pool.ts +10 -0
- package/src/supervise-probe.ts +158 -0
- package/src/supervise-run.ts +54 -0
- package/src/supervise.ts +383 -0
- package/src/sw-precache-plan.ts +1 -1
- package/src/templates/generate-purge.ts +6 -6
- package/src/templates/guard-animated-layout-property.ts +2 -2
- package/src/templates/guard-bare-error.ts +1 -1
- package/src/templates/guard-error-declared.ts +2 -2
- package/src/templates/guard-focus-visible.ts +1 -1
- package/src/templates/guard-image-dimensions.ts +2 -2
- package/src/templates/guard-island-mount-clears.ts +1 -1
- package/src/templates/guard-native-confirm.ts +1 -1
- package/src/templates/guard-raw-breakpoint.ts +2 -2
- package/src/templates/guard-raw-colour.ts +2 -2
- package/src/templates/guard-raw-fetch.ts +1 -1
- package/src/templates/guard-raw-interval.ts +1 -1
- package/src/templates/guard-raw-length.ts +3 -3
- package/src/templates/guard-raw-motion.ts +97 -1
- package/src/templates/guard-raw-shadow.ts +1 -1
- package/src/templates/guard-raw-z-index.ts +1 -1
- package/src/templates/guard-released-forms.ts +58 -9
- package/src/templates/guard-repo-await-in-loop.ts +1 -1
- package/src/templates/guard-repo-raw-sql.ts +4 -4
- package/src/templates/guard-repo-unbounded.ts +1 -1
- package/src/templates/guard-runtime-pin.ts +1 -1
- package/src/templates/guard-semantic-interactive.ts +2 -2
- package/src/templates/guard-unbounded-fanout.ts +1 -1
- package/src/templates/guard-undeclared-custom-property.ts +3 -3
- package/src/templates/guard-undefined-style-class.ts +3 -3
- package/src/templates/guard-unzoned-date.ts +3 -3
- package/src/templates/query-slice.ts +82 -0
- package/src/templates/query.ts +76 -30
- package/src/templates/resource-page.ts +3 -2
- package/src/templates/scaffold-bin.ts +2 -0
- package/src/templates/scaffold-claude-commands.ts +6 -0
- package/src/templates/scaffold-claude.ts +4 -4
- package/src/templates/scaffold-container-compose.ts +47 -7
- package/src/templates/scaffold-docs.ts +7 -3
- package/src/templates/scaffold-gitattributes.ts +18 -1
- package/src/templates/scaffold-helm-templates.ts +9 -0
- package/src/templates/scaffold-repo.ts +5 -2
- package/src/templates/scaffold-test-services.ts +33 -11
- package/src/templates/shapes/offline.ts +0 -7
- package/src/templates/shapes/realtime.ts +2 -6
- package/src/templates/sign-in-action-tests.ts +6 -4
- package/src/templates/sign-in-challenge.ts +62 -0
- package/src/templates/sign-in-oidc-mfa.ts +31 -0
- package/src/templates/sign-in-oidc.ts +11 -3
- package/src/templates/sign-in-password.ts +18 -56
- package/src/test-only-shipped.ts +29 -2
- package/src/test-shards.ts +134 -42
- package/src/test-verdict.ts +79 -0
- package/src/test-workers.ts +15 -0
- package/src/upgrade-coverage-ratchet.ts +95 -0
- package/src/upgrade-gate-codemods.ts +5 -3
- package/src/upgrade-gate.ts +42 -4
- package/src/upgrade-merge-drivers.ts +25 -0
- package/src/upgrade-report.ts +32 -4
- package/src/upgrade-scope.ts +62 -0
- package/src/verify-checks.ts +2 -8
- package/src/verify-coverage-run.ts +4 -1
- package/src/verify-e2e.ts +21 -3
- package/src/verify-live.ts +38 -14
- package/src/verify-only.ts +67 -0
- package/src/verify-progress.ts +7 -3
- package/src/verify-run.ts +20 -2
- package/src/verify-services-stack.ts +165 -0
- package/src/verify-services.ts +84 -2
- package/src/verify-test-run.ts +6 -7
- package/src/verify-tests.ts +8 -2
- package/src/verify-typecheck.ts +25 -2
- package/src/workspace-checks.ts +4 -1
- package/wiki/Actions.md +66 -3
- package/wiki/Admin-Dashboard.md +2 -2
- package/wiki/Agents.md +5 -5
- package/wiki/Auth.md +20 -6
- package/wiki/Bare-VM.md +1 -1
- package/wiki/CI-Parallel-Gate.md +2 -1
- package/wiki/CLI-Reference.md +115 -42
- package/wiki/Caching-And-Invalidation.md +1 -1
- package/wiki/Client-Navigation.md +35 -5
- package/wiki/Configuration.md +12 -10
- package/wiki/Deployment.md +44 -4
- package/wiki/Entities-And-Migrations.md +17 -3
- package/wiki/FAQ.md +1 -1
- package/wiki/Getting-Started.md +2 -2
- package/wiki/Home.md +3 -3
- package/wiki/I18n.md +6 -4
- package/wiki/Installation.md +12 -11
- package/wiki/Interface-Rules.md +3 -1
- package/wiki/Jobs-And-Workflows.md +24 -4
- package/wiki/Known-Gaps.md +2 -2
- package/wiki/MCP-And-AI.md +48 -13
- package/wiki/Many-Agents.md +69 -2
- package/wiki/Migrations-And-Backfills.md +18 -0
- package/wiki/Notify.md +5 -3
- package/wiki/Observability.md +13 -0
- package/wiki/Outbound-HTTP.md +53 -2
- package/wiki/Policies-And-Authz.md +1 -1
- package/wiki/Queries-And-Live-Queries.md +2 -2
- package/wiki/Realtime.md +24 -7
- package/wiki/Routes-And-Render-Modes.md +2 -2
- package/wiki/Scheduled-Tasks.md +4 -1
- package/wiki/Static-Assets.md +5 -3
- package/wiki/Testing.md +64 -7
- package/wiki/Theming.md +6 -3
- package/wiki/Timezones-And-Dates.md +5 -1
- package/wiki/Troubleshooting.md +1 -0
- package/wiki/Tutorial-01-First-App.md +3 -3
- package/wiki/Tutorial-02-First-Feature.md +1 -1
- package/wiki/Tutorial-03-Auth-And-Admin.md +7 -6
- package/wiki/UI-Components.md +1 -0
- package/wiki/Upgrading.md +38 -0
|
@@ -54,8 +54,9 @@ prefetch: 'intent' }` — only for a GET that does nothing but render.** A plain
|
|
|
54
54
|
unprefetched: a modal is often a form, and its GET may prepare one (a draft, a token, a reserved
|
|
55
55
|
slot). One spelling per meaning: the object takes exactly those two keys and values, anything else
|
|
56
56
|
is `X_ROUTE_NAVIGATION_INVALID`, and `{ modal: true }` alone is refused — that is `'modal'`.
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
A `navigation` key on a page of a surface `navigation.client` does not list is refused at boot,
|
|
58
|
+
since no router runs there — except `'document'`, which asks for the real load such a surface
|
|
59
|
+
already gives and is honoured on every surface (`As of 2026-11`).
|
|
59
60
|
|
|
60
61
|
An opted-in document (every page of the surface except a `'document'` one) carries:
|
|
61
62
|
|
|
@@ -66,7 +67,9 @@ An opted-in document (every page of the surface except a `'document'` one) carri
|
|
|
66
67
|
| `<script src="/_x/assets/navigation/<hash>.js" defer>` | the router: one classic script, content-addressed, `immutable`, `'self'` under the default CSP. `x dev`, the container and `x build --target static` all serve or write it |
|
|
67
68
|
| `<meta name="ultimate-modals" content='{"routes":[…],"close":"…","loading":"…"}'>` | only on a surface with a `'modal'` route: the modal patterns, most specific first, with `!<pattern>` for a page that outranks one (`/runs/new/peek` over `/runs/:id/peek`), and the frame's two words in the document's locale (`ui.close`, `ui.loading` — override them in the app's catalog). What lets a click open the dialog before the answer ([Modals](#opening-on-the-click)) |
|
|
68
69
|
|
|
69
|
-
**Budget:** the router is
|
|
70
|
+
**Budget:** the router is 32,699 B minified (11,809 B gzip) `As of 2026-11` — 31,904 B (11,507 B
|
|
71
|
+
gzip) before a stream's late fragment, its recovery and keep-alive frames were handled (+795 B);
|
|
72
|
+
29,955 B (10,817 B gzip) before a soft visit read as it streams (+1,949 B); 27,845 B (10,094 B gzip) at 29.1.0, 24,448 B (9,028 B
|
|
70
73
|
gzip) before the modal that opens on the click and its popover opening (+3,397 B), and 19,966 B
|
|
71
74
|
before route-presented modals and navigating from code (+4,092 B, 26.1.0). It is **charged** to
|
|
72
75
|
every route on the surface, like realtime's page boot, because it is interactivity the app opted
|
|
@@ -88,6 +91,15 @@ before any hook, before the handler**:
|
|
|
88
91
|
| any router request answered with a 3xx (a form's 303, a sign-in wall, a `load`'s `setRedirect`, an OAuth or payment hop) | any | `204` + `x-ultimate-location: <target>`, cookies kept. The handler ran once; the router follows a same-origin target as its own next request, and hands another origin to the browser. A target that is not `http:`/`https:` (or will not parse) is never handed over: the header names the requested URL instead, as a path |
|
|
89
92
|
| POST | any | never gated: it is the form's submission |
|
|
90
93
|
|
|
94
|
+
A principal is the actor's kind and id, who is really acting (an impersonator), and the actor's
|
|
95
|
+
`orgId` when it has one: the same person in two orgs is two principals, so a soft GET never swaps
|
|
96
|
+
a page rendered in one org into a document of the other, and the client store it fences is never
|
|
97
|
+
shared. The one exception is a POST answered in place: a form that switches org and renders its
|
|
98
|
+
page instead of redirecting is swapped in, since it cannot be repeated; the router then empties
|
|
99
|
+
every tab's cache and stops swapping (the POST row under
|
|
100
|
+
[What happens to the answer](#what-happens-to-the-answer)). An actor with no `orgId` keeps the scope id it had before the org joined it (`As of
|
|
101
|
+
2026-11`; `packages/core/src/client-scope-id.ts`).
|
|
102
|
+
|
|
91
103
|
A soft GET across a principal change runs auth and rate-limit **twice** — once before the `204` of
|
|
92
104
|
the principal row above, once for the real load. Expected and harmless (auth and rate-limit only;
|
|
93
105
|
the handler and `load` run once), but a tight per-actor rate limit should budget one extra request
|
|
@@ -170,6 +182,23 @@ In one order, so no frame is unstyled and no island runs twice:
|
|
|
170
182
|
one only the previous page had is removed. Every inline script, head or body, still needs its
|
|
171
183
|
CSP hash — the router re-inserts the same text, and the policy judges it as on a full load.
|
|
172
184
|
|
|
185
|
+
**A `stream` page paints before its slowest hole** (`As of 2026-11`). A soft visit reads the
|
|
186
|
+
answer as it arrives: the swap above runs once the shell is in (the server ends it with a flush
|
|
187
|
+
mark), with each hole's fallback on screen, and on a page (not a modal) `ultimate:navigated` fires
|
|
188
|
+
then, after the shell's scripts and before any hole's. Each hole's chunk is appended to the body as it lands and
|
|
189
|
+
its scripts run — the `$X()` reveal and the hole's own islands — so a hole fills, or shows its
|
|
190
|
+
`error` markup, as on a full load. A link to a fragment the shell does not have (`/feed#post-7`,
|
|
191
|
+
the post inside a hole) is scrolled to when the hole that carries it lands, unless the visitor
|
|
192
|
+
scrolled first. The next swap, or `stop()` (from an `ultimate:navigated` listener too), cancels
|
|
193
|
+
the request: the server aborts each open hole's signal, and a read that passes that signal on
|
|
194
|
+
(`fetch(url, { signal: useContext().signal })`) stops — one that ignores it runs to its end, and
|
|
195
|
+
its result is dropped. Nothing of a page left lands in the next one. A stream that breaks under the
|
|
196
|
+
page on screen is loaded for real (a GET, reloaded when only its fragment differs) or reported as
|
|
197
|
+
`ultimate:navigation-error` (a POST, never re-sent); while the visitor's next page is on its way,
|
|
198
|
+
the break waits for it, and is recovered only if that page never took the tab. A prefetch still
|
|
199
|
+
reads the whole answer, so a click that reuses one in flight waits for every hole; a modal is shown
|
|
200
|
+
whole. Measured: [Known gaps](Known-Gaps).
|
|
201
|
+
|
|
173
202
|
Inside `document.startViewTransition` when the browser has it and `prefers-reduced-motion` is not
|
|
174
203
|
`reduce`. Style the transition with the standard `::view-transition-*` pseudo-elements. While it
|
|
175
204
|
animates the browser hit-tests every press to `<html>` (Chrome does whatever `pointer-events` the
|
|
@@ -420,7 +449,7 @@ island that drops markup holding other islands (`As of 2026-10`, [Client data](C
|
|
|
420
449
|
|
|
421
450
|
| Call | With the router | Without it (a `site/` page, a `'document'` page, the router's script blocked) |
|
|
422
451
|
|---|---|---|
|
|
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` |
|
|
452
|
+
| `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
453
|
| `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
454
|
| `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
455
|
| `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 |
|
|
@@ -480,7 +509,7 @@ Dispatched on `document`:
|
|
|
480
509
|
| Event | When | `detail` |
|
|
481
510
|
|---|---|---|
|
|
482
511
|
| `ultimate:navigate` | before the fetch. **Cancelable**: `preventDefault()` keeps the tab where it is | `{ url, method }` |
|
|
483
|
-
| `ultimate:navigated` | after the swap, the scroll and the new scripts — and after a modal opens, its `url` the modal's | `{ url }` |
|
|
512
|
+
| `ultimate:navigated` | after the swap, the scroll and the new scripts — and after a modal opens, its `url` the modal's. On a `stream` page swapped in as a page, the shell's scripts only: each hole's run when its chunk lands, so a hole's element may still be its fallback. A `stream` modal is shown whole, holes included | `{ url }` |
|
|
484
513
|
| `ultimate:navigation-error` | a POST that failed or could not be shown, a swap that failed on a POST. **Cancelable**: the default is a GET of the current page | `{ url, method, reason }` |
|
|
485
514
|
|
|
486
515
|
The three event names are on `@ultimat3/render/client` too — what an island listens with. The event
|
|
@@ -510,6 +539,7 @@ names and attributes are exported from `@ultimat3/render` (`NAVIGATE_EVENT`,
|
|
|
510
539
|
| the server gate and the redirect hand-over, counting handler runs | `packages/http/src/navigation.test.ts` |
|
|
511
540
|
| speculation rules: which pages are candidates, the tag on a router-less document only, the CSP hash of the served bytes | `packages/cli/src/page-speculation.test.ts`, `packages/render/src/speculation-rules.test.ts` |
|
|
512
541
|
| real pages: prefetch and `'document'` run no `load`, another principal or app is refused, a misplaced key refuses the boot | `packages/cli/src/page-navigation.test.ts` |
|
|
542
|
+
| a soft visit to a `stream` page: the shell before an open hole, the hole filling and hydrating, its error branch, a second navigation cancelling the first | `packages/cli/e2e/stream-hole.e2e.test.ts`, `packages/render/src/navigation-stream.test.ts` |
|
|
513
543
|
| writes announced after they settle | `packages/core/src/client-writes.test.ts` |
|
|
514
544
|
| in a real Chrome, through the real pipeline under an enforced CSP: every rule above, counted in route executions | `packages/cli/e2e/client-navigation-*.e2e.test.ts` |
|
|
515
545
|
| the reference app, opted in: real pages, sign-out, a like after a round trip, the editor as a modal over the feed, scripting off | `examples/dummy/apps/web/e2e/client-navigation.e2e.test.ts` |
|
package/wiki/Configuration.md
CHANGED
|
@@ -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
|
|
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.
|
|
@@ -124,7 +124,7 @@ await withReplicaReads(async () => {
|
|
|
124
124
|
| `totpReplay` | `TotpReplayGuard` | which TOTP steps are spent, one atomic `claim(subject, step, at)`, called by `completeMfa`. Omitted means the guard the host installed: a framework boot's is `postgresTotpReplayGuard` (`x_totp_steps`), so a code is single-use across the fleet. With no host, `memoryTotpReplayGuard()`, single-use per replica. A guard with no `claim` is `X_CONFIG_INVALID` |
|
|
125
125
|
| `providers` | `OAuthProviderId[]` | **defaults to `[]`**, `As of 2026-08-23` — an empty list is "no OAuth", and every `/auth/sso/<id>` answers `X_OAUTH_PROVIDER_UNKNOWN`. Never the live registry: that would let any dependency that calls `registerOAuthProvider` turn on a login route this app never enabled |
|
|
126
126
|
| `link` | `OAuthLinkPolicy` | defaults to `'verified-email'` |
|
|
127
|
-
| `passkeys` | `PasskeyPolicyInput` | `{ rpId, origins, rpName?, challengeTtlMs? }` (`As of 2026-11`): the relying party every WebAuthn ceremony verifies against. `rpId` a bare lowercase host, never a URL or an IP; each origin exact (`URL.origin` round-trips it), https or `http://localhost`, on `rpId` or a subdomain; `challengeTtlMs` 5 min. Anything else is `X_CONFIG_INVALID` at `defineAuth`. Absent means no passkeys: `passkeyLogin(auth)` / `passkeyStepUp(auth)` refuse at definition ([Auth](Auth#passkeys)) |
|
|
127
|
+
| `passkeys` | `PasskeyPolicyInput` | `{ rpId, origins, rpName?, challengeTtlMs? }` (`As of 2026-11`): the relying party every WebAuthn ceremony verifies against. `rpId` a bare lowercase host, never a URL or an IP; each origin exact (`URL.origin` round-trips it) with a DNS host — a wildcard `*` matches no origin a browser sends, so it is refused — https or `http://localhost`, on `rpId` or a subdomain; `challengeTtlMs` 5 min. Anything else is `X_CONFIG_INVALID` at `defineAuth`. Absent means no passkeys: `passkeyLogin(auth)` / `passkeyStepUp(auth)` refuse at definition ([Auth](Auth#passkeys)) |
|
|
128
128
|
|
|
129
129
|
There is no `auth.trustedOrigins` in either place, and passkeys are `defineAuth`'s, never `app.config.ts`'s, `As of 2026-11`.
|
|
130
130
|
|
|
@@ -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
|
|
139
|
-
| `jobs.maxAttempts` | `number` | `
|
|
140
|
-
| `jobs.backoff` | `'exponential' \| 'fixed'` | `'exponential'` | **
|
|
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
|
|
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 |
|
|
@@ -801,6 +802,7 @@ Rules:
|
|
|
801
802
|
| Secrets are env or a mounted file | the framework never talks to a vendor secret API ([axiom 7](Home)) |
|
|
802
803
|
| `env.X` reads through `defineEnv`'s schema | a declared key that is missing or malformed is `X_ENV_MISSING` at boot, every offender in one error. A `process.env` read outside the schema is a lint error, never a runtime one |
|
|
803
804
|
| `X_CONFIG_INVALID` is env **and** `app.config.ts` | one code for a configuration that cannot boot: what `defineConfig`'s own validation throws — a bad locale or two spellings of one, an unknown time zone, a section or list of the wrong shape (`jobs: null`), a value outside its closed set (`roles`, `jobs.backoff`, `theme.defaultMode`), a switch that is not a boolean (`database.ssl: 'false'`), `jobs.concurrency < 1`, a removed key such as `realtime.transport`, a `cache.tiers` entry the environment cannot supply — and any env **combination** no boot can resolve, thrown by the selector that reads it. Both CDN pairs or half a pair (`selectPurgeDriver`), more than one of `SMTP_URL` / `RESEND_API_KEY` / `SES_REGION`, or a transport with no `MAIL_FROM` (`selectMailDriver`), or `REPLICATION_URL` naming a different host, port or database than `DATABASE_URL` (`selectChangeFeed`) |
|
|
805
|
+
| Required where it is needed | `role: 'sync'` (or a list) requires a key only on that role; `required: false, requiredIn: ['staging', 'production']` is optional except in those environments (`ULTIMATE_ENV`, else `NODE_ENV`), so a deploy cannot boot without it and a laptop or test run reads `undefined` (`As of 2026-11`). An environment no reader can name is a deploy: required. A `default` still answers an absent key first, and a `role` still narrows it. `describeEnv` reports it as `requiredIn`. `required: false` is optional everywhere |
|
|
804
806
|
| `X_ENV_MISSING` is one key, `X_CONFIG_INVALID` is the shape | absent or malformed key → `X_ENV_MISSING` at the `defineEnv` gate. Keys that each parse but contradict each other → `X_CONFIG_INVALID`. The two never overlap |
|
|
805
807
|
| No runtime mutation | config is frozen after `defineConfig`; there is no `setConfig` |
|
|
806
808
|
| Same image, all environments | only env differs. That is what makes staging a real rehearsal ([Deployment](Deployment)) |
|
package/wiki/Deployment.md
CHANGED
|
@@ -128,7 +128,7 @@ helm upgrade app docker/helm --set roles.worker.retireSeconds=7200 \
|
|
|
128
128
|
--set drain.workerDeadlineSeconds=7500 # 2 h worker; `x deploy --method helm` sets both itself
|
|
129
129
|
```
|
|
130
130
|
|
|
131
|
-
**`x verify` holds the job to it**: a job whose declared `timeout` exceeds the worker's budget (`drain.workerRetireMs` when above 0, else `drain.workerDeadlineMs`, else `drain.deadlineMs`) reds the `manifest` step with `X_JOB_OUTLASTS_DRAIN`, naming the job, its limit and the budget. A job with no `timeout` is not graded.
|
|
131
|
+
**`x verify` holds the job to it**: a job whose declared `timeout` exceeds the worker's budget (`drain.workerRetireMs` when above 0, else when the drain cancels a held job: `drain.workerDeadlineMs`, else `drain.deadlineMs`, less the later hooks' reserve and the 2 s cut-off margin — 21 s of 25 s, `As of 2026-11-19`) reds the `manifest` step with `X_JOB_OUTLASTS_DRAIN`, naming the job, its limit and the budget. A job with no `timeout` is not graded.
|
|
132
132
|
|
|
133
133
|
**Compose stays SIGTERM with `stop_grace_period`**: it has no `preStop`, and a SIGKILL mid-job is worse than a handed-back claim, so size `stop_grace_period` to the drain as below. It is the single-node rung, and makes no such claim → [scale ladder](https://github.com/developerz-ai/ultimate/blob/main/docs/idea/17-scale-ladder.md).
|
|
134
134
|
|
|
@@ -304,15 +304,53 @@ services:
|
|
|
304
304
|
|
|
305
305
|
**The `/app/.x` tmpfs is owned by the image's user** (`As of 30.0.0`): `'/app/.x:uid=1000,gid=1000'` in the scaffold (its `USER 1000:1000`), `uid=65532` in the framework's specimen (distroless `nonroot`). A tmpfs mounts root-owned under `read_only: true`, so before this every role refused at boot with `X_STORAGE_UNWRITABLE … EACCES mkdir '/app/.x/storage'`. An app scaffolded earlier edits that one line.
|
|
306
306
|
|
|
307
|
-
> **`web` and `sync` are one
|
|
307
|
+
> **`web` and `sync` are one container each, and the file says so** `As of 2026-11`. Both publish a host port, one host port has exactly one binder, so both declare `replicas: 1` — a ceiling that is declared rather than discovered when the second container dies on `port is already allocated`. One container is no longer one core: it runs one process per declared CPU on one port ([Processes per container](#processes-per-container)). `worker`, `scheduler` and `replicator` publish nothing; `worker` scales freely.
|
|
308
308
|
>
|
|
309
309
|
> | Want | Do |
|
|
310
310
|
> |---|---|
|
|
311
|
-
> | more `web`/`sync` on the same box |
|
|
311
|
+
> | more cores for `web`/`sync` on the same box | raise the service's `cpus:` (and `mem_limit` at 256 MiB per process): the container runs that many processes on its one port |
|
|
312
|
+
> | more `web`/`sync` containers on the same box | delete their `ports:` lines, add a reverse proxy of your choosing to the compose file, point it at the service names — compose DNS resolves each to every replica |
|
|
312
313
|
> | more `web`/`sync`, full stop | the Helm chart below, which carries a per-role HPA and an Ingress |
|
|
313
314
|
>
|
|
314
315
|
> The framework ships neither proxy: a proxy image in `docker-compose.prod.yml` is a dependency every app inherits and a second answer to "how does traffic reach a role" beside the chart's Ingress. This is the rung-1 ceiling → [`docs/idea/17-scale-ladder.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/idea/17-scale-ladder.md).
|
|
315
316
|
|
|
317
|
+
## Processes per container
|
|
318
|
+
|
|
319
|
+
**A production container runs one process per declared CPU, on one port** `As of 2026-11`. The process the platform starts becomes a supervisor: it opens `METRICS_PORT`, spawns N copies of the same entry point (`ULTIMATE_CHILD=<i>/<N>` in each), and the children share the role's port through `SO_REUSEPORT` — the kernel hands each new connection to one of them. One process per core is how a serving path uses a second core: a process runs its requests, jobs and sockets on one JavaScript thread (a `Worker` beside it — `transformImageBytes`' raster worker — takes work off that thread, never requests).
|
|
320
|
+
|
|
321
|
+
**Production containers only.** `x dev`, the test runner and every environment other than `production` and `staging` run one process; a count set there is ignored with one `info` line, never refused (a `.env` shared with production must not stop a laptop).
|
|
322
|
+
|
|
323
|
+
**`ULTIMATE_PROCESSES`** = `auto` (the default, also unset or blank) or a positive whole number, per service. Anything else is `X_PROCESSES_INVALID`. The boot names the count and the clamp that bound it in one line: `ultimate processes` with `count`, `binding` and each clamp's value.
|
|
324
|
+
|
|
325
|
+
`auto` is the minimum of:
|
|
326
|
+
|
|
327
|
+
| Clamp (`binding`) | Value |
|
|
328
|
+
|---|---|
|
|
329
|
+
| `environment` | 1 outside `production` / `staging` |
|
|
330
|
+
| `platform` | 1 off Linux: Bun ignores `reusePort` on macOS and Windows |
|
|
331
|
+
| `role` | 1 for `scheduler`, `replicator`, `migrate` (a lease row, a replication slot, run-once) |
|
|
332
|
+
| `cpu` | the cgroup's CPU quota in whole CPUs, floored, at least 1 (`cpus: '1.5'` → 1), and no more than `navigator.hardwareConcurrency`. **No quota declared (`cpu.max` = `max`) → 1**, whatever the host has |
|
|
333
|
+
| `memory` | `floor((memory limit − 32 MiB) / 256 MiB)`, at least 1; no bound when unlimited |
|
|
334
|
+
| `pool` | `DATABASE_POOL_MAX`, else the role's profile (web 20, sync 10, worker 8): every child needs a connection |
|
|
335
|
+
| `shared-state` | 1 if any per-process state would split: the `lru` cache tier with neither `NATS_URL` nor `REDIS_URL`/`VALKEY_URL`, a `runtime.ts` store whose `scope` is not `'shared'`, the embedded database (no `DATABASE_URL`), `sync` without `NATS_URL` or a crossing transport |
|
|
336
|
+
| `image` | 1 when the image carries no prebuilt store (`X_IMAGE_NOT_PREBUILT`): each child would compile the islands |
|
|
337
|
+
|
|
338
|
+
An explicit count is honoured and checked: 1 always runs; above 1 it is refused for a singleton role (`X_PROCESSES_ROLE_SINGLETON`), off Linux (`X_PROCESSES_UNBALANCED`), over per-process state (`X_PROCESSES_UNSHARED_STATE`) and above the pool (`X_PROCESSES_OVER_POOL`); above the memory fit it runs with a `warn` line. A child whose boot is refused for a reason the same image and environment meet again — a missing or malformed variable (`X_ENV_MISSING`, `X_ROLE_UNKNOWN`, `X_PORT_INVALID`), `X_CONFIG_INVALID`, a secrets or seal key that does not match, an unresolved import, every `X_PROCESSES_*` refusal — is not restarted: it logs `ultimate child refused to boot` with its own code and fix, the siblings drain and the container exits 1 at once (`FATAL_BOOT_CODES`, `packages/cli/src/supervise-child.ts`). What can heal by itself — a database, Redis or NATS still starting, migrations not yet applied, a port still held — is restarted with backoff. A child that exits unexpectedly 5 times in 5 minutes is `X_PROCESS_CRASH_LOOP`: the siblings drain and the container exits 1 for the platform to restart.
|
|
339
|
+
|
|
340
|
+
**Per container, never per process**: `DATABASE_POOL_MAX` (each child gets its `childShare`, so the container's connections do not grow with N), `jobs.concurrency` and `jobs.maxInFlight` (split the same way; a queue whose total is below N is served only by children with index < total, so `concurrency: 1` stays serial across the container). Each worker child holds its own LISTEN session: connections per container = pool + N for `worker`. `x doctor` prints both per role; `x deploy verify` reports N registry rows per worker container (`data.queues.containers`). Per-process still, and so N× per container: `perTenant` / `ratePerTenant` job caps and the per-actor socket caps — as with N containers today.
|
|
341
|
+
|
|
342
|
+
| What | Rule |
|
|
343
|
+
|---|---|
|
|
344
|
+
| `cpus:` | the knob `auto` reads. The shipped compose files declare `web: '2'`, `sync: '1'`, `worker: '1'` per replica (raise it for CPU-heavy queues), `scheduler: '0.5'`, and the framework's `replicator: '0.5'` (the scaffold writes no `replicator` service) |
|
|
345
|
+
| memory | 256 MiB per child plus headroom. Measured private memory of a reference-app web child: 104–106 MiB idle, 227 MiB peak under load; worker and sync 97–100 MiB idle; the supervisor about 3 MiB (`As of 2026-11`, Bun 1.4.4, Linux) |
|
|
346
|
+
| `init: true` | on every service. Bun as PID 1 never reaps an orphaned grandchild (zombies stay) and ignores SIGTERM until a handler is installed (`docker stop` waited out its grace and SIGKILLed); Docker's init fixes both |
|
|
347
|
+
| `sysctls: { net.ipv4.tcp_migrate_req: 1 }` | **an opt-in, commented out** on `web` and `sync` in the shipped files, never active: on a kernel older than Linux 5.14 (RHEL 8, Ubuntu 20.04, Amazon Linux 2) the knob does not exist and Docker refuses to create the container. Uncomment it on a host ≥ 5.14 where the container runs more than one process: closing a shared-port listener — a drain, a crash — otherwise resets every connection still queued on it (93–109 of 200 reset with the host default 0, 0 of 200 with the sysctl; per network namespace). At N = 1 it buys nothing. `x doctor` warns when N > 1 and the knob exists and reads 0 |
|
|
348
|
+
| a proxy in front | nginx and Caddy defaults need nothing: under load an HTTP/1.1 proxy opens one upstream connection per in-flight request, and CPU-bound work split 24–26 % per child at N=4. The upstream needs **at least 4 × N concurrent connections at peak**: with about 2N or fewer long-lived connections some child often gets none (balancing is per connection, by hash) and 20–40 % of throughput is lost. Do not cap upstream connections near N (`max_conns`, a tunnel with a fixed connection count). An HTTP/2-multiplexed upstream (one connection) is **unsupported for N > 1**: unmeasured, and the worst case puts everything on one child |
|
|
349
|
+
| probes | the supervisor answers `METRICS_PORT`: `/healthz` (alive, not in a crash loop), `/readyz` (at least one child ready, every other one ready or draining, the container not stopping), `/metrics` (every child's, merged with a `child` label → [Observability](Observability)). The image's `HEALTHCHECK` on `$PORT/readyz` reaches one child at random. A child opens no boot probe on the shared port: a plain bind would refuse its siblings (EADDRINUSE) and a shared one would take real traffic to answer 503 |
|
|
350
|
+
| drain | SIGTERM, SIGINT and SIGUSR2 (worker retire) go to every child at once; each child's budget starts at its `draining` acknowledgement (a CPU-saturated child heard the signal 1.9–5.2 s late, measured) and it is SIGKILLed 2 s past it; one outer ceiling, the longest budget + 6 s from the signal, bounds the container. Children drain in parallel, so `stop_grace_period` and `terminationGracePeriodSeconds` do not change. Exit 0 if every child exited 0, 70 if any hit its drain deadline |
|
|
351
|
+
|
|
352
|
+
What it buys, measured (`As of 2026-11`, Bun 1.4.4, Linux, 8 cores, a box shared with other agents — read the ratios, not the absolutes): a handler burning ~2 ms of CPU went from 523 rps at N=1 to 1,485–1,711 at N=4 (2.9–3.3×); the reference app spends 0.24–0.34 CPU-ms per request and one process saturates one core at 3.4–4.7k rps, so `web` sits in the CPU-bound row. A pure-wait handler gains nothing until one process saturates (~50k rps here). The full table: [`docs/idea/17-scale-ladder.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/idea/17-scale-ladder.md).
|
|
353
|
+
|
|
316
354
|
## Helm
|
|
317
355
|
|
|
318
356
|
**`x new` writes it**, `As of 2026-08-19` — `docker/helm`, one `Deployment` per role, 8 files: `Chart.yaml`, `values.yaml` and 6 templates. There is still no `--helm` flag on `x build`; the chart is a scaffold artifact like `docker/Dockerfile`, not a build target.
|
|
@@ -326,6 +364,8 @@ services:
|
|
|
326
364
|
| `replicator` | none — `replicas: 1` | 1 | owns the slot; `strategy: Recreate`, because a surged pod can only stand by unready and `maxUnavailable: 0` would never retire the holder |
|
|
327
365
|
| `migrate` | n/a | — | pre-install/pre-upgrade `Job` hook; blocks the release on failure |
|
|
328
366
|
|
|
367
|
+
**One process per pod**: both charts set `ULTIMATE_PROCESSES: "1"` on every role (`env.ULTIMATE_PROCESSES` in values wins). Per-pod parallelism is the HPA's; the chart sets CPU requests and no limits, so `auto` already resolves to 1 there — the pin makes the count explicit, and a CPU limit added later cannot raise it.
|
|
368
|
+
|
|
329
369
|
CPU autoscaling is wrong for `sync` and `worker`: a node holding 80k idle sockets is near-zero CPU and near-capacity, and a worker blocked on a slow HTTP call is idle CPU with a growing backlog. The framework **declares** both series — `connections` and `queue_demand`, with `rps` derived from the monotonic `http_requests_total` — and `SCALING_METRICS` maps each role's signal to its series so the chart and the role table cannot drift. `As of 2026-08` every role serves `/metrics` on `METRICS_PORT` (default 9090) and `http`/`realtime`/`jobs` call the recorders, so the signals exist. **The chart's half is closed in 2.0.0**: `values.yaml` declares `metricsPort: 9090`, `_helpers.tpl` emits a container port named `metrics` on every role but `migrate`, `service.yaml` publishes it by name and `templates/servicemonitor.yaml` ships the scrape target. `serviceMonitor.enabled` is `auto`: the object renders wherever the cluster serves the Prometheus operator's kind and is skipped where it does not, so `helm install` never fails on an unknown kind — and `templates/alert-rules.yaml` ships the mechanism alerts the same way (`alerts.enabled: auto`). One thing remains, and it is not the chart's: turning scraped series into the `Pods` metrics an HPA reads needs a **custom-metrics adapter**. Do not hand-add a metrics container port — the chart already emits one and a duplicate is rejected by the API server → [Observability](Observability).
|
|
330
370
|
|
|
331
371
|
`x deploy --method helm` works in a fresh app `As of 2026-08-19`: the command implements helm
|
|
@@ -419,7 +459,7 @@ Then reopen the pooler's server connections: a role setting applies at login.
|
|
|
419
459
|
| Role | Under `DATABASE_POOLER=transaction` |
|
|
420
460
|
|---|---|
|
|
421
461
|
| `web`, `sync`, `scheduler` | runs |
|
|
422
|
-
| `worker` | runs on the poll: no wake, pickup within `idlePollMaxMs`, `jobs.wake.unverified` once. For the wake, a direct or session-pooled `DATABASE_URL` and `DATABASE_POOLER` unset or `session` for that role |
|
|
462
|
+
| `worker` | runs on the poll: no wake, pickup within `idlePollMaxMs`, `jobs.wake.unverified` once. For the wake, a direct or session-pooled `DATABASE_URL` and `DATABASE_POOLER` unset or `session` for that role. A proven wake is re-proven every 10 s (`reproveEveryMs`): a session that stops delivering logs `jobs.wake.lost` and the worker returns to the 2 s poll |
|
|
423
463
|
| `migrate`, `replicator`, `x db migrate` | `X_DB_POOLER_SESSION_REQUIRED`, before a socket: point `DATABASE_URL` at the server's own port and unset the switch for that role |
|
|
424
464
|
|
|
425
465
|
`x doctor --json` reports the bound as the session reads it (`data.statementBound`). A bound that
|
|
@@ -145,15 +145,25 @@ migration or a psql session can violate.
|
|
|
145
145
|
| Written as | Reaches SQL | Note |
|
|
146
146
|
|---|---|---|
|
|
147
147
|
| `c.title.trimmed().minLength(1)` · `c.likeCount.atLeast(0)` · `c.email.contains('@')` · `c.a.eq(c.b)` · `c.flag.isTrue()` · `c.publishedAt.isNull()` / `.isNotNull()` | yes | `CHECK`. `trimmed()` strips leading and trailing **spaces** only, as one-argument `btrim` does — a tab is a character on both sides. `atLeast` / `eq(<number>)` compare the number the column holds, so a `bigint()` or `decimal()` row (a decimal string) is judged by its digits |
|
|
148
|
-
| `iff(c.status.eq('published'), c.publishedAt.isNotNull())` | yes | `(a) = (b)` — a rule that holds *exactly when* another does
|
|
148
|
+
| `iff(c.status.eq('published'), c.publishedAt.isNotNull())` | yes | `(a) = (b)` — a rule that holds *exactly when* another does |
|
|
149
|
+
| `allOf(c.a.isNull(), c.b.isNull())` · `anyOf(c.a.isNull(), c.b.isNull())` | yes | `(a) and (b)` / `(a) or (b)`, two or more operands, three-valued as SQL's (`As of 2026-11`): "both unset", "at most one set". Two invariants are already a conjunction; `allOf` is for where ONE predicate must say it — an index `where: (c) => allOf(…)`, or inside `anyOf`/`iff`. One app-only operand makes the whole rule `sql: null`; a `unique` operand, or fewer than two, is `X_INVARIANT_VIOLATED`. `not` stays absent: `isNull`/`isNotNull` are the negations a CHECK needs |
|
|
149
150
|
| `c.unique(['orgId', 'userId'])` | yes | `UNIQUE`, not a CHECK — a single row cannot see a duplicate |
|
|
150
151
|
| `c.slug.matches(SLUG_PATTERN)` — a **`RegExp`** | yes | `slug ~ '…'` |
|
|
151
152
|
| `c.slug.matches(isValidSlug)` — a **function** | **no** | `sql: null` |
|
|
152
153
|
| `c.satisfies(fn, ['status', 'publishedAt'])` | **no** | `sql: null`, by construction — a JS function over several columns |
|
|
153
154
|
|
|
155
|
+
**A patch is refused as the row would be.** `insert` judges the whole row before its statement; an
|
|
156
|
+
`update` or `updateWhere` patch only becomes a row on the server, so there the CHECK judges first,
|
|
157
|
+
and its `23514` on a rule this entity declares answers `X_INVARIANT_VIOLATED` naming that rule (a
|
|
158
|
+
422), the same as `insert`. A CHECK no invariant declares stays `X_DB_STATEMENT_FAILED`. As of
|
|
159
|
+
2026-11; before it a refused patch was a 500.
|
|
160
|
+
|
|
154
161
|
**A rule over a nullable column passes `NULL`, in the app as in the CHECK.** Every operator but
|
|
155
162
|
`isNull()`/`isNotNull()` answers SQL's *unknown* for a NULL operand, in TypeScript too, and a rule
|
|
156
|
-
holds unless
|
|
163
|
+
holds unless its FINAL verdict is false. That is per comparison: a composite decides by its own
|
|
164
|
+
three-valued logic, so `allOf(c.a.eq(1), c.b.eq(1))` refuses `a = NULL, b = 2` (false beats
|
|
165
|
+
unknown) while `anyOf(c.a.eq(1), c.b.eq(1))` passes it (no operand true, one unknown) — in both
|
|
166
|
+
halves. So `c.slug.matches(SLUG_PATTERN)` on a `.nullable()` slug accepts a
|
|
157
167
|
NULL in `$assert`, the memory driver and Postgres alike (`invariant-null.test.ts`, every operator on
|
|
158
168
|
PGlite). To refuse NULL, declare the column NOT NULL or add `.isNotNull()`. As of 31.3; before it
|
|
159
169
|
the app refused the NULL its CHECK stored.
|
|
@@ -179,6 +189,10 @@ constructs where the two engines disagree are **refused at declaration**:
|
|
|
179
189
|
| `\s` `\S` | `'\u00a0'` is whitespace to JS, not to Postgres | `[ \t\n\r\f\v]` |
|
|
180
190
|
| `\A` `\Z` | anchors in Postgres, letters in JS | `^` `$` |
|
|
181
191
|
| `\1`–`\9`, `(?<name>…)`, `(?i)`, `[[:alpha:]]`, a non-ASCII range endpoint | backreference, named group, embedded flag, POSIX class, collation-ordered range | a predicate |
|
|
192
|
+
| a surrogate escape `\uD800`–`\uDFFF` (any astral character written in a regex literal) | JS matches the pair as one character, Postgres reads two code points no text holds — its CHECK refused every row. `As of 2026-11-19` | a predicate |
|
|
193
|
+
| a repetition bound above 255 (`{256}`) | Postgres refuses the migration: invalid repetition count. `As of 2026-11-19` | a smaller bound, or a predicate on `length` |
|
|
194
|
+
| a `-` straight after a range or `\d`/`\D` inside a class, not last (`[a-z-9]`, `[\d-z]`) | Postgres refuses an invalid range; JS reads a literal `-`. `As of 2026-11-19` | `-` last in the class: `[a-z9-]` |
|
|
195
|
+
| a quantified lookaround (`(?=…)*`, `(?!…){2}`) | JS allows it (Annex B), Postgres refuses the operand. `As of 2026-11-19` | the lookaround unquantified |
|
|
182
196
|
|
|
183
197
|
The refusal is `X_INVARIANT_VIOLATED` at `entity()` time — before a migration exists — and names the
|
|
184
198
|
construct, its index, both readings, and the portable spelling where there is one. The subset is
|
|
@@ -1386,7 +1400,7 @@ Rule: `.search(term)` on a chain asks the INSTALLED `SearchIndex` — one search
|
|
|
1386
1400
|
| Index | How `.search(term)` answers |
|
|
1387
1401
|
|---|---|
|
|
1388
1402
|
| the built-in Postgres one (default) | inside the statement, its `matches` predicate over the `.searchable()` columns — the same SQL as before the port; costs a write nothing |
|
|
1389
|
-
| an external one (`searchIndex` in `apps/<app>/runtime.ts`: Meilisearch, Typesense, the app's adapter) | ids first, then the chain reads those rows — tenancy, soft delete, order and cursor still apply, so a hit can never widen what the chain sees |
|
|
1403
|
+
| an external one (`searchIndex` in `apps/<app>/runtime.ts`: Meilisearch, Typesense, the app's adapter) | ids first, then the chain reads those rows — tenancy, soft delete, order and cursor still apply, so a hit can never widen what the chain sees. Asked one tenant at a time: the chain's `eq` on the tenant column, else the actor's org. Inside `crossTenant()` an `andWhere('<tenant>', 'in', [...])` asks it once per listed tenant, and a chain naming no tenant is `X_INVARIANT_VIOLATED` — before `As of 2026-11-19` it silently answered the actor's org alone |
|
|
1390
1404
|
|
|
1391
1405
|
| Fact | Detail |
|
|
1392
1406
|
|---|---|
|
package/wiki/FAQ.md
CHANGED
|
@@ -97,7 +97,7 @@ Yes. CI runs exactly `x verify` — no bespoke pipeline steps, because a check t
|
|
|
97
97
|
|
|
98
98
|
### Do I need Docker to develop?
|
|
99
99
|
|
|
100
|
-
No. `x dev` uses embedded PGlite, in-process events, and a local directory in place of S3. `bunx create-ultimate myapp && cd myapp && bun run setup && bun run dev` — no Docker install, no `.env` scavenger hunt. `bun run setup` is
|
|
100
|
+
No. `x dev` uses embedded PGlite, in-process events, and a local directory in place of S3. `bunx create-ultimate myapp && cd myapp && bun run setup && bun run dev` — no Docker install, no `.env` scavenger hunt. `bun run setup` is seven steps — `bun install`, `x merge-driver install`, an `.env.development.local` touch, `x db gen "initial"`, `x db migrate`, `x db seed`, `x manifest` — and is not optional: `x new` installs nothing ([Getting started](Getting-Started), [Bare VM](Bare-VM)). The compose files exist for parity debugging and CI jobs that want real services ([Deployment](Deployment)).
|
|
101
101
|
|
|
102
102
|
### Do I need Redis or NATS?
|
|
103
103
|
|
package/wiki/Getting-Started.md
CHANGED
|
@@ -7,8 +7,8 @@ bunx create-ultimate myapp && cd myapp && bun run setup && bun run dev
|
|
|
7
7
|
Building a blog or an API rather than a dashboard? Add `--shape blog` or `--shape api` to the
|
|
8
8
|
first command: [Shapes](Shapes) says what each writes and leaves out.
|
|
9
9
|
|
|
10
|
-
**Four commands, and `bun run setup` is one of them.** It is the scaffold's own script,
|
|
11
|
-
`bun install`, an `.env.development.local` touch, `x db gen "initial"` when
|
|
10
|
+
**Four commands, and `bun run setup` is one of them.** It is the scaffold's own script, seven steps —
|
|
11
|
+
`bun install`, `x merge-driver install`, an `.env.development.local` touch, `x db gen "initial"` when
|
|
12
12
|
`packages/db/migrations` holds no `.sql`, `x db migrate`, `x db seed`, `x manifest` — idempotent, so
|
|
13
13
|
re-running it after a pull is safe. The last step is not optional either: `x.manifest.json` is a
|
|
14
14
|
projection of the loaded app, nothing else ever runs the command, and `x verify`'s `manifest` step
|
package/wiki/Home.md
CHANGED
|
@@ -53,7 +53,7 @@ Those facts are repeated on several pages because the wiki is plain markdown wit
|
|
|
53
53
|
|
|
54
54
|
## Tutorials
|
|
55
55
|
|
|
56
|
-
Follow in order. Each page states what it was executed against in its own first line — tutorial 1 its own measurement. `As of 2026-11-03`, 2–4 were re-run by hand, whole, in the app tutorial 1 leaves, and 5 with Docker up to the point a real host is needed. `scripts/tutorial-run.ts` (workflow `tutorial-run.yml`, on `main`) runs 1–4 in order and never 5; it has not yet run green. A workaround for a gap fixed since has been removed rather than left to mislead.
|
|
56
|
+
Follow in order. Each page states what it was executed against in its own first line — tutorial 1 its own measurement. `As of 2026-11-03`, 2–4 were re-run by hand, whole, in the app tutorial 1 leaves, and 5 with Docker up to the point a real host is needed. `scripts/tutorial-run.ts` (workflow `tutorial-run.yml`, on `main` and weekly since 2026-11-19) runs 1–4 in order and never 5; it has not yet run green. A workaround for a gap fixed since has been removed rather than left to mislead.
|
|
57
57
|
|
|
58
58
|
| Page | You end with |
|
|
59
59
|
|---|---|
|
|
@@ -108,7 +108,7 @@ Follow in order. Each page states what it was executed against in its own first
|
|
|
108
108
|
| [I18n](I18n) | flat catalogs, loud misses, locale routing, `hreflang` |
|
|
109
109
|
| [Theming](Theming) | 24 semantic colour roles as RGB channels, every token scale, breakpoint and layout mixins, `defineTheme()`, what contrast is gated |
|
|
110
110
|
| [Interface rules](Interface-Rules) | how a screen must behave, and which of the app's `guards/` refuses each rule |
|
|
111
|
-
| [UI components](UI-Components) | the four page composites, and the generated catalog of
|
|
111
|
+
| [UI components](UI-Components) | the four page composites, and the generated catalog of 100 source-derived UI components |
|
|
112
112
|
| [Timezones and dates](Timezones-And-Dates) | store UTC, format with an explicit IANA zone, frozen clocks in tests |
|
|
113
113
|
| [Money](Money) | `Money = { minor, currency }`, never a float |
|
|
114
114
|
| [Outbound HTTP](Outbound-HTTP) | `outbound()`: one vendor call with a whole-call deadline, the caller's signal, safe-only retry, idle and byte bounds, `dial: 'public'` pinning, and `breaker()` |
|
|
@@ -157,6 +157,6 @@ Follow in order. Each page states what it was executed against in its own first
|
|
|
157
157
|
| [`docs/ops/`](https://github.com/developerz-ai/ultimate/tree/main/docs/ops) | running an app for real: the PaaS → Compose → Kubernetes ladder, secrets, observability, datastore sizing, disaster recovery, runbooks. **Recommendations only** — the framework depends on none of it |
|
|
158
158
|
| [`docs/idea/16-app-targets.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/idea/16-app-targets.md) | three targets, one backend, two view layers — **design only, not shipped behaviour** |
|
|
159
159
|
| [`docs/idea/17-scale-ladder.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/idea/17-scale-ladder.md) | why the app code is identical at rung 0 and rung 4 — **shipped, not design only**: all 26 seam rows are marked shipped, rungs 0–2 are real, and the places the invariant breaks today are named |
|
|
160
|
-
| [`packages/ui/CATALOG.md`](https://github.com/developerz-ai/ultimate/blob/main/packages/ui/CATALOG.md) | the full catalog of
|
|
160
|
+
| [`packages/ui/CATALOG.md`](https://github.com/developerz-ai/ultimate/blob/main/packages/ui/CATALOG.md) | the full catalog of 100 source-derived UI components with every prop, generated from source and drift-tested |
|
|
161
161
|
| [`framework.manifest.json`](https://github.com/developerz-ai/ultimate/blob/main/framework.manifest.json) | every package, tier, and `X_*` code with its owner — generated |
|
|
162
162
|
| [llms.txt](https://github.com/developerz-ai/ultimate/blob/main/llms.txt) | the machine-readable repo map for agents |
|
package/wiki/I18n.md
CHANGED
|
@@ -118,8 +118,10 @@ translator over it (`As of 2026-10`):
|
|
|
118
118
|
| page (server) | `catalogSubset(t, ['app.post.likes'])` from `@ultimat3/i18n`; `uiCatalog(t)` from `@ultimat3/ui` for every `ui.*` key |
|
|
119
119
|
| island | `subsetTranslator(props.strings)` from `@ultimat3/i18n/subset`; `<UiProvider t={subsetTranslator(props.ui)}>` |
|
|
120
120
|
|
|
121
|
-
The slice carries every plural variant of each key
|
|
122
|
-
island
|
|
121
|
+
The slice carries every plural variant of each key and every `_select_*` / `_ordinal_*` family
|
|
122
|
+
member (`packages/i18n/src/subset.ts`, `As of 2026-11`; before, an island rendered `⟦key⟧` for a
|
|
123
|
+
select or ordinal the server rendered). A key it lacks renders `⟦key⟧` in the island exactly as on
|
|
124
|
+
the server.
|
|
123
125
|
|
|
124
126
|
**A form's validation messages key on the issue's `rule`**, never on its English `message` — the
|
|
125
127
|
framework's diagnostic text changes without a semver signal, the rule names do not
|
|
@@ -132,7 +134,7 @@ framework's diagnostic text changes without a semver signal, the rule names do n
|
|
|
132
134
|
| Command | Does |
|
|
133
135
|
|---|---|
|
|
134
136
|
| `x i18n add <locale>` | create `catalogs/<locale>.json` seeded with every default-locale key, each value copied inside `⟦…⟧` |
|
|
135
|
-
| `x i18n sync <locale>` | add keys the locale is missing; a key it already has is never overwritten, translated or not; never deletes |
|
|
137
|
+
| `x i18n sync <locale>` | add keys the locale is missing; a key it already has is never overwritten, translated or not; never deletes. An admin key it adds that the default locale's file lacks is added there too, with the string that locale renders, so every catalog keeps one key set |
|
|
136
138
|
| `x i18n check --json` | extract keys from source, diff against every catalog and against `en`, report missing / unused / dynamic / slot mismatch / untranslated |
|
|
137
139
|
|
|
138
140
|
Every command supports `--json`. `add` and `sync` copy the source value inside the marker, so the text sits where the translation goes and `x i18n check` counts the key as missing until a person replaces it. Source means every shape below; a key only a mail or a push names is a key.
|
|
@@ -182,7 +184,7 @@ A dynamic call contributes its static head (`plans.`) as a runtime-key prefix, s
|
|
|
182
184
|
| Static export | `x build --target static` renders each `site/` page once per routed locale, in that locale's context: `index.html` (`lang="es-co"`), `en/index.html` (`lang="en"`), `en/precios/index.html`. Every static host serves `/en/precios` from that layout with no rewrite |
|
|
183
185
|
| Cookie | `x_locale`, written only by an explicit language switcher |
|
|
184
186
|
| Unsupported tag | skipped, not thrown — a stale cookie must never 500 a page. `assertSupportedLocale` throws `X_LOCALE_UNSUPPORTED` where an unknown tag is a caller bug |
|
|
185
|
-
| Direction | `currentDirection()` returns `'rtl'` for `ar`, `he`, `fa`, `ur`, … and is written to `<html dir
|
|
187
|
+
| Direction | `currentDirection()` returns `'rtl'` for `ar`, `he`, `fa`, `ur`, … and is written to `<html dir>`. An explicit script subtag decides first: `az-Arab` is `rtl`, `ks-Deva` `ltr`. Bare `ku` is `ltr` (Kurmanji, Latin script); Kurdish in Arabic script is `ku-Arab` or `ckb` (`isRtl`, `packages/core/src/locale-direction.ts`, `As of 2026-11`) |
|
|
186
188
|
|
|
187
189
|
| API | From | Answers |
|
|
188
190
|
|---|---|---|
|
package/wiki/Installation.md
CHANGED
|
@@ -47,16 +47,17 @@ TypeScript that Bun executes, no bash and no WSL — and `bun run dev` and `bun
|
|
|
47
47
|
|
|
48
48
|
**`bun run setup` is not optional.** `x new` writes files and installs nothing, so `cd myapp && x dev`
|
|
49
49
|
stops on `X_BUILD_FAILED` naming `bun install` (measured `As of 2026-08-23`; this page said
|
|
50
|
-
otherwise until then). `bun run setup` is
|
|
50
|
+
otherwise until then). `bun run setup` is seven steps, idempotent and safe to re-run:
|
|
51
51
|
|
|
52
52
|
| # | Step | Why it is in the script |
|
|
53
53
|
|---|---|---|
|
|
54
54
|
| 1 | `bun install` | `x new` writes files and installs nothing |
|
|
55
|
-
| 2 |
|
|
56
|
-
| 3 |
|
|
57
|
-
| 4 | `x db
|
|
58
|
-
| 5 | `x db
|
|
59
|
-
| 6 | `x
|
|
55
|
+
| 2 | `x merge-driver install` | git keeps merge drivers in `.git/config`, which no clone inherits: [Merging two features](Many-Agents#merging-two-features) |
|
|
56
|
+
| 3 | touch `.env.development.local` | per-box secrets, gitignored, wins over the committed `.env.development` |
|
|
57
|
+
| 4 | `x db gen "initial"` | skipped when `packages/db/migrations` already holds a `.sql` — `x db gen` is that directory's only writer |
|
|
58
|
+
| 5 | `x db migrate` | applies them, then diffs the live schema against the ledger |
|
|
59
|
+
| 6 | `x db seed` | run through the CLI, never `bun run`: the CLI owns the connection, so it reaches the same embedded database the migration just wrote to |
|
|
60
|
+
| 7 | `x manifest` | `x.manifest.json` is a projection of the loaded app, so `x new` cannot write it. Nothing else ever ran the command, and `x verify`'s `manifest` step now refuses its absence with `X_MANIFEST_MISSING` |
|
|
60
61
|
|
|
61
62
|
Every flag, from the registry — `bun run x -- help new`, or `x help new` in an app. There are six,
|
|
62
63
|
each with a default, so **`x new` asks nothing**: an agent cannot answer a prompt and is never given
|
|
@@ -118,18 +119,18 @@ Boot parses this before any listener binds. Failure costs ~40ms and exit 1 — n
|
|
|
118
119
|
|
|
119
120
|
```
|
|
120
121
|
X_ENV_MISSING: required environment variables are missing or invalid
|
|
121
|
-
cause: STRIPE_KEY missing; NATS_URL is not
|
|
122
|
-
fix:
|
|
122
|
+
cause: STRIPE_KEY is missing (expected a non-empty string); NATS_URL is not an absolute URL (received a string of 4 characters)
|
|
123
|
+
fix: echo 'STRIPE_KEY=<value>' >> .env.development.local # STRIPE_KEY: a non-empty string; also malformed, where grep -n -e '^NATS_URL=' .env* finds them: NATS_URL (an absolute URL)
|
|
123
124
|
```
|
|
124
125
|
|
|
125
|
-
The
|
|
126
|
+
The fix is the line to add, in the file this environment loads: `.env.development.local` in development, `.env.test.local` under test, `.env.production` for a deploy (`envFileFor`, [`packages/core/src/env.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/core/src/env.ts)). Several missing keys are one `printf '%s\n' 'A=<value>' 'B=<value>' >> <file>`; a malformed key is found where it is set (`grep -n -e '^KEY=' .env*`). The cause names each value's shape, never its content. A `fix` on one `envSchema` entry overrides it for that key. `As of 2026-11-19`.
|
|
126
127
|
|
|
127
128
|
| Property | Behavior |
|
|
128
129
|
|---|---|
|
|
129
130
|
| Access | `env.STRIPE_KEY` is typed. A `process.env` read outside the schema is a lint error |
|
|
130
131
|
| Per-role | a role requires only the keys it uses — `ROLE=worker` does not fail on a missing `VAPID` |
|
|
131
132
|
| Repair | `x env example` regenerates `.env.example` from the schema; copy the keys it names into `.env.development.local` in dev, or into your platform's secret store in production. There is **no** `x env --fix` — `x env` declares `check` and `example` and no flags, so `x env check --fix` dies at the parser with `X_CLI_BAD_FLAG` |
|
|
132
|
-
| CI | `x verify`'s `manifest` step holds `.env.example` to the schema's projection (`X_ENV_EXAMPLE_DRIFT`); `x env check` is not a gate step — run it against the deploy's own environment (`ULTIMATE_ENV=production x env check`), where it also reports the framework's deploy-required secrets |
|
|
133
|
+
| CI | `x verify`'s `manifest` step holds `.env.example` to the schema's projection (`X_ENV_EXAMPLE_DRIFT`); `x env check` is not a gate step — run it against the deploy's own environment (`ULTIMATE_ENV=production x env check`), where it also reports the framework's deploy-required secrets. With no `ULTIMATE_ENV` or `NODE_ENV` set it checks as development (as `x dev` runs), except under `CI`, where it checks as production (`As of 2026-11-19`) |
|
|
133
134
|
| Provenance | `/_x` → **Env** shows every resolved key and which source it came from |
|
|
134
135
|
|
|
135
136
|
## What Bun natives replace
|
|
@@ -194,7 +195,7 @@ server itself rather than counted here. The core of it:
|
|
|
194
195
|
| `verify.run` | guessing whether the work is shippable |
|
|
195
196
|
| `logs.tail` | scrollback archaeology |
|
|
196
197
|
|
|
197
|
-
Read tools are unrestricted in dev; write tools are scoped to branch environments. The dev server is never exposed under `ROLE=web`. `db.query` refuses a batch, a write keyword anywhere at statement level (a data-modifying CTE included), a locking clause, `EXPLAIN ANALYZE
|
|
198
|
+
Read tools are unrestricted in dev; write tools are scoped to branch environments. The dev server is never exposed under `ROLE=web`. `db.query` refuses a batch, a write keyword anywhere at statement level (a data-modifying CTE included), a locking clause, `EXPLAIN ANALYZE` (or `ANALYSE`), and the banned function families matched by prefix (`pg_read_*`, `pg_ls_*`, `lo_*`, `pg_advisory_*`, `pg_sleep*`, `set_config`, `pg_copy_*`, `pg_sync_replication_*`, `pg_backup_*`, `pg_start_backup`, `pg_stop_backup`, `pg_restore_*`, `pg_clear_*`, …) — `X_MCP_QUERY_REJECTED`, before the host sees the string. Use `x mcp` for a standalone server (CI, remote agents). Editor config: Biome is the only formatter/linter — one binary, one config, no ESLint or Prettier.
|
|
198
199
|
|
|
199
200
|
## Upgrading and removal
|
|
200
201
|
|
package/wiki/Interface-Rules.md
CHANGED
|
@@ -47,6 +47,8 @@ noticed.
|
|
|
47
47
|
| A refetch keeps the previous data on screen | `asyncStateOf` — `loading` beside a defined `data` is `refreshing`, never `pending` |
|
|
48
48
|
| A failure beats stale data: report the error, do not re-render rows the failed request did not answer | `asyncBranch` tests `failed` first |
|
|
49
49
|
| Placeholder, error, empty and content land in the same box | `reserveBlockSize` is emitted as `--async-reserve` on the region in every branch |
|
|
50
|
+
| A person never reads a shell command: a failure in a page for an end user is the app's own screen | **judgement**: supply `AsyncRegionProps.failed(error, retry)` on every end-user page; it replaces `ErrorState` (code, cause, fix — the developer's report) on that branch. Nothing enforces it: a page that omits `failed` still typechecks and renders `ErrorState` with its shell fix, `As of 2026-11` |
|
|
51
|
+
| A state's title is in the outline when it is a destination | `EmptyState` and `Alert` take `level` (1-6): the title is `role="heading"` with that `aria-level` — an outline entry without six per-level templates in every island; absent, a paragraph |
|
|
50
52
|
| The region carries `aria-busy` while in flight | `AsyncRegion` derives it from `isBusyBranch` |
|
|
51
53
|
| `data: undefined` means nothing has arrived. An empty array is data | `asyncStateOf` |
|
|
52
54
|
| A `{ total: 0, items: [] }` envelope passes its own `isEmpty` — `isEmptyData` does not guess at an envelope | `AsyncRegionProps.isEmpty` |
|
|
@@ -267,7 +269,7 @@ Biome does not read `.scss`. These seven guards are the only thing that does. `A
|
|
|
267
269
|
| A viewport query names a rung of the one ladder | `guards/raw-breakpoint.ts` — `@media` with a `width` feature | `@include tokens.respond-to(md)` / `respond-down(md)` / `respond-between(md, lg)` |
|
|
268
270
|
| A layer is a name | `guards/raw-z-index.ts` — a number in `z-index` | `z-index: tokens.z(dropdown)`; behind its own stacking context, `calc(-1 * #{tokens.z(raised)})` |
|
|
269
271
|
| Elevation comes off the themed shadow scale | `guards/raw-shadow.ts` — a hand-written length in `box-shadow`, `text-shadow` or `drop-shadow()` | `box-shadow: tokens.shadow('sm')`, or `@include tokens.surface` |
|
|
270
|
-
| One tempo | `guards/raw-motion.ts` — a duration or `cubic-bezier()` literal in `transition*` / `animation*`, or assigned to a custom property (`--ease: cubic-bezier(…)`) | `transition: opacity tokens.duration(fast) tokens.easing(out)`; in a custom property, interpolated: `--ease: #{tokens.easing(out)}` |
|
|
272
|
+
| One tempo | `guards/raw-motion.ts` — a duration or `cubic-bezier()` literal in `transition*` / `animation*`, or assigned to a custom property (`--ease: cubic-bezier(…)`) | `transition: opacity tokens.duration(fast) tokens.easing(out)`; in a custom property, interpolated: `--ease: #{tokens.easing(out)}`; the app's own tempo for a rung (`--duration-base: 180ms`): `defineTheme({ motion: { duration: { base: '180ms' } } })` |
|
|
271
273
|
| A class a component reads is a class its sheet compiles | `guards/undefined-style-class.ts` — `styles.x` / `styles['x-y']` against the COMPILED `.module.scss` | the nearest class the sheet declares, or the rule to add |
|
|
272
274
|
| A custom property a sheet reads is one the app declares | `guards/undeclared-custom-property.ts` — `var(--x)` in the compiled CSS with no declaration anywhere and no fallback | the steps the scale really has: `tokens.space(7)` → `0 \| 1 \| 2 \| …` |
|
|
273
275
|
| A guard that reads compiled sheets never passes by reading nothing | `guards/undeclared-custom-property.ts` and `guards/undefined-style-class.ts` — a sheet that does not compile, or an imported one that does not exist, is a finding quoting the compiler's first line; while one is broken, no `var()` read is judged | repair the Sass at the error quoted |
|