@ultimat3/cli 31.47.0 → 31.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/package.json +29 -29
  2. package/src/cmd-drill.ts +20 -1
  3. package/src/cmd-heavy-spec.ts +28 -0
  4. package/src/cmd-heavy.ts +160 -0
  5. package/src/cmd-test.ts +13 -3
  6. package/src/cmd-upgrade.ts +22 -11
  7. package/src/codemods/docs-many-agents.ts +30 -0
  8. package/src/codemods/e2e-suite-floor.ts +42 -0
  9. package/src/codemods/e2e-suite.ts +71 -0
  10. package/src/codemods/index.ts +4 -0
  11. package/src/codemods/pending.ts +2 -2
  12. package/src/codemods/test-ports.ts +40 -33
  13. package/src/codemods/test-suites.ts +11 -22
  14. package/src/codemods/verify-floor-skips.ts +18 -6
  15. package/src/doctor-advisory-floors.ts +30 -8
  16. package/src/error-codes-tooling.ts +9 -3
  17. package/src/exec.ts +11 -3
  18. package/src/heavy-cores.ts +51 -0
  19. package/src/heavy-env.ts +19 -0
  20. package/src/heavy-errors.ts +36 -0
  21. package/src/heavy-flock.ts +73 -0
  22. package/src/heavy-ledger.ts +358 -0
  23. package/src/heavy-memory.ts +67 -0
  24. package/src/heavy-weights.ts +47 -0
  25. package/src/heavy.ts +290 -0
  26. package/src/local-cli.ts +6 -5
  27. package/src/mcp-errors.ts +4 -1
  28. package/src/messages.ts +11 -0
  29. package/src/registry.ts +2 -0
  30. package/src/role-replicator.ts +5 -3
  31. package/src/runtime-cache.ts +24 -3
  32. package/src/runtime-overrides.ts +4 -2
  33. package/src/templates/guard-released-forms.ts +35 -13
  34. package/src/templates/scaffold-claude-agents.ts +9 -6
  35. package/src/templates/scaffold-claude-commands.ts +1 -1
  36. package/src/templates/scaffold-docs.ts +5 -4
  37. package/src/templates/scaffold-suites.ts +22 -0
  38. package/src/test-batches.ts +9 -3
  39. package/src/test-shards.ts +3 -3
  40. package/src/test-slots.ts +35 -161
  41. package/src/upgrade-gate-codemods.ts +1 -18
  42. package/src/verify-checks.ts +4 -3
  43. package/src/verify-coverage-run.ts +5 -4
  44. package/src/verify-deadline.ts +18 -2
  45. package/src/verify-heavy-steps.ts +26 -0
  46. package/src/verify-test-run.ts +3 -2
  47. package/src/verify-tests.ts +27 -20
  48. package/wiki/Building-Your-Own-Base.md +15 -2
  49. package/wiki/CI-Parallel-Gate.md +2 -3
  50. package/wiki/CLI-Reference.md +25 -13
  51. package/wiki/Caching-And-Invalidation.md +1 -1
  52. package/wiki/Compared.md +13 -11
  53. package/wiki/Configuration.md +22 -4
  54. package/wiki/Home.md +1 -0
  55. package/wiki/Interface-Rules.md +1 -1
  56. package/wiki/Known-Gaps.md +1 -1
  57. package/wiki/Mail.md +1 -1
  58. package/wiki/Many-Agents.md +60 -0
  59. package/wiki/Stability.md +1 -1
  60. package/wiki/Testing.md +5 -5
  61. package/wiki/Tutorial-01-First-App.md +2 -2
  62. package/wiki/Upgrading.md +2 -1
@@ -254,9 +254,8 @@ Each job sizes its own test width the same way the laptop does (`x verify` print
254
254
  line, e.g. `3 workers (budget 4.0 GB)`): a budget of `max(2.75 GiB, 25% of the runner's RAM)`,
255
255
  1.25 GiB planned per worker, never more workers than cores. On a 16 GB `ubuntu-latest` that is 3
