@ultimat3/cli 31.11.0 → 31.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/cli",
3
- "version": "31.11.0",
3
+ "version": "31.13.0",
4
4
  "description": "The `x` binary: new, dev, build, verify, generate, db, mcp, doctor, deploy",
5
5
  "keywords": [
6
6
  "ultimate",
@@ -53,34 +53,34 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@babel/core": "^8.0.9",
56
- "@ultimat3/action": "31.11.0",
57
- "@ultimat3/admin": "31.11.0",
58
- "@ultimat3/ai": "31.11.0",
59
- "@ultimat3/auth": "31.11.0",
60
- "@ultimat3/cache": "31.11.0",
61
- "@ultimat3/core": "31.11.0",
62
- "@ultimat3/db": "31.11.0",
63
- "@ultimat3/entity": "31.11.0",
64
- "@ultimat3/flags": "31.11.0",
65
- "@ultimat3/http": "31.11.0",
66
- "@ultimat3/i18n": "31.11.0",
67
- "@ultimat3/jobs": "31.11.0",
68
- "@ultimat3/mail": "31.11.0",
69
- "@ultimat3/manifest": "31.11.0",
70
- "@ultimat3/mcp": "31.11.0",
71
- "@ultimat3/money": "31.11.0",
72
- "@ultimat3/notify": "31.11.0",
73
- "@ultimat3/policy": "31.11.0",
74
- "@ultimat3/pwa": "31.11.0",
75
- "@ultimat3/query": "31.11.0",
76
- "@ultimat3/realtime": "31.11.0",
77
- "@ultimat3/render": "31.11.0",
78
- "@ultimat3/schema": "31.11.0",
79
- "@ultimat3/scraping": "31.11.0",
80
- "@ultimat3/seo": "31.11.0",
81
- "@ultimat3/storage": "31.11.0",
82
- "@ultimat3/testing": "31.11.0",
83
- "@ultimat3/time": "31.11.0",
56
+ "@ultimat3/action": "31.13.0",
57
+ "@ultimat3/admin": "31.13.0",
58
+ "@ultimat3/ai": "31.13.0",
59
+ "@ultimat3/auth": "31.13.0",
60
+ "@ultimat3/cache": "31.13.0",
61
+ "@ultimat3/core": "31.13.0",
62
+ "@ultimat3/db": "31.13.0",
63
+ "@ultimat3/entity": "31.13.0",
64
+ "@ultimat3/flags": "31.13.0",
65
+ "@ultimat3/http": "31.13.0",
66
+ "@ultimat3/i18n": "31.13.0",
67
+ "@ultimat3/jobs": "31.13.0",
68
+ "@ultimat3/mail": "31.13.0",
69
+ "@ultimat3/manifest": "31.13.0",
70
+ "@ultimat3/mcp": "31.13.0",
71
+ "@ultimat3/money": "31.13.0",
72
+ "@ultimat3/notify": "31.13.0",
73
+ "@ultimat3/policy": "31.13.0",
74
+ "@ultimat3/pwa": "31.13.0",
75
+ "@ultimat3/query": "31.13.0",
76
+ "@ultimat3/realtime": "31.13.0",
77
+ "@ultimat3/render": "31.13.0",
78
+ "@ultimat3/schema": "31.13.0",
79
+ "@ultimat3/scraping": "31.13.0",
80
+ "@ultimat3/seo": "31.13.0",
81
+ "@ultimat3/storage": "31.13.0",
82
+ "@ultimat3/testing": "31.13.0",
83
+ "@ultimat3/time": "31.13.0",
84
84
  "babel-preset-solid": "^1.9.16"
85
85
  }
86
86
  }
@@ -239,6 +239,7 @@ export const CLI_OWNED_ERROR_CODES = [
239
239
  'X_TYPESCRIPT_VERSION',
240
240
  'X_SEED_FAILED',
241
241
  'X_NATIVE_FORM_UNANSWERED',
242
+ 'X_ASSET_RETAIN_UNDECLARED',
242
243
  ] as const;
243
244
 
