@ultimat3/cli 31.22.3 → 31.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CLAUDE.md CHANGED
@@ -141,7 +141,7 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
141
141
  | `runtime-render*.ts` / `runtime-{isr-outcome,assets,storage,hooks}.ts` / `route-islands.ts` / `api-routes.ts` | the HTTP surface both boots mount † |
142
142
  | `asset-route-meta.ts` | the ONE writer of an asset route's `tags: ['assets']` + `rateLimit: 'assets'`; the test walks `examples/dummy`'s built table and refuses an `assets.*` route on `default` |
143
143
  | `client-{errors,vitals}-*.ts` | `clientErrors` (and `.vitals`): the script on `app/` (vitals: listed) documents, its `POST` route, mounted by BOTH boots ‡ |
144
- | `retained-assets.ts` / `-layout.ts` / `-sweep.ts` / `-read.ts` / `-boot.ts` | `assets.retain`: the web boot publishes this build's hashed files before `/readyz` † |
144
+ | `retained-assets.ts` / `-layout.ts` / `-sweep.ts` / `-read.ts` / `-boot.ts` / `-warned.ts` | `assets.retain`: the web boot publishes this build's hashed files before `/readyz` † |
145
145
  | `runtime-overrides.ts` / `runtime-ports.ts` / `runtime-port-bindings.ts` | `runtime.ts`: a field per `ADAPTER_PORTS` row, installed by ONE loop or read where used; unbound row = build error. Plus `routes`. `docs/history/cli-adapter-ports.md` |
146
146
  | `plain-routes.ts` | the plain routes both boots mount and `x routes` lists: `runtime.routes`, then every declared `webhookReceiver()`'s, each once |
147
147
  | `app-openapi.ts` | `openapi.json` (complete when `defineApi({ openapi })` is declared) and each bearer mount's own document; staleness for all of them |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/cli",
3
- "version": "31.22.3",
3
+ "version": "31.23.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.22.3",
57
- "@ultimat3/admin": "31.22.3",
58
- "@ultimat3/ai": "31.22.3",
59
- "@ultimat3/auth": "31.22.3",
60
- "@ultimat3/cache": "31.22.3",
61
- "@ultimat3/core": "31.22.3",
62
- "@ultimat3/db": "31.22.3",
63
- "@ultimat3/entity": "31.22.3",
64
- "@ultimat3/flags": "31.22.3",
65
- "@ultimat3/http": "31.22.3",
66
- "@ultimat3/i18n": "31.22.3",
67
- "@ultimat3/jobs": "31.22.3",
68
- "@ultimat3/mail": "31.22.3",
69
- "@ultimat3/manifest": "31.22.3",
70
- "@ultimat3/mcp": "31.22.3",
71
- "@ultimat3/money": "31.22.3",
72
- "@ultimat3/notify": "31.22.3",
73
- "@ultimat3/policy": "31.22.3",
74
- "@ultimat3/pwa": "31.22.3",
75
- "@ultimat3/query": "31.22.3",
76
- "@ultimat3/realtime": "31.22.3",
77
- "@ultimat3/render": "31.22.3",
78
- "@ultimat3/schema": "31.22.3",
79
- "@ultimat3/scraping": "31.22.3",
80
- "@ultimat3/seo": "31.22.3",
81
- "@ultimat3/storage": "31.22.3",
82
- "@ultimat3/testing": "31.22.3",
83
- "@ultimat3/time": "31.22.3",
56
+ "@ultimat3/action": "31.23.0",
57
+ "@ultimat3/admin": "31.23.0",
58
+ "@ultimat3/ai": "31.23.0",
59
+ "@ultimat3/auth": "31.23.0",
60
+ "@ultimat3/cache": "31.23.0",
61
+ "@ultimat3/core": "31.23.0",
62
+ "@ultimat3/db": "31.23.0",
63
+ "@ultimat3/entity": "31.23.0",
64
+ "@ultimat3/flags": "31.23.0",
65
+ "@ultimat3/http": "31.23.0",
66
+ "@ultimat3/i18n": "31.23.0",
67
+ "@ultimat3/jobs": "31.23.0",
68
+ "@ultimat3/mail": "31.23.0",
69
+ "@ultimat3/manifest": "31.23.0",
70
+ "@ultimat3/mcp": "31.23.0",
71
+ "@ultimat3/money": "31.23.0",
72
+ "@ultimat3/notify": "31.23.0",
73
+ "@ultimat3/policy": "31.23.0",
74
+ "@ultimat3/pwa": "31.23.0",
75
+ "@ultimat3/query": "31.23.0",
76
+ "@ultimat3/realtime": "31.23.0",
77
+ "@ultimat3/render": "31.23.0",
78
+ "@ultimat3/schema": "31.23.0",
79
+ "@ultimat3/scraping": "31.23.0",
80
+ "@ultimat3/seo": "31.23.0",
81
+ "@ultimat3/storage": "31.23.0",
82
+ "@ultimat3/testing": "31.23.0",
83
+ "@ultimat3/time": "31.23.0",
84
84
  "babel-preset-solid": "^1.9.16"
