@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
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
// (`driver.ts`), such as `vitest` or `playwright`.
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
/**
|
|
5
|
-
* Finds the binary `name` for a run that counts its tests with it before anything is minted, acquired or started:
|
|
5
|
+
* Finds the binary `name` for a run that counts its tests with it before anything is minted, acquired, or started:
|
|
6
6
|
*
|
|
7
|
-
* 1. Where to count:
|
|
8
|
-
* directory on this machine that
|
|
7
|
+
* 1. Where to count: the working directory for `launch-machine`; `<repository root>/<runner.cwd>` for
|
|
8
|
+
* `vercel-sandbox`, the directory on this machine that corresponds to `/vercel/sandbox/<runner.cwd>` in the runner
|
|
9
|
+
* sandbox.
|
|
9
10
|
* 2. Finds `node_modules/.bin/<name>` in that directory and each above it, up to the repository's root, or the
|
|
10
|
-
* filesystem's root outside a repository,
|
|
11
|
-
* (`app.packageBins`, `src/local-services.ts`).
|
|
11
|
+
* filesystem's root outside a repository, through `app.packageBins` (`src/local-services.ts`) for `launch-machine`.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* A `launch-machine` run starts the binary found; a `vercel-sandbox` run starts plain `name`, which the runner's
|
|
14
14
|
* `PATH` finds in `node_modules/.bin` of `runner.cwd` and of the repository's root.
|
|
15
15
|
*/
|
|
16
|
-
export async function findRunBin(app, name,
|
|
17
|
-
if (
|
|
16
|
+
export async function findRunBin(app, name, runner) {
|
|
17
|
+
if (runner.kind === "launch-machine") {
|
|
18
18
|
const cwd = app.cwd;
|
|
19
19
|
const found = await app.packageBins.find(name, cwd);
|
|
20
20
|
return found.ok
|
|
@@ -24,7 +24,7 @@ export async function findRunBin(app, name, where) {
|
|
|
24
24
|
const root = await app.context.checkout.repositoryRoot({ cwd: app.cwd });
|
|
25
25
|
if (!root.ok)
|
|
26
26
|
return { kind: "checkout-failed", failure: root.failure };
|
|
27
|
-
const cwd = join(root.value,
|
|
27
|
+
const cwd = join(root.value, runner.options.cwd);
|
|
28
28
|
const found = await app.context.packageBins.find({ name, from: cwd, root: root.value });
|
|
29
29
|
return found.ok
|
|
30
30
|
? { kind: "found", cwd, counts: found.path, runs: name }
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ArgumentIssue } from "@vercel/clinkr";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { SettingsFile } from "../../config/index.ts";
|
|
4
|
+
/** Shared refusal detail for `--show-output` in a run across runner sandboxes. */
|
|
5
|
+
export declare const SHOW_OUTPUT_ACROSS_SANDBOXES_DETAIL = "prints status lines and no step output, and each runner sandbox entry of its run directory keeps its step logs; drop --show-output.";
|
|
6
|
+
/**
|
|
7
|
+
* The request fields every run takes, `storm test`'s and `storm exec`'s: the run's own, and each resource option's
|
|
8
|
+
* flag (`resource-flags.ts`). Each command adds its own fields (`--runner` on `exec`, `--suite` and `--count-tests`
|
|
9
|
+
* on `test`).
|
|
10
|
+
*/
|
|
11
|
+
export declare const RUN_REQUEST_FIELDS: {
|
|
12
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
13
|
+
project: z.ZodOptional<z.ZodString>;
|
|
14
|
+
credential: z.ZodOptional<z.ZodEnum<{
|
|
15
|
+
"github-actions": "github-actions";
|
|
16
|
+
mint: "mint";
|
|
17
|
+
"vercel-oidc": "vercel-oidc";
|
|
18
|
+
}>>;
|
|
19
|
+
showOutput: z.ZodDefault<z.ZodBoolean>;
|
|
20
|
+
keepSandbox: z.ZodOptional<z.ZodString>;
|
|
21
|
+
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
22
|
+
planOnly: z.ZodDefault<z.ZodBoolean>;
|
|
23
|
+
};
|
|
24
|
+
/** The CLI spellings of the fields every run takes. */
|
|
25
|
+
export declare const RUN_CLI_OPTIONS: {
|
|
26
|
+
readonly project: {
|
|
27
|
+
readonly short: "p";
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
declare const runRequestSchema: z.ZodObject<{
|
|
31
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
32
|
+
project: z.ZodOptional<z.ZodString>;
|
|
33
|
+
credential: z.ZodOptional<z.ZodEnum<{
|
|
34
|
+
"github-actions": "github-actions";
|
|
35
|
+
mint: "mint";
|
|
36
|
+
"vercel-oidc": "vercel-oidc";
|
|
37
|
+
}>>;
|
|
38
|
+
showOutput: z.ZodDefault<z.ZodBoolean>;
|
|
39
|
+
keepSandbox: z.ZodOptional<z.ZodString>;
|
|
40
|
+
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
41
|
+
planOnly: z.ZodDefault<z.ZodBoolean>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
/** What every run's request holds. */
|
|
44
|
+
export type RunCommandRequest = z.output<typeof runRequestSchema>;
|
|
45
|
+
/**
|
|
46
|
+
* What planning a run reads: the run's request, and what the command settled before planning: the effective config
|
|
47
|
+
* file (`effectiveConfig`, with any selected suite laid over the top level), the selected suite's name (null for the
|
|
48
|
+
* project's tests and `storm exec`), `--runner launch-machine` on `storm exec`, and `--sandboxes` and `--file-lists`,
|
|
49
|
+
* which `planRun` refuses for the launch machine runner (`conflicting_options`).
|
|
50
|
+
*/
|
|
51
|
+
export type RunPlanRequest = RunCommandRequest & {
|
|
52
|
+
readonly settingsFile: SettingsFile;
|
|
53
|
+
readonly suite: string | null;
|
|
54
|
+
readonly runner?: "launch-machine" | undefined;
|
|
55
|
+
readonly sandboxes?: number | undefined;
|
|
56
|
+
readonly fileLists?: string | undefined;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* What is wrong with `--sandboxes` or `--file-lists` combined with other run flags, whatever the runner, as `validate`
|
|
60
|
+
* reports it. The launch machine runner refuses both flags in `planRun` (`conflicting_options`), once it knows the
|
|
61
|
+
* effective runner.
|
|
62
|
+
*/
|
|
63
|
+
export declare function sandboxesFlagProblems(request: Pick<RunCommandRequest, "showOutput"> & {
|
|
64
|
+
readonly sandboxes?: number | undefined;
|
|
65
|
+
readonly fileLists?: string | undefined;
|
|
66
|
+
}): readonly ArgumentIssue[];
|
|
67
|
+
/** Flag checks that hold regardless of which runner the run uses (`validate`). */
|
|
68
|
+
export declare function runFlagProblems(request: RunCommandRequest): readonly ArgumentIssue[];
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Shared request fields, CLI options, and flag validation for `storm test` and `storm exec`.
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { resourceFlagFields, resourceFlagProblems } from "../../planning/resource-flags.js";
|
|
4
|
+
import { parseKeepTime } from "../../time/index.js";
|
|
5
|
+
/** Shared refusal detail for `--show-output` in a run across runner sandboxes. */
|
|
6
|
+
export const SHOW_OUTPUT_ACROSS_SANDBOXES_DETAIL = "prints status lines and no step output, and each runner sandbox entry of its run directory keeps its step logs; drop --show-output.";
|
|
7
|
+
/** The run's own request fields, which every run takes beside the resources' flags. */
|
|
8
|
+
const OWN_RUN_FIELDS = {
|
|
9
|
+
scope: z.string().min(1).optional(),
|
|
10
|
+
project: z.string().min(1).optional(),
|
|
11
|
+
credential: z.enum(["mint", "github-actions", "vercel-oidc"]).optional(),
|
|
12
|
+
showOutput: z.boolean().default(false),
|
|
13
|
+
keepSandbox: z.string().optional(),
|
|
14
|
+
verbose: z.boolean().default(false),
|
|
15
|
+
planOnly: z.boolean().default(false),
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The request fields every run takes, `storm test`'s and `storm exec`'s: the run's own, and each resource option's
|
|
19
|
+
* flag (`resource-flags.ts`). Each command adds its own fields (`--runner` on `exec`, `--suite` and `--count-tests`
|
|
20
|
+
* on `test`).
|
|
21
|
+
*/
|
|
22
|
+
export const RUN_REQUEST_FIELDS = { ...OWN_RUN_FIELDS, ...resourceFlagFields(Object.keys(OWN_RUN_FIELDS)) };
|
|
23
|
+
/** The CLI spellings of the fields every run takes. */
|
|
24
|
+
export const RUN_CLI_OPTIONS = { project: { short: "p" } };
|
|
25
|
+
const runRequestSchema = z.object(RUN_REQUEST_FIELDS);
|
|
26
|
+
/**
|
|
27
|
+
* What is wrong with `--sandboxes` or `--file-lists` combined with other run flags, whatever the runner, as `validate`
|
|
28
|
+
* reports it. The launch machine runner refuses both flags in `planRun` (`conflicting_options`), once it knows the
|
|
29
|
+
* effective runner.
|
|
30
|
+
*/
|
|
31
|
+
export function sandboxesFlagProblems(request) {
|
|
32
|
+
const flag = request.sandboxes !== undefined ? "--sandboxes" : request.fileLists !== undefined ? "--file-lists" : undefined;
|
|
33
|
+
if (flag === undefined)
|
|
34
|
+
return [];
|
|
35
|
+
return request.showOutput
|
|
36
|
+
? [
|
|
37
|
+
{
|
|
38
|
+
field: "showOutput",
|
|
39
|
+
message: `A run with ${flag} ${SHOW_OUTPUT_ACROSS_SANDBOXES_DETAIL}`,
|
|
40
|
+
},
|
|
41
|
+
]
|
|
42
|
+
: [];
|
|
43
|
+
}
|
|
44
|
+
/** Flag checks that hold regardless of which runner the run uses (`validate`). */
|
|
45
|
+
export function runFlagProblems(request) {
|
|
46
|
+
const { keepSandbox } = request;
|
|
47
|
+
return [
|
|
48
|
+
...resourceFlagProblems(request),
|
|
49
|
+
...(keepSandbox !== undefined && parseKeepTime(keepSandbox) === undefined
|
|
50
|
+
? [
|
|
51
|
+
{
|
|
52
|
+
field: "keepSandbox",
|
|
53
|
+
message: `--keep-sandbox takes 0, or a whole number of minutes or hours up to 5h, such as 30m or 2h, not ${JSON.stringify(keepSandbox)}.`,
|
|
54
|
+
},
|
|
55
|
+
]
|
|
56
|
+
: []),
|
|
57
|
+
];
|
|
58
|
+
}
|
|
@@ -14,11 +14,11 @@ export const EXEC_USAGE_FLAGS = `${RESOURCE_USAGE_FLAGS} [--credential <SOURCE>]
|
|
|
14
14
|
const ownRunFields = (verbose) => ({
|
|
15
15
|
credential: {
|
|
16
16
|
valueLabel: "SOURCE",
|
|
17
|
-
description: "The credential source: mint, the default, mints one with the vercel CLI for --scope and --project; github-actions requests a GitHub Actions OIDC token, in a GitHub Actions job with permissions id-token: write, anew once it is 4 minutes old, and needs no --scope or --project.
|
|
17
|
+
description: "The credential source: mint, the default, mints one with the vercel CLI for --scope and --project; vercel-oidc reads a pre-minted Vercel project OIDC token from VERCEL_OIDC_TOKEN and needs no --scope or --project; github-actions requests a GitHub Actions OIDC token, in a GitHub Actions job with permissions id-token: write, anew once it is 4 minutes old, and needs no --scope or --project. The Vercel Sandbox runner accepts mint and vercel-oidc, and refuses github-actions. On the launch machine, only a run with a resource that takes a credential takes it, as that resource's options decide; otherwise it is credential_unused. This credential is the Vercel OIDC token storm uses for its own calls, not a sandbox credential that runner.credentials declares: the word has both uses until a rename. No config key.",
|
|
18
18
|
},
|
|
19
19
|
keepSandbox: {
|
|
20
20
|
valueLabel: "DURATION",
|
|
21
|
-
description: "Keep the runner sandbox running this long once the run ends, however it ends, so you can connect to it from its page in the Vercel dashboard: 0, which stops and deletes it with the run's other sandboxes, or a whole number of minutes or hours up to 5h (30m, 2h). A run keeps its runner sandbox only when this flag or keepSandbox in vercelSandbox({ … }) asks; by default it stops and deletes it, after a failure too. A kept runner sandbox holds the checkout, the installed packages, and everything the command wrote, including its test output; storm removes nothing from it, and it holds no credential, the
|
|
21
|
+
description: "Keep the runner sandbox running this long once the run ends, however it ends, so you can connect to it from its page in the Vercel dashboard: 0, which stops and deletes it with the run's other sandboxes, or a whole number of minutes or hours up to 5h (30m, 2h). A run keeps its runner sandbox only when this flag or keepSandbox in vercelSandbox({ … }) asks; by default it stops and deletes it, after a failure too. A kept runner sandbox holds the checkout, the installed packages, and everything the command wrote, including its test output; storm removes nothing from it, and it holds no credential, the runner's or a resource's, since storm revokes every sandbox credential before it keeps the sandbox. Anyone who can update the Vercel project can connect to it. Refused when vercelSandbox({ … }) sets unsafeSecretEnvVars, because a run that passes secrets into the runner sandbox's environment never keeps its runner sandbox. storm gives the kept runner sandbox no network access before it releases the run's resources: once the run releases its resources, another run can take them. Before it keeps the sandbox, the run ends every process it started there. The run asks Vercel Sandbox to extend the runner sandbox's timeout when it would stop sooner; it never shortens it, so the sandbox may run past the keep time until its own timeout. The run says until when it runs, and storm runs show and runs list say so too. Default: keepSandbox in vercelSandbox({ … }), else 0; a run across runner sandboxes keeps each runner sandbox only with --keep-sandbox and ignores keepSandbox in vercelSandbox({ … }). Fits the Vercel Sandbox runner only.",
|
|
22
22
|
},
|
|
23
23
|
showOutput: {
|
|
24
24
|
description: "With the Vercel Sandbox runner on a terminal, print the runner's step output (a snapshot build, the install, the build) above the live view instead of keeping only each step's last line there. Plain output always prints it. Either way, the run directory keeps it whole. Fits the Vercel Sandbox runner only. No config key.",
|
|
@@ -31,11 +31,11 @@ const ownRunFields = (verbose) => ({
|
|
|
31
31
|
},
|
|
32
32
|
scope: {
|
|
33
33
|
valueLabel: "TEAM",
|
|
34
|
-
description: "The control plane team: the Vercel team whose project the credential is minted for and the Vercel Sandbox runner's sandboxes run in. Required, from this flag or scope in storm.config.ts, unless a launch machine run
|
|
34
|
+
description: "The control plane team: the Vercel team whose project the credential is minted for and the Vercel Sandbox runner's sandboxes run in. Required, from this flag or scope in storm.config.ts, unless the run takes --credential vercel-oidc or --credential github-actions, or is a launch machine run with no resource that takes a credential.",
|
|
35
35
|
},
|
|
36
36
|
project: {
|
|
37
37
|
valueLabel: "PROJECT",
|
|
38
|
-
description: "The control plane project: the Vercel project, within the team, to mint the credential for. Required, from this flag or project in storm.config.ts, unless a launch machine run
|
|
38
|
+
description: "The control plane project: the Vercel project, within the team, to mint the credential for. Required, from this flag or project in storm.config.ts, unless the run takes --credential vercel-oidc or --credential github-actions, or is a launch machine run with no resource that takes a credential.",
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
41
|
/**
|
|
@@ -65,7 +65,7 @@ export function runHelp(words, field, options = {}) {
|
|
|
65
65
|
*/
|
|
66
66
|
export const DRIVER_SANDBOXES_HELP = {
|
|
67
67
|
valueLabel: "N",
|
|
68
|
-
description: "Run in N runner sandboxes at once, a run across runner sandboxes, with a driver that has file list support, else driver_sandboxes_refused: storm lists the run's test files on this machine, whether or not storm.config.ts sets testPlan, sorts them, deals them in turn into N file lists, the first file to runner sandbox 0's list, the second to runner sandbox 1's, and so on, and runs each file list in its own runner sandbox, all started from one runner snapshot, with the run's arguments unchanged and each runner sandbox's file list in STORM_RUN. With fewer test files than N, the run has one runner sandbox for each test file, and the plan line says so. N is a whole number from 1 to runner.sandboxes.max in storm.config.ts, and a config file without runner.sandboxes takes no --sandboxes. Each runner sandbox's command output goes only to its command.log in the run directory, under sandboxes/<index>/, and the run prints one status line for each runner sandbox's step, then each runner sandbox's waterfall, a table of the runner sandboxes, and a warning, file_list_mismatch, for each runner sandbox that reported nothing for a test file of its list or reported a test file not in its list; storm exits 0 when every runner sandbox passed, else 1, warning or not. The run keeps each runner sandbox only with --keep-sandbox. To give your own lists, use --file-lists. Fits the Vercel Sandbox runner only. Not with --show-output. Config key: runner.sandboxes.default, the number of runner sandboxes of a run with neither --sandboxes nor --file-lists, a whole number or a
|
|
68
|
+
description: "Run in N runner sandboxes at once, a run across runner sandboxes, with a driver that has file list support, else driver_sandboxes_refused: storm lists the run's test files on this machine, whether or not storm.config.ts sets testPlan, sorts them, deals them in turn into N file lists, the first file to runner sandbox 0's list, the second to runner sandbox 1's, and so on, and runs each file list in its own runner sandbox, all started from one runner snapshot, with the run's arguments unchanged and each runner sandbox's file list in STORM_RUN. With fewer test files than N, the run has one runner sandbox for each test file, and the plan line says so. N is a whole number from 1 to runner.sandboxes.max in storm.config.ts, and a config file without runner.sandboxes takes no --sandboxes. Each runner sandbox's command output goes only to its command.log in the run directory, under sandboxes/<index>/, and the run prints one status line for each runner sandbox's step, then each runner sandbox's waterfall, a table of the runner sandboxes, and a warning, file_list_mismatch, for each runner sandbox that reported nothing for a test file of its list or reported a test file not in its list; storm exits 0 when every runner sandbox passed, else 1, warning or not. The run keeps each runner sandbox only with --keep-sandbox. To give your own lists, use --file-lists. Fits the Vercel Sandbox runner only. Not with --show-output. Config key: runner.sandboxes.default, the number of runner sandboxes of a run with neither --sandboxes nor --file-lists, a whole number or a declared { filesPerSandbox, max? } rule, lowered to runner.sandboxes.max when it is above it; with it, every such run is a run across runner sandboxes, also with one runner sandbox.",
|
|
69
69
|
};
|
|
70
70
|
/**
|
|
71
71
|
* The field description of `--file-lists` on `storm test`, for a driver with file list support (`Driver.fileLists`).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { StormApp } from "../../context.ts";
|
|
3
|
+
import type { AcrossSandboxesOutcome, RunRunnerRequest, SandboxesRanRun, SingleRunOutcome } from "../../core/index.ts";
|
|
4
|
+
import { type FileListMismatch } from "../../planning/file-lists.ts";
|
|
5
|
+
import type { FinalResultsRead } from "../../planning/final-results.ts";
|
|
6
|
+
import type { AcrossSandboxesRecorded, AcrossSandboxesRecording, RunRecording, TestPlanFacts, TimelineFacts } from "../../run-directory/index.ts";
|
|
7
|
+
import type { DriverHints } from "../../sdk/extension/index.ts";
|
|
8
|
+
import type { sandboxesRanSchema } from "./across-sandboxes-outcomes.ts";
|
|
9
|
+
import type { ranSchema } from "./outcomes.ts";
|
|
10
|
+
import type { RunView } from "./view.ts";
|
|
11
|
+
/** What a `ran` outcome reports of every run, which a command's own `ran` may extend. */
|
|
12
|
+
export type RanFacts = z.input<typeof ranSchema>;
|
|
13
|
+
/** What a `sandboxes_ran` outcome reports of every run across runner sandboxes. */
|
|
14
|
+
export type SandboxesRanFacts = z.input<typeof sandboxesRanSchema>;
|
|
15
|
+
/** Counts final test results and partial-read flags across a run's recorded test events. */
|
|
16
|
+
export declare function countFinalResults(tests: {
|
|
17
|
+
readonly events: readonly {
|
|
18
|
+
readonly kind: string;
|
|
19
|
+
}[];
|
|
20
|
+
readonly unreadable: number;
|
|
21
|
+
readonly incomplete?: unknown;
|
|
22
|
+
}): Omit<FinalResultsRead, "collected">;
|
|
23
|
+
/** Shortens a path under `$HOME` to `~/...` for display in summaries and headers. */
|
|
24
|
+
export declare function displayPath(path: string, env: Readonly<Record<string, string | undefined>>): string;
|
|
25
|
+
/** Ends a single run's recording, appends its job summary, finishes its view, and returns its timeline and test counts. */
|
|
26
|
+
export declare function summarizeSingle(app: StormApp, run: {
|
|
27
|
+
readonly command: string;
|
|
28
|
+
readonly hints: Pick<DriverHints, "noFinalResults">;
|
|
29
|
+
readonly view: RunView;
|
|
30
|
+
readonly recording: RunRecording;
|
|
31
|
+
readonly outcome: SingleRunOutcome;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
readonly timeline: TimelineFacts;
|
|
34
|
+
readonly finalResults: Omit<FinalResultsRead, "collected">;
|
|
35
|
+
}>;
|
|
36
|
+
/** Compares each runner sandbox's assigned file list against the test files it reported. */
|
|
37
|
+
export declare function listMismatches(recorded: AcrossSandboxesRecorded): readonly FileListMismatch[];
|
|
38
|
+
/** Appends a multi-sandbox run's job summary and finishes its view with per-sandbox waterfalls and the end table. */
|
|
39
|
+
export declare function summarizeAcrossSandboxes(app: StormApp, run: {
|
|
40
|
+
readonly command: string;
|
|
41
|
+
readonly hints: Pick<DriverHints, "noFinalResults">;
|
|
42
|
+
readonly extraMismatchHint?: string;
|
|
43
|
+
readonly view: RunView;
|
|
44
|
+
readonly recording: AcrossSandboxesRecording;
|
|
45
|
+
readonly recorded: AcrossSandboxesRecorded;
|
|
46
|
+
readonly outcome: AcrossSandboxesOutcome;
|
|
47
|
+
readonly mismatches: readonly FileListMismatch[];
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
/** Builds the `SandboxesRanFacts` payload for a completed run across runner sandboxes. */
|
|
50
|
+
export declare function sandboxesRanFacts(app: StormApp, run: {
|
|
51
|
+
readonly outcome: SandboxesRanRun;
|
|
52
|
+
readonly recorded: AcrossSandboxesRecorded;
|
|
53
|
+
readonly recording: AcrossSandboxesRecording;
|
|
54
|
+
readonly plan: TestPlanFacts;
|
|
55
|
+
readonly runner: RunRunnerRequest;
|
|
56
|
+
readonly configFile: string | null;
|
|
57
|
+
readonly mismatches: readonly FileListMismatch[];
|
|
58
|
+
}): SandboxesRanFacts;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// End-of-run summaries, job summaries, waterfall rendering, final-results counting, and `sandboxes_ran` outcome fact
|
|
2
|
+
// builders shared by `storm test` and `storm exec`.
|
|
3
|
+
import { DEFINITION_SET } from "../../extensions.js";
|
|
4
|
+
import { fileListMismatches } from "../../planning/file-lists.js";
|
|
5
|
+
import { RUN_CLEANUP } from "../../shared/cleanup.js";
|
|
6
|
+
import { sandboxConnectPage } from "../../shared/dashboard.js";
|
|
7
|
+
import { acrossSandboxesJobSummaryMarkdown, jobSummaryMarkdown } from "../../shared/job-summary.js";
|
|
8
|
+
import { testsSummaryLines } from "../../shared/tests-summary.js";
|
|
9
|
+
import { paint } from "../../shared/text.js";
|
|
10
|
+
import { waterfallLines } from "../../shared/waterfall.js";
|
|
11
|
+
import { hasPoorParallelism, testsChart } from "../../shared/worker-chart.js";
|
|
12
|
+
import { acrossSandboxesEndLines, showsFailed } from "./sandbox-lines.js";
|
|
13
|
+
/** Counts final test results and partial-read flags across a run's recorded test events. */
|
|
14
|
+
export function countFinalResults(tests) {
|
|
15
|
+
return {
|
|
16
|
+
finalResults: tests.events.filter((event) => event.kind === "test-result").length,
|
|
17
|
+
partial: tests.unreadable > 0 || tests.incomplete !== undefined,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** Shortens a path under `$HOME` to `~/...` for display in summaries and headers. */
|
|
21
|
+
export function displayPath(path, env) {
|
|
22
|
+
const home = env["HOME"];
|
|
23
|
+
if (home === undefined || home === "" || !path.startsWith(`${home}/`))
|
|
24
|
+
return path;
|
|
25
|
+
return `~${path.slice(home.length)}`;
|
|
26
|
+
}
|
|
27
|
+
/** Ends a single run's recording, appends its job summary, finishes its view, and returns its timeline and test counts. */
|
|
28
|
+
export async function summarizeSingle(app, run) {
|
|
29
|
+
const { view, recording } = run;
|
|
30
|
+
const recorded = await recording.end(run.outcome);
|
|
31
|
+
const { timeline, tests } = recorded;
|
|
32
|
+
const logs = recording.opened.ok ? recording.opened.path : undefined;
|
|
33
|
+
const failed = tests.events.some((event) => event.kind === "test-result" && event.state === "fail");
|
|
34
|
+
const testsLines = testsSummaryLines(tests.events, run.hints, tests.unreadable, tests.incomplete);
|
|
35
|
+
const stepLogs = failedStepLogs(timeline, recording, app.env);
|
|
36
|
+
const clock = workerClock(recorded);
|
|
37
|
+
const charted = clock === undefined ? undefined : testsChart(tests.events, run.hints, tests.unreadable, clock, tests.incomplete);
|
|
38
|
+
const workersHint = charted !== undefined && hasPoorParallelism(charted.parallelism);
|
|
39
|
+
const summarized = await app.context.jobSummary.appendJobSummary(jobSummaryMarkdown(timeline, {
|
|
40
|
+
command: run.command,
|
|
41
|
+
logs,
|
|
42
|
+
details: [...testsLines, ...stepLogs],
|
|
43
|
+
}));
|
|
44
|
+
await view.finish(waterfallLines(timeline, {
|
|
45
|
+
width: view.width,
|
|
46
|
+
colorDepth: view.colorDepth,
|
|
47
|
+
logs: logsText(recording, recorded.writeFailure, app.env, failed, workersHint),
|
|
48
|
+
...(charted === undefined ? {} : { workers: charted.lanes }),
|
|
49
|
+
details: [...(charted?.notes ?? testsLines), ...stepLogs, ...jobSummaryFailureLines(summarized)],
|
|
50
|
+
}));
|
|
51
|
+
return { timeline, finalResults: countFinalResults(tests) };
|
|
52
|
+
}
|
|
53
|
+
/** Compares each runner sandbox's assigned file list against the test files it reported. */
|
|
54
|
+
export function listMismatches(recorded) {
|
|
55
|
+
return fileListMismatches(recorded.sandboxes.map(({ record, tests }) => ({
|
|
56
|
+
sandbox: record.sandbox,
|
|
57
|
+
files: record.files,
|
|
58
|
+
exitCode: record.exitCode,
|
|
59
|
+
reported: tests.events.map((event) => event.file),
|
|
60
|
+
whole: tests.unreadable === 0 && tests.incomplete === undefined,
|
|
61
|
+
})));
|
|
62
|
+
}
|
|
63
|
+
/** Appends a multi-sandbox run's job summary and finishes its view with per-sandbox waterfalls and the end table. */
|
|
64
|
+
export async function summarizeAcrossSandboxes(app, run) {
|
|
65
|
+
const { view, recording, recorded, hints } = run;
|
|
66
|
+
const style = paint(view.colorDepth !== "none");
|
|
67
|
+
const events = recorded.sandboxes.flatMap((sandbox) => sandbox.tests.events.map((event) => ({ ...event, sandbox: sandbox.record.sandbox })));
|
|
68
|
+
const testsLines = testsSummaryLines(events, hints, recorded.tests.unreadable, recorded.tests.incomplete);
|
|
69
|
+
const failed = events.some((event) => event.kind === "test-result" && event.state === "fail");
|
|
70
|
+
const opened = recording.opened;
|
|
71
|
+
const summarized = await app.context.jobSummary.appendJobSummary(acrossSandboxesJobSummaryMarkdown(recorded.sandboxes.map(({ record }) => record), { command: run.command, logs: opened.ok ? opened.path : undefined, details: testsLines }));
|
|
72
|
+
const ranSandboxes = run.outcome.kind === "sandboxes_ran" || run.outcome.kind === "canceled";
|
|
73
|
+
const sandboxes = recorded.sandboxes.map((sandbox) => {
|
|
74
|
+
const tests = sandbox.timeline.rows.find((row) => row.name === "command");
|
|
75
|
+
const charted = tests === undefined
|
|
76
|
+
? undefined
|
|
77
|
+
: testsChart(sandbox.tests.events, hints, sandbox.tests.unreadable, { runStartedAt: Date.parse(sandbox.timeline.startedAt), offsetMs: sandbox.workerOffsetMs, tests }, sandbox.tests.incomplete);
|
|
78
|
+
return {
|
|
79
|
+
sandbox: sandbox.record.sandbox,
|
|
80
|
+
waterfall: waterfallLines(sandbox.timeline, {
|
|
81
|
+
width: view.width,
|
|
82
|
+
colorDepth: view.colorDepth,
|
|
83
|
+
logs: undefined,
|
|
84
|
+
...(charted === undefined ? {} : { workers: charted.lanes, details: charted.notes }),
|
|
85
|
+
}),
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
const [first] = sandboxes;
|
|
89
|
+
const runId = opened.ok ? opened.id : undefined;
|
|
90
|
+
const records = recorded.sandboxes.map(({ record }) => record);
|
|
91
|
+
const lines = acrossSandboxesEndLines({
|
|
92
|
+
sandboxes: ranSandboxes ? sandboxes : [],
|
|
93
|
+
records,
|
|
94
|
+
tests: testsLines,
|
|
95
|
+
runId,
|
|
96
|
+
logs: logsText(recording, recorded.writeFailure, app.env, failed && !showsFailed(records, runId), false),
|
|
97
|
+
mismatches: run.mismatches,
|
|
98
|
+
...(run.extraMismatchHint === undefined ? {} : { extraMismatchHint: run.extraMismatchHint }),
|
|
99
|
+
paint: style,
|
|
100
|
+
});
|
|
101
|
+
const once = ranSandboxes || first === undefined ? [] : first.waterfall;
|
|
102
|
+
await view.finish([...once, ...lines, ...jobSummaryFailureLines(summarized)]);
|
|
103
|
+
}
|
|
104
|
+
/** Builds the `SandboxesRanFacts` payload for a completed run across runner sandboxes. */
|
|
105
|
+
export function sandboxesRanFacts(app, run) {
|
|
106
|
+
const { outcome, recorded, recording, plan, runner } = run;
|
|
107
|
+
const records = recorded.sandboxes.map(({ record }) => record);
|
|
108
|
+
const count = (state) => records.filter((record) => record.state === state).length;
|
|
109
|
+
const totals = records.flatMap(({ tests }) => (tests === null ? [] : [tests]));
|
|
110
|
+
const snapshotState = recorded.state.runner?.snapshot;
|
|
111
|
+
const { entry } = outcome.snapshot;
|
|
112
|
+
return {
|
|
113
|
+
version: app.version,
|
|
114
|
+
commit: app.commit,
|
|
115
|
+
configFile: run.configFile,
|
|
116
|
+
runId: recording.opened.ok ? recording.opened.id : null,
|
|
117
|
+
runDirectory: recording.opened.ok ? recording.opened.path : null,
|
|
118
|
+
sandboxes: records,
|
|
119
|
+
states: {
|
|
120
|
+
passed: count("passed"),
|
|
121
|
+
failed: count("failed"),
|
|
122
|
+
"not-started": count("not-started"),
|
|
123
|
+
canceled: count("canceled"),
|
|
124
|
+
},
|
|
125
|
+
tests: totals.length === 0
|
|
126
|
+
? null
|
|
127
|
+
: {
|
|
128
|
+
passed: totals.reduce((sum, { passed }) => sum + passed, 0),
|
|
129
|
+
failed: totals.reduce((sum, { failed }) => sum + failed, 0),
|
|
130
|
+
skipped: totals.reduce((sum, { skipped }) => sum + skipped, 0),
|
|
131
|
+
},
|
|
132
|
+
plan: {
|
|
133
|
+
...plan,
|
|
134
|
+
options: plan.options.map((option) => ({ ...option })),
|
|
135
|
+
...(plan.sandboxes === undefined ? {} : { sandboxes: { ...plan.sandboxes } }),
|
|
136
|
+
},
|
|
137
|
+
resources: DEFINITION_SET.reports.ranFacts(outcome.resources),
|
|
138
|
+
wallMs: recorded.wallMs,
|
|
139
|
+
runner: {
|
|
140
|
+
snapshotId: entry.snapshotId,
|
|
141
|
+
base: entry.base,
|
|
142
|
+
builtBehind: snapshotState !== undefined && snapshotState.kind !== "building" ? snapshotState.builtBehind : null,
|
|
143
|
+
built: outcome.snapshot.built,
|
|
144
|
+
vcpus: runner.prepared.vcpus,
|
|
145
|
+
region: entry.region,
|
|
146
|
+
runtime: entry.runtime,
|
|
147
|
+
uploadBytes: recorded.uploadBytes,
|
|
148
|
+
},
|
|
149
|
+
cleanup: RUN_CLEANUP.facts(outcome),
|
|
150
|
+
kept: outcome.sandboxes.flatMap(({ sandbox, runnerCleanup }) => {
|
|
151
|
+
const kept = runnerCleanup?.kept ?? null;
|
|
152
|
+
return kept === null
|
|
153
|
+
? []
|
|
154
|
+
: [
|
|
155
|
+
{
|
|
156
|
+
sandbox,
|
|
157
|
+
name: kept.name,
|
|
158
|
+
stopsAt: kept.stopsAt,
|
|
159
|
+
url: runner.target === null ? null : sandboxConnectPage(runner.target, kept.name),
|
|
160
|
+
},
|
|
161
|
+
];
|
|
162
|
+
}),
|
|
163
|
+
notKept: outcome.sandboxes.flatMap(({ sandbox, runnerCleanup }) => {
|
|
164
|
+
const notKept = runnerCleanup?.notKept ?? null;
|
|
165
|
+
return notKept === null ? [] : [{ sandbox, name: notKept.name, message: notKept.message }];
|
|
166
|
+
}),
|
|
167
|
+
fileListMismatches: run.mismatches.map(({ sandbox, missing, extra }) => ({
|
|
168
|
+
sandbox,
|
|
169
|
+
missing: [...missing],
|
|
170
|
+
extra: [...extra],
|
|
171
|
+
})),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function jobSummaryFailureLines(summarized) {
|
|
175
|
+
return summarized.kind === "failed"
|
|
176
|
+
? [` couldn't append to the job summary at ${summarized.failure.path}: ${summarized.failure.message}`]
|
|
177
|
+
: [];
|
|
178
|
+
}
|
|
179
|
+
function workerClock({ timeline, workerOffsetMs }) {
|
|
180
|
+
const tests = timeline.rows.find((row) => row.name === "command");
|
|
181
|
+
if (tests === undefined)
|
|
182
|
+
return undefined;
|
|
183
|
+
return { runStartedAt: Date.parse(timeline.startedAt), offsetMs: workerOffsetMs, tests };
|
|
184
|
+
}
|
|
185
|
+
function logsText({ opened }, writeFailure, env, failed, workersHint) {
|
|
186
|
+
if (!opened.ok)
|
|
187
|
+
return `none: couldn't make ${opened.failure.path}: ${opened.failure.message}`;
|
|
188
|
+
const path = `${displayPath(opened.path, env)}/`;
|
|
189
|
+
const problems = [
|
|
190
|
+
...(writeFailure === undefined ? [] : [`couldn't write ${writeFailure.path}: ${writeFailure.message}`]),
|
|
191
|
+
...opened.pruneFailures.slice(0, 1).map((failure) => `couldn't remove ${failure.path}: ${failure.message}`),
|
|
192
|
+
];
|
|
193
|
+
const flags = `${failed ? " --failed" : ""}${workersHint ? " --workers" : ""}`;
|
|
194
|
+
const show = `storm runs show ${opened.id}${flags}`;
|
|
195
|
+
return `${problems.length === 0 ? path : `${path} (${problems.join("; ")})`} · ${show}`;
|
|
196
|
+
}
|
|
197
|
+
function failedStepLogs(timeline, recording, env) {
|
|
198
|
+
const runner = timeline.rows.find((row) => row.name === "runner");
|
|
199
|
+
return (runner?.steps ?? [])
|
|
200
|
+
.filter((step) => step.outcome === "failed")
|
|
201
|
+
.flatMap((step) => {
|
|
202
|
+
const log = recording.stepLog(step.name);
|
|
203
|
+
return log === undefined ? [] : [` failed ${step.name}, whole output: ${displayPath(log, env)}`];
|
|
204
|
+
});
|
|
205
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { RunRunnerFailure } from "../../core/index.ts";
|
|
2
|
+
import type { CheckoutFailure, PrepareRunnerOutcome } from "../../runner/index.ts";
|
|
3
|
+
/**
|
|
4
|
+
* The refusal for a runner whose local checks failed: no base, submodules, runner options storm can't use at the run's
|
|
5
|
+
* base or for its sandbox count (`invalid_config`, naming the key inside `runner`), or git or tar failing.
|
|
6
|
+
*/
|
|
7
|
+
export declare function prepareRefusal(prepared: Exclude<PrepareRunnerOutcome, {
|
|
8
|
+
readonly kind: "ok";
|
|
9
|
+
}>, configFile: string | null): import("@vercel/clinkr").CommandError<"invalid_config"> | import("@vercel/clinkr").CommandError<"no_base_ref"> | import("@vercel/clinkr").CommandError<"runner_failed"> | import("@vercel/clinkr").CommandError<"submodules_refused">;
|
|
10
|
+
/**
|
|
11
|
+
* The refusal for a run in a runner sandbox whose checkout git couldn't read before anything was minted, acquired, or
|
|
12
|
+
* started: `runner_failed` with `checkout-failed`, holding nothing.
|
|
13
|
+
*/
|
|
14
|
+
export declare function checkoutFailedRefusal(failure: CheckoutFailure): import("@vercel/clinkr").CommandError<"runner_failed">;
|
|
15
|
+
/**
|
|
16
|
+
* Each resource's resolved options, by resource key: what a Vercel Sandbox runner's declared `vcpus` rule reads.
|
|
17
|
+
*/
|
|
18
|
+
export declare function vcpuResources(requests: Readonly<Record<string, {
|
|
19
|
+
readonly definition: string;
|
|
20
|
+
readonly options: unknown;
|
|
21
|
+
}>>): {
|
|
22
|
+
readonly [key: string]: Readonly<Record<string, unknown>>;
|
|
23
|
+
};
|
|
24
|
+
/** A runner failure as outcomes report it. */
|
|
25
|
+
export declare function runnerFailureFacts(failure: RunRunnerFailure): {
|
|
26
|
+
message?: never;
|
|
27
|
+
kind: "apply-failed" | "build-failed" | "install-failed" | "snapshot-build-step-failed";
|
|
28
|
+
label: string;
|
|
29
|
+
exitCode: number | null;
|
|
30
|
+
tail: string[];
|
|
31
|
+
command?: never;
|
|
32
|
+
operation?: never;
|
|
33
|
+
around?: never;
|
|
34
|
+
reason?: never;
|
|
35
|
+
status?: never;
|
|
36
|
+
} | {
|
|
37
|
+
label?: never;
|
|
38
|
+
exitCode?: never;
|
|
39
|
+
tail?: never;
|
|
40
|
+
kind: "sandbox-api-failed";
|
|
41
|
+
operation: import("../../runner/events.ts").RunnerSandboxCall;
|
|
42
|
+
status: number | null;
|
|
43
|
+
message: string;
|
|
44
|
+
command?: never;
|
|
45
|
+
around?: never;
|
|
46
|
+
reason?: never;
|
|
47
|
+
} | {
|
|
48
|
+
label?: never;
|
|
49
|
+
exitCode?: never;
|
|
50
|
+
tail?: never;
|
|
51
|
+
kind: "checkout-failed";
|
|
52
|
+
message: string;
|
|
53
|
+
command: string | null;
|
|
54
|
+
operation?: never;
|
|
55
|
+
around?: never;
|
|
56
|
+
reason?: never;
|
|
57
|
+
status?: never;
|
|
58
|
+
} | {
|
|
59
|
+
label?: never;
|
|
60
|
+
exitCode?: never;
|
|
61
|
+
tail?: never;
|
|
62
|
+
command?: never;
|
|
63
|
+
kind: "network-policy-failed";
|
|
64
|
+
operation: "inject" | "remove";
|
|
65
|
+
around: import("../../runner/events.ts").NetworkPolicyPlace;
|
|
66
|
+
reason: "api" | "timed-out";
|
|
67
|
+
status: number | null;
|
|
68
|
+
message: string;
|
|
69
|
+
} | {
|
|
70
|
+
team: string;
|
|
71
|
+
project: string;
|
|
72
|
+
message?: never;
|
|
73
|
+
label?: never;
|
|
74
|
+
exitCode?: never;
|
|
75
|
+
tail?: never;
|
|
76
|
+
command?: never;
|
|
77
|
+
operation?: never;
|
|
78
|
+
around?: never;
|
|
79
|
+
reason?: never;
|
|
80
|
+
status?: never;
|
|
81
|
+
kind: "credential-claims-missing";
|
|
82
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Shared runner preparation refusal and failure-fact mappers used by runs (`execute-run.ts`, `driver-plan.ts`) and
|
|
2
|
+
// snapshot commands (`commands/snapshots/`).
|
|
3
|
+
import { invalidConfig } from "../../config/index.js";
|
|
4
|
+
import { RUN_CLEANUP } from "../../shared/cleanup.js";
|
|
5
|
+
import { runErrors } from "./outcomes.js";
|
|
6
|
+
/** The cleanup of a run that never started a runner sandbox or acquired a resource. */
|
|
7
|
+
const NOTHING_RELEASED = { runnerCleanup: null, resourceCleanup: {} };
|
|
8
|
+
/**
|
|
9
|
+
* The refusal for a runner whose local checks failed: no base, submodules, runner options storm can't use at the run's
|
|
10
|
+
* base or for its sandbox count (`invalid_config`, naming the key inside `runner`), or git or tar failing.
|
|
11
|
+
*/
|
|
12
|
+
export function prepareRefusal(prepared, configFile) {
|
|
13
|
+
switch (prepared.kind) {
|
|
14
|
+
case "no-base-ref":
|
|
15
|
+
return runErrors.noBaseRef({ refs: prepared.refs.map(({ ref, reason }) => ({ ref, reason })) });
|
|
16
|
+
case "submodules":
|
|
17
|
+
return runErrors.submodulesRefused({ paths: [...prepared.paths] });
|
|
18
|
+
case "invalid-runner":
|
|
19
|
+
return invalidConfig(configFile ?? "", [
|
|
20
|
+
{ key: ["runner", ...prepared.path].join("."), location: null, problem: prepared.problem },
|
|
21
|
+
]);
|
|
22
|
+
case "checkout-failed":
|
|
23
|
+
return checkoutFailedRefusal(prepared.failure);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The refusal for a run in a runner sandbox whose checkout git couldn't read before anything was minted, acquired, or
|
|
28
|
+
* started: `runner_failed` with `checkout-failed`, holding nothing.
|
|
29
|
+
*/
|
|
30
|
+
export function checkoutFailedRefusal(failure) {
|
|
31
|
+
return runErrors.runnerFailed({
|
|
32
|
+
failure: runnerFailureFacts({ kind: "checkout-failed", failure }),
|
|
33
|
+
cleanup: RUN_CLEANUP.facts(NOTHING_RELEASED),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Each resource's resolved options, by resource key: what a Vercel Sandbox runner's declared `vcpus` rule reads.
|
|
38
|
+
*/
|
|
39
|
+
export function vcpuResources(requests) {
|
|
40
|
+
return Object.fromEntries(Object.entries(requests).map(([key, { options }]) => {
|
|
41
|
+
// A resource's options are the plain values its definition merges to: always an object.
|
|
42
|
+
if (typeof options !== "object" || options === null)
|
|
43
|
+
throw new Error(`${key}'s options are not an object`);
|
|
44
|
+
return [key, options];
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
/** A runner failure as outcomes report it. */
|
|
48
|
+
export function runnerFailureFacts(failure) {
|
|
49
|
+
switch (failure.kind) {
|
|
50
|
+
case "snapshot-build-step-failed":
|
|
51
|
+
case "apply-failed":
|
|
52
|
+
case "install-failed":
|
|
53
|
+
case "build-failed":
|
|
54
|
+
return { kind: failure.kind, label: failure.label, exitCode: failure.exitCode, tail: [...failure.tail] };
|
|
55
|
+
case "sandbox-api-failed":
|
|
56
|
+
return { kind: failure.kind, operation: failure.operation, status: failure.status, message: failure.message };
|
|
57
|
+
case "checkout-failed":
|
|
58
|
+
return { kind: failure.kind, message: failure.failure.message, command: failure.failure.displayCommand ?? null };
|
|
59
|
+
case "network-policy-failed":
|
|
60
|
+
return {
|
|
61
|
+
kind: failure.kind,
|
|
62
|
+
operation: failure.operation,
|
|
63
|
+
around: failure.around,
|
|
64
|
+
reason: failure.reason,
|
|
65
|
+
status: failure.status,
|
|
66
|
+
message: failure.message,
|
|
67
|
+
};
|
|
68
|
+
case "credential-claims-missing":
|
|
69
|
+
return { kind: failure.kind, ...failure.target };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -60,6 +60,9 @@ function endTone(state, style) {
|
|
|
60
60
|
}
|
|
61
61
|
export function sandboxProgress(options) {
|
|
62
62
|
const { count } = options;
|
|
63
|
+
// Intentional `{ github: false }`: runs across runner sandboxes suppress `step-output` lines on the terminal (step
|
|
64
|
+
// logs stay in each runner sandbox entry), so GitHub Actions `::group::` folds for step output would wrap empty
|
|
65
|
+
// groups.
|
|
63
66
|
const own = plainRenderer({ github: false });
|
|
64
67
|
let origin;
|
|
65
68
|
let started = false;
|