@ultimat3/cli 31.40.1 → 31.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +29 -29
- package/src/codemods/index.ts +2 -0
- package/src/codemods/test-services.ts +31 -0
- package/src/dev-rebuild-isr.ts +8 -8
- package/src/dev-rebuild.ts +1 -1
- package/src/framework-schema-wait.ts +4 -0
- package/src/output.ts +11 -0
- package/src/templates/guard-released-forms.ts +4 -1
- package/src/templates/guard-undeclared-env.ts +44 -2
- package/src/verify-live.ts +23 -7
- package/src/verify-merge.ts +7 -1
- package/src/verify-part-step.ts +7 -2
- package/src/verify-run.ts +4 -1
- package/src/verify-skip-ceiling.ts +7 -1
- package/src/verify-step.ts +3 -1
- package/wiki/Routes-And-Render-Modes.md +2 -1
- package/wiki/Testing.md +6 -0
- package/wiki/Upgrading.md +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/cli",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.42.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.10",
|
|
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.42.0",
|
|
57
|
+
"@ultimat3/admin": "31.42.0",
|
|
58
|
+
"@ultimat3/ai": "31.42.0",
|
|
59
|
+
"@ultimat3/auth": "31.42.0",
|
|
60
|
+
"@ultimat3/cache": "31.42.0",
|
|
61
|
+
"@ultimat3/core": "31.42.0",
|
|
62
|
+
"@ultimat3/db": "31.42.0",
|
|
63
|
+
"@ultimat3/entity": "31.42.0",
|
|
64
|
+
"@ultimat3/flags": "31.42.0",
|
|
65
|
+
"@ultimat3/http": "31.42.0",
|
|
66
|
+
"@ultimat3/i18n": "31.42.0",
|
|
67
|
+
"@ultimat3/jobs": "31.42.0",
|
|
68
|
+
"@ultimat3/mail": "31.42.0",
|
|
69
|
+
"@ultimat3/manifest": "31.42.0",
|
|
70
|
+
"@ultimat3/mcp": "31.42.0",
|
|
71
|
+
"@ultimat3/money": "31.42.0",
|
|
72
|
+
"@ultimat3/notify": "31.42.0",
|
|
73
|
+
"@ultimat3/policy": "31.42.0",
|
|
74
|
+
"@ultimat3/pwa": "31.42.0",
|
|
75
|
+
"@ultimat3/query": "31.42.0",
|
|
76
|
+
"@ultimat3/realtime": "31.42.0",
|
|
77
|
+
"@ultimat3/render": "31.42.0",
|
|
78
|
+
"@ultimat3/schema": "31.42.0",
|
|
79
|
+
"@ultimat3/scraping": "31.42.0",
|
|
80
|
+
"@ultimat3/seo": "31.42.0",
|
|
81
|
+
"@ultimat3/storage": "31.42.0",
|
|
82
|
+
"@ultimat3/testing": "31.42.0",
|
|
83
|
+
"@ultimat3/time": "31.42.0",
|
|
84
84
|
"babel-preset-solid": "^1.9.16"
|
|
85
85
|
}
|
|
86
86
|
}
|
package/src/codemods/index.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { codemod as reproGitignore } from './repro-gitignore';
|
|
|
26
26
|
import { codemod as runtimePin } from './runtime-pin';
|
|
27
27
|
import { codemod as solidFloor } from './solid-floor';
|
|
28
28
|
import { codemod as testPorts } from './test-ports';
|
|
29
|
+
import { codemod as testServices } from './test-services';
|
|
29
30
|
import { codemod as testSuites } from './test-suites';
|
|
30
31
|
import { codemod as themeToggleMountOver } from './theme-toggle-mount-over';
|
|
31
32
|
import { codemod as vendoredGuards } from './vendored-guards';
|
|
@@ -61,4 +62,5 @@ export const CODEMODS: readonly Codemod[] = [
|
|
|
61
62
|
migrateJobOrdered,
|
|
62
63
|
ciServicesEnv,
|
|
63
64
|
docsEnvGuard,
|
|
65
|
+
testServices,
|
|
64
66
|
];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// 31.41.0: an app scaffolded before 31.27.0 gains the test-services stack `test-suites` and the
|
|
2
|
+
// `live` floor assume — `docker/docker-compose.test.yml` and `docker/test-services.env`, as `x new`
|
|
3
|
+
// writes them, under this app's own ports. A file the app already holds is its own.
|
|
4
|
+
|
|
5
|
+
import { names } from '../templates/naming';
|
|
6
|
+
import { testServicesFiles } from '../templates/scaffold-test-services';
|
|
7
|
+
import { appName } from './agents-dev-mcp';
|
|
8
|
+
import type { Codemod, CodemodResult } from './codemod';
|
|
9
|
+
import { mergeResults, readText, writeIfAbsent } from './engine-edits';
|
|
10
|
+
|
|
11
|
+
/** The live suite's host: an app with no db package has nothing for a test service to serve. */
|
|
12
|
+
const DB_HOST = 'packages/db/src/index.ts';
|
|
13
|
+
|
|
14
|
+
export const codemod: Codemod = {
|
|
15
|
+
id: 'test-services',
|
|
16
|
+
since: '31.41.0',
|
|
17
|
+
summary:
|
|
18
|
+
'the test-services stack a live suite needs, for an app scaffolded before it: docker/docker-compose.test.yml and docker/test-services.env',
|
|
19
|
+
async run(app) {
|
|
20
|
+
if (!(await app.exists(DB_HOST))) return { changed: [], skipped: [] };
|
|
21
|
+
const kebab = appName((await readText(app, 'package.json'))?.text ?? '');
|
|
22
|
+
if (kebab === undefined) return { changed: [], skipped: [] };
|
|
23
|
+
const results: CodemodResult[] = [];
|
|
24
|
+
for (const file of testServicesFiles(names(kebab))) {
|
|
25
|
+
if (typeof file.contents === 'string') {
|
|
26
|
+
results.push(await writeIfAbsent(app, file.path, file.contents));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return mergeResults(results);
|
|
30
|
+
},
|
|
31
|
+
};
|
package/src/dev-rebuild-isr.ts
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// request renders with the new module.
|
|
3
3
|
|
|
4
4
|
import { markAllInvalidated } from '@ultimat3/cache';
|
|
5
|
-
import type {
|
|
5
|
+
import type { IsrController } from '@ultimat3/render/server';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* the OLD module before the save samples its fence first; deleted paths alone left that fence
|
|
10
|
-
* valid
|
|
11
|
-
* `flushProcessTiers`: that also purges a CDN tier, the
|
|
8
|
+
* Forget every page a save made stale — after voiding every fill in flight. A render that began
|
|
9
|
+
* with the OLD module before the save samples its fence first; deleted paths alone left that fence
|
|
10
|
+
* valid (audit round 2), and a request after the save still JOINED that render's flight (round 3):
|
|
11
|
+
* `forgetAll` evicts the flights too. Never `flushProcessTiers`: that also purges a CDN tier, the
|
|
12
|
+
* real CDN when its keys are in `.env`.
|
|
12
13
|
*/
|
|
13
|
-
export async function clearIsrForRebuild(
|
|
14
|
+
export async function clearIsrForRebuild(isr: Pick<IsrController, 'forgetAll'>): Promise<void> {
|
|
14
15
|
markAllInvalidated();
|
|
15
|
-
|
|
16
|
-
for (const path of await store.paths()) await store.delete(path);
|
|
16
|
+
await isr.forgetAll();
|
|
17
17
|
}
|
package/src/dev-rebuild.ts
CHANGED
|
@@ -151,7 +151,7 @@ export function devRebuilder(
|
|
|
151
151
|
state.appFindings = findings;
|
|
152
152
|
state.islands = islands;
|
|
153
153
|
const unserved = await refreshDevices();
|
|
154
|
-
await clearIsrForRebuild(isr
|
|
154
|
+
await clearIsrForRebuild(isr);
|
|
155
155
|
state.reloads += 1;
|
|
156
156
|
// Read on EVERY rebuild, so a pin one save reached is never reported against the next save:
|
|
157
157
|
// this save's own pins name it, and only a save that reached none inherits the held ones.
|
|
@@ -94,6 +94,10 @@ export async function waitForSchema<T>(
|
|
|
94
94
|
let refuse: ((waitedMs?: number) => UltimateError) | undefined;
|
|
95
95
|
const drained = (): UltimateError => (refuse ?? waitDrained)(clock.monotonic() - startedAt);
|
|
96
96
|
try {
|
|
97
|
+
// A SIGTERM while the boot still loaded modules ran the `accept` phase before this hook existed,
|
|
98
|
+
// so its abort was never heard: refuse before the first read, which an unreachable database
|
|
99
|
+
// would hold past the pod's grace.
|
|
100
|
+
if (isDraining()) throw drained();
|
|
97
101
|
for (let attempt = 1; ; attempt += 1) {
|
|
98
102
|
// Raced against the drain like the sleep below: a read on an unreachable database hangs
|
|
99
103
|
// until the pool gives up — ~125 s on a worker, past the pod's grace, so SIGKILL (137).
|
package/src/output.ts
CHANGED
|
@@ -56,6 +56,9 @@ export interface SlowFile {
|
|
|
56
56
|
/** How many of a step's slowest files the human line names; `--json` carries all it has. */
|
|
57
57
|
export const SLOWEST_SHOWN = 3;
|
|
58
58
|
|
|
59
|
+
/** Whether a `live` step's test services answered (`StepResult.services`). */
|
|
60
|
+
export type TestServicesState = 'reached' | 'unavailable';
|
|
61
|
+
|
|
59
62
|
export interface StepResult {
|
|
60
63
|
readonly name: string;
|
|
61
64
|
readonly ok: boolean;
|
|
@@ -93,6 +96,12 @@ export interface StepResult {
|
|
|
93
96
|
* looking at (#434).
|
|
94
97
|
*/
|
|
95
98
|
readonly tests?: TestCounts;
|
|
99
|
+
/**
|
|
100
|
+
* The test services a `live` step needed, as the gate found them: `reached` (already up, found or
|
|
101
|
+
* started) or `unavailable` (the suites skipped). Absent for every other step. Carried into a
|
|
102
|
+
* part so `x verify merge` judges a skip as the run that made it saw its database.
|
|
103
|
+
*/
|
|
104
|
+
readonly services?: TestServicesState;
|
|
96
105
|
}
|
|
97
106
|
|
|
98
107
|
// `@ultimat3/schema`'s one declaration, re-exported for this package's callers — never restated.
|
|
@@ -364,6 +373,8 @@ export function renderJson(
|
|
|
364
373
|
// The counts the human line's `why()` renders, as numbers: a `--json` reader deciding whether
|
|
365
374
|
// a skipped lane is missing a suite or missing a prerequisite needs the same fact CI's log has.
|
|
366
375
|
...(step.tests === undefined ? {} : { tests: step.tests }),
|
|
376
|
+
// What a `live` step's database was: `x verify merge` reads it from the part to judge skips.
|
|
377
|
+
...(step.services === undefined ? {} : { services: step.services }),
|
|
367
378
|
// A FAILED step carries its captured stdout, exactly as the human renderer prints it. CI runs
|
|
368
379
|
// `--json`, and without this the log said only "one or more unit tests failed" with a generic
|
|
369
380
|
// fix line — the failing test's name and its assertion diff existed and were thrown away, so
|
|
@@ -70,7 +70,10 @@ export const RELEASED_GUARD_FORMS: Readonly<
|
|
|
70
70
|
['2xnl4zuy9xv6f', 'error'],
|
|
71
71
|
['3b0u9i8hze00x', 'error'],
|
|
72
72
|
],
|
|
73
|
-
'undeclared-env': [
|
|
73
|
+
'undeclared-env': [
|
|
74
|
+
['3gsy96z8bgrrl', 'error'],
|
|
75
|
+
['81vvl6xx5bb8', 'error'],
|
|
76
|
+
],
|
|
74
77
|
'undefined-style-class': [
|
|
75
78
|
['3food9t4vrzv8', 'error'],
|
|
76
79
|
['w7as1ib1ido8', 'error'],
|
|
@@ -47,7 +47,7 @@ const source =
|
|
|
47
47
|
// Read: \`process.env.X\`, \`Bun.env.X\`, \`import.meta.env.X\` and the \`['X']\` forms, in app source
|
|
48
48
|
// (\`apps/**\`, \`packages/**\`; never a test). Declared: a key of \`envSchema\` or of the object
|
|
49
49
|
// \`defineEnv({ … })\` is handed, in \`app.config.ts\` — the declaration \`x env check\` reads.
|
|
50
|
-
// Allowed: every name the framework reads itself, \`NODE_ENV\` among them.
|
|
50
|
+
// Allowed: every name the framework reads itself, \`NODE_ENV\` among them, and the OS's own.
|
|
51
51
|
|
|
52
52
|
import type { Finding, Guard } from '@ultimat3/cli';
|
|
53
53
|
|
|
@@ -113,6 +113,46 @@ export function declaredNames(config: string): ReadonlySet<string> {
|
|
|
113
113
|
return names;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/** The OS's own, set by the machine and never by a deploy: \`env: { PATH }\` for a child process. */
|
|
117
|
+
const AMBIENT = new Set(['HOME', 'HOSTNAME', 'LANG', 'PATH', 'PWD', 'SHELL', 'TMPDIR', 'USER']);
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Every string's CONTENTS blanked in place, so a name quoted in prose or data (a generated docs
|
|
121
|
+
* file) is no read. A template's \`\${…}\` stays code. A regex literal holding a quote reads as a
|
|
122
|
+
* string opening: the rest of that file then reports less, never something false.
|
|
123
|
+
*/
|
|
124
|
+
const codeOnly = (text: string): string => {
|
|
125
|
+
const out = text.split('');
|
|
126
|
+
const braces: number[] = [];
|
|
127
|
+
let quote = '';
|
|
128
|
+
for (let index = 0; index < out.length; index += 1) {
|
|
129
|
+
const character = text.charAt(index);
|
|
130
|
+
if (quote === '') {
|
|
131
|
+
const top = braces.length - 1;
|
|
132
|
+
if (character === "'" || character === '"' || character === '\`') quote = character;
|
|
133
|
+
else if (character === '{' && top >= 0) braces[top] = (braces[top] ?? 0) + 1;
|
|
134
|
+
else if (character === '}' && top >= 0) {
|
|
135
|
+
if ((braces[top] ?? 0) === 0) {
|
|
136
|
+
braces.pop();
|
|
137
|
+
quote = '\`';
|
|
138
|
+
} else braces[top] = (braces[top] ?? 0) - 1;
|
|
139
|
+
}
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (character === '\\\\') {
|
|
143
|
+
out[index] = ' ';
|
|
144
|
+
if (text.charAt(index + 1) !== '\\n') out[index + 1] = ' ';
|
|
145
|
+
index += 1;
|
|
146
|
+
} else if (character === quote) quote = '';
|
|
147
|
+
else if (quote === '\`' && character === '$' && text.charAt(index + 1) === '{') {
|
|
148
|
+
braces.push(0);
|
|
149
|
+
quote = '';
|
|
150
|
+
index += 1;
|
|
151
|
+
} else if (character !== '\\n') out[index] = ' ';
|
|
152
|
+
}
|
|
153
|
+
return out.join('');
|
|
154
|
+
};
|
|
155
|
+
|
|
116
156
|
const isFramework = (name: string): boolean =>
|
|
117
157
|
FRAMEWORK.has(name) || FRAMEWORK_PREFIXES.some((head) => name.startsWith(head));
|
|
118
158
|
|
|
@@ -122,9 +162,11 @@ export function undeclaredEnv(files: readonly SourceFile[], config: string): rea
|
|
|
122
162
|
const findings: Finding[] = [];
|
|
123
163
|
for (const file of files) {
|
|
124
164
|
const text = blank(file.source);
|
|
165
|
+
const code = codeOnly(text);
|
|
125
166
|
for (const match of text.matchAll(READ)) {
|
|
126
167
|
const name = match[1] ?? match[3] ?? '';
|
|
127
|
-
if (
|
|
168
|
+
if (code.charAt(match.index) === ' ') continue;
|
|
169
|
+
if (declared.has(name) || isFramework(name) || AMBIENT.has(name)) continue;
|
|
128
170
|
findings.push({
|
|
129
171
|
code: CODE,
|
|
130
172
|
cause: \`\${file.path}:\${lineOf(text, match.index)} reads \${match[0]}, which app.config.ts does not declare — x env check never asks for it, so a deploy without it boots and fails at the first read\`,
|
package/src/verify-live.ts
CHANGED
|
@@ -7,7 +7,12 @@ import type { Runner } from './exec';
|
|
|
7
7
|
import { msg } from './messages';
|
|
8
8
|
import { floorRequires, readVerifyFloor } from './verify-floor';
|
|
9
9
|
import type { LoginProbe, Probe } from './verify-services';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
ensureTestServices,
|
|
12
|
+
SERVICES_DOWN,
|
|
13
|
+
SERVICES_UP,
|
|
14
|
+
TEST_DATABASE_KEY,
|
|
15
|
+
} from './verify-services';
|
|
11
16
|
import type { StepOutcome, VerifyContext, VerifyStep } from './verify-step';
|
|
12
17
|
|
|
13
18
|
/** Whether this run asked for `live` by name or the committed floor holds it to running. */
|
|
@@ -24,6 +29,9 @@ function withEnv(ctx: VerifyContext, env: Readonly<Record<string, string>>): Ver
|
|
|
24
29
|
return { ...ctx, runner, env: { ...(ctx.env ?? Bun.env), ...env } };
|
|
25
30
|
}
|
|
26
31
|
|
|
32
|
+
/** The database answered, so a `live` test that skipped did so with one in reach. */
|
|
33
|
+
const reached = (outcome: StepOutcome): StepOutcome => ({ ...outcome, services: 'reached' });
|
|
34
|
+
|
|
27
35
|
const withWarning = (outcome: StepOutcome, warning: string): StepOutcome => ({
|
|
28
36
|
...outcome,
|
|
29
37
|
warnings: [...(outcome.warnings ?? []), warning],
|
|
@@ -47,15 +55,23 @@ export function withTestServices(step: VerifyStep, probe?: Probe, login?: LoginP
|
|
|
47
55
|
...(probe === undefined ? {} : { probe }),
|
|
48
56
|
...(login === undefined ? {} : { login }),
|
|
49
57
|
});
|
|
50
|
-
if (verdict.kind === 'ambient')
|
|
58
|
+
if (verdict.kind === 'ambient') {
|
|
59
|
+
// The caller's own URL is a database in reach; no stack and no URL is none.
|
|
60
|
+
const own = (ctx.env ?? Bun.env)[TEST_DATABASE_KEY];
|
|
61
|
+
const outcome = await step.run(ctx);
|
|
62
|
+
return own === undefined || own === '' ? outcome : reached(outcome);
|
|
63
|
+
}
|
|
51
64
|
if (verdict.kind === 'unavailable') {
|
|
52
65
|
const { code, cause, fix } = verdict.finding;
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
66
|
+
return {
|
|
67
|
+
...withWarning(
|
|
68
|
+
await step.run(ctx),
|
|
69
|
+
msg('cli.verify.services.unavailable', { code, cause, fix }),
|
|
70
|
+
),
|
|
71
|
+
services: 'unavailable',
|
|
72
|
+
};
|
|
57
73
|
}
|
|
58
|
-
const outcome = await step.run(withEnv(ctx, verdict.env));
|
|
74
|
+
const outcome = reached(await step.run(withEnv(ctx, verdict.env)));
|
|
59
75
|
// Whatever this run's `up` started, by compose's answer — a reachable Postgres beside a
|
|
60
76
|
// freshly started Redis still leaves containers running; a stack already up says nothing.
|
|
61
77
|
if (verdict.startedServices.length === 0) return outcome;
|
package/src/verify-merge.ts
CHANGED
|
@@ -344,7 +344,13 @@ function mergeStep(
|
|
|
344
344
|
// The ceiling on the SUM, always: a merge is the CI verdict, and one shard's skips say nothing.
|
|
345
345
|
const skips =
|
|
346
346
|
sharded.length > 0
|
|
347
|
-
? judgeSkips(name, tests, floor?.skipCeiling
|
|
347
|
+
? judgeSkips(name, tests, floor?.skipCeiling, {
|
|
348
|
+
// Every shard had its database: one that had none skipped by design, as a whole run would.
|
|
349
|
+
strictWithDatabase:
|
|
350
|
+
floor?.strict === true &&
|
|
351
|
+
required &&
|
|
352
|
+
sharded.every((entry) => entry.step.services === 'reached'),
|
|
353
|
+
})
|
|
348
354
|
: { findings: [], warnings: [] };
|
|
349
355
|
const riding = rider?.findings ?? [];
|
|
350
356
|
const findings = [
|
package/src/verify-part-step.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// cast past `name` and `ok`: `findings: [null]` merged green, and a step with no `durationMs`
|
|
3
3
|
// reached `Math.max` as `undefined` — a part a CI job hand-edited, or truncated, was believed.
|
|
4
4
|
|
|
5
|
-
import type { Finding } from './output';
|
|
5
|
+
import type { Finding, TestServicesState } from './output';
|
|
6
6
|
import type { TestCounts } from './test-counts';
|
|
7
7
|
|
|
8
8
|
export interface PartStep {
|
|
@@ -15,6 +15,7 @@ export interface PartStep {
|
|
|
15
15
|
readonly tests?: TestCounts;
|
|
16
16
|
readonly output?: string;
|
|
17
17
|
readonly warnings?: readonly string[];
|
|
18
|
+
readonly services?: TestServicesState;
|
|
18
19
|
readonly shard?: {
|
|
19
20
|
readonly index: number;
|
|
20
21
|
readonly total: number;
|
|
@@ -67,7 +68,7 @@ export function readPartStep(raw: unknown): PartStep | string {
|
|
|
67
68
|
if (!Array.isArray(findings) || !findings.every(isFinding)) {
|
|
68
69
|
return `holds step "${name}" whose findings are not each a code, a cause and a fix`;
|
|
69
70
|
}
|
|
70
|
-
const { tests, shard, output, workers, skipped, warnings } = raw;
|
|
71
|
+
const { tests, shard, output, workers, skipped, warnings, services } = raw;
|
|
71
72
|
if (tests !== undefined && !isTests(tests)) {
|
|
72
73
|
return `holds step "${name}" whose tests are not counts`;
|
|
73
74
|
}
|
|
@@ -83,6 +84,9 @@ export function readPartStep(raw: unknown): PartStep | string {
|
|
|
83
84
|
if (workers !== undefined && !isCount(workers)) {
|
|
84
85
|
return `holds step "${name}" whose workers is not a count`;
|
|
85
86
|
}
|
|
87
|
+
if (services !== undefined && services !== 'reached' && services !== 'unavailable') {
|
|
88
|
+
return `holds step "${name}" whose services is neither reached nor unavailable`;
|
|
89
|
+
}
|
|
86
90
|
return {
|
|
87
91
|
name,
|
|
88
92
|
ok: raw['ok'],
|
|
@@ -94,5 +98,6 @@ export function readPartStep(raw: unknown): PartStep | string {
|
|
|
94
98
|
...(output === undefined ? {} : { output }),
|
|
95
99
|
...(warnings === undefined ? {} : { warnings }),
|
|
96
100
|
...(shard === undefined ? {} : { shard }),
|
|
101
|
+
...(services === undefined ? {} : { services }),
|
|
97
102
|
};
|
|
98
103
|
}
|
package/src/verify-run.ts
CHANGED
|
@@ -340,7 +340,9 @@ async function runStep(
|
|
|
340
340
|
// share is judged by `x verify merge`, on the sum). A laptop without services stays a dev loop.
|
|
341
341
|
const skips =
|
|
342
342
|
outcome.shard === undefined && inCi(ctx.env ?? Bun.env)
|
|
343
|
-
? judgeSkips(step.name, tests, floor?.skipCeiling
|
|
343
|
+
? judgeSkips(step.name, tests, floor?.skipCeiling, {
|
|
344
|
+
strictWithDatabase: floor?.strict === true && required && outcome.services === 'reached',
|
|
345
|
+
})
|
|
344
346
|
: { findings: [], warnings: [] };
|
|
345
347
|
const warnings = [...(outcome.warnings ?? []), ...skips.warnings, ...staleWhy];
|
|
346
348
|
return {
|
|
@@ -362,6 +364,7 @@ async function runStep(
|
|
|
362
364
|
: { slowest: outcome.slowest }),
|
|
363
365
|
...(outcome.shard === undefined ? {} : { shard: outcome.shard }),
|
|
364
366
|
...(tests === undefined ? {} : { tests }),
|
|
367
|
+
...(outcome.services === undefined ? {} : { services: outcome.services }),
|
|
365
368
|
},
|
|
366
369
|
...(outcome.coverage === undefined ? {} : { coverage: outcome.coverage }),
|
|
367
370
|
...(outcome.measured === undefined ? {} : { measured: outcome.measured }),
|
|
@@ -58,9 +58,15 @@ export function judgeSkips(
|
|
|
58
58
|
step: string,
|
|
59
59
|
tests: TestCounts | undefined,
|
|
60
60
|
ceiling: SkipCeiling | undefined,
|
|
61
|
+
floor: { readonly strictWithDatabase?: boolean } = {},
|
|
61
62
|
): { readonly findings: readonly Finding[]; readonly warnings: readonly string[] } {
|
|
62
63
|
if (tests === undefined || tests.ran === 0) return { findings: [], warnings: [] };
|
|
63
|
-
|
|
64
|
+
// A `live` test that skipped with the database IN REACH is a test that proved nothing, and under
|
|
65
|
+
// a strict floor that requires the step an unwritten ceiling means 0. A run with no database is
|
|
66
|
+
// already `X_TEST_SERVICES_UNAVAILABLE`'s warning — a runner without one skips by design.
|
|
67
|
+
const allowed =
|
|
68
|
+
ceilingOf(ceiling, step) ??
|
|
69
|
+
(step === 'live' && floor.strictWithDatabase === true ? 0 : undefined);
|
|
64
70
|
if (allowed === undefined) {
|
|
65
71
|
return tests.skipped === 0
|
|
66
72
|
? { findings: [], warnings: [] }
|
package/src/verify-step.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { AppTestScope } from './affected-tests';
|
|
|
7
7
|
import type { CoverageMap } from './coverage-lcov';
|
|
8
8
|
import type { ExecResult, Runner } from './exec';
|
|
9
9
|
import { execOutput } from './exec';
|
|
10
|
-
import type { Finding, ShardFacts, SlowFile, StepResult } from './output';
|
|
10
|
+
import type { Finding, ShardFacts, SlowFile, StepResult, TestServicesState } from './output';
|
|
11
11
|
import type { TestCounts } from './test-counts';
|
|
12
12
|
import type { StepTimeouts } from './verify-deadline';
|
|
13
13
|
import type { MachinePace } from './verify-pace';
|
|
@@ -198,6 +198,8 @@ export interface StepOutcome {
|
|
|
198
198
|
* a green step's `output`, so the numbers ride in `data.coverage` where a reader can find them.
|
|
199
199
|
*/
|
|
200
200
|
readonly measured?: CoverageNumbers;
|
|
201
|
+
/** Set by `withTestServices` (`verify-live.ts`): whether the step's database answered. */
|
|
202
|
+
readonly services?: TestServicesState;
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
/** The two percentages a judged run measured, and the source files they are over. */
|
|
@@ -250,7 +250,7 @@ Order inside one bust: read tiers (farthest first) → this origin's ISR pages
|
|
|
250
250
|
|
|
251
251
|
## Why `stream` is the app default
|
|
252
252
|
|
|
253
|
-
An authed page needs fresh data and fast first paint. `ssr` gives freshness and a slow TTFB — the whole page waits for the slowest query. `stream` gives both halves: shell now, data as it resolves. A page whose body belongs in the browser declares an `island({ src })`, budgeted in real bytes; there is no client-side-only mode
|
|
253
|
+
An authed page needs fresh data and fast first paint. `ssr` gives freshness and a slow TTFB — the whole page waits for the slowest query. `stream` gives both halves: shell now, data as it resolves. A page whose body belongs in the browser declares an `island({ src })`, budgeted in real bytes; there is no client-side-only mode. Moving between pages without a full reload is the client router's ([Client Navigation](Client-Navigation)), opted into per surface with `navigation.client`; it swaps server-rendered documents, never renders one in the browser.
|
|
254
254
|
|
|
255
255
|
`x g route`, `x g resource` and `x new`'s dashboard write `render: 'stream'` on `app/`. A `stream` page with no hole registers and pays nothing: it is one flush.
|
|
256
256
|
|
|
@@ -311,6 +311,7 @@ In a VDOM framework a streaming shell still pays for hydrating the whole tree, w
|
|
|
311
311
|
| A hole's island | hydrates from its chunk: the chunk carries the hydration runtime after its reveal, and the realtime boot if this is the first island that needs it |
|
|
312
312
|
| A shell island while a hole is open | live: the runtime is `<script type="module" async>`, so it does not wait for parsing to end. With a realtime boot in the document it stays deferred ([Known gaps](Known-Gaps)) |
|
|
313
313
|
| Client router | a soft visit reads the whole answer before it swaps ([Known gaps](Known-Gaps)); every reveal still runs |
|
|
314
|
+
| A hand-rolled swap | the reveal is an inline `<script>`, and a document parsed by `DOMParser` or set through `innerHTML` runs none, so its holes keep their fallback. Re-run the scripts, or call `refresh()` / `scheduleRefresh()` from `@ultimat3/render/client`, which the router swaps through (`navigation-swap.ts`'s `runScripts`) |
|
|
314
315
|
| CSP | every chunk's inline script is a body `inlineScriptSources()` already hashes |
|
|
315
316
|
|
|
316
317
|
Solid's own boundary component is not this: it throws outside a Solid renderer, and the server JSX factory is inert by design.
|
package/wiki/Testing.md
CHANGED
|
@@ -676,6 +676,12 @@ describeIslandState(counterStates, 'idle', island, (mounted) => {
|
|
|
676
676
|
The props are the manifest's, so the picture `x shot --island` takes and the test are of one
|
|
677
677
|
component. `mountIsland` stays the call for props no state declares. `As of 2026-10`.
|
|
678
678
|
|
|
679
|
+
A builder you wrap keys its memo by `options.coverage`. Under `x verify`'s coverage run a mount
|
|
680
|
+
builds twice — covered to run, shipped for `code` — so `bundle ??= buildIslands(root, options)`
|
|
681
|
+
hands the covered chunk to every `code.length` ceiling: green under `bun test`, red in the gate.
|
|
682
|
+
`describeIslandState` already builds once per file; pass `buildIslands` itself. A memo that
|
|
683
|
+
returns the same bundle for both is refused: `X_TEST_ISLAND_BUILD_REUSED`. `As of 2026-11`.
|
|
684
|
+
|
|
679
685
|
A realtime island's page outlives its mount: the socket, the record store and the outbox sit on
|
|
680
686
|
`globalThis`, shared by every bundle. Between files (or cases that need a fresh page) call
|
|
681
687
|
`resetPageRealtime()` from `@ultimat3/realtime` in `afterAll` — it closes the socket the CHUNK's copy
|
package/wiki/Upgrading.md
CHANGED
|
@@ -301,6 +301,8 @@ A setter still on a package's `.` barrel is `X_ADAPTER_PORT_INCOMPLETE` on the `
|
|
|
301
301
|
| a serving role over a schema behind its build **waits** for the migrate step (**31.29.0**) instead of exiting — framework stamp and app migrations alike — and exits after `ULTIMATE_SCHEMA_WAIT_MS` (default 300000); the chart's migrate Job is an Argo CD `Sync` hook in wave −1, named by a hash of its image, its migrate settings and the chart version, deleted on success, and runs on `helm rollback` too | `x upgrade --json` (codemods `migrate-job-ordered`, `helm-alerts-deploy`); after a pre-31.29 chart, `kubectl delete job <release>-migrate` once; `ULTIMATE_SCHEMA_WAIT_MS=0` keeps the old refuse-at-once |
|
|
302
302
|
| `overrides` an app carries for `seroval`, `seroval-plugins` or `source-map-js` are no longer needed from **31.28.0**: `@ultimat3/ui`'s `solid-js` peer is `^1.9.18`, which requires the patched `seroval`; `source-map-js` and `immutable` arrive through `sass` and need a refreshed lockfile. `x doctor` warns below each floor (`X_ADVISORY_FLOOR_UNMET`) | drop those `overrides`, then `x upgrade --json` (its `solid-floor` codemod raises `solid-js`) and `bun update source-map-js immutable` |
|
|
303
303
|
| two shipped guards report more (**31.40.0**), built in: `raw-colour` (`X_RAW_COLOUR`) also reads a component's inline `style` (`style={{ color: '#f00' }}`, a quoted CSS string), and `untranslated-string` (`X_UNTRANSLATED_STRING`) also reads typed user-facing attributes (`aria-label`, `title`, `placeholder`, `alt`, …). A third, `undeclared-env` (`X_UNDECLARED_ENV`), is new: a raw `process.env.X` / `Bun.env.X` that `app.config.ts` does not declare. Every app runs them on its next install; a copy still in `guards/` keeps the old rule until `x upgrade` migrates it to the release after 31.39.0 | each finding names its edit: a semantic token, a `t('…')` key, or the `envSchema` entry to add; `"<name>": "off"` in `guards/shipped.json` opts out |
|
|
304
|
+
| the shipped `undeclared-env` guard reports less (**31.41.0**), built in: a name quoted inside a string (a generated docs file holding `process.env.X` as text) and a read of the OS's own `PATH`, `HOME`, `TMPDIR`, `USER`, `SHELL`, `PWD`, `LANG` or `HOSTNAME` are no longer `X_UNDECLARED_ENV`. A read inside a template's `${…}` still is | nothing, for the built-in guard. A vendored `guards/undeclared-env.ts` you never edited: `x upgrade` migrates it. An edited one keeps your rule; compare it with `x g guard undeclared-env --force`'s diff |
|
|
305
|
+
| `live` under a strict floor holds its skips at **0** in CI (**31.42.0**) when `x.verify.json` writes no `skipCeiling.live` and the run reached its database: `X_VERIFY_SKIPS_OVER_CEILING` names the step and the count. A run with no database (no services on the runner) is unchanged: `X_TEST_SERVICES_UNAVAILABLE`, a warning | make each skipped `live` test run — it needs a service the stack does not start, or skips on a condition it should not — or write the ceiling you accept, with its reason: `"skipCeiling": { "live": <n> }` in `x.verify.json`. Then `x verify --only live` |
|
|
304
306
|
|
|
305
307
|
## 29.x → 30.0.0, entry by entry
|
|
306
308
|
|