@cnc-tools/storm 0.15.0 → 0.17.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/application.d.ts +22 -13
- package/dist/application.js +21 -10
- package/dist/bin/run.d.ts +18 -0
- package/dist/bin/run.js +31 -0
- package/dist/bin/storm.js +42 -26
- package/dist/build-info.js +1 -1
- package/dist/chunks/{chunk-5CCP36QQ.js → chunk-2RNDPDTJ.js} +2 -2
- package/dist/chunks/chunk-2VP4GRJM.js +1219 -0
- package/dist/chunks/{chunk-SZEURWRS.js → chunk-4O5C2XGJ.js} +18 -15
- package/dist/chunks/{chunk-VL7WFTVQ.js → chunk-4WAMTUWZ.js} +419 -340
- package/dist/chunks/{chunk-QVS7HRU7.js → chunk-6UHIJXZG.js} +3 -3
- package/dist/chunks/{chunk-CN4EFA5J.js → chunk-72ZFEMAW.js} +1 -1
- package/dist/chunks/{chunk-4U4DZ7VG.js → chunk-7DZE67QM.js} +2 -2
- package/dist/chunks/{chunk-VUPZH7J2.js → chunk-BCBKYOHW.js} +1 -1
- package/dist/chunks/{chunk-QUHY6FGN.js → chunk-CKGZA25H.js} +1 -18
- package/dist/chunks/{chunk-ZG3WQ4UF.js → chunk-D27KILIA.js} +1 -1
- package/dist/chunks/{chunk-KC4KDJ5K.js → chunk-DADEYJDW.js} +174 -153
- package/dist/chunks/{chunk-R7XVBZOY.js → chunk-EEENLQHE.js} +59 -11
- package/dist/chunks/chunk-F4MOYHRY.js +198 -0
- package/dist/chunks/{chunk-CXAT7ZKP.js → chunk-FNBB6V4R.js} +1 -1
- package/dist/chunks/{chunk-OX7X4B2L.js → chunk-GRT3UIBV.js} +18 -1
- package/dist/chunks/chunk-HP3CURSZ.js +88 -0
- package/dist/chunks/{chunk-PN5ULTTH.js → chunk-HWIQ2S7K.js} +5 -5
- package/dist/chunks/chunk-JN3YY6ZH.js +2166 -0
- package/dist/chunks/{chunk-TJNFVNKR.js → chunk-LKTZ5OXS.js} +1 -1
- package/dist/chunks/{chunk-XEVHP5ZW.js → chunk-M7EKRGVD.js} +8 -8
- package/dist/chunks/chunk-MR77L2GK.js +340 -0
- package/dist/chunks/{chunk-L36GBUBB.js → chunk-RNAS7JHE.js} +1755 -522
- package/dist/chunks/{chunk-5GBMR4HM.js → chunk-RWIXDDCK.js} +4 -192
- package/dist/chunks/{chunk-5VXBKPW6.js → chunk-WV3DP6NR.js} +1 -1
- package/dist/chunks/{chunk-AWBSONHB.js → chunk-XBDRVFEV.js} +55 -16
- package/dist/chunks/{chunk-YV7GE6EV.js → chunk-YEPFSLQR.js} +480 -375
- package/dist/chunks/{live-app-PI3BAN6Y.js → live-app-R76JQXZL.js} +15 -13
- package/dist/commands/exec/across-sandboxes-outcomes.d.ts +1 -1
- package/dist/commands/exec/across-sandboxes-outcomes.js +4 -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 +39 -4
- 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 +38 -9
- package/dist/commands/exec/outcomes.js +32 -25
- package/dist/commands/exec/plan-run.d.ts +58 -150
- package/dist/commands/exec/plan-run.js +232 -88
- package/dist/commands/exec/planned-outcome.js +8 -1
- 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 +5 -5
- 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 +9 -4
- package/dist/commands/runs/facts.js +28 -11
- package/dist/commands/runs/list/command.d.ts +16 -6
- package/dist/commands/runs/list/command.js +10 -10
- package/dist/commands/runs/list/outcomes.d.ts +8 -3
- package/dist/commands/runs/logs/command.d.ts +6 -2
- package/dist/commands/runs/logs/command.js +10 -10
- package/dist/commands/runs/logs/outcomes.d.ts +3 -1
- package/dist/commands/runs/past-run.d.ts +14 -5
- package/dist/commands/runs/past-run.js +16 -5
- package/dist/commands/runs/show/command.d.ts +20 -8
- package/dist/commands/runs/show/command.js +30 -28
- package/dist/commands/runs/show/outcomes.d.ts +10 -4
- package/dist/commands/runs/show/outcomes.js +7 -5
- 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 +360 -93
- package/dist/commands/snapshots/build/command.js +446 -150
- 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 +234 -43
- 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 +296 -66
- 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 +245 -13
- package/dist/commands/snapshots/list/outcomes.js +221 -50
- 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 +19 -18
- package/dist/commands/suites/list/outcomes.js +4 -4
- package/dist/commands/test/command.d.ts +39 -4
- package/dist/commands/test/command.js +50 -255
- package/dist/commands/test/metadata.js +1 -1
- package/dist/commands/test/outcomes.d.ts +19 -2
- package/dist/commands/test/outcomes.js +2 -2
- package/dist/config/check-runner.d.ts +5 -3
- package/dist/config/check-runner.js +33 -7
- package/dist/config/check-suites.js +1 -0
- 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/gateways.d.ts +7 -3
- package/dist/config/index.d.ts +4 -5
- package/dist/config/index.js +3 -4
- package/dist/config/live/config-gateway.js +5 -2
- package/dist/config/load.d.ts +21 -4
- package/dist/config/load.js +129 -15
- package/dist/config/runner.d.ts +7 -8
- package/dist/config/runner.js +1 -1
- package/dist/config/schema.d.ts +17 -5
- package/dist/config/schema.js +11 -3
- package/dist/config/typed-options.d.ts +1 -6
- package/dist/config/typed-options.js +2 -10
- package/dist/config-file/define.d.ts +1 -11
- package/dist/config-file/define.js +3 -3
- package/dist/config-file/runner.d.ts +5 -6
- package/dist/config-file/toolchain.d.ts +13 -7
- package/dist/config-file/toolchain.js +53 -37
- package/dist/context.d.ts +8 -6
- package/dist/context.js +7 -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 +106 -266
- 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 +6 -1
- package/dist/extension-commands.js +15 -1
- package/dist/extensions/github/resource.d.ts +1 -1
- package/dist/extensions/github/resource.js +1 -1
- 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 +2 -2
- package/dist/extensions/testserver/resource.js +2 -2
- 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 +7 -15
- package/dist/planning/plan-only.js +16 -22
- package/dist/planning/run-kind-flags.js +2 -2
- package/dist/planning/run-plan.d.ts +45 -13
- 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 +10 -2
- package/dist/run-directory/recording.js +2 -2
- package/dist/run-directory/run-record.d.ts +21 -6
- package/dist/run-directory/run-record.js +12 -9
- package/dist/runner/base.d.ts +0 -6
- package/dist/runner/base.js +1 -16
- package/dist/runner/build-snapshots.d.ts +55 -29
- package/dist/runner/build-snapshots.js +135 -35
- 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 +92 -21
- package/dist/runner/gateways.js +1 -1
- package/dist/runner/index.d.ts +11 -7
- package/dist/runner/index.js +9 -4
- 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 +141 -3
- 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 +6 -7
- package/dist/runner/local-snapshot-index.d.ts +199 -0
- package/dist/runner/local-snapshot-index.js +211 -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 +25 -24
- package/dist/runner/prepare.js +28 -20
- package/dist/runner/ready.d.ts +18 -10
- 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 +10 -6
- package/dist/runner/scope.js +10 -3
- package/dist/runner/secrets.d.ts +13 -13
- package/dist/runner/secrets.js +18 -15
- package/dist/runner/session.d.ts +8 -8
- package/dist/runner/session.js +3 -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 +38 -28
- package/dist/runner/snapshot-choice.js +1 -1
- package/dist/runner/snapshot-inspect.d.ts +39 -40
- package/dist/runner/snapshot-inspect.js +58 -38
- package/dist/runner/snapshot-key.d.ts +30 -21
- package/dist/runner/snapshot-key.js +49 -29
- 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} +2 -2
- package/dist/runner/{recipe-check.js → vercel-sandbox-check.js} +3 -2
- package/dist/runner/{recipe.d.ts → vercel-sandbox-options.d.ts} +82 -82
- package/dist/runner/vercel-sandbox-options.js +510 -0
- package/dist/runner/{recipe-secrets.d.ts → vercel-sandbox-secrets.d.ts} +6 -6
- package/dist/runner/{recipe-secrets.js → vercel-sandbox-secrets.js} +20 -20
- package/dist/sdk/extension/commands.d.ts +8 -3
- package/dist/sdk/extension/commands.js +3 -1
- 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 +4 -3
- package/dist/sdk/extension/resource-definition.js +3 -2
- package/dist/sdk/extension/resource-factory.js +3 -4
- 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/sdk/run/present.d.ts +3 -3
- package/dist/sdk/run/present.js +1 -3
- 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 +3 -2
- package/skills/overview.md +6 -4
- package/skills/plan-runs.md +2 -2
- package/skills/read-run-output.md +6 -6
- package/dist/chunks/chunk-E4PJNZVG.js +0 -783
- package/dist/chunks/chunk-RAQEXKL6.js +0 -2591
- 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 -46
- package/dist/commands/exec/run-command.d.ts +0 -476
- package/dist/commands/exec/run-command.js +0 -604
- 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 -128
- package/dist/config/recipe-run.d.ts +0 -33
- package/dist/config/recipe-run.js +0 -28
- package/dist/core/sandbox-end.d.ts +0 -64
- package/dist/runner/live/snapshot-cache-gateway.d.ts +0 -12
- package/dist/runner/recipe.js +0 -425
- package/dist/runner/snapshot-cache.d.ts +0 -148
- package/dist/runner/snapshot-cache.js +0 -126
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// A program driver's part of planning a run (
|
|
2
|
-
// plan step for the test plan when the run counts, and the refusals that end the run there. Every driver of a program
|
|
3
|
-
// no command holds planning or refusal logic of its own.
|
|
1
|
+
// A program driver's part of planning a run (called from `plan-run.ts`): finding the program, asking the driver's
|
|
2
|
+
// plan step for the test plan when the run counts, and the refusals that end the run there. Every driver of a program
|
|
3
|
+
// plans through it, so no command holds planning or refusal logic of its own.
|
|
4
4
|
import { refused } from "@vercel/clinkr";
|
|
5
5
|
import { NOT_COUNTED } from "../../sdk/extension/index.js";
|
|
6
|
-
import { canceledBeforeStart } from "./
|
|
6
|
+
import { canceledBeforeStart } from "./outcomes.js";
|
|
7
7
|
import { findRunBin } from "./run-bin.js";
|
|
8
|
-
import { checkoutFailedRefusal } from "./
|
|
8
|
+
import { checkoutFailedRefusal } from "./runner-refusals.js";
|
|
9
9
|
/**
|
|
10
10
|
* Whether a driver run counts before it starts: nothing when neither `testPlan` nor `--count-tests` asks; otherwise
|
|
11
11
|
* each test when `--count-tests` was passed or the driver always counts each test (`driver.countsFilesOnly !== true`).
|
|
@@ -35,11 +35,11 @@ export function driverCount(driver, testPlan, countTests) {
|
|
|
35
35
|
* the driver's argv (`launch`) over the binary the run starts. `errors` are the builders of the driver's two errors
|
|
36
36
|
* (`driverRefusals`), the ones its command's outcomes list, which `driver.refusals`, the driver's words, word.
|
|
37
37
|
*/
|
|
38
|
-
export async function planDriverCommand(app, driver, errors, args, count,
|
|
38
|
+
export async function planDriverCommand(app, driver, errors, args, count, runner, signal) {
|
|
39
39
|
const { bin: name } = driver.program;
|
|
40
|
-
if (count === undefined &&
|
|
40
|
+
if (count === undefined && runner.kind === "vercel-sandbox")
|
|
41
41
|
return { ok: true, argv: driver.launch(name, args), testPlan: NOT_COUNTED.testPlan };
|
|
42
|
-
const bin = await findRunBin(app, name,
|
|
42
|
+
const bin = await findRunBin(app, name, runner);
|
|
43
43
|
if (bin.kind === "checkout-failed")
|
|
44
44
|
return refused(checkoutFailedRefusal(bin.failure));
|
|
45
45
|
const planned = { args, cwd: bin.cwd };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/** `exec`'s part of its leaf help: its usage after the run flags, its arguments, `--verbose`'s ending and its examples. */
|
|
7
7
|
export const EXEC_HELP = {
|
|
8
8
|
usage: "[--sandboxes <N>] -- <command...>",
|
|
9
|
-
args: "The command to run, after --, as an argument list with no shell. On the launch machine, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR only when neither is set and the launcher asks for or opts out of color; in a runner sandbox, the runner
|
|
9
|
+
args: "The command to run, after --, as an argument list with no shell. On the launch machine, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR only when neither is set and the launcher asks for or opts out of color; in a runner sandbox, the Vercel Sandbox runner's cwd, its env, the runner's PATH, STORM_RUN, and FORCE_COLOR or NO_COLOR only when that env sets neither and the launcher asks for or opts out of color, with paths under the repository's root rewritten.",
|
|
10
10
|
verbose: "which asks the command to print what each test does as it happens, for passing tests too",
|
|
11
11
|
examples: [
|
|
12
12
|
{
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CommandResult, ExecutionContext } from "@vercel/clinkr";
|
|
2
|
+
import type { StormApp } from "../../context.ts";
|
|
3
|
+
import { type ResourceLifecycles } from "../../core/index.ts";
|
|
4
|
+
import { type PlannedFacts } from "../../planning/plan-only.ts";
|
|
5
|
+
import type { RunPlan } from "../../planning/run-plan.ts";
|
|
6
|
+
import { type TestPlanFacts } from "../../run-directory/index.ts";
|
|
7
|
+
import type { DriverHints } from "../../sdk/extension/index.ts";
|
|
8
|
+
import type { RunCommandRequest } from "./run-flags.ts";
|
|
9
|
+
import { type RanFacts, type SandboxesRanFacts } from "./run-summary.ts";
|
|
10
|
+
/**
|
|
11
|
+
* A run once it is planned: its plan, across runner sandboxes or not (`RunPlan.sandboxes`), and the resources'
|
|
12
|
+
* lifecycles, bound once over the run's Contexts, which planning and `beforeRun` share.
|
|
13
|
+
*/
|
|
14
|
+
export interface PlannedRun {
|
|
15
|
+
readonly planned: RunPlan;
|
|
16
|
+
readonly lifecycles: ResourceLifecycles;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* How one command ends its planned run: its name, optional test metadata, driver hints, and outcome builders for
|
|
20
|
+
* `ran`, `sandboxes_ran`, and `--plan-only`'s `planned`.
|
|
21
|
+
*/
|
|
22
|
+
export interface RunSpec<TRan, TSandboxesRan, TPlanned> {
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly test?: {
|
|
25
|
+
readonly driver: string;
|
|
26
|
+
readonly suite: string | null;
|
|
27
|
+
} | undefined;
|
|
28
|
+
readonly hints: Pick<DriverHints, "noFinalResults">;
|
|
29
|
+
readonly extraMismatchHint?: string;
|
|
30
|
+
ran(facts: RanFacts, plan: TestPlanFacts | undefined, noFinalTestResults: boolean): TRan;
|
|
31
|
+
sandboxesRan(facts: SandboxesRanFacts, noFinalTestResults: boolean): TSandboxesRan;
|
|
32
|
+
planned(facts: PlannedFacts): TPlanned;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Executes a planned run: with `--plan-only` answers the planned run without starting anything; otherwise runs
|
|
36
|
+
* `beforeRun`, prepares the runner, records and renders progress, and maps outcomes for either a single run or a run
|
|
37
|
+
* across runner sandboxes.
|
|
38
|
+
*/
|
|
39
|
+
export declare function executePlannedRun<TRan extends CommandResult, TSandboxesRan, TPlanned>(context: ExecutionContext<StormApp>, request: RunCommandRequest, spec: RunSpec<TRan, TSandboxesRan, TPlanned>, plan: PlannedRun): Promise<TPlanned | TRan | TSandboxesRan | import("@vercel/clinkr").ClinkrError<"canceled"> | import("@vercel/clinkr").CommandError<"credential_unused"> | import("@vercel/clinkr").CommandError<"invalid_config"> | import("@vercel/clinkr").CommandError<"mint_failed"> | import("@vercel/clinkr").CommandError<"missing_target"> | import("@vercel/clinkr").CommandError<"no_base_ref"> | import("@vercel/clinkr").CommandError<"resource_needs_runner_sandbox"> | import("@vercel/clinkr").CommandError<"resource_refused"> | import("@vercel/clinkr").CommandError<"resource_refused_before_run"> | import("@vercel/clinkr").CommandError<"runner_failed"> | import("@vercel/clinkr").CommandError<"snapshot_gone"> | import("@vercel/clinkr").CommandError<"spawn_failed"> | import("@vercel/clinkr").CommandError<"submodules_refused"> | import("@vercel/clinkr").CommandError<"vercel_oidc_token_failed">>;
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
// Orchestrates a planned run for `storm test` and `storm exec`: `--plan-only`, single-run execution, and multi-sandbox
|
|
2
|
+
// execution. Delegates pre-start resource/runner checks to `before-run.ts`, end-of-run summaries and fact builders to
|
|
3
|
+
// `run-summary.ts`, and stopped-outcome mapping to `stopped-outcome.ts`.
|
|
4
|
+
import { acrossSandboxesExitStatus, commandExitStatus, executeAcrossSandboxes, executeRun, timedProgress, } from "../../core/index.js";
|
|
5
|
+
import { DEFINITION_SET } from "../../extensions.js";
|
|
6
|
+
import { forwardSigterm } from "../../forward-sigterm.js";
|
|
7
|
+
import { lacksFinalResults } from "../../planning/final-results.js";
|
|
8
|
+
import { buildPlannedFacts, plannedSecrets } from "../../planning/plan-only.js";
|
|
9
|
+
import { redactingObserver, redactingTerminal, redactor, redactStrings, } from "../../planning/redaction.js";
|
|
10
|
+
import { plannedTestPlan } from "../../planning/test-plan.js";
|
|
11
|
+
import { recordAcrossSandboxes, recordRun } from "../../run-directory/index.js";
|
|
12
|
+
import { RUN_CLEANUP } from "../../shared/cleanup.js";
|
|
13
|
+
import { isoSecondsText } from "../../shared/text.js";
|
|
14
|
+
import { beforeRunStarts, prepareRunnerForRun, resolveKeepMs, runnerRequestFor } from "./before-run.js";
|
|
15
|
+
import { countFinalResults, displayPath, listMismatches, sandboxesRanFacts, summarizeAcrossSandboxes, summarizeSingle, } from "./run-summary.js";
|
|
16
|
+
import { acrossSandboxesHeaderLines } from "./sandbox-lines.js";
|
|
17
|
+
import { sandboxProgress } from "./sandbox-progress.js";
|
|
18
|
+
import { mapStoppedOutcome } from "./stopped-outcome.js";
|
|
19
|
+
import { runView } from "./view.js";
|
|
20
|
+
/**
|
|
21
|
+
* Executes a planned run: with `--plan-only` answers the planned run without starting anything; otherwise runs
|
|
22
|
+
* `beforeRun`, prepares the runner, records and renders progress, and maps outcomes for either a single run or a run
|
|
23
|
+
* across runner sandboxes.
|
|
24
|
+
*/
|
|
25
|
+
export async function executePlannedRun(context, request, spec, plan) {
|
|
26
|
+
const { planned, lifecycles } = plan;
|
|
27
|
+
if (request.planOnly)
|
|
28
|
+
return await runPlanOnly(context.app, planned, lifecycles, spec);
|
|
29
|
+
if (planned.sandboxes === undefined)
|
|
30
|
+
return await runSingle(context, request, spec, planned, lifecycles);
|
|
31
|
+
return await runAcrossSandboxes(context, request, spec, planned, lifecycles);
|
|
32
|
+
}
|
|
33
|
+
/** `--plan-only`: checks runner preparation and returns redacted `PlannedFacts` without starting anything. */
|
|
34
|
+
async function runPlanOnly(app, plan, lifecycles, spec) {
|
|
35
|
+
let vcpus = null;
|
|
36
|
+
if (plan.runner.kind === "vercel-sandbox") {
|
|
37
|
+
const prepared = await prepareRunnerForRun(app, plan.runner, {
|
|
38
|
+
configFile: plan.configFile,
|
|
39
|
+
resources: plan.resources,
|
|
40
|
+
sandboxes: plan.sandboxes?.sandboxes.length ?? 1,
|
|
41
|
+
secrets: plannedSecrets(lifecycles, plan.runner, plan.resources),
|
|
42
|
+
});
|
|
43
|
+
if (!prepared.ok)
|
|
44
|
+
return prepared.refusal;
|
|
45
|
+
vcpus = prepared.prepared.vcpus;
|
|
46
|
+
}
|
|
47
|
+
return spec.planned(buildPlannedFacts({
|
|
48
|
+
version: app.version,
|
|
49
|
+
commit: app.commit,
|
|
50
|
+
plan,
|
|
51
|
+
lifecycles,
|
|
52
|
+
vcpus,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
/** Runs a single planned run (on the launch machine or in one runner sandbox). */
|
|
56
|
+
async function runSingle(context, request, spec, planned, lifecycles) {
|
|
57
|
+
const { app, ui, signal } = context;
|
|
58
|
+
const { configFile, argv } = planned;
|
|
59
|
+
const plan = plannedTestPlan(planned);
|
|
60
|
+
const before = await beforeRunStarts(context, lifecycles, planned, request, plan);
|
|
61
|
+
if (!before.ok)
|
|
62
|
+
return before.refusal;
|
|
63
|
+
const { runner: resolvedRunner, used } = before;
|
|
64
|
+
const base = {
|
|
65
|
+
argv,
|
|
66
|
+
version: app.version,
|
|
67
|
+
commit: app.commit,
|
|
68
|
+
configFile,
|
|
69
|
+
verbose: request.verbose,
|
|
70
|
+
resources: used.requests,
|
|
71
|
+
skipped: used.skipped,
|
|
72
|
+
};
|
|
73
|
+
let run;
|
|
74
|
+
if (resolvedRunner.kind === "vercel-sandbox") {
|
|
75
|
+
const keepMs = resolveKeepMs(request.keepSandbox, resolvedRunner.options, "single");
|
|
76
|
+
const requested = await runnerRequestFor(app, resolvedRunner, used, { configFile, sandboxes: 1, keepMs });
|
|
77
|
+
if (!requested.ok)
|
|
78
|
+
return requested.refusal;
|
|
79
|
+
run = {
|
|
80
|
+
...base,
|
|
81
|
+
runner: { kind: "vercel-sandbox", session: requested.runner, credential: resolvedRunner.credential },
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
const env = Object.fromEntries(Object.entries(app.env).filter(([name]) => !used.hiddenVariables.includes(name)));
|
|
86
|
+
run = {
|
|
87
|
+
...base,
|
|
88
|
+
runner: {
|
|
89
|
+
kind: "launch-machine",
|
|
90
|
+
env,
|
|
91
|
+
...(resolvedRunner.credential === undefined ? {} : { credential: resolvedRunner.credential }),
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const secrets = [...used.secrets, ...(resolvedRunner.kind === "vercel-sandbox" ? resolvedRunner.secrets : [])];
|
|
96
|
+
const redact = redactor(secrets);
|
|
97
|
+
const git = await checkoutGit(app.context.checkout, app.cwd);
|
|
98
|
+
// Only launch-machine runs forward SIGTERM directly to the child process; a run in a runner sandbox handles signals
|
|
99
|
+
// through `signal` alone and ignores `terminate`.
|
|
100
|
+
const sigterm = resolvedRunner.kind === "launch-machine" ? forwardSigterm(signal) : undefined;
|
|
101
|
+
const terminate = sigterm?.terminate ?? new AbortController().signal;
|
|
102
|
+
const view = runView({
|
|
103
|
+
presentation: app.presentation,
|
|
104
|
+
progress: ui.progress,
|
|
105
|
+
context: app.context,
|
|
106
|
+
mode: { kind: "single", showOutput: request.showOutput, verbose: request.verbose },
|
|
107
|
+
});
|
|
108
|
+
const recording = await recordRun(app.context.runDirectories, {
|
|
109
|
+
definitionSet: DEFINITION_SET,
|
|
110
|
+
clock: app.context.clock,
|
|
111
|
+
cwd: app.cwd,
|
|
112
|
+
configFile,
|
|
113
|
+
argv,
|
|
114
|
+
...(spec.test === undefined ? {} : { test: spec.test }),
|
|
115
|
+
plan,
|
|
116
|
+
run,
|
|
117
|
+
git,
|
|
118
|
+
redact: (value) => redactStrings(value, redact),
|
|
119
|
+
});
|
|
120
|
+
const observer = recording.observer(view.observer);
|
|
121
|
+
const terminal = recording.terminal(view.runnerTerminal);
|
|
122
|
+
const collected = run.runner.kind === "vercel-sandbox" || recording.testEvents !== undefined;
|
|
123
|
+
const runRequest = run.runner.kind === "launch-machine" && recording.testEvents !== undefined
|
|
124
|
+
? { ...run, runner: { ...run.runner, testEvents: recording.testEvents } }
|
|
125
|
+
: run;
|
|
126
|
+
let outcome;
|
|
127
|
+
try {
|
|
128
|
+
outcome = await runLifecycle({
|
|
129
|
+
execute: async () => await executeRun(DEFINITION_SET, { ...app.context, runnerTerminal: secrets.length === 0 ? terminal : redactingTerminal(terminal, redact) }, app.resourceContexts, runRequest, { signal, terminate }, timedProgress(app.context.clock, secrets.length === 0 ? observer : redactingObserver(observer, redact))),
|
|
130
|
+
redact,
|
|
131
|
+
hasSecrets: secrets.length > 0,
|
|
132
|
+
finishView: async () => await view.finish(),
|
|
133
|
+
abandonRecording: async () => await recording.abandon(),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
sigterm?.release();
|
|
138
|
+
}
|
|
139
|
+
const { timeline: ran, finalResults } = await summarizeSingle(app, {
|
|
140
|
+
command: spec.name,
|
|
141
|
+
hints: spec.hints,
|
|
142
|
+
view,
|
|
143
|
+
recording,
|
|
144
|
+
outcome,
|
|
145
|
+
});
|
|
146
|
+
if (outcome.kind !== "ran")
|
|
147
|
+
return mapStoppedOutcome(outcome);
|
|
148
|
+
const { command } = outcome;
|
|
149
|
+
const runId = recording.opened.ok ? recording.opened.id : null;
|
|
150
|
+
app.exit.status = commandExitStatus(outcome.command);
|
|
151
|
+
const facts = {
|
|
152
|
+
version: app.version,
|
|
153
|
+
commit: app.commit,
|
|
154
|
+
configFile,
|
|
155
|
+
resources: DEFINITION_SET.reports.ranFacts(outcome.resources),
|
|
156
|
+
cleanup: RUN_CLEANUP.facts(outcome),
|
|
157
|
+
command: command.kind === "exited"
|
|
158
|
+
? { exitCode: command.code, signal: null }
|
|
159
|
+
: command.kind === "signaled"
|
|
160
|
+
? { exitCode: null, signal: command.signal }
|
|
161
|
+
: { exitCode: null, signal: null },
|
|
162
|
+
runner: outcome.runner === undefined
|
|
163
|
+
? null
|
|
164
|
+
: {
|
|
165
|
+
snapshotId: outcome.runner.snapshotId,
|
|
166
|
+
base: outcome.runner.base,
|
|
167
|
+
builtBehind: outcome.runner.builtBehind,
|
|
168
|
+
uploadBytes: outcome.runner.uploadBytes,
|
|
169
|
+
built: outcome.runner.built,
|
|
170
|
+
vcpus: outcome.runner.vcpus,
|
|
171
|
+
region: outcome.runner.region,
|
|
172
|
+
runtime: outcome.runner.runtime,
|
|
173
|
+
buildMs: outcome.runner.buildMs,
|
|
174
|
+
},
|
|
175
|
+
timeline: ran,
|
|
176
|
+
runId,
|
|
177
|
+
};
|
|
178
|
+
return spec.ran(secrets.length === 0 ? facts : redactStrings(facts, redact), plan, lacksFinalResults(command.kind === "exited" ? command.code : null, {
|
|
179
|
+
...finalResults,
|
|
180
|
+
collected,
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
/** Runs a planned run across runner sandboxes. */
|
|
184
|
+
async function runAcrossSandboxes(context, request, spec, planned, lifecycles) {
|
|
185
|
+
const { app, ui, signal } = context;
|
|
186
|
+
const { configFile, argv, runner: plannedRunner } = planned;
|
|
187
|
+
const sandboxes = planned.sandboxes.sandboxes;
|
|
188
|
+
const count = sandboxes.length;
|
|
189
|
+
const plan = plannedTestPlan(planned);
|
|
190
|
+
const before = await beforeRunStarts(context, lifecycles, planned, request, plan);
|
|
191
|
+
if (!before.ok)
|
|
192
|
+
return before.refusal;
|
|
193
|
+
const { used } = before;
|
|
194
|
+
const requested = await runnerRequestFor(app, plannedRunner, used, {
|
|
195
|
+
configFile,
|
|
196
|
+
sandboxes: count,
|
|
197
|
+
keepMs: resolveKeepMs(request.keepSandbox, plannedRunner.options, "sandboxes"),
|
|
198
|
+
});
|
|
199
|
+
if (!requested.ok)
|
|
200
|
+
return requested.refusal;
|
|
201
|
+
const { runner } = requested;
|
|
202
|
+
const secrets = [...used.secrets, ...plannedRunner.secrets];
|
|
203
|
+
const redact = redactor(secrets);
|
|
204
|
+
const git = await checkoutGit(app.context.checkout, app.cwd);
|
|
205
|
+
const recording = await recordAcrossSandboxes(app.context.runDirectories, {
|
|
206
|
+
definitionSet: DEFINITION_SET,
|
|
207
|
+
clock: app.context.clock,
|
|
208
|
+
cwd: app.cwd,
|
|
209
|
+
configFile,
|
|
210
|
+
argv,
|
|
211
|
+
...(spec.test === undefined ? {} : { test: spec.test }),
|
|
212
|
+
plan,
|
|
213
|
+
runner,
|
|
214
|
+
sandboxes,
|
|
215
|
+
git,
|
|
216
|
+
redact: (value) => redactStrings(value, redact),
|
|
217
|
+
});
|
|
218
|
+
const runDirectory = recording.opened.ok
|
|
219
|
+
? `${displayPath(recording.opened.path, app.env)}/`
|
|
220
|
+
: `none: couldn't make ${recording.opened.failure.path}: ${recording.opened.failure.message}`;
|
|
221
|
+
// Redact raw argv elements before shell-quoting so secrets containing apostrophes cannot bypass literal masking,
|
|
222
|
+
// and keep final header redaction for other fields such as runDirectory.
|
|
223
|
+
const view = runView({
|
|
224
|
+
presentation: app.presentation,
|
|
225
|
+
progress: ui.progress,
|
|
226
|
+
context: app.context,
|
|
227
|
+
mode: {
|
|
228
|
+
kind: "sandboxes",
|
|
229
|
+
progress: sandboxProgress({
|
|
230
|
+
count,
|
|
231
|
+
listed: sandboxes.map(({ files }) => (files === null ? null : files.length)),
|
|
232
|
+
header: acrossSandboxesHeaderLines({
|
|
233
|
+
version: app.version,
|
|
234
|
+
commit: app.commit,
|
|
235
|
+
argv: argv.map(redact),
|
|
236
|
+
count,
|
|
237
|
+
runDirectory,
|
|
238
|
+
}).map(redact),
|
|
239
|
+
}),
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
const observer = recording.observer(view.observer);
|
|
243
|
+
const outcome = await runLifecycle({
|
|
244
|
+
execute: async () => await executeAcrossSandboxes(DEFINITION_SET, {
|
|
245
|
+
...app.context,
|
|
246
|
+
sandboxTerminal: (sandbox) => {
|
|
247
|
+
const terminal = recording.terminal(sandbox, app.context.runnerTerminal);
|
|
248
|
+
return secrets.length === 0 ? terminal : redactingTerminal(terminal, redact);
|
|
249
|
+
},
|
|
250
|
+
}, app.resourceContexts, {
|
|
251
|
+
version: app.version,
|
|
252
|
+
commit: app.commit,
|
|
253
|
+
configFile,
|
|
254
|
+
verbose: request.verbose,
|
|
255
|
+
runner,
|
|
256
|
+
credential: plannedRunner.credential,
|
|
257
|
+
sandboxes: sandboxes.map((sandbox) => ({
|
|
258
|
+
argv: sandbox.argv,
|
|
259
|
+
...(sandbox.files === null ? {} : { files: sandbox.files }),
|
|
260
|
+
})),
|
|
261
|
+
resources: used.requests,
|
|
262
|
+
skipped: used.skipped,
|
|
263
|
+
}, { signal }, timedProgress(app.context.clock, secrets.length === 0 ? observer : redactingObserver(observer, redact))),
|
|
264
|
+
redact,
|
|
265
|
+
hasSecrets: secrets.length > 0,
|
|
266
|
+
finishView: async () => await view.finish(),
|
|
267
|
+
abandonRecording: async () => await recording.abandon(),
|
|
268
|
+
});
|
|
269
|
+
const recorded = await recording.end(outcome);
|
|
270
|
+
const mismatches = outcome.kind === "sandboxes_ran" ? listMismatches(recorded) : [];
|
|
271
|
+
await summarizeAcrossSandboxes(app, {
|
|
272
|
+
command: spec.name,
|
|
273
|
+
hints: spec.hints,
|
|
274
|
+
...(spec.extraMismatchHint === undefined ? {} : { extraMismatchHint: spec.extraMismatchHint }),
|
|
275
|
+
view,
|
|
276
|
+
recording,
|
|
277
|
+
recorded,
|
|
278
|
+
outcome,
|
|
279
|
+
mismatches,
|
|
280
|
+
});
|
|
281
|
+
if (outcome.kind === "sandboxes_ran") {
|
|
282
|
+
app.exit.status = acrossSandboxesExitStatus(outcome.sandboxes);
|
|
283
|
+
const facts = sandboxesRanFacts(app, { outcome, recorded, recording, plan, runner, configFile, mismatches });
|
|
284
|
+
const everyExited0 = outcome.sandboxes.every(({ state, exitCode }) => state === "passed" && exitCode === 0);
|
|
285
|
+
const noFinalTestResults = lacksFinalResults(everyExited0 ? 0 : null, {
|
|
286
|
+
...countFinalResults(recorded.tests),
|
|
287
|
+
collected: true,
|
|
288
|
+
});
|
|
289
|
+
return spec.sandboxesRan(secrets.length === 0 ? facts : redactStrings(facts, redact), noFinalTestResults);
|
|
290
|
+
}
|
|
291
|
+
const keptLines = recorded.sandboxes.flatMap(({ record }) => record.name === null || record.keptUntil === null
|
|
292
|
+
? []
|
|
293
|
+
: [`Kept runner sandbox ${record.sandbox}, ${record.name}, running until ${isoSecondsText(record.keptUntil)}.`]);
|
|
294
|
+
return mapStoppedOutcome(outcome, {
|
|
295
|
+
commandLine: outcome.kind === "canceled" && outcome.commandStopped === true
|
|
296
|
+
? "Each command that was running was stopped in its runner sandbox."
|
|
297
|
+
: "The command didn't run.",
|
|
298
|
+
keptLines,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Executes a run inside the shared lifecycle guard: redacts the returned outcome when the run carries secrets, and
|
|
303
|
+
* ensures the view finishes and the recording is abandoned if execution throws.
|
|
304
|
+
*/
|
|
305
|
+
async function runLifecycle(options) {
|
|
306
|
+
try {
|
|
307
|
+
const ended = await options.execute();
|
|
308
|
+
// An outcome's facts, such as a failed Sandbox call's message, can quote what the run handed its command.
|
|
309
|
+
return options.hasSecrets ? redactStrings(ended, options.redact) : ended;
|
|
310
|
+
}
|
|
311
|
+
catch (error) {
|
|
312
|
+
// A live region must not outlive the run, however it ends, and abandoning the recording completes the run
|
|
313
|
+
// directory and removes any staged test events left there unredacted. They are never saved: the run didn't end.
|
|
314
|
+
await options.finishView();
|
|
315
|
+
await options.abandonRecording();
|
|
316
|
+
throw error;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
async function checkoutGit(checkout, cwd) {
|
|
320
|
+
const root = await checkout.repositoryRoot({ cwd });
|
|
321
|
+
if (!root.ok)
|
|
322
|
+
return null;
|
|
323
|
+
const head = await checkout.head({ repoRoot: root.value });
|
|
324
|
+
return head.ok ? { ...head.value } : null;
|
|
325
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type RunState } from "../../core/index.ts";
|
|
2
2
|
import { type Paint } from "../../shared/text.ts";
|
|
3
3
|
/**
|
|
4
|
-
* A run's phases, in order.
|
|
5
|
-
*
|
|
4
|
+
* A run's phases, in order. When a runner lane runs beside the resources' lanes, both render together as `lanes`;
|
|
5
|
+
* when the resources' lanes run alone, they render as `resources`.
|
|
6
6
|
*/
|
|
7
7
|
export type LivePhase = "credential" | "lanes" | "resources" | "command" | "cleanup";
|
|
8
8
|
/** The phase that runs now; undefined before the first. */
|
|
9
9
|
export declare function activePhase(state: RunState): LivePhase | undefined;
|
|
10
|
-
/** The run's first line: storm's version and,
|
|
10
|
+
/** The run's first line: storm's version and, when a merge-base is present, the base. Like a final form, it isn't cut. */
|
|
11
11
|
export declare function headerLine(state: RunState, paint: Paint): string;
|
|
12
12
|
/**
|
|
13
13
|
* Phase `phase`'s live block at `now`, `width` columns wide. Its height stays the same while the phase runs.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// The live view of a run on a terminal: its phases drawn by pure renderers from the run's state (`RunState`, built
|
|
2
2
|
// by `DEFINITION_SET.applyEvent`). A run goes through its phases in order: the credential, then the resources' lanes
|
|
3
|
-
// and the runner side by side (or the resources' lanes alone
|
|
4
|
-
// lane), then the command and the cleanup. The phase that runs shows live in a block of fixed height; once
|
|
5
|
-
// starts, it is printed above for good in its final form. Each resource lane's rows are its
|
|
6
|
-
// (`DEFINITION_SET.presentations`), laid out here.
|
|
3
|
+
// and the runner side by side (or the resources' lanes alone without a runner lane; or the runner alone without a
|
|
4
|
+
// resource lane), then the command and the cleanup. The phase that runs shows live in a block of fixed height; once
|
|
5
|
+
// the next one starts, it is printed above for good in its final form. Each resource lane's rows are its
|
|
6
|
+
// presentation's text (`DEFINITION_SET.presentations`), laid out here.
|
|
7
7
|
import { cleanupProblems, megabytesText, setupPhaseKey, setupPhaseWords, } from "../../core/index.js";
|
|
8
8
|
import { mintTargetText } from "../../credential/index.js";
|
|
9
9
|
import { DEFINITION_SET } from "../../extensions.js";
|
|
@@ -41,7 +41,7 @@ function instanceLanes(state) {
|
|
|
41
41
|
function startedLanes(state) {
|
|
42
42
|
return DEFINITION_SET.presentations.lanes(Object.entries(state.resources).map(([resource, { definition }]) => ({ resource, definition })));
|
|
43
43
|
}
|
|
44
|
-
/** The run's first line: storm's version and,
|
|
44
|
+
/** The run's first line: storm's version and, when a merge-base is present, the base. Like a final form, it isn't cut. */
|
|
45
45
|
export function headerLine(state, paint) {
|
|
46
46
|
const version = state.version === undefined ? "" : versionText(state.version.version, state.version.commit);
|
|
47
47
|
const header = [
|
|
@@ -69,7 +69,7 @@ export function phaseFrame(state, phase, now, width, paint) {
|
|
|
69
69
|
case "lanes":
|
|
70
70
|
return lanesFrame(state, view);
|
|
71
71
|
case "resources":
|
|
72
|
-
return
|
|
72
|
+
return resourceLanesFrame(state, view);
|
|
73
73
|
case "command":
|
|
74
74
|
return commandFrame(state, view);
|
|
75
75
|
case "cleanup":
|
|
@@ -99,7 +99,7 @@ export function phaseRecord(state, phase, width, paint) {
|
|
|
99
99
|
case "lanes":
|
|
100
100
|
return lanesRecord(state, view);
|
|
101
101
|
case "resources":
|
|
102
|
-
return
|
|
102
|
+
return resourceLanesRecord(state, view);
|
|
103
103
|
case "command":
|
|
104
104
|
return state.command === undefined ? [] : [commandLine(state, state.command, view, false)];
|
|
105
105
|
case "cleanup":
|
|
@@ -219,8 +219,9 @@ function snapshotText(step, runner, mergeBase) {
|
|
|
219
219
|
if (runner.snapshot?.kind === "built")
|
|
220
220
|
return "snapshot built";
|
|
221
221
|
if (runner.snapshot?.kind === "reused") {
|
|
222
|
-
const { base, builtBehind } = runner.snapshot;
|
|
223
|
-
|
|
222
|
+
const { base, builtBehind, source } = runner.snapshot;
|
|
223
|
+
const from = source === "shared" ? ", from the shared snapshot index" : "";
|
|
224
|
+
return `snapshot ${builtAtText({ base, builtBehind, mergeBase })}${from}`;
|
|
224
225
|
}
|
|
225
226
|
return `snapshot build ${step.status === "running" ? "stopped" : step.status}`;
|
|
226
227
|
}
|
|
@@ -282,11 +283,11 @@ function stepsText(steps, view, uploadBytes) {
|
|
|
282
283
|
.join(" · ");
|
|
283
284
|
}
|
|
284
285
|
/**
|
|
285
|
-
*
|
|
286
|
-
* its row, such as
|
|
287
|
-
* asked, takes the row under the first lane's.
|
|
286
|
+
* Resource lanes running alone (without a runner lane): each started resource lane's row, and under it what the lane
|
|
287
|
+
* says goes under its row, such as work in flight, else blank. A mint in flight, which the run makes once for
|
|
288
|
+
* whichever resource asked, takes the row under the first lane's.
|
|
288
289
|
*/
|
|
289
|
-
function
|
|
290
|
+
function resourceLanesFrame(state, view) {
|
|
290
291
|
const { mint } = state;
|
|
291
292
|
const draw = laneDraw(view);
|
|
292
293
|
const mintRow = mint !== undefined && mint.status === "running"
|
|
@@ -306,10 +307,10 @@ function unsandboxedResourcesFrame(state, view) {
|
|
|
306
307
|
]);
|
|
307
308
|
}
|
|
308
309
|
/**
|
|
309
|
-
*
|
|
310
|
+
* Final form of resource lanes running alone: the mint they waited on, if any, then each lane's line and the lines
|
|
310
311
|
* under it.
|
|
311
312
|
*/
|
|
312
|
-
function
|
|
313
|
+
function resourceLanesRecord(state, view) {
|
|
313
314
|
const { mint } = state;
|
|
314
315
|
const draw = laneDraw(view);
|
|
315
316
|
const lanes = startedLanes(state).flatMap((lane) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/commands/exec/metadata.ts
|
|
2
2
|
var metadata = {
|
|
3
|
-
description: `Run any command, the argument list after --, as it is, with the run payload in STORM_RUN. For a project's tests declared in storm.config.ts, use storm test, which finds the driver's program and can count the tests and size the run first (testPlan in storm.config.ts or --count-tests); exec counts nothing and sizes nothing. Where the command runs is the runner declared at the top level of storm.config.ts (launchMachine() or vercelSandbox({ \u2026 })), or --runner launch-machine, which runs on the launch machine and needs no config file. On the launch machine, the command runs on this machine in the working directory, with this machine's environment less the launcher environment variables the run's resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR only when neither is set and the launcher asks for or opts out of color. With vercelSandbox({ \u2026 }), it runs in a runner sandbox, a Vercel Sandbox readied from the runner
|
|
3
|
+
description: `Run any command, the argument list after --, as it is, with the run payload in STORM_RUN. For a project's tests declared in storm.config.ts, use storm test, which finds the driver's program and can count the tests and size the run first (testPlan in storm.config.ts or --count-tests); exec counts nothing and sizes nothing. Where the command runs is the runner declared at the top level of storm.config.ts (launchMachine() or vercelSandbox({ \u2026 })), or --runner launch-machine, which runs on the launch machine and needs no config file. On the launch machine, the command runs on this machine in the working directory, with this machine's environment less the launcher environment variables the run's resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR only when neither is set and the launcher asks for or opts out of color. With vercelSandbox({ \u2026 }), it runs in a runner sandbox, a Vercel Sandbox readied from the Vercel Sandbox runner in storm.config.ts, in the runner'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 runner's env, FORCE_COLOR or NO_COLOR only when that env sets neither and the launcher asks for or opts out of color (a plain non-TTY launcher gets neither), any variables declared in the runner's unsafeSecretEnvVars (each read from its source, { kind: "env", name }; command-only, never in steps or snapshots, and incompatible with keeping the runner sandbox), and STORM_RUN, and nothing else from this machine's environment; during the toolchain and prebuild steps of a snapshot build, then from the install until the command has ended, never during the upload or the apply, the Sandbox firewall adds each credential the runner's credentials key declares\u2014the value read from its source ({ kind: "env", name })\u2014as its header to the requests to its domain, GET and HEAD only by default, answering every other request to that domain with 403, or every request with requests: "all", so the value never enters the runner sandbox; storm shows each value as <token> in what it prints and writes, and a run in a runner sandbox 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. The run has each resource that storm.config.ts declares under resources or that one of the resource's own flags names, unless the resource skips itself: it first acquires each one, while the Vercel Sandbox runner readies its runner sandbox, hands it to the command under the run payload's resources, and releases it once the command has stopped; without one, the run payload names no resource. While the command runs in a runner sandbox, and only then, the Sandbox firewall adds each sandbox credential a resource gives the command to the requests to its domain, replacing a header of that name the request carries, so the value never enters the runner sandbox; a resource that gives one needs a runner sandbox, so a run on the launch machine that uses it is refused with resource_needs_runner_sandbox before it starts. Each resource's flags and examples are below, and its own commands are under storm ext. 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; storm.config.mts works the same, always loads as an ES module, and suits a package.json without "type": "module", and one directory may hold only one of the two. A resource's secrets, such as a token it reads from this machine's environment, show as <token> in what the run prints and writes. With --sandboxes <n> and the Vercel Sandbox runner, it is a run across runner sandboxes: one mint and one runner snapshot serve n runner sandboxes, which start at once, and each runner sandbox runs the command with {sandbox} replaced by its runner sandbox index (from 0), {sandbox+1} by its index plus one, and {sandboxes} by n; storm.config.ts must set runner.sandboxes.max; each resource of the run is acquired once and split across the runner sandboxes, each runner sandbox getting its own part; it prints status lines and no command output, each runner sandbox's output goes to its own command log in the run directory, and storm exits 0 when every runner sandbox passed, else 1.`,
|
|
4
4
|
summary: "Run any command with the declared runner or on the launch machine."
|
|
5
5
|
};
|
|
6
6
|
export {
|
|
@@ -8,6 +8,16 @@ export declare const mintFailedErrors: import("@vercel/clinkr").SharedErrors<{
|
|
|
8
8
|
runner: z.ZodBoolean;
|
|
9
9
|
cleanup: z.ZodType<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts, z.core.$ZodTypeInternals<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts>>;
|
|
10
10
|
}, z.core.$strip>;
|
|
11
|
+
vercelOidcTokenFailed: z.ZodObject<{
|
|
12
|
+
cause: z.ZodEnum<{
|
|
13
|
+
"invalid-token": "invalid-token";
|
|
14
|
+
"missing-token": "missing-token";
|
|
15
|
+
}>;
|
|
16
|
+
detail: z.ZodString;
|
|
17
|
+
fix: z.ZodString;
|
|
18
|
+
runner: z.ZodBoolean;
|
|
19
|
+
cleanup: z.ZodType<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts, z.core.$ZodTypeInternals<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts>>;
|
|
20
|
+
}, z.core.$strip>;
|
|
11
21
|
}, {
|
|
12
22
|
readonly mintFailed: {
|
|
13
23
|
readonly exitCode: 1;
|
|
@@ -36,4 +46,32 @@ export declare const mintFailedErrors: import("@vercel/clinkr").SharedErrors<{
|
|
|
36
46
|
}[];
|
|
37
47
|
};
|
|
38
48
|
};
|
|
49
|
+
readonly vercelOidcTokenFailed: {
|
|
50
|
+
readonly exitCode: 1;
|
|
51
|
+
readonly 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.";
|
|
52
|
+
readonly schema: z.ZodObject<{
|
|
53
|
+
cause: z.ZodEnum<{
|
|
54
|
+
"invalid-token": "invalid-token";
|
|
55
|
+
"missing-token": "missing-token";
|
|
56
|
+
}>;
|
|
57
|
+
detail: z.ZodString;
|
|
58
|
+
fix: z.ZodString;
|
|
59
|
+
runner: z.ZodBoolean;
|
|
60
|
+
cleanup: z.ZodType<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts, z.core.$ZodTypeInternals<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts>>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
readonly render: ({ detail, fix, runner, cleanup }: {
|
|
63
|
+
cause: "invalid-token" | "missing-token";
|
|
64
|
+
detail: string;
|
|
65
|
+
fix: string;
|
|
66
|
+
runner: boolean;
|
|
67
|
+
cleanup: import("../../shared/cleanup.ts").StormCleanupFacts;
|
|
68
|
+
}) => {
|
|
69
|
+
message: string;
|
|
70
|
+
rows?: readonly import("@vercel/clinkr").Row[];
|
|
71
|
+
next: {
|
|
72
|
+
type: "text";
|
|
73
|
+
text: string;
|
|
74
|
+
}[];
|
|
75
|
+
};
|
|
76
|
+
};
|
|
39
77
|
}>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
// A run's `mint_failed`, shared by `storm test` and `storm exec`: the run's
|
|
2
|
-
//
|
|
3
|
-
// machine, when the run settled the mint, the core's
|
|
4
|
-
// credential, and the run ends this way when that resource
|
|
1
|
+
// A run's `mint_failed` and `vercel_oidc_token_failed`, shared by `storm test` and `storm exec`: obtaining the run's
|
|
2
|
+
// Vercel credential failed. With the Vercel Sandbox runner, the core obtains the credential for the runner sandbox
|
|
3
|
+
// first, whatever the resources are (`runner: true`); on the launch machine, when the run settled the mint, the core's
|
|
4
|
+
// credential source mints when a resource first asks for a credential, and the run ends this way when that resource
|
|
5
|
+
// can't go on without it (`runner: false`).
|
|
5
6
|
import { defineErrors } from "@vercel/clinkr";
|
|
6
7
|
import { z } from "zod";
|
|
8
|
+
import { vercelOidcTokenFailureShape } from "../../credential/index.js";
|
|
7
9
|
import { RUN_CLEANUP } from "../../shared/cleanup.js";
|
|
8
10
|
export const mintFailedErrors = defineErrors({
|
|
9
11
|
mintFailed: {
|
|
@@ -30,4 +32,25 @@ export const mintFailedErrors = defineErrors({
|
|
|
30
32
|
};
|
|
31
33
|
},
|
|
32
34
|
},
|
|
35
|
+
vercelOidcTokenFailed: {
|
|
36
|
+
exitCode: 1,
|
|
37
|
+
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.",
|
|
38
|
+
schema: z.object({
|
|
39
|
+
...vercelOidcTokenFailureShape,
|
|
40
|
+
/** Whether the credential was for the runner sandbox, not for a resource. */
|
|
41
|
+
runner: z.boolean(),
|
|
42
|
+
/** What the run couldn't clean up. */
|
|
43
|
+
cleanup: RUN_CLEANUP.schema,
|
|
44
|
+
}),
|
|
45
|
+
render: ({ detail, fix, runner, cleanup }) => {
|
|
46
|
+
const rows = RUN_CLEANUP.rows(cleanup);
|
|
47
|
+
return {
|
|
48
|
+
message: runner
|
|
49
|
+
? `Couldn't use VERCEL_OIDC_TOKEN for the runner sandbox: ${detail}. The command didn't run.`
|
|
50
|
+
: `Couldn't use VERCEL_OIDC_TOKEN: ${detail}. One of the run's resources needed it, so the command didn't run.`,
|
|
51
|
+
...(rows.length === 0 ? {} : { rows }),
|
|
52
|
+
next: [{ type: "text", text: fix }],
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
},
|
|
33
56
|
});
|