@ultimat3/cli 31.47.1 → 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.
- package/CLAUDE.md +30 -23
- package/README.md +96 -4
- package/package.json +29 -29
- package/src/api-registration.ts +28 -14
- package/src/app-load.ts +6 -1
- package/src/app-root.ts +7 -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 +100 -19
- 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 +36 -0
- package/src/cmd-heavy.ts +244 -0
- 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 +15 -4
- package/src/cmd-upgrade-spec.ts +8 -1
- package/src/cmd-upgrade.ts +32 -5
- 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 +26 -0
- package/src/codemods/docs-worker-commands.ts +26 -0
- package/src/codemods/index.ts +6 -0
- package/src/codemods/merge-drivers.ts +66 -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-advisory-floors.ts +30 -8
- 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 +11 -3
- package/src/error-codes.ts +12 -13
- package/src/errors-suite.ts +27 -0
- package/src/errors.ts +18 -22
- package/src/exec.ts +11 -3
- package/src/exercise-registration.ts +4 -3
- package/src/framework-env.ts +7 -3
- 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/guards.ts +2 -2
- package/src/heavy-cores.ts +51 -0
- package/src/heavy-env.ts +21 -0
- package/src/heavy-errors.ts +54 -0
- package/src/heavy-flock.ts +73 -0
- package/src/heavy-holders.ts +78 -0
- package/src/heavy-ledger.ts +400 -0
- package/src/heavy-memory.ts +67 -0
- package/src/heavy-pressure.ts +104 -0
- package/src/heavy-weights.ts +47 -0
- package/src/heavy.ts +308 -0
- 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/local-cli.ts +6 -5
- 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 +18 -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 +6 -0
- package/src/messages.ts +62 -1
- package/src/output-findings.ts +48 -21
- 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/registry-lines.ts +110 -0
- package/src/registry.ts +4 -0
- package/src/retain-sweep.ts +1 -1
- package/src/role-replicator.ts +9 -4
- package/src/role-select.ts +86 -0
- package/src/role-start.ts +13 -55
- package/src/role-sync.ts +10 -5
- package/src/runtime-cache-frame.ts +46 -0
- package/src/runtime-cache-ttl.ts +23 -0
- package/src/runtime-cache.ts +56 -18
- 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-overrides.ts +4 -2
- package/src/runtime-queue.ts +18 -3
- 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/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/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 +1 -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 +59 -13
- 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-agents.ts +9 -6
- package/src/templates/scaffold-claude-commands.ts +7 -1
- package/src/templates/scaffold-claude.ts +4 -4
- package/src/templates/scaffold-container-compose.ts +47 -7
- package/src/templates/scaffold-docs.ts +11 -6
- package/src/templates/scaffold-gitattributes.ts +18 -1
- package/src/templates/scaffold-helm-templates.ts +9 -0
- package/src/templates/scaffold-repo.ts +4 -1
- 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-batches.ts +9 -3
- package/src/test-shards.ts +117 -37
- package/src/test-slots.ts +35 -161
- package/src/test-verdict.ts +79 -0
- package/src/test-workers.ts +15 -0
- package/src/upgrade-gate-codemods.ts +5 -3
- package/src/upgrade-gate.ts +19 -1
- package/src/upgrade-merge-drivers.ts +25 -0
- package/src/upgrade-report.ts +18 -4
- package/src/upgrade-scope.ts +62 -0
- package/src/verify-checks.ts +6 -11
- package/src/verify-coverage-run.ts +9 -5
- package/src/verify-deadline.ts +18 -2
- package/src/verify-heavy-steps.ts +26 -0
- 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 +9 -9
- package/src/verify-tests.ts +35 -22
- package/src/verify-typecheck.ts +25 -2
- package/wiki/Actions.md +2 -1
- package/wiki/Admin-Dashboard.md +2 -2
- package/wiki/Agents.md +5 -5
- package/wiki/Auth.md +15 -5
- package/wiki/Bare-VM.md +1 -1
- package/wiki/Building-Your-Own-Base.md +15 -2
- package/wiki/CI-Parallel-Gate.md +4 -4
- package/wiki/CLI-Reference.md +127 -48
- package/wiki/Caching-And-Invalidation.md +2 -2
- package/wiki/Client-Navigation.md +1 -1
- package/wiki/Configuration.md +32 -13
- package/wiki/Deployment.md +44 -4
- package/wiki/Entities-And-Migrations.md +5 -1
- package/wiki/FAQ.md +1 -1
- package/wiki/Getting-Started.md +2 -2
- package/wiki/Home.md +2 -1
- package/wiki/I18n.md +5 -3
- package/wiki/Installation.md +12 -11
- package/wiki/Interface-Rules.md +1 -1
- package/wiki/Jobs-And-Workflows.md +24 -4
- package/wiki/Known-Gaps.md +2 -2
- package/wiki/MCP-And-AI.md +8 -5
- package/wiki/Mail.md +1 -1
- package/wiki/Many-Agents.md +127 -0
- package/wiki/Migrations-And-Backfills.md +18 -0
- package/wiki/Notify.md +1 -1
- package/wiki/Observability.md +13 -0
- package/wiki/Queries-And-Live-Queries.md +2 -2
- package/wiki/Realtime.md +10 -1
- package/wiki/Routes-And-Render-Modes.md +1 -1
- package/wiki/Scheduled-Tasks.md +4 -1
- package/wiki/Testing.md +12 -9
- package/wiki/Timezones-And-Dates.md +5 -1
- package/wiki/Troubleshooting.md +1 -0
- package/wiki/Tutorial-01-First-App.md +5 -5
- package/wiki/Tutorial-02-First-Feature.md +1 -1
- package/wiki/Tutorial-03-Auth-And-Admin.md +7 -6
- package/wiki/Upgrading.md +37 -0
package/wiki/MCP-And-AI.md
CHANGED
|
@@ -43,7 +43,7 @@ The whole catalog, spelled exactly as each tool must be called; `bunx x mcp tool
|
|
|
43
43
|
| executes code | `tests.run`, `verify.run`, `ui.shot`, `ui.island`, `ui.inspect`, `ui.interact` | scope `dev:test`; all six declare `destructive: true`, so none is metered as read chatter — the four `ui.*` tools launch a browser |
|
|
44
44
|
| write | `db.migrate` | scope `db:migrate`, **branch environments only** |
|
|
45
45
|
|
|
46
|
-
None of them is exposed in `ROLE=web`. `db.query` accepts one statement, whose leading keyword must be `SELECT`/`WITH`/`EXPLAIN`/`SHOW`/`TABLE`/`VALUES` — necessary, never sufficient. Batches, any write keyword at statement level (a data-modifying CTE included), locking clauses (`FOR UPDATE`/`FOR SHARE`), `EXPLAIN ANALYZE
|
|
46
|
+
None of them is exposed in `ROLE=web`. `db.query` accepts one statement, whose leading keyword must be `SELECT`/`WITH`/`EXPLAIN`/`SHOW`/`TABLE`/`VALUES` — necessary, never sufficient. Batches, any write keyword at statement level (a data-modifying CTE included), locking clauses (`FOR UPDATE`/`FOR SHARE`), `EXPLAIN ANALYZE` (and its `ANALYSE` spelling), and whole function families matched by prefix of the called name, quoted and schema-qualified spellings included — file access (`pg_read_*`, `pg_ls_*`, `lo_*`, `dblink`), locks (`pg_advisory_*`), session settings (`set_config`), sleeps (`pg_sleep*`), catalog writes (`pg_import_*`, `pg_restore_*`, `pg_clear_*`), replication and backup control (`pg_copy_*`, `pg_sync_replication_*`, `pg_backup_*`, `pg_start_backup`, `pg_stop_backup`; `As of 2026-11-19`) and the functions that run a query handed to them as text (`query_to_xml*`, `cursor_to_xml*`, `table_to_xml*`, `schema_to_xml*`, `database_to_xml*`, `ts_stat`, `ts_rewrite`) — are **refused**, not discouraged — `X_MCP_QUERY_REJECTED`, enforced before the host sees the string. What the scan cannot read is refused, never decoded: a Unicode-escaped quoted identifier (`U&"…"`) is `X_MCP_QUERY_REJECTED` (`As of 2026-10`). A keyword is matched as Postgres lexes an identifier, so a column `set2` is a column, not `SET`. Its Postgres SELECT-only role is conditional on the connection's own rights; the answer's `guards` array names the defences that engaged. `db.migrate` refuses a target that is not a branch database — `X_MCP_NOT_BRANCH_DB`.
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
### Client config
|
|
@@ -536,7 +536,7 @@ The reference app's `draftReview` (`examples/dummy/apps/web/mcp-tools.ts`) queue
|
|
|
536
536
|
|
|
537
537
|
**From a markdown folder.** `recipes: await markdownRecipes({ dir: join(import.meta.dir, 'docs') })` reads one `*.md` per recipe and serves its body verbatim. The file name is the recipe name. `title:` and `description:` come from `---` frontmatter, else from the first `# ` heading and the paragraph under it. A fence tagged `call` holds one step, `tool {"arg": "value"}`, and is checked at boot like any `step.example`. A whole `"<postId>"` value is a placeholder, so any value passes at boot. A `docs://recipes/<name>` link in the text that names no recipe is `X_MCP_RECIPE_LINK_DANGLING`.
|
|
538
538
|
|
|
539
|
-
**Searching.** `docs({})` lists what this caller can follow. `docs({ name })` and `docs({ uri })` read one recipe. `docs({ q })` inlines the best match, scoring 3 for each word in the name or title, 2 in the description and 1 in the body. On a miss it names the nearest recipes, so a caller with any visible recipe never gets an empty answer.
|
|
539
|
+
**Searching.** `docs({})` lists what this caller can follow. `docs({ name })` and `docs({ uri })` read one recipe. `docs({ q })` inlines the best match (`q` at most 1,000 characters, else `X_INPUT_INVALID`; a miss compares its first 16 words, 64 characters each, for the nearest — `As of 2026-11-19`), scoring 3 for each word in the name or title, 2 in the description and 1 in the body. On a miss it names the nearest recipes, so a caller with any visible recipe never gets an empty answer.
|
|
540
540
|
|
|
541
541
|
**Per caller.** `extraRecipes: (caller) => recipes` adds the caller's own recipes, such as a tenant's runbooks. They are listed as `source: 'caller'` on `docs`, and on `resources/list` and `resources/read` to that caller only. They are not checked at boot. A recipe that names a tool the caller cannot call is not shown.
|
|
542
542
|
|
|
@@ -552,6 +552,9 @@ Remote MCP tools as this app's actions — the app's `policy`, rate limit, confi
|
|
|
552
552
|
| Reviewed | `allow` is required; `lock` is the committed `tools.lock.json` written by `x mcp lock <name>`; `x mcp lock <name> --check` writes nothing and fails on drift |
|
|
553
553
|
| Drift | a missing, re-described or re-shaped tool is `X_MCP_REMOTE_TOOL_CHANGED` — at declaration against the lock, before the first call against the live server |
|
|
554
554
|
| Wire | `outbound()` (`dial: 'public'` by default, deadline, size cap); modern era first, then legacy `initialize` + `Mcp-Session-Id`; JSON or SSE answers |
|
|
555
|
+
| Era fallback | the legacy handshake only when the first modern call is refused for its era: a `400`/`404`/`405`, JSON-RPC `-32022`/`-32601`/`-32600`/`-32602`, or a body that is no answer. Never on a `429`, `408` or `403`, a refusal of the moment. Concurrent first calls share one handshake; a failed handshake leaves the era undecided, so the next call tries again (`eraRefusal`, `packages/mcp/src/remote-client.ts`, `As of 2026-11`) |
|
|
556
|
+
| Paging | `listTools()` follows `nextCursor` for at most 50 pages; a cursor still open past that is `X_MCP_REMOTE_REFUSED`, `meta.failure: 'malformed'`, never a truncated list |
|
|
557
|
+
| Cancel | a legacy server hears `notifications/cancelled` for the aborted call's own request id, and only when the request was already sent |
|
|
555
558
|
| Untrusted | the answer arrives as `{ untrusted, isError }`, fenced `<untrusted source="mcp:<name>/<tool>">`, middle-cut past `maxResultChars`; invisible format characters stripped, then every `<` (and full-width `<`, small `﹤`) written `<` — no spelling of `</untrusted>` survives |
|
|
556
559
|
| Exposed | `expose` defaults to `false`: the actions are this app's, not its `/mcp`'s, so `include: 'exposed'` leaves them out; they are declared `agents: true`, so this app's own `agent()`s are offered them anyway. `expose: true` opts one remote server in, and this app's `/mcp` then answers for a third party's tools |
|
|
557
560
|
| Re-checked | the live list is held to the lock before the first call, on every `list_changed`, and again once a verdict is `reverifyMs` old (default 3,600,000) — a remote that changes silently is caught within the hour |
|
|
@@ -576,13 +579,13 @@ Remote MCP tools as this app's actions — the app's `policy`, rate limit, confi
|
|
|
576
579
|
|
|
577
580
|
1. `begin(serverUrl)` reads the server's RFC 9728 protected-resource document, then its authorization server's RFC 8414 metadata. It answers `{ authorizeUrl, handshake }`, with PKCE S256 from `@ultimat3/auth` and `resource` per RFC 8707.
|
|
578
581
|
2. Redirect the person to `authorizeUrl`. Keep `handshake` server-side, in the person's session.
|
|
579
|
-
3. On the callback, `exchange(handshake, { code, state })` answers `{ accessToken, refreshToken, expiresIn }`. `refresh(handshake, refreshToken)` answers the same shape
|
|
582
|
+
3. On the callback, `exchange(handshake, { code, state })` answers `{ accessToken, refreshToken, expiresIn }`. `refresh(handshake, refreshToken)` answers the same shape; when the server's answer carries no `refresh_token`, `refresh` answers the one it was passed (RFC 6749 §6), never `null`.
|
|
580
583
|
4. Store the tokens per connection. Return the access token from `mcpTools({ auth })`, which is read on every call, so a rotated token is never cached.
|
|
581
584
|
|
|
582
585
|
`begin` refuses, as `X_MCP_REMOTE_REFUSED`, metadata it cannot trust: a document that is not a URL,
|
|
583
586
|
resource metadata naming another resource (RFC 9728 §3.3), authorization-server metadata answering
|
|
584
587
|
for another issuer (RFC 8414 §3.3), no PKCE S256, and an `authorization_endpoint` or `token_endpoint`
|
|
585
|
-
that is not `https:` — `http:` only on a loopback host (`localhost`, `127.0.0.1`, `[::1]`, RFC 8252).
|
|
588
|
+
that is not `https:` — `http:` only on a loopback host (`localhost`, `127.0.0.1`, `[::1]`, RFC 8252). The same rule holds for the server URL and the authorization-server issuer, checked before either's metadata is fetched (`As of 2026-11-19`).
|
|
586
589
|
`authorizeUrl` is handed to a person as a link, so a `javascript:` endpoint would run in the app's
|
|
587
590
|
origin. `As of 31.15.0`.
|
|
588
591
|
|
|
@@ -856,7 +859,7 @@ pgvector in the same Postgres. No second datastore.
|
|
|
856
859
|
| Embeddings | an `Embedder` value, never an entity option: `remoteEmbedder({ name, dimension, baseUrl? })` speaks the `/v1/embeddings` shape (`EMBEDDINGS_API_KEY`), `hashEmbedder()` is the offline default |
|
|
857
860
|
| Writing | `indexDocument({ store, embedder, document })` chunks, embeds, upserts and prunes the stale tail; a sweep over many rows is the app's `backfill()` calling it per page |
|
|
858
861
|
| Index | HNSW: `postgresVectorStore({ name, dimension }).ddl()` prints the table and both indexes, pasted into a migration by the app |
|
|
859
|
-
| Hybrid search | one `query` primitive fusing pgvector cosine + Postgres FTS with Reciprocal Rank Fusion; weights are config |
|
|
862
|
+
| Hybrid search | one `query` primitive fusing pgvector cosine + Postgres FTS with Reciprocal Rank Fusion; weights are config. The lexical leg (`searchText`, `hybrid`) matches **any** word of the query, one `phraseto_tsquery` per whitespace-separated word OR-ed, as `memoryVectorStore()` does (`As of 2026-11-19`; before, every word had to match, so a whole question matched nothing). Nothing typed is query syntax: `"quoted phrase"`, `-word` and `or` are plain text, and an identifier the parser splits (`x_vector_drift`) still matches as one phrase |
|
|
860
863
|
| Filtering | tenant + policy filters applied **in SQL**, so vector search cannot leak across tenants; a store with no tenant bound, read inside a request acting for an org, is `X_VECTOR_UNSCOPED` — a backfill opts in with `scope: UNSCOPED` |
|
|
861
864
|
| HNSW recall | a search returns `k` hits for a small tenant on a large shared table: on pgvector ≥ 0.8 it runs with `hnsw.iterative_scan = relaxed_order`, before that with `hnsw.ef_search` raised to `max(40, k × 10)`, capped at 1,000 — the setting scoped to a read-only transaction the search opens (2–3 round trips), or to the caller's own, put back after (`pg-vector-recall.ts`). Without it pgvector took the 40 nearest rows and filtered afterwards, so a tenant holding a small share of the table got fewer than `k`, often none. `As of 31.15.0` |
|
|
862
865
|
| Re-embed | `indexDocument` again: every chunk is embedded on each call, so a job decides when text changed |
|
package/wiki/Mail.md
CHANGED
|
@@ -55,7 +55,7 @@ between environments — the credential does.
|
|
|
55
55
|
|---|---|
|
|
56
56
|
| nothing set, `development` / `test` | `memoryMailDriver()` — caught in the `/_x` mail panel, never sent |
|
|
57
57
|
| nothing set, `staging` / `production` | `unconfiguredMailDriver(...)` — every send is `X_MAIL_CREDENTIAL_MISSING`; the boot still succeeds, so an app that sends no mail deploys |
|
|
58
|
-
| `SMTP_URL` + `MAIL_FROM` | `smtpMailDriver(...)` — ESMTP over `Bun.connect`, STARTTLS required unless `allowInsecure` |
|
|
58
|
+
| `SMTP_URL` + `MAIL_FROM` | `smtpMailDriver(...)` — ESMTP over `Bun.connect`, STARTTLS required unless `allowInsecure`. `MAIL_POOL_SIZE`, `MAIL_TIMEOUT_MS` optional |
|
|
59
59
|
| `RESEND_API_KEY` + `MAIL_FROM` | `resendMailDriver(...)` — one `POST /emails` with an `Idempotency-Key` |
|
|
60
60
|
| `SES_REGION` + `SES_ACCESS_KEY_ID` + `SES_SECRET_ACCESS_KEY` + `MAIL_FROM` | `sesMailDriver(...)` — one SES v2 `SendEmail` with the raw MIME, SigV4-signed, no SDK. `SES_SESSION_TOKEN`, `SES_ENDPOINT`, `SES_CONFIGURATION_SET` optional |
|
|
61
61
|
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Working with many agents
|
|
2
|
+
|
|
3
|
+
**A parallel worker runs its own files. The coordinator runs the whole gate, once, at the end.** Every other rule on this page exists so that this one holds when several agents, in several checkouts and repositories, share one machine. `As of 2026-11-18`.
|
|
4
|
+
|
|
5
|
+
| Who | Runs | Never runs |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| a worker with a file set | `bun test ./its/file.test.ts`, `x test --filter <path>` over up to 3 files, `biome check <its paths>` | `x verify`, `bun run verify`, a whole `x test`, `bun run coverage` |
|
|
8
|
+
| the coordinator | `bun run verify` (or `x verify`) once, after the workers land | a second gate beside the first |
|
|
9
|
+
| a read-only agent (research, explore) | one command at a time, output bounded with `head` | any build, test, typecheck or index run |
|
|
10
|
+
|
|
11
|
+
**Read-only fan-out has its own limit.** Those agents write nothing, so they take no file set, but each is a whole session no ledger can see: its memory is outside the machine's accounting. Start a handful, not one per question.
|
|
12
|
+
|
|
13
|
+
## The machine ledger
|
|
14
|
+
|
|
15
|
+
One ledger per machine and user, at `/tmp/ultimate-heavy-<uid>`, shared by every checkout and every Ultimate app on the machine. It admits **half of the memory this process may use** (the smallest of RAM and every cgroup `memory.max` above it). Each heavy run reserves its measured peak first, in arrival order, and waits when it does not fit.
|
|
16
|
+
|
|
17
|
+
| Enters the ledger | Reserves |
|
|
18
|
+
|---|---|
|
|
19
|
+
| `tsc -b` of a monorepo (`x verify`'s `typecheck`, `bun run typecheck` at this repository's root) | 6,016 MB, plus this checkout's one-compiler lock |
|
|
20
|
+
| `tsc -p .` of an app (`x verify --only typecheck`) | 768 MB, plus the same lock |
|
|
21
|
+
| `biome check .` (`x verify --only lint`) | 2,112 MB |
|
|
22
|
+
| every batch of `bun test` workers (`x test`, `x verify`'s suites) | 704 MB + 1,280 MB per worker |
|
|
23
|
+
| an e2e lane (`x test e2e`, `x verify --only e2e`) | 3,072 MB |
|
|
24
|
+
| one coverage unit (`bun run coverage`), one heavy `bun run preflight` step | 704 MB + 1,280 MB per worker |
|
|
25
|
+
| anything under `x heavy run` | `--mb`, default a monorepo typecheck |
|
|
26
|
+
|
|
27
|
+
**What does not enter it, stated:** a bare `bun test ./path`; `x test` selecting 3 files or fewer; an app's own `bun run typecheck` and `bun run lint` scripts (raw `tsc` and `biome`: a scaffolded agent brief says `bunx x verify --only typecheck` instead); `x build`, including the one `budgets` runs; the `drift`, `exercise` and `contract-diff` steps; `x dev`; the test services in Docker; the agent sessions themselves. Those are why only half the memory is offered.
|
|
28
|
+
|
|
29
|
+
Every entry is an `flock(2)`, and a holder hands the locked descriptor to the command it starts, so the kernel frees a reservation only when the holder **and** that command are gone. Kill a wrapper with `kill -9` and its reservation lasts until the command it started exits; a killed waiter leaves the queue at once. Descendants keep it only by inheritance: a shell's background job does, and a process started through `Bun.spawn` or `node:child_process` does not, because both close the descriptor. So a daemon a shell left running keeps the reservation until it stops (`x heavy status` names the run), and workers a killed `bun` command leaves behind are unaccounted. `As of 2026-11-18`, Bun 1.4.4.
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
x heavy status # who runs, who waits, load, memory
|
|
33
|
+
x heavy status --json
|
|
34
|
+
x heavy run --label suite --mb 4096 -- bun run test # any command, in any repository
|
|
35
|
+
x heavy run --max-wait 300 -- bun run test # give up after 5 minutes in the queue
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**A waiter needs nothing from you: leave it running, it starts by itself.** It prints one line on stderr saying its position, who holds the memory and that, and again only when that changes, so `--json` output stays one document. Killing a waiter loses its place, so a harness with a short command timeout should run the command in the background. To bound the wait, `x heavy run --max-wait <seconds>` stops with `X_HEAVY_WAIT_EXPIRED` and exit 75, without starting the command; `0` is one attempt.
|
|
39
|
+
|
|
40
|
+
`x heavy status` names each reservation's processes. After `kill -9` of a wrapper it reads `wrapper pid N exited, command pid M`: M is what still holds the memory, and `--json` carries the same as `wrapperAlive` and `childPids`.
|
|
41
|
+
|
|
42
|
+
`x heavy run` passes the exit code through and forwards stop signals. A process started inside a reservation inherits it (`ULTIMATE_HEAVY_HOLD`) and never queues behind its own parent. Time spent queued does not count against an `x verify` step's deadline.
|
|
43
|
+
|
|
44
|
+
## Merging two features
|
|
45
|
+
|
|
46
|
+
**Two branches that each ran `x g resource` merge with no hand edit.** `bun run setup` installs the drivers (`x merge-driver install`); `.gitattributes` says which file takes which. `As of 2026-11-19`.
|
|
47
|
+
|
|
48
|
+
| Files | On a merge | After it |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| `apps/web/api/index.ts`, `apps/web/exercise.ts`, `apps/web/shared/roles.ts`, `packages/db/src/client.ts` | what both sides **added** is kept, sorted, so either merge direction writes the same bytes | nothing |
|
|
51
|
+
| `packages/i18n/catalogs/*.json` | three-way by key | nothing |
|
|
52
|
+
| `x.manifest.json`, `openapi.json` | our copy is kept | `bunx x manifest`, then commit |
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
git merge feature-b
|
|
56
|
+
bunx x manifest
|
|
57
|
+
bunx x verify
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**What stays a conflict, on purpose:**
|
|
61
|
+
|
|
62
|
+
| Both branches | Why a person decides |
|
|
63
|
+
|---|---|
|
|
64
|
+
| changed or removed one existing line | `merge=union` would keep both, so a revoked grant in `roles.ts` would come back |
|
|
65
|
+
| declared one key, or one import name, differently | either could be the right one |
|
|
66
|
+
| gave one catalog key two wordings | which text ships is a decision |
|
|
67
|
+
|
|
68
|
+
`X_MERGE_UNRESOLVED` lists what is left: `git diff --name-only --diff-filter=U`. Resolve each, `git add` it, finish the merge.
|
|
69
|
+
|
|
70
|
+
- **Why one entry per line.** Registries are written that way (`x new`, and the `merge-drivers` codemod on `x upgrade`), because a list on one line is one line both sides changed. Keep the comment inside the list: it is what stops Biome joining the list back up.
|
|
71
|
+
- **Where the drivers do not run.** A hosted merge button and a clone that never ran setup use git's plain text merge, so the same files conflict there and nothing is lost. Merge locally. `x doctor` warns `X_MERGE_DRIVER_UNSET` on such a clone.
|
|
72
|
+
- **Migrations: `bunx x db gen --merge-fork`.** Two branches that each ran `x db gen` fork the chain: the newest snapshot lacks the other branch's table. `x db gen`, `x db migrate` and the gate's `drift` step refuse it as `X_MIGRATION_FORKED`, before any `record …` migration is suggested. `--merge-fork` corrects the newest `.snapshot.json` only: no SQL changes and nothing is deleted, so it is safe after either migration was applied. Two creates of one table are the exception: run `bunx x db status --json` on every database first, and remove a migration only if `data.pending` lists it on all of them ([Migrations](Migrations-And-Backfills)).
|
|
73
|
+
- **One `x db gen` at a time per checkout.** A second run waits on the checkout's `db-gen` lock instead of diffing the same sidecar and writing a second `create table`. With several agents in one checkout, one run's migration can still record another agent's new entity: the success line names the migration and its tables, and "no migration needed" names the migration that already records them.
|
|
74
|
+
|
|
75
|
+
## CPU pressure
|
|
76
|
+
|
|
77
|
+
Memory alone does not bound a machine: at 14.3 of 15.9 GB reserved, an 8-core box sat at load 74 with 69 runnable tasks and `cpu some avg10` at 95.8 (`As of 2026-11-18`). So the queue's head also waits while the CPU is saturated **and** another heavy run is admitted:
|
|
78
|
+
|
|
79
|
+
| Signal | Waits at |
|
|
80
|
+
|---|---|
|
|
81
|
+
| PSI `cpu some avg10` (`/proc/pressure/cpu`) | 80% |
|
|
82
|
+
| without PSI: runnable tasks per core | 2 |
|
|
83
|
+
|
|
84
|
+
First come, first served still holds: only the head is judged. With nothing admitted one run always starts, whatever the pressure and wherever it comes from, and a head held back by CPU alone goes anyway after 5 minutes, so a long holder cannot starve the queue. The wait line then reads `waits for CPU … CPU pressure 96% (new runs wait at 80%)`; `x heavy status` prints the reading as `cpu:`, and `--json` carries `data.machine.cpu` and `data.cpuGate`. Off in CI, inside a test run, and with `ULTIMATE_HEAVY_CPU=0`. The figures and the reasoning: `packages/cli/src/heavy-pressure.ts`.
|
|
85
|
+
|
|
86
|
+
## Cores
|
|
87
|
+
|
|
88
|
+
Locally a run takes **at most 4 cores**, fewer when other sessions' runnable tasks already fill the machine, and never below 2. Test workers are capped per batch, so a run narrows and widens as the machine changes; `tsc` and `biome` get the cap as `GOMAXPROCS` and `RAYON_NUM_THREADS`. `--workers N` is taken as written. CI takes every core. A run held below its plan says `ran 2 at once (peak), planned 4`; `x test --json` carries it as `data.peakWorkers`.
|
|
89
|
+
|
|
90
|
+
## Neighbouring dev servers
|
|
91
|
+
|
|
92
|
+
`x dev` on a taken port refuses with `X_PORT_IN_USE`, naming the holder's pid and directory, and its fix names a pair of ports that is free when asked. `x doctor` reports a port held from **another checkout** as a warning, because nothing is wrong with this environment. A port held from this checkout, or by a process the OS will not name, stays a finding.
|
|
93
|
+
|
|
94
|
+
## Test service stacks
|
|
95
|
+
|
|
96
|
+
The `live` step prints one line on stderr for the stack it got:
|
|
97
|
+
|
|
98
|
+
| Line | Meaning |
|
|
99
|
+
|---|---|
|
|
100
|
+
| `services: started <project>` | this run started containers, and leaves them running for the next |
|
|
101
|
+
| `services: reused <project>` | they were already up, from this checkout |
|
|
102
|
+
| `services: shared <project> with <dir>` | another checkout of this app started them (same first commit, or same `origin`), or `ULTIMATE_TEST_SERVICES_SHARED=1` says the share is intended |
|
|
103
|
+
|
|
104
|
+
The compose project is the `name:` in `docker/docker-compose.test.yml`. An app `x new` wrote before 31.49.0 states `<app>-test`, so two different apps with one name land on the same stack; from 31.49.0 `x new` writes `<app>-test-<hash of the scaffold directory>` and picks the ports from both, so they do not (`As of 2026-11-19`). A shared name is refused: the step reports `X_TEST_SERVICES_UNAVAILABLE` naming the other directory — a stack that is stopped is said to be stopped, its fix `docker compose -p <project> down --volumes` — compose is not run, and the live suites run without the stack (red when the floor holds `live` and nothing ran). Checkouts git cannot tie together count as different apps. For good: give the app its own `name:` and ports, in the compose file and `docker/test-services.env`.
|
|
105
|
+
|
|
106
|
+
`x clean --services` stops this checkout's stack, keeps one another living checkout started, and lists every other test stack on the machine with its stop command, marking those whose checkout is gone. It stops nothing else.
|
|
107
|
+
|
|
108
|
+
## Switches
|
|
109
|
+
|
|
110
|
+
| Variable | Effect |
|
|
111
|
+
|---|---|
|
|
112
|
+
| `ULTIMATE_HEAVY_MEMORY=8g` | what the ledger admits; `0` turns it off |
|
|
113
|
+
| `ULTIMATE_HEAVY_CORES=6` | the local core ceiling |
|
|
114
|
+
| `ULTIMATE_HEAVY_CPU=0` | no waiting on CPU pressure; memory still applies |
|
|
115
|
+
| `ULTIMATE_HEAVY_DIR=<path>` | another ledger; also opts a test run in |
|
|
116
|
+
| `ULTIMATE_TEST_SLOTS=0` | test workers skip the ledger |
|
|
117
|
+
| `ULTIMATE_TEST_SERVICES_SHARED=1` | another app's test stack under this app's project name is shared on purpose |
|
|
118
|
+
|
|
119
|
+
Admission is off under `CI`, inside `bun test` (a fixture's `x test` must not queue behind real work), and on **Windows**, which has no `flock`: the core cap still applies there and `x heavy status` says why admission is off. A ledger that cannot work is reported as `X_HEAVY_LEDGER_UNAVAILABLE` and the command goes ahead; it never fails a run.
|
|
120
|
+
|
|
121
|
+
## Re-measuring a weight
|
|
122
|
+
|
|
123
|
+
Each figure sits in [`packages/cli/src/heavy-weights.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/src/heavy-weights.ts) beside its command. Re-read one on a clean snapshot:
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
GOMAXPROCS=4 bun run scripts/heavy-peak.ts -- node_modules/.bin/tsc -b --pretty false
|
|
127
|
+
```
|
|
@@ -55,6 +55,19 @@ Every migration applies inside its own transaction, recorded into `x_migrations`
|
|
|
55
55
|
|
|
56
56
|
Its two remedies, in the order they are safe to run: `git checkout -- packages/db/migrations/<id>.snapshot.json`, or, when the file was never written, `rm packages/db/migrations/<id>.* && x db gen "<name>"`. The delete comes first because `x db gen` against the migration that is still there raises this same code. Until 2026-08 the `fix:` said "restore … from version control" alone while `x db migrate`'s `unknown-schema` difference answered `x db gen "snapshot <name>"` — each naming the command that raises the other, with nothing to restore in an app whose sidecar was never written.
|
|
57
57
|
|
|
58
|
+
### Two branches, one chain — `X_MIGRATION_FORKED`
|
|
59
|
+
|
|
60
|
+
Two branches that each run `x db gen` from one parent leave valid SQL and a wrong sidecar: the newest `.snapshot.json` has never heard of the other branch's work. `As of 2026-11` every reader refuses that chain before acting on it: `x db gen`, `x db migrate`, `x db reset`, the `drift` step and `x doctor`.
|
|
61
|
+
|
|
62
|
+
| The chain holds | Fix | What it touches |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| an object the newest sidecar omits, or one it still records after another migration dropped it | `x db gen --merge-fork` | the newest `.snapshot.json`, then the `.hash` and the schema dump. No `.sql`, so no checksum moves, and it is safe after either migration was applied |
|
|
65
|
+
| two unguarded creates of one table or column, so a replay stops at `42P07` / `42701` | `x db status --json` on **every** database first | remove a migration only if `data.pending` lists it on all of them, then `x db gen --merge-fork`. A migration any database applied stays |
|
|
66
|
+
|
|
67
|
+
The detector folds the chain: each sidecar adds what it records, each `up` removes what it drops, and what survives is what a replay builds (tables, columns, indexes, foreign keys, checks, views). A migration with no sidecar was written by hand and ends what earlier sidecars can claim. Never answer a fork with a new migration: `create table` for a table the chain already builds is the statement that cannot replay.
|
|
68
|
+
|
|
69
|
+
`x db gen` also runs one at a time per checkout, `As of 2026-11`: two overlapping runs diffed one sidecar and each wrote every new table. The entities are one registry, so the first run's migration carries a second agent's table too: its summary names the tables, and the later run's names the newest migration. The lock is the machine ledger's, so it is off under `CI`, on Windows and with `ULTIMATE_HEAVY_MEMORY=0`; there, a collision is what `X_MIGRATION_FORKED` reports afterwards.
|
|
70
|
+
|
|
58
71
|
### Foreign keys are their own statement
|
|
59
72
|
|
|
60
73
|
Every foreign key is `alter table … add constraint`, emitted **after** every table statement, and
|
|
@@ -294,6 +307,10 @@ A NOT NULL contract is the same story. On an empty table — a fresh or `x db re
|
|
|
294
307
|
| `X_MIGRATION_ROLLING_UNSAFE` | a column leaves the entity without having been retired, with or without `--allow-destructive`. Also a retired name no migration records or `columns` still declares, a NOT NULL column with no default or a key column (the new release's inserts would fail, so relax it first), a committed `drop`/`rename` when the `drift` rail is on, and a retire and its drop both pending on a live production database |
|
|
295
308
|
| `X_MIGRATION_IRREVERSIBLE` | the retired column is removed without `--allow-destructive`. Retiring is not consent to losing the rows |
|
|
296
309
|
|
|
310
|
+
**A plain column made `generated` is a drop**, `As of 2026-11-19`: Postgres has no `set expression` for it, so the migration drops the column and adds it back computed, and the stored values are gone. `x db gen` asks the same two consents: `X_MIGRATION_ROLLING_UNSAFE` unless the column was retired first (or `--rolling-unsafe`), then `X_MIGRATION_IRREVERSIBLE` unless `--allow-destructive`. Before, it wrote the migration unasked.
|
|
311
|
+
|
|
312
|
+
**A drop's `down` restores the column's indexes and foreign keys**, `As of 2026-11-19` — those the previous `.snapshot.json` recorded over it, for every dropped column, retired or not. The rows, NOT NULL and the default are not restored. Only newly generated migrations change.
|
|
313
|
+
|
|
297
314
|
An app that stops before it starts (one instance, `strategy: Recreate`) says so: `x db gen "drop legacy" --allow-destructive --rolling-unsafe` writes `-- rolling-unsafe: true` and needs no retire.
|
|
298
315
|
|
|
299
316
|
**The rail.** `rollingSince: "<migration id>"` in `x.verify.json` turns on the `drift` step's fifth rail for every migration after that id: a `drop column` with no `-- retires` in an earlier file, a `rename column`, a `rename table`. A closed list, on statements and not on prose. `x new` writes `"0"`. Unset, the rail does not run, because an applied migration cannot gain a marker (checksum); `x doctor` prints one line naming the id to set. A retire before the bound still earns the drop after it.
|
|
@@ -568,6 +585,7 @@ Scaffolds a working pair, never a stub: `x g backfill <name> --feature <slice>`
|
|
|
568
585
|
| `X_MIGRATION_CONFLICT` | the ledger disagrees with this build — a foreign app-version row that is not a rollback (rows all newer than the build are accepted), or an applied migration whose checksum moved | deploy the version `cause` names, or `x db gen "fix <migration>"` — never edit an applied migration |
|
|
569
586
|
| `X_MIGRATION_IRREVERSIBLE` | a generated plan drops a column or table and its `down` cannot restore the rows | `x db gen "<name>" --allow-destructive`, or put the column back in `columns` and keep it |
|
|
570
587
|
| `X_MIGRATION_DESTRUCTIVE` | a committed migration's `up` destroys data with no `-- destructive: true` line | add the marker, or regenerate with `--allow-destructive` — before the migration is applied |
|
|
588
|
+
| `X_MIGRATION_FORKED` | two branches generated from one parent and were merged, so the newest sidecar is wrong or two migrations create one object | `x db gen --merge-fork`, which changes no SQL and deletes nothing. A collision: `x db status --json` on every database first, and never delete a migration any of them applied |
|
|
571
589
|
| `X_MIGRATION_SNAPSHOT_MISSING` | the newest migration on disk carries no `.snapshot.json` sidecar to diff against | `git checkout -- packages/db/migrations/<id>.snapshot.json` — or, when it was never written, `rm packages/db/migrations/<id>.* && x db gen "<name>"`, the delete first |
|
|
572
590
|
| `X_MIGRATION_CONCURRENT_IN_TRANSACTION` | a migration without `-- transaction: false` holds a concurrent index statement, which Postgres refuses inside a transaction block (`25001`) | `sed -i '1i -- transaction: false' packages/db/migrations/<id>.sql` before it is applied, or move the statement into a migration of its own. Refused before `BEGIN`, so nothing is applied |
|
|
573
591
|
| `X_MIGRATION_VIEW_DEPENDS` | a view is compiled against a column this migration retypes — Postgres answers `0A000` and rolls the whole migration back | `drop view "<v>";` then `x db migrate`, then re-create it from the `create view` the `fix` line carries verbatim. Caught by a **preflight** inside the migration's own transaction, before its first statement, so nothing partial is applied |
|
package/wiki/Notify.md
CHANGED
|
@@ -167,7 +167,7 @@ What each push-service answer does:
|
|
|
167
167
|
| 404 / 410, or an expired subscription | the subscription is deleted; nothing is retried |
|
|
168
168
|
| 429 / 5xx / no connection | `X_PWA_PUSH_FAILED` — thrown after every other device was tried, so the delivery fails as `X_NOTIFY_DELIVERY_FAILED` and the notifier job retries on its own backoff |
|
|
169
169
|
| 400 / 413 | `X_PWA_PUSH_REJECTED` — logged and counted, never retried |
|
|
170
|
-
| 401 / 403 | `X_PWA_PUSH_REJECTED
|
|
170
|
+
| 401 / 403 | `X_PWA_PUSH_REJECTED` — logged with its code and counted as `refused`; the subscription is **kept** (`As of 2026-11-19`): a push service answers a fault in this server's token (a `pwa.vapid.subject` it refuses, a skewed clock) the same way as a rotated key, and deleting on it unsubscribed every device a send reached. After a real key rotation `subscribeToPush` (or the emitted `subscribePush`) replaces such a browser's subscription the next time it asks |
|
|
171
171
|
|
|
172
172
|
A retry re-sends to the devices that already got it; the `tag` makes that a replacement on the device
|
|
173
173
|
rather than a second notification. `renotify` without a `tag` is dropped with a warning — the spec
|
package/wiki/Observability.md
CHANGED
|
@@ -192,6 +192,18 @@ The body always opens with a `target_info` gauge carrying the service identity,
|
|
|
192
192
|
| `x dev` with no `METRICS_PORT` moves off a taken port | two apps on one laptop both default to 9090: the second binds a free port, logs `ultimate metrics port taken`, and reports the real URL in `x dev --json`'s `metrics`. A declared `METRICS_PORT`, and every container, refuses with `X_PORT_IN_USE` — a scraper was told that port |
|
|
193
193
|
| Answered outside the request pipeline | no auth stage, no rate limit, no locale — a saturated or draining process must still be able to say how saturated it is. Same shape as `/healthz` |
|
|
194
194
|
|
|
195
|
+
### A container running N processes
|
|
196
|
+
|
|
197
|
+
`As of 2026-11`, a production container with a CPU budget runs one process per CPU ([Processes per container](Deployment#processes-per-container)). The scrape stays one target:
|
|
198
|
+
|
|
199
|
+
| Signal | Shape |
|
|
200
|
+
|---|---|
|
|
201
|
+
| `/metrics` on `METRICS_PORT` | the supervisor's: each child's own scrape (loopback, an ephemeral port), merged under one `# HELP` / `# TYPE` per family, every sample labelled `child="<i>"`. A child that does not answer within 2 s is left out of that scrape |
|
|
202
|
+
| counters and histograms | per child: `sum by (…)` over `child` is the container's total, as it is over pods |
|
|
203
|
+
| **process-global gauges** | appear **N times**, once per child — `queue_demand`, `queue_depth`, `queue_oldest_ready_seconds` and the `db_server_*` gauges are each child's reading of one shared fact. **Use `max`, never `sum`**: a sum reads N× the backlog and scales the fleet N× |
|
|
204
|
+
| log lines | every line a child writes carries `"child": <i>`; the supervisor's carry `"child": "supervisor"`. A caller's own `child` field moves to `field.child`. A child whose boot throws says so first as `ultimate child refused to boot` (`error`, with the code, cause and fix) — the line `X_PROCESS_CRASH_LOOP` sends you to |
|
|
205
|
+
| `/healthz`, `/readyz` | the supervisor's: alive and not in a crash loop; at least one child ready, every other one ready or draining, the container not stopping |
|
|
206
|
+
|
|
195
207
|
## The series autoscaling reads
|
|
196
208
|
|
|
197
209
|
Declared in `runtime-metrics.ts`, so the role table, the Helm chart and the scrape cannot drift apart.
|
|
@@ -277,6 +289,7 @@ CPU autoscaling is wrong for `sync` and `worker`: a node holding 80k idle socket
|
|
|
277
289
|
| Head sampling | `otel.sampling`, default `0.1`; errors are always sampled |
|
|
278
290
|
| OTLP delivery | a 429, 502, 503, 504 or a transport failure is retried, 3 attempts with full jitter and `Retry-After` honoured, inside the exporter's `timeoutMs` (default 10 s, the whole export); any other status is one POST. One `otlp export rejected`/`failed` line per batch, with `attempts`. A collector that accepted and then answered 503 receives that batch twice; span ids dedupe it |
|
|
279
291
|
| Error grouping | `errorFingerprint(report)`: 16 hex over `code`, `source`, `scope.operation`, plus the top application frame (function and root-relative path, no line) for `X_INTERNAL`. Never the cause or an id, so two throws differing in a row id are one group, and a deploy is not a new one. The Sentry envelope sends it as `fingerprint` |
|
|
292
|
+
| Monitor delivery | the `SENTRY_DSN` transport (`sentryErrorReporter`) reads each answer, `As of 2026-11-19`: one `warn` line per refused status (`error reporter delivery refused; events are being dropped`, with `status`), a 429 pauses sends for its `Retry-After` — 60 s when it states none — and reports in the pause are dropped, every answer's body is cancelled, and a throw while reading is logged, never an unhandled rejection. `X_ERROR_REPORTER_DSN_INVALID` names the DSN with its userinfo removed |
|
|
280
293
|
| Log level | `LOG_LEVEL`, default `info`. The framework's own policy (`As of 2026-11`): a routine per-unit event (one per request, job, fire or message) is `debug`; `info` is lifecycle and rare outcomes; `warn` asks an operator to act. `scripts/log-levels.ts` refuses an unstated per-unit `info` line in the framework (`X_LOG_LEVEL_UNSTATED`) |
|
|
281
294
|
| Secret redaction | a `Secret` is redacted by value before every other branch, at any depth → [Configuration](Configuration) |
|
|
282
295
|
| Value redaction | `redactValues([{ pattern: /acct_[0-9]{10}/g, replace: '[account]' }])`, once at boot (`As of 2026-11`): every match is rewritten in the log line's message and field strings, an `Error`'s message, and the monitor envelope's exception value, `fix`, `stack`, extras and `meta`, a span's exception event and status message, and a failure bundle's captured values. Key redaction (`redactKeys`) cannot see a value inside a message; this can. The `g` flag is required; a sticky pattern, one matching the empty string, or a repeated group holding a repeating quantifier (`(a+)+`, `(a+){2,40}`; only `?`/`{0,1}` do not repeat) is refused with `X_REDACT_PATTERN_UNSAFE`, and the whole list with it. Appends, like `redactKeys`; the framework registers no pattern |
|
|
@@ -220,7 +220,7 @@ export const queries = queryClient<Api['queries']>({ baseUrl }); // reads
|
|
|
220
220
|
| Why two clients and not one | actions and queries are two registries (`defineApi`'s `actions:` and `queries:` keys) answering two methods. A read taken off the action client is a name that does not exist on `Api['actions']` — a compile error, which is the point |
|
|
221
221
|
| Types | the read's own `input` and row type. A list read answers `readonly TRow[]`, `limit(1)` included; a `single: true` read answers `TRow` and rejects with `X_NOT_FOUND` when the route 404s |
|
|
222
222
|
| Failures | the server's own code, off `problem+json` — `X_INPUT_INVALID` stays `X_INPUT_INVALID`. A gateway answering HTML, a network fault and a 2xx body that is not JSON are `X_CLIENT_TRANSPORT_FAILED`, the same code an action's client answers. It was `X_RPC_FAILED` until 21.0.0 |
|
|
223
|
-
| Rows are JSON, with their instants revived | what the body parses to, plus every value the server answered as a `Date` handed back as one (`As of 2026-10`, #710): the route names them in `x-ultimate-dates` by path — one entry per column of a list — and `clientTransport` revives exactly those. The body and the OpenAPI document are unchanged; a client that ignores the header reads ISO strings. A query's rows are never parsed on the way out (a declared `rows:` publishes structure, it parses nothing), so the header is how the row type's `Date` stays true |
|
|
223
|
+
| Rows are JSON, with their instants revived | what the body parses to, plus every value the server answered as a `Date` handed back as one (`As of 2026-10`, #710): the route names them in `x-ultimate-dates` by path — one entry per column of a list — and `clientTransport` revives exactly those. The body and the OpenAPI document are unchanged; a client that ignores the header reads ISO strings. A query's rows are never parsed on the way out (a declared `rows:` publishes structure, it parses nothing), so the header is how the row type's `Date` stays true. The header is capped at 1,536 bytes (`WIRE_DATES_MAX_BYTES`): an answer whose instants need one path each — a `string \| Date` column, a `[label, instant]` tuple — past that is sent with no `x-ultimate-dates` (and no `dates:` line), the client reads those instants as ISO strings, and the operation is logged once at `warn` as `http.wire_dates_dropped`. `As of 2026-11-19`. |
|
|
224
224
|
| `then` is not a read | the proxy answers `undefined` for it, so `await queries` resolves to the client instead of fetching `/_x/query/then`. Same rule in `rpc` |
|
|
225
225
|
|
|
226
226
|
## A file at a signed URL — `download:`
|
|
@@ -437,7 +437,7 @@ Fifty *counts* collapse neither way — one `count()` per row is fifty different
|
|
|
437
437
|
| Not recorded | `explainQuery()`, `describeSql()`, the shared live window: built `unenforced`, no caller to attribute |
|
|
438
438
|
| No sink installed | `X_QUERY_AUDIT_SINK_MISSING`, before the input parse |
|
|
439
439
|
| The sink refuses | a denied/failed record: logged (`audit.sink.failed`), the caller gets the original error. An allowed record: the rows are withheld, `X_QUERY_AUDIT_SINK_FAILED` — a read commits nothing, so retry |
|
|
440
|
-
| Group commit | opt-in, `As of 31.11.0`: `postgresAuditSink({ executor, groupCommit: true })` (`@ultimat3/action`) queues each record up to 5 ms or 256 records (`{ maxRecords, maxDelayMs }` to change either) and writes the batch as one `x_audit` insert. Each call waits on its own batch, so the rule above holds per call: a failed batch is `X_QUERY_AUDIT_SINK_FAILED` (an action's, `X_AUDIT_SINK_FAILED`) on every allowed call it carried. Flushed on drain, before the pool closes. Any sink with a `writeMany(records)`: `batchedAuditSink(sink, opts)` from `@ultimat3/action/adapter` |
|
|
440
|
+
| Group commit | opt-in, `As of 31.11.0`: `postgresAuditSink({ executor, groupCommit: true })` (`@ultimat3/action`) queues each record up to 5 ms or 256 records (`{ maxRecords, maxDelayMs }` to change either) and writes the batch as one `x_audit` insert. Each call waits on its own batch, so the rule above holds per call: a failed batch is `X_QUERY_AUDIT_SINK_FAILED` (an action's, `X_AUDIT_SINK_FAILED`) on every allowed call it carried. Flushed on drain, before the pool closes. Any sink with a `writeMany(records)`: `batchedAuditSink(sink, opts)` from `@ultimat3/action/adapter`. A batch that committed but lost its reply stores nothing twice (`As of 2026-11-19`): each accepted write keeps one row id through the single retry, and an insert skips a row already stored with identical facts — a different row under that id still fails `unique_violation` |
|
|
441
441
|
|
|
442
442
|
## Every cached query carries a tag
|
|
443
443
|
|
package/wiki/Realtime.md
CHANGED
|
@@ -155,7 +155,7 @@ adapter, its sync URL and its `LiveClient`: the page's one socket is the framewo
|
|
|
155
155
|
|
|
156
156
|
| Step | Where | What |
|
|
157
157
|
|---|---|---|
|
|
158
|
-
| 1. the dependency | root `package.json` | `bun add @ultimat3/realtime
|
|
158
|
+
| 1. the dependency | root `package.json` | `x new` declares `@ultimat3/realtime` beside `@ultimat3/query`, at the framework's exact version (`As of 2026-11-19`). An app scaffolded before 31.49.0 adds it once, at the version its `@ultimat3/core` pin names: `bun add --exact @ultimat3/realtime@$(bun -p "require('./package.json').dependencies['@ultimat3/core']")` — a bare `bun add` writes a range `x doctor` refuses (`X_FRAMEWORK_PIN_RANGE`). Missing, the import is `TS2307: Cannot find module '@ultimat3/realtime'` |
|
|
159
159
|
| 2. the query | `app/<feature>/live.ts` | `query({ …, live: true, subscribes: ['posts'] })`, bounded and ordered; `x g query <name> --feature <slice> --live` writes it |
|
|
160
160
|
| 3. the ref | the island | `{ name: 'liveFeed', live: true }`, the query's registered **name**, never the query value: importing that drags its whole read path into the island. `live` is stated beside the name, not derived (see below) |
|
|
161
161
|
| 4. the install | nothing to write | `x build` builds every island whose own import graph reaches `@ultimat3/realtime` from an entry that calls `installRealtime({ signal: createSignal, cleanup: onCleanup })` first, for about 100 B — `cleanup` releases every hook with the component that called it (31.14.0), so an island writes no `onCleanup(() => h.release())`. An island not reaching realtime pays nothing. The sync target is read from the document's `<meta name="ultimate-sync">` ([Configuration](Configuration), `SYNC_URL`) |
|
|
@@ -400,6 +400,15 @@ org's value is `X_TOPIC_FORBIDDEN` (cause `X_TENANCY_ACTOR_MISMATCH`), an actor
|
|
|
400
400
|
is enough: the policy decides the permission, the mechanism decides the tenant — the same split an
|
|
401
401
|
HTTP read has.
|
|
402
402
|
|
|
403
|
+
`As of 2026-11-19`. A channel keyed by any other param — `room-feed.<roomId>` on `records: [messages]` — carries every
|
|
404
|
+
org's rows that name that room, and its subscribe cannot know which. So the mechanism decides per
|
|
405
|
+
row: a tenanted row reaches only the members whose org is the row's tenant, live and on a `since`
|
|
406
|
+
replay alike; every other member receives that frame's `seq` alone, carrying no record, key or
|
|
407
|
+
`write`, so its cursor stays whole. A row naming no tenant reaches no member; an untenanted entity's
|
|
408
|
+
rows, and every row on a topic keyed by the tenant column, reach every member as before
|
|
409
|
+
(`channel-tenant.ts`, `rowTenant`). The catch-up read is a query, tenant-scoped by
|
|
410
|
+
`@ultimat3/entity` like every other.
|
|
411
|
+
|
|
403
412
|
## A channel event re-reads the page
|
|
404
413
|
|
|
405
414
|
`As of 30.0.0`. For a server-rendered page with nothing to push but "this changed": the channel
|
|
@@ -218,7 +218,7 @@ export const config = defineRoute({
|
|
|
218
218
|
|
|
219
219
|
| Key | Default | What it decides |
|
|
220
220
|
|---|---|---|
|
|
221
|
-
| `onInvalidate: 'stale'` | yes | a tag bust marks the stored page stale; the next request is answered **that copy, however old**, while a fresh one renders behind it (`x-ultimate-isr: stale`). Right for a price list |
|
|
221
|
+
| `onInvalidate: 'stale'` | yes | a tag bust marks the stored page stale; the next request is answered **that copy, however old**, while a fresh one renders behind it (`x-ultimate-isr: stale`). That stale answer is **not leased to a shared cache**: it carries `public, max-age=0, s-maxage=0` and no `stale-while-revalidate`, with the same `surrogate-key`, so a CDN purged by the bust asks the origin again and gets the regenerated page, instead of holding the pre-write one for the whole `ttl` (`As of 2026-11-19`). Right for a price list |
|
|
222
222
|
| `onInvalidate: 'purge'` | — | a tag bust **deletes** every stored page of the route carrying the tag — each locale, each keyed query, stored 404s included — and evicts any render of them in flight, so the next request renders and waits. For content that must come **down** (a withdrawn article, a corrected legal text). Needs `tags` **and `ttl`** (`X_ROUTE_MODE_INVALID` without either). The response carries no `stale-while-revalidate`, and its `s-maxage` is what is **left** of the `ttl` |
|
|
223
223
|
| `maxStale` | unbounded; **`0` under `'purge'`** | how long **past its `ttl`** a stored page may still be answered stale: a duration, or `0` for never. Older, it is dropped and the request waits for a render. Also the `stale-while-revalidate` a shared cache is told (a day when omitted, absent at `0`). Needs `ttl` |
|
|
224
224
|
| `query` | `[]`, none | the query parameters the page varies on. Only these are in the stored page's key **and** in the `url` / `query` that `load`, `meta` and the page receive; one value each (the first), sorted |
|
package/wiki/Scheduled-Tasks.md
CHANGED
|
@@ -84,6 +84,8 @@ export const digestTask = sendDigest.schedule;
|
|
|
84
84
|
|
|
85
85
|
Hand the job's module to `defineApi({ jobs })`; the task registers with it — it needs no `tasks` entry. A task that fires several jobs, or a job other code also enqueues, stays a `task()` beside its jobs.
|
|
86
86
|
|
|
87
|
+
**One job per org, from a schedule**: the schedule belongs to no org (`tenant: 'none'`), the org list is read inside `crossTenant()` as a service actor, and each child job is tenant-scoped and runs as its org — the whole pattern, with a test that runs it, is `x docs 'jobs.README#one-job-per-org-from-a-schedule'`. Fire it now in dev with `x tasks run <name>.schedule`.
|
|
88
|
+
|
|
87
89
|
## The fluent surface
|
|
88
90
|
|
|
89
91
|
Every projection is a method on the task — `nightlyDigest.enqueue()`, never `runTask(nightlyDigest)` — and every declared field is lifted onto it. A task has no `.def`.
|
|
@@ -160,8 +162,9 @@ Role table and drain sequence: [Deployment](Deployment).
|
|
|
160
162
|
|---|---|
|
|
161
163
|
| `x tasks list --json` | the descriptor — `name`, `cron`, `tz`, `catchUp`, `maxCatchUp`, `jobs` — plus the resolved **`next`** occurrence, rendered in the task's own `tz`, and its `nextMs` epoch instant; and the **`last`** fire (`last`, `lastMs`, `lastFiredAtMs` — `null` before the first), read from the queue, which `x tasks` opens when a task is declared. All derived, never declared fields |
|
|
162
164
|
| `x tasks show <name> --json` | the same, plus the cron in words (`describe`) and the next N occurrences (`--count`, default 5) |
|
|
165
|
+
| `x tasks run <name> --json` | fires the task now: each job its occurrence enqueues goes onto the app's queue (`TaskHandle.enqueue()`, the run-now path; the scheduler's watermark is untouched, so the next scheduled occurrence still fires). Beside an `x dev` on the embedded database it refuses with the stop–run–restart fix; where the environment resolves `production` it needs `--production` (or `ULTIMATE_TASK_RUN=<name>` in a container), else `X_TASK_RUN_PRODUCTION`. `x g cron-job` prints it as its next step. `As of 2026-11-19` |
|
|
163
166
|
| `/admin/jobs/tasks` | the jobs dashboard every `defineAdmin()` serves: schedule, zone, last fire, next fire (`nextTaskRun`), paused; pause, resume and run now behind `job:manage` → [Admin dashboard](Admin-Dashboard#the-jobs-dashboard) |
|
|
164
|
-
| MCP `admin.x_job_tasks.list`, `admin.action.job.task.run-now` | the same screen and actions as admin MCP tools, same authz
|
|
167
|
+
| MCP `admin.x_job_tasks.list`, `admin.action.job.task.run-now` | the same screen and actions as admin MCP tools, same authz: listing needs `job:read`, run-now `job:manage` — which `x new`'s `admin` role does **not** hold (it holds `job:read`); grant it in `apps/web/shared/roles.ts` to see the tool |
|
|
165
168
|
| `/_x` dev panel | the jobs tab: the dev process's tasks beside its queues and runs |
|
|
166
169
|
| `x.manifest.json` | generated `tasks` section — the build-time source of truth |
|
|
167
170
|
| `<task>.describe()` | in process: `kind`, `name`, `cron`, `tz`, `catchUp`, `maxCatchUp`, and the job names it enqueues |
|
package/wiki/Testing.md
CHANGED
|
@@ -234,7 +234,8 @@ export const summarizeEval = defineEval({
|
|
|
234
234
|
```
|
|
235
235
|
|
|
236
236
|
`ULTIMATE_EVAL_RECORD=1 x test eval` re-records every baseline, so accepting a new number is a
|
|
237
|
-
reviewable diff instead of an edited threshold.
|
|
237
|
+
reviewable diff instead of an edited threshold. `0`, `false`, `no`, `off` or empty (any case) is
|
|
238
|
+
off and gates; any other value records (`As of 2026-11-19`). It is refused inside the gate: `x verify` with that
|
|
238
239
|
variable set is `X_EVAL_RECORDING` and runs no eval suite, because recording passes by definition
|
|
239
240
|
and would overwrite the committed baselines during the run.
|
|
240
241
|
|
|
@@ -402,7 +403,7 @@ Installed by the preload on `expect`.
|
|
|
402
403
|
| `toDenyPolicy(context)` | the policy refuses that context |
|
|
403
404
|
| `toEmitSteps(names)` | a job runs exactly those steps, in order |
|
|
404
405
|
| `toMatchOpenApi(committed)` | no operation removed, no parameter newly required |
|
|
405
|
-
| `toBeWithinBudget(limit)` | a measured number is at or under the limit |
|
|
406
|
+
| `toBeWithinBudget(limit)` | a measured number is at or under the limit; a limit that is not a finite number (`undefined` from a renamed budget key, `NaN`, `Infinity`) throws `X_TEST_NUMBER_EXPECTED`, under `.not` too (`As of 2026-11-19`) |
|
|
406
407
|
| `toRejectInput(input)` / `toAcceptInput(input)` | a schema's verdict on one input |
|
|
407
408
|
| `toEqualRow(expected)` | equality over every OWN property — the one that sees a `.sealed()` column |
|
|
408
409
|
| `toBeVisible(options?)` | waits for a locator to show; `.not` waits for it to go |
|
|
@@ -1098,7 +1099,7 @@ coverage floor counts that suite alone, so a body only a typed suite reaches is
|
|
|
1098
1099
|
|---|---|---|
|
|
1099
1100
|
| `x g action` | input parse; the handler through `.as(actor, input)` — the refusal first, then what it answers | `contract`: the action contract (the exercise as a member of the input's org), the foreign-org denial, the OpenAPI operation |
|
|
1100
1101
|
| `x g mutator` | the same, plus `local()` against `memoryLocalTx()`, applied twice | `contract` |
|
|
1101
|
-
| `x g query` | the SQL's bound, total order and direction; the read through `.as()` — no grant refused, an empty org reads empty, stored rows read back newest first and never another org's, the read costing one `statements` count however many rows it answers | `--live`: the declaration in `.live.test.ts` |
|
|
1102
|
+
| `x g query` | the SQL's bound, total order and direction; the read through `.as()` — no grant refused, an empty org reads empty, stored rows read back newest first and never another org's — a read through the slice's `<Feature>View` answers exactly its keys, no `orgId` — the read costing one `statements` count however many rows it answers | `--live`: the declaration in `.live.test.ts` |
|
|
1102
1103
|
| `x g job` · `x g task` | the body under `runJobs`: which steps one run takes, what it answers, and how it ends | `job`: key, tenant, retry policy, enqueue dedupe |
|
|
1103
1104
|
| `x g backfill` | one whole pass over rows in two tenants; the projection replayed | `job`: durable name, dedupe |
|
|
1104
1105
|
| `x g route` | the page rendered (`renderRoute`): heading, metadata, mode, budget, islands | `e2e`: the offline fallback |
|
|
@@ -1384,13 +1385,15 @@ gates at once — and it is held to a **memory budget**, not to whatever looks f
|
|
|
1384
1385
|
|
|
1385
1386
|
- **Width.** `max(2.75 GiB, 25% of total RAM)` divided by 1.25 GiB a worker, clamped to `1..cores`:
|
|
1386
1387
|
3 workers on a 16 GB box, 12 on a 62 GB 16-core one, 2 on an 8 GB one (the 2.75 GiB floor). Never more workers than cores. The step line says
|
|
1387
|
-
what it chose and why — `3 workers (budget 4.0 GB)
|
|
1388
|
+
what it chose and why — `3 workers (budget 4.0 GB)`; fewer files than that read
|
|
1389
|
+
`1 worker, one per file (plan: …)`, and a run the machine held narrower reads
|
|
1390
|
+
`ran 2 at once (peak), planned 3 — …`. `ULTIMATE_TEST_MEMORY_BUDGET=3g` replaces
|
|
1388
1391
|
the budget, `ULTIMATE_TEST_MAX_WORKERS=2` caps the width, `--workers N` wins over both. Total RAM,
|
|
1389
1392
|
never "free": page cache counts as free, and two gates each planning on it took a 45 GB box down.
|
|
1390
|
-
- **One budget per machine.** Each batch of workers
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1393
|
+
- **One budget per machine.** Each batch of workers reserves its measured memory in the
|
|
1394
|
+
[machine ledger](Many-Agents), at most 4 cores locally. A second `x test` or `x verify` on the
|
|
1395
|
+
same box runs narrower or queues instead of doubling the memory; a selection of 3 files or fewer
|
|
1396
|
+
runs free. `ULTIMATE_TEST_SLOTS=0` turns it off.
|
|
1394
1397
|
- **No per-file isolation by default.** A worker keeps one global and one module registry across
|
|
1395
1398
|
the files it runs (`bun test --parallel=N --no-isolate`) — measured 2-5x faster than `--isolate`
|
|
1396
1399
|
at the same width. Between two files the testing preload hands the next file the process it would
|
|
@@ -1521,7 +1524,7 @@ This table is a hand-synced copy of it ([Contributing](Contributing)).
|
|
|
1521
1524
|
|---|---|
|
|
1522
1525
|
| `typecheck` | any error; `any` is banned by lint, not tolerated by a cast |
|
|
1523
1526
|
| `lint` | biome only: formatting, `any`, default exports, unused imports. **Not** raw colours, bare `Error`, untranslated strings or unzoned dates — biome ignores `.scss` entirely and those are guards, one row down |
|
|
1524
|
-
| `boundaries` | `site/` → `app/`, routes → DB, services → HTTP, tier violations in framework packages, **and every
|
|
1527
|
+
| `boundaries` | `site/` → `app/`, routes → DB, services → HTTP, tier violations in framework packages, **and every guard**: every name in `SHIPPED_GUARD_NAMES` (`packages/cli/src/templates/scaffold-guards.ts`), run from the installed framework at the severity `guards/shipped.json` gives it, and every file of your own in `guards/` → [Interface rules](Interface-Rules) |
|
|
1525
1528
|
| `filesize` | a source file over 500 lines |
|
|
1526
1529
|
| `package-shape` | a workspace package missing `README.md`, `CLAUDE.md`, `tsconfig.json`, or `src/index.ts` |
|
|
1527
1530
|
| `errors` | an `X_*` code with no runnable fix or no docs page |
|
|
@@ -66,7 +66,11 @@ and `Calendar` take and post `YYYY-MM-DD` and know no zone. Month and weekday na
|
|
|
66
66
|
`Intl.DateTimeFormat` with `timeZone: 'UTC'` on the plain date's UTC midnight, which names the date
|
|
67
67
|
and never shifts it; the week starts on the locale's day (`Intl.Locale#getWeekInfo`). A *window* is
|
|
68
68
|
instants: `timeRangeUrl(url, { presets, default, timeZone, now })` reads a custom `from`/`to` as
|
|
69
|
-
wall-clock time in `timeZone` (a spring-forward gap resolves forward)
|
|
69
|
+
wall-clock time in `timeZone` (a spring-forward gap resolves forward); `href({ from, to })` writes
|
|
70
|
+
`:ss` when an instant has seconds and writes the end so it reads back at or after the instant
|
|
71
|
+
asked for, so a window touching a fall-back hour reads back as one containing the window given,
|
|
72
|
+
never `invalid` or an hour early (`As of 2026-11-19`). Every list cursor on the page, a namespaced
|
|
73
|
+
one (`runs.after`) included, is dropped when the window changes. And `TimeRangePicker` requires
|
|
70
74
|
the same `timeZone` as a prop — omitting it is a type error. "Today" is the caller's: pass `month`
|
|
71
75
|
(or `now`) computed with `plainDateIn(now(), actor.tz)`; with none, `Calendar` opens on today in
|
|
72
76
|
`useUi().timeZone`, the request's zone, never the device's.
|
package/wiki/Troubleshooting.md
CHANGED
|
@@ -40,6 +40,7 @@ The `--json` form is the same content as the terminal form. Paste the JSON into
|
|
|
40
40
|
| `X_APP_IMPORT_UNRESOLVED` | an app module imports a package nobody installed, or a path with no file behind it. One finding per specifier | `bun add <pkg>`, or edit the import in the file the finding names. `x doctor` reports it too |
|
|
41
41
|
| `X_DB_DRIFT` on a brand-new app, cause *packages/db has a schema but no migration recorded it* | expected: `x new` writes no migration, and `x db gen` is the only writer of `packages/db/migrations`. Only an app that declares an entity reports it — zero declared against zero recorded is agreement | `x db gen "initial"` then `x db migrate` — `bun run setup` does both |
|
|
42
42
|
| `X_DB_DRIFT` after deleting the last entity, migrations still committed | correct, and not the case above: the migrations record tables the source no longer declares | `x db gen "drop <table>"` → it refuses with `X_MIGRATION_IRREVERSIBLE` → re-run as `x db gen "drop <table>" --allow-destructive`, or put the entity back |
|
|
43
|
+
| `X_MIGRATION_FORKED` after merging two branches | each ran `x db gen` from one parent, so the newest `.snapshot.json` omits the other's work | `x db gen --merge-fork`: no SQL changes, nothing is deleted. Do not generate a `record …` migration. If the cause says a migration creates something *again*, follow its `x db status --json` check, and never delete a migration a database applied |
|
|
43
44
|
| `X_MIGRATION_SNAPSHOT_MISSING`, and `x db gen` refuses before writing anything | the newest migration on disk carries no `.snapshot.json` — hand-written, or the sidecar was deleted | `git checkout -- packages/db/migrations/<id>.snapshot.json`; if it was never written, `rm packages/db/migrations/<id>.* && x db gen "<name>"` — the delete **first**, or the generate refuses again |
|
|
44
45
|
| `ROLE=migrate` sits there doing nothing | another version's `ROLE=migrate` holds the session-pinned migration lock. This one **waits up to 60s**, polling once per 500ms, then exits non-zero with `X_MIGRATE_CONCURRENT` (`As of 2026-08`; on 1.2.0 it waits forever) | let the first exit 0 — the second then applies. If nothing else is deploying, the holder is a wedged backend: `psql "$DATABASE_URL" -c "select pid, application_name, state from pg_stat_activity join pg_locks using (pid) where locktype = 'advisory'"`, then `pg_terminate_backend(pid)` it |
|
|
45
46
|
| `ROLE=migrate` exits non-zero, deploy blocked | migration failure — correct, the roll is supposed to stop | read the SQL error, fix the migration, re-run. Do not start `web` on the old schema |
|
|
@@ -40,7 +40,7 @@ cd myapp && bun run setup
|
|
|
40
40
|
setup complete — next: bun run dev
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
`bun run setup` is `bun install`, an `.env.development.local` touch, `x db gen "initial"`, `x db migrate`, `x db seed`, then `x manifest` — so the database is migrated and `x.manifest.json` exists before the gate asks for either. `x new` installs nothing, so this is not optional.
|
|
43
|
+
`bun run setup` is `bun install`, `x merge-driver install`, an `.env.development.local` touch, `x db gen "initial"`, `x db migrate`, `x db seed`, then `x manifest` — so the database is migrated and `x.manifest.json` exists before the gate asks for either. `x new` installs nothing, so this is not optional.
|
|
44
44
|
|
|
45
45
|
`x` is a workspace dependency, not a global install. `bunx x <command>` resolves `node_modules/.bin/x`; the `package.json` scripts (`bun run verify`, `bun run dev`) resolve the same binary. A globally installed `x` (`bun link`, `bun add -g`) run inside the app **hands over** to that same file, `As of 2026-09-05`, and says so on stderr: a global copy carries its own `@ultimat3/entity` with an empty registry, and it wrote a zero-entity manifest under a green exit code before it did. `ULTIMATE_KEEP_GLOBAL_CLI=1` is the opt-out — [`@ultimat3/cli`'s README](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/README.md) has the measurement.
|
|
46
46
|
|
|
@@ -79,7 +79,7 @@ The default scaffold, after `bun run setup`, with no `.x/build-stats.json` befor
|
|
|
79
79
|
✓ unit 2790ms 3 workers (budget 4.0 GB)
|
|
80
80
|
✓ contract 1233ms 3 workers (budget 4.0 GB)
|
|
81
81
|
✓ live 840ms serial
|
|
82
|
-
✓ job 345ms 1
|
|
82
|
+
✓ job 345ms 1 worker, one per file (plan: 3 workers (budget 4.0 GB))
|
|
83
83
|
✓ exercise 1952ms
|
|
84
84
|
✓ e2e 12124ms serial
|
|
85
85
|
✓ eval 91ms
|
|
@@ -223,8 +223,8 @@ myapp/
|
|
|
223
223
|
│ └── ui/ app components on semantic tokens
|
|
224
224
|
├── docker/ Dockerfile, .dockerignore, dev + prod compose, helm/
|
|
225
225
|
├── guards/ one rule per file, run by `x verify`'s boundaries step.
|
|
226
|
-
│
|
|
227
|
-
│
|
|
226
|
+
│ Shipped ones run from the framework; shipped.json
|
|
227
|
+
│ sets each one's severity (`off` turns it off)
|
|
228
228
|
├── bin/ setup.ts — `bun run setup`; `dev` and `verify` are x's own
|
|
229
229
|
└── CLAUDE.md AGENTS.md what an agent reads first: one file, AGENTS.md a symlink
|
|
230
230
|
```
|
|
@@ -240,7 +240,7 @@ bunx x db gen "initial" # entities → <id>.sql, <id>.snapshot.json, <id>.has
|
|
|
240
240
|
bunx x db migrate # applies them, then diffs the live schema against the ledger it wrote
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
-
`bun run setup` runs both — `bun install`, an `.env.development.local` touch, `x db gen "initial"` when the directory holds no `.sql`, `x db migrate`, `x db seed`, then `x manifest`. `x db migrate` is `@ultimat3/db`'s own migrator, the one `ROLE=migrate` runs, so nothing extra has to be installed.
|
|
243
|
+
`bun run setup` runs both — `bun install`, `x merge-driver install`, an `.env.development.local` touch, `x db gen "initial"` when the directory holds no `.sql`, `x db migrate`, `x db seed`, then `x manifest`. `x db migrate` is `@ultimat3/db`'s own migrator, the one `ROLE=migrate` runs, so nothing extra has to be installed.
|
|
244
244
|
|
|
245
245
|
Until the generate has run, `x verify` is **red on its `drift` step** — correct behaviour with a runnable fix, not a defect:
|
|
246
246
|
|
|
@@ -249,7 +249,7 @@ bunx x db gen "add todos"
|
|
|
249
249
|
```
|
|
250
250
|
|
|
251
251
|
```text
|
|
252
|
-
✓ migration …_add_todos generated
|
|
252
|
+
✓ migration …_add_todos generated — tables: todos
|
|
253
253
|
```
|
|
254
254
|
|
|
255
255
|
The 1.1.0 workaround this step used to carry (a hand-written `db-gen.ts` script, and two manual
|
|
@@ -83,14 +83,14 @@ bunx x policy explain todo:write
|
|
|
83
83
|
|
|
84
84
|
```text
|
|
85
85
|
action archiveTodo — policy todo:write
|
|
86
|
-
actor verdict
|
|
87
|
-
anonymous deny
|
|
88
|
-
admin
|
|
89
|
-
member deny
|
|
86
|
+
actor verdict deciding reason
|
|
87
|
+
anonymous deny todo:write no actor for todo:write
|
|
88
|
+
admin needs input todo:write not denied — every actor-only clause passes, and todo:write has a predicate that reads the request input
|
|
89
|
+
member deny todo:write actor lacks todo:write
|
|
90
90
|
evaluated with no request input and no row — a rule reading either decides again on the real request
|
|
91
91
|
action createTodo — policy todo:write
|
|
92
92
|
…
|
|
93
|
-
✓ todo:write — allowed for 0 of 6 actor evaluation(s)
|
|
93
|
+
✓ todo:write — allowed for 0 of 6 actor evaluation(s); 1 not denied, decided by a predicate that reads the request input — x policy explain todo:write --input '<the request input as JSON>'
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
Read the `reason` column, not the verdict:
|
|
@@ -98,7 +98,8 @@ Read the `reason` column, not the verdict:
|
|
|
98
98
|
| Reason | Means |
|
|
99
99
|
|---|---|
|
|
100
100
|
| `actor lacks todo:write` | the grant is missing — a role problem, fix it in `defineRoles` |
|
|
101
|
-
| `predicate returned false` | the grant is held, the predicate said no
|
|
101
|
+
| `predicate returned false` | the grant is held, the predicate said no |
|
|
102
|
+
| `needs input` | the grant is held and every clause that reads only the actor passes; the rest reads the request input — here archive's tenancy rule, `input.orgId`. Not a denial: run the summary's own command with the input a request sends, `x policy explain todo:write --input '{"orgId":"…"}'` |
|
|
102
103
|
| `no actor for …` | anonymous. Every surface agrees on this one |
|
|
103
104
|
|
|
104
105
|
`<subject>` resolves against a permission, an action name, a query name, then an action's HTTP path — so the `fix:` line an `X_FORBIDDEN` prints is runnable whichever of the four the throwing surface had. Verdicts come from `policyMatrix()` over the app's real `Policy` objects, never a second evaluation.
|