@ultimat3/cli 31.26.0 → 31.28.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 +47 -37
- package/README.md +19 -8
- package/package.json +29 -29
- package/src/app-manifest.ts +6 -1
- package/src/app-mcp.ts +17 -3
- package/src/cmd-cache-spec.ts +5 -2
- package/src/cmd-db-spec.ts +2 -3
- package/src/cmd-db.ts +0 -2
- package/src/cmd-deploy-verify-sample.ts +93 -0
- package/src/cmd-deploy-verify.ts +2 -41
- package/src/cmd-dev-spec.ts +15 -1
- package/src/cmd-dev.ts +31 -4
- package/src/cmd-doctor.ts +15 -4
- package/src/cmd-exercise-spec.ts +7 -1
- package/src/cmd-exercise.ts +22 -10
- package/src/cmd-generate.ts +2 -0
- package/src/cmd-jobs-spec.ts +3 -6
- package/src/cmd-jobs.ts +1 -7
- package/src/cmd-logs-spec.ts +2 -1
- package/src/cmd-logs.ts +9 -28
- package/src/cmd-planned.ts +11 -45
- package/src/cmd-profile-frames.ts +99 -0
- package/src/cmd-profile-spec.ts +24 -0
- package/src/cmd-profile.ts +164 -0
- package/src/cmd-repro-spec.ts +13 -1
- package/src/cmd-repro.ts +37 -5
- package/src/cmd-status-sample.ts +57 -0
- package/src/cmd-status-spec.ts +30 -0
- package/src/cmd-status.ts +108 -0
- package/src/cmd-token-spec.ts +5 -2
- package/src/cmd-token.ts +7 -3
- package/src/cmd-upgrade-codemods.ts +71 -0
- package/src/cmd-upgrade-spec.ts +19 -5
- package/src/cmd-upgrade.ts +91 -34
- package/src/codemods/agents-dev-mcp.ts +50 -0
- package/src/codemods/authenticator-session-refusal.ts +214 -0
- package/src/codemods/biome-no-default-export.ts +58 -0
- package/src/codemods/bunfig-island-coverage.ts +33 -0
- package/src/codemods/chart-dashboard.ts +73 -0
- package/src/codemods/ci-e2e-browser-stock.ts +75 -0
- package/src/codemods/ci-e2e-browser.ts +63 -0
- package/src/codemods/codemod.ts +58 -0
- package/src/codemods/define-error-leaf.ts +73 -0
- package/src/codemods/docs-ci-parts.ts +65 -0
- package/src/codemods/docs-gate-prose.ts +53 -0
- package/src/codemods/docs-island-rows.ts +31 -0
- package/src/codemods/docs-shipped-guards.ts +100 -0
- package/src/codemods/docs-test-services.ts +62 -0
- package/src/codemods/engine-diff.ts +104 -0
- package/src/codemods/engine-edits.ts +111 -0
- package/src/codemods/engine-fs.ts +95 -0
- package/src/codemods/engine.ts +191 -0
- package/src/codemods/format-edited-hook-3122.ts +28 -0
- package/src/codemods/format-edited-hook.ts +152 -0
- package/src/codemods/helm-alerts-objective.ts +105 -0
- package/src/codemods/helm-alerts-stock.ts +108 -0
- package/src/codemods/index.ts +56 -0
- package/src/codemods/metrics-probe-healthz.ts +47 -0
- package/src/codemods/pending.ts +36 -0
- package/src/codemods/repro-gitignore.ts +40 -0
- package/src/codemods/runtime-pin-lines.ts +109 -0
- package/src/codemods/runtime-pin.ts +116 -0
- package/src/codemods/solid-floor.ts +63 -0
- package/src/codemods/test-ports.ts +86 -0
- package/src/codemods/test-suites.ts +37 -0
- package/src/codemods/theme-toggle-mount-over.ts +70 -0
- package/src/codemods/vendored-guards.ts +186 -0
- package/src/codemods/verify-floor-skips.ts +88 -0
- package/src/codemods/verify-floor-steps.ts +90 -0
- package/src/coverage-island.ts +121 -0
- package/src/coverage-lcov.ts +49 -5
- package/src/coverage-remap.ts +146 -0
- package/src/db-replay-engine-prepared.ts +66 -0
- package/src/db-replay-engine-template.ts +156 -0
- package/src/db-replay-engine.ts +4 -0
- package/src/db-replay-scratch-reap.ts +54 -0
- package/src/deploy-verify-flags.ts +9 -2
- package/src/deploy-verify-grade.ts +10 -3
- package/src/dev-boot.ts +14 -1
- package/src/dev-dashboard-guard.ts +57 -10
- package/src/dev-host.ts +46 -0
- package/src/dev-tls-cache.ts +103 -0
- package/src/dev-tls-der.ts +69 -0
- package/src/dev-tls.ts +120 -0
- package/src/doctor-advisory-floors.ts +113 -0
- package/src/doctor-browser.ts +60 -0
- package/src/doctor-guards.ts +39 -86
- package/src/doctor-superseded.ts +67 -0
- package/src/error-codes-doctor.ts +12 -4
- package/src/error-codes-verify.ts +47 -0
- package/src/error-codes.ts +20 -23
- package/src/exercise-database.ts +47 -9
- package/src/exercise-push-device.ts +51 -0
- package/src/exercise-route-api.ts +74 -0
- package/src/exercise-routes.ts +14 -5
- package/src/exercise-services.ts +3 -1
- package/src/exercise-shard-flag.ts +47 -0
- package/src/fix-command.ts +2 -2
- package/src/generate-factories.ts +5 -11
- package/src/generate-feature-required.ts +9 -4
- package/src/generate-files.ts +26 -7
- package/src/generate-kinds.ts +5 -1
- package/src/guards-built-in-codes.ts +36 -0
- package/src/guards-built-in-refusal.ts +25 -0
- package/src/guards-built-in.ts +134 -0
- package/src/guards-materialize.ts +42 -0
- package/src/guards-paths.ts +37 -0
- package/src/guards-shipped-names.ts +38 -0
- package/src/guards-vendored.ts +73 -0
- package/src/guards.ts +105 -34
- package/src/index.ts +10 -0
- package/src/island-bundle-options.ts +48 -0
- package/src/island-bundle.ts +18 -46
- package/src/island-link.ts +5 -0
- package/src/island-outputs.ts +5 -0
- package/src/lint-findings.ts +3 -3
- package/src/mcp-errors-verify.ts +35 -0
- package/src/mcp-errors.ts +21 -20
- package/src/mcp-host-logs.ts +121 -0
- package/src/mcp-host.ts +12 -73
- package/src/measure-scope.ts +23 -3
- package/src/messages-floor.ts +19 -0
- package/src/messages-repro.ts +16 -2
- package/src/messages-status.ts +10 -0
- package/src/messages-upgrade.ts +15 -0
- package/src/messages.ts +22 -1
- package/src/registry.ts +4 -0
- package/src/repro-archive-collect.ts +161 -0
- package/src/repro-archive-write.ts +96 -0
- package/src/repro-archive.ts +161 -0
- package/src/repro-bundle.ts +8 -16
- package/src/repro-errors.ts +14 -2
- package/src/repro-framework.ts +53 -0
- package/src/repro-parse.ts +87 -0
- package/src/repro-redact.ts +218 -0
- package/src/repro-scrub.ts +257 -0
- package/src/role-start-types.ts +7 -0
- package/src/role-start.ts +4 -0
- package/src/serve-boot.ts +7 -1
- package/src/serve-env-tls.ts +57 -0
- package/src/solid-loader.ts +27 -10
- package/src/superseded-match.ts +87 -0
- package/src/superseded.ts +84 -0
- package/src/templates/bun-image.ts +48 -0
- package/src/templates/generate-export-rows.ts +136 -0
- package/src/templates/generate-import-rows.ts +186 -0
- package/src/templates/generate-rows-slice.ts +95 -0
- package/src/templates/github/ci.yml.ts +5 -1
- package/src/templates/guard-released-forms.ts +112 -0
- package/src/templates/guard-runtime-pin-test.ts +54 -0
- package/src/templates/guard-runtime-pin.ts +189 -0
- package/src/templates/scaffold-claude-agents.ts +6 -6
- package/src/templates/scaffold-claude-commands.ts +1 -1
- package/src/templates/scaffold-claude-hook.ts +18 -8
- package/src/templates/scaffold-claude.ts +2 -2
- package/src/templates/scaffold-db-package.ts +3 -0
- package/src/templates/scaffold-docs.ts +34 -30
- package/src/templates/scaffold-guards.ts +73 -39
- package/src/templates/scaffold-repo.ts +4 -8
- package/src/templates/scaffold-site.ts +4 -1
- package/src/templates/scaffold-suites.ts +72 -0
- package/src/templates/scaffold-test-services.ts +35 -10
- package/src/templates/scaffold-verify-floor.ts +53 -31
- package/src/templates/shapes/api.ts +4 -0
- package/src/templates/slice-foundation.ts +3 -3
- package/src/unthrown-codes.ts +3 -1
- package/src/upgrade-bun-floor.ts +4 -0
- package/src/upgrade-clean-tree.ts +54 -0
- package/src/upgrade-gate-codemods-install.ts +40 -0
- package/src/upgrade-gate-codemods.ts +151 -0
- package/src/upgrade-gate.ts +44 -7
- package/src/upgrade-guards-baseline.ts +43 -0
- package/src/upgrade-guards.ts +37 -2
- package/src/upgrade-lock.ts +118 -0
- package/src/upgrade-plan.ts +2 -1
- package/src/upgrade-report-codemods.ts +54 -0
- package/src/upgrade-report.ts +55 -27
- package/src/upgrade-signals.ts +91 -0
- package/src/upgrade-unfinished.ts +61 -0
- package/src/verify-coverage-run.ts +42 -11
- package/src/verify-e2e.ts +115 -4
- package/src/verify-floor.ts +27 -0
- package/src/verify-guard-baseline.ts +109 -0
- package/src/verify-live.ts +72 -0
- package/src/verify-merge-skips.ts +51 -0
- package/src/verify-merge.ts +36 -2
- package/src/verify-run.ts +48 -7
- package/src/verify-services.ts +287 -0
- package/src/verify-skip-reason.ts +53 -0
- package/src/verify-strict.ts +108 -0
- package/src/verify-test-command.ts +129 -0
- package/src/verify-tests.ts +39 -126
- package/types/babel-modules.d.ts +2 -0
- package/wiki/CLI-Reference.md +200 -27
- package/wiki/Caching-And-Invalidation.md +1 -1
- package/wiki/Entities-And-Migrations.md +1 -1
- package/wiki/Interface-Rules.md +17 -8
- package/wiki/Jobs-And-Workflows.md +3 -3
- package/wiki/Known-Gaps.md +5 -1
- package/wiki/MCP-And-AI.md +1 -1
- package/wiki/Observability.md +1 -0
- package/wiki/PWA-And-Offline.md +1 -1
- package/wiki/Project-Layout.md +4 -4
- package/wiki/Troubleshooting.md +3 -3
- package/wiki/Tutorial-05-Deploy-Free.md +2 -2
- package/wiki/Upgrading.md +8 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// `strict` and `skip` in `x.verify.json`: a gate where every step either ran a check or carries a
|
|
2
|
+
// written reason it cannot here. `steps` is a floor an app grows by hand, so a step it never listed
|
|
3
|
+
// skips in silence forever; strict turns every unlisted skip red unless `skip` says why.
|
|
4
|
+
|
|
5
|
+
import { ERROR_DOCS_URL, renderFixShellArg } from '@ultimat3/core';
|
|
6
|
+
import type { Finding } from './output';
|
|
7
|
+
import { GATE_COMMAND } from './verify-step';
|
|
8
|
+
|
|
9
|
+
/** The floor's strict switch. Named once: the problem quotes it and the fix repairs it. */
|
|
10
|
+
export const STRICT_FIELD = 'strict';
|
|
11
|
+
|
|
12
|
+
/** The floor's written reasons: step name → why it runs no check in this repository. */
|
|
13
|
+
export const SKIP_FIELD = 'skip';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Strict red's code. A string here until the coordinator registers it in `error-codes.ts`; the
|
|
17
|
+
* literal is the one spelling every reader of this module uses.
|
|
18
|
+
*/
|
|
19
|
+
export const STRICT_UNRUN_CODE = 'X_VERIFY_STRICT_UNRUN';
|
|
20
|
+
|
|
21
|
+
/** Step name → the written reason it runs no check here. */
|
|
22
|
+
export type SkipReasons = Readonly<Record<string, string>>;
|
|
23
|
+
|
|
24
|
+
/** The two keys as `parseVerifyFloor` folds them in: off and none when absent. */
|
|
25
|
+
export interface StrictFloor {
|
|
26
|
+
readonly strict?: boolean;
|
|
27
|
+
readonly skip?: SkipReasons;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* `strict` (true or false) and `skip` (`{ "<step>": "<why>" }`, a step the gate runs, a non-empty
|
|
32
|
+
* reason, never one `steps` already requires), or the problems. A why that is blank is no why: it
|
|
33
|
+
* is the silent skip strict exists to refuse, typed into the file.
|
|
34
|
+
*/
|
|
35
|
+
export function readStrict(
|
|
36
|
+
payload: Record<string, unknown> | undefined,
|
|
37
|
+
declared: readonly string[],
|
|
38
|
+
): StrictFloor & { readonly problems: readonly string[] } {
|
|
39
|
+
const problems: string[] = [];
|
|
40
|
+
const rawStrict = payload?.[STRICT_FIELD];
|
|
41
|
+
let strict: boolean | undefined;
|
|
42
|
+
if (rawStrict !== undefined) {
|
|
43
|
+
if (typeof rawStrict === 'boolean') strict = rawStrict;
|
|
44
|
+
else
|
|
45
|
+
problems.push(
|
|
46
|
+
`"${STRICT_FIELD}" is ${JSON.stringify(rawStrict)}, which is not true or false`,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
const rawSkip = payload?.[SKIP_FIELD];
|
|
50
|
+
const skip = new Map<string, string>();
|
|
51
|
+
if (rawSkip !== undefined) {
|
|
52
|
+
if (typeof rawSkip !== 'object' || rawSkip === null || Array.isArray(rawSkip)) {
|
|
53
|
+
problems.push(`"${SKIP_FIELD}" is not an object of { "<step>": "<why>" }`);
|
|
54
|
+
} else {
|
|
55
|
+
const required = Array.isArray(payload?.['steps']) ? (payload['steps'] as unknown[]) : [];
|
|
56
|
+
for (const [step, why] of Object.entries(rawSkip)) {
|
|
57
|
+
if (!declared.includes(step)) {
|
|
58
|
+
problems.push(`"${SKIP_FIELD}" names ${step}, which x verify does not run`);
|
|
59
|
+
} else if (typeof why !== 'string' || why.trim() === '') {
|
|
60
|
+
problems.push(`"${SKIP_FIELD}" gives ${step} no written why`);
|
|
61
|
+
} else if (required.includes(step)) {
|
|
62
|
+
problems.push(`"${SKIP_FIELD}" excuses ${step}, which the floor's step list requires`);
|
|
63
|
+
} else skip.set(step, why.trim());
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
...(strict === undefined ? {} : { strict }),
|
|
69
|
+
...(skip.size === 0 ? {} : { skip: Object.fromEntries(skip) }),
|
|
70
|
+
problems,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** The written why for this step, when the floor carries one. */
|
|
75
|
+
export const skipWhy = (floor: StrictFloor | undefined, step: string): string | undefined =>
|
|
76
|
+
floor?.skip !== undefined && Object.hasOwn(floor.skip, step) ? floor.skip[step] : undefined;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A step that ran no check, under a strict floor, with no why. The fix opens with the command that
|
|
80
|
+
* shows what the step needs, and carries the edit that excuses it behind the `#`: either is right,
|
|
81
|
+
* and neither is the gate's to perform on its own file.
|
|
82
|
+
*/
|
|
83
|
+
export const strictUnrunFinding = (
|
|
84
|
+
step: string,
|
|
85
|
+
reason: string,
|
|
86
|
+
command: string = GATE_COMMAND,
|
|
87
|
+
): Finding => ({
|
|
88
|
+
code: STRICT_UNRUN_CODE,
|
|
89
|
+
cause: `x.verify.json is strict and the ${step} step ran no check (${reason}) with no written why`,
|
|
90
|
+
fix: `${command} --only ${renderFixShellArg(step, '<step>')} --json # give ${step} a suite or an input to run, or write "${SKIP_FIELD}": { "${step}": "<why>" } in x.verify.json`,
|
|
91
|
+
docs: ERROR_DOCS_URL,
|
|
92
|
+
at: 'x.verify.json',
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The verdict on one step that ran no check. Strict and unexcused is red; a step the floor's
|
|
97
|
+
* `steps` requires is the vanished-suite finding's to report, so it is never judged twice here.
|
|
98
|
+
*/
|
|
99
|
+
export const judgeUnrun = (
|
|
100
|
+
floor: StrictFloor | undefined,
|
|
101
|
+
step: string,
|
|
102
|
+
reason: string,
|
|
103
|
+
required: boolean,
|
|
104
|
+
command?: string,
|
|
105
|
+
): readonly Finding[] =>
|
|
106
|
+
floor?.strict === true && !required && skipWhy(floor, step) === undefined
|
|
107
|
+
? [strictUnrunFinding(step, reason, command)]
|
|
108
|
+
: [];
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// What decides a test file's type, and the `bun test` argv each type's step runs: the ordered
|
|
2
|
+
// ownership rules, the ignore globs, the per-type filters and timeouts. Split from `verify-tests.ts`
|
|
3
|
+
// at its 500-line ceiling, which builds the steps; one definition here, so `x test <type>` and the
|
|
4
|
+
// gate's `<type>` step can never disagree about what a suite is.
|
|
5
|
+
|
|
6
|
+
import type { TestType } from '@ultimat3/testing';
|
|
7
|
+
import { IGNORED_TEST_PATTERNS } from './test-ignores';
|
|
8
|
+
import type { MachinePace } from './verify-pace';
|
|
9
|
+
import { DECLARED_PACE, defaultTimeoutArgs, pacedMs } from './verify-pace';
|
|
10
|
+
|
|
11
|
+
type TypedTest = Exclude<TestType, 'unit'>;
|
|
12
|
+
|
|
13
|
+
const TYPED_SUFFIXES = '{contract,live,job,e2e,eval}';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Every rule that decides a file's type, MOST SPECIFIC FIRST: the first entry a path matches owns
|
|
17
|
+
* it, and no later entry may claim it. Each is a substring `bun test` matches against a file path,
|
|
18
|
+
* which is exactly how bun reads more than one positional filter (measured: `.contract.test.` +
|
|
19
|
+
* `.job.test.` runs the union of both suites, never the intersection).
|
|
20
|
+
*
|
|
21
|
+
* A FILENAME declares a type; a DIRECTORY only fills in for a filename that declares none — which
|
|
22
|
+
* is why the one directory rule is last. Ownership had no order at all until 2026-08, so
|
|
23
|
+
* `packages/app/e2e/payment.contract.test.ts` matched `.contract.test.` AND `e2e/`: the `contract`
|
|
24
|
+
* step selected it by name while the `e2e` step's argv selected it by directory, and one test ran
|
|
25
|
+
* twice in one gate. The bare word `e2e` was worse still — it matched any path holding those three
|
|
26
|
+
* characters anywhere, so `src/e2e-helpers.test.ts` joined the e2e step and left the unit step,
|
|
27
|
+
* which selects by exclusion.
|
|
28
|
+
*/
|
|
29
|
+
const OWNERSHIP = [
|
|
30
|
+
['contract', '.contract.test.'],
|
|
31
|
+
['live', '.live.test.'],
|
|
32
|
+
['job', '.job.test.'],
|
|
33
|
+
['e2e', '.e2e.test.'],
|
|
34
|
+
['eval', '.eval.test.'],
|
|
35
|
+
// `e2e/`, not `/e2e/`: bun matches a filter against the cwd-relative path and answers
|
|
36
|
+
// `Test filter "/e2e/" had no matches` for the anchored form (bun 1.3.14). The trailing slash
|
|
37
|
+
// is the boundary this can express, and it is the same string `ownerOf` ranks last, so the
|
|
38
|
+
// step's argv and the file list can never disagree about what an e2e test is.
|
|
39
|
+
['e2e', 'e2e/'],
|
|
40
|
+
] as const satisfies readonly (readonly [TypedTest, string])[];
|
|
41
|
+
|
|
42
|
+
/** The types whose filename rule outranks the `e2e/` directory — e2e's own never does. */
|
|
43
|
+
const OUTRANKING_E2E: readonly TypedTest[] = [
|
|
44
|
+
...new Set(OWNERSHIP.filter(([type]) => type !== 'e2e').map(([type]) => type)),
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The one suite a path belongs to, and `unit` when no rule claims it — the single definition of a
|
|
49
|
+
* file's type, which both `x test <type>` and the gate's own steps select through. Exactly one
|
|
50
|
+
* owner is the point: two owners is a file two steps run, and a test that runs twice in one gate
|
|
51
|
+
* proves nothing the first run did not.
|
|
52
|
+
*/
|
|
53
|
+
export const ownerOf = (path: string): TestType =>
|
|
54
|
+
OWNERSHIP.find(([, filter]) => path.includes(filter))?.[0] ?? 'unit';
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Paths a suite's own filters match but the suite does NOT own, as `--path-ignore-patterns`. Only
|
|
58
|
+
* `e2e` has any, for the reason above. It has to be said in the argv and not only in `ownerOf`:
|
|
59
|
+
* bun has no "match this and not that" filter, and a serial step runs the argv rather than a file
|
|
60
|
+
* list — so exclusivity that lived only in the file list would still have run the file twice.
|
|
61
|
+
*/
|
|
62
|
+
const disownedBy = (type: TypedTest): readonly string[] =>
|
|
63
|
+
type === 'e2e' ? [`**/e2e/**/*.{${OUTRANKING_E2E.join(',')}}.test.*`] : [];
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Build output, and nested projects that carry their own `x verify`. `examples/**` and
|
|
67
|
+
* `dummy/**` are the second kind: each holds a whole app gated by its own run of this same step
|
|
68
|
+
* list, so collecting them here would report one app failure on two different gates. The patterns
|
|
69
|
+
* are relative to the run's root, so this excludes nothing when the app itself is the root. The
|
|
70
|
+
* policy — which directories, and which are anchored at the root — is `test-ignores.ts`'s, the same
|
|
71
|
+
* one `discoverTests` filters the parallel steps by; this is its glob projection.
|
|
72
|
+
*
|
|
73
|
+
* `dummy/**` was added after the framework gate started running a demo app's tests and disagreeing
|
|
74
|
+
* with `bun run test` — which already excluded it — for no reason a reader could see.
|
|
75
|
+
*
|
|
76
|
+
* Excluded here is not ungated: `scripts/reference-app-gate.ts` runs `x verify` inside each of
|
|
77
|
+
* those apps and blocks on a per-app ratchet. Until 2026-08 that was only true of `examples/**`,
|
|
78
|
+
* and `dummy/social-media-clone` was excluded by this list and gated by nothing.
|
|
79
|
+
*/
|
|
80
|
+
const NEVER_A_TEST = IGNORED_TEST_PATTERNS;
|
|
81
|
+
|
|
82
|
+
const ignoreFlags = (patterns: readonly string[]): readonly string[] =>
|
|
83
|
+
patterns.map((pattern) => `--path-ignore-patterns=${pattern}`);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The substrings that decide a file's type — the same ones the step's `bun test` runs with, so
|
|
87
|
+
* `x test <type>` and the gate's `<type>` step can never disagree about what a contract test is.
|
|
88
|
+
*/
|
|
89
|
+
export const typeFiltersOf = (type: Exclude<TestType, 'unit'>): readonly string[] =>
|
|
90
|
+
OWNERSHIP.filter(([owner]) => owner === type).map(([, filter]) => filter);
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* What an e2e test's path is, as globs: the e2e step's own substrings (`typeFiltersOf('e2e')`),
|
|
94
|
+
* each spelt as the glob matching the same paths. One definition, read three ways — the e2e step
|
|
95
|
+
* selects by the substrings, the unit step ignores these globs, and `scripts/coverage-gate.ts`
|
|
96
|
+
* leaves them out of a package's coverage: an e2e suite drives a built app through a browser and
|
|
97
|
+
* child processes no in-process lcov sees, and it already runs in its own gate step.
|
|
98
|
+
*/
|
|
99
|
+
export const E2E_PATH_GLOBS: readonly string[] = typeFiltersOf('e2e').map((filter) =>
|
|
100
|
+
filter.endsWith('/') ? `**/*${filter}**` : `**/*${filter}*`,
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* An e2e test's own budget: a first navigation waits on `x dev` compiling the route and its island,
|
|
105
|
+
* which bun's default 5 s does not cover — a timeout there reads as an app bug that is not one.
|
|
106
|
+
*/
|
|
107
|
+
export const E2E_TEST_TIMEOUT_MS = 60_000;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Unit is everything the typed suites do not claim, so no test can fall between two steps. Each
|
|
111
|
+
* per-test default is read at the machine's `pace` (`verify-pace.ts`).
|
|
112
|
+
*/
|
|
113
|
+
export const testStepCommand = (type: TestType, pace?: MachinePace): readonly string[] =>
|
|
114
|
+
type === 'unit'
|
|
115
|
+
? [
|
|
116
|
+
'bun',
|
|
117
|
+
'test',
|
|
118
|
+
...defaultTimeoutArgs(pace),
|
|
119
|
+
...ignoreFlags([...NEVER_A_TEST, ...E2E_PATH_GLOBS, `**/*.${TYPED_SUFFIXES}.test.*`]),
|
|
120
|
+
]
|
|
121
|
+
: [
|
|
122
|
+
'bun',
|
|
123
|
+
'test',
|
|
124
|
+
...(type === 'e2e'
|
|
125
|
+
? [`--timeout=${String(pacedMs(E2E_TEST_TIMEOUT_MS, pace ?? DECLARED_PACE))}`]
|
|
126
|
+
: defaultTimeoutArgs(pace)),
|
|
127
|
+
...ignoreFlags([...NEVER_A_TEST, ...disownedBy(type)]),
|
|
128
|
+
...typeFiltersOf(type),
|
|
129
|
+
];
|
package/src/verify-tests.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// One gate step per test type, so every type reports on its own line. A test's type is its
|
|
2
2
|
// filename suffix — `*.contract.test.ts`, `*.live.test.ts`, `*.job.test.ts`, `*.e2e.test.ts`,
|
|
3
|
-
// `*.eval.test.ts` — and only then the `e2e/` directory it sits in, which is why `OWNERSHIP`
|
|
4
|
-
// is an ordered list. Everything else is a unit test,
|
|
3
|
+
// `*.eval.test.ts` — and only then the `e2e/` directory it sits in, which is why `OWNERSHIP`
|
|
4
|
+
// (`verify-test-command.ts`) is an ordered list. Everything else is a unit test, selected by exclusion.
|
|
5
5
|
//
|
|
6
6
|
// `eval` carries one rule beyond its suite — every prompt must have an eval — so it is the only
|
|
7
7
|
// step here that can fail with no test file of its own.
|
|
@@ -19,7 +19,6 @@ import { judgeCoverage } from './coverage-floor';
|
|
|
19
19
|
import { msg } from './messages';
|
|
20
20
|
import { countsOf } from './test-counts';
|
|
21
21
|
import { testEnvOverrides } from './test-dotenv';
|
|
22
|
-
import { IGNORED_TEST_PATTERNS } from './test-ignores';
|
|
23
22
|
import type { TestFile } from './test-select';
|
|
24
23
|
import { discoverTests } from './test-select';
|
|
25
24
|
import { TEST_TIMINGS_FILE } from './test-shards';
|
|
@@ -27,15 +26,17 @@ import { machineLease } from './test-slots';
|
|
|
27
26
|
import type { WorkerPlan } from './test-workers';
|
|
28
27
|
import { availableCpus, SERIAL_TYPES, totalMemory, workerPlan } from './test-workers';
|
|
29
28
|
import { runCovered } from './verify-coverage-run';
|
|
30
|
-
import { withE2eApp } from './verify-e2e';
|
|
29
|
+
import { judgeE2eBrowser, withE2eApp } from './verify-e2e';
|
|
31
30
|
import { factoryFindings } from './verify-factories';
|
|
32
31
|
import { readVerifyFloor } from './verify-floor';
|
|
32
|
+
import { withTestServices } from './verify-live';
|
|
33
33
|
import type { MachinePace } from './verify-pace';
|
|
34
|
-
import {
|
|
34
|
+
import { paceEnv } from './verify-pace';
|
|
35
35
|
import { seedFindings } from './verify-seeds';
|
|
36
36
|
import { shardFiles } from './verify-shard';
|
|
37
37
|
import type { ChangedTestSelection, StepOutcome, VerifyContext, VerifyStep } from './verify-step';
|
|
38
38
|
import { fromExec, fromFindings } from './verify-step';
|
|
39
|
+
import { testStepCommand } from './verify-test-command';
|
|
39
40
|
import { runParallel } from './verify-test-run';
|
|
40
41
|
|
|
41
42
|
/**
|
|
@@ -46,11 +47,17 @@ import { runParallel } from './verify-test-run';
|
|
|
46
47
|
* and `@ultimat3/testing` is already a runtime dependency of this package.
|
|
47
48
|
*/
|
|
48
49
|
export type { TestType } from '@ultimat3/testing';
|
|
50
|
+
// Re-exported: every caller that read a test type's filters or argv here still does.
|
|
51
|
+
export {
|
|
52
|
+
E2E_PATH_GLOBS,
|
|
53
|
+
E2E_TEST_TIMEOUT_MS,
|
|
54
|
+
ownerOf,
|
|
55
|
+
testStepCommand,
|
|
56
|
+
typeFiltersOf,
|
|
57
|
+
} from './verify-test-command';
|
|
49
58
|
|
|
50
59
|
type TypedTest = Exclude<TestType, 'unit'>;
|
|
51
60
|
|
|
52
|
-
const TYPED_SUFFIXES = '{contract,live,job,e2e,eval}';
|
|
53
|
-
|
|
54
61
|
/**
|
|
55
62
|
* `Object.create(null)`, not a `{}` literal, because `stepFor` reads it with a COMPUTED key
|
|
56
63
|
* (`SUMMARIES[type]`). On a normal object literal every `Object.prototype` member reads back as
|
|
@@ -74,124 +81,8 @@ const SUMMARIES: Readonly<Record<TypedTest, string>> = Object.assign(
|
|
|
74
81
|
},
|
|
75
82
|
);
|
|
76
83
|
|
|
77
|
-
/**
|
|
78
|
-
* Every rule that decides a file's type, MOST SPECIFIC FIRST: the first entry a path matches owns
|
|
79
|
-
* it, and no later entry may claim it. Each is a substring `bun test` matches against a file path,
|
|
80
|
-
* which is exactly how bun reads more than one positional filter (measured: `.contract.test.` +
|
|
81
|
-
* `.job.test.` runs the union of both suites, never the intersection).
|
|
82
|
-
*
|
|
83
|
-
* A FILENAME declares a type; a DIRECTORY only fills in for a filename that declares none — which
|
|
84
|
-
* is why the one directory rule is last. Ownership had no order at all until 2026-08, so
|
|
85
|
-
* `packages/app/e2e/payment.contract.test.ts` matched `.contract.test.` AND `e2e/`: the `contract`
|
|
86
|
-
* step selected it by name while the `e2e` step's argv selected it by directory, and one test ran
|
|
87
|
-
* twice in one gate. The bare word `e2e` was worse still — it matched any path holding those three
|
|
88
|
-
* characters anywhere, so `src/e2e-helpers.test.ts` joined the e2e step and left the unit step,
|
|
89
|
-
* which selects by exclusion.
|
|
90
|
-
*/
|
|
91
|
-
const OWNERSHIP = [
|
|
92
|
-
['contract', '.contract.test.'],
|
|
93
|
-
['live', '.live.test.'],
|
|
94
|
-
['job', '.job.test.'],
|
|
95
|
-
['e2e', '.e2e.test.'],
|
|
96
|
-
['eval', '.eval.test.'],
|
|
97
|
-
// `e2e/`, not `/e2e/`: bun matches a filter against the cwd-relative path and answers
|
|
98
|
-
// `Test filter "/e2e/" had no matches` for the anchored form (bun 1.3.14). The trailing slash
|
|
99
|
-
// is the boundary this can express, and it is the same string `ownerOf` ranks last, so the
|
|
100
|
-
// step's argv and the file list can never disagree about what an e2e test is.
|
|
101
|
-
['e2e', 'e2e/'],
|
|
102
|
-
] as const satisfies readonly (readonly [TypedTest, string])[];
|
|
103
|
-
|
|
104
|
-
/** The types whose filename rule outranks the `e2e/` directory — e2e's own never does. */
|
|
105
|
-
const OUTRANKING_E2E: readonly TypedTest[] = [
|
|
106
|
-
...new Set(OWNERSHIP.filter(([type]) => type !== 'e2e').map(([type]) => type)),
|
|
107
|
-
];
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* The one suite a path belongs to, and `unit` when no rule claims it — the single definition of a
|
|
111
|
-
* file's type, which both `x test <type>` and the gate's own steps select through. Exactly one
|
|
112
|
-
* owner is the point: two owners is a file two steps run, and a test that runs twice in one gate
|
|
113
|
-
* proves nothing the first run did not.
|
|
114
|
-
*/
|
|
115
|
-
export const ownerOf = (path: string): TestType =>
|
|
116
|
-
OWNERSHIP.find(([, filter]) => path.includes(filter))?.[0] ?? 'unit';
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Paths a suite's own filters match but the suite does NOT own, as `--path-ignore-patterns`. Only
|
|
120
|
-
* `e2e` has any, for the reason above. It has to be said in the argv and not only in `ownerOf`:
|
|
121
|
-
* bun has no "match this and not that" filter, and a serial step runs the argv rather than a file
|
|
122
|
-
* list — so exclusivity that lived only in the file list would still have run the file twice.
|
|
123
|
-
*/
|
|
124
|
-
const disownedBy = (type: TypedTest): readonly string[] =>
|
|
125
|
-
type === 'e2e' ? [`**/e2e/**/*.{${OUTRANKING_E2E.join(',')}}.test.*`] : [];
|
|
126
|
-
|
|
127
84
|
const isSerial = (type: TestType): boolean => SERIAL_TYPES.includes(type);
|
|
128
85
|
|
|
129
|
-
/**
|
|
130
|
-
* Build output, and nested projects that carry their own `x verify`. `examples/**` and
|
|
131
|
-
* `dummy/**` are the second kind: each holds a whole app gated by its own run of this same step
|
|
132
|
-
* list, so collecting them here would report one app failure on two different gates. The patterns
|
|
133
|
-
* are relative to the run's root, so this excludes nothing when the app itself is the root. The
|
|
134
|
-
* policy — which directories, and which are anchored at the root — is `test-ignores.ts`'s, the same
|
|
135
|
-
* one `discoverTests` filters the parallel steps by; this is its glob projection.
|
|
136
|
-
*
|
|
137
|
-
* `dummy/**` was added after the framework gate started running a demo app's tests and disagreeing
|
|
138
|
-
* with `bun run test` — which already excluded it — for no reason a reader could see.
|
|
139
|
-
*
|
|
140
|
-
* Excluded here is not ungated: `scripts/reference-app-gate.ts` runs `x verify` inside each of
|
|
141
|
-
* those apps and blocks on a per-app ratchet. Until 2026-08 that was only true of `examples/**`,
|
|
142
|
-
* and `dummy/social-media-clone` was excluded by this list and gated by nothing.
|
|
143
|
-
*/
|
|
144
|
-
const NEVER_A_TEST = IGNORED_TEST_PATTERNS;
|
|
145
|
-
|
|
146
|
-
const ignoreFlags = (patterns: readonly string[]): readonly string[] =>
|
|
147
|
-
patterns.map((pattern) => `--path-ignore-patterns=${pattern}`);
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* The substrings that decide a file's type — the same ones the step's `bun test` runs with, so
|
|
151
|
-
* `x test <type>` and the gate's `<type>` step can never disagree about what a contract test is.
|
|
152
|
-
*/
|
|
153
|
-
export const typeFiltersOf = (type: Exclude<TestType, 'unit'>): readonly string[] =>
|
|
154
|
-
OWNERSHIP.filter(([owner]) => owner === type).map(([, filter]) => filter);
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* What an e2e test's path is, as globs: the e2e step's own substrings (`typeFiltersOf('e2e')`),
|
|
158
|
-
* each spelt as the glob matching the same paths. One definition, read three ways — the e2e step
|
|
159
|
-
* selects by the substrings, the unit step ignores these globs, and `scripts/coverage-gate.ts`
|
|
160
|
-
* leaves them out of a package's coverage: an e2e suite drives a built app through a browser and
|
|
161
|
-
* child processes no in-process lcov sees, and it already runs in its own gate step.
|
|
162
|
-
*/
|
|
163
|
-
export const E2E_PATH_GLOBS: readonly string[] = typeFiltersOf('e2e').map((filter) =>
|
|
164
|
-
filter.endsWith('/') ? `**/*${filter}**` : `**/*${filter}*`,
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* An e2e test's own budget: a first navigation waits on `x dev` compiling the route and its island,
|
|
169
|
-
* which bun's default 5 s does not cover — a timeout there reads as an app bug that is not one.
|
|
170
|
-
*/
|
|
171
|
-
export const E2E_TEST_TIMEOUT_MS = 60_000;
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Unit is everything the typed suites do not claim, so no test can fall between two steps. Each
|
|
175
|
-
* per-test default is read at the machine's `pace` (`verify-pace.ts`).
|
|
176
|
-
*/
|
|
177
|
-
export const testStepCommand = (type: TestType, pace?: MachinePace): readonly string[] =>
|
|
178
|
-
type === 'unit'
|
|
179
|
-
? [
|
|
180
|
-
'bun',
|
|
181
|
-
'test',
|
|
182
|
-
...defaultTimeoutArgs(pace),
|
|
183
|
-
...ignoreFlags([...NEVER_A_TEST, ...E2E_PATH_GLOBS, `**/*.${TYPED_SUFFIXES}.test.*`]),
|
|
184
|
-
]
|
|
185
|
-
: [
|
|
186
|
-
'bun',
|
|
187
|
-
'test',
|
|
188
|
-
...(type === 'e2e'
|
|
189
|
-
? [`--timeout=${String(pacedMs(E2E_TEST_TIMEOUT_MS, pace ?? DECLARED_PACE))}`]
|
|
190
|
-
: defaultTimeoutArgs(pace)),
|
|
191
|
-
...ignoreFlags([...NEVER_A_TEST, ...disownedBy(type)]),
|
|
192
|
-
...typeFiltersOf(type),
|
|
193
|
-
];
|
|
194
|
-
|
|
195
86
|
/**
|
|
196
87
|
* Whether a step applies and what it runs are now one question with one answer: the file list.
|
|
197
88
|
* They used to be two — a glob for `applies`, `--path-ignore-patterns` for the run — and when they
|
|
@@ -244,11 +135,17 @@ const runSerial = async (
|
|
|
244
135
|
const result =
|
|
245
136
|
type === 'e2e'
|
|
246
137
|
? await withE2eApp(
|
|
247
|
-
{
|
|
138
|
+
{
|
|
139
|
+
root: ctx.root,
|
|
140
|
+
isApp: isApp(ctx.root),
|
|
141
|
+
command,
|
|
142
|
+
env: envOverrides,
|
|
143
|
+
hostEnv: ctx.env ?? Bun.env,
|
|
144
|
+
},
|
|
248
145
|
exec,
|
|
249
146
|
)
|
|
250
147
|
: await exec({ command, env: envOverrides });
|
|
251
|
-
|
|
148
|
+
const outcome: StepOutcome = {
|
|
252
149
|
...fromExec(result, {
|
|
253
150
|
code: 'X_TEST_FAILED',
|
|
254
151
|
cause: `one or more ${type} tests failed`,
|
|
@@ -257,6 +154,16 @@ const runSerial = async (
|
|
|
257
154
|
workers: 1,
|
|
258
155
|
tests: countsOf([result]),
|
|
259
156
|
};
|
|
157
|
+
// A floored e2e step that found no browser says which browser to install, never only "re-run".
|
|
158
|
+
return type === 'e2e'
|
|
159
|
+
? await judgeE2eBrowser({
|
|
160
|
+
root: ctx.root,
|
|
161
|
+
isApp: isApp(ctx.root),
|
|
162
|
+
outcome,
|
|
163
|
+
env: ctx.env ?? Bun.env,
|
|
164
|
+
sharded: ctx.shard !== undefined,
|
|
165
|
+
})
|
|
166
|
+
: outcome;
|
|
260
167
|
};
|
|
261
168
|
|
|
262
169
|
/**
|
|
@@ -484,5 +391,11 @@ const stepFor = (type: TestType): VerifyStep => {
|
|
|
484
391
|
};
|
|
485
392
|
};
|
|
486
393
|
|
|
394
|
+
/** One test type's step BEFORE the live wrap: what `verify-live.test.ts` wraps over its own probe. */
|
|
395
|
+
export const bareTestStep = stepFor;
|
|
396
|
+
|
|
487
397
|
/** In cost order: unit needs nothing, e2e needs a build. */
|
|
488
|
-
|
|
398
|
+
// The live step brings up the app's own test database when none answers (`verify-live.ts`).
|
|
399
|
+
export const TEST_STEPS: readonly VerifyStep[] = TEST_TYPES.map(stepFor).map((step) =>
|
|
400
|
+
step.name === 'live' ? withTestServices(step) : step,
|
|
401
|
+
);
|
package/types/babel-modules.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ declare module '@babel/core' {
|
|
|
8
8
|
readonly filename?: string;
|
|
9
9
|
readonly babelrc?: boolean;
|
|
10
10
|
readonly configFile?: boolean;
|
|
11
|
+
/** Keep each output line at its source line number — a coverage build's only. */
|
|
12
|
+
readonly retainLines?: boolean;
|
|
11
13
|
readonly parserOpts?: { readonly plugins?: readonly string[] };
|
|
12
14
|
/** `[preset, options]` pairs. The preset itself is opaque here — it is never called. */
|
|
13
15
|
readonly presets?: readonly (readonly [unknown, unknown])[];
|