244
245
  /**
@@ -464,6 +465,7 @@ export const CLI_ERROR_TITLES: Readonly<Record<CliListedErrorCode, string>> = {
464
465
  X_TYPESCRIPT_VERSION: 'The app declares a TypeScript older than the one x new scaffolds',
465
466
  X_SEED_FAILED: 'a seed threw an uncoded error',
466
467
  X_NATIVE_FORM_UNANSWERED: 'a page form posts to an action that declares no native answer',
468
+ X_ASSET_RETAIN_UNDECLARED: "A served build keeps no earlier build's assets",
467
469
  };
468
470
 
469
471
  // One unconditional call, so a second package claiming one of the CLI's codes throws
@@ -24,7 +24,7 @@ import {
24
24
  } from '@ultimat3/auth/schema';
25
25
  import { FAILURES_TABLE, SQL_FAILURES_TABLE, type TableStorage } from '@ultimat3/db';
26
26
  import { RATE_LIMIT_STORAGE, SQL_RATE_LIMIT_TABLE } from '@ultimat3/http';
27
- import { SQL_JOBS_TABLE } from '@ultimat3/jobs';
27
+ import { JOBS_TABLE_STORAGE, SQL_JOBS_TABLE } from '@ultimat3/jobs';
28
28
  import { MCP_CONFIRMATIONS_TABLE, SQL_MCP_CONFIRMATIONS_TABLE } from '@ultimat3/mcp/schema';
29
29
  import {
30
30
  PUSH_DEVICES_TABLE,
@@ -82,6 +82,9 @@ export const FRAMEWORK_SCHEMA: readonly FrameworkSchema[] = Object.freeze([
82
82
  'x_job_counters',
83
83
  ]),
84
84
  ddl: Object.freeze([SQL_JOBS_TABLE]),
85
+ // Fillfactor 80: the room a lease renewal's HOT update needs. Drift is what reports a hand
86
+ // `alter table x_jobs reset (fillfactor)` — the apply never rewrites a table it made.
87
+ storage: Object.freeze([JOBS_TABLE_STORAGE]),
85
88
  }),
86
89
  Object.freeze({
87
90
  pkg: '@ultimat3/action',
package/src/mcp-errors.ts CHANGED
@@ -382,6 +382,8 @@ const CLI_FIXES: Readonly<Record<CliErrorCode, string>> = {
382
382
  X_SEED_FAILED: 'bun --eval \'await (await import("./packages/db/seeds/dev.ts")).dev.run()\'',
383
383
  X_NATIVE_FORM_UNANSWERED:
384
384
  "native: { success: (output) => '/where-it-lands' } in the action's declaration, then x verify --only manifest",
385
+ X_ASSET_RETAIN_UNDECLARED:
386
+ "edit app.config.ts: add assets: { retain: { disk: 'assets', builds: 3 } }, naming a disk your defineStorage({ disks }) declares that every web pod reads",
385
387
  };
386
388
 
387
389
  const isCliCode = (code: string): code is CliErrorCode =>
@@ -3,7 +3,7 @@
3
3
  // binds, so before `/readyz` can say ready — and hand back the reader the asset routes miss into.
4
4
 
5
5
  import type { AppConfig, AssetsRetainConfig } from '@ultimat3/core';
6
- import { ConfigInvalidError, renderFixLiteral } from '@ultimat3/core';
6
+ import { ConfigInvalidError, logger, renderFixLiteral, UltimateError } from '@ultimat3/core';
7
7
  import type { Storage } from '@ultimat3/storage';
8
8
  import type { IslandBundle } from './island-bundle';
9
9
  import type { BuildAsset, PublishReport, RetainLog } from './retained-assets';
@@ -60,6 +60,35 @@ export function buildAssetsOf(surface: BuiltSurface): readonly BuildAsset[] {
60
60
  return [...new Map(assets.map((asset) => [asset.url, asset] as const)).values()];
61
61
  }
62
62
 
63
+ /**
64
+ * A served build that keeps no earlier build's hashed files. Logged, never thrown: one replica
65
+ * serving its own build is correct until the next deploy, and the boot cannot see how many
66
+ * replicas the platform runs — only that nothing would answer a URL another build named.
67
+ */
68
+ export class AssetRetainUndeclaredError extends UltimateError {
69
+ constructor(input: { readonly environment: string; readonly disks: readonly string[] }) {
70
+ const disk = renderFixLiteral(input.disks[0], '"assets"');
71
+ super({
72
+ code: 'X_ASSET_RETAIN_UNDECLARED',
73
+ cause: `this web role serves the ${input.environment} environment with no assets.retain, so it answers only its own build's hashed files: across a rolling deploy with more than one replica, or after any deploy, a page can name a stylesheet or island chunk the answering replica 404s, and renders unstyled`,
74
+ fix: `assets: { retain: { disk: ${disk}, builds: 3 } } # in app.config.ts, over a disk every web pod reads${input.disks.length === 0 ? ' (declare one with defineStorage({ disks }))' : ''}`,
75
+ meta: { environment: input.environment },
76
+ });
77
+ }
78
+ }
79
+
80
+ /** Where a boot has no rolling deploy to survive: a laptop, a test run. */
81
+ const LOCAL_ENVIRONMENTS: ReadonlySet<string> = new Set(['development', 'test']);
82
+
83
+ function warnUndeclared(input: RetainBootInput): void {
84
+ if (LOCAL_ENVIRONMENTS.has(input.environment) || buildAssetsOf(input).length === 0) return;
85
+ const warning = new AssetRetainUndeclaredError({
86
+ environment: input.environment,
87
+ disks: input.storage.diskNames,
88
+ });
89
+ (input.log ?? logger).warn(warning.format(), { code: warning.code, ...warning.meta });
90
+ }
91
+
63
92
  export interface RetainBootInput extends BuiltSurface {
64
93
  readonly config: AppConfig | undefined;
65
94
  /** The disks the app's routes read (`servedStorage`) — `retain.disk` must be one of them. */
@@ -79,15 +108,20 @@ export interface RetainedBoot {
79
108
  }
80
109
 
81
110
  /**
82
- * `undefined` when the app declared no window. A misnamed disk refuses the boot: it is the app's
83
- * config, wrong, and every pod of the deploy would otherwise run without the window it asked for.
111
+ * `undefined` when the app declared no window — and, outside development and test, one
112
+ * `X_ASSET_RETAIN_UNDECLARED` warning naming the edit (`warnUndeclared`). A misnamed disk refuses
113
+ * the boot: it is the app's config, wrong, and every pod of the deploy would otherwise run without
114
+ * the window it asked for.
84
115
  * A disk that refuses a write does NOT: `publishBuildAssets` logs it and the pod serves, reading
85
116
  * earlier builds' files all the same. The scope is `config.name` and the environment, so staging
86
117
  * and production on one bucket never sweep or serve each other.
87
118
  */
88
119
  export async function retainBuildAssets(input: RetainBootInput): Promise<RetainedBoot | undefined> {
89
120
  const retain = retainOf(input.config);
90
- if (input.config === undefined || retain === undefined) return undefined;
121
+ if (input.config === undefined || retain === undefined) {
122
+ warnUndeclared(input);
123
+ return undefined;
124
+ }
91
125
  const names = input.storage.diskNames;
92
126
  if (!names.includes(retain.disk)) {
93
127
  throw new ConfigInvalidError({
@@ -104,7 +104,7 @@ from the values `x deploy --method helm` passes it; on Compose, `stop_grace_peri
104
104
  | `web` | let in-flight requests and streaming responses finish; a stream past the deadline gets a typed truncation, not a socket reset |
105
105
  | `sync` | send every client a `reconnect` frame **with a per-client backoff delay** (see below), then close cleanly |
106
106
  | `worker` | stop claiming at step 2 and **cancel nothing**: every held job keeps running, and one that finishes inside the budget is acked. At the cut-off — the worker's budget (`drain.workerDeadlineMs` when declared, else `drain.deadlineMs`) less a margin (2 s, or half of a budget under 4 s) — a job still running has its `ctx.signal` aborted with `X_DRAINING`; a step that completes after that is still recorded. Half a margin later every claim still held is handed back uncounted (`countsAsAttempt: false`), so the replacement worker claims it at once — not after the visibility timeout — and replays every completed step instead of re-running it. A worker started after the signal (a boot still in progress) claims nothing |
107
- | `scheduler` | delete the lease row immediately so the standby promotes on its next round rather than waiting out the 30s TTL |
107
+ | `scheduler` | delete the lease row immediately so the standby promotes on its next ask (every 20s) rather than waiting out the 60s TTL |
108
108
  | `replicator` | flush the change feed to NATS up to the last confirmed LSN, then release the slot |
109
109
 
110
110
  A hook or request still running at `drain.deadlineMs` (the worker's: `drain.workerDeadlineMs` when declared) is **abandoned** — logged as `X_SHUTDOWN_TIMEOUT` naming it, never thrown, and the process exits clean; requests arriving during the drain get `X_DRAINING`.
@@ -527,7 +527,9 @@ The refusal is the ROLLED-BACK image's code, so it protects from the release aft
527
527
 
528
528
  ### Hashed assets across a deploy — `assets.retain`
529
529
 
530
- A web process serves only the hashed files it built: `/styles/<hash>.css`, `/islands/<island>-<hash>.js`, `/_x/assets/<script>/<hash>.js`, `/assets/<name>.<hash>.<ext>`. With no window, an open tab holding the previous build's document gets a 404 for its stylesheet, or for its island chunk on the first click, after every deploy, one replica or many. During a rolling update both directions fail: a new document that reaches an old pod also gets no stylesheet. Declare a window over a disk every web pod can read:
530
+ A web process serves only the hashed files it built: `/styles/<hash>.css`, `/islands/<island>-<hash>.js`, `/_x/assets/<script>/<hash>.js`, `/assets/<name>.<hash>.<ext>`. With no window, an open tab holding the previous build's document gets a 404 for its stylesheet, or for its island chunk on the first click, after every deploy, one replica or many. During a rolling update with more than one web replica both directions fail on every page load, not only in old tabs: the document and its stylesheet are two requests, the load balancer may send them to pods of different builds, and the page renders with no CSS at all (the AppShell's "Skip to content" link as its first line).
531
+
532
+ Without a window the framework only limits the damage (`As of 2026-11-12`): a soft navigation whose next sheet fails becomes a full load and never retires the working sheet. A full load whose sheet 404s stays unstyled: nothing reloads it for you. A web role booted outside `development` and `test` with no window logs `X_ASSET_RETAIN_UNDECLARED`. The window is the fix. Declare it over a disk every web pod can read:
531
533
 
532
534
  ```ts
533
535
  // app.config.ts — `deploys` is a disk from the app's defineStorage({ disks })
@@ -333,8 +333,8 @@ Every operator capability is a member of `JobIntrospection` (`driver.introspect`
333
333
  | task pause | `pauseTask(t)` / `resumeTask(t)` / `pausedTasks()` | on resume the task's own `catchUp` decides what it missed |
334
334
  | a task's last fire | `taskFires()` — `{ task, occurrenceMs, firedAt }` per task, by name | the last occurrence that QUEUED its jobs: arming a task or skipping missed occurrences is not a fire. `MAX_TASK_FIRES` 1,000 rows |
335
335
  | a task's next fire | `nextTaskRun(task, from)` — the next occurrence strictly after `from`, in the task's own zone | the scheduler's own resolver, so a dashboard and the scheduler cannot disagree; no running scheduler needed |
336
- | who is working | `workers()` — id, host, started, queues, slots, in-flight job ids, last heartbeat | a row expires one visibility timeout after its last heartbeat: a killed worker leaves by expiry |
337
- | history | `counters({ job, sinceMs })`, `counterTotals(sinceMs)` — `done`, `retried`, `failed`, `dead`, `durationMs` | `COUNTER_TIERS`: 1-minute buckets for 24 h, 5-minute for 7 d, 1-hour for 30 d |
336
+ | who is working | `workers()` — id, host, started, queues, slots, in-flight job ids, last heartbeat | a row expires `max(60 s, visibility timeout)` after its last renewal, renewed every third of that (20 s); a killed worker leaves by expiry, so it stays listed up to 60 s. As of 2026-11-12 |
337
+ | history | `counters({ job, sinceMs })`, `counterTotals(sinceMs)` — `done`, `retried`, `failed`, `dead`, `durationMs` | `COUNTER_TIERS`: 1-minute buckets for 24 h, 5-minute for 7 d, 1-hour for 30 d. On Postgres a process batches its settles' counts and writes them every 10 s and on `close()`: a read from the same process flushes first, one from another process can lag up to 10 s, and a crash loses at most 10 s of counts — never a job row's state |
338
338
  | progress | `run({ progress })` → `progress(done, total, note?)`, on the row and in `x jobs show` | one write a second per run at most, and always the last before the run settles |
339
339
  | how a run ended | `job({ onSettled })` — `completed` (with what `run` returned), `dead-lettered`, `dropped` or `refused`; after the row is settled, under the job's tenant, three tries of its own, on a live `ctx.signal` under `onSettledTimeout` (30 s by default): its `fetch` and its writes land | at most once across a crash; a hook that keeps failing is `X_JOB_ON_SETTLED_FAILED`, logged and reported, and the row is untouched. A cancel is not a settlement: whoever cancels is the observer |
340
340
 
@@ -386,11 +386,11 @@ export const syncAccount = job({
386
386
 
387
387
  | Loop | Idle behaviour | Claims per idle minute |
388
388
  |---|---|---|
389
- | worker | waits `pollIntervalMs` (250 ms) while passes find work, doubling to `idlePollMaxMs` while they do not; an idle pass is one claim over every queue it serves | 12 with the wake, 30 without |
390
- | outbox relay | `intervalMs` (200 ms) doubling to `idlePollMaxMs` | 12 with the wake, 30 without |
391
- | scheduler | ticks every second and, with nothing due, reads no store: watermarks are held in memory while it leads and the lease is renewed every 10 s | 6 statements, for any number of tasks |
389
+ | worker | waits `pollIntervalMs` (250 ms) while passes find work; idle with the wake proven, it rests until the next row is due (an empty claim says when), at most 60 s; without the wake, doubling to `idlePollMaxMs`. An idle pass is one claim over every queue it serves | ≤ 1 with the wake (was 12), 30 without |
390
+ | outbox relay | `intervalMs` (200 ms); idle with the wake, rests until a held row's lease lapses, at most 60 s; without, doubling to `idlePollMaxMs` | ≤ 1 with the wake (was 12), 30 without |
391
+ | scheduler | ticks every second and, with nothing due, reads no store: watermarks are held in memory while it leads and the 60 s lease is renewed every 20 s | 3 statements, for any number of tasks (was 6) |
392
392
 
393
- `idlePollMaxMs` defaults to 2 s, and to 5 s while the wake is proven.
393
+ `idlePollMaxMs` defaults to 2 s, and to 5 s while the wake is proven; declared, it caps the rest too. A wake session lost mid-rest falls back to the 2 s poll within one 2 s slice. `As of 2026-11-12`.
394
394
 
395
395
  **The wake.** A `worker` pod holds one `LISTEN` session (`startQueueWake`, started by the boot). The enqueue statement and the outbox stage carry a `pg_notify` — transactional, so it is delivered when the row commits and never when it rolls back — and an idle worker or relay passes at once.
396
396
 
@@ -401,13 +401,13 @@ export const syncAccount = job({
401
401
  | another process, through the outbox, from its commit | 9 ms / 13 ms |
402
402
  | another process, with no wake | within `idlePollMaxMs` — 2 s |
403
403
  | a retry or `step.sleep` the worker itself handed back | when it falls due |
404
- | a delayed job another process queued | within `idlePollMaxMs` past its `runAt` |
404
+ | a delayed job another process queued | no wake: within `idlePollMaxMs` past its `runAt`. Proven wake: at its `runAt` — an enqueue due within 60 s notifies, so a resting worker re-reads when its next row is due. `As of 2026-11-12` |
405
405
 
406
406
  | Rule | Detail |
407
407
  |---|---|
408
408
  | the payload is the queue name | never an id, an input or a tenant |
409
409
  | at most one notification per queue per 250 ms | Postgres serialises every notifying commit behind one lock. A row its slot kept silent is found by the woken worker's next pass, one `pollIntervalMs` later — never worse than a fixed 250 ms poll |
410
- | the poll is the guarantee | a notification is lost with the session that would have carried it; the driver re-dials and the poll covers the gap |
410
+ | the poll is the guarantee | a notification is lost with the session that would have carried it; the driver re-dials and the poll covers the gap. With the wake proven the poll is a rest of up to 60 s, cut to the 2 s poll within one 2 s slice once the session is lost |
411
411
  | the wake has to be proven | a probe sent through the pool must come back on the session: `jobs.wake.live`. If it does not — PgBouncer in `pool_mode = transaction` delivers no notification — the log says `jobs.wake.unverified` once and the ceiling stays 2 s. Give the `worker` role a direct or session-pooled `DATABASE_URL` ([`docs/ops/04-datastores.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/ops/04-datastores.md#pooling-and-the-trap-under-it)) |
412
412
  | a queue pause | read by the claim statement itself, so it holds from each worker's next claim; a resume announces the queue |
413
413
 
@@ -45,7 +45,7 @@ CHANGELOG.md` finds its bounds, and it changes on any commit.
45
45
  | `--target binary` is a **launcher** for an app tree, and has never been served from a bare VM | `As of 2026-10-06`. It boots: `x build --target binary` compiles `apps/web/server.ts` with `--compile-autoload-package-json`, `--compile-autoload-tsconfig` and `@ultimat3/*` external (`binaryArgs`, `packages/cli/src/cmd-build.ts`), and the required `windows` CI job starts the result from a scaffold and gets `200` from `/healthz`; `packages/cli/e2e/binary-launch.e2e.test.ts` proves the same on Linux. **It is not a self-contained artifact**: at run time it reads the app's `package.json` and `tsconfig.json`, imports `app.config.ts` and every module under `apps/*`, and loads the framework from the app's `node_modules` — one instance, so the app's registrations reach the server. Unmeasured: a scaffold compiled, copied with its tree to a VM with no Bun, and served under systemd [pin](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/e2e/binary-launch.e2e.test.ts#the%20compiled%20launcher%20resolves%20its%20app%20tree%20at%20run%20time%2C%20against%20ONE%20framework%20instance) | ship the app root, its installed `node_modules` (installed for the target OS and CPU) and the binary together, and start the binary from that root. Prove it for your own app first — `./app --version`, then `ROLE=web PORT=3000 ./app` and `curl /readyz`. Prefer `--target docker`, the self-contained artifact → [Deployment](Deployment) |
46
46
  | A local `typecheck` step can report green on a tree CI fails, on the same commit — **one sighting, unreproduced** | `As of 2026-10`. Observed once (2026-09-17, TypeScript 7.0.2): after a `git stash -u` → branch switch → `x verify` on the other branch → switch back → `stash pop` sequence, a type error that surfaces in an UNCHANGED file (a widened index signature in a file it imports) passed locally and failed CI; deleting `tsconfig.tsbuildinfo` then reproduced CI's red locally. Five faithful reproduction attempts against 7.0.2 all stayed correctly red ([#450](https://github.com/developerz-ai/ultimate/issues/450)). **[#450](https://github.com/developerz-ai/ultimate/issues/450) itself is closed `As of 2026-09-23`** — read from the shipped fix, not from the tracker: plan 101 row 14 r ("Close #450", `docs/plans/2026/09/23/101-framework-deep-sweep/14-guards-gate.md:37`; plan `status.yml` `complete`), recorded in `CHANGELOG.md` under 22.0.0 and pinned by `packages/cli/src/verify-typecheck.test.ts`. `tsc -b` decides "up to date" by **mtime**, and Bun installs a dependency as **hardlinks** carrying its cache's old mtimes, so an upgrade to an already-cached version left every input older than the buildinfo and a root without `references` — every scaffolded app — skipped the program and reported green while a cold CI was red. A scaffolded app's `typecheck` is now `tsc -p .` ([`packages/cli/src/templates/scaffold-repo.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/src/templates/scaffold-repo.ts), its `"typecheck"` script), which is incremental by **content hash**, and `x verify`'s `typecheck` step picks `-p .` over `-b` for any such root ([`packages/cli/src/verify-typecheck.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/src/verify-typecheck.ts)); the framework root keeps `-b`. **Still open**: a *second* `tsc` racing the same buildinfo is the one suspect not excluded, and no cause for it has been shown. `x verify` deliberately takes two flags and no `--cold` pin: none — one sighting, and five faithful reproductions stayed red, so no test can hold it | CI is always cold and is the judge of record. If a local `typecheck` disagrees with it again, capture the command, its argv and its exit code before deleting any `tsconfig.tsbuildinfo` |
47
47
  | A `stream` page with a realtime island keeps every island on the page inert until its slowest hole closes | `As of 2026-11-02`. The runtime goes `async` so a shell island answers while a hole is open, but only with no realtime boot in the document: the boot (`script defer`) has to run first (`bootScript`, [`packages/cli/src/route-islands.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/src/route-islands.ts)), and a deferred script waits for parsing to end. Bound by the hole's 15 s deadline | keep the slow read out of such a page's holes, or give it a short deadline of its own: `fetch(url, { signal: AbortSignal.timeout(2_000) })` |
48
- | An open tab can meet a dead island across a deploy | `As of 2026-11-03`. A web process serves only the hashed files it built, so with `assets.retain` unset (the default) a tab holding the previous build's document gets a `no-store` 404 for its stylesheet, or for its island chunk on the first click, after every deploy; during a rolling update a new document that reaches an old pod gets no stylesheet either [pin](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/src/retained-assets-boot.test.ts#undeclared%3A%20nothing%20is%20published%20and%20there%20is%20no%20reader). Declared, a tab survives six deploys with build 0's island alive [evidence](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/e2e/six-deploys.e2e.test.ts#with%20assets.retain%2C%20the%20click%20boots%20build%200%E2%80%99s%20island%3A%20its%20chunk%20200%2C%20no%20404%2C%20an%20update%20offered) | declare `assets: { retain: { disk, builds } }` over a disk every web pod reads → [Deployment](Deployment#hashed-assets-across-a-deploy--assetsretain) |
48
+ | An open tab can meet a dead island across a deploy | `As of 2026-11-12`. A web process serves only the hashed files it built, so with `assets.retain` unset (the default) a tab holding the previous build's document gets a `no-store` 404 for its stylesheet, or for its island chunk on the first click, after every deploy; during a rolling update a new document that reaches an old pod gets no stylesheet either. What the framework does about the stylesheet half without a window: a soft navigation whose next sheet fails never swaps an unstyled page in (a GET becomes a full load, the old sheet stays) [pin](https://github.com/developerz-ai/ultimate/blob/main/packages/render/src/navigation-stylesheet-skew.test.ts#a%20GET%20is%20loaded%20by%20the%20browser%3B%20the%20page%20on%20screen%20keeps%20its%20sheet); a full load whose sheet 404s stays unstyled — the framework does not reload it, as a reload it cannot tell from a missing file offline or under a test harness is a navigation nobody asked for. A web role booted outside development and test with no window logs `X_ASSET_RETAIN_UNDECLARED` [pin](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/src/retained-assets-boot.test.ts#undeclared%3A%20nothing%20is%20published%20and%20there%20is%20no%20reader). Declared, a tab survives six deploys with build 0's island alive [evidence](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/e2e/six-deploys.e2e.test.ts#with%20assets.retain%2C%20the%20click%20boots%20build%200%E2%80%99s%20island%3A%20its%20chunk%20200%2C%20no%20404%2C%20an%20update%20offered) | declare `assets: { retain: { disk, builds } }` over a disk every web pod reads → [Deployment](Deployment#hashed-assets-across-a-deploy--assetsretain) |
49
49
  | A soft visit waits for the slowest hole | `As of 2026-11-02`. The client router reads `response.text()` ([`packages/render/src/navigation-fetch.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/render/src/navigation-fetch.ts)) and swaps the whole answer, so holes fill through the re-run scripts and the first paint of an in-app navigation is as late as a full `ssr` render. A full load streams. No incremental parse here [pin](https://github.com/developerz-ai/ultimate/blob/main/packages/render/src/navigation-fetch.test.ts#a%20page%3A%20its%20text%2C%20its%20build%2C%20no-store%20read%20off%20cache-control) | nothing to do in an app; a page that must paint first on a soft visit declares `navigation: 'document'` |
50
50
  | A pod evaluates the framework from **source**, one module at a time — ~28 Mi of resident memory per pod that a bundle would not hold | `As of 2026-10-01`, measured on the framework serve graph alone: 1,071 modules from source settle at **80.4 Mi**; the same graph as one `bun build --target=bun` file is 5 modules and settles at **51.8 Mi** — ~34 kB of RSS per source module, the runtime's cost and not the code's. It is the largest saving left after the per-role load and the prebuilt store (a web pod of the demo app settles at 97–102 Mi, a worker at 80–85 Mi). **Not a patch**: a registry is a module instance, so the framework bundled apart from the app is two `@ultimat3/jobs`, two `@ultimat3/entity` — the app registers into one and the boot reads the other. The unit has to be the app **and** the framework as one graph, per role, built inside the image build from a generated entry that imports what `scanAppModules` would, with the `.tsx`/`.scss` loaders as build plugins. Containers only either way (axiom 7). Design note: [`docs/architecture/13-topology-runtime.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/architecture/13-topology-runtime.md#not-built-one-bundle-per-role) pin: none — a resident-memory measurement of a running pod, not a behaviour a unit test can assert | nothing to do in an app. Size a pod's memory request from `process_resident_memory_bytes` on `/metrics`, not from a guess |
51
51
  | Every role evaluates all of `@ultimat3/jobs` — 96 modules (`As of 2026-10-02`, by file) — whatever it runs | `As of 2026-10-01`, read off the serve graph by the names each role's code uses: a `web` pod needs 43 of them (enqueue, the outbox relay, the purge task), a `scheduler` 46, a `worker` 62. The rest ride the barrel: `worker.ts` and its eighteen dependencies in a web pod, the `backfill()` / `exportJob()` / `webhook()` factories (17 modules, 123 kB of source) in an app that declares none, and the memory driver (3 modules) outside a test. ~1.6 Mi per web pod at the measured 34 kB a module. Closing it means subpath entries (`@ultimat3/jobs/worker`, one per factory) and every importer rewritten — a breaking move for a saving the per-role bundle above makes moot, so it waits on that decision. The operator surface is **not** in this list: `JobIntrospection` is a member of the driver, and the worker announces itself and counts settles through it pin: none — a module count read off a role's serve graph, measured rather than asserted | nothing to do in an app |
@@ -96,9 +96,9 @@ Fixed **1**. Cron dispatch only.
96
96
  | Property | Behavior |
97
97
  |---|---|
98
98
  | Leader election | an **expiring lease row** in `x_scheduler_leader` (`postgresLeaseLeader`), never `pg_try_advisory_lock` — that grant belongs to the **session**, not to the process: it outlives every transaction, survives or dies by the pool's reset policy on release, and either way no node can renew it or prove it still holds one. A stranded lock nobody can release and a lock silently dropped mid-round are both wrong for election. Whoever holds an unexpired row dispatches |
99
- | Renewal | `acquire()` **is** the renewal, asked every round — tick 1s, lease TTL `DEFAULT_LEADER_TTL_MS` = 30s. A node that stops renewing loses the lease by expiry, with nothing to clean up |
100
- | Second instance | a warm standby, not a duplicate. It calls `acquire()` every round like the leader does; while another node holds an unexpired row it acquires nothing and dispatches nothing, and the round after that row expires it takes the row and becomes the leader |
101
- | Leadership lost | logged once as `jobs.scheduler.leadership-lost`; the node keeps polling and takes over on the first round after the holder's lease expires. **The process does not exit**, and neither does a `replicator` container that loses its lock: it stands by unready and re-asks. Only `x dev --role replicator` refuses (`X_REPLICATOR_SLOT_HELD`) |
99
+ | Renewal | `acquire()` **is** the renewal, sent every `ttlMs / 3` (20s) — tick 1s, lease TTL `DEFAULT_LEADER_TTL_MS` = 60s. A node that stops renewing loses the lease by expiry, with nothing to clean up: a killed leader's standby takes over up to ~80s later (the 60s lease, then its next ask), a drained one's within 20s (the drain deletes the row; the standby's next ask takes it). As of 2026-11-12 |
100
+ | Second instance | a warm standby, not a duplicate. It calls `acquire()` every `renewEveryMs` (20s), the cadence the leader renews on, not every round; while another node holds an unexpired row it acquires nothing and dispatches nothing, and its first ask after that row expires takes the row and makes it the leader |
101
+ | Leadership lost | logged once as `jobs.scheduler.leadership-lost`; the node keeps polling and takes over on its first ask (every 20s) after the holder's lease expires. **The process does not exit**, and neither does a `replicator` container that loses its lock: it stands by unready and re-asks. Only `x dev --role replicator` refuses (`X_REPLICATOR_SLOT_HELD`) |
102
102
  | `/readyz` on the standby | there is none. `ROLE=scheduler` binds the metrics port only (`/metrics`, `METRICS_PORT`, default 9090) and no HTTP server, so liveness is that endpoint — the probe [`docs/ops/01-kubernetes.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/ops/01-kubernetes.md) declares. Nothing routes request traffic to a scheduler in the first place |
103
103
  | Missed tick (leader down, node paused, clock jump) | **fires late rather than being skipped** |
104
104
  | Double fire during handover | absorbed by the enqueued job's `idempotencyKey` — the second enqueue returns the existing handle, no new row |
package/wiki/Testing.md CHANGED
@@ -944,7 +944,7 @@ describe(testName('unit', 'publishPost'), () => {
944
944
 
945
945
  `behavesLike` wraps the body in `describe('behaves like <name>')`, so a failure reads `publishPost > behaves like an authenticated action > denies an anonymous actor` — the subject and the contract both named. Because it calls `describe`, it belongs at declaration scope and never inside a test body. The body runs once per `behavesLike` call.
946
946
 
947
- Every adapter port's contract ships as shared examples on `@ultimat3/testing/conformance` — never `.` (31.0.0, Upgrading #46), one suite per `ADAPTER_PORTS` row, named as its `conformance` field: `behavesLike(jobDriverConformance, () => myDriver)` holds a custom `JobDriver` to claim / ack / nack, the claim fence, lease expiry and the burial of a row whose lease lapsed on its final attempt (`onExhausted`, `dropExhausted`); `behavesLike(budgetStoreConformance, () => myStore)` races 24 concurrent `take`s on one key against an `@ultimat3/ai` `BudgetStore`. Every suite and its subject: [the README's table](https://github.com/developerz-ai/ultimate/blob/main/packages/testing/README.md#conformance-a-ports-contract); per port, with the reference to copy: [Adapters](Adapters).
947
+ Every adapter port's contract ships as shared examples on `@ultimat3/testing/conformance` — never `.` (31.0.0, Upgrading #46), one suite per `ADAPTER_PORTS` row, named as its `conformance` field: `behavesLike(jobDriverConformance, () => myDriver)` holds a custom `JobDriver` to claim / ack / nack, the claim fence, lease expiry, the burial of a row whose lease lapsed on its final attempt (`onExhausted`, `dropExhausted`), an empty claim's `onEmpty` due time and the steps a claimed row carries (from 31.13.0); `behavesLike(budgetStoreConformance, () => myStore)` races 24 concurrent `take`s on one key against an `@ultimat3/ai` `BudgetStore`. Every suite and its subject: [the README's table](https://github.com/developerz-ai/ultimate/blob/main/packages/testing/README.md#conformance-a-ports-contract); per port, with the reference to copy: [Adapters](Adapters).
948
948
 
949
949
  ## Generated scaffolds
950
950
 
package/wiki/Upgrading.md CHANGED
@@ -244,6 +244,13 @@ A setter still on a package's `.` barrel is `X_ADAPTER_PORT_INCOMPLETE` on the `
244
244
  | `x verify`'s `manifest` step lists `X_NATIVE_FORM_UNANSWERED` under `warnings` for each `page.tsx` `<form method="post">` posting to an action with no `native` (**31.11.0**). The step stays green; a refusal is planned for `next` | add `native: { success: (output) => '/where-it-lands' }` to that action's declaration, then `x verify --only manifest` |
245
245
  | an action that declares `native` answers a refusal with a 4xx other than `X_UNAUTHENTICATED` to a browser form POST as a `303` (**31.11.0**). `X_UNAUTHENTICATED` keeps the sign-in redirect, so a protected form posted signed-out lands on sign-in as before; a sign-in action's own 401 (a wrong password) is a refusal and lands back on its form with its code. Without `native` nothing changes | nothing. A sign-in page that showed its failure some other way reads `useActionAnswer('<action>')` in its route's `load`: `outcome: 'refusal'` and the `code` the sign-in threw. Any 401 a sign-in throws must use its own code, never `X_UNAUTHENTICATED`, or it takes the sign-in redirect |
246
246
  | an action that answers a browser form by sniffing `accept` itself (**31.11.0**, optional) | delete the hand-written `if (accept includes 'text/html') setRedirect(next)` from `handle` and declare `native: { success: (output) => output.next }` on the action. A `setRedirect()` still in `handle` keeps winning on success, so a sign-in's per-request `next` can stay where it is |
247
+ | the first boot on **31.13.0** drops `x_jobs_finished_idx`, builds `x_jobs_ended_idx` and sets `x_jobs` to `fillfactor = 80`, inside the locked framework-schema apply. The index build is not `concurrently` (the apply is one transaction): enqueues, claims and settles wait for one build over `x_jobs`, bounded by the migrate `lock_timeout`. Existing pages reach the fillfactor as rows churn; nothing is rewritten. An app that commits the framework schema dump (`packages/db/schema/framework/`) sees `X_SCHEMA_DUMP_DRIFT` on `x_jobs` until it regenerates it | on a large `x_jobs`, roll the `migrate` job at a quiet hour. Then `x db gen` once and commit the regenerated `04_tables/x_jobs.sql` (`with (fillfactor=80)`) and `05_indexes/x_jobs.sql` (`x_jobs_ended_idx`); no migration |
248
+ | a killed scheduler leader's standby takes over up to ~80 s later (**31.13.0**: the 60 s lease, then its next ask, every 20 s; was ~40 s), and a drained leader's within 20 s (was 10 s) | nothing: the boot's leader takes no TTL from `app.config.ts` (`postgresLeaseLeader({ executor })`, `packages/cli/src/role-start.ts`). A scheduler you start yourself can pass `postgresLeaseLeader({ executor, ttlMs })` |
249
+ | a killed worker stays in `workers()`, `x jobs`, `/admin/jobs/workers` and `x deploy verify`'s queue grade for up to 60 s (**31.13.0**: the registry row lives `max(60 s, visibility timeout)`, renewed every 20 s; was one visibility timeout, 30 s by default) | nothing. A deploy check that counts live workers right after killing one waits 60 s |
250
+ | `counters()` / `counterTotals()` read from another process than the one that settled can lag up to 10 s (**31.13.0**: the Postgres driver writes settle counts in a per-process batch every 10 s and on `close()`); a crashed process loses at most its last 10 s of counts. A read in the settling process flushes first. Job rows and `stats()` are exact as before | nothing. A test that settles in one process and reads counters in another calls `close()` on the settling driver first |
251
+ | an on-time `jobs.scheduler.dispatched` logs at `debug` (**31.13.0**); a catch-up fire and `jobs.scheduler.already-fired` stay `info` | an alert or dashboard keyed on `jobs.scheduler.dispatched` at `info` keys on `catchUp: true` for missed fires, or sets `LOG_LEVEL=debug` on the `scheduler` role to keep every line |
252
+ | with a proven wake, an idle worker rests up to 60 s between claims (**31.13.0**; was ≤ 5 s). An enqueue due within 60 s now notifies (was within 1 s), so a delayed job another process queues still starts at its `runAt`; a worker that stops holding a retry or `step.sleep` due soon announces it (`JobDriver.wake`). Only a driver with `wake` rests — Redis keeps the 5 s poll | nothing for the shipped drivers. A custom `JobDriver` whose enqueues reach every worker adds `wake(queue?)` to let its workers rest; without it they keep the 2–5 s poll |
253
+ | a custom `JobDriver` or `OutboxStore` proved with `behavesLike(jobDriverConformance, …)` / `behavesLike(outboxStoreConformance, …)` (`@ultimat3/testing/conformance`) meets new checks (**31.13.0**): an empty claim calls `ClaimOptions.onEmpty(dueInMs)` (`null`, a delayed row, a held lease), a claimed row carries `steps`, and an empty outbox `claim(limit, { onEmpty })` reports a held row's lease | implement them — `memoryJobDriver` and `memoryOutboxStore` are the shapes to copy — or keep the driver unproved: each is optional on the interface, and a driver without them keeps the 2–5 s poll and the per-attempt step list |
247
254
 
248
255
  ## 29.x → 30.0.0, entry by entry
249
256