@cnc-tools/storm 0.16.0 → 0.18.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/dist/bin/storm.js +54 -40
- package/dist/build-info.js +1 -1
- package/dist/chunks/{chunk-VL7WFTVQ.js → chunk-24UYAK4R.js} +465 -365
- package/dist/chunks/{chunk-DC2CDHNK.js → chunk-2JMWUKH3.js} +2074 -473
- package/dist/chunks/{chunk-FOZWA52V.js → chunk-3VXZONGE.js} +481 -376
- package/dist/chunks/{chunk-ZG3WQ4UF.js → chunk-55O4FCN4.js} +1 -1
- package/dist/chunks/{chunk-CN4EFA5J.js → chunk-72ZFEMAW.js} +1 -1
- package/dist/chunks/chunk-AS37D43E.js +2173 -0
- package/dist/chunks/chunk-CQAY6GLP.js +1260 -0
- package/dist/chunks/chunk-DZLU7BYK.js +340 -0
- package/dist/chunks/{chunk-R7XVBZOY.js → chunk-EEENLQHE.js} +59 -11
- package/dist/chunks/{chunk-TJNFVNKR.js → chunk-EI3XDCEI.js} +1 -1
- package/dist/chunks/{chunk-HVNK3I45.js → chunk-FDUY3BNF.js} +1 -1
- package/dist/chunks/{chunk-FCQUJDA4.js → chunk-GUCCYCIO.js} +4 -189
- package/dist/chunks/{chunk-OIY3DMF2.js → chunk-HBI4LEMH.js} +3 -3
- package/dist/chunks/{chunk-2MAD5NKK.js → chunk-K4MDQPLW.js} +1 -18
- package/dist/chunks/chunk-KK7PAWIZ.js +198 -0
- package/dist/chunks/{chunk-G3PHMXH5.js → chunk-KQ5FXRUD.js} +18 -1
- package/dist/chunks/{chunk-5VXBKPW6.js → chunk-LKXHGGGX.js} +1 -1
- package/dist/chunks/{chunk-P357TZAY.js → chunk-LOGHIUUB.js} +21 -18
- package/dist/chunks/{chunk-CK2GZEPK.js → chunk-OEPFINFT.js} +2 -2
- package/dist/chunks/{chunk-DWEAHX4T.js → chunk-OI4AP6Z7.js} +5 -5
- package/dist/chunks/{chunk-V4IKA3WI.js → chunk-PMBQWVTW.js} +26 -19
- package/dist/chunks/chunk-SZMYIIG2.js +88 -0
- package/dist/chunks/{chunk-5CCP36QQ.js → chunk-TXCOFC7N.js} +1 -1
- package/dist/chunks/{chunk-VUPZH7J2.js → chunk-UXD3TVWM.js} +1 -1
- package/dist/chunks/{chunk-3L52KNQA.js → chunk-WNW2QXQK.js} +8 -8
- package/dist/chunks/{chunk-AWBSONHB.js → chunk-XBDRVFEV.js} +55 -16
- package/dist/chunks/{live-app-WECQOQ4C.js → live-app-UY7BEDUN.js} +17 -13
- package/dist/cli.d.ts +28 -0
- package/dist/cli.js +64 -0
- package/dist/commands/exec/across-sandboxes-outcomes.d.ts +2 -2
- package/dist/commands/exec/across-sandboxes-outcomes.js +3 -3
- package/dist/commands/exec/before-run.d.ts +123 -0
- package/dist/commands/exec/before-run.js +105 -0
- package/dist/commands/exec/command.d.ts +67 -14
- package/dist/commands/exec/command.js +31 -95
- package/dist/commands/exec/driver-plan.d.ts +9 -4
- package/dist/commands/exec/driver-plan.js +8 -8
- package/dist/commands/exec/exec-words.js +1 -1
- package/dist/commands/exec/execute-run.d.ts +39 -0
- package/dist/commands/exec/execute-run.js +325 -0
- package/dist/commands/exec/live-view.d.ts +3 -3
- package/dist/commands/exec/live-view.js +16 -15
- package/dist/commands/exec/metadata.js +1 -1
- package/dist/commands/exec/mint-failed.d.ts +38 -0
- package/dist/commands/exec/mint-failed.js +27 -4
- package/dist/commands/exec/outcomes.d.ts +104 -22
- package/dist/commands/exec/outcomes.js +73 -26
- package/dist/commands/exec/plan-run.d.ts +58 -150
- package/dist/commands/exec/plan-run.js +239 -90
- package/dist/commands/exec/progress.d.ts +10 -6
- package/dist/commands/exec/progress.js +38 -25
- package/dist/commands/exec/run-bin.d.ts +11 -11
- package/dist/commands/exec/run-bin.js +9 -9
- package/dist/commands/exec/run-flags.d.ts +69 -0
- package/dist/commands/exec/run-flags.js +58 -0
- package/dist/commands/exec/run-metadata.js +4 -4
- package/dist/commands/exec/run-summary.d.ts +58 -0
- package/dist/commands/exec/run-summary.js +205 -0
- package/dist/commands/exec/runner-refusals.d.ts +82 -0
- package/dist/commands/exec/runner-refusals.js +71 -0
- package/dist/commands/exec/sandbox-progress.js +3 -0
- package/dist/commands/exec/stopped-outcome.d.ts +12 -0
- package/dist/commands/exec/stopped-outcome.js +77 -0
- package/dist/commands/exec/view.d.ts +20 -11
- package/dist/commands/exec/view.js +103 -47
- package/dist/commands/runs/facts.d.ts +8 -4
- package/dist/commands/runs/facts.js +19 -10
- package/dist/commands/runs/list/command.d.ts +16 -8
- package/dist/commands/runs/list/command.js +10 -10
- package/dist/commands/runs/list/outcomes.d.ts +8 -4
- package/dist/commands/runs/logs/command.js +10 -10
- package/dist/commands/runs/show/command.d.ts +16 -8
- package/dist/commands/runs/show/command.js +31 -29
- package/dist/commands/runs/show/metadata.js +1 -1
- package/dist/commands/runs/show/outcomes.d.ts +8 -4
- package/dist/commands/runs/show/outcomes.js +8 -6
- package/dist/commands/snapshots/access.d.ts +111 -0
- package/dist/commands/snapshots/access.js +96 -0
- package/dist/commands/snapshots/build/command.d.ts +376 -101
- package/dist/commands/snapshots/build/command.js +447 -149
- package/dist/commands/snapshots/build/metadata.d.ts +10 -0
- package/dist/commands/snapshots/build/metadata.js +31 -11
- package/dist/commands/snapshots/build/outcomes.d.ts +242 -47
- package/dist/commands/snapshots/build/outcomes.js +200 -36
- package/dist/commands/snapshots/list/command.d.ts +368 -27
- package/dist/commands/snapshots/list/command.js +298 -68
- package/dist/commands/snapshots/list/metadata.d.ts +16 -0
- package/dist/commands/snapshots/list/metadata.js +29 -6
- package/dist/commands/snapshots/list/outcomes.d.ts +247 -15
- package/dist/commands/snapshots/list/outcomes.js +223 -52
- package/dist/commands/snapshots/metadata.js +1 -1
- package/dist/commands/snapshots/prune/command.d.ts +430 -0
- package/dist/commands/snapshots/prune/command.js +161 -0
- package/dist/commands/snapshots/prune/metadata.d.ts +28 -0
- package/dist/commands/snapshots/prune/metadata.js +39 -0
- package/dist/commands/snapshots/prune/outcomes.d.ts +208 -0
- package/dist/commands/snapshots/prune/outcomes.js +78 -0
- package/dist/commands/suites/list/command.js +17 -17
- package/dist/commands/suites/list/outcomes.js +2 -2
- package/dist/commands/test/command.d.ts +67 -14
- package/dist/commands/test/command.js +49 -252
- package/dist/commands/test/outcomes.d.ts +33 -7
- package/dist/config/check-runner.d.ts +3 -3
- package/dist/config/check-runner.js +8 -7
- package/dist/config/credential-resolver.d.ts +50 -5
- package/dist/config/credential-resolver.js +51 -19
- package/dist/config/credential-settle.d.ts +6 -2
- package/dist/config/credential-settle.js +11 -5
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +1 -1
- package/dist/config/runner.d.ts +5 -5
- package/dist/config/runner.js +1 -1
- package/dist/config/schema.d.ts +2 -2
- package/dist/config/schema.js +1 -1
- package/dist/config-file/define.d.ts +1 -1
- package/dist/config-file/define.js +1 -1
- package/dist/config-file/runner.d.ts +5 -5
- package/dist/config-file/toolchain.d.ts +14 -4
- package/dist/config-file/toolchain.js +43 -7
- package/dist/context.d.ts +10 -6
- package/dist/context.js +8 -6
- package/dist/core/across-sandboxes.d.ts +7 -6
- package/dist/core/across-sandboxes.js +123 -152
- package/dist/core/coordinator.d.ts +166 -0
- package/dist/core/coordinator.js +233 -0
- package/dist/core/events.d.ts +2 -2
- package/dist/core/index.d.ts +4 -2
- package/dist/core/index.js +1 -1
- package/dist/core/outcomes.d.ts +148 -0
- package/dist/core/{sandbox-end.js → outcomes.js} +28 -4
- package/dist/core/resources.d.ts +31 -53
- package/dist/core/resources.js +32 -70
- package/dist/core/run-state.d.ts +7 -1
- package/dist/core/run-state.js +2 -0
- package/dist/core/run.d.ts +32 -236
- package/dist/core/run.js +107 -267
- package/dist/core/state-directory.d.ts +1 -1
- package/dist/core/state-directory.js +2 -2
- package/dist/credential/gateways.d.ts +15 -1
- package/dist/credential/index.d.ts +4 -3
- package/dist/credential/index.js +3 -2
- package/dist/credential/live/vercel-cli-gateway.d.ts +1 -1
- package/dist/credential/live/vercel-cli-gateway.js +1 -1
- package/dist/credential/live/vercel-oidc-token-gateway.d.ts +11 -0
- package/dist/credential/live/vercel-oidc-token-gateway.js +16 -0
- package/dist/credential/source.d.ts +73 -6
- package/dist/credential/source.js +55 -2
- package/dist/extension-commands.d.ts +1 -1
- package/dist/extension-commands.js +2 -2
- package/dist/extensions/testserver/commands/pool/create/command.d.ts +35 -2
- package/dist/extensions/testserver/commands/pool/create/command.js +7 -7
- package/dist/extensions/testserver/commands/pool/create/metadata.js +5 -5
- package/dist/extensions/testserver/commands/pool/create/outcomes.d.ts +17 -1
- package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
- package/dist/extensions/testserver/credential-facts.d.ts +6 -2
- package/dist/extensions/testserver/credential-facts.js +29 -11
- package/dist/extensions/testserver/lifecycle.js +7 -1
- package/dist/extensions/testserver/limit.d.ts +3 -0
- package/dist/extensions/testserver/limit.js +3 -0
- package/dist/extensions/testserver/provision.d.ts +8 -1
- package/dist/extensions/testserver/provision.js +8 -3
- package/dist/extensions/testserver/refusals.d.ts +6 -1
- package/dist/extensions/testserver/refusals.js +16 -1
- package/dist/extensions/testserver/resource.d.ts +1 -1
- package/dist/extensions/testserver/resource.js +1 -1
- package/dist/extensions/testserver/result.d.ts +1 -1
- package/dist/extensions/testserver/result.js +9 -4
- package/dist/planning/driver-file-lists.d.ts +0 -15
- package/dist/planning/driver-file-lists.js +2 -21
- package/dist/planning/plan-only.d.ts +3 -14
- package/dist/planning/plan-only.js +11 -20
- package/dist/planning/run-kind-flags.js +2 -2
- package/dist/planning/run-plan.d.ts +45 -12
- package/dist/planning/run-plan.js +4 -3
- package/dist/planning/suites.d.ts +1 -1
- package/dist/planning/suites.js +2 -2
- package/dist/planning/test-plan.d.ts +9 -0
- package/dist/planning/test-plan.js +9 -0
- package/dist/run-directory/recording.js +3 -3
- package/dist/run-directory/run-record.d.ts +26 -11
- package/dist/run-directory/run-record.js +16 -13
- package/dist/runner/base.js +1 -1
- package/dist/runner/build-snapshots.d.ts +60 -29
- package/dist/runner/build-snapshots.js +136 -29
- package/dist/runner/context.d.ts +15 -7
- package/dist/runner/context.js +19 -6
- package/dist/runner/events.d.ts +16 -10
- package/dist/runner/gateways.d.ts +122 -23
- package/dist/runner/gateways.js +1 -1
- package/dist/runner/gh.d.ts +42 -0
- package/dist/runner/gh.js +58 -0
- package/dist/runner/index.d.ts +13 -8
- package/dist/runner/index.js +12 -6
- package/dist/runner/live/checkout-gateway.js +7 -0
- package/dist/runner/live/gh-output.d.ts +17 -0
- package/dist/runner/live/gh-output.js +37 -0
- package/dist/runner/live/gh-token-gateway.d.ts +13 -0
- package/dist/runner/live/gh-token-gateway.js +51 -0
- package/dist/runner/live/sandbox-errors.d.ts +2 -0
- package/dist/runner/live/sandbox-errors.js +4 -0
- package/dist/runner/live/sandbox-gateway.js +140 -4
- package/dist/runner/live/snapshot-index-gateway.d.ts +12 -0
- package/dist/runner/live/{snapshot-cache-gateway.js → snapshot-index-gateway.js} +11 -11
- package/dist/runner/live/snapshot-records.js +12 -12
- package/dist/runner/local-snapshot-index.d.ts +205 -0
- package/dist/runner/local-snapshot-index.js +210 -0
- package/dist/runner/network-policy.d.ts +6 -6
- package/dist/runner/network-policy.js +7 -7
- package/dist/runner/policy-writes.d.ts +1 -1
- package/dist/runner/policy-writes.js +1 -1
- package/dist/runner/prepare.d.ts +14 -14
- package/dist/runner/prepare.js +20 -11
- package/dist/runner/ready.d.ts +19 -11
- package/dist/runner/ready.js +104 -33
- package/dist/runner/sandboxed-command.d.ts +3 -3
- package/dist/runner/sandboxed-command.js +3 -3
- package/dist/runner/scope.d.ts +15 -8
- package/dist/runner/scope.js +16 -5
- package/dist/runner/secrets.d.ts +41 -18
- package/dist/runner/secrets.js +226 -30
- package/dist/runner/session.d.ts +8 -8
- package/dist/runner/session.js +6 -3
- package/dist/runner/shared-snapshot-entry.d.ts +92 -0
- package/dist/runner/shared-snapshot-entry.js +168 -0
- package/dist/runner/shared-snapshot-list.d.ts +81 -0
- package/dist/runner/shared-snapshot-list.js +155 -0
- package/dist/runner/shared-snapshot-lookup.d.ts +51 -0
- package/dist/runner/shared-snapshot-lookup.js +118 -0
- package/dist/runner/shared-snapshot-prune.d.ts +58 -0
- package/dist/runner/shared-snapshot-prune.js +133 -0
- package/dist/runner/snapshot-build.d.ts +42 -14
- package/dist/runner/snapshot-build.js +79 -47
- package/dist/runner/snapshot-choice.js +2 -1
- package/dist/runner/snapshot-inspect.d.ts +39 -40
- package/dist/runner/snapshot-inspect.js +52 -35
- package/dist/runner/snapshot-key.d.ts +32 -17
- package/dist/runner/snapshot-key.js +43 -18
- package/dist/runner/snapshot-source.d.ts +31 -0
- package/dist/runner/snapshot-source.js +122 -0
- package/dist/runner/steps.d.ts +1 -1
- package/dist/runner/steps.js +1 -1
- package/dist/runner/{recipe-check.d.ts → vercel-sandbox-check.d.ts} +4 -2
- package/dist/runner/{recipe-check.js → vercel-sandbox-check.js} +7 -2
- package/dist/runner/{recipe.d.ts → vercel-sandbox-options.d.ts} +59 -28
- package/dist/runner/{recipe.js → vercel-sandbox-options.js} +128 -84
- package/dist/runner/vercel-sandbox-secrets.d.ts +116 -0
- package/dist/runner/{recipe-secrets.js → vercel-sandbox-secrets.js} +159 -26
- package/dist/sdk/extension/credential-diagnosis.d.ts +3 -1
- package/dist/sdk/extension/credential-diagnosis.js +25 -5
- package/dist/sdk/extension/credential-source.d.ts +20 -3
- package/dist/sdk/extension/credential-source.js +4 -4
- package/dist/sdk/extension/index.d.ts +3 -2
- package/dist/sdk/extension/index.js +2 -1
- package/dist/sdk/extension/resource-definition.d.ts +1 -1
- package/dist/sdk/extension/secret-source.d.ts +1 -1
- package/dist/sdk/extension/secret-source.js +1 -1
- package/dist/sdk/extension/vercel-oidc-facts.d.ts +20 -0
- package/dist/sdk/extension/vercel-oidc-facts.js +20 -0
- package/dist/shared/cleanup.d.ts +3 -3
- package/dist/shared/cleanup.js +15 -5
- package/dist/shared/snapshot-text.d.ts +4 -4
- package/dist/shared/snapshot-text.js +11 -11
- package/dist/time/duration.js +1 -1
- package/package.json +5 -3
- package/skills/overview.md +4 -4
- package/skills/plan-runs.md +1 -1
- package/skills/read-run-output.md +6 -6
- package/dist/application.d.ts +0 -21
- package/dist/application.js +0 -30
- package/dist/chunks/chunk-7EENF73W.js +0 -782
- package/dist/chunks/chunk-Z5PBVG3Y.js +0 -2599
- package/dist/commands/exec/across-sandboxes-run.d.ts +0 -180
- package/dist/commands/exec/across-sandboxes-run.js +0 -339
- package/dist/commands/exec/plan-only.d.ts +0 -10
- package/dist/commands/exec/plan-only.js +0 -45
- package/dist/commands/exec/run-command.d.ts +0 -475
- package/dist/commands/exec/run-command.js +0 -603
- package/dist/commands/exec/run-planned.d.ts +0 -20
- package/dist/commands/exec/run-planned.js +0 -22
- package/dist/commands/exec/sandbox-view.d.ts +0 -19
- package/dist/commands/exec/sandbox-view.js +0 -72
- package/dist/commands/test/plan.d.ts +0 -92
- package/dist/commands/test/plan.js +0 -125
- package/dist/core/sandbox-end.d.ts +0 -64
- package/dist/runner/live/snapshot-cache-gateway.d.ts +0 -12
- package/dist/runner/recipe-secrets.d.ts +0 -67
- package/dist/runner/snapshot-cache.d.ts +0 -148
- package/dist/runner/snapshot-cache.js +0 -126
|
@@ -0,0 +1,1260 @@
|
|
|
1
|
+
import {
|
|
2
|
+
redactStrings,
|
|
3
|
+
redactor
|
|
4
|
+
} from "./chunk-FDUY3BNF.js";
|
|
5
|
+
import {
|
|
6
|
+
comparedPath,
|
|
7
|
+
fileListMismatchText,
|
|
8
|
+
plannedTestPlan,
|
|
9
|
+
testPlanLine
|
|
10
|
+
} from "./chunk-KK7PAWIZ.js";
|
|
11
|
+
import {
|
|
12
|
+
DEFINITION_SET
|
|
13
|
+
} from "./chunk-OI4AP6Z7.js";
|
|
14
|
+
import {
|
|
15
|
+
isoSecondsText,
|
|
16
|
+
sandboxConnectPage
|
|
17
|
+
} from "./chunk-KQ5FXRUD.js";
|
|
18
|
+
import {
|
|
19
|
+
planSchema,
|
|
20
|
+
sandboxRecordSchema,
|
|
21
|
+
timelineSchema
|
|
22
|
+
} from "./chunk-LOGHIUUB.js";
|
|
23
|
+
import {
|
|
24
|
+
CONFIG_FILE_NAMES_TEXT,
|
|
25
|
+
CREDENTIAL_PROBLEM_KINDS,
|
|
26
|
+
MAX_RUNNER_SANDBOXES,
|
|
27
|
+
configErrors,
|
|
28
|
+
credentialErrors,
|
|
29
|
+
invalidConfig
|
|
30
|
+
} from "./chunk-2JMWUKH3.js";
|
|
31
|
+
import {
|
|
32
|
+
optionKeyPath,
|
|
33
|
+
vercelOidcTokenFailureShape
|
|
34
|
+
} from "./chunk-XBDRVFEV.js";
|
|
35
|
+
import {
|
|
36
|
+
defineErrors,
|
|
37
|
+
defineOutcomes,
|
|
38
|
+
renderOutcome
|
|
39
|
+
} from "./chunk-24UYAK4R.js";
|
|
40
|
+
|
|
41
|
+
// src/shared/cleanup.ts
|
|
42
|
+
import { z } from "zod";
|
|
43
|
+
var notStoppedSchema = z.object({
|
|
44
|
+
name: z.string(),
|
|
45
|
+
role: z.enum(["runner", "snapshot-build"]),
|
|
46
|
+
/** The sandbox's own timeout, in minutes, within which it stops. */
|
|
47
|
+
timeoutMinutes: z.number(),
|
|
48
|
+
message: z.string()
|
|
49
|
+
});
|
|
50
|
+
var notDeletedSchema = z.object({
|
|
51
|
+
name: z.string(),
|
|
52
|
+
role: z.enum(["runner", "snapshot-build"]),
|
|
53
|
+
message: z.string()
|
|
54
|
+
});
|
|
55
|
+
var keptSchema = z.object({
|
|
56
|
+
name: z.string(),
|
|
57
|
+
/** When its timeout stops it, as an ISO time: the keep time from when the run ended, or later. */
|
|
58
|
+
stopsAt: z.string(),
|
|
59
|
+
/** Its Connect page in the Vercel dashboard, which says how to open a shell in it; null when team or project slug is unknown. */
|
|
60
|
+
url: z.string().nullable()
|
|
61
|
+
});
|
|
62
|
+
var notKeptSchema = z.object({ name: z.string(), message: z.string() });
|
|
63
|
+
var runnerCleanupSchema = z.object({
|
|
64
|
+
kept: keptSchema.nullable(),
|
|
65
|
+
notKept: notKeptSchema.nullable(),
|
|
66
|
+
notStopped: z.array(notStoppedSchema),
|
|
67
|
+
notDeleted: z.array(notDeletedSchema)
|
|
68
|
+
});
|
|
69
|
+
function sandboxRole(role) {
|
|
70
|
+
return role === "runner" ? "runner sandbox" : "build sandbox";
|
|
71
|
+
}
|
|
72
|
+
function notStoppedText(sandbox) {
|
|
73
|
+
return `Couldn't stop the ${sandboxRole(sandbox.role)} ${sandbox.name}: ${sandbox.message}. Its own timeout stops it within ${sandbox.timeoutMinutes} minutes.`;
|
|
74
|
+
}
|
|
75
|
+
function notDeletedText(sandbox) {
|
|
76
|
+
return `Stopped the ${sandboxRole(sandbox.role)} ${sandbox.name}, but couldn't delete it: ${sandbox.message}. It stays listed in the Vercel project.`;
|
|
77
|
+
}
|
|
78
|
+
function keptText(kept) {
|
|
79
|
+
const suffix = kept.url === null ? "" : `: ${kept.url}`;
|
|
80
|
+
return `Kept the runner sandbox ${kept.name} running until ${isoSecondsText(kept.stopsAt)}, with no network access, so you can connect to it${suffix}`;
|
|
81
|
+
}
|
|
82
|
+
function notKeptText(sandbox) {
|
|
83
|
+
return `Couldn't keep the runner sandbox ${sandbox.name} running: ${sandbox.message}. Stopped and deleted it instead.`;
|
|
84
|
+
}
|
|
85
|
+
function runnerCleanupRows(cleanup) {
|
|
86
|
+
if (cleanup === null) return [];
|
|
87
|
+
const { kept, notKept } = cleanup;
|
|
88
|
+
return [
|
|
89
|
+
...kept === null ? [] : [
|
|
90
|
+
[
|
|
91
|
+
"Runner sandbox kept",
|
|
92
|
+
[
|
|
93
|
+
`${kept.name}, running until ${isoSecondsText(kept.stopsAt)}, with no network access`,
|
|
94
|
+
...kept.url === null ? [] : [kept.url]
|
|
95
|
+
]
|
|
96
|
+
]
|
|
97
|
+
],
|
|
98
|
+
...notKept === null ? [] : [["Runner sandbox not kept", notKeptText(notKept)]],
|
|
99
|
+
...cleanup.notStopped.length === 0 ? [] : [["Sandboxes not stopped", cleanup.notStopped.map(notStoppedText)]],
|
|
100
|
+
...cleanup.notDeleted.length === 0 ? [] : [["Sandboxes not deleted", cleanup.notDeleted.map(notDeletedText)]]
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
function runnerCleanupWarnings(cleanup) {
|
|
104
|
+
if (cleanup === null) return [];
|
|
105
|
+
return [
|
|
106
|
+
...cleanup.notKept === null ? [] : [{ reason: "runner_sandbox_not_kept", message: notKeptText(cleanup.notKept) }],
|
|
107
|
+
...cleanup.notStopped.map((sandbox) => ({
|
|
108
|
+
reason: "runner_sandbox_not_stopped",
|
|
109
|
+
message: notStoppedText(sandbox)
|
|
110
|
+
})),
|
|
111
|
+
...cleanup.notDeleted.map((sandbox) => ({
|
|
112
|
+
reason: "runner_sandbox_not_deleted",
|
|
113
|
+
message: notDeletedText(sandbox)
|
|
114
|
+
}))
|
|
115
|
+
];
|
|
116
|
+
}
|
|
117
|
+
function runCleanupOf(reports) {
|
|
118
|
+
const schema = z.object({ runner: runnerCleanupSchema.nullable(), resources: reports.cleanupSchema });
|
|
119
|
+
const rows = (cleanup) => [
|
|
120
|
+
...runnerCleanupRows(cleanup.runner),
|
|
121
|
+
...reports.cleanupRows(cleanup.resources)
|
|
122
|
+
];
|
|
123
|
+
return {
|
|
124
|
+
schema,
|
|
125
|
+
facts: ({ runnerCleanup, resourceCleanup }) => ({
|
|
126
|
+
runner: runnerCleanupOf(runnerCleanup),
|
|
127
|
+
resources: reports.cleanupFacts(resourceCleanup)
|
|
128
|
+
}),
|
|
129
|
+
rows
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
var RUN_CLEANUP = runCleanupOf(DEFINITION_SET.reports);
|
|
133
|
+
function runnerCleanupOf(report) {
|
|
134
|
+
if (report === null) return null;
|
|
135
|
+
const { kept, target } = report;
|
|
136
|
+
return {
|
|
137
|
+
kept: kept === null ? null : {
|
|
138
|
+
name: kept.name,
|
|
139
|
+
stopsAt: kept.stopsAt,
|
|
140
|
+
url: target === null ? null : sandboxConnectPage(target, kept.name)
|
|
141
|
+
},
|
|
142
|
+
notKept: report.notKept === null ? null : { ...report.notKept },
|
|
143
|
+
notStopped: report.notStopped.map(({ name, role, timeoutMinutes, message }) => ({
|
|
144
|
+
name,
|
|
145
|
+
role,
|
|
146
|
+
timeoutMinutes,
|
|
147
|
+
message
|
|
148
|
+
})),
|
|
149
|
+
notDeleted: report.notDeleted.map(({ name, role, message }) => ({ name, role, message }))
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// src/commands/exec/outcomes.ts
|
|
154
|
+
import { z as z6 } from "zod";
|
|
155
|
+
|
|
156
|
+
// src/planning/final-results.ts
|
|
157
|
+
function lacksFinalResults(exitCode, read) {
|
|
158
|
+
return exitCode === 0 && read.collected && read.finalResults === 0 && !read.partial;
|
|
159
|
+
}
|
|
160
|
+
var NO_FINAL_RESULTS_MESSAGE = "The command exited 0, but storm got no final test result from it, so the run saved no test results. A test runner reports them only with storm's reporter in its config, and a --reporter on its command line replaces the config's reporters.";
|
|
161
|
+
function noFinalResultsContent(noFinalTestResults, hints) {
|
|
162
|
+
if (!noFinalTestResults) return { warnings: [], next: [] };
|
|
163
|
+
return {
|
|
164
|
+
warnings: [{ reason: "no_final_test_results", message: NO_FINAL_RESULTS_MESSAGE }],
|
|
165
|
+
next: hints.addReporter.map((text) => ({ type: "text", text }))
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// src/planning/plan-only.ts
|
|
170
|
+
import { z as z2 } from "zod";
|
|
171
|
+
var plannedOptionSchema = z2.object({
|
|
172
|
+
/** The option's key path, `resources.<key>.<option>`. */
|
|
173
|
+
path: z2.string(),
|
|
174
|
+
/** Its value; a value that is not a string, a number, or a boolean as its JSON text. */
|
|
175
|
+
value: z2.union([z2.string(), z2.number(), z2.boolean()]),
|
|
176
|
+
/** Where the value came from: its flag (`flag`), storm.config.ts (`file`), or its default (`default`). */
|
|
177
|
+
from: z2.enum(["flag", "file", "default"])
|
|
178
|
+
});
|
|
179
|
+
var plannedSchema = z2.object({
|
|
180
|
+
version: z2.string(),
|
|
181
|
+
commit: z2.string().nullable(),
|
|
182
|
+
configFile: z2.string().nullable(),
|
|
183
|
+
argv: z2.array(z2.string()),
|
|
184
|
+
plan: planSchema.nullable(),
|
|
185
|
+
testFiles: z2.array(z2.string()).nullable(),
|
|
186
|
+
runnerSandboxes: z2.object({
|
|
187
|
+
max: z2.number(),
|
|
188
|
+
default: z2.union([z2.number(), z2.object({ filesPerSandbox: z2.number(), max: z2.number().optional() })]).nullable()
|
|
189
|
+
}).nullable(),
|
|
190
|
+
sandboxes: z2.array(z2.object({ sandbox: z2.number(), argv: z2.array(z2.string()), files: z2.array(z2.string()).nullable() })).nullable(),
|
|
191
|
+
options: z2.array(plannedOptionSchema),
|
|
192
|
+
vcpus: z2.number().nullable()
|
|
193
|
+
});
|
|
194
|
+
function plannedSecrets(lifecycles, runner, resources) {
|
|
195
|
+
return [...lifecycles.secrets(resources), ...runner.kind === "vercel-sandbox" ? runner.secrets : []];
|
|
196
|
+
}
|
|
197
|
+
function buildPlannedFacts(input) {
|
|
198
|
+
const { plan: runPlan, lifecycles } = input;
|
|
199
|
+
const { runner, sandboxes, resources } = runPlan;
|
|
200
|
+
const policy = runner.kind === "vercel-sandbox" ? runner.options.sandboxes : void 0;
|
|
201
|
+
const facts = {
|
|
202
|
+
version: input.version,
|
|
203
|
+
commit: input.commit,
|
|
204
|
+
configFile: runPlan.configFile,
|
|
205
|
+
argv: [...runPlan.argv],
|
|
206
|
+
plan: plannedTestPlan(runPlan) ?? null,
|
|
207
|
+
testFiles: runPlan.testFiles === void 0 ? null : [...runPlan.testFiles],
|
|
208
|
+
runnerSandboxes: policy === void 0 ? null : {
|
|
209
|
+
max: policy.max,
|
|
210
|
+
default: policy.default ?? null
|
|
211
|
+
},
|
|
212
|
+
sandboxes: sandboxes === void 0 ? null : sandboxes.sandboxes.map(({ argv, files }, index) => ({
|
|
213
|
+
sandbox: index,
|
|
214
|
+
argv: [...argv],
|
|
215
|
+
files: files === null ? null : [...files]
|
|
216
|
+
})),
|
|
217
|
+
options: Object.entries(resources).flatMap(
|
|
218
|
+
([key, { options, sources }]) => Object.entries(options).map(([option, value]) => ({
|
|
219
|
+
path: optionKeyPath(key, option),
|
|
220
|
+
value: typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? value : JSON.stringify(value) ?? String(value),
|
|
221
|
+
from: sources[option] ?? "default"
|
|
222
|
+
}))
|
|
223
|
+
),
|
|
224
|
+
vcpus: input.vcpus
|
|
225
|
+
};
|
|
226
|
+
const redact = redactor(plannedSecrets(lifecycles, runner, resources));
|
|
227
|
+
return redactStrings(facts, redact);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// src/commands/exec/mint-failed.ts
|
|
231
|
+
import { z as z3 } from "zod";
|
|
232
|
+
var mintFailedErrors = defineErrors({
|
|
233
|
+
mintFailed: {
|
|
234
|
+
exitCode: 1,
|
|
235
|
+
description: "The vercel CLI couldn't mint a credential, so the command didn't run. With the Vercel Sandbox runner, the credential was for the runner sandbox, which always needs one; on the launch machine, for a resource that couldn't go on without it.",
|
|
236
|
+
schema: z3.object({
|
|
237
|
+
team: z3.string(),
|
|
238
|
+
project: z3.string(),
|
|
239
|
+
cause: z3.string(),
|
|
240
|
+
fix: z3.string(),
|
|
241
|
+
/** Whether the credential was for the runner sandbox, not for a resource. */
|
|
242
|
+
runner: z3.boolean(),
|
|
243
|
+
/** What the run couldn't clean up. */
|
|
244
|
+
cleanup: RUN_CLEANUP.schema
|
|
245
|
+
}),
|
|
246
|
+
render: ({ cause, fix, runner, cleanup }) => {
|
|
247
|
+
const rows = RUN_CLEANUP.rows(cleanup);
|
|
248
|
+
return {
|
|
249
|
+
message: runner ? `Couldn't mint a credential for the runner sandbox: ${cause}. The command didn't run.` : `Couldn't mint a credential: ${cause}. One of the run's resources needed it, so the command didn't run.`,
|
|
250
|
+
...rows.length === 0 ? {} : { rows },
|
|
251
|
+
next: [{ type: "text", text: fix }]
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
vercelOidcTokenFailed: {
|
|
256
|
+
exitCode: 1,
|
|
257
|
+
description: "With --credential vercel-oidc, VERCEL_OIDC_TOKEN is missing, empty, or not a valid Vercel project OIDC token, so the command didn't run.",
|
|
258
|
+
schema: z3.object({
|
|
259
|
+
...vercelOidcTokenFailureShape,
|
|
260
|
+
/** Whether the credential was for the runner sandbox, not for a resource. */
|
|
261
|
+
runner: z3.boolean(),
|
|
262
|
+
/** What the run couldn't clean up. */
|
|
263
|
+
cleanup: RUN_CLEANUP.schema
|
|
264
|
+
}),
|
|
265
|
+
render: ({ detail, fix, runner, cleanup }) => {
|
|
266
|
+
const rows = RUN_CLEANUP.rows(cleanup);
|
|
267
|
+
return {
|
|
268
|
+
message: runner ? `Couldn't use VERCEL_OIDC_TOKEN for the runner sandbox: ${detail}. The command didn't run.` : `Couldn't use VERCEL_OIDC_TOKEN: ${detail}. One of the run's resources needed it, so the command didn't run.`,
|
|
269
|
+
...rows.length === 0 ? {} : { rows },
|
|
270
|
+
next: [{ type: "text", text: fix }]
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
// src/commands/exec/planned-outcome.ts
|
|
277
|
+
var PLANNED_DESCRIPTION = "With --plan-only: storm did the local checks and the plan step, and printed the planned run. It minted nothing, acquired no resource, started no sandbox, and opened no run directory. Each refusal a run gets before it mints, --plan-only gets too.";
|
|
278
|
+
function plannedText(planned) {
|
|
279
|
+
const files = (n) => `${n} test ${n === 1 ? "file" : "files"}`;
|
|
280
|
+
return [
|
|
281
|
+
...planned.plan === null ? [] : [testPlanLine(planned.plan)],
|
|
282
|
+
...(planned.sandboxes ?? []).map(
|
|
283
|
+
({ sandbox, argv, files: list }) => `runner sandbox ${sandbox}: ${list === null ? argv.join(" ") : files(list.length)}`
|
|
284
|
+
),
|
|
285
|
+
...planned.sandboxes === null ? [`command: ${planned.argv.join(" ")}`] : [],
|
|
286
|
+
...planned.vcpus === null ? [] : [
|
|
287
|
+
planned.sandboxes === null ? `runner sandbox: ${planned.vcpus} vCPUs` : `runner sandboxes: ${planned.vcpus} vCPUs each`
|
|
288
|
+
],
|
|
289
|
+
...planned.runnerSandboxes === null || planned.runnerSandboxes.default === null ? [] : [
|
|
290
|
+
`runner.sandboxes: default ${formatSandboxesDefault(planned.runnerSandboxes.default)}, max ${planned.runnerSandboxes.max}`
|
|
291
|
+
],
|
|
292
|
+
...planned.options.map(({ path, value, from }) => `${path}: ${String(value)} (${from})`)
|
|
293
|
+
].join("\n");
|
|
294
|
+
}
|
|
295
|
+
function formatSandboxesDefault(value) {
|
|
296
|
+
if (typeof value === "number") return String(value);
|
|
297
|
+
const per = `1 per ${value.filesPerSandbox} test ${value.filesPerSandbox === 1 ? "file" : "files"}`;
|
|
298
|
+
return value.max === void 0 ? per : `${per} (max ${value.max})`;
|
|
299
|
+
}
|
|
300
|
+
function renderPlanned(planned) {
|
|
301
|
+
return renderOutcome({
|
|
302
|
+
text: plannedText(planned),
|
|
303
|
+
message: "Nothing was minted, acquired, or started.",
|
|
304
|
+
next: [{ type: "text", text: "Run the same command without --plan-only to start the run." }]
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// src/commands/exec/resource-refusals.ts
|
|
309
|
+
import { z as z4 } from "zod";
|
|
310
|
+
var refusalShape = {
|
|
311
|
+
/** The resource instance that refused, by its resource key. */
|
|
312
|
+
resource: z4.string().min(1),
|
|
313
|
+
/** The resource's own snake_case reason for refusing. */
|
|
314
|
+
refusal: z4.string(),
|
|
315
|
+
/** The resource's own data about the refusal, which differs by resource and reason. */
|
|
316
|
+
data: z4.record(z4.string(), z4.unknown())
|
|
317
|
+
};
|
|
318
|
+
function contentOf({ message, next, rows: own = [] }, rows) {
|
|
319
|
+
const all = [...own, ...rows];
|
|
320
|
+
return { message, ...next === void 0 ? {} : { next }, ...all.length === 0 ? {} : { rows: all } };
|
|
321
|
+
}
|
|
322
|
+
var resourceRefusalErrors = defineErrors({
|
|
323
|
+
resourceRefusedBeforeRun: {
|
|
324
|
+
exitCode: 2,
|
|
325
|
+
description: "A resource's beforeRun refused the run before it started, so nothing was minted, acquired or started. data.resource names the resource by its key, data.refusal is the resource's own reason, and data.data its own data.",
|
|
326
|
+
schema: z4.object({
|
|
327
|
+
...refusalShape,
|
|
328
|
+
/** The config file that applied (its absolute path); null when none did. */
|
|
329
|
+
configFile: z4.string().nullable()
|
|
330
|
+
}),
|
|
331
|
+
render: (_data, refusal) => contentOf(refusal, [])
|
|
332
|
+
},
|
|
333
|
+
resourceRefused: {
|
|
334
|
+
exitCode: 1,
|
|
335
|
+
description: "A resource refused while the run acquired its resources, so the command didn't run. data.resource names the resource by its key, data.refusal is the resource's own reason, and data.data its own data.",
|
|
336
|
+
schema: z4.object({
|
|
337
|
+
...refusalShape,
|
|
338
|
+
/** What the run couldn't clean up. */
|
|
339
|
+
cleanup: RUN_CLEANUP.schema
|
|
340
|
+
}),
|
|
341
|
+
render: ({ cleanup }, refusal) => contentOf(refusal, RUN_CLEANUP.rows(cleanup))
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
function resourceRefusedBeforeRun(resource, refusal, configFile) {
|
|
345
|
+
const { refused, data, ...content } = refusal;
|
|
346
|
+
return resourceRefusalErrors.resourceRefusedBeforeRun(
|
|
347
|
+
{ resource, refusal: refused, data: { ...data }, configFile },
|
|
348
|
+
content
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
function resourceRefused(outcome, cleanup) {
|
|
352
|
+
const { refused, data, ...content } = outcome.refusal;
|
|
353
|
+
return resourceRefusalErrors.resourceRefused(
|
|
354
|
+
{ resource: outcome.resource, refusal: refused, data: { ...data }, cleanup },
|
|
355
|
+
content
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// src/commands/exec/across-sandboxes-outcomes.ts
|
|
360
|
+
import { z as z5 } from "zod";
|
|
361
|
+
|
|
362
|
+
// src/planning/file-lists-file.ts
|
|
363
|
+
import { isAbsolute, resolve } from "node:path";
|
|
364
|
+
async function readFileListsFile(gateway, request) {
|
|
365
|
+
const { path, cwd, sandboxes } = request;
|
|
366
|
+
const resolvedPath = path === "-" ? "-" : isAbsolute(path) ? path : resolve(cwd, path);
|
|
367
|
+
const read = await gateway.readFileListsFile({ path: resolvedPath });
|
|
368
|
+
if (read.kind !== "read") return { ok: false, kind: "unreadable", path, problem: read.kind, message: read.message };
|
|
369
|
+
const lists = fileListsOf(read.value);
|
|
370
|
+
if (!lists.ok) return { ok: false, kind: "unreadable", path, problem: "not-lists", message: lists.problem };
|
|
371
|
+
const problems = fileListsProblems(lists.lists, sandboxes);
|
|
372
|
+
if (problems.length > 0) return { ok: false, kind: "invalid", path, problems };
|
|
373
|
+
return { ok: true, lists: { path, lists: lists.lists } };
|
|
374
|
+
}
|
|
375
|
+
function fileListsOf(value) {
|
|
376
|
+
const shape = "an array with one array of test file paths for each runner sandbox";
|
|
377
|
+
if (!Array.isArray(value)) return { ok: false, problem: `holds ${describe(value)}, not ${shape}` };
|
|
378
|
+
if (value.length === 0) return { ok: false, problem: `holds an empty array, not ${shape}, at least one` };
|
|
379
|
+
const lists = [];
|
|
380
|
+
for (const [index, list] of value.entries()) {
|
|
381
|
+
if (!Array.isArray(list))
|
|
382
|
+
return {
|
|
383
|
+
ok: false,
|
|
384
|
+
problem: `holds ${describe(list)} as the list of runner sandbox ${index}, not an array of paths`
|
|
385
|
+
};
|
|
386
|
+
const bad = list.findIndex((file) => typeof file !== "string" || file === "");
|
|
387
|
+
if (bad !== -1)
|
|
388
|
+
return {
|
|
389
|
+
ok: false,
|
|
390
|
+
problem: `holds ${describe(list[bad])} in the list of runner sandbox ${index}, at item ${bad + 1}, not a test file's path`
|
|
391
|
+
};
|
|
392
|
+
lists.push(list);
|
|
393
|
+
}
|
|
394
|
+
return { ok: true, lists };
|
|
395
|
+
}
|
|
396
|
+
function describe(value) {
|
|
397
|
+
if (value === null) return "null";
|
|
398
|
+
if (Array.isArray(value)) return "an array";
|
|
399
|
+
if (typeof value === "string") return value === "" ? "an empty string" : `the string ${JSON.stringify(value)}`;
|
|
400
|
+
if (typeof value === "object") return "an object";
|
|
401
|
+
return `${typeof value} ${JSON.stringify(value) ?? typeof value}`;
|
|
402
|
+
}
|
|
403
|
+
function fileListsProblems(lists, sandboxes) {
|
|
404
|
+
const named = /* @__PURE__ */ new Map();
|
|
405
|
+
lists.forEach((list, index) => {
|
|
406
|
+
for (const file of list) {
|
|
407
|
+
const key = comparedPath(file);
|
|
408
|
+
named.set(key, [...named.get(key) ?? [], index]);
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
return [
|
|
412
|
+
...lists.flatMap((list, index) => list.length === 0 ? [{ kind: "empty-list", sandbox: index }] : []),
|
|
413
|
+
...[...named].flatMap(
|
|
414
|
+
([file, at]) => at.length > 1 ? [{ kind: "in-two-lists", file, sandboxes: at }] : []
|
|
415
|
+
),
|
|
416
|
+
...sandboxes !== void 0 && sandboxes !== lists.length ? [{ kind: "count-mismatch", lists: lists.length, sandboxes }] : []
|
|
417
|
+
];
|
|
418
|
+
}
|
|
419
|
+
function numbersText(numbers) {
|
|
420
|
+
const words = numbers.map(String);
|
|
421
|
+
if (words.length <= 2) return words.join(" and ");
|
|
422
|
+
return `${words.slice(0, -1).join(", ")}, and ${words.at(-1) ?? ""}`;
|
|
423
|
+
}
|
|
424
|
+
function fileListsProblemText(problem) {
|
|
425
|
+
switch (problem.kind) {
|
|
426
|
+
case "empty-list":
|
|
427
|
+
return `The list of runner sandbox ${problem.sandbox} holds no test file.`;
|
|
428
|
+
case "in-two-lists": {
|
|
429
|
+
const distinct = [...new Set(problem.sandboxes)];
|
|
430
|
+
return distinct.length === 1 ? `${problem.file} is in the list of runner sandbox ${distinct[0] ?? ""} ${problem.sandboxes.length} times.` : `${problem.file} is in the lists of runner sandboxes ${numbersText(problem.sandboxes)}.`;
|
|
431
|
+
}
|
|
432
|
+
case "count-mismatch":
|
|
433
|
+
return `The file holds ${problem.lists} ${problem.lists === 1 ? "list" : "lists"}, and --sandboxes asks for ${problem.sandboxes} ${problem.sandboxes === 1 ? "runner sandbox" : "runner sandboxes"}.`;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
function resolveCallerFileLists(testFiles, caller) {
|
|
437
|
+
const listed2 = new Map(testFiles.map((file) => [comparedPath(file), file]));
|
|
438
|
+
const unlisted = caller.lists.flat().filter((file) => !listed2.has(comparedPath(file)));
|
|
439
|
+
if (unlisted.length > 0) return { ok: false, unlisted, listed: listed2.size };
|
|
440
|
+
const lists = caller.lists.map((list) => list.map((file) => listed2.get(comparedPath(file)) ?? file));
|
|
441
|
+
const held = lists.reduce((sum, list) => sum + list.length, 0);
|
|
442
|
+
return { ok: true, lists, leftOut: listed2.size - held };
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// src/commands/exec/across-sandboxes-outcomes.ts
|
|
446
|
+
var keptSandboxSchema = z5.object({
|
|
447
|
+
sandbox: z5.number(),
|
|
448
|
+
name: z5.string(),
|
|
449
|
+
stopsAt: z5.string(),
|
|
450
|
+
url: z5.string().nullable()
|
|
451
|
+
});
|
|
452
|
+
var notKeptSandboxSchema = z5.object({ sandbox: z5.number(), name: z5.string(), message: z5.string() });
|
|
453
|
+
var sandboxesRanSchema = z5.object({
|
|
454
|
+
version: z5.string(),
|
|
455
|
+
commit: z5.string().nullable(),
|
|
456
|
+
configFile: z5.string().nullable(),
|
|
457
|
+
runId: z5.string().nullable(),
|
|
458
|
+
runDirectory: z5.string().nullable(),
|
|
459
|
+
sandboxes: z5.array(sandboxRecordSchema),
|
|
460
|
+
/** How many runner sandboxes are in each runner sandbox state, keyed by the state. */
|
|
461
|
+
states: z5.object({
|
|
462
|
+
passed: z5.number(),
|
|
463
|
+
failed: z5.number(),
|
|
464
|
+
"not-started": z5.number(),
|
|
465
|
+
canceled: z5.number()
|
|
466
|
+
}),
|
|
467
|
+
tests: z5.object({ passed: z5.number(), failed: z5.number(), skipped: z5.number() }).nullable(),
|
|
468
|
+
plan: planSchema,
|
|
469
|
+
resources: DEFINITION_SET.reports.ranSchema,
|
|
470
|
+
wallMs: z5.number(),
|
|
471
|
+
runner: z5.object({
|
|
472
|
+
snapshotId: z5.string(),
|
|
473
|
+
base: z5.string(),
|
|
474
|
+
builtBehind: z5.number().nullable(),
|
|
475
|
+
built: z5.boolean(),
|
|
476
|
+
vcpus: z5.number(),
|
|
477
|
+
region: z5.string(),
|
|
478
|
+
image: z5.string(),
|
|
479
|
+
uploadBytes: z5.number().nullable()
|
|
480
|
+
}),
|
|
481
|
+
cleanup: RUN_CLEANUP.schema,
|
|
482
|
+
kept: z5.array(keptSandboxSchema),
|
|
483
|
+
notKept: z5.array(notKeptSandboxSchema),
|
|
484
|
+
fileListMismatches: z5.array(
|
|
485
|
+
z5.object({ sandbox: z5.number(), missing: z5.array(z5.string()), extra: z5.array(z5.string()) })
|
|
486
|
+
)
|
|
487
|
+
});
|
|
488
|
+
var SANDBOXES_RAN_DESCRIPTION = "Every runner sandbox of a run across runner sandboxes ended. storm exits 0 when every runner sandbox passed, else 1, whatever this result's exit code. A runner sandbox with a file list whose command ended, and which reported nothing for a test file of its list or reported a test file not in its list, warns file_list_mismatch; the exit status is the same.";
|
|
489
|
+
function renderSandboxesRan(ran, options = {}) {
|
|
490
|
+
const noFinal = options.noFinal === void 0 ? { warnings: [], next: [] } : noFinalResultsContent(options.noFinal.noFinalTestResults, options.noFinal.hints);
|
|
491
|
+
const warnings = [
|
|
492
|
+
...ran.notKept.map((sandbox) => ({
|
|
493
|
+
reason: "runner_sandbox_not_kept",
|
|
494
|
+
message: `Runner sandbox ${sandbox.sandbox}: ${notKeptText(sandbox)}`
|
|
495
|
+
})),
|
|
496
|
+
...runnerCleanupWarnings(ran.cleanup.runner),
|
|
497
|
+
...DEFINITION_SET.reports.cleanupWarnings(ran.cleanup.resources),
|
|
498
|
+
...ran.fileListMismatches.map((mismatch) => ({
|
|
499
|
+
reason: "file_list_mismatch",
|
|
500
|
+
message: fileListMismatchText(
|
|
501
|
+
mismatch,
|
|
502
|
+
options.extraMismatchHint === void 0 ? {} : { extraHint: options.extraMismatchHint }
|
|
503
|
+
)
|
|
504
|
+
})),
|
|
505
|
+
...noFinal.warnings
|
|
506
|
+
];
|
|
507
|
+
const kept = ran.kept.map(
|
|
508
|
+
({ sandbox, name, stopsAt, url }) => `Kept runner sandbox ${sandbox}, ${name}, running until ${isoSecondsText(stopsAt)}, so you can connect to it${url === null ? "" : `: ${url}`}`
|
|
509
|
+
);
|
|
510
|
+
return renderOutcome({
|
|
511
|
+
...kept.length === 0 ? {} : { message: kept.join("\n") },
|
|
512
|
+
...warnings.length === 0 ? {} : { warnings },
|
|
513
|
+
...noFinal.next.length === 0 ? {} : { next: [...noFinal.next] }
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
var sandboxesFlagSchema = z5.enum(["--sandboxes", "--file-lists"]);
|
|
517
|
+
var fileListsProblemSchema = z5.discriminatedUnion("kind", [
|
|
518
|
+
z5.object({ kind: z5.literal("empty-list"), sandbox: z5.number() }),
|
|
519
|
+
z5.object({ kind: z5.literal("in-two-lists"), file: z5.string(), sandboxes: z5.array(z5.number()) }),
|
|
520
|
+
z5.object({ kind: z5.literal("count-mismatch"), lists: z5.number(), sandboxes: z5.number() })
|
|
521
|
+
]);
|
|
522
|
+
var NAMED_PATHS = 10;
|
|
523
|
+
function namedPaths(paths) {
|
|
524
|
+
return paths.length > NAMED_PATHS ? [...paths.slice(0, NAMED_PATHS), `and ${paths.length - NAMED_PATHS} more`] : paths;
|
|
525
|
+
}
|
|
526
|
+
var sandboxesErrors = defineErrors({
|
|
527
|
+
missingSandboxesMax: {
|
|
528
|
+
exitCode: 2,
|
|
529
|
+
description: "--sandboxes or --file-lists was given, and storm.config.ts has no runner.sandboxes key, which sets the most runner sandboxes a run can have. A repository opts in to runs across runner sandboxes. Nothing was minted, acquired, or started.",
|
|
530
|
+
schema: z5.object({
|
|
531
|
+
flag: sandboxesFlagSchema,
|
|
532
|
+
key: z5.string(),
|
|
533
|
+
configFile: z5.string().nullable()
|
|
534
|
+
}),
|
|
535
|
+
render: ({ flag, configFile }) => ({
|
|
536
|
+
message: `${flag} needs runner.sandboxes in storm.config.ts, and ${configFile === null ? `no ${CONFIG_FILE_NAMES_TEXT} applies` : `${configFile} has none`}. The run didn't start.`,
|
|
537
|
+
next: [
|
|
538
|
+
{
|
|
539
|
+
type: "text",
|
|
540
|
+
text: `Add runner: { sandboxes: { max: <n> } } to storm.config.ts, with n from 1 to ${MAX_RUNNER_SANDBOXES}: the most runner sandboxes a run can have. Or drop ${flag}.`
|
|
541
|
+
}
|
|
542
|
+
]
|
|
543
|
+
})
|
|
544
|
+
},
|
|
545
|
+
sandboxesOverMax: {
|
|
546
|
+
exitCode: 2,
|
|
547
|
+
description: "--sandboxes asked for more runner sandboxes than runner.sandboxes.max in storm.config.ts allows, or the file --file-lists names holds more lists than that. Nothing was minted, acquired, or started.",
|
|
548
|
+
schema: z5.object({
|
|
549
|
+
flag: sandboxesFlagSchema,
|
|
550
|
+
sandboxes: z5.number(),
|
|
551
|
+
key: z5.string(),
|
|
552
|
+
max: z5.number(),
|
|
553
|
+
configFile: z5.string().nullable()
|
|
554
|
+
}),
|
|
555
|
+
render: ({ flag, sandboxes, key, max }) => {
|
|
556
|
+
const raise = max < MAX_RUNNER_SANDBOXES ? `, or raise ${key} in storm.config.ts, up to ${MAX_RUNNER_SANDBOXES}` : "";
|
|
557
|
+
return {
|
|
558
|
+
message: flag === "--sandboxes" ? `--sandboxes ${sandboxes} asks for more runner sandboxes than ${key} allows: ${max}. The run didn't start.` : `--file-lists gives ${sandboxes} file lists, more than ${key} allows: ${max}. The run didn't start.`,
|
|
559
|
+
next: [
|
|
560
|
+
{
|
|
561
|
+
type: "text",
|
|
562
|
+
text: flag === "--sandboxes" ? `Give --sandboxes a number from 1 to ${max}${raise}.` : `Give at most ${max} lists in the file${raise}.`
|
|
563
|
+
}
|
|
564
|
+
]
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
var sandboxesDefaultErrors = defineErrors({
|
|
570
|
+
sandboxesDefaultRefused: {
|
|
571
|
+
exitCode: 2,
|
|
572
|
+
description: "runner.sandboxes.default in storm.config.ts makes this a run across runner sandboxes, and the run was given something a run across runner sandboxes can't take: --show-output or an argument its driver refuses in a run across runner sandboxes. Nothing was minted, acquired, or started.",
|
|
573
|
+
schema: z5.object({
|
|
574
|
+
key: z5.string(),
|
|
575
|
+
sandboxes: z5.number(),
|
|
576
|
+
field: z5.enum(["showOutput", "args"]),
|
|
577
|
+
problem: z5.string(),
|
|
578
|
+
configFile: z5.string().nullable()
|
|
579
|
+
}),
|
|
580
|
+
render: ({ key, sandboxes, problem }) => ({
|
|
581
|
+
message: `${key} in storm.config.ts makes this a run across ${sandboxes} ${sandboxes === 1 ? "runner sandbox" : "runner sandboxes"}, which can't take what the run was given: ${problem} The run didn't start.`,
|
|
582
|
+
next: [
|
|
583
|
+
{
|
|
584
|
+
type: "text",
|
|
585
|
+
text: `Drop what the problem names, or remove ${key} from storm.config.ts.`
|
|
586
|
+
}
|
|
587
|
+
]
|
|
588
|
+
})
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
var fileListErrors = defineErrors({
|
|
592
|
+
fileListsUnreadable: {
|
|
593
|
+
exitCode: 2,
|
|
594
|
+
description: "The file --file-lists names can't be read, its text isn't JSON, or its JSON isn't an array with one array of test file paths for each runner sandbox, at least one. Nothing was minted, acquired, or started.",
|
|
595
|
+
schema: z5.object({
|
|
596
|
+
path: z5.string(),
|
|
597
|
+
problem: z5.enum(["unreadable", "not-json", "not-lists"]),
|
|
598
|
+
message: z5.string()
|
|
599
|
+
}),
|
|
600
|
+
render: ({ path, problem, message }) => ({
|
|
601
|
+
message: problem === "unreadable" ? `Couldn't read the file lists file ${path}: ${message}. The run didn't start.` : problem === "not-json" ? `The file lists file ${path} isn't JSON: ${message}. The run didn't start.` : `The file lists file ${path} ${message}. The run didn't start.`,
|
|
602
|
+
next: [
|
|
603
|
+
{
|
|
604
|
+
type: "text",
|
|
605
|
+
text: 'Give --file-lists a JSON file that holds an array with one array of test file paths for each runner sandbox, in order of runner sandbox index, such as [["test/a.test.ts"], ["test/b.test.ts"]].'
|
|
606
|
+
}
|
|
607
|
+
]
|
|
608
|
+
})
|
|
609
|
+
},
|
|
610
|
+
invalidFileLists: {
|
|
611
|
+
exitCode: 2,
|
|
612
|
+
description: "The lists in the file --file-lists names can't be a run's file lists: a list holds no test file, a test file is in two lists or two times in one, or the number of lists differs from --sandboxes. Nothing was minted, acquired, or started.",
|
|
613
|
+
schema: z5.object({
|
|
614
|
+
path: z5.string(),
|
|
615
|
+
problems: z5.array(fileListsProblemSchema)
|
|
616
|
+
}),
|
|
617
|
+
render: ({ path, problems }) => ({
|
|
618
|
+
message: `The file lists in ${path} can't be used. The run didn't start.`,
|
|
619
|
+
rows: [["Problems", problems.map(fileListsProblemText)]],
|
|
620
|
+
next: [
|
|
621
|
+
{
|
|
622
|
+
type: "text",
|
|
623
|
+
text: "Give each runner sandbox a list with at least one test file, name each test file in one list at most, and drop --sandboxes or give it the number of lists."
|
|
624
|
+
}
|
|
625
|
+
]
|
|
626
|
+
})
|
|
627
|
+
},
|
|
628
|
+
fileListsUnlisted: {
|
|
629
|
+
exitCode: 2,
|
|
630
|
+
description: "A list in the file --file-lists names holds a path that the run's own listing of its test files doesn't have. Nothing was minted, acquired, or started.",
|
|
631
|
+
schema: z5.object({
|
|
632
|
+
path: z5.string(),
|
|
633
|
+
files: z5.array(z5.string()),
|
|
634
|
+
listed: z5.number()
|
|
635
|
+
}),
|
|
636
|
+
render: ({ path, files, listed: listed2 }) => ({
|
|
637
|
+
message: `The file lists in ${path} name ${files.length === 1 ? "a path" : `${files.length} paths`} that the run's listing of its ${listed2} test ${listed2 === 1 ? "file" : "files"} doesn't have. The run didn't start.`,
|
|
638
|
+
rows: [["Not listed", [...namedPaths(files)]]],
|
|
639
|
+
next: [
|
|
640
|
+
{
|
|
641
|
+
type: "text",
|
|
642
|
+
text: "Name each test file as the listing does, relative to the project, such as test/a.test.ts, and only test files the run's arguments select. Run the same command with --plan-only --json, and read testFiles."
|
|
643
|
+
}
|
|
644
|
+
]
|
|
645
|
+
})
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
// src/commands/exec/outcomes.ts
|
|
650
|
+
var runnerFailureSchema = z6.union([
|
|
651
|
+
z6.object({
|
|
652
|
+
kind: z6.enum(["snapshot-build-step-failed", "apply-failed", "install-failed", "build-failed"]),
|
|
653
|
+
/** The step's label. */
|
|
654
|
+
label: z6.string(),
|
|
655
|
+
/** Its exit code; null when it ended without one. */
|
|
656
|
+
exitCode: z6.number().nullable(),
|
|
657
|
+
/** Its last 40 output lines. */
|
|
658
|
+
tail: z6.array(z6.string())
|
|
659
|
+
}),
|
|
660
|
+
z6.object({
|
|
661
|
+
kind: z6.literal("sandbox-api-failed"),
|
|
662
|
+
/** The Sandbox call that failed. */
|
|
663
|
+
operation: z6.string(),
|
|
664
|
+
/** The HTTP status the Sandbox API answered; null when it answered none. */
|
|
665
|
+
status: z6.number().nullable(),
|
|
666
|
+
message: z6.string()
|
|
667
|
+
}),
|
|
668
|
+
z6.object({
|
|
669
|
+
kind: z6.literal("checkout-failed"),
|
|
670
|
+
/** What git or tar said. */
|
|
671
|
+
message: z6.string(),
|
|
672
|
+
/** The failed command; null when there was none. */
|
|
673
|
+
command: z6.string().nullable()
|
|
674
|
+
}),
|
|
675
|
+
z6.object({ kind: z6.literal("credential-claims-missing"), team: z6.string(), project: z6.string() }),
|
|
676
|
+
z6.object({
|
|
677
|
+
kind: z6.literal("network-policy-failed"),
|
|
678
|
+
/** The write that failed: the one that puts credentials in place, or the one that removes them. */
|
|
679
|
+
operation: z6.enum(["inject", "remove"]),
|
|
680
|
+
/** Where the write was: around the runner's snapshot steps or its run steps and their credentials, before a runner snapshot is saved, or as the command starts, with the credentials its resources give it beside the runner's. */
|
|
681
|
+
around: z6.enum(["snapshot-steps", "run-steps", "snapshot-save", "command"]),
|
|
682
|
+
/** `api` when the Sandbox API refused or failed, `timed-out` when it didn't answer in time. */
|
|
683
|
+
reason: z6.enum(["api", "timed-out"]),
|
|
684
|
+
/** The HTTP status the Sandbox API answered; null when it answered none. */
|
|
685
|
+
status: z6.number().nullable(),
|
|
686
|
+
/** What failed, without any credential's value. */
|
|
687
|
+
message: z6.string()
|
|
688
|
+
})
|
|
689
|
+
]);
|
|
690
|
+
function listed(names) {
|
|
691
|
+
if (names.length <= 1) return names.join("");
|
|
692
|
+
return `${names.slice(0, -1).join(", ")} and ${names.at(-1) ?? ""}`;
|
|
693
|
+
}
|
|
694
|
+
function renderInvalidCredentials(problems, configFile) {
|
|
695
|
+
const hints = [...new Set(problems.map(({ hint }) => hint))];
|
|
696
|
+
return {
|
|
697
|
+
message: `runner.credentials${configFile === null ? "" : ` in ${configFile}`} names ${problems.length === 1 ? "a credential" : "credentials"} storm can't use. The run didn't start.`,
|
|
698
|
+
rows: [["Credentials", problems.map(({ detail }) => detail)]],
|
|
699
|
+
next: [
|
|
700
|
+
{ type: "text", text: hints.join(" ") },
|
|
701
|
+
{
|
|
702
|
+
type: "text",
|
|
703
|
+
text: "Or run on the launch machine with runner: launchMachine() (or --runner launch-machine for storm exec), which reads none of these credentials."
|
|
704
|
+
}
|
|
705
|
+
]
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
function renderInvalidSecretVariables(key, rowLabel, variables, minLength, configFile) {
|
|
709
|
+
const named = (problem) => variables.filter((variable) => variable.problem === problem).map(({ name }) => name);
|
|
710
|
+
const [missing, multiline, short] = [named("missing"), named("multiline"), named("short")];
|
|
711
|
+
return {
|
|
712
|
+
message: `${key}${configFile === null ? "" : ` in ${configFile}`} names ${variables.length === 1 ? "a variable" : "variables"} storm can't use. The run didn't start.`,
|
|
713
|
+
rows: [
|
|
714
|
+
[
|
|
715
|
+
rowLabel,
|
|
716
|
+
variables.map(
|
|
717
|
+
({ name, problem }) => problem === "missing" ? `${name} is not set` : problem === "multiline" ? `${name} holds a carriage return or a line feed` : `${name} holds fewer than ${minLength} characters`
|
|
718
|
+
)
|
|
719
|
+
]
|
|
720
|
+
],
|
|
721
|
+
next: [
|
|
722
|
+
{
|
|
723
|
+
type: "text",
|
|
724
|
+
text: [
|
|
725
|
+
...missing.length === 0 ? [] : [`Set ${listed(missing)} in this machine's environment.`],
|
|
726
|
+
...multiline.length === 0 ? [] : [
|
|
727
|
+
`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.`
|
|
728
|
+
],
|
|
729
|
+
...short.length === 0 ? [] : [`Set ${listed(short)} to the whole secret.`]
|
|
730
|
+
].join(" ")
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
type: "text",
|
|
734
|
+
text: "Or run on the launch machine with runner: launchMachine() (or --runner launch-machine for storm exec), which reads none of these variables."
|
|
735
|
+
}
|
|
736
|
+
]
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
function stepEnded(exitCode) {
|
|
740
|
+
return exitCode === null ? "ended without an exit code" : `exited ${exitCode}`;
|
|
741
|
+
}
|
|
742
|
+
function runnerFailureText(failure) {
|
|
743
|
+
switch (failure.kind) {
|
|
744
|
+
case "snapshot-build-step-failed":
|
|
745
|
+
return {
|
|
746
|
+
message: `The runner snapshot build's step "${failure.label}" ${stepEnded(failure.exitCode)}. The command didn't run.`,
|
|
747
|
+
next: "Fix the step in vercelSandbox({ \u2026 }), then retry. A failed build records no runner snapshot."
|
|
748
|
+
};
|
|
749
|
+
case "apply-failed":
|
|
750
|
+
return {
|
|
751
|
+
message: `Couldn't apply your changes in the runner sandbox: "${failure.label}" ${stepEnded(failure.exitCode)}. The command didn't run.`,
|
|
752
|
+
next: "Check the output for the file that didn't apply, then retry."
|
|
753
|
+
};
|
|
754
|
+
case "install-failed":
|
|
755
|
+
return {
|
|
756
|
+
message: `The runner's install, "${failure.label}", ${stepEnded(failure.exitCode)}. The command didn't run.`,
|
|
757
|
+
next: "Fix run.install in vercelSandbox({ \u2026 }), or what it installs, then retry."
|
|
758
|
+
};
|
|
759
|
+
case "build-failed":
|
|
760
|
+
return {
|
|
761
|
+
message: `The runner's build, "${failure.label}", ${stepEnded(failure.exitCode)}. The command didn't run.`,
|
|
762
|
+
next: "Fix the build, or run.build in vercelSandbox({ \u2026 }), then retry."
|
|
763
|
+
};
|
|
764
|
+
case "sandbox-api-failed":
|
|
765
|
+
return {
|
|
766
|
+
message: `A Vercel Sandbox call failed (${failure.operation}${failure.status === null ? "" : `, HTTP ${failure.status}`}): ${failure.message}. ${failure.operation === "run-command" ? "The command's outcome is unknown." : "The command didn't run."}`,
|
|
767
|
+
next: "Retry; if it keeps failing, check the Vercel Sandbox status and the project's Sandbox access."
|
|
768
|
+
};
|
|
769
|
+
case "checkout-failed":
|
|
770
|
+
return {
|
|
771
|
+
message: `git or tar failed on this machine: ${failure.message}. The command didn't run.`,
|
|
772
|
+
next: "Fix the checkout, then retry."
|
|
773
|
+
};
|
|
774
|
+
case "network-policy-failed": {
|
|
775
|
+
const detail = failure.status === null ? failure.message : `HTTP ${failure.status}: ${failure.message}`;
|
|
776
|
+
const next = "Retry; if it keeps failing, check the Vercel Sandbox status and the project's Sandbox access.";
|
|
777
|
+
if (failure.around === "command")
|
|
778
|
+
return {
|
|
779
|
+
message: `Couldn't give the command the credentials its resources give it, beside the runner's: writing the runner sandbox's network policy failed (${detail}). The command didn't run.`,
|
|
780
|
+
next
|
|
781
|
+
};
|
|
782
|
+
if (failure.operation === "remove")
|
|
783
|
+
return {
|
|
784
|
+
message: `Couldn't remove the runner's credentials from the sandbox's network policy before saving the runner snapshot (${detail}). storm stops and deletes the sandbox, and keeps neither it nor a runner snapshot of it. The command didn't run.`,
|
|
785
|
+
next
|
|
786
|
+
};
|
|
787
|
+
const steps = failure.around === "snapshot-steps" ? "the snapshot build's toolchain and prebuild steps" : "the install and build steps";
|
|
788
|
+
return {
|
|
789
|
+
message: `Couldn't give ${steps} the runner's credentials: writing the sandbox's network policy failed (${detail}). None of those steps ran, and the command didn't run.`,
|
|
790
|
+
next
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
case "credential-claims-missing":
|
|
794
|
+
return {
|
|
795
|
+
message: `The credential minted for project ${failure.project} on team ${failure.team} names no team and project ids (its owner_id and project_id claims), so the runner sandbox can't use it. The command didn't run.`,
|
|
796
|
+
next: "Mint for a Vercel project whose development OIDC tokens carry owner_id and project_id, then retry."
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
var ranSchema = z6.object({
|
|
801
|
+
/** storm's version. */
|
|
802
|
+
version: z6.string(),
|
|
803
|
+
/** The git commit storm was built from, as its version line shows it (`3f2a9c1b7d4e`, `-dirty` appended when built from a tree with uncommitted changes); null when unknown. */
|
|
804
|
+
commit: z6.string().nullable(),
|
|
805
|
+
/** The config file the run's settings came from (its absolute path); null when none applied. */
|
|
806
|
+
configFile: z6.string().nullable(),
|
|
807
|
+
/**
|
|
808
|
+
* What each acquired resource instance that reports something says of itself, keyed by resource key: its
|
|
809
|
+
* definition's name (`definition`), its facts (`facts`, what its acquire answered, unknown to the schema, or null
|
|
810
|
+
* when it answered none) and the warnings its acquire reported (`warnings`).
|
|
811
|
+
*/
|
|
812
|
+
resources: DEFINITION_SET.reports.ranSchema,
|
|
813
|
+
/**
|
|
814
|
+
* What the run's cleanup left: the runner sandbox it kept running and the runner's sandboxes it couldn't stop or
|
|
815
|
+
* delete (`runner`, null without a runner sandbox), and what releasing each of its resource instances couldn't do,
|
|
816
|
+
* its warnings, keyed by resource key, each with its definition's name (`resources`, `{}` when it took none).
|
|
817
|
+
*/
|
|
818
|
+
cleanup: RUN_CLEANUP.schema,
|
|
819
|
+
/**
|
|
820
|
+
* How the command ended: its exit code, or the signal that ended it; both null for a command in the runner sandbox
|
|
821
|
+
* that ended without an exit code.
|
|
822
|
+
*/
|
|
823
|
+
command: z6.object({ exitCode: z6.number().nullable(), signal: z6.string().nullable() }),
|
|
824
|
+
/** The runner sandbox the command ran in; null without one. */
|
|
825
|
+
runner: z6.object({
|
|
826
|
+
/** The runner snapshot it started from. */
|
|
827
|
+
snapshotId: z6.string(),
|
|
828
|
+
/** The runner snapshot's base, a full SHA: the commit it was built at. */
|
|
829
|
+
base: z6.string(),
|
|
830
|
+
/** How many commits HEAD has that the snapshot's base lacks, 0 for a snapshot built at HEAD's commit. */
|
|
831
|
+
builtBehind: z6.number(),
|
|
832
|
+
/** How many bytes of changes the run uploaded on top of the snapshot's base. */
|
|
833
|
+
uploadBytes: z6.number(),
|
|
834
|
+
/** Whether this run built the runner snapshot. */
|
|
835
|
+
built: z6.boolean(),
|
|
836
|
+
vcpus: z6.number(),
|
|
837
|
+
region: z6.string(),
|
|
838
|
+
image: z6.string(),
|
|
839
|
+
/** How long the build step took, in milliseconds. */
|
|
840
|
+
buildMs: z6.number()
|
|
841
|
+
}).nullable(),
|
|
842
|
+
/** The run's waterfall, as the run directory's timeline.json holds it: each lane's label, span and steps in milliseconds since the run started, how they ended, idle time, and the critical path. */
|
|
843
|
+
timeline: timelineSchema,
|
|
844
|
+
/** The run's run directory's run id, which `storm runs show` takes; null when the run couldn't make one. */
|
|
845
|
+
runId: z6.string().nullable()
|
|
846
|
+
});
|
|
847
|
+
var RAN_DESCRIPTION = "The command ran and ended. storm exits with its code, or 128 + n when signal n ended it, whatever this result's exit code.";
|
|
848
|
+
function renderRan(ran, noFinal) {
|
|
849
|
+
const noFinalContent = noFinal === void 0 ? { warnings: [], next: [] } : noFinalResultsContent(noFinal.noFinalTestResults, noFinal.hints);
|
|
850
|
+
const warnings = [
|
|
851
|
+
...DEFINITION_SET.reports.ranWarnings(ran.resources),
|
|
852
|
+
...ran.runner !== null && ran.command.exitCode === null && ran.command.signal === null ? [
|
|
853
|
+
{
|
|
854
|
+
reason: "sandboxed_no_exit_code",
|
|
855
|
+
message: "The command ended in the runner sandbox without an exit code, so storm exits 1."
|
|
856
|
+
}
|
|
857
|
+
] : [],
|
|
858
|
+
...runnerCleanupWarnings(ran.cleanup.runner),
|
|
859
|
+
...DEFINITION_SET.reports.cleanupWarnings(ran.cleanup.resources),
|
|
860
|
+
...noFinalContent.warnings
|
|
861
|
+
];
|
|
862
|
+
const kept = ran.cleanup.runner?.kept ?? null;
|
|
863
|
+
return renderOutcome({
|
|
864
|
+
...kept === null ? {} : { message: keptText(kept) },
|
|
865
|
+
...warnings.length === 0 ? {} : { warnings },
|
|
866
|
+
...noFinalContent.next.length === 0 ? {} : { next: [...noFinalContent.next] }
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
var runErrors = defineErrors({
|
|
870
|
+
conflictingOptions: {
|
|
871
|
+
exitCode: 2,
|
|
872
|
+
description: "A run flag doesn't fit the effective runner: --show-output and --keep-sandbox fit the Vercel Sandbox runner, and --credential github-actions fits the launch machine runner.",
|
|
873
|
+
schema: z6.object({
|
|
874
|
+
/** Each conflicting flag, as typed, and why it doesn't fit. */
|
|
875
|
+
conflicts: z6.array(z6.object({ flag: z6.string(), message: z6.string() })),
|
|
876
|
+
/** The effective runner kind for the run: `launch-machine` or `vercel-sandbox`. */
|
|
877
|
+
runner: z6.enum(["launch-machine", "vercel-sandbox"]),
|
|
878
|
+
/** The selected suite's name, or null when no suite was selected. */
|
|
879
|
+
suite: z6.string().nullable(),
|
|
880
|
+
/** The config file that applied; null when none did. */
|
|
881
|
+
configFile: z6.string().nullable()
|
|
882
|
+
}),
|
|
883
|
+
render: ({ conflicts, runner, suite }) => ({
|
|
884
|
+
message: conflicts.map(({ message }) => message).join(" "),
|
|
885
|
+
rows: [
|
|
886
|
+
["Conflicts", conflicts.map(({ flag }) => flag)],
|
|
887
|
+
["Runner", runner],
|
|
888
|
+
...suite === null ? [] : [["Suite", suite]]
|
|
889
|
+
],
|
|
890
|
+
next: [
|
|
891
|
+
{
|
|
892
|
+
type: "text",
|
|
893
|
+
text: runner === "launch-machine" ? `Drop ${listed(conflicts.map(({ flag }) => flag))}, or run with a vercelSandbox({ \u2026 }) runner.` : `Drop ${listed(conflicts.map(({ flag }) => flag))}, or run on the launch machine with launchMachine() (or --runner launch-machine for storm exec).`
|
|
894
|
+
}
|
|
895
|
+
]
|
|
896
|
+
})
|
|
897
|
+
},
|
|
898
|
+
credentialUnused: {
|
|
899
|
+
exitCode: 2,
|
|
900
|
+
description: "--credential was given to a launch machine run with no resource that takes a credential.",
|
|
901
|
+
schema: z6.object({
|
|
902
|
+
/** The flags given that none of the run's resources takes, as typed, such as --credential. */
|
|
903
|
+
flags: z6.array(z6.string()),
|
|
904
|
+
/** The config file that applied; null when none did. */
|
|
905
|
+
configFile: z6.string().nullable()
|
|
906
|
+
}),
|
|
907
|
+
render: ({ flags }) => ({
|
|
908
|
+
message: `${flags.join(", ")} ${flags.length === 1 ? "applies" : "apply"} only to a run with a resource that takes a credential, and this run has none.`,
|
|
909
|
+
next: [
|
|
910
|
+
{
|
|
911
|
+
type: "text",
|
|
912
|
+
text: `Drop ${flags.join(" and ")}, or give the run a resource that takes a credential, in storm.config.ts or on the command line.`
|
|
913
|
+
}
|
|
914
|
+
]
|
|
915
|
+
})
|
|
916
|
+
},
|
|
917
|
+
resourceNeedsRunnerSandbox: {
|
|
918
|
+
exitCode: 2,
|
|
919
|
+
description: "A run on the launch machine uses a resource that needs a runner sandbox, such as one that gives the command a sandbox credential the runner sandbox's firewall adds, so the run didn't start: it minted, acquired, and started nothing.",
|
|
920
|
+
schema: z6.object({
|
|
921
|
+
/** The keys of the resources that need a runner sandbox, as storm.config.ts names them, in the run's order. */
|
|
922
|
+
resources: z6.array(z6.string()),
|
|
923
|
+
/** The config file that applied; null when none did. */
|
|
924
|
+
configFile: z6.string().nullable()
|
|
925
|
+
}),
|
|
926
|
+
render: ({ resources }) => ({
|
|
927
|
+
message: `${listed(resources.map((key) => `resources.${key}`))} ${resources.length === 1 ? "needs" : "need"} a runner sandbox, and this run uses the launch machine runner, with no firewall to add the sandbox credentials ${resources.length === 1 ? "it gives" : "they give"} the command. The run didn't start.`,
|
|
928
|
+
next: [
|
|
929
|
+
{
|
|
930
|
+
type: "text",
|
|
931
|
+
text: "Use runner: vercelSandbox({ \u2026 }) in storm.config.ts (without --runner launch-machine), or run without the resource."
|
|
932
|
+
}
|
|
933
|
+
]
|
|
934
|
+
})
|
|
935
|
+
},
|
|
936
|
+
missingRunner: {
|
|
937
|
+
exitCode: 2,
|
|
938
|
+
description: "No runner is declared: neither storm.config.ts (nor the selected suite) declares runner with vercelSandbox({ \u2026 }) or launchMachine(), and --runner launch-machine wasn't passed.",
|
|
939
|
+
schema: z6.object({
|
|
940
|
+
/** The config file that applied; null when none did. */
|
|
941
|
+
configFile: z6.string().nullable()
|
|
942
|
+
}),
|
|
943
|
+
render: ({ configFile }) => ({
|
|
944
|
+
message: configFile === null ? `No runner is declared, and no ${CONFIG_FILE_NAMES_TEXT} applies.` : `No runner is declared in ${configFile}.`,
|
|
945
|
+
next: [
|
|
946
|
+
{
|
|
947
|
+
type: "text",
|
|
948
|
+
text: "Add runner: vercelSandbox({ \u2026 }) or runner: launchMachine() to storm.config.ts (or to a suite under suites)."
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
type: "text",
|
|
952
|
+
text: "Or, for storm exec, pass --runner launch-machine to run on the launch machine."
|
|
953
|
+
}
|
|
954
|
+
]
|
|
955
|
+
})
|
|
956
|
+
},
|
|
957
|
+
credentialsInvalid: {
|
|
958
|
+
exitCode: 2,
|
|
959
|
+
description: "With the Vercel Sandbox runner, one or more sandbox credentials declared by credentials in vercelSandbox({ \u2026 }) can't be read or used on this machine, so the run didn't start: it minted, acquired, and created nothing. Each problem names the credential source, a machine-readable problem code, a human-readable detail, and an actionable next step without revealing any secret value or file contents.",
|
|
960
|
+
schema: z6.object({
|
|
961
|
+
/** Each credential source storm can't use and why, in the order the runner options first name it. */
|
|
962
|
+
problems: z6.array(
|
|
963
|
+
z6.object({
|
|
964
|
+
name: z6.string(),
|
|
965
|
+
problem: z6.enum(CREDENTIAL_PROBLEM_KINDS),
|
|
966
|
+
detail: z6.string(),
|
|
967
|
+
hint: z6.string()
|
|
968
|
+
})
|
|
969
|
+
),
|
|
970
|
+
/** The fewest characters a credential's value may have. */
|
|
971
|
+
minLength: z6.number(),
|
|
972
|
+
/** The config file that gave the Vercel Sandbox runner options. */
|
|
973
|
+
configFile: z6.string().nullable()
|
|
974
|
+
}),
|
|
975
|
+
render: ({ problems, configFile }) => renderInvalidCredentials(problems, configFile)
|
|
976
|
+
},
|
|
977
|
+
keepSandboxUnsafeSecretEnvVars: {
|
|
978
|
+
exitCode: 2,
|
|
979
|
+
description: "With the Vercel Sandbox runner, --keep-sandbox asked to keep the runner sandbox for a runner whose unsafeSecretEnvVars passes secrets into the command's environment, so the run didn't start: it minted, acquired, and created nothing. Anyone who can update the Vercel project can connect to a kept runner sandbox and read what the command wrote.",
|
|
980
|
+
schema: z6.object({
|
|
981
|
+
/** The environment variable names the runner's unsafeSecretEnvVars exposes to the command, in the runner options' order. */
|
|
982
|
+
variables: z6.array(z6.string()),
|
|
983
|
+
/** The config file that gave the Vercel Sandbox runner options. */
|
|
984
|
+
configFile: z6.string().nullable()
|
|
985
|
+
}),
|
|
986
|
+
render: ({ variables, configFile }) => ({
|
|
987
|
+
message: `Can't keep the runner sandbox when runner.unsafeSecretEnvVars${configFile === null ? "" : ` in ${configFile}`} is set (${listed(variables)}). Anyone who can update the Vercel project can connect to a kept runner sandbox and read what the command wrote. The run didn't start.`,
|
|
988
|
+
next: [
|
|
989
|
+
{
|
|
990
|
+
type: "text",
|
|
991
|
+
text: "Drop --keep-sandbox, or pass --keep-sandbox 0, so the runner sandbox stops and deletes."
|
|
992
|
+
},
|
|
993
|
+
{
|
|
994
|
+
type: "text",
|
|
995
|
+
text: "Or, when the secret travels as an HTTPS header, declare it under runner.credentials (a sandbox credential) instead of runner.unsafeSecretEnvVars."
|
|
996
|
+
}
|
|
997
|
+
]
|
|
998
|
+
})
|
|
999
|
+
},
|
|
1000
|
+
keepSandboxManagedCredentials: {
|
|
1001
|
+
exitCode: 2,
|
|
1002
|
+
description: "With the Vercel Sandbox runner, --keep-sandbox asked to keep the runner sandbox for a runner whose managedCredentials asks Vercel Sandbox to inject managed credentials, so the run didn't start: it minted, acquired, and created nothing. Vercel Sandbox rejects deny-all on a sandbox with managed credentials, so storm cannot fence it before keeping it running.",
|
|
1003
|
+
schema: z6.object({
|
|
1004
|
+
/** The Vercel-managed credential providers the runner declares, in the runner options' order. */
|
|
1005
|
+
providers: z6.array(z6.string()),
|
|
1006
|
+
/** The config file that gave the Vercel Sandbox runner options. */
|
|
1007
|
+
configFile: z6.string().nullable()
|
|
1008
|
+
}),
|
|
1009
|
+
render: ({ providers, configFile }) => ({
|
|
1010
|
+
message: `Can't keep the runner sandbox when runner.managedCredentials${configFile === null ? "" : ` in ${configFile}`} is set (${listed(providers)}). Vercel Sandbox rejects deny-all on a sandbox with managed credentials, so storm cannot fence a kept runner sandbox. The run didn't start.`,
|
|
1011
|
+
next: [
|
|
1012
|
+
{
|
|
1013
|
+
type: "text",
|
|
1014
|
+
text: "Drop --keep-sandbox, or pass --keep-sandbox 0, so the runner sandbox stops and deletes."
|
|
1015
|
+
}
|
|
1016
|
+
]
|
|
1017
|
+
})
|
|
1018
|
+
},
|
|
1019
|
+
unsafeSecretEnvVarsInvalid: {
|
|
1020
|
+
exitCode: 2,
|
|
1021
|
+
description: `With the Vercel Sandbox runner, launcher environment variables named by unsafeSecretEnvVars in vercelSandbox({ \u2026 }) (source: { kind: "env", name }) can't be used, so the run didn't start: it minted, acquired, 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.`,
|
|
1022
|
+
schema: z6.object({
|
|
1023
|
+
/** Each variable storm can't use and why, once, in the order the runner options first name it. */
|
|
1024
|
+
variables: z6.array(z6.object({ name: z6.string(), problem: z6.enum(["missing", "multiline", "short"]) })),
|
|
1025
|
+
/** The fewest characters an unsafe secret environment variable's value may have. */
|
|
1026
|
+
minLength: z6.number(),
|
|
1027
|
+
/** The config file that gave the Vercel Sandbox runner options. */
|
|
1028
|
+
configFile: z6.string().nullable()
|
|
1029
|
+
}),
|
|
1030
|
+
render: ({ variables, minLength, configFile }) => renderInvalidSecretVariables(
|
|
1031
|
+
"runner.unsafeSecretEnvVars",
|
|
1032
|
+
"Unsafe secret environment variables",
|
|
1033
|
+
variables,
|
|
1034
|
+
minLength,
|
|
1035
|
+
configFile
|
|
1036
|
+
)
|
|
1037
|
+
},
|
|
1038
|
+
noBaseRef: {
|
|
1039
|
+
exitCode: 1,
|
|
1040
|
+
description: "With the Vercel Sandbox runner, none of the runner's baseRefs exists locally and shares history with HEAD, so there is no base. storm never fetches.",
|
|
1041
|
+
schema: z6.object({
|
|
1042
|
+
/** Each ref in baseRefs, and why it gave no base. */
|
|
1043
|
+
refs: z6.array(z6.object({ ref: z6.string(), reason: z6.enum(["missing", "unrelated"]) }))
|
|
1044
|
+
}),
|
|
1045
|
+
render: ({ refs }) => ({
|
|
1046
|
+
message: `No base for the runner: none of ${refs.map(({ ref }) => ref).join(", ")} exists locally and shares history with HEAD. The command didn't run.`,
|
|
1047
|
+
rows: [
|
|
1048
|
+
[
|
|
1049
|
+
"Base refs",
|
|
1050
|
+
refs.map(
|
|
1051
|
+
({ ref, reason }) => reason === "missing" ? `${ref}: no such local ref` : `${ref}: shares no history with HEAD`
|
|
1052
|
+
)
|
|
1053
|
+
]
|
|
1054
|
+
],
|
|
1055
|
+
next: [
|
|
1056
|
+
{
|
|
1057
|
+
type: "text",
|
|
1058
|
+
text: refs.some(({ ref }) => ref === "main" || ref === "origin/main") ? "Run git fetch origin main, then retry." : `Fetch or create one of ${refs.map(({ ref }) => ref).join(", ")}, then retry.`
|
|
1059
|
+
}
|
|
1060
|
+
]
|
|
1061
|
+
})
|
|
1062
|
+
},
|
|
1063
|
+
submodulesRefused: {
|
|
1064
|
+
exitCode: 1,
|
|
1065
|
+
description: "With the Vercel Sandbox runner, the checkout has Git submodules, which neither the upload nor the base's files carry.",
|
|
1066
|
+
schema: z6.object({ paths: z6.array(z6.string()) }),
|
|
1067
|
+
render: ({ paths }) => ({
|
|
1068
|
+
message: `The checkout has Git submodules, which the runner can't carry: ${paths.join(", ")}. The command didn't run.`,
|
|
1069
|
+
next: [
|
|
1070
|
+
{
|
|
1071
|
+
type: "text",
|
|
1072
|
+
text: "Run on the launch machine with runner: launchMachine() (or --runner launch-machine for storm exec)."
|
|
1073
|
+
}
|
|
1074
|
+
]
|
|
1075
|
+
})
|
|
1076
|
+
},
|
|
1077
|
+
snapshotGone: {
|
|
1078
|
+
exitCode: 1,
|
|
1079
|
+
description: "With the Vercel Sandbox runner, the runner snapshot the run picked was gone (the Sandbox API answered 410), so its local snapshot index entry was removed and the command didn't run. The next run picks another runner snapshot or builds one.",
|
|
1080
|
+
schema: z6.object({
|
|
1081
|
+
snapshotId: z6.string(),
|
|
1082
|
+
/** The runner snapshot's base, a full SHA. */
|
|
1083
|
+
base: z6.string(),
|
|
1084
|
+
/** Why its local snapshot index entry couldn't be removed; null when it was. */
|
|
1085
|
+
removal: z6.object({ path: z6.string(), message: z6.string() }).nullable(),
|
|
1086
|
+
/** What the run couldn't clean up. */
|
|
1087
|
+
cleanup: RUN_CLEANUP.schema
|
|
1088
|
+
}),
|
|
1089
|
+
render: ({ snapshotId, removal, cleanup }) => {
|
|
1090
|
+
const rows = RUN_CLEANUP.rows(cleanup);
|
|
1091
|
+
return {
|
|
1092
|
+
message: `Runner snapshot ${snapshotId} is gone, before its local snapshot index entry said it expires. ${removal === null ? "Removed its local snapshot index entry." : `Couldn't remove its local snapshot index entry at ${removal.path}: ${removal.message}.`} The command didn't run.`,
|
|
1093
|
+
...rows.length === 0 ? {} : { rows },
|
|
1094
|
+
next: [
|
|
1095
|
+
{
|
|
1096
|
+
type: "text",
|
|
1097
|
+
text: removal === null ? "Run again: the next run picks another runner snapshot or builds one." : `Remove ${removal.path}, then run again.`
|
|
1098
|
+
}
|
|
1099
|
+
]
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
},
|
|
1103
|
+
runnerFailed: {
|
|
1104
|
+
exitCode: 1,
|
|
1105
|
+
description: "With the Vercel Sandbox runner, the runner couldn't run the command: a snapshot build step, applying the changes, the install, or the build failed (with the step's last 40 output lines), a Vercel Sandbox call failed, a network policy write that puts the runner steps' credentials in place or removes them failed, git or tar failed on this machine, or the credential names no team and project ids.",
|
|
1106
|
+
schema: z6.object({
|
|
1107
|
+
failure: runnerFailureSchema,
|
|
1108
|
+
/** What the run couldn't clean up; its `runner` is null when the run failed before it started a sandbox. */
|
|
1109
|
+
cleanup: RUN_CLEANUP.schema
|
|
1110
|
+
}),
|
|
1111
|
+
render: ({ failure, cleanup }) => {
|
|
1112
|
+
const { message, next } = runnerFailureText(failure);
|
|
1113
|
+
const rows = [
|
|
1114
|
+
..."tail" in failure && failure.tail.length > 0 ? [["Last output", failure.tail]] : [],
|
|
1115
|
+
...failure.kind === "checkout-failed" && failure.command !== null ? [["Command", failure.command]] : [],
|
|
1116
|
+
...RUN_CLEANUP.rows(cleanup)
|
|
1117
|
+
];
|
|
1118
|
+
return { message, ...rows.length === 0 ? {} : { rows }, next: [{ type: "text", text: next }] };
|
|
1119
|
+
}
|
|
1120
|
+
},
|
|
1121
|
+
spawnFailed: {
|
|
1122
|
+
exitCode: 1,
|
|
1123
|
+
description: "The command couldn't start.",
|
|
1124
|
+
schema: z6.object({
|
|
1125
|
+
/** The command's first argument: what storm tried to run. */
|
|
1126
|
+
executable: z6.string(),
|
|
1127
|
+
/** What the OS said. */
|
|
1128
|
+
message: z6.string(),
|
|
1129
|
+
/**
|
|
1130
|
+
* What the run couldn't clean up; its `runner` is null, since only a run without a runner sandbox spawns its
|
|
1131
|
+
* command here.
|
|
1132
|
+
*/
|
|
1133
|
+
cleanup: RUN_CLEANUP.schema
|
|
1134
|
+
}),
|
|
1135
|
+
render: ({ executable, message, cleanup }) => {
|
|
1136
|
+
const rows = RUN_CLEANUP.rows(cleanup);
|
|
1137
|
+
return {
|
|
1138
|
+
message: `Couldn't start the command ${executable}: ${message}`,
|
|
1139
|
+
...rows.length === 0 ? {} : { rows },
|
|
1140
|
+
next: [
|
|
1141
|
+
{ type: "text", text: "Check the command after --; it runs with no shell, as the argument list given." }
|
|
1142
|
+
]
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
var RUN_ERRORS = {
|
|
1148
|
+
...configErrors,
|
|
1149
|
+
...credentialErrors,
|
|
1150
|
+
// A resource's refusal, before the run starts or while it acquires.
|
|
1151
|
+
...resourceRefusalErrors,
|
|
1152
|
+
...mintFailedErrors,
|
|
1153
|
+
...runErrors
|
|
1154
|
+
};
|
|
1155
|
+
var outcomes = defineOutcomes({
|
|
1156
|
+
results: {
|
|
1157
|
+
ran: { schema: ranSchema, description: RAN_DESCRIPTION, render: (ran) => renderRan(ran) },
|
|
1158
|
+
sandboxesRan: {
|
|
1159
|
+
schema: sandboxesRanSchema,
|
|
1160
|
+
description: SANDBOXES_RAN_DESCRIPTION,
|
|
1161
|
+
render: (ran) => renderSandboxesRan(ran)
|
|
1162
|
+
},
|
|
1163
|
+
planned: { schema: plannedSchema, description: PLANNED_DESCRIPTION, render: renderPlanned }
|
|
1164
|
+
},
|
|
1165
|
+
errors: { ...RUN_ERRORS, ...sandboxesErrors }
|
|
1166
|
+
});
|
|
1167
|
+
function canceledBeforeStart() {
|
|
1168
|
+
return outcomes.canceled({ changed: "The command didn't run.\nNothing was minted, acquired or started." });
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
// src/commands/exec/runner-refusals.ts
|
|
1172
|
+
var NOTHING_RELEASED = { runnerCleanup: null, resourceCleanup: {} };
|
|
1173
|
+
function prepareRefusal(prepared, configFile) {
|
|
1174
|
+
switch (prepared.kind) {
|
|
1175
|
+
case "no-base-ref":
|
|
1176
|
+
return runErrors.noBaseRef({ refs: prepared.refs.map(({ ref, reason }) => ({ ref, reason })) });
|
|
1177
|
+
case "submodules":
|
|
1178
|
+
return runErrors.submodulesRefused({ paths: [...prepared.paths] });
|
|
1179
|
+
case "invalid-runner":
|
|
1180
|
+
return invalidConfig(configFile ?? "", [
|
|
1181
|
+
{ key: ["runner", ...prepared.path].join("."), location: null, problem: prepared.problem }
|
|
1182
|
+
]);
|
|
1183
|
+
case "checkout-failed":
|
|
1184
|
+
return checkoutFailedRefusal(prepared.failure);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
function checkoutFailedRefusal(failure) {
|
|
1188
|
+
return runErrors.runnerFailed({
|
|
1189
|
+
failure: runnerFailureFacts({ kind: "checkout-failed", failure }),
|
|
1190
|
+
cleanup: RUN_CLEANUP.facts(NOTHING_RELEASED)
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
function vcpuResources(requests) {
|
|
1194
|
+
return Object.fromEntries(
|
|
1195
|
+
Object.entries(requests).map(([key, { options }]) => {
|
|
1196
|
+
if (typeof options !== "object" || options === null) throw new Error(`${key}'s options are not an object`);
|
|
1197
|
+
return [key, options];
|
|
1198
|
+
})
|
|
1199
|
+
);
|
|
1200
|
+
}
|
|
1201
|
+
function runnerFailureFacts(failure) {
|
|
1202
|
+
switch (failure.kind) {
|
|
1203
|
+
case "snapshot-build-step-failed":
|
|
1204
|
+
case "apply-failed":
|
|
1205
|
+
case "install-failed":
|
|
1206
|
+
case "build-failed":
|
|
1207
|
+
return { kind: failure.kind, label: failure.label, exitCode: failure.exitCode, tail: [...failure.tail] };
|
|
1208
|
+
case "sandbox-api-failed":
|
|
1209
|
+
return { kind: failure.kind, operation: failure.operation, status: failure.status, message: failure.message };
|
|
1210
|
+
case "checkout-failed":
|
|
1211
|
+
return { kind: failure.kind, message: failure.failure.message, command: failure.failure.displayCommand ?? null };
|
|
1212
|
+
case "network-policy-failed":
|
|
1213
|
+
return {
|
|
1214
|
+
kind: failure.kind,
|
|
1215
|
+
operation: failure.operation,
|
|
1216
|
+
around: failure.around,
|
|
1217
|
+
reason: failure.reason,
|
|
1218
|
+
status: failure.status,
|
|
1219
|
+
message: failure.message
|
|
1220
|
+
};
|
|
1221
|
+
case "credential-claims-missing":
|
|
1222
|
+
return { kind: failure.kind, ...failure.target };
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
export {
|
|
1227
|
+
lacksFinalResults,
|
|
1228
|
+
plannedSchema,
|
|
1229
|
+
plannedSecrets,
|
|
1230
|
+
buildPlannedFacts,
|
|
1231
|
+
notStoppedText,
|
|
1232
|
+
notDeletedText,
|
|
1233
|
+
keptText,
|
|
1234
|
+
notKeptText,
|
|
1235
|
+
RUN_CLEANUP,
|
|
1236
|
+
mintFailedErrors,
|
|
1237
|
+
PLANNED_DESCRIPTION,
|
|
1238
|
+
renderPlanned,
|
|
1239
|
+
resourceRefusedBeforeRun,
|
|
1240
|
+
resourceRefused,
|
|
1241
|
+
readFileListsFile,
|
|
1242
|
+
resolveCallerFileLists,
|
|
1243
|
+
sandboxesRanSchema,
|
|
1244
|
+
SANDBOXES_RAN_DESCRIPTION,
|
|
1245
|
+
renderSandboxesRan,
|
|
1246
|
+
sandboxesErrors,
|
|
1247
|
+
sandboxesDefaultErrors,
|
|
1248
|
+
fileListErrors,
|
|
1249
|
+
ranSchema,
|
|
1250
|
+
RAN_DESCRIPTION,
|
|
1251
|
+
renderRan,
|
|
1252
|
+
runErrors,
|
|
1253
|
+
RUN_ERRORS,
|
|
1254
|
+
outcomes,
|
|
1255
|
+
canceledBeforeStart,
|
|
1256
|
+
prepareRefusal,
|
|
1257
|
+
checkoutFailedRefusal,
|
|
1258
|
+
vcpuResources,
|
|
1259
|
+
runnerFailureFacts
|
|
1260
|
+
};
|