85
85
  }
86
86
  }
@@ -11,6 +11,7 @@ import { publishBuildAssets } from './retained-assets';
11
11
  import { retainedPrefix } from './retained-assets-layout';
12
12
  import type { RetainedAssets } from './retained-assets-read';
13
13
  import { retainedAssets } from './retained-assets-read';
14
+ import { warnOncePerBuild } from './retained-assets-warned';
14
15
  import { siteAssetTable } from './site-assets';
15
16
  import type { StyleBundle } from './style-bundle';
16
17
  import type { FrameworkScript } from './worker-bundle';
@@ -80,13 +81,32 @@ export class AssetRetainUndeclaredError extends UltimateError {
80
81
  /** Where a boot has no rolling deploy to survive: a laptop, a test run. */
81
82
  const LOCAL_ENVIRONMENTS: ReadonlySet<string> = new Set(['development', 'test']);
82
83
 
83
- function warnUndeclared(input: RetainBootInput): void {
84
+ /** This file is the web role's boot alone (`serve-web.ts`): the role half of the warned key. */
85
+ const WEB_ROLE = 'web';
86
+
87
+ /**
88
+ * Once per build id for the web role, not per boot: the marker sits on the app's default disk,
89
+ * the one place every pod of a deploy may share (`warnOncePerBuild`). With no `app.config.ts`
90
+ * there is no app name to scope it by, so that boot says it every time.
91
+ */
92
+ async function warnUndeclared(input: RetainBootInput): Promise<void> {
84
93
  if (LOCAL_ENVIRONMENTS.has(input.environment) || buildAssetsOf(input).length === 0) return;
85
94
  const warning = new AssetRetainUndeclaredError({
86
95
  environment: input.environment,
87
96
  disks: input.storage.diskNames,
88
97
  });
89
- (input.log ?? logger).warn(warning.format(), { code: warning.code, ...warning.meta });
98
+ const warn = (): void =>
99
+ (input.log ?? logger).warn(warning.format(), { code: warning.code, ...warning.meta });
100
+ if (input.config === undefined) return warn();
101
+ await warnOncePerBuild(
102
+ {
103
+ disk: () => input.storage.disk(),
104
+ prefix: retainedPrefix(input.config.name, input.environment),
105
+ role: WEB_ROLE,
106
+ buildId: input.buildId,
107
+ },
108
+ warn,
109
+ );
90
110
  }
91
111
 
92
112
  export interface RetainBootInput extends BuiltSurface {
@@ -109,7 +129,7 @@ export interface RetainedBoot {
109
129
 
110
130
  /**
111
131
  * `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
132
+ * `X_ASSET_RETAIN_UNDECLARED` warning per build naming the edit (`warnUndeclared`). A misnamed disk refuses
113
133
  * the boot: it is the app's config, wrong, and every pod of the deploy would otherwise run without
114
134
  * the window it asked for.
115
135
  * A disk that refuses a write does NOT: `publishBuildAssets` logs it and the pod serves, reading
@@ -119,7 +139,7 @@ export interface RetainedBoot {
119
139
  export async function retainBuildAssets(input: RetainBootInput): Promise<RetainedBoot | undefined> {
120
140
  const retain = retainOf(input.config);
121
141
  if (input.config === undefined || retain === undefined) {
122
- warnUndeclared(input);
142
+ await warnUndeclared(input);
123
143
  return undefined;
124
144
  }
125
145
  const names = input.storage.diskNames;
@@ -0,0 +1,76 @@
1
+ // A boot warning said once per build id per role, not once per boot: a zero-byte marker on the
2
+ // disk the role's pods share remembers that some process of this build already said it. Fail
3
+ // open — a disk that refuses or stalls costs a duplicate line, never a lost one or a held boot.
4
+
5
+ import { finiteCount } from '@ultimat3/core';
6
+ import type { StorageDriver } from '@ultimat3/storage';
7
+
8
+ /** How long the marker may hold a boot: a warning never delays readiness past this. */
9
+ export const WARNED_MARKER_DEADLINE_MS = 2_000;
10
+ /** Markers kept per role, newest first: a rolling deploy's old build restarting stays quiet. */
11
+ export const WARNED_BUILDS_KEPT = 3;
12
+
13
+ export interface WarnOnceInput {
14
+ /** Resolved inside the fail-open guard: a storage that cannot name its disk still warns. */
15
+ readonly disk: () => StorageDriver;
16
+ /** The app-and-environment scope (`retainedPrefix`), so staging never silences production. */
17
+ readonly prefix: string;
18
+ readonly role: string;
19
+ readonly buildId: string;
20
+ /** Test seam; `WARNED_MARKER_DEADLINE_MS` otherwise. */
21
+ readonly deadlineMs?: number | undefined;
22
+ }
23
+
24
+ /** `<prefix>/warned/<role>/` — beside the retained files, outside `org/`, so never served. */
25
+ export const warnedPrefix = (prefix: string, role: string): string =>
26
+ `${prefix}/warned/${encodeURIComponent(role)}/`;
27
+
28
+ const markerKey = (input: WarnOnceInput): string =>
29
+ `${warnedPrefix(input.prefix, input.role)}${encodeURIComponent(input.buildId)}`;
30
+
31
+ async function prune(input: WarnOnceInput, disk: StorageDriver): Promise<void> {
32
+ const own = markerKey(input);
33
+ const page = await disk.list({ prefix: warnedPrefix(input.prefix, input.role) });
34
+ // This build's marker is kept whatever the clock says (a disk's timestamps can tie); the rest
35
+ // newest first. One with no `lastModified` has no age to rank by: spared, never guessed old.
36
+ const others = page.rows.filter((row) => row.key !== own && row.lastModified !== undefined);
37
+ const stale = others
38
+ .sort((a, b) => (b.lastModified?.getTime() ?? 0) - (a.lastModified?.getTime() ?? 0))
39
+ .slice(WARNED_BUILDS_KEPT - 1);
40
+ for (const row of stale) await disk.delete(row.key);
41
+ }
42
+
43
+ /** `true` when this process should say it: no marker, or the disk could not answer. */
44
+ async function claim(input: WarnOnceInput): Promise<boolean> {
45
+ // `async`, so a synchronous throw from `disk()` is a rejection the caller's guard catches.
46
+ const key = markerKey(input);
47
+ const disk = input.disk();
48
+ if (await disk.exists(key)) return false;
49
+ await disk.put(key, new Uint8Array(0), { contentType: 'application/octet-stream' });
50
+ await prune(input, disk);
51
+ return true;
52
+ }
53
+
54
+ /**
55
+ * Calls `warn` unless a process of this build and role already did. Two pods booting in the same
56
+ * instant may both say it — no shipped driver offers a create-if-absent put — which is the bound:
57
+ * once per build per simultaneous boot, never once per boot.
58
+ */
59
+ export async function warnOncePerBuild(input: WarnOnceInput, warn: () => void): Promise<void> {
60
+ // Checked up front (`X_INVARIANT`): `setTimeout` fires a `NaN` at once, as `publishBuildAssets`.
61
+ const ms = finiteCount(
62
+ 'warnOncePerBuild',
63
+ 'deadlineMs',
64
+ input.deadlineMs ?? WARNED_MARKER_DEADLINE_MS,
65
+ 1,
66
+ );
67
+ let timer: ReturnType<typeof setTimeout> | undefined;
68
+ const deadline = new Promise<'deadline'>((resolve) => {
69
+ timer = setTimeout(() => resolve('deadline'), ms);
70
+ });
71
+ // The marker is memory, not correctness: any failure of the disk says the warning instead.
72
+ const said = await Promise.race([claim(input).catch(() => true), deadline]).finally(() =>
73
+ clearTimeout(timer),
74
+ );
75
+ if (said !== false) warn();
76
+ }
package/wiki/Actions.md CHANGED
@@ -165,6 +165,7 @@ export const load = async (): Promise<{ readonly answer: ActionAnswer | null }>
165
165
  | `useActionAnswer(createPost)` answers only that action's outcome — or by name, `useActionAnswer('createPost' satisfies keyof Api['actions'])`, from a page that may not import the action; `useActionAnswer()` any | two forms on one page |
166
166
  | a cookie that is not one this package wrote reads as `null` | it arrives from the browser: parsed, bounded, never trusted |
167
167
  | `static` / `isr` pages read `null` | a shared document is rendered as nobody, with no inbound cookie |
168
+ | outside a request (the `llms.txt` build runs `load` with none) reads `null`, never `X_NO_REQUEST` | no request, no answer |
168
169
  | translate on `code` and `issues[].rule` with `t()` | the flash carries no prose, so no locale |
169
170
  | field values are not carried back | a password or a card number does not belong in a cookie; the form re-renders empty, or the page keeps a draft |
170
171
 
@@ -246,6 +246,7 @@ export const syncCrm = job({
246
246
  | a **`terminal`** thrown code | stops on the attempt that failed, before `attempts` is reached — the same code run again is the same answer, and the attempts left are a queue slot, a provider bill, or three more wrong passwords at a site that locks the account after three. `lastError` records `— not retried: this code is classified terminal`, so an early stop is never silent | the code's `retry` classification, `registerErrorRetry({ X_YOUR_CODE: 'terminal' })`. An **unclassified** code is unaffected |
247
247
  | a **`retry-after`** thrown code | the responder's `meta.retryAfterSeconds` replaces the delay, clamped by `maxDelay` — never the attempt count | same |
248
248
  | attempts exhausted | moves to dead-letter with the full step trace | `x jobs retry <id>` replays from the failed step |
249
+ | `retry.report` | what reaches the error tracker. `'dead-letter'` (default): only an attempt nobody recovered from, once, as `error`; a retry is counted on `jobs_retried_total{job,code}` and never pages. `'every-attempt'`: each retried attempt is reported too, as `warning` — for the job whose first failure already needs a human. Per job, never a global switch (`As of 2026-11-14`) | `executeJob` (`execute-report.ts`) |
249
250
 
250
251
  A job over a tenant, queue or global cap, or over a `'wait'` concurrency cap, is **deferred, never dropped** — it stays queued with a later `runAt`. `whenBusy: 'fail'` is the one declared exception. `'wait'` holds the cap and states no order: a later enqueue can start first.
251
252
 
@@ -873,7 +874,8 @@ Draining a worker mid-job does **not** finish the current step (`As of 2026-09-0
873
874
  | `x db backfill --list --json` | the whole ledger: one row per pass, newest first → [CLI reference](CLI-Reference#x-db) |
874
875
  | MCP dev tools | `jobs.inspect` (definitions, retry policy, steps) and `queue.depth` (pending/running/failed per queue) — scope `dev:read`, never reachable in `ROLE=web` |
875
876
  | OpenTelemetry | one span per job, one child span per step, trace linked to the enqueuing request |
876
- | Metrics | `queue_depth{queue}`, `queue_demand{queue}` (what the worker HPA reads), `jobs_total{queue,outcome}`, `job_leases_lost_total{queue}` → [Observability](Observability) |
877
+ | Metrics | `queue_depth{queue}`, `queue_demand{queue}` (what the worker HPA reads), `jobs_total{queue,outcome}`, `jobs_retried_total{job,code}` (one per retried attempt; `code` is the thrown `X_*`, or `uncoded`), `job_leases_lost_total{queue}` → [Observability](Observability) |
878
+ | Loop failures | a database restart fails every tick: one line opens the streak, one closes it with the count — `jobs.scheduler.tick-failed` / `-recovered`, `jobs.worker.tick-failed` / `-recovered`, `jobs.outbox.tick-failed` / `-recovered` |
877
879
 
878
880
  Every command supports `--json`. See [CLI reference](CLI-Reference).
879
881
 
@@ -209,7 +209,9 @@ Declared in `runtime-metrics.ts`, so the role table, the Helm chart and the scra
209
209
 
210
210
  Recorders: `recordRequest({ method, route, status, durationMs })`, `recordConnection(delta)`, `recordQueueDepth(queue, depth)`, `recordJob(queue, outcome)`, `recordLeaseLost(queue)`.
211
211
 
212
- All five are wired `As of 2026-08`, each in the package that owns the event:
212
+ Beside them, `@ultimat3/jobs` declares its own: `jobs_retried_total{job,code}` (counter, `{attempt}`) — one per attempt that failed and went back to the queue, `code` the thrown `X_*` or `uncoded`. A retry is counted there and **not** sent to the `ErrorReporter`; a dead letter is, once, as `error`. A job opts its retries into the reporter, as `warning`, with `retry: { report: 'every-attempt' }` ([Jobs](Jobs-And-Workflows#concurrency-rate-limits-queues-retry)). A polling loop that fails every tick logs one line when the streak opens and one with the count when it closes: `jobs.{scheduler,worker,outbox}.tick-failed` / `.tick-recovered`, and `db.listen.redial_failed` / `db.listen.redialed`.
213
+
214
+ All five recorders are wired `As of 2026-08`, each in the package that owns the event:
213
215
 
214
216
  | Recorder | Called from | Note |
215
217
  |---|---|---|
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` is meant to re-measure the first-hour and HTTP figures weekly and on each release, as a pull request; `As of 2026-11-10` its one run measured and could not open that pull request, so the committed figures are older. 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-14` the committed figures predate its first green run. 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