@ultimat3/cli 31.2.0 → 31.4.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 +2 -2
- package/package.json +29 -29
- package/src/app-load.ts +3 -2
- package/src/cmd-doctor.ts +12 -316
- package/src/dev-boot.ts +4 -5
- package/src/dev-rebuild.ts +38 -5
- package/src/doctor-database.ts +121 -0
- package/src/doctor-port.ts +88 -0
- package/src/doctor-probe.ts +148 -0
- package/src/framework-schema.ts +4 -2
- package/src/island-build-pool.ts +35 -0
- package/src/island-bundle.ts +137 -176
- package/src/island-cache-inputs.ts +141 -0
- package/src/island-duplicates.ts +36 -0
- package/src/island-group-cache.ts +289 -0
- package/src/island-groups.ts +117 -0
- package/src/island-outputs.ts +153 -0
- package/src/island-runtime.ts +5 -0
- package/src/island-styles.ts +68 -19
- package/src/templates/scaffold-auth.ts +7 -10
- package/src/verify-e2e.ts +17 -5
- package/wiki/Client-Data.md +14 -8
- package/wiki/Configuration.md +1 -1
- package/wiki/Deployment.md +1 -1
- package/wiki/Entities-And-Migrations.md +15 -10
- package/wiki/Stability.md +6 -5
- package/wiki/Storage-And-Uploads.md +1 -1
- package/wiki/Testing.md +1 -0
- package/wiki/Upgrading.md +10 -10
package/src/island-styles.ts
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
// default loader answers the asset PATH — a string — so `styles['track']` is `undefined`, every
|
|
4
4
|
// element renders unclassed, and `Bun.build` reports `success: true` with no log.
|
|
5
5
|
|
|
6
|
+
// why: Bun ships no path API; the bundler names its inputs relative to the building process's cwd.
|
|
7
|
+
import { resolve } from 'node:path';
|
|
6
8
|
import { renderThrowable, UltimateError } from '@ultimat3/core';
|
|
7
|
-
import { loadStylesheet } from '@ultimat3/render/server';
|
|
9
|
+
import { compileStylesheet, loadStylesheet, registeredStylesheets } from '@ultimat3/render/server';
|
|
8
10
|
import type { BunPlugin } from 'bun';
|
|
9
11
|
import { IslandBuildFailedError } from './errors';
|
|
10
12
|
|
|
@@ -16,6 +18,9 @@ import { IslandBuildFailedError } from './errors';
|
|
|
16
18
|
*/
|
|
17
19
|
const STYLESHEET = /\.s?css$/;
|
|
18
20
|
|
|
21
|
+
/** Whether `path` is a stylesheet by the one spelling the loader and the bundler share. */
|
|
22
|
+
export const isStylesheet = (path: string): boolean => STYLESHEET.test(path);
|
|
23
|
+
|
|
19
24
|
/**
|
|
20
25
|
* Every stylesheet an island build has loaded in this process, absolute. `x build --target docker`
|
|
21
26
|
* writes them into the island store, so a container that serves the stored chunks registers the
|
|
@@ -26,27 +31,71 @@ const islandSheets = new Set<string>();
|
|
|
26
31
|
/** Sorted, so the store index is byte-identical for identical input. */
|
|
27
32
|
export const islandStylesheets = (): readonly string[] => [...islandSheets].sort();
|
|
28
33
|
|
|
34
|
+
/** Registers one island stylesheet: what the plugin does on a load, and a cached group's hit. */
|
|
35
|
+
export function registerIslandStylesheet(path: string, source: string): string {
|
|
36
|
+
islandSheets.add(path);
|
|
37
|
+
return loadStylesheet(path, source, 'island');
|
|
38
|
+
}
|
|
39
|
+
|
|
29
40
|
/**
|
|
30
41
|
* `loadStylesheet`, not `compileStylesheet`: compiling alone answers the class names and drops the
|
|
31
42
|
* RULES on the floor, and an island is the one importer a document's own module graph never sees.
|
|
32
43
|
* Registering here is what puts them in `stylesFor(surface)` — `buildIslands` runs before the first
|
|
33
44
|
* document is rendered, in `x dev` and in `prerenderSite` alike.
|
|
45
|
+
*
|
|
46
|
+
* One plugin per `buildIslands` call, holding each sheet's answer for that call: every group's
|
|
47
|
+
* build loads the design system's sheets again, and compiling them once per group was 6.0 s of a
|
|
48
|
+
* 19.6 s build of the 159-island bench app (one CPU profile, As of 2026-11-10). Per call and never
|
|
49
|
+
* per process, so a `x dev` rebuild compiles an edited sheet — or a partial it `@use`s — afresh.
|
|
50
|
+
*/
|
|
51
|
+
/** The plugin, and the Sass partials each sheet it loaded read — what a cache entry must rehash. */
|
|
52
|
+
export interface IslandStyles extends BunPlugin {
|
|
53
|
+
dependenciesOf(sheets: readonly string[]): readonly string[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function islandStylesPlugin(): IslandStyles {
|
|
57
|
+
const compiled = new Map<string, Promise<string>>();
|
|
58
|
+
const partials = new Map<string, readonly string[]>();
|
|
59
|
+
const load = async (path: string): Promise<string> => {
|
|
60
|
+
const source = await Bun.file(path).text();
|
|
61
|
+
try {
|
|
62
|
+
const classes = registerIslandStylesheet(path, source);
|
|
63
|
+
// A partial `@use`d by the sheet moves its class hashes and is no bundler input: read off the
|
|
64
|
+
// registry the load just wrote, compiled again only for a sheet with no rules to register.
|
|
65
|
+
const held = registeredStylesheets().find((sheet) => sheet.file === path);
|
|
66
|
+
partials.set(path, held?.dependencies ?? compileStylesheet(path, source).dependencies);
|
|
67
|
+
return classes;
|
|
68
|
+
} catch (error) {
|
|
69
|
+
// A coded failure already names the file and carries a fix — re-wrapping it would bury
|
|
70
|
+
// both. Anything else is rendered through `renderThrowable`, because this is the plugin's
|
|
71
|
+
// last frame and a value that fights being read would escape a Bun plugin as a bare throw.
|
|
72
|
+
if (error instanceof UltimateError) throw error;
|
|
73
|
+
throw new IslandBuildFailedError({ file: path, logs: renderThrowable(error) });
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
name: 'ultimate-island-styles',
|
|
78
|
+
dependenciesOf: (sheets) => [...new Set(sheets.flatMap((one) => partials.get(one) ?? []))],
|
|
79
|
+
setup(build): void {
|
|
80
|
+
build.onLoad({ filter: STYLESHEET }, async ({ path }) => {
|
|
81
|
+
let contents = compiled.get(path);
|
|
82
|
+
if (contents === undefined) {
|
|
83
|
+
contents = load(path);
|
|
84
|
+
compiled.set(path, contents);
|
|
85
|
+
}
|
|
86
|
+
return { contents: await contents, loader: 'js' };
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The stylesheets among a build's metafile inputs (cwd-relative), absolute — a package's own
|
|
94
|
+
* included, which a cached group must register again exactly as the build's plugin did.
|
|
34
95
|
*/
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
islandSheets.add(path);
|
|
42
|
-
return { contents: loadStylesheet(path, source, 'island'), loader: 'js' };
|
|
43
|
-
} catch (error) {
|
|
44
|
-
// A coded failure already names the file and carries a fix — re-wrapping it would bury
|
|
45
|
-
// both. Anything else is rendered through `renderThrowable`, because this is the plugin's
|
|
46
|
-
// last frame and a value that fights being read would escape a Bun plugin as a bare throw.
|
|
47
|
-
if (error instanceof UltimateError) throw error;
|
|
48
|
-
throw new IslandBuildFailedError({ file: path, logs: renderThrowable(error) });
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
},
|
|
52
|
-
};
|
|
96
|
+
export function stylesheetsOf(inputs: readonly string[]): readonly string[] {
|
|
97
|
+
const cwd = process.cwd();
|
|
98
|
+
return [
|
|
99
|
+
...new Set(inputs.filter((one) => STYLESHEET.test(one)).map((one) => resolve(cwd, one))),
|
|
100
|
+
].sort();
|
|
101
|
+
}
|
|
@@ -117,16 +117,13 @@ export const authModule =
|
|
|
117
117
|
// creates one.
|
|
118
118
|
import { type Auth, defineAuth, postgresAuthAdapter } from '@ultimat3/auth';
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
// Built at import, and safe to be: the boot scan imports this module before the database and the
|
|
121
|
+
// host's shared lockout limiter are installed, and both are read where they are used — the adapter
|
|
122
|
+
// asks for \`db()\` per call, \`defineAuth\` for the installed limiter on its first attempt.
|
|
123
|
+
const auth = defineAuth({ adapter: postgresAuthAdapter() });
|
|
121
124
|
|
|
122
|
-
/**
|
|
123
|
-
|
|
124
|
-
* the host's shared lockout limiter are installed, and \`defineAuth\` reads both.
|
|
125
|
-
*/
|
|
126
|
-
export const appAuth = (): Auth => {
|
|
127
|
-
built ??= defineAuth({ adapter: postgresAuthAdapter() });
|
|
128
|
-
return built;
|
|
129
|
-
};
|
|
125
|
+
/** This app's \`Auth\`: the one instance every sign-in, session and api-key check runs through. */
|
|
126
|
+
export const appAuth = (): Auth => auth;
|
|
130
127
|
`;
|
|
131
128
|
|
|
132
129
|
const authenticatorModule =
|
|
@@ -157,7 +154,7 @@ export interface SessionRequest extends HeaderRequest {
|
|
|
157
154
|
}
|
|
158
155
|
|
|
159
156
|
export interface SessionAuthenticatorOptions {
|
|
160
|
-
/** The app's \`Auth\`, asked for per request so
|
|
157
|
+
/** The app's \`Auth\`, asked for per request so a test can hand in its own. */
|
|
161
158
|
readonly auth: () => Auth;
|
|
162
159
|
/** Whether a request with no session is the development viewer rather than anonymous. */
|
|
163
160
|
readonly development: boolean;
|
package/src/verify-e2e.ts
CHANGED
|
@@ -17,11 +17,27 @@ import type { ExecResult } from './exec';
|
|
|
17
17
|
export const e2ePreload = (): string =>
|
|
18
18
|
Bun.resolveSync('@ultimat3/testing/e2e-preload', import.meta.dir);
|
|
19
19
|
|
|
20
|
+
/** The device zone every browser-backed app e2e run uses, never the runner's ambient zone. */
|
|
21
|
+
export const E2E_TIME_ZONE = 'America/Los_Angeles';
|
|
22
|
+
|
|
20
23
|
export interface E2eRun {
|
|
21
24
|
readonly command: readonly string[];
|
|
22
25
|
readonly env: Readonly<Record<string, string | undefined>>;
|
|
23
26
|
}
|
|
24
27
|
|
|
28
|
+
/** Add the app preload and its deterministic device zone after a browser was found. */
|
|
29
|
+
export function appE2eRun(input: {
|
|
30
|
+
readonly root: string;
|
|
31
|
+
readonly command: readonly string[];
|
|
32
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
33
|
+
}): E2eRun {
|
|
34
|
+
const [bun = 'bun', test = 'test', ...rest] = input.command;
|
|
35
|
+
return {
|
|
36
|
+
command: [bun, test, '--preload', e2ePreload(), ...rest],
|
|
37
|
+
env: { ...input.env, [E2E_ROOT_ENV]: input.root, TZ: E2E_TIME_ZONE },
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
25
41
|
/** Wrap one e2e `bun test` invocation: `run` receives the command and extra environment to use. */
|
|
26
42
|
export async function withE2eApp(
|
|
27
43
|
input: {
|
|
@@ -34,9 +50,5 @@ export async function withE2eApp(
|
|
|
34
50
|
): Promise<ExecResult> {
|
|
35
51
|
const chrome = input.isApp ? await findChrome(Bun.env) : undefined;
|
|
36
52
|
if (chrome === undefined) return run({ command: input.command, env: input.env });
|
|
37
|
-
|
|
38
|
-
return run({
|
|
39
|
-
command: [bun, test, '--preload', e2ePreload(), ...rest],
|
|
40
|
-
env: { ...input.env, [E2E_ROOT_ENV]: input.root },
|
|
41
|
-
});
|
|
53
|
+
return run(appE2eRun(input));
|
|
42
54
|
}
|
package/wiki/Client-Data.md
CHANGED
|
@@ -177,18 +177,24 @@ Full rows: [Error codes](Error-Codes).
|
|
|
177
177
|
|
|
178
178
|
## Shared island chunks
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
a module
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
**By default the build groups islands by route.** Islands rendered on exactly the same set of
|
|
181
|
+
routes are one split build: a module they share is one `/islands/chunk-<hash>.js` the page fetches
|
|
182
|
+
once. Every other island is built alone, self-contained, so no route pays for an island it does
|
|
183
|
+
not render. The groups are read from each `page.tsx`'s `island({ src })` declarations
|
|
184
|
+
(`packages/cli/src/island-groups.ts`). Measured `As of 2026-11-10`: the reference app's
|
|
185
|
+
`/posts/:id` (three islands on that route only) 95,754 → 65,676 B; every other route unchanged.
|
|
186
|
+
|
|
187
|
+
**`islands: { sharedChunks: true }` in `app.config.ts` is one group holding every island.** Off by
|
|
188
|
+
default, by measurement (`packages/core/src/config-islands.ts`): tree shaking across one build
|
|
189
|
+
keeps what any importer uses, so an island that takes one helper from a module the others use
|
|
190
|
+
heavily pays for all of it — the reference app's plain-DOM update banner went 712 → 16,288 B.
|
|
185
191
|
|
|
186
192
|
| Turn it on when | Leave it off when |
|
|
187
193
|
|---|---|
|
|
188
|
-
|
|
|
189
|
-
| `x build --target static`, then `x verify --only budgets`, shows
|
|
194
|
+
| shared code cached across pages is worth more than each page's first-visit bytes | an island is small and plain-DOM, or the islands share little |
|
|
195
|
+
| `x build --target static`, then `x verify --only budgets`, shows no route growing | any route's `budget.js` grows past its budget |
|
|
190
196
|
|
|
191
197
|
Layering: the last config layer that states `sharedChunks` wins; absent everywhere is `false`
|
|
192
198
|
(`mergeIslands`). A value that is not a boolean is refused at boot (`X_CONFIG_INVALID`). `As of
|
|
193
|
-
2026-
|
|
199
|
+
2026-11`.
|
|
194
200
|
|
package/wiki/Configuration.md
CHANGED
|
@@ -373,7 +373,7 @@ islands: { sharedChunks: true },
|
|
|
373
373
|
|
|
374
374
|
| field | type | default | notes |
|
|
375
375
|
|---|---|---|---|
|
|
376
|
-
| `islands.sharedChunks` | `boolean` | `false` | **read** by `x dev`, the container and `x build`: `true` builds every island in one split bundle, so a module two islands import is one `/islands/chunk-<hash>.js` a page fetches once and a browser caches across pages; each route's `budget.js` counts it once. `false`
|
|
376
|
+
| `islands.sharedChunks` | `boolean` | `false` | **read** by `x dev`, the container and `x build`: `true` builds every island in one split bundle, so a module two islands import is one `/islands/chunk-<hash>.js` a page fetches once and a browser caches across pages; each route's `budget.js` counts it once. `false` (the default) groups by route: islands rendered on exactly the same set of routes are one split build sharing their modules, every other island is built alone, self-contained ([Client data](Client-Data#shared-island-chunks)). `true` is one group holding every island: tree shaking across one split build keeps what ANY importer uses, so a small island importing a helper from a module other islands use heavily pays for all of it (`examples/dummy`'s update banner 712 → 16,288 B). Turn it on only when cross-page caching of shared code is worth that, then weigh the routes with `x verify`. A non-boolean → `X_CONFIG_INVALID` |
|
|
377
377
|
|
|
378
378
|
## `clientErrors`
|
|
379
379
|
|
package/wiki/Deployment.md
CHANGED
|
@@ -222,7 +222,7 @@ own file. Add it; the boot log names it until you do ([Upgrading](Upgrading)).
|
|
|
222
222
|
| the registry came from another Bun | ignores it and scans |
|
|
223
223
|
| a module would not import at build time | no registry was written; the boot scans and refuses with that module's cause (`X_APP_MODULE_LOAD_FAILED`) |
|
|
224
224
|
|
|
225
|
-
Every scan without a registry — tools, `x dev`'s first load, `x build` — imports in batches of 256 through one generated entry module per batch, in the serial scan's evaluation order (`packages/cli/src/app-load-order.test.ts`). Measured cold module load, 5,000 synthetic modules: serial 3,258 ms, batched 1,259 ms ([`boot-vs-files.json`](https://github.com/developerz-ai/ultimate/blob/main/scripts/bench/results/boot-vs-files.json)).
|
|
225
|
+
Every scan without a registry — tools, `x dev`'s first load, `x build` — imports in batches of 256 through one generated entry module per batch, in the serial scan's evaluation order (`packages/cli/src/app-load-order.test.ts`). Measured cold module load, 5,000 synthetic modules: serial 3,258 ms, batched 1,259 ms ([`boot-vs-files.json`](https://github.com/developerz-ai/ultimate/blob/main/scripts/bench/results/boot-vs-files.json)). A whole `web` pod boot, `As of 2026-11-10`, on a 5,124-file app (the reference app plus 150 generated resources): 2.4 s to the first 200 from the prebuilt registry, 3.3 s scanning instead — the image's entry and store on one busy host, not inside a container ([`boot-large-app.json`](https://github.com/developerz-ai/ultimate/blob/main/scripts/bench/results/boot-large-app.json), `bun run scripts/bench/boot-large-app.bench.ts`).
|
|
226
226
|
|
|
227
227
|
All targets share one build ID (content hash), stamped into the image, the HTML, the assets, `x.manifest.json` — **and `sw.js`**, `As of 2026-08`: the worker's cache names carry the build id, so a deploy retires the previous build's caches instead of serving them ([#390](https://github.com/developerz-ai/ultimate/issues/390)). Every target that serves or writes a document emits `manifest.webmanifest`, `sw.js` and `x-sw-register.js` alike ([PWA and offline](PWA-And-Offline)).
|
|
228
228
|
|
|
@@ -88,14 +88,18 @@ migration or a psql session can violate.
|
|
|
88
88
|
| `c.slug.matches(isValidSlug)` — a **function** | **no** | `sql: null` |
|
|
89
89
|
| `c.satisfies(fn, ['status', 'publishedAt'])` | **no** | `sql: null`, by construction — a JS function over several columns |
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
**A rule over a nullable column passes `NULL`, in the app as in the CHECK.** Every operator but
|
|
92
|
+
`isNull()`/`isNotNull()` answers SQL's *unknown* for a NULL operand, in TypeScript too, and a rule
|
|
93
|
+
holds unless it is false — so `c.slug.matches(SLUG_PATTERN)` on a `.nullable()` slug accepts a
|
|
94
|
+
NULL in `$assert`, the memory driver and Postgres alike (`invariant-null.test.ts`, every operator on
|
|
95
|
+
PGlite). To refuse NULL, declare the column NOT NULL or add `.isNotNull()`. As of 31.3; before it
|
|
96
|
+
the app refused the NULL its CHECK stored.
|
|
97
|
+
|
|
98
|
+
**`iff` renders `=`, not `IS NOT DISTINCT FROM`, and that is not an oversight.** `=` between two
|
|
99
|
+
booleans where either is NULL yields NULL, which a CHECK **passes** and the app now passes too. The
|
|
100
|
+
total form would make Postgres **refuse a row TypeScript accepted**, which reaches the caller as a
|
|
101
|
+
raw `23514` instead of `X_INVARIANT_VIOLATED`. Where both operands are total — a non-nullable
|
|
102
|
+
column, an `IS NOT NULL` — the two spellings are the same predicate, measured.
|
|
99
103
|
|
|
100
104
|
Pass the pattern, not a function wrapping it. `matches(isValidSlug)` and `matches(SLUG_PATTERN)`
|
|
101
105
|
read almost identically and only one of them reaches a constraint.
|
|
@@ -913,7 +917,7 @@ Three declarations on the entity, each compiled to a trigger or a purge target,
|
|
|
913
917
|
| Declaration | Compiles to | Refused when |
|
|
914
918
|
|---|---|---|
|
|
915
919
|
| `retain: { after: '90d', on: 'createdAt' }` | a `PurgeTarget` per entity — batched, cross-tenant `delete … where created_at < now - after` | no window (`X_ENTITY_RETAIN_INVALID`), `on` not an indexed `timestamp()` (`X_ENTITY_RETAIN_UNINDEXED`), beside `appendOnly`, or on a table the catalog holds partitioned (drift, `X_ENTITY_RETAIN_INVALID`: detach partitions in a `task`) |
|
|
916
|
-
| `history: true` · `history: { retain: { after: '365d' } }` | `<table>_history (id, <tenant>, row_id, op, at, actor_id, request_id, before, after)` — a registered entity (`posts.$history`), written by the `ultimate_history` trigger, guarded by `ultimate_history_guard` | a composite primary key, `appendOnly` (`X_INVARIANT_VIOLATED`) |
|
|
920
|
+
| `history: true` · `history: { retain: { after: '365d' }, ignore: ['likeCount', 'updatedAt'] }` | `<table>_history (id, <tenant>, row_id, op, at, actor_id, request_id, before, after)` — a registered entity (`posts.$history`), written by the `ultimate_history` trigger, guarded by `ultimate_history_guard` | a composite primary key, `appendOnly` (`X_INVARIANT_VIOLATED`) |
|
|
917
921
|
| `references(() => posts.id, { countedIn: () => posts.likeCount })` | a trigger on the child moving `posts.like_count` by one in the write's own transaction | the column is no `integer()`, or the key points at no single primary key (`X_ENTITY_COUNTS_INVALID`) |
|
|
918
922
|
|
|
919
923
|
```ts
|
|
@@ -935,7 +939,8 @@ export const likes = entity('likes', {
|
|
|
935
939
|
```
|
|
936
940
|
|
|
937
941
|
- **Retention is a promise `x verify` checks.** A `retain` no `purge()` covers is `X_ENTITY_RETAIN_UNSWEPT` in the `manifest` step. `purge({ entities: 'declared' })` covers every one, history tables included, and needs no line per entity.
|
|
938
|
-
- **History is recorded by trigger**, so `updateWhere`, a cascade and raw SQL are recorded too. An update that changes nothing records nothing; a change to a counted column alone records nothing. `.sealed()` columns stay ciphertext in the images. `actor_id`/`request_id` are what the WRITE'S transaction set (`x.actor`, `x.request`): the repository sets them before its first write to a history entity inside a transaction; an autocommit write records `null`, never a guess. Update of a history row is refused always; delete only under `x.purge` naming that table, which the retention sweep sets (`X_ENTITY_APPEND_ONLY`, SQLSTATE `23001`). Reading it is an ordinary, tenant-scoped, cursor-paged read: `database({ posts, postsHistory: posts.$history })`.
|
|
942
|
+
- **History is recorded by trigger**, so `updateWhere`, a cascade and raw SQL are recorded too. An update that changes nothing records nothing; a change to a counted column, or to columns `history: { ignore }` names, alone records nothing — on both drivers (`history-ignore.test.ts`). `ignore` takes the entity's own columns, typed; another name is `X_INVARIANT_VIOLATED`. Declaring it changes the trigger's arguments, so `x db gen` writes the migration that reinstalls it. `.sealed()` columns stay ciphertext in the images. `actor_id`/`request_id` are what the WRITE'S transaction set (`x.actor`, `x.request`): the repository sets them before its first write to a history entity inside a transaction; an autocommit write records `null`, never a guess. Update of a history row is refused always; delete only under `x.purge` naming that table, which the retention sweep sets (`X_ENTITY_APPEND_ONLY`, SQLSTATE `23001`). Reading it is an ordinary, tenant-scoped, cursor-paged read: `database({ posts, postsHistory: posts.$history })`.
|
|
943
|
+
- **One row's history is `history(db.postsHistory, id)`**: every version, oldest first, each numbered `version` from 1 — ordered by chaining each `before` onto the previous `after` across every version, `at` only breaking ties: `at` is the transaction's START, so a transaction that began first and committed last carries the earlier `at` and the later image. `history(table, id, { limit: n })` reads the `n` versions with the latest `at` (ties at the edge kept), numbered as the whole history numbers them — chosen by transaction start, so a transaction that began before that window and committed inside it can fall outside. The read is the history table's, so another tenant's row reads back `[]`; the policy is the query or action that calls it. `version` counts what is retained: after a `retain` sweep, 1 is the oldest kept. As of 31.3.
|
|
939
944
|
- **A counter locks its parent row.** A hot parent serializes its writers; where that matters, `countBy` plus a cache is the alternative. A soft-deleted child is not counted. A new counter's migration recounts once, so an existing table starts true; `x db recount posts.likeCount` reports drift and `--write` repairs it.
|
|
940
945
|
- **A counter's write is the trigger's, not the repository's.** The WAL replicator reports it; the in-process `entity.row` event (what `x dev` on PGlite and the memory driver feed live queries from) does not, so a live view of the counter on those does not move until the parent row is written again. A counter a page shows live stays the mutator's job until that event reports trigger writes. As of 2026-11.
|
|
941
946
|
- **Memory answers as Postgres does**: the memory driver records history and moves counters in its repository (`counter.test.ts`, `history.test.ts` are the parity tables).
|
package/wiki/Stability.md
CHANGED
|
@@ -40,13 +40,13 @@ Never "stable forever": a covered surface can change, in a scheduled major, with
|
|
|
40
40
|
|
|
41
41
|
| Release | When | Branch | npm dist-tag |
|
|
42
42
|
|---|---|---|---|
|
|
43
|
-
| major | at most once per 90 days from v31, counted from the previous major's `
|
|
43
|
+
| major | at most once per 90 days from v31, counted from the heading date of the previous major's `docs/changelog/<major>.0.0.md` | `next`, merged into `main` when the window opens | `latest` |
|
|
44
44
|
| minor | weekly, when something shipped | `main` | `latest` |
|
|
45
45
|
| patch to the current major | as needed | `main` | `latest` |
|
|
46
46
|
| patch to the previous major | security fixes only, until 6 months after its successor shipped | `release/<major>.x` | `maint-<major>` |
|
|
47
47
|
| prerelease of the next major — **planned, nothing ships one yet** | `release-tag.yml` cuts only `X.Y.Z` release commits, so no workflow publishes from `next` | `next` | `next` (`scripts/dist-tag.ts` already names it) |
|
|
48
48
|
|
|
49
|
-
**v31 is the stable line**, dated 2026-11-10 by
|
|
49
|
+
**v31 is the stable line**, dated 2026-11-10 by the heading of `docs/changelog/31.0.0.md`. It was the exception that starts the clock: it carried every break queued before the promise bound anyone (74, [Upgrading](Upgrading#30x--3100-entry-by-entry)), and `scripts/release.ts` does not refuse it (`WINDOW_OPENS_AT_MAJOR` in `scripts/lib/major-window.ts`). From it on, a `BREAKING —` entry waits on `next` and a removal ships its deprecation minor first.
|
|
50
50
|
|
|
51
51
|
Ruling 2026-11-09: the clock moved from v30 to v31. v30 shipped 2026-11-07 while only our own apps ran Ultimate in production, so the window protected no one yet; v31 carries the breaks of plan 101-final-hardening-before-v31, and the window protects adopters from there.
|
|
52
52
|
|
|
@@ -58,7 +58,7 @@ Ruling 2026-11-09: the clock moved from v30 to v31. v30 shipped 2026-11-07 while
|
|
|
58
58
|
| the previous major | security fixes, as patches on `release/<major>.x` | 6 months after the current major's `## X.0.0` date |
|
|
59
59
|
| anything older | none | [Upgrading](Upgrading), one major per `x upgrade` run |
|
|
60
60
|
|
|
61
|
-
**Convention, not enforced:** `release/<major>.x` is cut by hand at each major and kept at that major's newest minor; no script cuts
|
|
61
|
+
**Convention, not enforced:** `release/<major>.x` is cut by hand at each major and kept at that major's newest minor; no script cuts it. Its name is enforced: `ci.yml` and `release-tag.yml` match exactly `release/[0-9]+.x`, and `scripts/release.ts --bump` refuses any other `release/*` branch (`X_RELEASE_BRANCH_NAME`). A bump PR's own branch is `chore/release-X.Y.Z`, never `release/X.Y.Z` (#1054). Once it exists, a patch is `latest` while its major is current and `maint-<major>` once its successor ships. `scripts/dist-tag.ts` decides the tag from the registry's `latest`, and `npm publish` never runs without it.
|
|
62
62
|
|
|
63
63
|
## Deprecation
|
|
64
64
|
|
|
@@ -82,7 +82,7 @@ A security fix that cannot be made non-breaking may ship a major inside the wind
|
|
|
82
82
|
bun run scripts/release.ts --bump major --security GHSA-xxxx-xxxx-xxxx --dry-run --json
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
The advisory id (a `GHSA-…` or `CVE-…`) is recorded under the
|
|
85
|
+
The advisory id (a `GHSA-…` or `CVE-…`) is recorded under the heading of the release's `docs/changelog/<version>.md` (under `[Unreleased]` in `CHANGELOG.md` before the bump) as `> **Security exception:** \`<id>\``, and the bump commit's body carries `Security-Exception: <id>`. The same recorded line lets a removal skip its deprecation minor.
|
|
86
86
|
|
|
87
87
|
## Who decides
|
|
88
88
|
|
|
@@ -95,5 +95,6 @@ The maintainer bot judges whether a release is due and which kind (`.dz/briefs/r
|
|
|
95
95
|
| one major per 90 days | `scripts/release.ts --bump`, `--check`, and the gate's `boundaries` step | `X_RELEASE_MAJOR_WINDOW` |
|
|
96
96
|
| no break on `main` while the window is closed | `bun run changelog-check` and the gate, on the pull request's base branch | `X_BREAKING_ON_MAIN` |
|
|
97
97
|
| a removal was deprecated first | `bun run scripts/deprecation-window.ts` and the gate | `X_RELEASE_UNDEPRECATED_REMOVAL` |
|
|
98
|
-
| every release from 30.0.0 opens with Highlights, the Release body | `bun run changelog-check` and the gate | `X_CHANGELOG_HIGHLIGHTS_MISSING` |
|
|
98
|
+
| every release from 30.0.0 opens with Highlights, the Release body | `bun run changelog-check` and the gate, over `docs/changelog/` | `X_CHANGELOG_HIGHLIGHTS_MISSING` |
|
|
99
|
+
| a bump branch is `chore/release-X.Y.Z`; `release/*` is only `release/<major>.x` | `scripts/release.ts --bump`; `ci.yml` and `release-tag.yml` filter on `release/[0-9]+.x` (`scripts/release-tag-workflow-shape.test.ts`) | `X_RELEASE_BRANCH_NAME` |
|
|
99
100
|
| a maintenance publish never moves `latest` | `scripts/dist-tag.ts` in `release.yml`; `scripts/registry-audit.ts` audits `latest` and each `maint-*` tag | `X_REGISTRY_LATEST_DRIFT` |
|
|
@@ -355,7 +355,7 @@ Rule: an `uploadScanner` returned from `apps/<app>/runtime.ts` is asked about ev
|
|
|
355
355
|
|
|
356
356
|
| Fact | Detail |
|
|
357
357
|
|---|---|
|
|
358
|
-
| the port | `UploadScanner = { name, holds?, scan({ key, pendingKey, size, contentType, body }) → Promise<ScanVerdict> }` on `@ultimat3/storage/adapter`. `key` is the per-attempt scan copy, `pendingKey` the upload's own key, stable across retries —
|
|
358
|
+
| the port | `UploadScanner = { name, holds?, scan({ key, pendingKey, revision, size, contentType, body }) → Promise<ScanVerdict> }` on `@ultimat3/storage/adapter`. `key` is the per-attempt scan copy, `pendingKey` the upload's own key, stable across retries, `revision` which bytes are under it (the etag, or `sha256:<hex>`) — a `hold` is decided by `(pendingKey, revision)`, because the upload URL stays valid and a rewrite is new bytes (31.3). "Cannot decide" is a rejection, never a verdict. A scanner that answers `hold` declares `holds: true`; a `hold` from one that did not is `X_INVARIANT`, nothing attached |
|
|
359
359
|
| the reference | `memoryUploadScanner()` flags the EICAR test string (`EICAR_TEST_STRING`), across chunk boundaries |
|
|
360
360
|
| prove yours | `behavesLike(uploadScannerConformance, () => yours)` from `@ultimat3/testing/conformance` |
|
|
361
361
|
| ClamAV | the app's adapter (axiom 8): stream `body` to clamd's `INSTREAM` over `Bun.connect`; `stream: OK` → clean, `stream: <sig> FOUND` → infected, anything else → reject |
|
package/wiki/Testing.md
CHANGED
|
@@ -918,6 +918,7 @@ await insertSeedGraph(graph, writer);
|
|
|
918
918
|
| soft delete | a soft-deleting table's `deletedAt` is `null` unless a factory builds it: seeded rows are live |
|
|
919
919
|
| `factories` | `{ factories: { posts: myFactory } }` — what the factory builds wins, except keys and the tenant column, which stay the graph's |
|
|
920
920
|
| determinism | defaults `tenants: 2`, `perTable: 3` (per tenant for a tenant-scoped table), `seed` the package's `DEFAULT_SEED`. Same seed, same bytes |
|
|
921
|
+
| partitions | an `entity({ partitionBy })` column takes values in the UTC bucket holding `now` — the partition the migration makes first, read off `$describe().partition` — a `date()` as `YYYY-MM-DD`, a `timestamp()` as an instant. `now` defaults to `systemClock.now()`; under a frozen test clock, pass the database's `select now()` (`As of 31.3`) |
|
|
921
922
|
| `beside` | `{ beside: earlier }` — a graph already written to the same database. Each table's row positions (the ordinal a generated integer, date or money is built from; a factory's `index`, reached by replaying its builds after `reset()`) continue past `earlier.next[table]`, so no value built from a position repeats one of its rows on a unique column. `graph.next` is cumulative: chain a third graph beside the second |
|
|
922
923
|
| canaries | each row's generated text carries a token; `graph.canaries` lists it per row with the columns holding it, so a later read can say whose row it saw |
|
|
923
924
|
| writing | `insertSeedGraph(graph, writer)`: every insert in order, then every update, sequentially. `entitySeedWriter({ entities, client })` (Postgres or PGlite) or `entitySeedWriter({ entities, driver? })` (a driver; default `defaultDriver()`) writes through each entity's own repository. A row whose entity the writer was not given is `X_SEED_GRAPH_ENTITY_UNKNOWN` |
|
package/wiki/Upgrading.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
> **From v31, one major per 90 days.** The window, what semver covers, the support window and the security exception: [Stability](Stability). A removal now ships its `@deprecated` alias for at least one minor before a major takes it, so `x upgrade` across one major names no edit a minor did not already warn about. The 30 sections below stay as they are.
|
|
6
6
|
|
|
7
|
-
**Thirty majors have shipped since 1.0.0, and this page walks all thirty** — 2.0.0's 33 entries joined it `As of 2026-08`, and `scripts/changelog-check.ts` now refuses a summary row whose section the page does not carry, which is how they were missing for six releases. [`CHANGELOG.md`](https://github.com/developerz-ai/ultimate/blob/main/CHANGELOG.md) is the source for the majors it still carries, and `git show v<tag>:CHANGELOG.md` for the ones it has archived; none ships a codemod, so every entry is a manual edit the entry itself names. **One section per major**, newest first — read the ones between your pin and your target, oldest first.
|
|
7
|
+
**Thirty majors have shipped since 1.0.0, and this page walks all thirty** — 2.0.0's 33 entries joined it `As of 2026-08`, and `scripts/changelog-check.ts` now refuses a summary row whose section the page does not carry, which is how they were missing for six releases. [`docs/changelog/`](https://github.com/developerz-ai/ultimate/tree/main/docs/changelog) — one file per release, indexed by [`CHANGELOG.md`](https://github.com/developerz-ai/ultimate/blob/main/CHANGELOG.md) — is the source for the majors it still carries, and `git show v<tag>:CHANGELOG.md` for the ones it has archived; none ships a codemod, so every entry is a manual edit the entry itself names. **One section per major**, newest first — read the ones between your pin and your target, oldest first.
|
|
8
8
|
|
|
9
9
|
| From → to | Breaking entries | Read |
|
|
10
10
|
|---|---|---|
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
| 3.0.0 → 4.0.0 | **25**, from a sweep that closed every known gap | [the `4.0.0` section](#300--400-entry-by-entry), in order |
|
|
39
39
|
| 2.0.0 → 3.0.0 | **10**, all from a five-agent bug sweep | [the `3.0.0` section](#200--300-entry-by-entry), in order |
|
|
40
40
|
| 1.x → 2.0.0 | **33** | [the `2.0.0` section](#1x--200-entry-by-entry), in order |
|
|
41
|
-
| 11.x → 20.0.0 | **47** | every major section `
|
|
41
|
+
| 11.x → 20.0.0 | **47** | every major section `docs/changelog/` still carries, oldest first |
|
|
42
42
|
|
|
43
|
-
An entry is a line `
|
|
43
|
+
An entry is a line a release file in `docs/changelog/` marks `BREAKING —`. The count is derived, never curated:
|
|
44
44
|
|
|
45
45
|
```sh
|
|
46
|
-
grep -cE '^(- \*\*|### )BREAKING —'
|
|
47
|
-
# 634 As of 2026-11-10 — every RELEASED section, which is the
|
|
48
|
-
#
|
|
46
|
+
cat docs/changelog/*.md | grep -cE '^(- \*\*|### )BREAKING —'
|
|
47
|
+
# 634 As of 2026-11-10 — every RELEASED section ([Unreleased] stays in CHANGELOG.md), which is the
|
|
48
|
+
# sum of every row above whose section docs/changelog/ still carries.
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
How that total is counted, and why `[Unreleased]` is cut: the header of [`scripts/changelog-check.ts`](https://github.com/developerz-ai/ultimate/blob/main/scripts/changelog-check.ts).
|
|
@@ -3202,7 +3202,7 @@ Seven breaking entries, and the first is a **runtime** refusal with no compile e
|
|
|
3202
3202
|
|
|
3203
3203
|
### Start here — the one edit
|
|
3204
3204
|
|
|
3205
|
-
Every single-label timezone name except `UTC` is refused. `isValidTimeZone` answers `false`, `canonicalTimeZone` answers `undefined`, `assertTimeZone` throws `X_TIMEZONE_INVALID` — and every `@ultimat3/time` formatter is downstream of that one call. **43 names change answer**, tabulated once under
|
|
3205
|
+
Every single-label timezone name except `UTC` is refused. `isValidTimeZone` answers `false`, `canonicalTimeZone` answers `undefined`, `assertTimeZone` throws `X_TIMEZONE_INVALID` — and every `@ultimat3/time` formatter is downstream of that one call. **43 names change answer**, tabulated once under the `6.0.0` section of `git show v6.0.0:CHANGELOG.md`; that table is the source and is deliberately not copied here.
|
|
3206
3206
|
|
|
3207
3207
|
```diff
|
|
3208
3208
|
- formatDate(at, { locale, zone: 'CET' })
|
|
@@ -3334,7 +3334,7 @@ carry.
|
|
|
3334
3334
|
|
|
3335
3335
|
## 3.0.0 → 4.0.0, entry by entry
|
|
3336
3336
|
|
|
3337
|
-
Twenty-five `BREAKING —` entries. Most are one of two shapes: a **declaration nothing read**, deleted rather than implemented, and a **surface that answered the wrong thing**, corrected. Full rationale per row in
|
|
3337
|
+
Twenty-five `BREAKING —` entries. Most are one of two shapes: a **declaration nothing read**, deleted rather than implemented, and a **surface that answered the wrong thing**, corrected. Full rationale per row in the `4.0.0` section of `git show v4.0.0:CHANGELOG.md`.
|
|
3338
3338
|
|
|
3339
3339
|
**Start here — these three change behaviour whether or not you edit anything:**
|
|
3340
3340
|
|
|
@@ -3385,7 +3385,7 @@ Twenty-five `BREAKING —` entries. Most are one of two shapes: a **declaration
|
|
|
3385
3385
|
|
|
3386
3386
|
## 2.0.0 → 3.0.0, entry by entry
|
|
3387
3387
|
|
|
3388
|
-
Ten `BREAKING —` entries, all from one bug sweep. Each was a documented surface that did nothing, or did the wrong thing; the fix is the edit named beside it. Full rationale per row in
|
|
3388
|
+
Ten `BREAKING —` entries, all from one bug sweep. Each was a documented surface that did nothing, or did the wrong thing; the fix is the edit named beside it. Full rationale per row in the `3.0.0` section of `git show v3.0.0:CHANGELOG.md`.
|
|
3389
3389
|
|
|
3390
3390
|
| Surface | The edit |
|
|
3391
3391
|
|---|---|
|
|
@@ -3404,7 +3404,7 @@ Ten `BREAKING —` entries, all from one bug sweep. Each was a documented surfac
|
|
|
3404
3404
|
|
|
3405
3405
|
## 1.x → 2.0.0, entry by entry
|
|
3406
3406
|
|
|
3407
|
-
**Thirty-three `BREAKING —` entries — the largest major this project has shipped, and the first one semver covered.** Written up here `As of 2026-08`; the page carried a row pointing at this section for six releases and never carried the section. Full rationale per entry in
|
|
3407
|
+
**Thirty-three `BREAKING —` entries — the largest major this project has shipped, and the first one semver covered.** Written up here `As of 2026-08`; the page carried a row pointing at this section for six releases and never carried the section. Full rationale per entry in the `2.0.0` section of `git show v2.0.0:CHANGELOG.md` — the numbers below are that section's own order. No codemod.
|
|
3408
3408
|
|
|
3409
3409
|
Two things are not compile errors and are the ones to read first: the **seven behaviour changes** under *Start here*, and the **one migration** every app with a `money()` column owes.
|
|
3410
3410
|
|