@ultimat3/cli 31.15.0 → 31.16.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/README.md +1 -1
- package/package.json +29 -29
- package/src/cmd-doctor.ts +47 -37
- package/src/cmd-exercise.ts +14 -1
- package/src/cmd-upgrade.ts +19 -2
- package/src/coverage-floor.ts +2 -2
- package/src/doctor-env-reserved.ts +111 -0
- package/src/doctor-floor.ts +62 -0
- package/src/doctor-pins.ts +101 -0
- package/src/doctor-probe.ts +21 -1
- package/src/doctor-row-security.ts +119 -4
- package/src/doctor-warnings.ts +55 -0
- package/src/error-codes-doctor.ts +24 -0
- package/src/error-codes.ts +5 -0
- package/src/exercise-floor-report.ts +138 -0
- package/src/exercise-floor-verdict.ts +98 -0
- package/src/exercise-floor.ts +158 -0
- package/src/mcp-errors.ts +10 -0
- package/src/messages-upgrade.ts +13 -0
- package/src/messages.ts +3 -0
- package/src/templates/scaffold-verify-floor.ts +4 -0
- package/src/test-dotenv.ts +15 -2
- package/src/upgrade-coverage.ts +109 -0
- package/src/upgrade-document.ts +18 -0
- package/src/upgrade-exercise-floor.ts +53 -0
- package/src/upgrade-gate.ts +68 -25
- package/src/upgrade-guards.ts +159 -0
- package/src/upgrade-report.ts +29 -1
- package/src/verify-checks.ts +3 -1
- package/src/verify-floor.ts +13 -0
- package/wiki/CLI-Reference.md +26 -3
- package/wiki/Configuration.md +16 -0
- package/wiki/Testing.md +64 -2
- package/wiki/Upgrading.md +3 -0
package/src/verify-floor.ts
CHANGED
|
@@ -11,6 +11,8 @@ import { ERROR_DOCS_URL, renderThrowable } from '@ultimat3/core';
|
|
|
11
11
|
import { AGENTS_MD_MAX_BYTES } from '@ultimat3/manifest';
|
|
12
12
|
import type { CoverageFloor } from './coverage-floor';
|
|
13
13
|
import { COVERAGE_FIELD, readCoverageFloor } from './coverage-floor';
|
|
14
|
+
import type { ExerciseFloor } from './exercise-floor';
|
|
15
|
+
import { EXERCISE_FIELD, readExerciseFloor } from './exercise-floor';
|
|
14
16
|
import type { Finding } from './output';
|
|
15
17
|
import type { StepTimeouts } from './verify-deadline';
|
|
16
18
|
import { readStepTimeouts, STEP_TIMEOUT_FIELD } from './verify-deadline';
|
|
@@ -75,6 +77,11 @@ export interface VerifyFloor {
|
|
|
75
77
|
* whole `x verify` under `CI`. Absent is no ceiling, and a CI run names the number to write.
|
|
76
78
|
*/
|
|
77
79
|
readonly skipCeiling?: SkipCeiling;
|
|
80
|
+
/**
|
|
81
|
+
* What the `exercise` step's pass may leave unproven (`exercise-floor.ts`). Absent is a warning
|
|
82
|
+
* naming the figure to write, never red: an app that has not opted in stays green on `main`.
|
|
83
|
+
*/
|
|
84
|
+
readonly exercise?: ExerciseFloor;
|
|
78
85
|
/** Why part of the file is not a floor. The `manifest` step reports these; nothing swallows them. */
|
|
79
86
|
readonly problems: readonly string[];
|
|
80
87
|
}
|
|
@@ -194,6 +201,7 @@ export function parseVerifyFloor(
|
|
|
194
201
|
const coverage = readCoverageFloor(record);
|
|
195
202
|
const rolling = readRollingSince(record);
|
|
196
203
|
const skips = readSkipCeiling(record, declared);
|
|
204
|
+
const exercise = readExerciseFloor(record);
|
|
197
205
|
const rest = {
|
|
198
206
|
...(budget.budget === undefined ? {} : { agentsMdMaxBytes: budget.budget }),
|
|
199
207
|
...(typecheckBin.bin === undefined ? {} : { typecheckBin: typecheckBin.bin }),
|
|
@@ -202,6 +210,7 @@ export function parseVerifyFloor(
|
|
|
202
210
|
...(coverage.coverage === undefined ? {} : { coverage: coverage.coverage }),
|
|
203
211
|
...(rolling.since === undefined ? {} : { rollingSince: rolling.since }),
|
|
204
212
|
...(skips.ceiling === undefined ? {} : { skipCeiling: skips.ceiling }),
|
|
213
|
+
...(exercise.floor === undefined ? {} : { exercise: exercise.floor }),
|
|
205
214
|
};
|
|
206
215
|
const steps = record?.['steps'];
|
|
207
216
|
if (!Array.isArray(steps)) {
|
|
@@ -217,6 +226,7 @@ export function parseVerifyFloor(
|
|
|
217
226
|
...coverage.problems,
|
|
218
227
|
...rolling.problems,
|
|
219
228
|
...skips.problems,
|
|
229
|
+
...exercise.problems,
|
|
220
230
|
],
|
|
221
231
|
};
|
|
222
232
|
}
|
|
@@ -237,6 +247,7 @@ export function parseVerifyFloor(
|
|
|
237
247
|
...coverage.problems,
|
|
238
248
|
...rolling.problems,
|
|
239
249
|
...skips.problems,
|
|
250
|
+
...exercise.problems,
|
|
240
251
|
],
|
|
241
252
|
};
|
|
242
253
|
}
|
|
@@ -330,5 +341,7 @@ const fixFor = (problem: string): string => {
|
|
|
330
341
|
return `x doctor --json # it names your newest migration id: set "${ROLLING_SINCE_FIELD}" in ${VERIFY_FLOOR_FILE} to that, "0" to judge them all, or drop the key`;
|
|
331
342
|
if (problem.includes(`"${SKIP_CEILING_FIELD}"`))
|
|
332
343
|
return `x verify --json # then write "${SKIP_CEILING_FIELD}" in ${VERIFY_FLOOR_FILE} as { "contract": 9 } — a step it runs, a whole number of tests`;
|
|
344
|
+
if (problem.includes(`"${EXERCISE_FIELD}`))
|
|
345
|
+
return `x exercise --json # then write "${EXERCISE_FIELD}" in ${VERIFY_FLOOR_FILE} as { "unprovenMax": 0, "statementsMax": 100 } — a ratio from 0 to 1, a whole number of statements`;
|
|
333
346
|
return `x verify --json # then write ${VERIFY_FLOOR_FILE} as {"steps":["unit","contract"]}, naming only steps it ran`;
|
|
334
347
|
};
|
package/wiki/CLI-Reference.md
CHANGED
|
@@ -637,6 +637,7 @@ below on `--workers` and batching describe 22.6 and earlier where they differ.
|
|
|
637
637
|
| `steps` | steps this repo may never report as skipped (`X_VERIFY_SUITE_VANISHED`) |
|
|
638
638
|
| `coverage` | `{ "lines", "funcs", "why"?, "exclude"?: [{ "glob", "why" }] }` — the floor the `unit` step holds an app's whole source tree to (`X_COVERAGE_BELOW_FLOOR`, `X_COVERAGE_FLOOR_UNSTATED`, `X_COVERAGE_FLOOR_STALE`) → [Testing](Testing#coverage). `x doctor` prints every `exclude` |
|
|
639
639
|
| `stepTimeoutMs` | `{ "<step>": milliseconds }` — a step's own deadline. Default 8 minutes for the six suites, 5 for every other step; past it the step is `X_VERIFY_STEP_TIMEOUT` and its processes are killed |
|
|
640
|
+
| `exercise` | `{ "unprovenMax"?: <0–1>, "statementsMax"?: <whole ≥ 1> }` — what the `exercise` step's pass may leave unproven, and statements per call (`X_EXERCISE_UNPROVEN_ABOVE_FLOOR`, `X_STATEMENTS_OVER_BUDGET`); absent, each is a warning line → [`x exercise`](#x-exercise), `As of 31.16.0` |
|
|
640
641
|
| `isolate` · `typecheckBin` · `agentsMdMaxBytes` | a fresh global per test file · the `tsc`-compatible binary · the `AGENTS.md` byte budget |
|
|
641
642
|
|
|
642
643
|
Either render prints one line per finished step on **stderr** — `{"step":"lint","ok":true,"ms":21987}` —
|
|
@@ -1207,6 +1208,15 @@ It also lists the shipped guards the app's `guards/` does not hold, and the ones
|
|
|
1207
1208
|
|
|
1208
1209
|
A listing, never a finding: deleting or editing a guard is how an app changes a rule, so the verdict does not move.
|
|
1209
1210
|
|
|
1211
|
+
Four warnings about how the app is held, `As of 31.16.0` — beside the verdict, never in it: the exit status, `findings` and `data.codes` stay as they were, and `--json` carries each as `data.warnings[]` (`{ code, cause, fix, docs, at }`). None is a gate step; on `next` they join the verdict, red:
|
|
1212
|
+
|
|
1213
|
+
| Code | Asked | Fix |
|
|
1214
|
+
|---|---|---|
|
|
1215
|
+
| `X_DB_ROW_SECURITY_OFF` | `database.rowSecurity` is off and a raw `` sql`…` `` (or `` Bun.sql`…` ``, `` tx.sql`…` ``, `raw('…')`, `identifier('…')`) outside migrations, seeds and tests names a tenant table — up to five sites listed. Off with no raw tenant SQL is not reported | `database: { rowSecurity: true }` in `app.config.ts`, then `x db gen "row security" && x db migrate` |
|
|
1216
|
+
| `X_VERIFY_STEP_UNFLOORED` | a gate step applies here — its suite files exist, its input is committed — and `x.verify.json` `"steps"` does not hold it, so a deleted suite reads as skipped. `e2e` is never proposed (the scaffold's placeholder skips until a browser driver is registered) | `x verify --only <steps> --json`, then add each step that passed to `"steps"` |
|
|
1217
|
+
| `X_FRAMEWORK_PIN_RANGE` | an `@ultimat3/*` dependency in any of the app's manifests is anything but an exact version or a `workspace:`/`file:`/`link:` path (`^31.0.0`, `*`, `latest`, `>=31 <32`; an `npm:` alias by its own spec), one finding per manifest | the exact version `bun install` resolved, at the line named; then `bun install` |
|
|
1218
|
+
| `X_ENV_NAME_RESERVED` | a name the app declares in `envSchema` or seals in `secrets.enc.json` is one `FRAMEWORK_ENV` (`@ultimat3/core`) lists as a `switch` or `internal` name — setting it for the app also switches that package's behaviour. Deploy-contract names (`DATABASE_URL`, `PORT`) and host names are not collisions | rename it `APP_<name>` (or delete it where the value is meant for the framework); then `x env example` |
|
|
1219
|
+
|
|
1210
1220
|
**The chart's monitoring templates**, the same way (`As of 2026-11`): an app with a `docker/helm/Chart.yaml` and no `templates/servicemonitor.yaml` or `templates/alert-rules.yaml` gets one line per missing file, then `x g chart-alerts`, which writes only those (`--json`: `data.chartAlerts`, `{ missing[], add }`). A chart that dropped them on purpose keeps a green verdict; an app with no chart is listed nothing.
|
|
1211
1221
|
|
|
1212
1222
|
The embedded half is the bare-VM case: the external-database probe answers nothing the moment `DATABASE_URL` is unset, and that silence *is* the configuration a fresh box has. So `x doctor` also asks whether `@electric-sql/pglite` resolves from the app root — a resolve, never an import, because loading it boots the WASM build and takes the single-writer lock the next command needs. Red only where both hold: `DATABASE_URL` unset **and** the peer unresolvable, reported as `X_DB_UNAVAILABLE` with `@ultimat3/db`'s own sentence and its own runnable fix ([Bare VM](Bare-VM)). The snapshot half is `As of 2026-08` and separate from drift on purpose: they are two questions with two remedies, and `x db gen`'s own `X_MIGRATION_SNAPSHOT_MISSING` was a condition this diagnostic could not see at all, so `x doctor --json` — the `fix:` of the `X_CLI_UNEXPECTED` an author reaches it through — ran clean over a broken app.
|
|
@@ -1388,7 +1398,18 @@ A blank `off` reason is `X_CONTRACT_EXERCISE_UNDECLARED`; so is an `exercise.ts`
|
|
|
1388
1398
|
exactly its findings, plus the static half of the tenant proof: an entity with no tenant column
|
|
1389
1399
|
that references one with a tenant and declares no `shared` reason.
|
|
1390
1400
|
|
|
1391
|
-
|
|
1401
|
+
**The `exercise` floor** (`As of 31.16.0`). `x exercise` and the gate step judge the pass against
|
|
1402
|
+
`x.verify.json`'s `exercise` key ([Configuration](Configuration#the-gates-file--xverifyjson)). Without the key every
|
|
1403
|
+
judgement below is a warning line (`! …`, and `data.warnings[]` under `--json`) naming the figure to
|
|
1404
|
+
write, and the run stays green; with it, above a declared figure is red.
|
|
1405
|
+
|
|
1406
|
+
| Judged | Red, once opted in | Warning otherwise |
|
|
1407
|
+
|---|---|---|
|
|
1408
|
+
| unproven ÷ reached — a tenant, crash or scale proof that could not ask | `X_EXERCISE_UNPROVEN_ABOVE_FLOOR`, naming the first three | the ratio, rounded up, to write as `unprovenMax`; also when it fell under the floor, naming the lower figure |
|
|
1409
|
+
| a sized-seed table the database refused | `X_EXERCISE_SEED_FAILED`, one per table, naming the entity, the driver's words and its readers — red exactly when the unproven ratio is | the same finding as a line |
|
|
1410
|
+
| one call over its statement ceiling — `statementsMax`, or the entry's own `statements: { max, why }` | `X_STATEMENTS_OVER_BUDGET`, the busiest call and its three largest shapes | the same finding as a line, judged at 100 |
|
|
1411
|
+
|
|
1412
|
+
Errors: `X_CONTRACT_EXERCISE_UNREACHED`, `X_CONTRACT_EXERCISE_UNDECLARED`, `X_DECLARATION_UNKNOWN`, `X_CLI_BAD_FLAG`, `X_EXERCISE_UNPROVEN_ABOVE_FLOOR`, `X_EXERCISE_SEED_FAILED`, `X_STATEMENTS_OVER_BUDGET`.
|
|
1392
1413
|
|
|
1393
1414
|
## x drill
|
|
1394
1415
|
|
|
@@ -1554,7 +1575,7 @@ One major per run, so each hop's gate attributes its red to that hop. `As of 30.
|
|
|
1554
1575
|
| 3 | `bun pm view @ultimat3/cli versions`: the next major's newest; the last major's newest when no later major exists | `X_UPGRADE_REGISTRY_UNREACHABLE`, `X_UPGRADE_HOP_TOO_WIDE`, `X_UPGRADE_VERSION_UNPUBLISHED`, `X_BUN_VERSION` |
|
|
1555
1576
|
| 4 | write exact pins, raise the Bun floor | — |
|
|
1556
1577
|
| 5 | `bun install` | `X_UPGRADE_INSTALL_FAILED`, `fix:` carries the undo |
|
|
1557
|
-
| 6 | the installed CLI: `x manifest`, `x doctor --json`, `x exercise --json
|
|
1578
|
+
| 6 | the installed CLI: `x manifest`, `x doctor --json`, each missing guard (`x g guard <name>`, kept only when `x verify --only boundaries` finds nothing more), a Bun-floor hop's `x verify --only unit` coverage rebaseline, `x exercise --json` and its `exercise` floor figures, `x verify --json` | `X_UPGRADE_GATE_UNREADABLE`, as a finding on a red hop |
|
|
1558
1579
|
|
|
1559
1580
|
A dry run refuses exactly what the real run would, then stops before step 4. It never commits; `git diff` is the hop. Under `--json` fd 1 is one document, fd 2 a `{"upgrade":"<stage>"}` line per stage and a heartbeat a minute.
|
|
1560
1581
|
|
|
@@ -1572,7 +1593,9 @@ A dry run refuses exactly what the real run would, then stops before step 4. It
|
|
|
1572
1593
|
| `pins[]` | `{ file, name, from, to }` |
|
|
1573
1594
|
| `bun` | `{ from, to, edited[], manual[] }`. `manual[]`: `{ path, line, text, why }`, a site only you can move, listed on every run |
|
|
1574
1595
|
| `agentsMd` | `link`: `AGENTS.md` was byte-identical to `CLAUDE.md` and the hop makes it a relative symlink to it · `linked`: already one · `differs`: two different files, left alone; merge what only `AGENTS.md` says into `CLAUDE.md`, then `ln -sf CLAUDE.md AGENTS.md` · `none`: one of the two is missing · `null`: no hop planned |
|
|
1575
|
-
| `guards` | `{ reported, missing[], differs[] }` from the hop's own `x doctor`.
|
|
1596
|
+
| `guards` | `{ reported, missing[], differs[], installed[], withheld[] }` from the hop's own `x doctor`. `As of 31.16.0` each missing shipped guard is written from the installed release's template and kept when `boundaries` finds nothing more with it on disk: `installed[]` names it. One the tree already breaks is taken back out: `withheld[]` is `{ name, add, findings }` (`findings: null` when the count could not be measured) and `missing[]` still lists it. `differs[]` — the app's edit or an older copy — is never overwritten: `x g guard <name> --force` is yours. `reported: false` is a CLI too old to list them, which is not the same as none |
|
|
1597
|
+
| `coverage` | a hop that moved the Bun floor re-measures unit coverage (`x verify --only unit`); only when that measurement is `X_COVERAGE_BELOW_FLOOR` is the `x.verify.json` `coverage` floor moved to it, the number that fell alone, with a dated `why`: `{ file, measured, from, to, why }`. `null` when nothing moved |
|
|
1598
|
+
| `exerciseFloor` | `{ file, written }`: the `exercise` keys (`unprovenMax`, `statementsMax` ≥ 100) the hop's own `x exercise` measured, written into an `x.verify.json` that stated none, so the hop stays green and the floor only falls. A key the app already wrote is never touched; `null` when nothing was written |
|
|
1576
1599
|
| `manifest` | `{ ok, findings[] }`. A failure does not stop the gate |
|
|
1577
1600
|
| `exercise` | `{ reported, ok, findings[] }` from the hop's own `x exercise --json`, listed (and printed) before the gate's findings; each `fix` pastes as written. `reported: false`: the hop's CLI answered no exercise document — unknown, never a finding |
|
|
1578
1601
|
| `verify` | `{ ok, summary, failed[], findings[] }`, each finding `{ step?, code, cause, fix, at? }` |
|
package/wiki/Configuration.md
CHANGED
|
@@ -775,6 +775,7 @@ Rules:
|
|
|
775
775
|
| `X_ENV_MISSING` is one key, `X_CONFIG_INVALID` is the shape | absent or malformed key → `X_ENV_MISSING` at the `defineEnv` gate. Keys that each parse but contradict each other → `X_CONFIG_INVALID`. The two never overlap |
|
|
776
776
|
| No runtime mutation | config is frozen after `defineConfig`; there is no `setConfig` |
|
|
777
777
|
| Same image, all environments | only env differs. That is what makes staging a real rehearsal ([Deployment](Deployment)) |
|
|
778
|
+
| An app's own name is not a framework name | `FRAMEWORK_ENV` (`@ultimat3/core`) lists every name the framework reads. An app name on one it reads as a switch or for itself (`OTEL_*`, `TEST_DATABASE_URL`, any `ULTIMATE_*`) is `X_ENV_NAME_RESERVED` in `x doctor`, `As of 31.16.0`: rename it `APP_<name>`. An adapter's settings (`S3_*`, `SMTP_URL`, `CLOUDFLARE_*`) are the contract, never reported: declaring them is how an app configures that adapter |
|
|
778
779
|
|
|
779
780
|
## The environment — `resolveEnvironment()`
|
|
780
781
|
|
|
@@ -864,6 +865,21 @@ x doctor --json # env + connectivity + version checks
|
|
|
864
865
|
x verify --json # the gate
|
|
865
866
|
```
|
|
866
867
|
|
|
868
|
+
## The gate's file — `x.verify.json`
|
|
869
|
+
|
|
870
|
+
Not configuration of the app: what `x verify` holds it to, committed at the repo root. Every key is in [CLI reference](CLI-Reference#x-verify); the `exercise` key, `As of 31.16.0`:
|
|
871
|
+
|
|
872
|
+
| Key | Value | Absent |
|
|
873
|
+
|---|---|---|
|
|
874
|
+
| `exercise.unprovenMax` | a ratio from 0 to 1: how many reached primitives the exercise pass may leave `unproven` (`X_EXERCISE_UNPROVEN_ABOVE_FLOOR` above it) | a warning line naming the figure to write; the step stays green |
|
|
875
|
+
| `exercise.statementsMax` | a whole number ≥ 1: statements one call may send, for every primitive whose `defineExercise` entry declares no `statements: { max, why }` (`X_STATEMENTS_OVER_BUDGET` above it) | judged at 100, as a warning line |
|
|
876
|
+
|
|
877
|
+
```json
|
|
878
|
+
{ "exercise": { "unprovenMax": 0, "statementsMax": 100 } }
|
|
879
|
+
```
|
|
880
|
+
|
|
881
|
+
`x new` writes exactly that; `x upgrade` writes the figures the hop measured into a file that states none, so the floor only falls. A malformed value is a `manifest`-step problem naming the shape → [CLI reference](CLI-Reference#x-exercise).
|
|
882
|
+
|
|
867
883
|
`x config show` is **planned**, not shipped — it throws `X_NOT_IMPLEMENTED` naming `x manifest --json` as the closest thing today → [CLI reference](CLI-Reference).
|
|
868
884
|
|
|
869
885
|
Error shapes: [Error codes](Error-Codes). Symptom-first fixes: [Troubleshooting](Troubleshooting). Metrics, spans and logs: [Observability](Observability).
|
package/wiki/Testing.md
CHANGED
|
@@ -1118,13 +1118,13 @@ Source: `packages/testing/src/scale-sweep*.ts`, `plan-oracle.ts`, `plan-sweep*.t
|
|
|
1118
1118
|
|
|
1119
1119
|
| Sweep | What | Red |
|
|
1120
1120
|
|---|---|---|
|
|
1121
|
-
| scale | every reached primitive once more in a tenant at 2 rows a table, once in one at 8; per statement shape, the counts compared. Each sized seed is written beside the graph before it: row positions (a generated integer, a factory's `index`) continue past that graph's, so ``code: `c${index}` `` on a unique column never repeats the pass's own row | a shape sent more often at 8: `X_QUERY_SCALES_WITH_ROWS`, fix `preload()` or `expectedQueryLoop('<why>', fn)` |
|
|
1121
|
+
| scale | every reached primitive once more in a tenant at 2 rows a table, once in one at 8; per statement shape, the counts compared. Each sized seed is written beside the graph before it: row positions (a generated integer, a factory's `index`) continue past that graph's, so ``code: `c${index}` `` on a unique column never repeats the pass's own row | a shape sent more often at 8 than at 2, where it was sent at least once: `X_QUERY_SCALES_WITH_ROWS`, fix `preload()` or `expectedQueryLoop('<why>', fn)`. A shape sent only at 8, nothing else grown, is another path (a branch on the handed row), `unproven` (`As of 31.16.0`); the 8-row graph opens on the 2-row graph's values in every non-unique column, so the handed row is the same at both sizes |
|
|
1122
1122
|
| plans | every distinct statement whose first relation is an app table, `PREPARE`d and explained as a generic plan with `enable_seqscan`, `enable_bitmapscan` off — and, for a statement with a `Limit`, planned again with `enable_sort` off for its sort alone — in a read-only transaction | `Seq Scan`, or an index scan with no `Index Cond` no `Limit` stops: `X_QUERY_UNINDEXED`. `Sort` under `Limit`: `X_QUERY_SORT_UNSERVED`, on the table its key names. Each prints an `indexes:` entry, one per arm for an `or`; a sort no declarable index serves (an expression, an aggregate, a derived column, keys across tables, mixed directions) or an index the entity already declares prints a rewrite or `expectedSeqScan` instead |
|
|
1123
1123
|
|
|
1124
1124
|
With the planner's scans and sorts disabled it picks one only when no index can answer, so the
|
|
1125
1125
|
verdict reads the schema on empty tables — no volume, no statistics. Never red: `scale.verdict`
|
|
1126
1126
|
`flat` (a declared loop listed in `expected` with its reason) or `unproven` (a call that did not
|
|
1127
|
-
answer at both sizes); a statement whose equality pins a unique key; one a partial index serves once
|
|
1127
|
+
answer at both sizes, or took another path at 8); a statement whose equality pins a unique key; one a partial index serves once
|
|
1128
1128
|
its value is bound; a whole read beside a join whose join column leads a declared index on that
|
|
1129
1129
|
side, while the other side is bound by its own key — on empty tables a partial index the statement
|
|
1130
1130
|
implies looks like one row, so the planner walks it rather than probe it per row (`As of
|
|
@@ -1137,6 +1137,68 @@ under `expectedSeqScan('<why>', fn)` or on an entity with `scan: '<why>'`
|
|
|
1137
1137
|
x db gen posts-orgId-createdAt-id-index # after indexes: [{ on: ['orgId', 'createdAt', 'id'] }] in entity("posts")
|
|
1138
1138
|
```
|
|
1139
1139
|
|
|
1140
|
+
**Seed isolation** (`As of 31.16.0`). A sized-seed table the database refuses — usually a unique
|
|
1141
|
+
column the default factory repeats — is that table's failure alone: the primitives whose statements
|
|
1142
|
+
read it are `unproven`, the failure on their `scale.seed` (`{ entity, cause }`), and every other
|
|
1143
|
+
primitive is still scale-judged. `scaleSeedFindings(records)` folds them into one
|
|
1144
|
+
`X_EXERCISE_SEED_FAILED` per table, naming the entity, the driver's words and up to ten readers; the
|
|
1145
|
+
fix is the factory to declare. Before, one refused table left every primitive `unproven` with the
|
|
1146
|
+
same reason.
|
|
1147
|
+
|
|
1148
|
+
```ts
|
|
1149
|
+
import { entity, text, uuid } from '@ultimat3/entity';
|
|
1150
|
+
import { defineExercise, defineFactory } from '@ultimat3/testing';
|
|
1151
|
+
|
|
1152
|
+
const posts = entity('posts', {
|
|
1153
|
+
columns: { id: uuid().primaryKey(), slug: text({ max: 80 }).unique() },
|
|
1154
|
+
});
|
|
1155
|
+
|
|
1156
|
+
export const exercise = defineExercise(
|
|
1157
|
+
{},
|
|
1158
|
+
{ factories: { posts: defineFactory(posts, { defaults: (index) => ({ slug: `post-${index}` }) }) } },
|
|
1159
|
+
);
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
### The statement ceiling
|
|
1163
|
+
|
|
1164
|
+
`As of 31.16.0`. The scale sweep judges growth; this judges the count. One call of an action, query
|
|
1165
|
+
or job may send `STATEMENTS_MAX` — 100 — statements; the busiest of its calls is the one judged,
|
|
1166
|
+
never the runs' sum. Over it the record carries `statementCeiling: { verdict: 'over', statements,
|
|
1167
|
+
max, top }` — `top` its three most-sent shapes, what a `preload()` would fold — and
|
|
1168
|
+
`statementCeilingFindings(records)` reports `X_STATEMENTS_OVER_BUDGET`. A flat 300-statement call is
|
|
1169
|
+
never `X_QUERY_SCALES_WITH_ROWS`, and it is still slow.
|
|
1170
|
+
|
|
1171
|
+
Only statements no `expectedQueryLoop` declared are counted, as in the scale sweep: the loop's reason
|
|
1172
|
+
is its argument. A `backfill()` pass writes every row it visits under the factory's own loop, so a
|
|
1173
|
+
sweep over 500 seeded rows judges its page reads, never the seed's size; the excluded count is
|
|
1174
|
+
`statementCeiling.expected`, named in the finding.
|
|
1175
|
+
|
|
1176
|
+
One primitive's ceiling, raised or lowered with a reason; a blank `why` (or none) is
|
|
1177
|
+
`X_CONTRACT_EXERCISE_UNDECLARED`, and `max` is a whole number ≥ 1:
|
|
1178
|
+
|
|
1179
|
+
```ts
|
|
1180
|
+
import { defineExercise } from '@ultimat3/testing';
|
|
1181
|
+
|
|
1182
|
+
export const exercise = defineExercise({
|
|
1183
|
+
importRows: { statements: { max: 140, why: 'one insert per line, bounded by the 140-line form' } },
|
|
1184
|
+
});
|
|
1185
|
+
```
|
|
1186
|
+
|
|
1187
|
+
### The floor: `unprovenMax` and `statementsMax`
|
|
1188
|
+
|
|
1189
|
+
What is red is `x.verify.json`'s call ([Configuration](Configuration#the-gates-file--xverifyjson)):
|
|
1190
|
+
`x exercise` and the gate's `exercise` step read its `exercise` key.
|
|
1191
|
+
|
|
1192
|
+
| Key | Red above it | Without the key |
|
|
1193
|
+
|---|---|---|
|
|
1194
|
+
| `unprovenMax` | `X_EXERCISE_UNPROVEN_ABOVE_FLOOR` — unproven ÷ reached, rounded up to four places, names the first three; the sized-seed findings behind it are red with it | a warning line naming the figure to write |
|
|
1195
|
+
| `statementsMax` | `X_STATEMENTS_OVER_BUDGET` for every primitive over it whose entry declares no `statements` (an entry's own ceiling stands) | the ceiling is 100 and each finding is a warning line |
|
|
1196
|
+
|
|
1197
|
+
`x new` writes `{ "unprovenMax": 0, "statementsMax": 100 }`. An app scaffolded before 31.16.0 stays
|
|
1198
|
+
green with warnings until it opts in, and `x upgrade` writes the figures its hop measured — the
|
|
1199
|
+
busiest undeclared call, never under 100 — so the floor starts where the app is. A figure the run
|
|
1200
|
+
beats is a warning naming the lower number: the floor only falls.
|
|
1201
|
+
|
|
1140
1202
|
## Memory, width and isolation
|
|
1141
1203
|
|
|
1142
1204
|
`As of 22.7`. The gate is built for the machines it runs on — 8-16 GB, 2-8 cores, often two agents'
|
package/wiki/Upgrading.md
CHANGED
|
@@ -267,6 +267,9 @@ A setter still on a package's `.` barrel is `X_ADAPTER_PORT_INCOMPLETE` on the `
|
|
|
267
267
|
| a `postgresVectorStore` search runs in a read-only transaction that widens the HNSW scan (**31.15.0**: `hnsw.iterative_scan = relaxed_order` on pgvector ≥ 0.8, else `hnsw.ef_search = max(40, k × 10)`), 2–3 round trips where it was 1, so a small tenant gets `k` hits | nothing. On pgvector < 0.8, upgrade the extension for the cheaper iterative scan |
|
|
268
268
|
| `x build --target static` writes `.br` (brotli 11) and `.gz` (gzip 9) siblings beside each island chunk and stylesheet (**31.15.0**), and the app brand ships at the end of each surface stylesheet instead of an inline `<style>` | a static host may serve the siblings (nginx `gzip_static on;` / `brotli_static on;`, Caddy `file_server { precompressed br gzip }`, with `Vary: Accept-Encoding`) or ignore them — [Static assets](Static-Assets#precompressed-siblings-in-a-static-export). A hand-written CSP that allowed the brand's `sha256` may drop it |
|
|
269
269
|
| a cacheable `ssr` document (not `no-store`) carries a strong content `ETag` and answers `If-None-Match` with `304` (**31.15.0**); every document sends a `Link` header (stylesheet preload + the modulepreloads its tags name) a CDN turns into 103 Early Hints | nothing. A test that expected `200` to `If-None-Match: *` on such a page expects `304` |
|
|
270
|
+
| `x exercise` and `x verify`'s `exercise` step print `X_EXERCISE_UNPROVEN_ABOVE_FLOOR`, `X_EXERCISE_SEED_FAILED` and `X_STATEMENTS_OVER_BUDGET` as **warning lines** (**31.16.0**): one call over 100 statements, or primitives left `unproven`, in an app whose `x.verify.json` has no `exercise` key. The step stays green; each is red only once the key opts in | nothing. `x upgrade` to 31.16.0 writes the figures the hop's own `x exercise` measured (`"exercise": { "unprovenMax": <measured>, "statementsMax": <busiest call, ≥ 100> }`), so the hop stays green and the floor only falls; `x new` writes the strict `{ "unprovenMax": 0, "statementsMax": 100 }`. A primitive that needs more statements per call: `defineExercise({ <name>: { statements: { max: <n>, why: '<why one call sends that many>' } } })` in `apps/web/exercise.ts` |
|
|
271
|
+
| `x upgrade` writes files it used to print (**31.16.0**): each missing shipped guard whose rule the tree already meets is installed as `guards/<name>.ts` (+ its test), and a hop that moves the Bun floor rewrites `x.verify.json`'s `coverage` floor to the measurement, with a dated `why`, when unit coverage measured under it. Both are in the hop's diff and in `--json` (`data.guards.installed` / `data.guards.withheld`, `data.coverage`) | review the diff before committing it. A guard you do not want: delete its file. A withheld guard is listed with its finding count and the `x g guard <name>` that adds it |
|
|
272
|
+
| `x doctor` prints four new **warnings** (**31.16.0**): `X_DB_ROW_SECURITY_OFF`, `X_VERIFY_STEP_UNFLOORED`, `X_FRAMEWORK_PIN_RANGE`, `X_ENV_NAME_RESERVED`, one line each under `N warning(s)` and in `--json` as `data.warnings[]` (`{ code, cause, fix, docs, at }`). Its exit status, `findings` and `data.codes` are unchanged, so a CI step or `x upgrade` hop running `x doctor` stays green; they join the verdict (red) on the next major, `next`. `x verify` is unchanged — none of them is a gate step | nothing now. Before the next major, clear them: each warning's `fix:` is the edit. A reserved env name: rename it to `APP_<name>` in `envSchema` (or `x secrets edit`); an unfloored step: `x verify --only <steps> --json`, then add each step that passed to `"steps"` |
|
|
270
273
|
|
|
271
274
|
## 29.x → 30.0.0, entry by entry
|
|
272
275
|
|