256
256
  workers; a 62 GB, 16-core workstation plans 12 (`As of 2026-11-07`, when the fixed 4 GiB cap went —
257
- the machine-wide slot pool is what keeps two runs on one box inside one budget). `ULTIMATE_TEST_MEMORY_BUDGET=6g` or `ULTIMATE_TEST_MAX_WORKERS=4` override it; `--workers`
258
- wins over both. The machine-wide slot pool (see [Testing](Testing#memory-width-and-isolation))
259
- has nothing to share on a one-job VM; `ULTIMATE_TEST_SLOTS=0` turns it off.
257
+ the [machine ledger](Many-Agents) is what keeps two runs on one box inside one budget). `ULTIMATE_TEST_MEMORY_BUDGET=6g` or `ULTIMATE_TEST_MAX_WORKERS=4` override it; `--workers`
258
+ wins over both. The [machine ledger](Many-Agents) has nothing to share on a one-job VM and is off under `CI`.
260
259
 
261
260
  ## Skipping the build's duplicate preflight
262
261
 
@@ -72,6 +72,7 @@ x version # CLI version
72
72
  | `x cache graph\|bust <tag>\|clear` | the tag graph off the manifest (what each write evicts), a bust of one tag or every declared tag through the app's own tiers and bus · `stats` was removed `As of 2026-11-15` ([Known gaps](Known-Gaps#open-by-decision)) | shipped |
73
73
  | `x explain <query> [--input <json>] [--org <id>]` | one declared query run once on the dev database, every statement it sent planned by the `exercise` step's oracle | shipped |
74
74
  | `x profile <route> [--runs 20] [--top 10]` | a CPU profile of rendering one route in this process: the hottest functions, file and line | shipped |
75
+ | `x heavy [status]` · `x heavy run [--label s] [--mb n] -- <command…>` | the machine's shared memory ledger: who runs, who is queued, load and memory; any command run inside one reservation, its exit code passed through | shipped |
75
76
  | `x status [--url <origin>] [--samples n]` | the build each live worker runs (`x_job_workers`), and the build, status and role each sampled origin's `/readyz` answers | shipped |
76
77
 
77
78
  ## x new
@@ -1288,16 +1289,16 @@ x doctor [--port 3000] [--json]
1288
1289
 
1289
1290
  Checks Bun version, env completeness, source drift, **the newest migration's `.snapshot.json`**, port availability, PWA prerequisites and **embedded-Postgres readiness** — each failing check carries its own fix command.
1290
1291
 
1291
- It also lists the shipped guards the app holds that differ from the current template — a copy from an older release, or the app's own edit — and warns `X_SHIPPED_GUARD_MISSING` for each one the app's `guards/` does not hold, its fix `x g guard <name> && x verify --only boundaries --json` (`As of 31.22`: a warning beside the verdict in `data.warnings[]`, so the exit status is unchanged; it was a listing). `As of 2026-10-07` (owner decision 8: shipped guards stay copies the app owns).
1292
+ It also lists the copies of shipped guards the app's `guards/` still holds, each with `X_GUARD_VENDORED` beside the verdict in `data.warnings[]`: shipped guards run from the installed framework, so a copy runs in place of the shipped one and never receives a fix. `As of 31.28`. No shipped guard is ever missing, so `data.guards.missing` is always `[]`.
1292
1293
 
1293
1294
  | Listing | One line each | `--json` |
1294
1295
  |---|---|---|
1295
- | missing | its `X_SHIPPED_GUARD_MISSING` warning line (`As of 31.22`) | `data.guards.missing[]`: `{ name, add }`, and the warning in `data.warnings[]` |
1296
- | differs from the template (line endings ignored) | `x g guard <name> --force` — rewrites the guard and its test; review the diff, and restore your edit if it was deliberate | `data.guards.differs[]`: `{ name, refresh }` |
1296
+ | a copy, identical or edited | the edit that resolves it: `rm -f` for an identical copy; for an edited one, `mv` to `guards/app-<name>.ts` and `"<name>": "off"` in `guards/shipped.json` | `data.guards.vendored[]`: every copy's name |
1297
+ | an edited copy | the same line | `data.guards.differs[]`: `{ name, refresh, diff }` — `refresh` is that edit |
1297
1298
 
1298
- A listing, never a finding: deleting or editing a guard is how an app changes a rule, so the verdict does not move.
1299
+ A listing, never a finding: the verdict does not move. `x upgrade` applies the same migration (`vendored-guards` codemod); how a shipped guard reports is a row in `guards/shipped.json`.
1299
1300
 
1300
- Four warnings about how the app is held, `As of 31.16.0` (a fifth, `X_SHIPPED_GUARD_MISSING`, `As of 31.22`) — beside the verdict, never in it: the exit status, `findings` and `data.codes` stay as they were, and `--json` carries each as `data.warnings[]` (`{ code, cause, fix, docs, at }`). None is a gate step; on `next` they join the verdict, red:
1301
+ Warnings about how the app is held — beside the verdict, never in it: the exit status, `findings` and `data.codes` stay as they were, and `--json` carries each as `data.warnings[]` (`{ code, cause, fix, docs, at }`). None is a gate step; on `next` they join the verdict, red:
1301
1302
 
1302
1303
  | Code | Asked | Fix |
1303
1304
  |---|---|---|
@@ -1305,7 +1306,7 @@ Four warnings about how the app is held, `As of 31.16.0` (a fifth, `X_SHIPPED_GU
1305
1306
  | `X_VERIFY_STEP_UNFLOORED` | a gate step applies here — its suite files exist, its input is committed — and `x.verify.json` `"steps"` does not hold it, so a deleted suite reads as skipped. `e2e` is never proposed (the scaffold's placeholder skips until a browser driver is registered) | `x verify --only <steps> --json`, then add each step that passed to `"steps"` |
1306
1307
  | `X_FRAMEWORK_PIN_RANGE` | an `@ultimat3/*` dependency in any of the app's manifests is anything but an exact version or a `workspace:`/`file:`/`link:` path (`^31.0.0`, `*`, `latest`, `>=31 <32`; an `npm:` alias by its own spec), one finding per manifest | the exact version `bun install` resolved, at the line named; then `bun install` |
1307
1308
  | `X_ENV_NAME_RESERVED` | a name the app declares in `envSchema` or seals in `secrets.enc.json` is one `FRAMEWORK_ENV` (`@ultimat3/core`) lists as a `switch` or `internal` name — setting it for the app also switches that package's behaviour. Deploy-contract names (`DATABASE_URL`, `PORT`) and host names are not collisions | rename it `APP_<name>` (or delete it where the value is meant for the framework); then `x env example` |
1308
- | `X_SHIPPED_GUARD_MISSING` (`As of 31.22`) | a guard `x new` ships is not in the app's `guards/`, so the gate does not hold the app to that rule — one per guard | `x g guard <name> && x verify --only boundaries --json` |
1309
+ | `X_GUARD_VENDORED` (`As of 31.28`) | the app's `guards/` holds a copy of a shipped guard, which runs in place of the built-in one and never receives a fix — one per copy. `boundaries` lists it too | the resolving edit above |
1309
1310
 
1310
1311
  **Redundant indexes**, the same way (`As of 2026-11-14`): each implicit index the entities describe that another index, the primary key or a unique invariant already leads with, still in the newest migration's snapshot, is one line — `<table>.<index> (<columns>) — <covering index>` — under a header naming `x db gen "drop redundant indexes" --drop-redundant`; `--json`: `data.redundantIndexes[]` = `{ table, name, columns, coveredBy }`, `[]` when none, absent when the app would not load or has no snapshot. A listing, never a finding: every write pays for each twice, and dropping it is a migration the app opts into.
1311
1312
 
@@ -1614,9 +1615,11 @@ sampled throughout.
1614
1615
  | `roll-before-migrate` | the roles started before `ROLE=migrate`, on a schema stamped by an older build | `roles-wait`, `serves-after-migrate`, `one-wait-line` |
1615
1616
 
1616
1617
  `roll-before-migrate`, `As of 2026-11-15`, is the rollout order a deploy cannot always hold: no
1617
- proxy and no load. The scratch database is migrated, its framework stamp (`x_jobs`' table comment)
1618
+ fault and no load. The scratch database is migrated, its framework stamp (`x_jobs`' table comment)
1618
1619
  is rewound to name only an older build, then `web`, `worker` and `scheduler` start on it without
1619
- waiting for readiness. Once each has logged its wait (or exited), they are held 3 s and
1620
+ waiting for readiness, with `sync` when `TEST_NATS_URL` is set and `replicator` when
1621
+ `TEST_REPLICATION_URL` names a logical server (the scratch database then lives there) and the app
1622
+ has an entity on a table. A role left out is in `data.rolesNotPlayed[]`, `{ drill, role, needs }`. Once each has logged its wait (or exited), they are held 3 s and
1620
1623
  `ROLE=migrate` runs again. Each must stay up (`roles-wait`: an exit is a crash-loop), log exactly
1621
1624
  one line naming `X_FRAMEWORK_SCHEMA_UNAPPLIED` (`one-wait-line`), and answer `/readyz` 200 once
1622
1625
  migrate has run (`serves-after-migrate`). `ULTIMATE_SCHEMA_WAIT_MS` is inherited: `0` — refuse at
@@ -1635,7 +1638,7 @@ property is red when no job ran during the drill, `sync-resumes` when no sync cl
1635
1638
  A service the app uses must be up for every drill; an unset one is refused, never skipped. A named
1636
1639
  drill that faults a service the app does not declare is refused; a whole run lists it under
1637
1640
  `data.notRun`. `--list` prints the table and runs nothing. `--json`: `{ budgets, targets,
1638
- skippedWrites, drills[], notRun }`, each drill `{ name, verdict, evidence, budgets, baseline }`.
1641
+ skippedWrites, drills[], notRun, rolesNotPlayed }`, each drill `{ name, verdict, evidence, budgets, baseline }`.
1639
1642
 
1640
1643
  Errors: `X_DRILL_FAILED` (one per property that did not hold), `X_DRILL_SERVICE_MISSING`, `X_CLI_UNKNOWN_COMMAND`, `X_CLI_BAD_FLAG`.
1641
1644
 
@@ -1760,8 +1763,8 @@ One major per run, so each hop's gate attributes its red to that hop. `As of 30.
1760
1763
  | 2 | read every workspace's `@ultimat3/*` pins, `overrides` and `resolutions` included | `X_UPGRADE_PIN_UNREADABLE`, `X_UPGRADE_MIXED_PINS` |
1761
1764
  | 3 | `bun pm view @ultimat3/cli versions`: the next major's newest; the last major's newest when no later major exists | `X_UPGRADE_REGISTRY_UNREACHABLE`, `X_UPGRADE_HOP_TOO_WIDE`, `X_UPGRADE_VERSION_UNPUBLISHED`, `X_BUN_VERSION` |
1762
1765
  | 4 | write exact pins, raise the Bun floor | — |
1763
- | 5 | `bun install` | `X_UPGRADE_INSTALL_FAILED`, `fix:` carries the undo |
1764
- | 6 | the installed CLI: `x upgrade codemods --from <from> --to <to>` (below), then `x manifest`, `x doctor --json`, each missing guard (`x g guard <name>`, kept only when `x verify --only boundaries` finds nothing more), a Bun-floor hop's `x verify --only unit` coverage rebaseline, `x exercise --json` and its `exercise` floor figures, `x verify --json` | `X_UPGRADE_GATE_UNREADABLE`, as a finding on a red hop |
1766
+ | 5 | `bun install`, then `bun update <names>` for each transitive package `bun.lock` holds under an advisory floor (`X_ADVISORY_FLOOR_UNMET`) | `X_UPGRADE_INSTALL_FAILED`, `fix:` carries the undo |
1767
+ | 6 | the installed CLI: `x upgrade codemods --from <from> --to <to>` (below), then `x manifest`, `x doctor --json`, each guard that doctor reports missing (only a hop landing before 31.28: `x g guard <name>`, kept when `x verify --only boundaries` finds nothing more), a Bun-floor hop's `x verify --only unit` coverage rebaseline, `x exercise --json` and its `exercise` floor figures, `x verify --json` | `X_UPGRADE_GATE_UNREADABLE`, as a finding on a red hop |
1765
1768
 
1766
1769
  A dry run refuses exactly what the real run would, then stops before step 4 — after previewing this CLI's codemods for the span, written nowhere. It never commits; `git diff` is the hop. Under `--json` fd 1 is one document, fd 2 a `{"upgrade":"<stage>"}` line per stage and a heartbeat a minute.
1767
1770
 
@@ -1779,14 +1782,14 @@ A dry run refuses exactly what the real run would, then stops before step 4 —
1779
1782
  | `pins[]` | `{ file, name, from, to }` |
1780
1783
  | `bun` | `{ from, to, edited[], manual[] }`. `manual[]`: `{ path, line, text, why }`, a site only you can move, listed on every run |
1781
1784
  | `agentsMd` | `link`: `AGENTS.md` was byte-identical to `CLAUDE.md` and the hop makes it a relative symlink to it · `linked`: already one · `differs`: two different files, left alone; merge what only `AGENTS.md` says into `CLAUDE.md`, then `ln -sf CLAUDE.md AGENTS.md` · `none`: one of the two is missing · `null`: no hop planned |
1782
- | `guards` | `{ reported, missing[], differs[], installed[], withheld[] }` from the hop's own `x doctor`. `As of 31.16.0` each missing shipped guard is written from the installed release's template and kept when `boundaries` finds nothing more with it on disk: `installed[]` names it. One the tree already breaks is taken back out: `withheld[]` is `{ name, add, findings }` (`findings: null` when the count could not be measured) and `missing[]` still lists it. `differs[]` — the app's edit or an older copy — is never overwritten: `x g guard <name> --force` is yours. `reported: false` is a CLI too old to list them, which is not the same as none |
1785
+ | `guards` | `{ reported, missing[], differs[], installed[], withheld[], baselined[]? }` from the hop's own `x doctor`. A hop landing on 31.28 or later has `missing[]`, `installed[]` and `withheld[]` empty: shipped guards run built in. Landing earlier (`As of 31.16.0`), each missing shipped guard is written from the installed release's template and kept when `boundaries` finds nothing more with it on disk: `installed[]` names it; one the tree already breaks is taken back out: `withheld[]` is `{ name, add, findings }` (`findings: null` when the count could not be measured) and `missing[]` still lists it. `differs[]` is `{ name, refresh }`: an edited copy the hop's `vendored-guards` codemod left, never overwritten, `refresh` the edit that resolves it. `reported: false` is a CLI too old to list them, which is not the same as none |
1783
1786
  | `guards.baselined` | `[{ name, findings }]`, absent when empty, `As of 2026-11-15`: a guard the tree breaks, kept anyway — its measured count merged into `x.verify.json` as `"guardBaseline": { "<name>": n }` (beside the app's keys; a baseline the app already wrote for it, or a floor that is not a JSON object, is never touched) and kept only when the installed CLI's `boundaries` then finds no more than before. Also in `installed[]`. `findings: null` stays withheld |
1784
1787
  | `coverage` | a hop that moved the Bun floor re-measures unit coverage (`x verify --only unit`); only when that measurement is `X_COVERAGE_BELOW_FLOOR` is the `x.verify.json` `coverage` floor moved to it, the number that fell alone, with a dated `why`: `{ file, measured, from, to, why }`. `null` when nothing moved |
1785
1788
  | `exerciseFloor` | `{ file, written }`: the `exercise` keys (`unprovenMax`, `statementsMax` ≥ 100) the hop's own `x exercise` measured, written into an `x.verify.json` that stated none, so the hop stays green and the floor only falls. A key the app already wrote is never touched; `null` when nothing was written |
1786
1789
  | `manifest` | `{ ok, findings[] }`. A failure does not stop the gate |
1787
1790
  | `exercise` | `{ reported, ok, findings[] }` from the hop's own `x exercise --json`, listed (and printed) before the gate's findings; each `fix` pastes as written. `reported: false`: the hop's CLI answered no exercise document — unknown, never a finding |
1788
1791
  | `verify` | `{ ok, summary, failed[], findings[] }`, each finding `{ step?, code, cause, fix, at? }` |
1789
- | `codemods` | `As of 2026-11-15`: `{ from, to, dryRun, source, applied[] }`, each `applied[]` a codemod that ran: `{ id, since, summary, changed[], skipped[] }`; a `skipped[]` entry is `{ path, reason, diff? }`, a file the codemod would not overwrite (the app edited it), with the template's change as a unified diff to make by hand. `source: installed` — the hop's own CLI applied its list; `driver` — that CLI predates codemods, so this one applied its own. `reinstalled: true` — a `package.json` differs after the codemods (read byte for byte, never off a codemod's report), so the hop ran `bun install` again before any gate stage; `x upgrade codemods` does the same by hand. `failure: { code, cause, fix }` — the installed CLI's codemods run failed for a reason other than lacking the subcommand: nothing applied, this CLI does not stand in, and the hop is not done. An app already at its target reruns every codemod up to the release it is on (`from: 0.0.0`): each is idempotent, so a done one changes nothing and an app still holding an old template's copy is carried across. `null`: no app |
1792
+ | `codemods` | `As of 2026-11-15`: `{ from, to, dryRun, source, applied[] }`, each `applied[]` a codemod that ran: `{ id, since, summary, changed[], skipped[] }`; a `skipped[]` entry is `{ path, reason, diff? }`, a file the codemod would not overwrite (the app edited it), with the template's change as a unified diff to make by hand. `source: installed` — the hop's own CLI applied its list; `driver` — that CLI predates codemods, so this one applied its own. `reinstalled: true` — a `package.json` differs after the codemods (read byte for byte, never off a codemod's report), so the hop ran `bun install` again before any gate stage; `x upgrade codemods` does the same by hand. `failure: { code, cause, fix }` — the installed CLI's codemods run failed for a reason other than lacking the subcommand: nothing applied, this CLI does not stand in, and the hop is not done. `null`: no app, or already at the target, where no codemod runs (`As of 2026-11-18`; `x upgrade codemods --from 0.0.0 --json` carries an app still holding an old template's copy) |
1790
1793
  | `superseded[]` | `As of 2026-11-15`: a workaround the hop's framework made unnecessary, read after the codemods — `{ code: X_SUPERSEDED_WORKAROUND, cause, fix, at }`. A warning, never the verdict |
1791
1794
  | `then` | the next thing to do, in a sentence naming the commands |
1792
1795
 
@@ -2164,6 +2167,15 @@ For each violation involving the file it reports the offending edge, the full ch
2164
2167
 
2165
2168
  Every flag is read before the database opens: a refusal costs no boot.
2166
2169
 
2170
+ ## x heavy
2171
+
2172
+ `As of 2026-11-18`. `x heavy [status] [--json]` · `x heavy run [--label s] [--mb n] [--json] -- <command…>` — the machine ledger every heavy run on this machine reserves its measured memory in, from any directory, in any repository. The rules, the weights and what stays outside: [Working with many agents](Many-Agents).
2173
+
2174
+ | Form | Answers |
2175
+ |---|---|
2176
+ | `x heavy` / `x heavy status` | `data.holds` and `data.queue` (label, directory, MB, pid, age), `data.capacityMb`, `data.usedMb`, `data.coreCap`, `data.machine` (load, runnable tasks, available and usable memory); `data.enabled: false` with `data.off` naming why (`ci`, `test-run`, `disabled`, `unsupported`) |
2177
+ | `x heavy run -- <command…>` | runs it inside one reservation of `--mb` (default: a monorepo typecheck). Exit code passed through, `128 + n` for a signal, 127 and `X_HEAVY_COMMAND_NOT_FOUND` for no such program. SIGTERM and SIGHUP are forwarded. Its summary goes to stderr, so stdout stays the command's; with `--json` the one document is on stdout and the command's stdout moves to stderr |
2178
+
2167
2179
  ## x status
2168
2180
 
2169
2181
  `As of 2026-11-15`. `x status [--url <origin>[,<origin>…]] [--samples n] [--json]` — what the running deployment is, from what it already records. A read, exit 0 whatever it finds: whether one build is fully out is [`x deploy verify`](#x-deploy-verify)'s question.
@@ -302,7 +302,7 @@ From code: `invalidateTags([...])` from `@ultimat3/cache`, the call `x cache bus
302
302
  |---|---|---|
303
303
  | `X_CACHE_UNTAGGED_QUERY` | **reserved, nothing raises it** `As of 2026-08` — a query's tables are covered by no tag, so it could never be invalidated ([Error codes → Reserved codes](Error-Codes#reserved-codes)) | declare the entity tag, then `x manifest` |
304
304
  | `X_CACHE_TAG_UNKNOWN` | `tag "<name>" is not declared by any entity` | `declareTags(['<name>'])` beside the app's other declared tags, plus the name in its `CacheTagRegistry`; for a typo, correct the tag |
305
- | `X_CACHE_TOO_LARGE` | `entry "<key>" is <n>B, over the <tier> budget of <m>B` | `lruTier({ maxBytes: <n> })` / `redisTier({ maxValueBytes: <n> })` where the tier is built, or cache a projection instead of the row |
305
+ | `X_CACHE_TOO_LARGE` | `entry "<key>" is <n>B, over the <tier> budget of <m>B` | `cacheTiers: [lruTier({ maxBytes: <n> })]` / `cacheTiers: [redisTier({ maxValueBytes: <n> })]` in `apps/web/runtime.ts` ([limits](Configuration#cache)), or cache a projection instead of the row |
306
306
  | `X_CACHE_DRIVER_UNAVAILABLE` | `cache tier "<driver>" is unavailable` — a Redis command missed its deadline, or the tier is parked after one; or a purge driver built without its token | the error carries the exact config or command to fix |
307
307
  | `X_CACHE_PURGE_FAILED` | `<driver> refused the purge (HTTP <status>)` — a wrong token, a zone without tag purge, a throttle, or a key a CDN would split | `meta.retryable === true` → the identical purge can land again; otherwise set the env key the `fix` names |
308
308
 
package/wiki/Compared.md CHANGED
@@ -28,23 +28,25 @@ Who uses it:
28
28
 
29
29
  ## Measured, and how to reproduce it
30
30
 
31
- One local run on an 8-core laptop, `As of 2026-11-06`, not yet a CI figure; the method, the box and
32
- the caveats are [`scripts/bench/results/README.md`](https://github.com/developerz-ai/ultimate/blob/main/scripts/bench/results/README.md),
31
+ Medians of five runs on a 4-core GitHub `ubuntu-latest` runner, `As of 2026-11-18`; the method, the
32
+ box and the caveats are [`scripts/bench/results/README.md`](https://github.com/developerz-ai/ultimate/blob/main/scripts/bench/results/README.md),
33
33
  and every number below is held to the committed JSON by `bun run scripts/bench-claims.ts`
34
34
  (`X_BENCH_CLAIM_STALE`).
35
35
 
36
36
  | Figure | Measured |
37
37
  |---|---|
38
- | scaffold, published `create-ultimate` (29.4.0) | 4.7 s |
39
- | `bun run setup`, cold Bun cache | 43.3 s |
40
- | `node_modules` after setup | 165 MB |
41
- | first `bun run verify` | **red on 29.4.0**: `budgets` was `X_BUDGET_UNMEASURED` until something built; the step builds first on `main` |
42
- | `/` under `x dev`, one client, concurrency 16 | median 267 req/s, p99 181.85 ms |
43
- | a typed read, `/_x/query/post-list` | median 183 req/s, p99 258.26 ms |
44
- | cold start to the first 2xx (`x dev`) | 4.8 s |
38
+ | scaffold, published `create-ultimate` (31.46.0) | 1.5 s |
39
+ | `bun run setup`, cold Bun cache | 8.0 s |
40
+ | `node_modules` after setup | 197 MB |
41
+ | first `bun run verify` | green in all five runs, median 23.1 s |
42
+ | `/` under `x dev`, one client, concurrency 16 | median 1,147 req/s, p99 26.86 ms |
43
+ | a typed read, `/_x/query/post-list` | median 875 req/s, p99 35.3 ms |
44
+ | cold start to the first 2xx (`x dev`) | 1.1 s |
45
45
 
46
46
  `x dev` is the development server — every role and an embedded Postgres in one process — so these
47
- are a laptop's first-hour numbers, not a production capacity claim.
47
+ are a CI runner's first-hour numbers, not a production capacity claim. The previous figures came from
48
+ a laptop on 29.4.0, so the difference in times is not a measured speed-up; `node_modules` did grow,
49
+ from 165 MB.
48
50
 
49
51
  Reproduce on any machine with Bun and a clone of this repository:
50
52
 
@@ -56,7 +58,7 @@ bun run scripts/bench/http-hello.ts --url http://localhost:3000/ --seconds 30 --
56
58
  `http-hello.ts --url` loads any URL, so point it at your own app on any stack and compare like with
57
59
  like. It refuses a run under 10 s (`X_BENCH_RUN_TOO_SHORT`), and a non-2xx answer or a server that
58
60
  dies mid-run is `X_BENCH_RUN_FAILED`, never a figure. `.github/workflows/bench.yml` re-measures weekly
59
- and on every release, on a free `ubuntu-latest` runner, and opens a pull request with the JSON.
61
+ and on dispatch, on a free `ubuntu-latest` runner, and opens a pull request with the JSON.
60
62
 
61
63
  ## Rails
62
64
 
@@ -231,14 +231,31 @@ its config into a variable first.
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` |
233
233
 
234
- **The per-tier byte caps and TTLs are constructor options, not config** — the same shape as the realtime caps above. `cache.memo.maxBytes`, `cache.lru.maxBytes`, `cache.redis.*` and `cache.ttl.*` are not fields and never were; writing one is `TS2353`, excess property on `Input<CacheConfig>`, and `X_CONFIG_INVALID` at boot.
234
+ **A rung's limits are constructor options, set in `runtime.ts`, never config** `As of 2026-11`. The boot builds `lru` and `redis` with their defaults; `cacheTiers` replaces the rung of the same name, and that is the one way to change a limit:
235
+
236
+ ```ts
237
+ // apps/web/runtime.ts — `cache.tiers` still decides which rungs exist
238
+ import { lruTier, redisTier } from '@ultimat3/cache';
239
+
240
+ export const runtime = {
241
+ cacheTiers: [
242
+ lruTier({ maxBytes: 128 * 1024 * 1024 }),
243
+ redisTier({ maxValueBytes: 2 * 1024 * 1024, jitterFraction: 0.1 }),
244
+ ],
245
+ };
246
+ ```
247
+
248
+ `cache.memo.maxBytes`, `cache.lru.maxBytes`, `cache.redis.*` and `cache.ttl.*` are not fields and never were: writing one is `TS2353`, excess property on `Input<CacheConfig>`, and `X_CONFIG_INVALID` at boot. A bad value is refused where the tier is built (`X_CACHE_LIMIT_INVALID`, `X_CACHE_JITTER_INVALID`). There is no entry-count limit: both rungs are bounded in bytes.
249
+
250
+ A supplied `redisTier` with no `client` uses core's client: `REDIS_URL`, then `VALKEY_URL`, then `redis://localhost:6379`. The refusal the boot's own `redis` rung gets for an unset URL does not apply to it; the boot logs `cache.tier.default-redis` instead.
235
251
 
236
252
  | Option | Where | Default | Effect |
237
253
  |---|---|---|---|
238
254
  | `maxBytes` | `lruTier({ … })` | 64 MiB | byte budget for the whole tier; a single value over it is `X_CACHE_TOO_LARGE` rather than a silent drop |
239
- | `defaultTtlMs` | same | `60_000` | applied when a `set` omits `ttlMs` |
240
- | `jitterFraction` | same | `DEFAULT_TTL_JITTER_FRACTION` | TTL spread in `[0, 1)`; `0` disables it, which is how a stampede is reproduced in a test |
241
- | `clock` / `rng` | same | system | injected so a jittered expiry is deterministic |
255
+ | `maxValueBytes` | `redisTier({ … })` | 1 MiB | the largest encoded value one `set` may write; over it is `X_CACHE_TOO_LARGE` |
256
+ | `defaultTtlMs` | `lruTier({ … })` | `60_000` | applied when a `set` omits `ttlMs` |
257
+ | `jitterFraction` | `lruTier({ … })`, `redisTier({ … })` | `DEFAULT_TTL_JITTER_FRACTION` | TTL spread in `[0, 1)`; `0` disables it, which is how a stampede is reproduced in a test |
258
+ | `clock` / `rng` | `lruTier({ … })`, `redisTier({ … })` | system | injected so a jittered expiry is deterministic |
242
259
  | `loadDeadlineMs` | `cacheStack(tiers, { … })` | `30_000` | how long one `load()` may hold its key before a later reader starts its own. Frees the KEY, never the load — the wedged call runs on. Anchored to `http`'s own request timeout: a load still running at 30 s has no reader left to serve |
243
260
  | `schedule` | same | `setTimeout` | injected so the deadline above is provable without a test waiting one out |
244
261
 
@@ -526,6 +543,7 @@ mail: { retainMime: { maxBytes: 262_144 } },
526
543
  | `SES_CONFIGURATION_SET` | — | SES only, optional: the configuration set that publishes delivery events |
527
544
  | `MAIL_FROM` | — | required by SMTP, Resend and SES; the memory and unconfigured drivers do not read it. `Name <addr>`; also the envelope sender and the `Message-ID` domain |
528
545
  | `MAIL_POOL_SIZE` | — | SMTP connections open at once. Default `4`, whole number ≥ 1 |
546
+ | `MAIL_TIMEOUT_MS` | — | SMTP only: the deadline for any single read or write. Default `30000`, whole number from 1 to 2147483647 (the most a timer holds); anything else is `X_CONFIG_INVALID` at boot |
529
547
 
530
548
  The list is `MAIL_ENV_KEYS` in `packages/mail/src/driver-env.ts`, `As of 2026-10`. More than one of
531
549
  `SMTP_URL`, `RESEND_API_KEY` and `SES_REGION` is `X_CONFIG_INVALID`: a process delivers through
package/wiki/Home.md CHANGED
@@ -91,6 +91,7 @@ Follow in order. Each page states what it was executed against in its own first
91
91
  | [Client navigation](Client-Navigation) | soft navigation over server-rendered pages: one config line per surface, swap, prefetch, history, focus |
92
92
  | [MCP and AI](MCP-And-AI) | the dev MCP server, every action as a tool, the `llm()` gateway, evals |
93
93
  | [Agents](Agents) | `agent()` as an action factory, tools as real actions, `hive()`, `agentJob()`, and the at-least-once trap |
94
+ | [Working with many agents](Many-Agents) | a worker runs its own files, the coordinator runs the gate once; the machine's memory ledger and core cap |
94
95
  | [Admin dashboard](Admin-Dashboard) | `defineAdmin()` serving list, detail and form per entity with no host code; filters, scopes, sections, related rows, actions with `when` and `batch`, the audit log, the jobs dashboard; zero JavaScript; its MCP surface |
95
96
  | [Scraping](Scraping) | `scrape()` as a job factory, the driver-blind page vocabulary, robots and host gates, per-run egress, a rented CDP browser, usage, sealed sessions, mid-run prompts |
96
97
  | [Auth](Auth) | sessions, OAuth, MFA, API keys and service tokens — the output is an `Actor` |
@@ -346,7 +346,7 @@ Read as a review checklist. Each one is a defect on sight.
346
346
  | live regions and the focus trap | `packages/ui/src/a11y.ts` |
347
347
  | the toast queue's rules | `packages/ui/src/toast/toast-state.ts` |
348
348
  | a list's URL state (sort, cursor, limit, `q`) | `packages/ui/src/list-url.ts` |
349
- | your app's guards | `guards/` in the app root — `x new` writes every name in `SHIPPED_GUARD_NAMES`, `x g guard <name>` adds one, `x doctor` lists the shipped ones missing |
349
+ | your app's guards | `guards/` in the app root — `x new` writes only `guards/shipped.json`, `x g guard <name>` adds one of your own, `x doctor` lists any copy of a shipped guard still held |
350
350
 
351
351
  Components, props and token vocabulary: [UI components](UI-Components). Colour roles and the
352
352
  contrast table: [Theming](Theming). Seeing a component in a state you cannot click to:
@@ -83,7 +83,7 @@ Each of these is a defect, or a target, somebody has already argued about, and t
83
83
  | Retry-from-step on the jobs dashboard is a free-text field | `As of 2026-10`. `job.retry-from-step` takes `{ step: t.string.min(1) }` (`packages/admin/src/jobs/job-actions.ts`); the run's detail page shows its steps, but the form does not offer them as a choice. **Why it stays** (`As of 2026-11-18`): An action's `input` is one static schema shared by the form, the MCP tool and the audit entry, so it has no per-row list of choices to offer. **Do instead:** copy the step name from the run's `steps` section on the same page. |
84
84
  | The admin MCP batch tool takes `ids` only | `As of 2026-10`. A `batch` action is one MCP tool, `admin.action.<name>`, and it takes the rows by id; "all matching" — the list's own filter — is a screen control only. **Why it stays** (`As of 2026-11-18`): An agent names every row it changes, so the per-row gate and the `<entity>:<n> rows` confirmation state a set it chose. "All matching" stays a control a person reads the list beside. **Do instead:** list the rows with `admin.<entity>.list` and its `where`, then pass their ids. |
85
85
  | No counts on the jobs dashboard's state tabs | `As of 2026-10`. `stats()` counts per queue across every tenant, so a count on a tab would show an org-scoped operator other orgs' numbers; the tabs carry none and the overview's tiles carry the counts, for a platform operator only. A per-tenant count is a second query nothing issues yet. **Why it stays** (`As of 2026-11-18`): A per-tenant count per tab is one more read per state on every page view, over a column with no leading index (the org-scoped runs-list row). **Do instead:** a platform operator reads the overview tiles; an org-scoped operator reads a tab's own page. |
86
- | `x drill` proves one node per role on one machine, and drills no object store and no CDN | `As of 2026-11-06`. The fleet is one `web`, one `worker` (and one `sync` for `nats-down`) on one host, every dependency a local container behind a Bun TCP proxy: a multi-node NATS cluster, a Postgres failover to a real standby, a real S3 bucket and a real CDN in front of the web role are never faulted. `nats-down`'s sync lane is proven on a stand-in node (`packages/testing/src/drill-sync.test.ts`), not on `examples/dummy`, whose transport is in-memory; its client subscribes to nothing by default, so a gap counts only what the node volunteers. CI runs four of the nine (`fault-drills`, `roll-before-migrate` among them) [pin](https://github.com/developerz-ai/ultimate/blob/main/packages/testing/src/drills.test.ts#the%20nine%20drills%2C%20once%20each) **Why it stays** (`As of 2026-11-18`): A drill runs where a CI runner or one machine can hold the whole fleet. A real standby, bucket or CDN is a staging environment, which is the app's. **Do instead:** the rest by hand: `x drill --list --json`, then `x drill <name> --json` with `docker/test-services.env` loaded. A multi-node or object-store fault is a staging drill of your own, against [`docs/ops/06-runbooks.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/ops/06-runbooks.md) |
86
+ | `x drill` proves one node per role on one machine, and drills no object store and no CDN | `As of 2026-11-06`. The fleet is one `web`, one `worker` (one `sync` for `nats-down`, and one of every role for `roll-before-migrate`) on one host, every dependency a local container behind a Bun TCP proxy: a multi-node NATS cluster, a Postgres failover to a real standby, a real S3 bucket and a real CDN in front of the web role are never faulted. `nats-down`'s sync lane is proven on a stand-in node (`packages/testing/src/drill-sync.test.ts`), not on `examples/dummy`, whose transport is in-memory; its client subscribes to nothing by default, so a gap counts only what the node volunteers. CI runs four of the nine (`fault-drills`, `roll-before-migrate` among them) [pin](https://github.com/developerz-ai/ultimate/blob/main/packages/testing/src/drills.test.ts#the%20nine%20drills%2C%20once%20each) **Why it stays** (`As of 2026-11-18`): A drill runs where a CI runner or one machine can hold the whole fleet. A real standby, bucket or CDN is a staging environment, which is the app's. **Do instead:** the rest by hand: `x drill --list --json`, then `x drill <name> --json` with `docker/test-services.env` loaded. A multi-node or object-store fault is a staging drill of your own, against [`docs/ops/06-runbooks.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/ops/06-runbooks.md) |
87
87
  | `x cache`'s `stats` | removed from the registry `As of 2026-11-15`, where it was planned and exited `X_NOT_IMPLEMENTED`; now `X_CLI_UNKNOWN_COMMAND`, exit 1 as before. A hit rate is `cache.hit`/`cache.miss` on each serving process's instrumentation bus (`packages/cache/src/tiers.ts`), and no process aggregates them: the `/_x` cache panel shows the tag graph and the invalidation log, not hits. The route is a counter on each role's `/metrics`, read by whatever scrapes it; a CLI process has served nothing to count |
88
88
  | `x status` for sync, scheduler and replicator | `As of 2026-11-15`, `x status` reads every live worker's build from `x_job_workers` and samples each `--url` origin's `/readyz` for `x-ultimate-build`. No fleet-wide record exists for the other roles: a sync node keeps its connected clients' builds in its own memory (the `/_x` live panel in `x dev`), and the scheduler and replicator write no row. Each answers `/readyz` on its health port, so `x status --url http://<pod>:9091` reads one pod; the build-ID distribution of connected clients needs an aggregate the realtime package does not keep (`data.unrecorded` names these roles) |
89
89
  | `api/**/route.ts` | not a file kind — owner decision 1 ([#648](https://github.com/developerz-ai/ultimate/issues/648)), `As of 2026-10`. `api/` holds the action and query projections `defineApi()` collects; a route file there is refused at registration (`X_ROUTE_FILE_INVALID`), and 26.0.0 deleted `ROUTE_FILENAME`'s `api` row ([#709](https://github.com/developerz-ai/ultimate/issues/709)). A wire format an action cannot speak — a webhook receiver, an OAuth endpoint — is a plain HTTP route in the `routes` runtime override ([Configuration](Configuration)) |
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,60 @@
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
+ ```
36
+
37
+ A waiter prints one line on stderr saying its position and who holds the memory, and again only when that changes, so `--json` output stays one document. `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.
38
+
39
+ ## Cores
40
+
41
+ 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.
42
+
43
+ ## Switches
44
+
45
+ | Variable | Effect |
46
+ |---|---|
47
+ | `ULTIMATE_HEAVY_MEMORY=8g` | what the ledger admits; `0` turns it off |
48
+ | `ULTIMATE_HEAVY_CORES=6` | the local core ceiling |
49
+ | `ULTIMATE_HEAVY_DIR=<path>` | another ledger; also opts a test run in |
50
+ | `ULTIMATE_TEST_SLOTS=0` | test workers skip the ledger |
51
+
52
+ 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.
53
+
54
+ ## Re-measuring a weight
55
+
56
+ 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:
57
+
58
+ ```sh
59
+ GOMAXPROCS=4 bun run scripts/heavy-peak.ts -- node_modules/.bin/tsc -b --pretty false
60
+ ```
package/wiki/Stability.md CHANGED
@@ -26,7 +26,7 @@ A breaking change to any of these needs a major, and a major waits for its windo
26
26
  | `.x/` — the build cache, generated manifests, snapshots | regenerated by the CLI; never hand-edited, never read by an app |
27
27
  | the exact wording of a `cause:` or `fix:` line | the code is the contract; the text improves in any release |
28
28
  | a gate verdict getting stricter | a new `x verify` rule that reds an app waits on `next` like any break |
29
- | performance figures and budgets | measurements, each dated in its committed JSON under `scripts/bench/results/`, never promises. `bench.yml` re-measures the first-hour and HTTP figures weekly (and on dispatch), as a pull request; a release does not trigger it (`GITHUB_TOKEN` events start no workflow). `As of 2026-11-14` the committed figures predate its first green run. Budgets: [Routes and render modes](Routes-And-Render-Modes#budgets) |
29
+ | performance figures and budgets | measurements, each dated in its committed JSON under `scripts/bench/results/`, never promises. `bench.yml` re-measures the first-hour and HTTP figures weekly (and on dispatch), as a pull request; a release does not trigger it (`GITHUB_TOKEN` events start no workflow). `As of 2026-11-18` the committed first-hour and HTTP figures are its own. Budgets: [Routes and render modes](Routes-And-Render-Modes#budgets) |
30
30
 
31
31
  Never "stable forever": a covered surface can change, in a scheduled major, with its entry in [Upgrading](Upgrading).
32
32
 
package/wiki/Testing.md CHANGED
@@ -1387,10 +1387,10 @@ gates at once — and it is held to a **memory budget**, not to whatever looks f
1387
1387
  what it chose and why — `3 workers (budget 4.0 GB)`. `ULTIMATE_TEST_MEMORY_BUDGET=3g` replaces
1388
1388
  the budget, `ULTIMATE_TEST_MAX_WORKERS=2` caps the width, `--workers N` wins over both. Total RAM,
1389
1389
  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 leases that many slots from a pool of lock
1391
- files under the OS temp dir (one per worker the budget allows; a dead holder's slot is taken
1392
- over). A second `x test` or `x verify` on the same box gets what is left and runs narrower, or
1393
- waits for one slot, instead of doubling the memory. `ULTIMATE_TEST_SLOTS=0` turns it off.
1390
+ - **One budget per machine.** Each batch of workers reserves its measured memory in the
1391
+ [machine ledger](Many-Agents), at most 4 cores locally. A second `x test` or `x verify` on the
1392
+ same box runs narrower or queues instead of doubling the memory; a selection of 3 files or fewer
1393
+ runs free. `ULTIMATE_TEST_SLOTS=0` turns it off.
1394
1394
  - **No per-file isolation by default.** A worker keeps one global and one module registry across
1395
1395
  the files it runs (`bun test --parallel=N --no-isolate`) — measured 2-5x faster than `--isolate`
1396
1396
  at the same width. Between two files the testing preload hands the next file the process it would
@@ -1521,7 +1521,7 @@ This table is a hand-synced copy of it ([Contributing](Contributing)).
1521
1521
  |---|---|
1522
1522
  | `typecheck` | any error; `any` is banned by lint, not tolerated by a cast |
1523
1523
  | `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 file in the app's own `guards/`** — every name in `SHIPPED_GUARD_NAMES` (`packages/cli/src/templates/scaffold-guards.ts`) that `x new` writes, or the ones you kept → [Interface rules](Interface-Rules) |
1524
+ | `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
1525
  | `filesize` | a source file over 500 lines |
1526
1526
  | `package-shape` | a workspace package missing `README.md`, `CLAUDE.md`, `tsconfig.json`, or `src/index.ts` |
1527
1527
  | `errors` | an `X_*` code with no runnable fix or no docs page |
@@ -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
- │ Every name in SHIPPED_GUARD_NAMES ships; `x doctor`
227
- │ lists any missing. Delete one by deleting its file
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
  ```
package/wiki/Upgrading.md CHANGED
@@ -313,11 +313,12 @@ A setter still on a package's `.` barrel is `X_ADAPTER_PORT_INCOMPLETE` on the `
313
313
  | a required column with no default is added nullable and contracted to NOT NULL in the migration's non-transactional step (**31.44.0**), so a fresh or reset database migrates clean | a committed migration that still holds the old `-- backfill "c", then: … set not null;` comment: declare the column `.nullable()`, `x db gen "relax c"`, declare it required again, `x db gen "contract c"`, then `x db migrate`. A populated production table: ship `.nullable()` plus its `backfill()` first, then required |
314
314
  | two shipped guards change (**31.44.0**), built in: `undeclared-env` (`X_UNDECLARED_ENV`) also refuses a `defineEnv(` record anywhere in app source whose keys `envSchema` in `app.config.ts` does not declare; `untranslated-string` (`X_UNTRANSLATED_STRING`) ends its fix with `x verify --only boundaries`. A copy still in `guards/` keeps the old rule until `x upgrade` migrates it to the release after 31.43.0 | each `undeclared-env` finding names the keys to move into `envSchema`; then `x env example` |
315
315
  | `x new`'s `ci.yml` uploads each `verify-part-*` document with `retention-days: 1` (**31.45.0**): the verdict job reads it in the same run, and GitHub's 90-day default let one adopter's parts fill the org's artifact storage quota until CI could not run | nothing: `x upgrade` applies codemod `ci-artifact-retention`; an upload that already sets `retention-days` is left as it is. Artifacts already stored keep their 90 days: delete them from the repository's Actions storage settings if the quota is already full |
316
- | codemod `ci-pinned-actions` pins any tagged major of `actions/checkout`, `cache`, `upload-artifact` and `download-artifact` (**31.45.0**), and adds `persist-credentials: false` to each checkout it pins, inside the step's own `with:` when it has one; 31.43–31.44 skipped a workflow on another major (`actions/checkout@v5`) | nothing: `x doctor` names it as `X_UPGRADE_CODEMODS_PENDING`, and `x upgrade --json` applies it. A SHA-pinned line and an action with no pin are never touched |
316
+ | codemod `ci-pinned-actions` pins any tagged major of `actions/checkout`, `cache`, `upload-artifact` and `download-artifact` (**31.45.0**), and adds `persist-credentials: false` to each checkout it pins, inside the step's own `with:` when it has one; 31.43–31.44 skipped a workflow on another major (`actions/checkout@v5`) | nothing: `x doctor` names it as `X_UPGRADE_CODEMODS_PENDING`, and `x upgrade codemods --from 0.0.0 --json` applies it. A SHA-pinned line and an action with no pin are never touched |
317
317
  | the shipped `undeclared-env` guard's fix changes (**31.45.0**), built in; its findings do not: `X_UNDECLARED_ENV` still opens with the `envSchema` line to paste, and adds a second branch for a build-time constant injected by `bun build --define process.env.X=…` (declare a global, `--define NAME=…`), which no deploy sets. A copy still in `guards/` keeps the old text until `x upgrade` migrates it to the release after 31.44.0 | nothing; for a `--define` constant, follow the second branch rather than declaring an env var |
318
318
  | `x g sign-in --password` and `x g invite` declare `native: { success: (output) => output.next }` on their six actions and drop the `landAt()` helper (**31.46.0**); an app scaffolded before keeps its `landAt`, whose `setRedirect` still answers its forms with a 303 | nothing. Optional, to have one redirect path: on each action, add `native: { success: (output) => output.next }`, replace `landAt(x)` with `x`, delete `landAt` from `sign-in-flow.ts` / `invite.ts`, and move the test that asserted `request.redirect` to a form post through `httpServer({ routes: [toRoute(target)] }).fetch(…)` with `accept: text/html`, asserting `303` and the `Location` — a fresh `x g sign-in --password` writes that test. Then `x verify --only unit,manifest` |
319
319
  | an offline replay sends `x-ultimate-replay-scope`, and the action route answers a session other than the queue's owner `409 X_REPLAY_PRINCIPAL_MISMATCH`, the entry kept `pending` (**31.47.0**, [Realtime](Realtime#tier-3-shipped-in-2100)); `DEFAULT_CORS.allowHeaders` lists the header | an app setting `cors.allowHeaders` replaces that list (`packages/http/src/config.ts`): add `x-ultimate-replay-scope` to it. A cross-origin caller sending the header needs this; the page outbox replays to a same-origin path, which has no preflight. An app on several processes sets `SESSION_SECRET` (32+ characters), or a replay reaching another process is refused |
320
320
  | `x exercise` with no `--seed`, and so `x verify`'s `exercise` step, runs one constant seed (**31.47.0**) where each run drew a random one, and `seed` in `.x/exercise.json` is always the number used, never `null`. One tree now gets one verdict, but an `exercise.unprovenMax` measured under random seeds can sit just below the constant seed's figure, so the first gate after the hop can be `X_EXERCISE_UNPROVEN_ABOVE_FLOOR`. `x upgrade` writes a figure only where the app states none, and never raises one | `x exercise --json`, then fix the helper or override each `unproven` record names: pick rows by what they are, never by id order, and assume no order between sized calls ([Testing](Testing)). If the figure that remains is the honest one, raising `unprovenMax` to it is your own reviewed edit of `x.verify.json`. `x exercise --seed random` looks for seed-dependent helpers |
321
+ | `x upgrade` stops requiring an `e2e` suite no codemod wrote (**31.47.1**): an app with pages but no `apps/web/site/page.tsx` was left on `X_VERIFY_SUITE_VANISHED`. Rerunning `x upgrade` at the target no longer replays every codemod | nothing: `x upgrade` applies codemod `e2e-suite-floor`, which writes a `page.e2e.test.ts` beside the shortest parameter-free page, or moves `e2e` to `skip` with its why when no page can be visited. To apply codemods an older CLI left behind: `x upgrade codemods --from 0.0.0 --json` |
321
322
 
322
323
  ## 29.x → 30.0.0, entry by entry
323
324