@ultimat3/cli 31.48.0 → 31.49.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 +30 -23
- package/README.md +96 -4
- package/package.json +29 -29
- package/src/api-registration.ts +28 -14
- package/src/app-load.ts +6 -1
- package/src/app-root.ts +7 -1
- package/src/clean-services.ts +142 -0
- package/src/cmd-auth.ts +3 -0
- package/src/cmd-clean-spec.ts +10 -3
- package/src/cmd-clean.ts +23 -9
- package/src/cmd-db-backfill.ts +6 -0
- package/src/cmd-db-branch.ts +10 -4
- package/src/cmd-db-recount.ts +5 -12
- package/src/cmd-db-rollback.ts +77 -0
- package/src/cmd-db-spec.ts +18 -2
- package/src/cmd-db-status.ts +5 -10
- package/src/cmd-db.ts +105 -33
- package/src/cmd-deploy-verify.ts +14 -6
- package/src/cmd-docs-topic.ts +94 -0
- package/src/cmd-docs.ts +15 -1
- package/src/cmd-doctor.ts +109 -41
- package/src/cmd-drill.ts +80 -18
- package/src/cmd-env.ts +30 -8
- package/src/cmd-errors-app.ts +63 -0
- package/src/cmd-errors.ts +50 -14
- package/src/cmd-generate.ts +17 -4
- package/src/cmd-heavy-spec.ts +9 -1
- package/src/cmd-heavy.ts +111 -27
- package/src/cmd-jobs.ts +27 -1
- package/src/cmd-merge-driver-spec.ts +12 -0
- package/src/cmd-merge-driver.ts +95 -0
- package/src/cmd-new.ts +23 -3
- package/src/cmd-policy-spec.ts +9 -1
- package/src/cmd-policy.ts +72 -17
- package/src/cmd-stop.ts +18 -4
- package/src/cmd-tasks-run.ts +87 -0
- package/src/cmd-tasks-spec.ts +10 -3
- package/src/cmd-tasks.ts +8 -5
- package/src/cmd-test.ts +2 -1
- package/src/cmd-upgrade-spec.ts +8 -1
- package/src/cmd-upgrade.ts +15 -1
- package/src/cmd-verify.ts +9 -41
- package/src/codemods/agents-doc-row.ts +73 -0
- package/src/codemods/define-error-leaf.ts +37 -12
- package/src/codemods/docs-many-agents.ts +11 -15
- package/src/codemods/docs-worker-commands.ts +26 -0
- package/src/codemods/index.ts +4 -0
- package/src/codemods/merge-drivers.ts +66 -0
- package/src/command.ts +3 -0
- package/src/db-applied-edits.ts +117 -0
- package/src/db-dev-wire.ts +18 -0
- package/src/db-diagnostics.ts +5 -10
- package/src/db-generate.ts +82 -7
- package/src/db-migrate-pass.ts +51 -0
- package/src/db-migrate-through-dev.ts +209 -0
- package/src/db-rollback-consent.ts +128 -0
- package/src/db-rollback-pass.ts +76 -0
- package/src/db-seed-generate.ts +5 -1
- package/src/db-seed.ts +7 -1
- package/src/deploy-verify-findings.ts +3 -0
- package/src/deploy-verify-grade.ts +3 -0
- package/src/deploy-verify-processes.ts +32 -0
- package/src/dev-boot.ts +3 -0
- package/src/dev-db-migrate.ts +155 -0
- package/src/dev-db-rollback.ts +33 -0
- package/src/dev-db-settled.ts +22 -0
- package/src/dev-lock-errors.ts +78 -0
- package/src/dev-lock-holder-dir.ts +64 -0
- package/src/dev-lock-live.ts +44 -0
- package/src/dev-lock.ts +59 -84
- package/src/dev-policy.ts +11 -8
- package/src/dev-rebuild-schema.ts +116 -13
- package/src/dev-rebuild.ts +13 -4
- package/src/dev-route-table.ts +7 -0
- package/src/dispatch.ts +21 -1
- package/src/doctor-api-listing.ts +114 -0
- package/src/doctor-guarded.ts +41 -0
- package/src/doctor-port.ts +90 -17
- package/src/doctor-probe.ts +36 -5
- package/src/doctor-processes-probe.ts +127 -0
- package/src/doctor-processes.ts +136 -0
- package/src/doctor-warnings.ts +17 -0
- package/src/error-codes-agents.ts +35 -0
- package/src/error-codes-processes.ts +30 -0
- package/src/error-codes-tooling.ts +2 -0
- package/src/error-codes.ts +12 -13
- package/src/errors-suite.ts +27 -0
- package/src/errors.ts +18 -22
- package/src/exercise-registration.ts +4 -3
- package/src/framework-env.ts +7 -3
- package/src/generate-files.ts +1 -0
- package/src/generate-grant-findings.ts +7 -5
- package/src/generate-grants.ts +9 -8
- package/src/generate-kinds.ts +30 -6
- package/src/generate-roles-file.ts +30 -0
- package/src/generate-slice-policy.ts +3 -3
- package/src/guards.ts +2 -2
- package/src/heavy-env.ts +2 -0
- package/src/heavy-errors.ts +18 -0
- package/src/heavy-holders.ts +78 -0
- package/src/heavy-ledger.ts +56 -14
- package/src/heavy-pressure.ts +104 -0
- package/src/heavy.ts +31 -13
- package/src/i18n-registration.ts +22 -2
- package/src/island-harness.ts +2 -2
- package/src/job-budget.ts +4 -2
- package/src/job-registration.ts +64 -8
- package/src/jobs-queue-known.ts +43 -0
- package/src/mcp-errors-agents.ts +20 -0
- package/src/mcp-errors-doctor.ts +27 -0
- package/src/mcp-errors-processes.ts +23 -0
- package/src/mcp-errors.ts +15 -29
- package/src/mcp-host.ts +2 -2
- package/src/merge-driver-catalog.ts +58 -0
- package/src/merge-driver-config.ts +43 -0
- package/src/merge-driver-lines.ts +140 -0
- package/src/merge-state.ts +105 -0
- package/src/messages-db.ts +22 -1
- package/src/messages-processes.ts +13 -0
- package/src/messages-upgrade.ts +6 -0
- package/src/messages.ts +54 -4
- package/src/output-findings.ts +48 -21
- package/src/parse.ts +37 -6
- package/src/policy-facts.ts +38 -21
- package/src/policy-row.ts +99 -0
- package/src/port-pair-free.ts +28 -0
- package/src/registry-lines.ts +110 -0
- package/src/registry.ts +2 -0
- package/src/retain-sweep.ts +1 -1
- package/src/role-replicator.ts +4 -1
- package/src/role-select.ts +86 -0
- package/src/role-start.ts +13 -55
- package/src/role-sync.ts +10 -5
- package/src/runtime-cache-frame.ts +46 -0
- package/src/runtime-cache-ttl.ts +23 -0
- package/src/runtime-cache.ts +33 -16
- package/src/runtime-database-ssl.ts +84 -0
- package/src/runtime-idempotency-scope.ts +16 -2
- package/src/runtime-jobs-share.ts +52 -0
- package/src/runtime-jobs.ts +43 -12
- package/src/runtime-queue.ts +18 -3
- package/src/runtime-services.ts +8 -1
- package/src/schema-drift.ts +19 -2
- package/src/schema-dump-drift.ts +4 -1
- package/src/serve-boot-probe.ts +30 -2
- package/src/serve-boot.ts +11 -1
- package/src/serve-env.ts +39 -3
- package/src/serve.ts +61 -10
- package/src/stop-run-start.ts +12 -0
- package/src/supervise-boot.ts +61 -0
- package/src/supervise-cgroup.ts +84 -0
- package/src/supervise-child.ts +206 -0
- package/src/supervise-count.ts +244 -0
- package/src/supervise-errors.ts +83 -0
- package/src/supervise-facts.ts +40 -0
- package/src/supervise-messages.ts +84 -0
- package/src/supervise-policy.ts +46 -0
- package/src/supervise-pool.ts +10 -0
- package/src/supervise-probe.ts +158 -0
- package/src/supervise-run.ts +54 -0
- package/src/supervise.ts +383 -0
- package/src/templates/generate-purge.ts +6 -6
- package/src/templates/guard-animated-layout-property.ts +2 -2
- package/src/templates/guard-bare-error.ts +1 -1
- package/src/templates/guard-error-declared.ts +2 -2
- package/src/templates/guard-focus-visible.ts +1 -1
- package/src/templates/guard-image-dimensions.ts +2 -2
- package/src/templates/guard-island-mount-clears.ts +1 -1
- package/src/templates/guard-native-confirm.ts +1 -1
- package/src/templates/guard-raw-breakpoint.ts +2 -2
- package/src/templates/guard-raw-colour.ts +2 -2
- package/src/templates/guard-raw-fetch.ts +1 -1
- package/src/templates/guard-raw-interval.ts +1 -1
- package/src/templates/guard-raw-length.ts +3 -3
- package/src/templates/guard-raw-motion.ts +1 -1
- package/src/templates/guard-raw-shadow.ts +1 -1
- package/src/templates/guard-raw-z-index.ts +1 -1
- package/src/templates/guard-released-forms.ts +54 -8
- package/src/templates/guard-repo-await-in-loop.ts +1 -1
- package/src/templates/guard-repo-raw-sql.ts +4 -4
- package/src/templates/guard-repo-unbounded.ts +1 -1
- package/src/templates/guard-runtime-pin.ts +1 -1
- package/src/templates/guard-semantic-interactive.ts +2 -2
- package/src/templates/guard-unbounded-fanout.ts +1 -1
- package/src/templates/guard-undeclared-custom-property.ts +3 -3
- package/src/templates/guard-undefined-style-class.ts +3 -3
- package/src/templates/guard-unzoned-date.ts +3 -3
- package/src/templates/query-slice.ts +82 -0
- package/src/templates/query.ts +76 -30
- package/src/templates/resource-page.ts +3 -2
- package/src/templates/scaffold-bin.ts +2 -0
- package/src/templates/scaffold-claude-commands.ts +6 -0
- package/src/templates/scaffold-claude.ts +4 -4
- package/src/templates/scaffold-container-compose.ts +47 -7
- package/src/templates/scaffold-docs.ts +7 -3
- package/src/templates/scaffold-gitattributes.ts +18 -1
- package/src/templates/scaffold-helm-templates.ts +9 -0
- package/src/templates/scaffold-repo.ts +4 -1
- package/src/templates/scaffold-test-services.ts +33 -11
- package/src/templates/shapes/offline.ts +0 -7
- package/src/templates/shapes/realtime.ts +2 -6
- package/src/templates/sign-in-action-tests.ts +6 -4
- package/src/templates/sign-in-challenge.ts +62 -0
- package/src/templates/sign-in-oidc-mfa.ts +31 -0
- package/src/templates/sign-in-oidc.ts +11 -3
- package/src/templates/sign-in-password.ts +18 -56
- package/src/test-shards.ts +114 -34
- package/src/test-verdict.ts +79 -0
- package/src/test-workers.ts +15 -0
- package/src/upgrade-gate-codemods.ts +5 -3
- package/src/upgrade-gate.ts +19 -1
- package/src/upgrade-merge-drivers.ts +25 -0
- package/src/upgrade-report.ts +18 -4
- package/src/upgrade-scope.ts +62 -0
- package/src/verify-checks.ts +2 -8
- package/src/verify-coverage-run.ts +4 -1
- package/src/verify-live.ts +38 -14
- package/src/verify-only.ts +67 -0
- package/src/verify-progress.ts +7 -3
- package/src/verify-run.ts +20 -2
- package/src/verify-services-stack.ts +165 -0
- package/src/verify-services.ts +84 -2
- package/src/verify-test-run.ts +6 -7
- package/src/verify-tests.ts +8 -2
- package/src/verify-typecheck.ts +25 -2
- package/wiki/Actions.md +2 -1
- package/wiki/Admin-Dashboard.md +2 -2
- package/wiki/Agents.md +5 -5
- package/wiki/Auth.md +15 -5
- package/wiki/Bare-VM.md +1 -1
- package/wiki/CI-Parallel-Gate.md +2 -1
- package/wiki/CLI-Reference.md +107 -40
- package/wiki/Caching-And-Invalidation.md +1 -1
- package/wiki/Client-Navigation.md +1 -1
- package/wiki/Configuration.md +10 -9
- package/wiki/Deployment.md +44 -4
- package/wiki/Entities-And-Migrations.md +5 -1
- package/wiki/FAQ.md +1 -1
- package/wiki/Getting-Started.md +2 -2
- package/wiki/Home.md +1 -1
- package/wiki/I18n.md +5 -3
- package/wiki/Installation.md +12 -11
- package/wiki/Jobs-And-Workflows.md +24 -4
- package/wiki/Known-Gaps.md +1 -1
- package/wiki/MCP-And-AI.md +8 -5
- package/wiki/Many-Agents.md +69 -2
- package/wiki/Migrations-And-Backfills.md +18 -0
- package/wiki/Notify.md +1 -1
- package/wiki/Observability.md +13 -0
- package/wiki/Queries-And-Live-Queries.md +2 -2
- package/wiki/Realtime.md +10 -1
- package/wiki/Routes-And-Render-Modes.md +1 -1
- package/wiki/Scheduled-Tasks.md +4 -1
- package/wiki/Testing.md +7 -4
- package/wiki/Timezones-And-Dates.md +5 -1
- package/wiki/Troubleshooting.md +1 -0
- package/wiki/Tutorial-01-First-App.md +3 -3
- package/wiki/Tutorial-02-First-Feature.md +1 -1
- package/wiki/Tutorial-03-Auth-And-Admin.md +7 -6
- package/wiki/Upgrading.md +37 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// What a finished `x test` run says beyond its exit code: which files failed, read out of bun's own
|
|
2
|
+
// per-file headers, and why a run in which every test skipped itself is not a pass. Split from
|
|
3
|
+
// `test-shards.ts`, which spends the files; this file only reads what came back.
|
|
4
|
+
|
|
5
|
+
import { ERROR_DOCS_URL } from '@ultimat3/core';
|
|
6
|
+
import { TEST_SERVICE_ENV, TEST_SERVICES_START } from '@ultimat3/testing';
|
|
7
|
+
import type { Finding } from './output';
|
|
8
|
+
import { quoteArg } from './shell-quote';
|
|
9
|
+
|
|
10
|
+
/** Bun prints `<path>:` above a file's own lines, and only for a file that printed something. */
|
|
11
|
+
const HEADER = /^(\S.*):$/;
|
|
12
|
+
/** What makes a file's section a failure: a failed test, or an error outside any test. */
|
|
13
|
+
const FAILED = /^\(fail\) |^# Unhandled error/;
|
|
14
|
+
|
|
15
|
+
const normal = (path: string): string => path.split('\\').join('/').replace(/^\.\//, '');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The run's files whose section in bun's output holds a failure, in the order bun printed them.
|
|
19
|
+
* A header naming no file of the run is ignored, so a log line ending in `:` is never a file.
|
|
20
|
+
*/
|
|
21
|
+
export function failingFiles(output: string, files: readonly string[]): readonly string[] {
|
|
22
|
+
const known = new Set(files.map(normal));
|
|
23
|
+
const failing: string[] = [];
|
|
24
|
+
let current: string | undefined;
|
|
25
|
+
for (const line of output.split('\n')) {
|
|
26
|
+
const header = HEADER.exec(line.trimEnd())?.[1];
|
|
27
|
+
if (header !== undefined && known.has(normal(header))) {
|
|
28
|
+
current = normal(header);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (current !== undefined && FAILED.test(line) && !failing.includes(current)) {
|
|
32
|
+
failing.push(current);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return failing;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type Env = Readonly<Record<string, string | undefined>>;
|
|
39
|
+
|
|
40
|
+
/** The service variables the children ran without: a test that `needs` one skips over it. */
|
|
41
|
+
const unsetServices = (env: Env): readonly string[] =>
|
|
42
|
+
Object.values(TEST_SERVICE_ENV).filter((key) => (env[key]?.trim() ?? '') === '');
|
|
43
|
+
|
|
44
|
+
const SHOWN_FILES = 3;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A run whose every test skipped itself executed nothing, and `bun test` still exits 0 over it —
|
|
48
|
+
* so "passed" would be the one answer that is certainly wrong. `X_TEST_FAILED`: the type ran no
|
|
49
|
+
* check. The cause names what the children lacked; the fix starts it, or shows each skip's
|
|
50
|
+
* condition when nothing the framework knows of was missing.
|
|
51
|
+
*/
|
|
52
|
+
export function allSkippedFinding(input: {
|
|
53
|
+
readonly type?: string;
|
|
54
|
+
readonly skipped: number;
|
|
55
|
+
readonly files: readonly string[];
|
|
56
|
+
/** The environment the `bun test` children saw. */
|
|
57
|
+
readonly env: Env;
|
|
58
|
+
/** `reproduceWords`: the selection's words after `x`, every selector kept, quoted here. */
|
|
59
|
+
readonly rerun: readonly string[];
|
|
60
|
+
}): Finding {
|
|
61
|
+
const missing = unsetServices(input.env);
|
|
62
|
+
const label = input.type ?? 'test';
|
|
63
|
+
const why =
|
|
64
|
+
missing.length === 0
|
|
65
|
+
? 'each skip is its own condition in the file (a skipIf, a test.skip, a needs: whose service is unset)'
|
|
66
|
+
: `the run's environment leaves ${missing.join(', ')} unset, and a test that needs that service skips without it`;
|
|
67
|
+
const shown = input.files.slice(0, SHOWN_FILES).map(quoteArg).join(' ');
|
|
68
|
+
return {
|
|
69
|
+
code: 'X_TEST_FAILED',
|
|
70
|
+
cause: `${label} run executed 0 of ${input.skipped} test(s): every one skipped itself, so nothing was checked — ${why}`,
|
|
71
|
+
fix:
|
|
72
|
+
missing.length === 0
|
|
73
|
+
? `grep -nE 'skip|needs:' ${shown} # set what each skip waits for, then: x ${quoteArg(input.rerun)}`
|
|
74
|
+
: // The reproduce line, whole: `--affected`, `--sample` and a passthrough decide the
|
|
75
|
+
// selection, and a rebuilt `x test <type> --filter` reran a broader one.
|
|
76
|
+
`${TEST_SERVICES_START} && x ${quoteArg(input.rerun)} # this selection, now with the services`,
|
|
77
|
+
docs: ERROR_DOCS_URL,
|
|
78
|
+
};
|
|
79
|
+
}
|
package/src/test-workers.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { cpus, totalmem } from 'node:os';
|
|
10
10
|
import { UltimateError } from '@ultimat3/core';
|
|
11
11
|
import type { TestType } from '@ultimat3/testing';
|
|
12
|
+
import { msg } from './messages';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* `ULTIMATE_TEST_MEMORY_BUDGET` or `ULTIMATE_TEST_MAX_WORKERS` set to something that does not
|
|
@@ -227,6 +228,20 @@ export function workerPlan(
|
|
|
227
228
|
return { workers, budgetBytes, boundBy, reason: `${String(workers)} ${noun} (${why})` };
|
|
228
229
|
}
|
|
229
230
|
|
|
231
|
+
/**
|
|
232
|
+
* A plan cut short by the selection: one worker per file. It read `4 of 6 workers`, and a run the
|
|
233
|
+
* machine then narrowed read `2 of 4 of 6 workers`.
|
|
234
|
+
*/
|
|
235
|
+
export const fileBoundWidth = (files: number, reason: string): string =>
|
|
236
|
+
`${String(files)} ${files === 1 ? 'worker' : 'workers'}, one per file (plan: ${reason})`;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* The step line's width: the plan when the run reached it, else the widest batch beside the plan.
|
|
240
|
+
* Never "held by another run": the core cap narrows a run on a machine with nobody else on it.
|
|
241
|
+
*/
|
|
242
|
+
export const reachedWidth = (peak: number, planned: number, reason: string): string =>
|
|
243
|
+
peak < planned ? msg('cli.test.narrowedWhy', { peak, planned, reason }) : reason;
|
|
244
|
+
|
|
230
245
|
/** The width alone — `workerPlan(...).workers`. */
|
|
231
246
|
export const defaultWorkers = (
|
|
232
247
|
cpus: number = availableCpus(),
|
|
@@ -15,6 +15,7 @@ import { LOCAL_CLI_BIN } from './local-cli';
|
|
|
15
15
|
import type { Finding } from './output';
|
|
16
16
|
import { documentIn } from './upgrade-document';
|
|
17
17
|
import { manifestSnapshot, reinstallIfMoved } from './upgrade-gate-codemods-install';
|
|
18
|
+
import { installMergeDrivers } from './upgrade-merge-drivers';
|
|
18
19
|
import type { HopCodemods } from './upgrade-report-codemods';
|
|
19
20
|
|
|
20
21
|
const SKIP = t.object({ path: t.string, reason: t.string, diff: t.optional(t.string) });
|
|
@@ -106,9 +107,10 @@ export async function applyHopCodemods(input: {
|
|
|
106
107
|
})),
|
|
107
108
|
source: 'driver',
|
|
108
109
|
};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
const reinstalled = await reinstallIfMoved({ runner, root, to, before });
|
|
111
|
+
// After the install: the driver command runs the app's own `node_modules/.bin/x`.
|
|
112
|
+
await installMergeDrivers(runner, root);
|
|
113
|
+
return reinstalled ? { ...report, reinstalled: true } : report;
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
/**
|
package/src/upgrade-gate.ts
CHANGED
|
@@ -21,6 +21,7 @@ import type { BaselinedGuard, WithheldGuard } from './upgrade-guards';
|
|
|
21
21
|
import { installMissingGuards } from './upgrade-guards';
|
|
22
22
|
import { parseJson } from './upgrade-registry';
|
|
23
23
|
import type { HopCodemods } from './upgrade-report-codemods';
|
|
24
|
+
import { installedNotRun } from './upgrade-scope';
|
|
24
25
|
|
|
25
26
|
// Where it always was: `verify-exercise.ts` and `verify-budgets-build.ts` read it from here.
|
|
26
27
|
export { documentIn } from './upgrade-document';
|
|
@@ -145,6 +146,10 @@ export interface HopGate {
|
|
|
145
146
|
/** The steps that went red, whether or not they carried a finding. */
|
|
146
147
|
readonly failed: readonly string[];
|
|
147
148
|
readonly findings: readonly GateFinding[];
|
|
149
|
+
/** `x upgrade --only`'s list, as run; absent when the hop ran the full gate. */
|
|
150
|
+
readonly only?: readonly string[];
|
|
151
|
+
/** The gate's steps this hop did NOT run, owed elsewhere (CI); absent beside a full gate. */
|
|
152
|
+
readonly notRun?: readonly string[];
|
|
148
153
|
};
|
|
149
154
|
}
|
|
150
155
|
|
|
@@ -254,6 +259,8 @@ export async function runHopGate(input: {
|
|
|
254
259
|
readonly bunMoved?: CoverageRebaseline;
|
|
255
260
|
/** The span whose codemods run first, so every later stage judges the carried-across tree. */
|
|
256
261
|
readonly codemods?: { readonly from: string; readonly to: string };
|
|
262
|
+
/** `x upgrade --only`: verify narrowed to these steps, a strict subset of the gate's. */
|
|
263
|
+
readonly only?: { readonly steps: readonly string[]; readonly notRun: readonly string[] };
|
|
257
264
|
}): Promise<HopGate> {
|
|
258
265
|
const { runner, root, onStage } = input;
|
|
259
266
|
const installed = (args: readonly string[]): Promise<ExecResult> =>
|
|
@@ -294,7 +301,18 @@ export async function runHopGate(input: {
|
|
|
294
301
|
// Before `verify`, from the report that exercise just wrote: the gate judges the figures it holds.
|
|
295
302
|
const exerciseFloor = await ratchetExerciseFloor(root, stamp);
|
|
296
303
|
onStage('verify');
|
|
297
|
-
const
|
|
304
|
+
const { only } = input;
|
|
305
|
+
// The installed gate's own list first: the steps owed to CI are steps that CLI has. None owed
|
|
306
|
+
// (every one of its steps named) is that CLI's full gate, run and reported as one.
|
|
307
|
+
const notRun = only === undefined ? undefined : await installedNotRun(installed, only);
|
|
308
|
+
const verify =
|
|
309
|
+
only === undefined || notRun === undefined || notRun.length === 0
|
|
310
|
+
? readVerify(await installed(['verify', '--json']))
|
|
311
|
+
: {
|
|
312
|
+
...readVerify(await installed(['verify', '--only', only.steps.join(','), '--json'])),
|
|
313
|
+
only: only.steps,
|
|
314
|
+
notRun,
|
|
315
|
+
};
|
|
298
316
|
return {
|
|
299
317
|
codemods,
|
|
300
318
|
superseded,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// After a hop's codemods: the merge drivers its `.gitattributes` names, installed in this clone as
|
|
2
|
+
// `bun run setup` would, so an upgrade leaves no `X_MERGE_DRIVER_UNSET` for a person to act on.
|
|
3
|
+
|
|
4
|
+
// why: Bun exposes no path-join primitive.
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import type { Runner } from './exec';
|
|
7
|
+
import { LOCAL_CLI_BIN } from './local-cli';
|
|
8
|
+
import { driverUnset } from './merge-driver-config';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Through the installed CLI, which the hop just installed and which has the subcommand. True when
|
|
12
|
+
* it ran and succeeded; a failure is not thrown, because `x doctor` reports the same unset driver
|
|
13
|
+
* as a warning with its fix, beside the hop's verdict.
|
|
14
|
+
*/
|
|
15
|
+
export async function installMergeDrivers(runner: Runner, root: string): Promise<boolean> {
|
|
16
|
+
if (!(await driverUnset(root, runner))) return false;
|
|
17
|
+
const command = [
|
|
18
|
+
process.execPath,
|
|
19
|
+
join(root, LOCAL_CLI_BIN),
|
|
20
|
+
'merge-driver',
|
|
21
|
+
'install',
|
|
22
|
+
'--json',
|
|
23
|
+
];
|
|
24
|
+
return (await runner(command, { cwd: root })).ok;
|
|
25
|
+
}
|
package/src/upgrade-report.ts
CHANGED
|
@@ -34,11 +34,18 @@ export interface PlannedWrites {
|
|
|
34
34
|
readonly manual: readonly BunManual[];
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
|
|
37
|
+
/**
|
|
38
|
+
* The strongest check a hop had: the verdict `done` rests on, stated rather than implied.
|
|
39
|
+
* `verify-only` is `x upgrade --only`'s: green on some steps, the rest in `verify.notRun`.
|
|
40
|
+
*/
|
|
41
|
+
export type HopProof = 'verify' | 'verify-only' | 'scripts' | 'none';
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
const notRunOf = (gate: HopGate | undefined): readonly string[] => gate?.verify.notRun ?? [];
|
|
44
|
+
|
|
45
|
+
export const proofOf = (gate: HopGate | undefined, scripts: readonly RepoScript[]): HopProof => {
|
|
46
|
+
if (gate !== undefined) return notRunOf(gate).length > 0 ? 'verify-only' : 'verify';
|
|
47
|
+
return scripts.length > 0 ? 'scripts' : 'none';
|
|
48
|
+
};
|
|
42
49
|
|
|
43
50
|
/** What the agent does next, as a sentence naming the commands. */
|
|
44
51
|
export const thenLine = (input: {
|
|
@@ -68,6 +75,10 @@ export const thenLine = (input: {
|
|
|
68
75
|
: msg('cli.upgrade.then.scriptsRed', { to: hop.to });
|
|
69
76
|
}
|
|
70
77
|
if (gate?.verify.ok !== true) return msg('cli.upgrade.then.red', { to: hop.to });
|
|
78
|
+
const notRun = notRunOf(gate);
|
|
79
|
+
if (notRun.length > 0) {
|
|
80
|
+
return msg('cli.upgrade.then.scoped', { to: hop.to, steps: notRun.join(',') });
|
|
81
|
+
}
|
|
71
82
|
return hop.next === null
|
|
72
83
|
? msg('cli.upgrade.then.last', { to: hop.to })
|
|
73
84
|
: msg('cli.upgrade.then.walk', { to: hop.to, next: hop.next });
|
|
@@ -154,6 +165,9 @@ export const humanLines = (
|
|
|
154
165
|
...scripts
|
|
155
166
|
.filter((script) => script.ok === false)
|
|
156
167
|
.map((script) => msg('cli.upgrade.scriptRed', { name: script.name })),
|
|
168
|
+
...(notRunOf(gate).length === 0
|
|
169
|
+
? []
|
|
170
|
+
: [msg('cli.upgrade.notRun', { steps: notRunOf(gate).join(',') })]),
|
|
157
171
|
msg('cli.upgrade.then', { then }),
|
|
158
172
|
];
|
|
159
173
|
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// `x upgrade --only`: which of the gate's steps the hop's `x verify` runs, read before anything
|
|
2
|
+
// spawns, and which it leaves out — counted against the installed CLI's gate, which may be older.
|
|
3
|
+
// The list is `x verify --only`'s, read by the same reader (`verify-only.ts`).
|
|
4
|
+
|
|
5
|
+
import { t } from '@ultimat3/schema';
|
|
6
|
+
import type { CommandContext } from './command';
|
|
7
|
+
import { BadFlagError } from './errors';
|
|
8
|
+
import type { ExecResult } from './exec';
|
|
9
|
+
import { documentIn } from './upgrade-document';
|
|
10
|
+
import { readStepList, stepsNotIn } from './verify-only';
|
|
11
|
+
|
|
12
|
+
/** A scoped gate's list and the steps it leaves out: what the hop's report owes to be honest. */
|
|
13
|
+
export interface GateScope {
|
|
14
|
+
readonly steps: readonly string[];
|
|
15
|
+
readonly notRun: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* `--only`, read before anything spawns. Every step named is the full gate, so it runs as one and
|
|
20
|
+
* reports as one; a repository with no `app.config.ts` runs scripts, never `x verify`, so a list
|
|
21
|
+
* there would narrow nothing and is refused rather than ignored.
|
|
22
|
+
*/
|
|
23
|
+
export const readScope = (ctx: CommandContext, app: boolean): GateScope | undefined => {
|
|
24
|
+
const steps = readStepList(ctx.args, 'upgrade');
|
|
25
|
+
if (steps === undefined) return undefined;
|
|
26
|
+
if (!app) {
|
|
27
|
+
throw new BadFlagError({
|
|
28
|
+
flag: 'only',
|
|
29
|
+
command: 'upgrade',
|
|
30
|
+
reason: 'no app.config.ts here, so the hop runs the typecheck and test scripts, not x verify',
|
|
31
|
+
fix: 'x upgrade --json',
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const notRun = stepsNotIn(steps);
|
|
35
|
+
return notRun.length === 0 ? undefined : { steps, notRun };
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const PLAN = t.object({
|
|
39
|
+
data: t.object({
|
|
40
|
+
matrix: t.object({ include: t.array(t.object({ only: t.string })) }),
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The steps the INSTALLED CLI's gate has and this hop did not run: its `x verify plan --parts 1`,
|
|
46
|
+
* the one form that reads no app. A CLI with no plan (or no answer) leaves this CLI's list
|
|
47
|
+
* standing, the best evidence there is; a step it lacks then fails CI's run by name.
|
|
48
|
+
*/
|
|
49
|
+
export async function installedNotRun(
|
|
50
|
+
cli: (args: readonly string[]) => Promise<ExecResult>,
|
|
51
|
+
scope: GateScope,
|
|
52
|
+
): Promise<readonly string[]> {
|
|
53
|
+
const parsed = PLAN.safeParse(
|
|
54
|
+
documentIn((await cli(['verify', 'plan', '--parts', '1', '--json'])).stdout),
|
|
55
|
+
);
|
|
56
|
+
if (parsed.issues !== undefined) return scope.notRun;
|
|
57
|
+
const rows = (parsed.value as { data: { matrix: { include: readonly { only: string }[] } } }).data
|
|
58
|
+
.matrix.include;
|
|
59
|
+
const gate = new Set(rows.flatMap((row) => row.only.split(',')));
|
|
60
|
+
if (gate.size === 0) return scope.notRun;
|
|
61
|
+
return [...gate].filter((name) => name !== '' && !scope.steps.includes(name));
|
|
62
|
+
}
|
package/src/verify-checks.ts
CHANGED
|
@@ -51,7 +51,6 @@ import {
|
|
|
51
51
|
} from './schema-dump-drift';
|
|
52
52
|
import { cardRouteFindings } from './seo-cards';
|
|
53
53
|
import { scanSiteMeta } from './seo-meta';
|
|
54
|
-
import { quoteArg } from './shell-quote';
|
|
55
54
|
import { loadSiteSettings } from './site-config';
|
|
56
55
|
import { readStaticReport } from './static-report';
|
|
57
56
|
import { unknownToolGateFindings } from './tool-gate-names';
|
|
@@ -67,7 +66,7 @@ import { roleLoadFindings } from './verify-role-load';
|
|
|
67
66
|
import type { VerifyStep } from './verify-step';
|
|
68
67
|
import { fromExec, fromFindings, hostFindings } from './verify-step';
|
|
69
68
|
import { TEST_STEPS } from './verify-tests';
|
|
70
|
-
import { typecheckArgs } from './verify-typecheck';
|
|
69
|
+
import { typecheckArgs, typecheckFinding } from './verify-typecheck';
|
|
71
70
|
import { checkPackageShape, fileSizeReport, hasWorkspacePackages } from './workspace-checks';
|
|
72
71
|
import { checkExternalDependencies } from './workspace-external-deps';
|
|
73
72
|
import { checkWorkspaceDependencies } from './workspace-graph';
|
|
@@ -92,12 +91,7 @@ export const VERIFY_STEPS: readonly VerifyStep[] = [
|
|
|
92
91
|
const floor = await readVerifyFloor(ctx.root);
|
|
93
92
|
const argv = await typecheckArgs(ctx.root, floor?.typecheckBin ?? 'tsc');
|
|
94
93
|
const result = await runTypecheck(ctx, argv);
|
|
95
|
-
return fromExec(result,
|
|
96
|
-
code: 'X_TYPECHECK_FAILED',
|
|
97
|
-
cause: 'the project does not typecheck',
|
|
98
|
-
// Joined, never spliced: `typecheckBin` is a value from the app's `x.verify.json`.
|
|
99
|
-
fix: ['bunx', ...argv.map(quoteArg)].join(' '),
|
|
100
|
-
});
|
|
94
|
+
return fromExec(result, typecheckFinding(result.stdout));
|
|
101
95
|
},
|
|
102
96
|
},
|
|
103
97
|
{
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
recordTimings,
|
|
42
42
|
slowestOf,
|
|
43
43
|
} from './test-timings';
|
|
44
|
+
import { reachedWidth } from './test-workers';
|
|
44
45
|
import type { MachinePace } from './verify-pace';
|
|
45
46
|
import { defaultTimeoutArgs, paceEnv } from './verify-pace';
|
|
46
47
|
import type { StepOutcome } from './verify-step';
|
|
@@ -238,7 +239,9 @@ export async function runCovered(options: CoveredRunOptions): Promise<CoveredRun
|
|
|
238
239
|
}),
|
|
239
240
|
],
|
|
240
241
|
workers: width,
|
|
241
|
-
...(options.widthReason === undefined
|
|
242
|
+
...(options.widthReason === undefined
|
|
243
|
+
? {}
|
|
244
|
+
: { widthReason: reachedWidth(width, want, options.widthReason) }),
|
|
242
245
|
tests: countsOf(results),
|
|
243
246
|
...(first === undefined ? {} : { output }),
|
|
244
247
|
...(Object.keys(measured).length === 0 ? {} : { slowest: slowestOf(measured, options.files) }),
|
package/src/verify-live.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import type { Runner } from './exec';
|
|
7
7
|
import { msg } from './messages';
|
|
8
8
|
import { floorRequires, readVerifyFloor } from './verify-floor';
|
|
9
|
-
import type { LoginProbe, Probe } from './verify-services';
|
|
9
|
+
import type { LoginProbe, Probe, StackReport } from './verify-services';
|
|
10
10
|
import {
|
|
11
11
|
ensureTestServices,
|
|
12
12
|
SERVICES_DOWN,
|
|
@@ -14,12 +14,16 @@ import {
|
|
|
14
14
|
TEST_DATABASE_KEY,
|
|
15
15
|
} from './verify-services';
|
|
16
16
|
import type { StepOutcome, VerifyContext, VerifyStep } from './verify-step';
|
|
17
|
+
import { writeErrorLine } from './write-line';
|
|
17
18
|
|
|
18
|
-
/**
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Whether this run needs `live`: `floored` when the committed floor holds it (an empty suite is
|
|
21
|
+
* red there), `asked` when only `--only` named it.
|
|
22
|
+
*/
|
|
23
|
+
async function liveRequired(ctx: VerifyContext): Promise<'floored' | 'asked' | undefined> {
|
|
24
|
+
if (floorRequires(await readVerifyFloor(ctx.root), 'live')) return 'floored';
|
|
20
25
|
const only = ctx.only === undefined ? [] : typeof ctx.only === 'string' ? [ctx.only] : ctx.only;
|
|
21
|
-
|
|
22
|
-
return floorRequires(await readVerifyFloor(ctx.root), 'live');
|
|
26
|
+
return only.includes('live') ? 'asked' : undefined;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
/** `ctx` whose every child sees `env` beneath its own overrides — an explicit unset still wins. */
|
|
@@ -37,17 +41,33 @@ const withWarning = (outcome: StepOutcome, warning: string): StepOutcome => ({
|
|
|
37
41
|
warnings: [...(outcome.warnings ?? []), warning],
|
|
38
42
|
});
|
|
39
43
|
|
|
44
|
+
/** The one line about the stack: which it is, and what became of it. Stderr: stdout may be JSON. */
|
|
45
|
+
const stackLine = (stack: StackReport, services: readonly string[]): string =>
|
|
46
|
+
msg(`cli.verify.services.line.${stack.state}`, {
|
|
47
|
+
project: stack.project,
|
|
48
|
+
services: services.join(', '),
|
|
49
|
+
other: stack.with ?? '',
|
|
50
|
+
why: stack.why === undefined ? '' : msg(`cli.verify.services.why.${stack.why}`),
|
|
51
|
+
});
|
|
52
|
+
|
|
40
53
|
/**
|
|
41
|
-
* `step` with its database found or started first. A stack that cannot be started is
|
|
42
|
-
*
|
|
43
|
-
*
|
|
54
|
+
* `step` with its database found or started first. A stack that cannot be started is the step's
|
|
55
|
+
* FINDING when the floor holds `live` and nothing ran — the services are why, and the floor's own
|
|
56
|
+
* `X_VERIFY_SUITE_VANISHED` would only restate the symptom with a fix that reruns it. Otherwise it
|
|
57
|
+
* stays a WARNING carrying `X_TEST_SERVICES_UNAVAILABLE`: tests that ran without it still count.
|
|
44
58
|
* Never torn down: the next run reuses it, and the warning says how to stop it.
|
|
45
59
|
*/
|
|
46
|
-
export function withTestServices(
|
|
60
|
+
export function withTestServices(
|
|
61
|
+
step: VerifyStep,
|
|
62
|
+
probe?: Probe,
|
|
63
|
+
login?: LoginProbe,
|
|
64
|
+
say: (line: string) => void = writeErrorLine,
|
|
65
|
+
): VerifyStep {
|
|
47
66
|
return {
|
|
48
67
|
...step,
|
|
49
68
|
async run(ctx) {
|
|
50
|
-
|
|
69
|
+
const required = await liveRequired(ctx);
|
|
70
|
+
if (required === undefined) return step.run(ctx);
|
|
51
71
|
const verdict = await ensureTestServices({
|
|
52
72
|
root: ctx.root,
|
|
53
73
|
runner: ctx.runner,
|
|
@@ -62,15 +82,19 @@ export function withTestServices(step: VerifyStep, probe?: Probe, login?: LoginP
|
|
|
62
82
|
return own === undefined || own === '' ? outcome : reached(outcome);
|
|
63
83
|
}
|
|
64
84
|
if (verdict.kind === 'unavailable') {
|
|
85
|
+
const outcome = await step.run(ctx);
|
|
86
|
+
const ranNothing = outcome.tests?.ran === 0 && outcome.shard === undefined;
|
|
87
|
+
if (required === 'floored' && ranNothing) {
|
|
88
|
+
const findings = [verdict.finding, ...outcome.findings];
|
|
89
|
+
return { ...outcome, ok: false, findings, services: 'unavailable' };
|
|
90
|
+
}
|
|
65
91
|
const { code, cause, fix } = verdict.finding;
|
|
66
92
|
return {
|
|
67
|
-
...withWarning(
|
|
68
|
-
await step.run(ctx),
|
|
69
|
-
msg('cli.verify.services.unavailable', { code, cause, fix }),
|
|
70
|
-
),
|
|
93
|
+
...withWarning(outcome, msg('cli.verify.services.unavailable', { code, cause, fix })),
|
|
71
94
|
services: 'unavailable',
|
|
72
95
|
};
|
|
73
96
|
}
|
|
97
|
+
if (verdict.stack !== undefined) say(stackLine(verdict.stack, verdict.startedServices));
|
|
74
98
|
const outcome = reached(await step.run(withEnv(ctx, verdict.env)));
|
|
75
99
|
// Whatever this run's `up` started, by compose's answer — a reachable Postgres beside a
|
|
76
100
|
// freshly started Redis still leaves containers running; a stack already up says nothing.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// `--only <step>[,<step>…]`, read once for every command that narrows the gate: `x verify --only`
|
|
2
|
+
// and `x upgrade --only` take the same list, refused the same way, so the two cannot disagree.
|
|
3
|
+
|
|
4
|
+
import { nearestName, renderFixShellArg } from '@ultimat3/core';
|
|
5
|
+
import { BadFlagError } from './errors';
|
|
6
|
+
import type { ParsedArgs } from './parse';
|
|
7
|
+
import { flagString } from './parse';
|
|
8
|
+
import type { VerifyStepName } from './verify-step';
|
|
9
|
+
import { VERIFY_STEP_NAMES } from './verify-step';
|
|
10
|
+
|
|
11
|
+
/** The commands whose `--only` narrows the gate; each refusal's `fix:` re-runs the one typed. */
|
|
12
|
+
export type StepListCommand = 'verify' | 'upgrade';
|
|
13
|
+
|
|
14
|
+
const isStepName = (raw: string): raw is VerifyStepName =>
|
|
15
|
+
(VERIFY_STEP_NAMES as readonly string[]).includes(raw);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The steps `--only` names, or nothing: one step (`--only lint`) or a comma-separated list
|
|
19
|
+
* (`--only typecheck,lint,boundaries`), in the gate's declared order whatever order they were
|
|
20
|
+
* typed in. Refused against `VERIFY_STEP_NAMES` — the same constant the runner's list is built
|
|
21
|
+
* from — so a typo can never be read as "narrow to no steps at all", which is a run that passes by
|
|
22
|
+
* checking nothing. An empty item (`lint,,drift`, a trailing comma) is refused for the same reason.
|
|
23
|
+
*
|
|
24
|
+
* A near miss leads with the list as it would be with each typo corrected; an item near NOTHING
|
|
25
|
+
* gets the command itself rather than an invented lead, which is the rule `parse.ts` already
|
|
26
|
+
* follows for a command that resembles none. Both arms are commands that run.
|
|
27
|
+
*/
|
|
28
|
+
export const readStepList = (
|
|
29
|
+
args: ParsedArgs,
|
|
30
|
+
command: StepListCommand,
|
|
31
|
+
): readonly VerifyStepName[] | undefined => {
|
|
32
|
+
const raw = flagString(args, 'only');
|
|
33
|
+
if (raw === undefined) return undefined;
|
|
34
|
+
const items = raw.split(',').map((item) => item.trim());
|
|
35
|
+
const unknown = items.filter((item) => !isStepName(item));
|
|
36
|
+
if (unknown.length === 0) {
|
|
37
|
+
return VERIFY_STEP_NAMES.filter((name) => items.includes(name));
|
|
38
|
+
}
|
|
39
|
+
// An empty item corrects to nothing — never to whichever step is nearest to ''.
|
|
40
|
+
const corrected = items.map((item) =>
|
|
41
|
+
isStepName(item) ? item : item === '' ? undefined : nearestName(item, VERIFY_STEP_NAMES),
|
|
42
|
+
);
|
|
43
|
+
const list = corrected.every((item) => item !== undefined)
|
|
44
|
+
? renderFixShellArg([...new Set(corrected)].join(','), '<step,step>')
|
|
45
|
+
: undefined;
|
|
46
|
+
throw new BadFlagError({
|
|
47
|
+
flag: 'only',
|
|
48
|
+
command,
|
|
49
|
+
reason: `${reasonOf(unknown)} (${VERIFY_STEP_NAMES.join(', ')})`,
|
|
50
|
+
fix: command === 'verify' ? verifyFix(list) : upgradeFix(list),
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// One literal per command: the command word never reaches a `fix:` as a spliced value.
|
|
55
|
+
const verifyFix = (list: string | undefined): string =>
|
|
56
|
+
list === undefined ? 'x verify --json' : `x verify --only ${list} --json`;
|
|
57
|
+
const upgradeFix = (list: string | undefined): string =>
|
|
58
|
+
list === undefined ? 'x upgrade --json' : `x upgrade --only ${list} --json`;
|
|
59
|
+
|
|
60
|
+
const reasonOf = (unknown: readonly string[]): string => {
|
|
61
|
+
const named = unknown.map((item) => (item === '' ? '(empty)' : `"${item}"`)).join(', ');
|
|
62
|
+
return `${named} ${unknown.length === 1 ? 'is not a gate step' : 'are not gate steps'}`;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/** The gate's steps a narrowed run leaves out, in declared order: what someone else still owes. */
|
|
66
|
+
export const stepsNotIn = (only: readonly string[]): readonly VerifyStepName[] =>
|
|
67
|
+
VERIFY_STEP_NAMES.filter((name) => !only.includes(name));
|
package/src/verify-progress.ts
CHANGED
|
@@ -8,6 +8,8 @@ import { systemClock } from '@ultimat3/core';
|
|
|
8
8
|
import { TEST_TYPES } from '@ultimat3/testing';
|
|
9
9
|
import { msg } from './messages';
|
|
10
10
|
import type { StepResult } from './output';
|
|
11
|
+
import type { ReaderOptions } from './output-findings';
|
|
12
|
+
import { fixForReader } from './output-findings';
|
|
11
13
|
import { quoteArg } from './shell-quote';
|
|
12
14
|
import { isTest } from './source-files';
|
|
13
15
|
import type { VerifyStepName } from './verify-step';
|
|
@@ -56,10 +58,10 @@ export function narrowestRerun(step: StepResult): string {
|
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
/** `✓ lint 22.0s`, `○ seo 0.0s` (did not apply), `✗ unit 3.1s → x test unit --filter … --json`. */
|
|
59
|
-
export function humanStepLine(step: StepResult): string {
|
|
61
|
+
export function humanStepLine(step: StepResult, reader: ReaderOptions = {}): string {
|
|
60
62
|
const mark = step.skipped === true ? '○' : step.ok ? '✓' : '✗';
|
|
61
63
|
const line = `${mark} ${step.name} ${(step.durationMs / 1000).toFixed(1)}s`;
|
|
62
|
-
return step.ok ? line : `${line} → ${narrowestRerun(step)}`;
|
|
64
|
+
return step.ok ? line : `${line} → ${fixForReader(narrowestRerun(step), reader)}`;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
/** `12m 3s`, `45s`: a person reading a CI log, not a parser — the step lines carry exact ms. */
|
|
@@ -89,6 +91,8 @@ export interface VerifyProgressOptions {
|
|
|
89
91
|
* for a person — `x verify` and `scripts/verify.ts` pass it when `--json` is unset.
|
|
90
92
|
*/
|
|
91
93
|
readonly render?: 'json' | 'human';
|
|
94
|
+
/** Who reads the human line's pointer: `x` is not every reader's command. */
|
|
95
|
+
readonly reader?: ReaderOptions;
|
|
92
96
|
}
|
|
93
97
|
|
|
94
98
|
/**
|
|
@@ -120,7 +124,7 @@ export async function withVerifyProgress<T>(
|
|
|
120
124
|
},
|
|
121
125
|
onStep: (step) => {
|
|
122
126
|
running.delete(step.name);
|
|
123
|
-
write(options.render === 'human' ? humanStepLine(step) : stepLine(step));
|
|
127
|
+
write(options.render === 'human' ? humanStepLine(step, options.reader) : stepLine(step));
|
|
124
128
|
},
|
|
125
129
|
});
|
|
126
130
|
} finally {
|
package/src/verify-run.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// `cmd-verify.ts` because `x build` and the MCP host run the gate without going through the
|
|
3
3
|
// command: what a run means — never bail early, count what actually ran — belongs to neither.
|
|
4
4
|
|
|
5
|
-
import { ERROR_DOCS_URL, renderThrowable } from '@ultimat3/core';
|
|
5
|
+
import { ERROR_DOCS_URL, isUltimateError, renderThrowable, stringField } from '@ultimat3/core';
|
|
6
6
|
import type { CoverageMap } from './coverage-lcov';
|
|
7
7
|
import { encodeCoverage } from './coverage-lcov';
|
|
8
8
|
import { msg } from './messages';
|
|
@@ -323,7 +323,11 @@ async function runStep(
|
|
|
323
323
|
// A step the floor requires whose suite executed nothing is the same vanished suite as a step
|
|
324
324
|
// with no files at all — the run just had to finish before it could be seen. Appended to the
|
|
325
325
|
// step's own findings so `data.failed`, the counts and every gate reading this table carry it.
|
|
326
|
-
|
|
326
|
+
// Unless the step already said why: a `live` step whose services could not start carries that
|
|
327
|
+
// finding itself, and a second one here would bury the cause under its symptom.
|
|
328
|
+
const explained = outcome.services === 'unavailable' && outcome.findings.length > 0;
|
|
329
|
+
const vanished =
|
|
330
|
+
nothingRan && required && !explained ? [skippedSuiteFinding(step.name, tests.skipped)] : [];
|
|
327
331
|
const unrun = nothingRan ? ranNothingReason(tests) : undefined;
|
|
328
332
|
const strict = unrun === undefined ? [] : judgeUnrun(floor, step.name, unrun, required, command);
|
|
329
333
|
// A `skip` why over a suite that RAN tests is stale: said on the step, never red. Only on counts
|
|
@@ -389,6 +393,20 @@ async function expired(
|
|
|
389
393
|
}
|
|
390
394
|
|
|
391
395
|
function findingOf(error: unknown, step: string, command: string): Finding {
|
|
396
|
+
// A coded throw already carries its instruction: print its code and its fix, never the gate's
|
|
397
|
+
// own rerun, which only repeats the step that just threw (an `X_ENV_MISSING` under `manifest`).
|
|
398
|
+
// `stringField` because the read may fight back, like `renderThrowable` below.
|
|
399
|
+
if (isUltimateError(error)) {
|
|
400
|
+
const [code, cause, fix] = ['code', 'cause', 'fix'].map((key) => stringField(error, key));
|
|
401
|
+
if (code !== undefined && cause !== undefined && fix !== undefined && fix !== '') {
|
|
402
|
+
return {
|
|
403
|
+
code: 'X_VERIFY_FAILED',
|
|
404
|
+
cause: `step "${step}" threw ${code}: ${cause}`,
|
|
405
|
+
fix,
|
|
406
|
+
docs: ERROR_DOCS_URL,
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
}
|
|
392
410
|
// A step may throw anything, including an Error that fights being read: `instanceof` runs a
|
|
393
411
|
// Proxy's `getPrototypeOf` trap and `.message` runs a getter, so a hostile throw would take the
|
|
394
412
|
// gate's own report down with it — the one message that may never be lost.
|