@cnc-tools/storm 0.8.1 → 0.9.1
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/bin/storm.js +3 -14
- package/dist/application.d.ts +18 -10
- package/dist/application.js +10 -11
- package/dist/bin/storm.js +97 -41
- package/dist/build-info.js +1 -1
- package/dist/chunks/chunk-5CQCRX2L.js +5768 -0
- package/dist/chunks/chunk-5U5Q6VZR.js +556 -0
- package/dist/chunks/chunk-7O6UN63H.js +63 -0
- package/dist/chunks/chunk-I5GZLOLQ.js +38 -0
- package/dist/chunks/chunk-NX55IJ5S.js +1842 -0
- package/dist/chunks/chunk-OCZJE5XV.js +910 -0
- package/dist/chunks/chunk-RRQ2ZGSE.js +1512 -0
- package/dist/chunks/chunk-S5NAIZYS.js +13 -0
- package/dist/chunks/chunk-UHO5OCEX.js +360 -0
- package/dist/chunks/chunk-WBIHJM7D.js +188 -0
- package/dist/chunks/chunk-WV6WQFC6.js +436 -0
- package/dist/chunks/live-app-X3PW2W42.js +89 -0
- package/dist/chunks/version-X7RMSKZI.js +12 -0
- package/dist/commands/exec/command.d.ts +32 -0
- package/dist/commands/exec/command.js +35 -21
- package/dist/commands/exec/metadata.js +66 -58
- package/dist/commands/exec/outcomes.d.ts +67 -0
- package/dist/commands/exec/outcomes.js +50 -0
- package/dist/commands/exec/redaction.js +1 -1
- package/dist/commands/exec/run-collector.d.ts +1 -1
- package/dist/commands/exec/run-collector.js +1 -1
- package/dist/commands/exec/run-command.d.ts +17 -11
- package/dist/commands/exec/run-command.js +33 -16
- package/dist/commands/exec/run-record.d.ts +1 -1
- package/dist/commands/exec/tests-summary.d.ts +1 -1
- package/dist/commands/exec/worker-chart.d.ts +1 -1
- package/dist/commands/runs/list/command.js +136 -33
- package/dist/commands/runs/list/metadata.js +22 -18
- package/dist/commands/runs/logs/command.js +131 -48
- package/dist/commands/runs/logs/metadata.js +24 -20
- package/dist/commands/runs/metadata.js +6 -2
- package/dist/commands/runs/past-run.d.ts +1 -1
- package/dist/commands/runs/past-run.js +1 -1
- package/dist/commands/runs/show/command.js +396 -74
- package/dist/commands/runs/show/metadata.js +24 -20
- package/dist/commands/vitest/command.d.ts +32 -0
- package/dist/commands/vitest/command.js +195 -128
- package/dist/commands/vitest/metadata.js +45 -37
- package/dist/commands/vitest/outcomes.d.ts +16 -0
- package/dist/context.d.ts +1 -1
- package/dist/core/events.d.ts +1 -1
- package/dist/core/payload.d.ts +1 -1
- package/dist/core/payload.js +1 -1
- package/dist/core/provider.d.ts +12 -2
- package/dist/core/run.d.ts +6 -1
- package/dist/core/run.js +2 -2
- package/dist/live-app.d.ts +9 -0
- package/dist/live-app.js +21 -0
- package/dist/resource-commands.d.ts +13 -0
- package/dist/resource-commands.js +22 -0
- package/dist/resources/github/provider.d.ts +1 -1
- package/dist/resources/testserver/command-tree.d.ts +4 -0
- package/dist/resources/testserver/command-tree.js +12 -0
- package/dist/resources/testserver/commands/create/command.js +373 -194
- package/dist/resources/testserver/commands/create/metadata.js +52 -48
- package/dist/resources/testserver/commands/list/command.js +195 -50
- package/dist/resources/testserver/commands/list/metadata.js +12 -8
- package/dist/resources/testserver/provider.d.ts +1 -1
- package/dist/resources/testserver/resource-provider.js +2 -8
- package/dist/resources.d.ts +0 -3
- package/dist/resources.js +5 -10
- package/dist/runner/index.d.ts +2 -1
- package/dist/runner/index.js +1 -0
- package/dist/runner/prepare.d.ts +7 -6
- package/dist/runner/prepare.js +1 -1
- package/dist/runner/ready.d.ts +6 -0
- package/dist/runner/ready.js +33 -5
- package/dist/runner/recipe.d.ts +33 -6
- package/dist/runner/recipe.js +151 -23
- package/dist/runner/remote-command.js +1 -1
- package/dist/runner/secrets.d.ts +42 -0
- package/dist/runner/secrets.js +44 -0
- package/dist/runner/snapshot-build.d.ts +5 -2
- package/dist/runner/snapshot-build.js +12 -5
- package/dist/runner/snapshot-cache.d.ts +3 -3
- package/dist/runner/snapshot-cache.js +2 -2
- package/dist/runner/snapshot-key.d.ts +19 -12
- package/dist/runner/snapshot-key.js +25 -16
- package/dist/runner/snapshot-save.d.ts +5 -3
- package/dist/runner/snapshot-save.js +7 -5
- package/dist/runner/steps.d.ts +6 -1
- package/dist/runner/steps.js +5 -2
- package/dist/sdk/host.d.ts +2 -0
- package/dist/sdk/host.js +7 -0
- package/dist/version.d.ts +2 -2
- package/dist/version.js +10 -11
- package/dist/vitest/config.d.ts +4 -8
- package/dist/vitest/config.js +5 -9
- package/dist/vitest/container-scope.d.ts +12 -5
- package/dist/vitest/container-scope.js +27 -4
- package/dist/vitest/diagnostics.d.ts +8 -2
- package/dist/vitest/diagnostics.js +7 -4
- package/dist/vitest/fixtures.d.ts +4 -1
- package/dist/vitest/fixtures.js +17 -6
- package/dist/vitest/plan.d.ts +1 -1
- package/dist/vitest/plan.js +2 -2
- package/dist/vitest/sandbox.d.ts +6 -0
- package/dist/vitest/sandbox.js +6 -0
- package/package.json +4 -3
- package/skills/overview.md +1 -0
- package/bin/node-version.js +0 -24
- package/dist/closed-terminal.d.ts +0 -7
- package/dist/closed-terminal.js +0 -18
|
@@ -1,59 +1,67 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
1
|
+
import {
|
|
2
|
+
RUN_FIELDS,
|
|
3
|
+
RUN_USAGE_FLAGS
|
|
4
|
+
} from "../../chunks/chunk-7O6UN63H.js";
|
|
5
|
+
|
|
6
|
+
// src/commands/exec/metadata.ts
|
|
7
|
+
var metadata = {
|
|
8
|
+
description: "Run any command, the argument list after --, as it is, with the run payload in STORM_RUN. For vitest, use storm vitest, which counts the tests and sizes the run first; exec counts nothing and sizes nothing. In a local run (--local), the command runs on this machine in the working directory, with this machine's environment less the host variables a resource names (TESTSERVER_BASES and TESTSERVER_BASE), plus STORM_RUN, and FORCE_COLOR or NO_COLOR when neither is set. In a runner run, the default, it runs in a runner sandbox, a Vercel Sandbox readied from the runner recipe in storm.config.ts, in the recipe's cwd, with the runner sandbox's own environment, a PATH that starts with node_modules/.bin of that cwd and of the repository's root, the recipe's env and STORM_RUN, and nothing from this machine's environment; each recipe step that names a runner secret, never the command, also gets that host variable, one its secrets key declares, shown as <token> in what storm prints and writes, and a runner run refuses before it starts when one of them is unset, holds a line break or is shorter than 8 characters; each path under the repository's root in its arguments points at the runner sandbox's copy, and each in its output back at this checkout. With a Testserver side (resources.testserverPool in storm.config.ts, or any --testserver-* flag), first lease usable Testserver sandboxes from the pool and create the rest, while a runner run readies its runner sandbox, and release the leases once the command ends; without one, the run payload names no Testserver sandbox. Shows on stderr what runs when and what runs at once, live on a terminal and one line at a time elsewhere, then a waterfall of the run's lanes naming its critical path, and exits with the command's code. Each run writes what it was and how it ended, its events, its steps' output, its command's output, its test events and its timeline to a run directory under ${XDG_STATE_HOME:-~/.local/state}/storm/runs/, named for its run id, keeping the newest 1000 completed ones and every one whose run is still going; the summary names the run id, storm runs show reads the run back, and storm runs logs prints its command's output and its steps' logs. A flag overrides storm.config.ts, found in the working directory or a parent up to the git worktree's root and checked whole, which overrides the built-in default. With resources.githubFixtureRepo, in storm.config.ts or by a --set of its options, the run reads a token for that GitHub repository from the host variable its tokenEnv names (refusing without it, unless optional), checks the token can read the repository, hands the command the repository, the token and a run prefix (run/<UTC timestamp>-<suffix>) in the run payload, shows the token as <token> in what it prints and writes, and deletes every branch under the run prefix once the command has stopped.",
|
|
9
|
+
summary: "Run any command, in a runner sandbox or locally.",
|
|
10
|
+
usages: [`${RUN_USAGE_FLAGS} -- <command...>`],
|
|
11
|
+
fields: {
|
|
12
|
+
...RUN_FIELDS,
|
|
13
|
+
command: {
|
|
14
|
+
valueLabel: "command",
|
|
15
|
+
description: "The command to run, after --, as an argument list with no shell. Locally it gets this machine's working directory and environment, less TESTSERVER_BASES and TESTSERVER_BASE, plus STORM_RUN and FORCE_COLOR or NO_COLOR; in a runner run, the runner recipe's cwd, its env, the runner's PATH and STORM_RUN, with paths under the repository's root rewritten."
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
examples: [
|
|
19
|
+
{
|
|
20
|
+
argv: "-- pnpm test",
|
|
21
|
+
description: "Run the package's test script in a runner sandbox, with the runner recipe, team and project from storm.config.ts, and its Testserver side, if it has one."
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
argv: "--testserver-sandboxes 4 -- pnpm test:testserver",
|
|
25
|
+
description: "Run a script in a runner sandbox against 4 Testserver sandboxes."
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
argv: "--local --testserver-sandboxes 4 --scope vercel --project vercel -- pnpm test",
|
|
29
|
+
description: "Run the tests on this machine against 4 Testserver sandboxes on the stable build channel."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
argv: "--keep-sandbox 2h -- pnpm test",
|
|
33
|
+
description: "Run the tests in a runner sandbox and keep it running 2 hours after the run, to debug in it."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
argv: "--local -- node scripts/smoke.mjs",
|
|
37
|
+
description: "Run a Node.js script on this machine, with no Testserver sandbox when storm.config.ts has no resources.testserverPool."
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
argv: "--local --testserver-ttl 30m --testserver-min-time-left 25m -- pnpm test",
|
|
41
|
+
description: "Create Testserver sandboxes that live 30 minutes, with team and project from storm.config.ts."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
argv: "--local --testserver-build pr:104196 -- pnpm test",
|
|
45
|
+
description: "Run the tests on this machine against the Testserver build of vercel/api pull request 104196's head commit."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
argv: "--local --testserver-no-create --testserver-sandboxes 4 -- pnpm test",
|
|
49
|
+
description: "Run only on Testserver sandboxes already in the pool, never minting."
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
argv: "--local --verbose --testserver-sandboxes 2 -- pnpm test",
|
|
53
|
+
description: "Run the tests, printing each create's progress and, through the Vitest adapter, each test as it ends."
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
argv: "--local --credential github-actions --testserver-ttl 30m --testserver-min-time-left 25m -- pnpm test",
|
|
57
|
+
description: "In a GitHub Actions job, create Testserver sandboxes with a GitHub Actions OIDC token."
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
argv: "--local --testserver-build latest_main --testserver-min-time-left 75m --scope vercel --project vercel -- pnpm test",
|
|
61
|
+
description: "Run them on the newest main build, with Testserver sandboxes that live at least 75 more minutes."
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
metadata
|
|
59
67
|
};
|
|
@@ -162,6 +162,18 @@ export declare const runErrors: import("@vercel/clinkr").SharedErrors<{
|
|
|
162
162
|
missingRunner: z.ZodObject<{
|
|
163
163
|
configFile: z.ZodNullable<z.ZodString>;
|
|
164
164
|
}, z.core.$strip>;
|
|
165
|
+
runnerSecretsInvalid: z.ZodObject<{
|
|
166
|
+
variables: z.ZodArray<z.ZodObject<{
|
|
167
|
+
name: z.ZodString;
|
|
168
|
+
problem: z.ZodEnum<{
|
|
169
|
+
missing: "missing";
|
|
170
|
+
multiline: "multiline";
|
|
171
|
+
short: "short";
|
|
172
|
+
}>;
|
|
173
|
+
}, z.core.$strip>>;
|
|
174
|
+
minLength: z.ZodNumber;
|
|
175
|
+
configFile: z.ZodNullable<z.ZodString>;
|
|
176
|
+
}, z.core.$strip>;
|
|
165
177
|
noBaseRef: z.ZodObject<{
|
|
166
178
|
refs: z.ZodArray<z.ZodObject<{
|
|
167
179
|
ref: z.ZodString;
|
|
@@ -250,6 +262,37 @@ export declare const runErrors: import("@vercel/clinkr").SharedErrors<{
|
|
|
250
262
|
}[];
|
|
251
263
|
};
|
|
252
264
|
};
|
|
265
|
+
readonly runnerSecretsInvalid: {
|
|
266
|
+
readonly exitCode: 2;
|
|
267
|
+
readonly description: "In a runner run, host environment variables the runner recipe's secrets key names can't be used, so the run didn't start: it minted, leased and created nothing. Each variable has one problem, the first of: missing, unset or empty; multiline, its value holds a carriage return or a line feed, which line-by-line output would split past storm's redaction; short, its value holds fewer than 8 characters, and storm shows each value as <token> wherever it appears in what it prints and writes, so a value that short would hide ordinary output.";
|
|
268
|
+
readonly schema: z.ZodObject<{
|
|
269
|
+
variables: z.ZodArray<z.ZodObject<{
|
|
270
|
+
name: z.ZodString;
|
|
271
|
+
problem: z.ZodEnum<{
|
|
272
|
+
missing: "missing";
|
|
273
|
+
multiline: "multiline";
|
|
274
|
+
short: "short";
|
|
275
|
+
}>;
|
|
276
|
+
}, z.core.$strip>>;
|
|
277
|
+
minLength: z.ZodNumber;
|
|
278
|
+
configFile: z.ZodNullable<z.ZodString>;
|
|
279
|
+
}, z.core.$strip>;
|
|
280
|
+
readonly render: ({ variables, minLength, configFile }: {
|
|
281
|
+
variables: {
|
|
282
|
+
name: string;
|
|
283
|
+
problem: "missing" | "multiline" | "short";
|
|
284
|
+
}[];
|
|
285
|
+
minLength: number;
|
|
286
|
+
configFile: string | null;
|
|
287
|
+
}) => {
|
|
288
|
+
message: string;
|
|
289
|
+
rows: [string, string[]][];
|
|
290
|
+
next: {
|
|
291
|
+
type: "text";
|
|
292
|
+
text: string;
|
|
293
|
+
}[];
|
|
294
|
+
};
|
|
295
|
+
};
|
|
253
296
|
readonly noBaseRef: {
|
|
254
297
|
readonly exitCode: 1;
|
|
255
298
|
readonly description: "In a runner run, none of the runner recipe's baseRefs exists locally and shares history with HEAD, so there is no base. storm never fetches.";
|
|
@@ -582,6 +625,14 @@ export declare const RUN_ERRORS: {
|
|
|
582
625
|
};
|
|
583
626
|
cleanup: import("./cleanup.ts").StormCleanupFacts;
|
|
584
627
|
}]>;
|
|
628
|
+
runnerSecretsInvalid: import("@vercel/clinkr").SharedError<"runner_secrets_invalid", [data: {
|
|
629
|
+
variables: {
|
|
630
|
+
name: string;
|
|
631
|
+
problem: "missing" | "multiline" | "short";
|
|
632
|
+
}[];
|
|
633
|
+
minLength: number;
|
|
634
|
+
configFile: string | null;
|
|
635
|
+
}]>;
|
|
585
636
|
snapshotGone: import("@vercel/clinkr").SharedError<"snapshot_gone", [data: {
|
|
586
637
|
snapshotId: string;
|
|
587
638
|
base: string;
|
|
@@ -893,6 +944,14 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
|
|
|
893
944
|
};
|
|
894
945
|
cleanup: import("./cleanup.ts").StormCleanupFacts;
|
|
895
946
|
}]>;
|
|
947
|
+
runnerSecretsInvalid: import("@vercel/clinkr").SharedError<"runner_secrets_invalid", [data: {
|
|
948
|
+
variables: {
|
|
949
|
+
name: string;
|
|
950
|
+
problem: "missing" | "multiline" | "short";
|
|
951
|
+
}[];
|
|
952
|
+
minLength: number;
|
|
953
|
+
configFile: string | null;
|
|
954
|
+
}]>;
|
|
896
955
|
snapshotGone: import("@vercel/clinkr").SharedError<"snapshot_gone", [data: {
|
|
897
956
|
snapshotId: string;
|
|
898
957
|
base: string;
|
|
@@ -1104,6 +1163,14 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
|
|
|
1104
1163
|
};
|
|
1105
1164
|
cleanup: import("./cleanup.ts").StormCleanupFacts;
|
|
1106
1165
|
}]>;
|
|
1166
|
+
runnerSecretsInvalid: import("@vercel/clinkr").SharedError<"runner_secrets_invalid", [data: {
|
|
1167
|
+
variables: {
|
|
1168
|
+
name: string;
|
|
1169
|
+
problem: "missing" | "multiline" | "short";
|
|
1170
|
+
}[];
|
|
1171
|
+
minLength: number;
|
|
1172
|
+
configFile: string | null;
|
|
1173
|
+
}]>;
|
|
1107
1174
|
snapshotGone: import("@vercel/clinkr").SharedError<"snapshot_gone", [data: {
|
|
1108
1175
|
snapshotId: string;
|
|
1109
1176
|
base: string;
|
|
@@ -35,6 +35,12 @@ const runnerFailureSchema = z.union([
|
|
|
35
35
|
}),
|
|
36
36
|
z.object({ kind: z.literal("credential-claims-missing"), team: z.string(), project: z.string() }),
|
|
37
37
|
]);
|
|
38
|
+
/** Names as a sentence lists them: `A`, `A and B`, `A, B and C`. */
|
|
39
|
+
function listed(names) {
|
|
40
|
+
if (names.length <= 1)
|
|
41
|
+
return names.join("");
|
|
42
|
+
return `${names.slice(0, -1).join(", ")} and ${names.at(-1) ?? ""}`;
|
|
43
|
+
}
|
|
38
44
|
/** How a step ended, as a message says it. */
|
|
39
45
|
function stepEnded(exitCode) {
|
|
40
46
|
return exitCode === null ? "ended without an exit code" : `exited ${exitCode}`;
|
|
@@ -226,6 +232,50 @@ export const runErrors = defineErrors({
|
|
|
226
232
|
],
|
|
227
233
|
}),
|
|
228
234
|
},
|
|
235
|
+
runnerSecretsInvalid: {
|
|
236
|
+
exitCode: 2,
|
|
237
|
+
description: "In a runner run, host environment variables the runner recipe's secrets key names can't be used, so the run didn't start: it minted, leased and created nothing. Each variable has one problem, the first of: missing, unset or empty; multiline, its value holds a carriage return or a line feed, which line-by-line output would split past storm's redaction; short, its value holds fewer than 8 characters, and storm shows each value as <token> wherever it appears in what it prints and writes, so a value that short would hide ordinary output.",
|
|
238
|
+
schema: z.object({
|
|
239
|
+
/** Each variable storm can't use and why, in the recipe's order. */
|
|
240
|
+
variables: z.array(z.object({ name: z.string(), problem: z.enum(["missing", "multiline", "short"]) })),
|
|
241
|
+
/** The fewest characters a runner secret's value may have. */
|
|
242
|
+
minLength: z.number(),
|
|
243
|
+
/** The config file that gave the runner recipe. */
|
|
244
|
+
configFile: z.string().nullable(),
|
|
245
|
+
}),
|
|
246
|
+
render: ({ variables, minLength, configFile }) => {
|
|
247
|
+
const named = (problem) => variables.filter((variable) => variable.problem === problem).map(({ name }) => name);
|
|
248
|
+
const [missing, multiline, short] = [named("missing"), named("multiline"), named("short")];
|
|
249
|
+
return {
|
|
250
|
+
message: `runner.secrets${configFile === null ? "" : ` in ${configFile}`} names ${variables.length === 1 ? "a variable" : "variables"} storm can't use. The run didn't start.`,
|
|
251
|
+
rows: [
|
|
252
|
+
[
|
|
253
|
+
"Runner secrets",
|
|
254
|
+
variables.map(({ name, problem }) => problem === "missing"
|
|
255
|
+
? `${name} is not set`
|
|
256
|
+
: problem === "multiline"
|
|
257
|
+
? `${name} holds a carriage return or a line feed`
|
|
258
|
+
: `${name} holds fewer than ${minLength} characters`),
|
|
259
|
+
],
|
|
260
|
+
],
|
|
261
|
+
next: [
|
|
262
|
+
{
|
|
263
|
+
type: "text",
|
|
264
|
+
text: [
|
|
265
|
+
...(missing.length === 0 ? [] : [`Set ${listed(missing)} in this machine's environment.`]),
|
|
266
|
+
...(multiline.length === 0
|
|
267
|
+
? []
|
|
268
|
+
: [
|
|
269
|
+
`Set ${listed(multiline)} to a value on one line: storm hides each value in output a line at a time, and doesn't trim one.`,
|
|
270
|
+
]),
|
|
271
|
+
...(short.length === 0 ? [] : [`Set ${listed(short)} to the whole secret.`]),
|
|
272
|
+
].join(" "),
|
|
273
|
+
},
|
|
274
|
+
{ type: "text", text: "Or run on this machine with --local, which reads no runner secret." },
|
|
275
|
+
],
|
|
276
|
+
};
|
|
277
|
+
},
|
|
278
|
+
},
|
|
229
279
|
noBaseRef: {
|
|
230
280
|
exitCode: 1,
|
|
231
281
|
description: "In a runner run, none of the runner recipe's baseRefs exists locally and shares history with HEAD, so there is no base. storm never fetches.",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Hiding a run's secrets, such as the GitHub fixture repository's token, in what the run prints and writes: its
|
|
2
2
|
// events (which feed progress, the run directory's `events.jsonl`, the timeline, the job summary and the outcome), the
|
|
3
3
|
// remote command's output (the terminal and `command.log`), and the test events a local command appended.
|
|
4
|
-
import { redactSecrets } from "../../sdk/
|
|
4
|
+
import { redactSecrets } from "../../sdk/host.js";
|
|
5
5
|
/** A redaction of `secrets`, each replaced by `<token>` wherever it appears. */
|
|
6
6
|
export function redactor(secrets) {
|
|
7
7
|
const kept = secrets.filter((secret) => secret !== "");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type RunDirectory } from "../../core/index.ts";
|
|
2
2
|
import { type StormRunObserver, type StormRunState } from "../../resources.ts";
|
|
3
|
-
import { type TestEvent } from "../../sdk/
|
|
3
|
+
import { type TestEvent } from "../../sdk/host.ts";
|
|
4
4
|
import { type Redact } from "./redaction.ts";
|
|
5
5
|
/** The test events the summary reads, how many lines held none, and why they may be incomplete, when they may. */
|
|
6
6
|
export interface RunTestEvents {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// run keeps no test output or test errors in memory after it has handed them on.
|
|
4
4
|
import { EMPTY_RUN_STATE } from "../../core/index.js";
|
|
5
5
|
import { applyStormRunEvent } from "../../resources.js";
|
|
6
|
-
import { parseTestEvent, testEventLine } from "../../sdk/
|
|
6
|
+
import { parseTestEvent, testEventLine } from "../../sdk/host.js";
|
|
7
7
|
import { redactStrings } from "./redaction.js";
|
|
8
8
|
/**
|
|
9
9
|
* A collector that folds every event but a runner step's output into the run's state. Each test event it hears or
|
|
@@ -2,7 +2,7 @@ import { type ArgumentIssue, type CommandError, type CommandResult, type Executi
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import type { StormApp } from "../../context.ts";
|
|
4
4
|
import { type CredentialSourceChoice, type MintTarget } from "../../credential/index.ts";
|
|
5
|
-
import { type CheckedRecipe, type CheckoutFailure } from "../../runner/index.ts";
|
|
5
|
+
import { type CheckedRecipe, type CheckoutFailure, type RunnerSecrets } from "../../runner/index.ts";
|
|
6
6
|
import { type StormSetValues } from "../../resources.ts";
|
|
7
7
|
import { type ranSchema } from "./outcomes.ts";
|
|
8
8
|
import { type RunRecordPlan } from "./run-record.ts";
|
|
@@ -148,12 +148,13 @@ export interface RunCommandSpec<TPlan, TRan, TRefusal> {
|
|
|
148
148
|
* Each resource is a provider (the registry, `src/resources.ts`, lists them), whose folder under `src/resources/` says
|
|
149
149
|
* what the run does with it, and whose command half settles it (`RESOURCE_COMMANDS.settle`). The run refuses in this
|
|
150
150
|
* order: `invalid_config`, `invalid_resource_options`, `credential_unused`; in a runner run `missing_runner`, then
|
|
151
|
-
* `missing_target`; in a local run where a resource takes
|
|
152
|
-
* resource's settle, in provider order; then `spec.prepare`'s
|
|
153
|
-
*
|
|
154
|
-
*
|
|
151
|
+
* `missing_target`, then `runner_secrets_invalid`; in a local run where a resource takes
|
|
152
|
+
* the credential, `missing_target` for the mint; then each resource's settle, in provider order; then `spec.prepare`'s
|
|
153
|
+
* refusal, if any. A resource's secrets, such as a token, and in a runner run the runner secrets' values, are hidden as
|
|
154
|
+
* `<token>` in the run's progress, its run directory, its job summary, its outcome, `spec.prepare`'s refusal, a runner
|
|
155
|
+
* run's preparation refusal (`prepareRunner`'s), and its command's output and step output.
|
|
155
156
|
*/
|
|
156
|
-
export declare function runCommand<TPlan extends RunRecordPlan | undefined, TRan extends CommandResult, TRefusal extends CommandError = never>({ app, ui, signal }: ExecutionContext<StormApp>, request: RunCommandRequest, spec: RunCommandSpec<TPlan, TRan, TRefusal>): Promise<TRan | TRefusal | import("@vercel/clinkr").ClinkrError<"canceled"> | CommandError<"credential_rejected"> | CommandError<"credential_unused"> | CommandError<"github_fixture_repo_unavailable"> | CommandError<"github_token_missing"> | CommandError<"invalid_config"> | CommandError<"invalid_resource_options"> | CommandError<"mint_failed"> | CommandError<"missing_runner"> | CommandError<"missing_target"> | CommandError<"no_base_ref"> | CommandError<"no_sandboxes"> | CommandError<"no_usable_sandboxes"> | CommandError<"pool_unavailable"> | CommandError<"pool_unreadable"> | CommandError<"pr_build_expired"> | CommandError<"pr_build_not_ready"> | CommandError<"pr_builds_unlisted"> | CommandError<"pull_request_unreadable"> | CommandError<"runner_failed"> | CommandError<"snapshot_gone"> | CommandError<"spawn_failed"> | CommandError<"submodules_refused"> | CommandError<"token_request_failed">>;
|
|
157
|
+
export declare function runCommand<TPlan extends RunRecordPlan | undefined, TRan extends CommandResult, TRefusal extends CommandError = never>({ app, ui, signal }: ExecutionContext<StormApp>, request: RunCommandRequest, spec: RunCommandSpec<TPlan, TRan, TRefusal>): Promise<TRan | TRefusal | import("@vercel/clinkr").ClinkrError<"canceled"> | CommandError<"credential_rejected"> | CommandError<"credential_unused"> | CommandError<"github_fixture_repo_unavailable"> | CommandError<"github_token_missing"> | CommandError<"invalid_config"> | CommandError<"invalid_resource_options"> | CommandError<"mint_failed"> | CommandError<"missing_runner"> | CommandError<"missing_target"> | CommandError<"no_base_ref"> | CommandError<"no_sandboxes"> | CommandError<"no_usable_sandboxes"> | CommandError<"pool_unavailable"> | CommandError<"pool_unreadable"> | CommandError<"pr_build_expired"> | CommandError<"pr_build_not_ready"> | CommandError<"pr_builds_unlisted"> | CommandError<"pull_request_unreadable"> | CommandError<"runner_failed"> | CommandError<"runner_secrets_invalid"> | CommandError<"snapshot_gone"> | CommandError<"spawn_failed"> | CommandError<"submodules_refused"> | CommandError<"token_request_failed">>;
|
|
157
158
|
/** What is wrong with a run's request that its schema can't say, as `validate` reports it. */
|
|
158
159
|
export declare function runProblems({ set, credential, local, rebuildSnapshot, saveSnapshot, showOutput, keepSandbox, ...rest }: RunCommandRequest): readonly ArgumentIssue[];
|
|
159
160
|
/**
|
|
@@ -170,8 +171,8 @@ export declare function checkoutFailedRefusal(failure: CheckoutFailure): Command
|
|
|
170
171
|
export declare const DEFAULT_KEEP_SANDBOX_MINUTES = 30;
|
|
171
172
|
/**
|
|
172
173
|
* Where a settled run runs: with `--local` on this machine, with the credential source it settled when a held
|
|
173
|
-
* resource takes one; or by default in a runner sandbox, with the runner recipe
|
|
174
|
-
* sandbox's credential is minted for, whose one mint the resources share.
|
|
174
|
+
* resource takes one; or by default in a runner sandbox, with the runner recipe, the team and project the runner
|
|
175
|
+
* sandbox's credential is minted for, whose one mint the resources share, and the runner secrets' values.
|
|
175
176
|
*/
|
|
176
177
|
type RunWhere = {
|
|
177
178
|
readonly kind: "local";
|
|
@@ -180,13 +181,15 @@ type RunWhere = {
|
|
|
180
181
|
readonly kind: "runner";
|
|
181
182
|
readonly recipe: CheckedRecipe;
|
|
182
183
|
readonly target: MintTarget;
|
|
184
|
+
readonly secrets: RunnerSecrets;
|
|
183
185
|
};
|
|
184
186
|
/**
|
|
185
187
|
* Settles a run before it starts, refusing in this order: the config file (`invalid_config`); each held resource's
|
|
186
188
|
* merged options (`invalid_resource_options`); a `--credential` no held resource takes (`credential_unused`); in a
|
|
187
|
-
* runner run, the runner recipe (`missing_runner`)
|
|
188
|
-
*
|
|
189
|
-
*
|
|
189
|
+
* runner run, the runner recipe (`missing_runner`), the team and project its mint needs (`missing_target`) and the
|
|
190
|
+
* runner secrets from the host's environment (`runner_secrets_invalid`); in a local run
|
|
191
|
+
* where a held resource takes the credential, the credential source (`missing_target` for the mint); then each held
|
|
192
|
+
* resource's own settle, in provider order.
|
|
190
193
|
*/
|
|
191
194
|
declare function settleRun(app: StormApp, request: {
|
|
192
195
|
readonly given: StormSetValues;
|
|
@@ -212,6 +215,9 @@ declare function settleRun(app: StormApp, request: {
|
|
|
212
215
|
} | {
|
|
213
216
|
readonly ok: false;
|
|
214
217
|
readonly refusal: CommandError<"missing_runner">;
|
|
218
|
+
} | {
|
|
219
|
+
readonly ok: false;
|
|
220
|
+
readonly refusal: CommandError<"runner_secrets_invalid">;
|
|
215
221
|
} | {
|
|
216
222
|
readonly ok: true;
|
|
217
223
|
readonly configFile: string | null;
|
|
@@ -5,7 +5,7 @@ import { refused, } from "@vercel/clinkr";
|
|
|
5
5
|
import { NodeSignalCancellation } from "@vercel/clinkr/node";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { describeMintFailure, requireTarget, settleCredential, } from "../../credential/index.js";
|
|
8
|
-
import { prepareRunner, } from "../../runner/index.js";
|
|
8
|
+
import { prepareRunner, readRunnerSecrets, RUNNER_SECRET_MIN_LENGTH, } from "../../runner/index.js";
|
|
9
9
|
import { fileSettings, invalidConfig, loadSettingsFile, parseSetFlags, settleResourceOptions, } from "../../config/index.js";
|
|
10
10
|
import { commandExitStatus, executeRun, observeAll, RUN_DIRECTORIES_KEPT, runDirectoryObserver, stepLog, testEventsPath, timedProgress, } from "../../core/index.js";
|
|
11
11
|
import { RESOURCE_COMMANDS, RESOURCE_CONFIGS, RESOURCE_REPORTS, RESOURCES, RUN_CLEANUP, stormTimeline, } from "../../resources.js";
|
|
@@ -103,10 +103,11 @@ const runRequestSchema = z.object(RUN_REQUEST_FIELDS);
|
|
|
103
103
|
* Each resource is a provider (the registry, `src/resources.ts`, lists them), whose folder under `src/resources/` says
|
|
104
104
|
* what the run does with it, and whose command half settles it (`RESOURCE_COMMANDS.settle`). The run refuses in this
|
|
105
105
|
* order: `invalid_config`, `invalid_resource_options`, `credential_unused`; in a runner run `missing_runner`, then
|
|
106
|
-
* `missing_target`; in a local run where a resource takes
|
|
107
|
-
* resource's settle, in provider order; then `spec.prepare`'s
|
|
108
|
-
*
|
|
109
|
-
*
|
|
106
|
+
* `missing_target`, then `runner_secrets_invalid`; in a local run where a resource takes
|
|
107
|
+
* the credential, `missing_target` for the mint; then each resource's settle, in provider order; then `spec.prepare`'s
|
|
108
|
+
* refusal, if any. A resource's secrets, such as a token, and in a runner run the runner secrets' values, are hidden as
|
|
109
|
+
* `<token>` in the run's progress, its run directory, its job summary, its outcome, `spec.prepare`'s refusal, a runner
|
|
110
|
+
* run's preparation refusal (`prepareRunner`'s), and its command's output and step output.
|
|
110
111
|
*/
|
|
111
112
|
export async function runCommand({ app, ui, signal }, request, spec) {
|
|
112
113
|
const sets = parseSetFlags(request.set, RESOURCE_CONFIGS, TESTSERVER_OWN_FLAGS);
|
|
@@ -116,10 +117,14 @@ export async function runCommand({ app, ui, signal }, request, spec) {
|
|
|
116
117
|
const settled = await settleRun(app, { ...request, given: withTestserverFlags(sets.values, request) });
|
|
117
118
|
if (!settled.ok)
|
|
118
119
|
return settled.refusal;
|
|
119
|
-
// The resources' secrets: every event, the command's output
|
|
120
|
-
// before any view, the run directory or the summary sees them. A refusal
|
|
121
|
-
// machine's environment, such as the last line of `vitest list`'s stderr
|
|
122
|
-
|
|
120
|
+
// The resources' secrets and the runner secrets' values: every event, the command's output, `spec.prepare`'s refusal
|
|
121
|
+
// and `prepareRunner`'s pass through `redact` before any view, the run directory or the summary sees them. A refusal
|
|
122
|
+
// can quote what preparation ran with this machine's environment, such as the last line of `vitest list`'s stderr,
|
|
123
|
+
// or what a recipe's step function or `vcpus` function threw.
|
|
124
|
+
const secrets = [
|
|
125
|
+
...settled.settlement.secrets,
|
|
126
|
+
...(settled.where.kind === "runner" ? Object.values(settled.where.secrets) : []),
|
|
127
|
+
];
|
|
123
128
|
const redact = redactor(secrets);
|
|
124
129
|
const ready = await spec.prepare(settled, signal);
|
|
125
130
|
if (signal.aborted)
|
|
@@ -128,7 +133,7 @@ export async function runCommand({ app, ui, signal }, request, spec) {
|
|
|
128
133
|
return secrets.length === 0 ? ready.refusal : redactStrings(ready.refusal, redact);
|
|
129
134
|
const { argv, plan } = ready;
|
|
130
135
|
const { configFile, options, where, settlement } = ready.settled;
|
|
131
|
-
if (settlement.secrets !== secrets)
|
|
136
|
+
if (settlement.secrets !== settled.settlement.secrets || where !== settled.where)
|
|
132
137
|
throw new Error("spec.prepare changed the run's secrets");
|
|
133
138
|
const base = {
|
|
134
139
|
argv,
|
|
@@ -157,8 +162,10 @@ export async function runCommand({ app, ui, signal }, request, spec) {
|
|
|
157
162
|
rebuild: request.rebuildSnapshot,
|
|
158
163
|
saveSnapshot: request.saveSnapshot,
|
|
159
164
|
});
|
|
160
|
-
if (prepared.kind !== "ok")
|
|
161
|
-
|
|
165
|
+
if (prepared.kind !== "ok") {
|
|
166
|
+
const refusal = prepareRefusal(prepared, configFile);
|
|
167
|
+
return secrets.length === 0 ? refusal : redactStrings(refusal, redact);
|
|
168
|
+
}
|
|
162
169
|
const { save } = prepared.prepared;
|
|
163
170
|
run = {
|
|
164
171
|
...base,
|
|
@@ -167,6 +174,7 @@ export async function runCommand({ app, ui, signal }, request, spec) {
|
|
|
167
174
|
prepared: prepared.prepared,
|
|
168
175
|
target: where.target,
|
|
169
176
|
user: app.user,
|
|
177
|
+
secrets: where.secrets,
|
|
170
178
|
sandbox: save?.kind === "branch"
|
|
171
179
|
? { kind: "save", branch: save.branch }
|
|
172
180
|
: { kind: "keep", ms: keepSandboxMinutes(request.keepSandbox, where.recipe, app.env) * 60_000 },
|
|
@@ -626,9 +634,10 @@ function setProblems(texts) {
|
|
|
626
634
|
/**
|
|
627
635
|
* Settles a run before it starts, refusing in this order: the config file (`invalid_config`); each held resource's
|
|
628
636
|
* merged options (`invalid_resource_options`); a `--credential` no held resource takes (`credential_unused`); in a
|
|
629
|
-
* runner run, the runner recipe (`missing_runner`)
|
|
630
|
-
*
|
|
631
|
-
*
|
|
637
|
+
* runner run, the runner recipe (`missing_runner`), the team and project its mint needs (`missing_target`) and the
|
|
638
|
+
* runner secrets from the host's environment (`runner_secrets_invalid`); in a local run
|
|
639
|
+
* where a held resource takes the credential, the credential source (`missing_target` for the mint); then each held
|
|
640
|
+
* resource's own settle, in provider order.
|
|
632
641
|
*/
|
|
633
642
|
async function settleRun(app, request) {
|
|
634
643
|
const file = await loadSettingsFile(app.context.config, app.cwd, RESOURCE_CONFIGS);
|
|
@@ -650,7 +659,15 @@ async function settleRun(app, request) {
|
|
|
650
659
|
const required = requireTarget(settings.scope, settings.project);
|
|
651
660
|
if (!required.ok)
|
|
652
661
|
return required;
|
|
653
|
-
|
|
662
|
+
const recipe = settings.runner.value;
|
|
663
|
+
const secrets = readRunnerSecrets(recipe, app.env);
|
|
664
|
+
if (!secrets.ok)
|
|
665
|
+
return refused(runErrors.runnerSecretsInvalid({
|
|
666
|
+
variables: secrets.variables.map(({ name, problem }) => ({ name, problem })),
|
|
667
|
+
minLength: RUNNER_SECRET_MIN_LENGTH,
|
|
668
|
+
configFile,
|
|
669
|
+
}));
|
|
670
|
+
where = { kind: "runner", recipe, target: required.target, secrets: secrets.values };
|
|
654
671
|
}
|
|
655
672
|
else if (takesCredential) {
|
|
656
673
|
const chosen = settleCredential(request.credential ?? "mint", settings.scope, settings.project);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type StormResourceRanFacts } from "../../resources.ts";
|
|
3
|
-
import type { TestEvent } from "../../sdk/
|
|
3
|
+
import type { TestEvent } from "../../sdk/host.ts";
|
|
4
4
|
declare const testTotalsSchema: z.ZodObject<{
|
|
5
5
|
passed: z.ZodNumber;
|
|
6
6
|
failed: z.ZodNumber;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TestEvent } from "../../sdk/
|
|
1
|
+
import type { TestEvent } from "../../sdk/host.ts";
|
|
2
2
|
/**
|
|
3
3
|
* What the summary says about the tests, a line apiece: `tests`, the totals and how busy the workers were;
|
|
4
4
|
* `containers`, how long container starts took and how much of the attempts' time they were; `slowest`, the slowest
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TimelineSpan } from "../../core/index.ts";
|
|
2
|
-
import type { TestEvent } from "../../sdk/
|
|
2
|
+
import type { TestEvent } from "../../sdk/host.ts";
|
|
3
3
|
import { type Paint } from "./text.ts";
|
|
4
4
|
/** The most workers the chart draws; the rest, those that finished first, are counted on one line. */
|
|
5
5
|
export declare const MAX_WORKER_ROWS = 16;
|