@ultimat3/cli 31.4.1 → 31.5.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 +1 -0
- package/package.json +29 -29
- package/src/app-boundaries.ts +3 -2
- package/src/asset-route-meta.ts +29 -0
- package/src/cmd-drill.ts +39 -9
- package/src/favicon.ts +2 -1
- package/src/guard-sources.ts +22 -2
- package/src/island-routes.ts +2 -1
- package/src/mcp-host.ts +70 -9
- package/src/pwa-artifacts.ts +3 -3
- package/src/runtime-assets.ts +4 -1
- package/src/site-asset-routes.ts +2 -1
- package/src/style-routes.ts +2 -1
- package/src/templates/guard-local-binding.ts +4 -4
- package/src/templates/guard-repo-raw-sql.ts +6 -3
- package/src/worker-bundle.ts +2 -1
- package/wiki/Entities-And-Migrations.md +3 -3
- package/wiki/Interface-Rules.md +2 -2
- package/wiki/Project-Layout.md +3 -3
- package/wiki/Upgrading.md +12 -2
package/CLAUDE.md
CHANGED
|
@@ -132,6 +132,7 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
|
|
|
132
132
|
| `role-wake.ts` | the worker's LISTEN session (`@ultimat3/jobs`' `startQueueWake`) — worker role only, only over a client that `canListen` — and `queue_wake_live` |
|
|
133
133
|
| `role-sync.ts` / `role-replicator.ts` / `runtime-live-feed.ts` | the sync node, the change feed |
|
|
134
134
|
| `runtime-render*.ts` / `runtime-{isr-outcome,assets,storage,hooks}.ts` / `route-islands.ts` / `api-routes.ts` | the HTTP surface both boots mount † |
|
|
135
|
+
| `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` |
|
|
135
136
|
| `client-{errors,vitals}-*.ts` | `clientErrors` (and `.vitals`): the script on `app/` (vitals: listed) documents, its `POST` route, mounted by BOTH boots ‡ |
|
|
136
137
|
| `retained-assets.ts` / `-layout.ts` / `-sweep.ts` / `-read.ts` / `-boot.ts` | `assets.retain`: the web boot publishes this build's hashed files before `/readyz` † |
|
|
137
138
|
| `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` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/cli",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.5.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.
|
|
57
|
-
"@ultimat3/admin": "31.
|
|
58
|
-
"@ultimat3/ai": "31.
|
|
59
|
-
"@ultimat3/auth": "31.
|
|
60
|
-
"@ultimat3/cache": "31.
|
|
61
|
-
"@ultimat3/core": "31.
|
|
62
|
-
"@ultimat3/db": "31.
|
|
63
|
-
"@ultimat3/entity": "31.
|
|
64
|
-
"@ultimat3/flags": "31.
|
|
65
|
-
"@ultimat3/http": "31.
|
|
66
|
-
"@ultimat3/i18n": "31.
|
|
67
|
-
"@ultimat3/jobs": "31.
|
|
68
|
-
"@ultimat3/mail": "31.
|
|
69
|
-
"@ultimat3/manifest": "31.
|
|
70
|
-
"@ultimat3/mcp": "31.
|
|
71
|
-
"@ultimat3/money": "31.
|
|
72
|
-
"@ultimat3/notify": "31.
|
|
73
|
-
"@ultimat3/policy": "31.
|
|
74
|
-
"@ultimat3/pwa": "31.
|
|
75
|
-
"@ultimat3/query": "31.
|
|
76
|
-
"@ultimat3/realtime": "31.
|
|
77
|
-
"@ultimat3/render": "31.
|
|
78
|
-
"@ultimat3/schema": "31.
|
|
79
|
-
"@ultimat3/scraping": "31.
|
|
80
|
-
"@ultimat3/seo": "31.
|
|
81
|
-
"@ultimat3/storage": "31.
|
|
82
|
-
"@ultimat3/testing": "31.
|
|
83
|
-
"@ultimat3/time": "31.
|
|
56
|
+
"@ultimat3/action": "31.5.0",
|
|
57
|
+
"@ultimat3/admin": "31.5.0",
|
|
58
|
+
"@ultimat3/ai": "31.5.0",
|
|
59
|
+
"@ultimat3/auth": "31.5.0",
|
|
60
|
+
"@ultimat3/cache": "31.5.0",
|
|
61
|
+
"@ultimat3/core": "31.5.0",
|
|
62
|
+
"@ultimat3/db": "31.5.0",
|
|
63
|
+
"@ultimat3/entity": "31.5.0",
|
|
64
|
+
"@ultimat3/flags": "31.5.0",
|
|
65
|
+
"@ultimat3/http": "31.5.0",
|
|
66
|
+
"@ultimat3/i18n": "31.5.0",
|
|
67
|
+
"@ultimat3/jobs": "31.5.0",
|
|
68
|
+
"@ultimat3/mail": "31.5.0",
|
|
69
|
+
"@ultimat3/manifest": "31.5.0",
|
|
70
|
+
"@ultimat3/mcp": "31.5.0",
|
|
71
|
+
"@ultimat3/money": "31.5.0",
|
|
72
|
+
"@ultimat3/notify": "31.5.0",
|
|
73
|
+
"@ultimat3/policy": "31.5.0",
|
|
74
|
+
"@ultimat3/pwa": "31.5.0",
|
|
75
|
+
"@ultimat3/query": "31.5.0",
|
|
76
|
+
"@ultimat3/realtime": "31.5.0",
|
|
77
|
+
"@ultimat3/render": "31.5.0",
|
|
78
|
+
"@ultimat3/schema": "31.5.0",
|
|
79
|
+
"@ultimat3/scraping": "31.5.0",
|
|
80
|
+
"@ultimat3/seo": "31.5.0",
|
|
81
|
+
"@ultimat3/storage": "31.5.0",
|
|
82
|
+
"@ultimat3/testing": "31.5.0",
|
|
83
|
+
"@ultimat3/time": "31.5.0",
|
|
84
84
|
"babel-preset-solid": "^1.9.16"
|
|
85
85
|
}
|
|
86
86
|
}
|
package/src/app-boundaries.ts
CHANGED
|
@@ -72,10 +72,11 @@ const isService = (path: string): boolean => /\/service\.[cm]?ts$/.test(path);
|
|
|
72
72
|
* query that carries the read's policy, bound and cache tag — the scaffold's own dashboard showed
|
|
73
73
|
* every post to a viewer holding `dashboard:read` alone. Matched as a whole module name, resolved
|
|
74
74
|
* (`…/repo.ts`), NodeNext-spelled (`./repo.js`, `.mjs`, `.cjs`) or bare (`../post/repo`), so
|
|
75
|
-
* `report` and `repository` are names, not repos.
|
|
75
|
+
* `report` and `repository` are names, not repos. A `repo-<part>` module is the same repo split at
|
|
76
|
+
* the file ceiling (`repo-window.ts`): without it the split was a door around this rule.
|
|
76
77
|
*/
|
|
77
78
|
const isRepoSpecifier = (specifier: string): boolean =>
|
|
78
|
-
/(^|\/)repo(\/index)?(\.[cm]?[jt]sx?)?$/.test(specifier);
|
|
79
|
+
/(^|\/)repo(-[a-z0-9]+)*(\/index)?(\.[cm]?[jt]sx?)?$/.test(specifier);
|
|
79
80
|
const isDbSpecifier = (specifier: string): boolean =>
|
|
80
81
|
/(^|\/)packages\/db($|\/)/.test(specifier) ||
|
|
81
82
|
specifier.endsWith('/db') ||
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// The one place an asset route's tag and rate-limit bucket are written. Every route serving built
|
|
2
|
+
// bytes (chunks, stylesheets, icons, site files, framework scripts) spends `assets`, not `default`:
|
|
3
|
+
// one page load is dozens of content-hashed GETs, and `default`'s 120 burst at 2/s answered 429 to
|
|
4
|
+
// an office behind one NAT from the fifth route on.
|
|
5
|
+
|
|
6
|
+
import type { RouteMeta } from '@ultimat3/http';
|
|
7
|
+
|
|
8
|
+
/** The tag `withRetainedAssets` and the manifest read to know a route serves built bytes. */
|
|
9
|
+
export const ASSET_ROUTE_TAG = 'assets';
|
|
10
|
+
|
|
11
|
+
/** The bucket in `@ultimat3/http`'s `DEFAULT_RATE_LIMIT` an asset route spends. */
|
|
12
|
+
export const ASSET_RATE_LIMIT_BUCKET = 'assets';
|
|
13
|
+
|
|
14
|
+
/** What an asset route declares itself; the tag and the bucket are this function's to write. */
|
|
15
|
+
export type AssetRouteDeclaration = Omit<
|
|
16
|
+
RouteMeta,
|
|
17
|
+
'tags' | 'rateLimit' | 'rateLimitBucket' | 'rateLimitedBy'
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A route meta with `tags: ['assets']` and `rateLimit: 'assets'` written for it. Not optional per
|
|
22
|
+
* route: `asset-route-meta.test.ts` walks the reference app's built table and refuses any
|
|
23
|
+
* `assets.*` route whose meta did not come through here.
|
|
24
|
+
*/
|
|
25
|
+
export const assetRouteMeta = (meta: AssetRouteDeclaration): RouteMeta => ({
|
|
26
|
+
...meta,
|
|
27
|
+
tags: [ASSET_ROUTE_TAG],
|
|
28
|
+
rateLimit: ASSET_RATE_LIMIT_BUCKET,
|
|
29
|
+
});
|
package/src/cmd-drill.ts
CHANGED
|
@@ -5,7 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
import type { AppConfig } from '@ultimat3/core';
|
|
7
7
|
import { DRAIN_DEADLINE_DEFAULT_MS, MAX_TIMER_MS } from '@ultimat3/core';
|
|
8
|
-
import type {
|
|
8
|
+
import type {
|
|
9
|
+
Drill,
|
|
10
|
+
DrillConfig,
|
|
11
|
+
DrillDeclarations,
|
|
12
|
+
DrillFleet,
|
|
13
|
+
DrillReport,
|
|
14
|
+
} from '@ultimat3/testing';
|
|
9
15
|
import {
|
|
10
16
|
bunDrillSql,
|
|
11
17
|
DRILL_NAMES,
|
|
@@ -90,6 +96,33 @@ const findingsOf = (report: DrillReport): readonly Finding[] =>
|
|
|
90
96
|
return { code: error.code, cause: error.cause, fix: error.fix };
|
|
91
97
|
});
|
|
92
98
|
|
|
99
|
+
/** The evidence connection: `bunDrillSql`'s shape, a seam so a test can make it throw. */
|
|
100
|
+
type DrillSqlConnection = ReturnType<typeof bunDrillSql>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* One drill's body over a started fleet, which is ALWAYS stopped. The fleet is spawned role
|
|
104
|
+
* processes: the connection was opened before the `try`, so a constructor that threw (a malformed
|
|
105
|
+
* URL is a synchronous `Invalid URL`) left every role running, and a `close()` that threw skipped
|
|
106
|
+
* `stop()` the same way.
|
|
107
|
+
*/
|
|
108
|
+
export async function withDrillFleet<T>(
|
|
109
|
+
fleet: Pick<DrillFleet, 'databaseUrl' | 'stop'>,
|
|
110
|
+
open: (url: string) => DrillSqlConnection,
|
|
111
|
+
body: (sql: DrillSqlConnection) => Promise<T>,
|
|
112
|
+
): Promise<T> {
|
|
113
|
+
let sql: DrillSqlConnection | undefined;
|
|
114
|
+
try {
|
|
115
|
+
sql = open(fleet.databaseUrl);
|
|
116
|
+
return await body(sql);
|
|
117
|
+
} finally {
|
|
118
|
+
try {
|
|
119
|
+
await sql?.close();
|
|
120
|
+
} finally {
|
|
121
|
+
await fleet.stop();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
93
126
|
export const drillCommand: CliCommand = {
|
|
94
127
|
spec: drillSpec,
|
|
95
128
|
async run(ctx: CommandContext): Promise<CommandResult> {
|
|
@@ -147,14 +180,11 @@ export const drillCommand: CliCommand = {
|
|
|
147
180
|
roles: drillRoles(drill),
|
|
148
181
|
readyTimeoutMs: READY_TIMEOUT_MS,
|
|
149
182
|
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
await sql.close();
|
|
156
|
-
await fleet.stop();
|
|
157
|
-
}
|
|
183
|
+
reports.push(
|
|
184
|
+
await withDrillFleet(fleet, bunDrillSql, (sql) =>
|
|
185
|
+
runDrill({ drill, fleet, budgets, targets, sql, sync: drillSyncLane(fleet) }),
|
|
186
|
+
),
|
|
187
|
+
);
|
|
158
188
|
}
|
|
159
189
|
const held = reports.filter((report) => report.verdict.ok).length;
|
|
160
190
|
const findings = reports.flatMap(findingsOf);
|
package/src/favicon.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { join } from 'node:path';
|
|
|
10
10
|
import { blankRaster, encodeImage } from '@ultimat3/core';
|
|
11
11
|
import type { CacheHint, Route, UltimateRequest } from '@ultimat3/http';
|
|
12
12
|
import { applyCacheHeaders } from '@ultimat3/http';
|
|
13
|
+
import { assetRouteMeta } from './asset-route-meta';
|
|
13
14
|
|
|
14
15
|
/** What a browser asks for with no `<link rel="icon">` to tell it otherwise. */
|
|
15
16
|
export const FAVICON_PATH = '/favicon.ico';
|
|
@@ -108,6 +109,6 @@ export async function faviconResponse(root: string): Promise<Response> {
|
|
|
108
109
|
export const faviconRoute = (root: string): Route => ({
|
|
109
110
|
method: 'GET',
|
|
110
111
|
path: FAVICON_PATH,
|
|
111
|
-
meta: { name: 'assets.favicon', auth: 'public', cache: FAVICON_CACHE
|
|
112
|
+
meta: assetRouteMeta({ name: 'assets.favicon', auth: 'public', cache: FAVICON_CACHE }),
|
|
112
113
|
handler: async (_request: UltimateRequest): Promise<Response> => faviconResponse(root),
|
|
113
114
|
});
|
package/src/guard-sources.ts
CHANGED
|
@@ -40,6 +40,13 @@ export interface GuardSources {
|
|
|
40
40
|
compileError?(path: string): Promise<string | undefined>;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* `@ultimat3/render`'s asset resolver slot (`asset.ts`): global by design, so every copy of render
|
|
45
|
+
* reads the one table installed. Read here only to put back what a compile found; a renamed key
|
|
46
|
+
* fails `guard-sources.test.ts`' restore case, which goes through render's own `asset()`.
|
|
47
|
+
*/
|
|
48
|
+
const RESOLVER_SLOT = Symbol.for('ultimate.render.assetResolver');
|
|
49
|
+
|
|
43
50
|
/** Path segments that are never the app's own source. */
|
|
44
51
|
const NOT_SOURCE = /(?:^|\/)(?:node_modules|dist|\.x|\.git)\//;
|
|
45
52
|
|
|
@@ -84,8 +91,21 @@ export function guardSources(
|
|
|
84
91
|
// Imported here, not at the top: Sass loads on the first compile, and a gate run whose
|
|
85
92
|
// guards compile nothing must not pay for the compiler (`sass-lazy.test.ts`).
|
|
86
93
|
const { compileStylesheet } = await import('@ultimat3/render/server');
|
|
87
|
-
const {
|
|
88
|
-
|
|
94
|
+
const { setAssetResolver } = await import('@ultimat3/render');
|
|
95
|
+
const { siteAssetTable } = await import('./site-assets');
|
|
96
|
+
// A sheet's `asset()` resolves through the table `loadApp` installs for the build — the same
|
|
97
|
+
// table, so a file the app holds compiles and one it does not is `X_ASSET_MISSING`. Installed
|
|
98
|
+
// around the one synchronous compile and handed back after: no await runs in between, so no
|
|
99
|
+
// other code ever sees it, and a table a caller had installed is the one it still has.
|
|
100
|
+
const table = siteAssetTable(root);
|
|
101
|
+
const previous: unknown = Reflect.get(globalThis, RESOLVER_SLOT);
|
|
102
|
+
setAssetResolver((asset) => table.resolve(asset).url);
|
|
103
|
+
try {
|
|
104
|
+
const { css, classes } = compileStylesheet(join(root, path), source);
|
|
105
|
+
return { css, classes };
|
|
106
|
+
} finally {
|
|
107
|
+
Reflect.set(globalThis, RESOLVER_SLOT, previous);
|
|
108
|
+
}
|
|
89
109
|
} catch (error) {
|
|
90
110
|
// The compiler's own words: render's `X_PRERENDER_FAILED` carries them in its cause behind
|
|
91
111
|
// the absolute path, which names a temp root in a test and a different checkout in CI.
|
package/src/island-routes.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type { Route, UltimateRequest } from '@ultimat3/http';
|
|
6
6
|
import { applyCacheHeaders, jsonResponse, NO_STORE, textResponse } from '@ultimat3/http';
|
|
7
|
+
import { assetRouteMeta } from './asset-route-meta';
|
|
7
8
|
import type { IslandBundle } from './island-bundle';
|
|
8
9
|
import { ISLAND_BASE_PATH } from './island-bundle';
|
|
9
10
|
|
|
@@ -24,7 +25,7 @@ export function islandRoutes(source: IslandSource): readonly Route[] {
|
|
|
24
25
|
{
|
|
25
26
|
method: 'GET',
|
|
26
27
|
path: `${ISLAND_BASE_PATH}/*file`,
|
|
27
|
-
meta: { name: 'assets.island', auth: 'public'
|
|
28
|
+
meta: assetRouteMeta({ name: 'assets.island', auth: 'public' }),
|
|
28
29
|
handler: (request: UltimateRequest): Response => {
|
|
29
30
|
// An entry or a shared chunk: an entry's bytes import its chunks by a relative name, so both
|
|
30
31
|
// have to answer at the one base path, under the one cache rule.
|
package/src/mcp-host.ts
CHANGED
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
import { join } from 'node:path';
|
|
10
10
|
import {
|
|
11
11
|
agentActor,
|
|
12
|
+
isRole,
|
|
12
13
|
isUltimateError,
|
|
13
14
|
NotImplementedError,
|
|
15
|
+
ROLES,
|
|
14
16
|
renderFixShellArg,
|
|
15
17
|
renderThrowable,
|
|
16
18
|
UltimateError,
|
|
@@ -213,6 +215,71 @@ export function testRunArgv(filter: string | undefined): readonly string[] {
|
|
|
213
215
|
return ['bun', 'test', filter];
|
|
214
216
|
}
|
|
215
217
|
|
|
218
|
+
/**
|
|
219
|
+
* `db.migrate`'s answer to a foreign throw. The fix is the REGISTERED one (`mcp-errors.ts`), never
|
|
220
|
+
* a literal here: this said `x db reset`, and an agent that followed it wiped the database the
|
|
221
|
+
* migration had failed against.
|
|
222
|
+
*/
|
|
223
|
+
export function migrateFailed(error: unknown): UltimateError {
|
|
224
|
+
return new UltimateError({
|
|
225
|
+
code: 'X_DB_MIGRATE_FAILED',
|
|
226
|
+
// The blessed total renderer: `String(error)` runs the value's own `toString`, and this is
|
|
227
|
+
// the last hop before an agent is handed the three-line result.
|
|
228
|
+
cause: renderThrowable(error),
|
|
229
|
+
fix:
|
|
230
|
+
explainErrorCode('X_DB_MIGRATE_FAILED')?.fix ?? 'x errors explain X_DB_MIGRATE_FAILED --json',
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* The log `logs.tail` reads. `role` is joined into a path, so it must BE a role: `'../x'` named a
|
|
236
|
+
* file outside the state directory. The tool's schema lists the roles, but a schema is advice to a
|
|
237
|
+
* client and this is the line that opens the file.
|
|
238
|
+
*/
|
|
239
|
+
export function logTailPath(dir: string, role: string | undefined): string {
|
|
240
|
+
if (role === undefined) return join(dir, 'dev.log');
|
|
241
|
+
if (!isRole(role)) {
|
|
242
|
+
throw new BadFlagError({
|
|
243
|
+
flag: 'role',
|
|
244
|
+
command: 'mcp serve',
|
|
245
|
+
reason: `logs.tail's role "${role}" is not a runtime role`,
|
|
246
|
+
fix: `logs.tail({ role: 'web' }) # role is one of ${ROLES.join(', ')}; none reads dev.log`,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
return join(dir, 'logs', `${role}.log`);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** The first window read from a log's end; each further one is four times wider. */
|
|
253
|
+
const TAIL_WINDOW_BYTES = 64 * 1024;
|
|
254
|
+
/** The most a tail ever reads: past this, lines that long are cut rather than the log loaded. */
|
|
255
|
+
const TAIL_MAX_BYTES = 1024 * 1024;
|
|
256
|
+
|
|
257
|
+
/** What `tailLines` reads of a file: its size and a byte range — `Bun.file`'s own shape. */
|
|
258
|
+
export interface TailSource {
|
|
259
|
+
readonly size: number;
|
|
260
|
+
slice(start: number, end: number): { text(): Promise<string> };
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* The last `lines` lines, read from the END in widening windows. `file.text()` loaded the whole
|
|
265
|
+
* `dev.log` per call, and an agent calls this in a loop against a log `x dev` never rotates. A
|
|
266
|
+
* window that does not start at byte 0 drops its first line: it may be partial, and may begin
|
|
267
|
+
* mid-character.
|
|
268
|
+
*/
|
|
269
|
+
export async function tailLines(file: TailSource, lines: number): Promise<readonly string[]> {
|
|
270
|
+
let window = TAIL_WINDOW_BYTES;
|
|
271
|
+
for (;;) {
|
|
272
|
+
const start = Math.max(0, file.size - Math.min(window, TAIL_MAX_BYTES));
|
|
273
|
+
const all = (await file.slice(start, file.size).text()).trimEnd().split('\n');
|
|
274
|
+
const whole = start === 0 ? all : all.slice(1);
|
|
275
|
+
if (whole.length >= lines || start === 0) return whole.slice(-lines);
|
|
276
|
+
// At the cap with no newline inside it, the one line there is longer than the cap: answered
|
|
277
|
+
// cut, never as `[]` — an empty tail reads as an empty log.
|
|
278
|
+
if (window >= TAIL_MAX_BYTES) return (whole.length === 0 ? all : whole).slice(-lines);
|
|
279
|
+
window *= 4;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
216
283
|
function capabilities(
|
|
217
284
|
input: DevHostInput,
|
|
218
285
|
lazy: LazyServices,
|
|
@@ -249,13 +316,7 @@ function capabilities(
|
|
|
249
316
|
// code/cause/fix result, which is what an agent needs to act without a round trip. The
|
|
250
317
|
// engine's own errors already carry that shape and pass through untouched.
|
|
251
318
|
if (isUltimateError(error)) throw error;
|
|
252
|
-
throw
|
|
253
|
-
code: 'X_DB_MIGRATE_FAILED',
|
|
254
|
-
// The blessed total renderer: `String(error)` runs the value's own `toString`, and
|
|
255
|
-
// this is the last hop before an agent is handed the three-line result.
|
|
256
|
-
cause: renderThrowable(error),
|
|
257
|
-
fix: 'x db reset',
|
|
258
|
-
});
|
|
319
|
+
throw migrateFailed(error);
|
|
259
320
|
}
|
|
260
321
|
// The ledger is the evidence for "applied" — never the migrator's own return value.
|
|
261
322
|
const pending = await pendingIds(root, lazy);
|
|
@@ -292,7 +353,7 @@ function capabilities(
|
|
|
292
353
|
|
|
293
354
|
async tailLogs(lines: number, role: string | undefined) {
|
|
294
355
|
const dir = lazy.services.stateDir;
|
|
295
|
-
const path =
|
|
356
|
+
const path = logTailPath(dir, role);
|
|
296
357
|
const file = Bun.file(path);
|
|
297
358
|
if (!(await file.exists())) {
|
|
298
359
|
// `@ultimat3/core`'s `logger` is a module const with no sink seam, so there is nothing to
|
|
@@ -305,7 +366,7 @@ function capabilities(
|
|
|
305
366
|
: `mkdir -p ${renderFixShellArg(join(dir, 'logs'), '<the logs dir of the path the cause names>')} && x dev --role ${role} > ${path} 2>&1`,
|
|
306
367
|
});
|
|
307
368
|
}
|
|
308
|
-
return (
|
|
369
|
+
return tailLines(file, lines);
|
|
309
370
|
},
|
|
310
371
|
|
|
311
372
|
async readManifest() {
|
package/src/pwa-artifacts.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
import type { AssetPath } from '@ultimat3/render';
|
|
32
32
|
import { assetPathProblem } from '@ultimat3/render';
|
|
33
33
|
import { loadAppConfig } from './app-config-load';
|
|
34
|
+
import { assetRouteMeta } from './asset-route-meta';
|
|
34
35
|
import { hasSourceIcon, iconPlan, iconRenderer } from './icon-assets';
|
|
35
36
|
import type { AppLocales } from './pwa-manifest-locales';
|
|
36
37
|
import { appLocales, localeMembers, spellIn } from './pwa-manifest-locales';
|
|
@@ -253,13 +254,12 @@ export const pwaManifestRoute = (artifacts: PwaArtifacts): Route => ({
|
|
|
253
254
|
path: WEB_MANIFEST_PATH,
|
|
254
255
|
// `'path'`: `/en/manifest.webmanifest` reaches this route with its prefix split off and `en` as the
|
|
255
256
|
// locale, and the bare path is the default locale's — never negotiated, so a CDN may cache both.
|
|
256
|
-
meta: {
|
|
257
|
+
meta: assetRouteMeta({
|
|
257
258
|
name: 'assets.manifest',
|
|
258
259
|
auth: 'public',
|
|
259
260
|
cache: MANIFEST_CACHE,
|
|
260
|
-
tags: ['assets'],
|
|
261
261
|
localeSource: 'path',
|
|
262
|
-
},
|
|
262
|
+
}),
|
|
263
263
|
handler: async (_request: UltimateRequest, ctx: RequestContext): Promise<Response> =>
|
|
264
264
|
applyCacheHeaders(
|
|
265
265
|
// `textResponse` for the length it declares: `compress` reads nothing undeclared.
|
package/src/runtime-assets.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
variantKey,
|
|
20
20
|
variantRevision,
|
|
21
21
|
} from '@ultimat3/storage';
|
|
22
|
+
import { assetRouteMeta } from './asset-route-meta';
|
|
22
23
|
import { faviconRoute } from './favicon';
|
|
23
24
|
// The icon matrix's source, its base path and its renderer live in their own module so that
|
|
24
25
|
// `pwa-artifacts.ts` — which this file imports for the manifest route — can reach them without
|
|
@@ -260,7 +261,7 @@ export function assetRoutes(options: AssetRoutesOptions): readonly Route[] {
|
|
|
260
261
|
const routes: Route[] = plan.entries.map((entry) => ({
|
|
261
262
|
method: 'GET',
|
|
262
263
|
path: entry.outputPath,
|
|
263
|
-
meta: { name: `assets.icon.${entry.spec.filename}`, auth: 'public'
|
|
264
|
+
meta: assetRouteMeta({ name: `assets.icon.${entry.spec.filename}`, auth: 'public' }),
|
|
264
265
|
// Revalidated, never `immutable` (22.3.2): the file name is the icon's SIZE, so a new
|
|
265
266
|
// `icon.png` shipped under the same URLs and every client that had seen the old one kept it for
|
|
266
267
|
// a year. The manifest and the apple-touch links name these paths, so a hashed URL would move
|
|
@@ -277,6 +278,8 @@ export function assetRoutes(options: AssetRoutesOptions): readonly Route[] {
|
|
|
277
278
|
routes.push({
|
|
278
279
|
method: 'GET',
|
|
279
280
|
path: `${MEDIA_BASE_PATH}/*key`,
|
|
281
|
+
// Tagged `assets` (the retained-build lookup reads the tag) but NOT on the `assets` bucket: an
|
|
282
|
+
// authenticated storage read per request is not a content-hashed chunk, so it stays `default`.
|
|
280
283
|
meta: {
|
|
281
284
|
name: 'assets.media',
|
|
282
285
|
auth: 'required',
|
package/src/site-asset-routes.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
parseByteRange,
|
|
13
13
|
RANGE_UNSATISFIABLE,
|
|
14
14
|
} from '@ultimat3/http';
|
|
15
|
+
import { assetRouteMeta } from './asset-route-meta';
|
|
15
16
|
import type { SiteAsset, SiteAssetTable } from './site-assets';
|
|
16
17
|
import { parseHashedAssetUrl, SITE_ASSET_BASE_PATH } from './site-assets';
|
|
17
18
|
|
|
@@ -65,7 +66,7 @@ export function siteAssetRoutes(table: SiteAssetTable): readonly Route[] {
|
|
|
65
66
|
{
|
|
66
67
|
method: 'GET',
|
|
67
68
|
path: `${SITE_ASSET_BASE_PATH}/*file`,
|
|
68
|
-
meta: { name: 'assets.site', auth: 'public'
|
|
69
|
+
meta: assetRouteMeta({ name: 'assets.site', auth: 'public' }),
|
|
69
70
|
handler: (request: UltimateRequest): Response => {
|
|
70
71
|
const named = parseHashedAssetUrl(request.pathname);
|
|
71
72
|
if (named === undefined) {
|
package/src/style-routes.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import type { Route, UltimateRequest } from '@ultimat3/http';
|
|
7
7
|
import { applyCacheHeaders, jsonResponse, NO_STORE, textResponse } from '@ultimat3/http';
|
|
8
|
+
import { assetRouteMeta } from './asset-route-meta';
|
|
8
9
|
import type { StyleBundle } from './style-bundle';
|
|
9
10
|
import { STYLE_BASE_PATH } from './style-bundle';
|
|
10
11
|
|
|
@@ -28,7 +29,7 @@ export function styleRoutes(source: StyleSource): readonly Route[] {
|
|
|
28
29
|
{
|
|
29
30
|
method: 'GET',
|
|
30
31
|
path: `${STYLE_BASE_PATH}/*file`,
|
|
31
|
-
meta: { name: 'assets.style', auth: 'public'
|
|
32
|
+
meta: assetRouteMeta({ name: 'assets.style', auth: 'public' }),
|
|
32
33
|
handler: (request: UltimateRequest): Response => {
|
|
33
34
|
const chunk = source().chunkAt(request.pathname);
|
|
34
35
|
if (chunk === undefined) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// The source text of `bindsLocally()`, spliced into each shipped guard that refuses a call to a
|
|
2
2
|
// global by name (`confirm(`, `fetch(`, `setInterval(`): a file that declares its own binding of
|
|
3
|
-
// that name calls its own function, never the global.
|
|
4
|
-
//
|
|
3
|
+
// that name calls its own function, never the global. `String.raw` keeps the regexes as written;
|
|
4
|
+
// the text holds no backtick and is ASCII only: Bun escapes `—` and `String.raw` keeps `\u2014`.
|
|
5
5
|
|
|
6
6
|
export const LOCAL_BINDING_SOURCE = String.raw`const DECLARED = /\b(?:const|let|var|class|function\s*\*?)\s+([A-Za-z_$][\w$]*)/g;
|
|
7
7
|
const ARROW_PARAMETER = /(?<![\w$.])([A-Za-z_$][\w$]*)\s*=>/g;
|
|
8
8
|
const IMPORT_CLAUSE = /\bimport\s+([^;]*?)\bfrom\b/g;
|
|
9
|
-
/** A name an import clause binds: 'a', '{ a }', '* as a', '{ b as a }'
|
|
9
|
+
/** A name an import clause binds: 'a', '{ a }', '* as a', '{ b as a }', never the 'b' of 'b as a'. */
|
|
10
10
|
const IMPORTED = /(?<![\w$])([A-Za-z_$][\w$]*)(?![\w$])(?!\s+as\b)/g;
|
|
11
11
|
const IDENTIFIER = /(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$])/g;
|
|
12
12
|
/** After a pattern's closing bracket: '=' closes a destructuring, '=>' or a body a parameter list. */
|
|
@@ -57,7 +57,7 @@ const inPattern = (text: string, at: number, name: string): boolean => {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
* Whether the file binds 'name' itself
|
|
60
|
+
* Whether the file binds 'name' itself (declared, imported, a parameter or destructured), so a
|
|
61
61
|
* bare 'name(' is its own function and not the global. File-wide, not scoped: a guard is a regex.
|
|
62
62
|
*/
|
|
63
63
|
const bindsLocally = (text: string, name: string): boolean => {
|
|
@@ -277,9 +277,12 @@ export function rawRepoSql(files: readonly RepoFile[]): readonly Finding[] {
|
|
|
277
277
|
export const guard: Guard = {
|
|
278
278
|
summary: 'a repo.ts reads through the typed handle, never a sql literal the handle can express',
|
|
279
279
|
async check(_root, sources) {
|
|
280
|
-
// The run's ONE read of these files: every guard asking for this glob shares the walk.
|
|
281
|
-
|
|
282
|
-
|
|
280
|
+
// The run's ONE read of these files: every guard asking for this glob shares the walk. A
|
|
281
|
+
// \`repo-<part>.ts\` is the same repo split at the file ceiling, so it is read too — but not a
|
|
282
|
+
// \`repo-<part>.test.ts\`, which the same glob reaches and whose fixture SQL is no repo's.
|
|
283
|
+
const repos = await sources.files('{apps,packages}/**/repo{,-*}.ts');
|
|
284
|
+
const read = repos.filter((file) => !file.path.endsWith('.test.ts'));
|
|
285
|
+
return rawRepoSql(read.map((file) => ({ path: file.path, source: file.text })));
|
|
283
286
|
},
|
|
284
287
|
};
|
|
285
288
|
`;
|
package/src/worker-bundle.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { dirname, join, relative } from 'node:path';
|
|
9
9
|
import type { Route, UltimateRequest } from '@ultimat3/http';
|
|
10
10
|
import { applyCacheHeaders, jsonResponse, NO_STORE, textResponse } from '@ultimat3/http';
|
|
11
|
+
import { assetRouteMeta } from './asset-route-meta';
|
|
11
12
|
import { FrameworkScriptBuildFailedError, type FrameworkScriptKind } from './errors';
|
|
12
13
|
import { describeBuildError, graphHash, stripDebugId } from './island-identity';
|
|
13
14
|
|
|
@@ -204,7 +205,7 @@ function scriptRoute(
|
|
|
204
205
|
return {
|
|
205
206
|
method: 'GET',
|
|
206
207
|
path: `${basePath}/:file`,
|
|
207
|
-
meta: { name, auth: 'public'
|
|
208
|
+
meta: assetRouteMeta({ name, auth: 'public' }),
|
|
208
209
|
handler: (request: UltimateRequest): Response => {
|
|
209
210
|
const script = source();
|
|
210
211
|
if (script === undefined || script.url !== request.pathname) {
|
|
@@ -315,14 +315,14 @@ export const db = database(entities, { driver });
|
|
|
315
315
|
| Raw `sql` | Where |
|
|
316
316
|
|---|---|
|
|
317
317
|
| belongs | a `query`'s source, built with `from()`; a migration |
|
|
318
|
-
| is the exception | a `repo.ts`, for what the handle cannot say: a join, an aggregate, a CTE, a window. Its unit test runs [the migrated-database recipe](Testing#database-state-and-what-a-run-leaves-behind): the handle's `testDriver()` follows the installed client, so the handle's writes and the join meet in one database |
|
|
319
|
-
| is refused | a `repo.ts`, for `select *` / `insert` / `update` / `delete` on one table, and `select * … where id = ? for update` (`db.<table>.lock(id, fn)`) |
|
|
318
|
+
| is the exception | a `repo.ts` or a `repo-<part>.ts`, for what the handle cannot say: a join, an aggregate, a CTE, a window. Its unit test runs [the migrated-database recipe](Testing#database-state-and-what-a-run-leaves-behind): the handle's `testDriver()` follows the installed client, so the handle's writes and the join meet in one database |
|
|
319
|
+
| is refused | a `repo.ts` or a `repo-<part>.ts`, for `select *` / `insert` / `update` / `delete` on one table, and `select * … where id = ? for update` (`db.<table>.lock(id, fn)`) |
|
|
320
320
|
| is refused, any statement | `order by date_trunc('milliseconds', …)`: the index cannot serve it. `keyset()` pages at the column's own precision |
|
|
321
321
|
|
|
322
322
|
| Enforced by | What fails |
|
|
323
323
|
|---|---|
|
|
324
324
|
| `tsc` | `db.widgets` exists only when `widget` is in the set; a renamed column is an error in the repo |
|
|
325
|
-
| `guards/repo-raw-sql.ts` — `X_REPO_RAW_SQL`, `boundaries` step | a `sql` literal in a `repo.ts` the handle can express; the `fix:` is the handle call |
|
|
325
|
+
| `guards/repo-raw-sql.ts` — `X_REPO_RAW_SQL`, `boundaries` step | a `sql` literal in a `repo.ts` or a `repo-<part>.ts` the handle can express; the `fix:` is the handle call |
|
|
326
326
|
| `X_DB_HANDLE_UNREGISTERED` — `x g entity`, `x g resource` | a `client.ts` with no `const <set> = { … }` passed to `database()`, or an `index.ts` that does not export the handle; the `fix:` is the lines to add |
|
|
327
327
|
|
|
328
328
|
### Paging a raw join
|
package/wiki/Interface-Rules.md
CHANGED
|
@@ -276,13 +276,13 @@ a `fix:` — documented where its subject is: [Entities and migrations](Entities
|
|
|
276
276
|
|
|
277
277
|
| Rule | Refused by | The `fix:` it names |
|
|
278
278
|
|---|---|---|
|
|
279
|
-
| A `repo.ts` reads through the typed handle | `guards/repo-raw-sql.ts` — a `sql` literal the handle can express: `select *`, `insert`, `update` or `delete` on one table, plain comparisons | the handle call: `db.posts.where({ orgId }).orderBy('createdAt', 'desc').limit(limit).all()` |
|
|
279
|
+
| A `repo.ts` or a `repo-<part>.ts` reads through the typed handle | `guards/repo-raw-sql.ts` — a `sql` literal the handle can express: `select *`, `insert`, `update` or `delete` on one table, plain comparisons | the handle call: `db.posts.where({ orgId }).orderBy('createdAt', 'desc').limit(limit).all()` |
|
|
280
280
|
|
|
281
281
|
| Not a finding | Why |
|
|
282
282
|
|---|---|
|
|
283
283
|
| a join, an aggregate, a CTE, a window, an `or`, a function call | the handle has no word for it; raw SQL in the repo is the answer |
|
|
284
284
|
| a statement composed from another `sql` fragment | composition, not one statement |
|
|
285
|
-
| `sql` in a `query`'s source, a migration, a comment or a string | only a tagged template in a `repo.ts` is read |
|
|
285
|
+
| `sql` in a `query`'s source, a migration, a comment or a string | only a tagged template in a `repo.ts` or a `repo-<part>.ts` is read |
|
|
286
286
|
|
|
287
287
|
A sheet that defines its own `@function rem` / `fluid` or `@mixin respond-*` is refused by
|
|
288
288
|
`raw-length` and `raw-breakpoint`: Sass lets a module that forwards the tokens redefine one with no
|
package/wiki/Project-Layout.md
CHANGED
|
@@ -64,7 +64,7 @@ Enforcement, not vigilance:
|
|
|
64
64
|
| A `shared/` module exceeding its own byte budget | build error, so `shared/ui` cannot silently fatten |
|
|
65
65
|
| `site/` route emitting >0kb JS without an explicit `hydrate` | build error |
|
|
66
66
|
| `app/` → `api/` | **types only** (`import type`); a runtime import is a build error, call the typed client instead |
|
|
67
|
-
| routes → DB | build error. Routes call actions/queries; only `repo.ts` touches the DB |
|
|
67
|
+
| routes → DB | build error. Routes call actions/queries; only `repo.ts` or a `repo-<part>.ts` touches the DB |
|
|
68
68
|
| components → business logic | build error via the feature-slice rule below |
|
|
69
69
|
| services → HTTP | build error. A service that knows about requests cannot be reused by a job |
|
|
70
70
|
|
|
@@ -99,7 +99,7 @@ apps/web/app/<feature>/ui/ # component
|
|
|
99
99
|
| File | Owns | Never — and the error |
|
|
100
100
|
|---|---|---|
|
|
101
101
|
| `entity.ts` | table + domain type + invariants | I/O, policy |
|
|
102
|
-
| `repo.ts` | the feature's reads and writes, through the typed handle | a raw SQL literal the handle can express — `guards/repo-raw-sql.ts` |
|
|
102
|
+
| `repo.ts` or a `repo-<part>.ts` | the feature's reads and writes, through the typed handle | a raw SQL literal the handle can express — `guards/repo-raw-sql.ts` |
|
|
103
103
|
| `service.ts` | business logic, composed from repos | an HTTP import — `X_BOUNDARY_SERVICE_TO_HTTP` |
|
|
104
104
|
| `page.tsx` · `layout.tsx` | a URL | a database import — `X_BOUNDARY_ROUTE_TO_DB` |
|
|
105
105
|
| `actions/` | `action` / `mutator` declarations, one per file | logic (delegate to `service.ts`) |
|
|
@@ -108,7 +108,7 @@ apps/web/app/<feature>/ui/ # component
|
|
|
108
108
|
| `policy.ts` | `policy` rules for this feature | data shaping |
|
|
109
109
|
| `ui/` | Solid components | fetching, business logic, its own authz |
|
|
110
110
|
|
|
111
|
-
A feature imports another feature through that feature's `service.ts` or its published types, never its `repo.ts` — a convention, **not a build error** (`As of 2026-10-06`: no boundary rule reads it from a `service.ts`). A **route** importing any `repo.ts` is a build error, `X_BOUNDARY_ROUTE_TO_DB`; `x new`'s own dashboard reads through the `postList` query (`../post/live/post-list`).
|
|
111
|
+
A feature imports another feature through that feature's `service.ts` or its published types, never its `repo.ts` — a convention, **not a build error** (`As of 2026-10-06`: no boundary rule reads it from a `service.ts`). A **route** importing any `repo.ts` or a `repo-<part>.ts` is a build error, `X_BOUNDARY_ROUTE_TO_DB`; `x new`'s own dashboard reads through the `postList` query (`../post/live/post-list`).
|
|
112
112
|
|
|
113
113
|
## App packages
|
|
114
114
|
|
package/wiki/Upgrading.md
CHANGED
|
@@ -197,7 +197,17 @@ A setter still on a package's `.` barrel is `X_ADAPTER_PORT_INCOMPLETE` on the `
|
|
|
197
197
|
| `x exercise` reports `X_AUDIT_SINK_MISSING` (`X_QUERY_AUDIT_SINK_MISSING` for a query) on every `audit: true` primitive, and `x build` lists each page whose render runs one under `unmeasured`: entry 43 moved `auditSink` into `runtime.ts`, and neither pass installs `runtime.ts` | fixed in **31.2.0**: both read `apps/<app>/runtime.ts` through the boot's own loader, a memory sink standing in for the declared one so neither writes to it. On 31.0.0–31.1.0, install a memory sink at the top of `apps/web/exercise.ts` and `apps/web/prerender.ts` — `installAuditSink(memoryAuditSink())`, `installAuditSink` from `@ultimat3/core/adapter`, `memoryAuditSink` from `@ultimat3/action`; on 31.2.0, delete it |
|
|
198
198
|
| `defineFactory` (`@ultimat3/testing`, entry 40) widens a string literal in `defaults` or a trait to `string`, so an `enumerated([…])` column is TS2322 — `Type 'string' is not assignable to type '"closed" \| "open"'` | `'open' as const` on the literal. Fixed in **31.2.0**: from it, an `as const` or per-literal annotation added for this TS2322 can be deleted — kept, it is harmless |
|
|
199
199
|
| `disk('<name>')` is `X_STORAGE_DISK_UNKNOWN` for a disk your own `defineStorage({ disks: { … } })` declares, when an app module reached from `runtime.ts` makes that call: the boot installed its one-disk registry over it | fixed in **31.2.0**: the boot keeps a registry the app declared, and the app's `defineStorage()` wins over `runtime.storage`. Upgrade to it; no workaround is verified for 31.0.0–31.1.0 |
|
|
200
|
-
| `
|
|
200
|
+
| `@ultimat3/auth/schema` (**31.4.0**) exports `AUTH_TABLES`, `AUTH_TABLE_NAMES`, `AUTH_SERVER_TABLES`, `SQL_AUTH_SERVER_TABLES`, `SQL_AUTH_LIMIT_TABLES` and `SQL_TOTP_REPLAY_TABLE` and imports no auth runtime; `@ultimat3/auth` still exports all six | nothing. Optional: a module that reads only those names (a schema reader, a migrate-only script) imports them from `@ultimat3/auth/schema` and stops loading the auth barrel |
|
|
201
|
+
| `defineError` is exported from `@ultimat3/core/page` (**31.4.1**), and the refreshed `error-declared` guard refuses it imported from `@ultimat3/core`: `X_ERROR_DECLARED` at the import line. Through the barrel, every island that throws an app code carried both framework titles tables: 12,019 B against 6,507 B for one declaration thrown (`As of 2026-11`: Bun 1.4.4, minified) | `import { defineError } from '@ultimat3/core/page'` — the same function, so the swap is the import line only. A `/* @__PURE__ */` or `"sideEffects": false` added to keep the table out is no longer needed for that. `x new` and `x g` write the `./page` import from 31.4.1 |
|
|
202
|
+
| `x doctor` and `x upgrade` list up to twelve guards as differing from the shipped template after the **31.4.1** hop (`x doctor --json`: `.data.guards.differs[].refresh`). 31.4.1 changed `native-confirm`, `raw-fetch`, `raw-interval`, `unzoned-date`, `semantic-interactive`, `image-dimensions`, `untranslated-string`, `raw-motion`, `undeclared-custom-property`, `undefined-style-class`, `error-declared` and `bare-error` (its `fix:` now names `@ultimat3/core/page`). Your `guards/` copy is the app's own: `x upgrade` never rewrites it | `x g guard <name> --force` per name — it rewrites `guards/<name>.ts` **and** `guards/<name>.test.ts`, so review the diff and keep any rule you edited on purpose. Then `x verify` |
|
|
203
|
+
| after that refresh, `x verify`'s `boundaries` step reports findings the old guards never saw — all of them already in your code: `X_IMAGE_DIMENSIONS`, `X_SEMANTIC_INTERACTIVE` or `X_UNTRANSLATED_STRING` in `apps/*/shared/**/*.tsx` (the three scanned only `site/` and `app/`); `X_RAW_MOTION` on a raw duration or `cubic-bezier()` assigned to a custom property (`--my-ease: cubic-bezier(0, 0, 1, 1)`); `X_UNDECLARED_CUSTOM_PROPERTY` at a stylesheet that does not compile, `X_UNDEFINED_STYLE_CLASS` at the `.tsx` line importing one — while any sheet fails, `undeclared-custom-property` reports only the broken sheets and checks no `var()` read | fix each where its `fix:` points: the `shared/` component as you would in `app/`; `--my-ease: #{tokens.easing(out)}` for a motion value; the Sass at the compiler error the cause quotes. Then re-run `x verify` — a repaired sheet can surface the `var()` reads it was hiding |
|
|
204
|
+
| the same refresh drops findings that were false: a file's own function named `confirm`, `fetch` or `setInterval` (a declaration, import, parameter or destructured name), `Intl.DateTimeFormat().resolvedOptions().timeZone`, and a `role="option"` with `tabIndex={-1}` | nothing — a rename made only to quiet one of them can be reverted |
|
|
205
|
+
| `x doctor` lists `native-confirm`, `raw-fetch` and `raw-interval` as differing from the shipped template after the **31.4.2** hop: their copy from 31.4.1 shows `\u2014` where two comments meant a dash. Comments only; the rule is the same | optional: `x g guard native-confirm --force`, `x g guard raw-fetch --force`, `x g guard raw-interval --force` |
|
|
206
|
+
| `x doctor` lists `repo-raw-sql` as differing from the shipped template after the **31.5.0** hop: the guard now also reads a `repo-<part>.ts` (a `repo.ts` split at the file ceiling, e.g. `repo-window.ts`) and skips `*.test.ts`; `x verify`'s `boundaries` step may report `X_REPO_RAW_SQL` in a split repo it never read before, and a route importing `repo-<part>` is now `X_BOUNDARY_ROUTE_TO_DB` like one importing `repo` | `x g guard repo-raw-sql --force` — it rewrites `guards/repo-raw-sql.ts` **and** its `.test.ts`, so review the diff and keep any rule you edited on purpose. Then `x verify` |
|
|
207
|
+
| `undeclared-custom-property` and `undefined-style-class` report `<sheet> does not compile: asset("assets/…") ran with no site asset table installed` on 31.4.1 for a sheet that calls Sass `asset()` and builds fine (on 31.4.0, `undeclared-custom-property` passed the whole app on nothing instead). From **31.4.2** a guard's compile resolves `asset()` through the site asset table the build uses, so the sheet compiles and an `asset()` naming a file missing from `apps/web/site/assets/` is still the finding. The fix is in `@ultimat3/cli`'s `GuardSources`, not in a template | nothing to refresh. Delete any placeholder asset table you installed around a guard to work around it, then `x verify` |
|
|
208
|
+
| built, content-hashed asset routes spend the new `assets` rate-limit bucket (**31.5.0**: 2,000 burst, 200/s), not `default`. An app that lowered `rateLimit.buckets.default` to throttle its static files no longer throttles them that way | to tighten static routes, set `rateLimit: { buckets: { assets: { capacity, refillPerSecond } } }` in `app.config.ts`. Nothing to do otherwise |
|
|
209
|
+
| `rateLimit.buckets` in `app.config.ts` merges over the shipped buckets key by key (**31.5.0**). Before, any `buckets` you declared replaced the whole table, so `auth`, `mutation` and `assets` were gone and routes naming them used `default` | nothing. A bucket you declared still wins under its own name; delete any copy of a shipped bucket you kept only so it would not disappear |
|
|
210
|
+
| a `from(entity, fn)` provider's function receives a `RowWindow` (**31.5.0**), `{ after, limit, order, filters }`, the page the read is after | nothing: a function that ignores the argument behaves as before. Optional: a repository that reads its own top N reads `after` and `limit` instead, so later pages are not empty or short |
|
|
201
211
|
|
|
202
212
|
## 29.x → 30.0.0, entry by entry
|
|
203
213
|
|
|
@@ -461,7 +471,7 @@ Only an app that relied on the old behaviour has anything to do:
|
|
|
461
471
|
| `x jobs show` / `inspectJob(driver, id).input` is `'[redacted]'` for a job name this process has not registered with `job()` | to read such a payload, register the job again (a stub `job({ name, input: t.json(), … })`) in the process that inspects it |
|
|
462
472
|
| a field marked `.sensitive()` (last in the chain) is masked in the audit record and `x jobs show`; one reachable from an action `output` or a query `rows` fails boot with `X_SCHEMA_SENSITIVE_OUTPUT` | optional: mark what must never be written down. An app's own `logger.info('x', input)` is not covered: keep `redactKeys` or a `Secret` there |
|
|
463
473
|
| every builtin schema refusal carries `rule` (`SCHEMA_RULES`) and `params`, on the wire and on `FormIssue` | key a form's `messageFor` on `issue.rule`, not the English `issue.message`; keep a fallback, since a third-party schema library sends no `rule` |
|
|
464
|
-
| app codes declare with `defineError({ code, title, status \| offSocket, cause, fix })` from `@ultimat3/core`, which registers the status in the same call | optional: replace `class X extends UltimateError` with `defineError`; `X.is(error)` replaces `instanceof`, and a base class becomes a code prefix. `x g guard error-declared` adds the guard that keeps it so; `x g guard bare-error --force` refreshes the bare-error guard's fix. An app code with no status still answers 500 |
|
|
474
|
+
| app codes declare with `defineError({ code, title, status \| offSocket, cause, fix })` from `@ultimat3/core`, which registers the status in the same call | optional: replace `class X extends UltimateError` with `defineError`; `X.is(error)` replaces `instanceof`, and a base class becomes a code prefix. `x g guard error-declared` adds the guard that keeps it so; `x g guard bare-error --force` refreshes the bare-error guard's fix. An app code with no status still answers 500. From 31.4.1 the import is `@ultimat3/core/page` ([the `31.0.0` section's table](#not-breaking-but-you-will-see-it)) |
|
|
465
475
|
| the Sentry envelope carries `fingerprint: [errorFingerprint(report)]` | nothing: each existing issue reopens once under its new group. A reporter of your own groups the same way with `errorFingerprint(report)` |
|
|
466
476
|
| OTLP export retries 429, 502, 503, 504 and a transport failure, inside the exporter's `timeoutMs` (default 10 s) | lower `timeoutMs` if a shorter hold on the in-flight batch matters more than delivery. A collector that accepted a batch then answered 503 receives it twice; span ids dedupe it |
|
|
467
477
|
| `X_DEV_ALREADY_RUNNING`'s fix is `x stop --json` | a script that killed `x dev` by pid calls `x stop --json`, which returns once the next `x dev` can boot |
|