@cnc-tools/storm 0.16.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-P357TZAY.js → chunk-4O5C2XGJ.js} +18 -15
- package/dist/chunks/{chunk-VL7WFTVQ.js → chunk-4WAMTUWZ.js} +419 -340
- package/dist/chunks/{chunk-OIY3DMF2.js → chunk-6UHIJXZG.js} +3 -3
- package/dist/chunks/{chunk-CN4EFA5J.js → chunk-72ZFEMAW.js} +1 -1
- package/dist/chunks/{chunk-CK2GZEPK.js → chunk-7DZE67QM.js} +2 -2
- package/dist/chunks/{chunk-VUPZH7J2.js → chunk-BCBKYOHW.js} +1 -1
- package/dist/chunks/{chunk-2MAD5NKK.js → chunk-CKGZA25H.js} +1 -18
- package/dist/chunks/{chunk-ZG3WQ4UF.js → chunk-D27KILIA.js} +1 -1
- package/dist/chunks/{chunk-V4IKA3WI.js → chunk-DADEYJDW.js} +24 -17
- package/dist/chunks/{chunk-R7XVBZOY.js → chunk-EEENLQHE.js} +59 -11
- package/dist/chunks/chunk-F4MOYHRY.js +198 -0
- package/dist/chunks/{chunk-HVNK3I45.js → chunk-FNBB6V4R.js} +1 -1
- package/dist/chunks/{chunk-G3PHMXH5.js → chunk-GRT3UIBV.js} +18 -1
- package/dist/chunks/chunk-HP3CURSZ.js +88 -0
- package/dist/chunks/{chunk-DWEAHX4T.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-3L52KNQA.js → chunk-M7EKRGVD.js} +8 -8
- package/dist/chunks/chunk-MR77L2GK.js +340 -0
- package/dist/chunks/{chunk-DC2CDHNK.js → chunk-RNAS7JHE.js} +1438 -445
- package/dist/chunks/{chunk-FCQUJDA4.js → chunk-RWIXDDCK.js} +4 -189
- 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-FOZWA52V.js → chunk-YEPFSLQR.js} +480 -375
- package/dist/chunks/{live-app-WECQOQ4C.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 +2 -2
- 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 +31 -2
- 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 +34 -8
- package/dist/commands/exec/outcomes.js +30 -23
- package/dist/commands/exec/plan-run.d.ts +58 -150
- package/dist/commands/exec/plan-run.js +232 -88
- package/dist/commands/exec/progress.d.ts +10 -6
- package/dist/commands/exec/progress.js +38 -25
- package/dist/commands/exec/run-bin.d.ts +11 -11
- package/dist/commands/exec/run-bin.js +9 -9
- package/dist/commands/exec/run-flags.d.ts +69 -0
- package/dist/commands/exec/run-flags.js +58 -0
- package/dist/commands/exec/run-metadata.js +4 -4
- package/dist/commands/exec/run-summary.d.ts +58 -0
- package/dist/commands/exec/run-summary.js +205 -0
- package/dist/commands/exec/runner-refusals.d.ts +82 -0
- package/dist/commands/exec/runner-refusals.js +71 -0
- package/dist/commands/exec/sandbox-progress.js +3 -0
- package/dist/commands/exec/stopped-outcome.d.ts +12 -0
- package/dist/commands/exec/stopped-outcome.js +77 -0
- package/dist/commands/exec/view.d.ts +20 -11
- package/dist/commands/exec/view.js +103 -47
- package/dist/commands/runs/facts.d.ts +7 -3
- package/dist/commands/runs/facts.js +17 -8
- package/dist/commands/runs/list/command.d.ts +14 -6
- package/dist/commands/runs/list/command.js +10 -10
- package/dist/commands/runs/list/outcomes.d.ts +7 -3
- package/dist/commands/runs/logs/command.js +10 -10
- package/dist/commands/runs/show/command.d.ts +14 -6
- package/dist/commands/runs/show/command.js +30 -28
- package/dist/commands/runs/show/outcomes.d.ts +7 -3
- 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 +366 -25
- 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 +17 -17
- package/dist/commands/suites/list/outcomes.js +2 -2
- package/dist/commands/test/command.d.ts +31 -2
- package/dist/commands/test/command.js +49 -252
- package/dist/commands/test/outcomes.d.ts +15 -1
- package/dist/config/check-runner.d.ts +3 -3
- package/dist/config/check-runner.js +8 -7
- package/dist/config/credential-resolver.d.ts +50 -5
- package/dist/config/credential-resolver.js +51 -19
- package/dist/config/credential-settle.d.ts +6 -2
- package/dist/config/credential-settle.js +11 -5
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +1 -1
- package/dist/config/runner.d.ts +5 -5
- package/dist/config/runner.js +1 -1
- package/dist/config/schema.d.ts +2 -2
- package/dist/config/schema.js +1 -1
- package/dist/config-file/define.d.ts +1 -1
- package/dist/config-file/define.js +1 -1
- package/dist/config-file/runner.d.ts +5 -5
- package/dist/config-file/toolchain.d.ts +1 -1
- package/dist/config-file/toolchain.js +2 -2
- 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/testserver/commands/pool/create/command.d.ts +35 -2
- package/dist/extensions/testserver/commands/pool/create/command.js +7 -7
- package/dist/extensions/testserver/commands/pool/create/metadata.js +5 -5
- package/dist/extensions/testserver/commands/pool/create/outcomes.d.ts +17 -1
- package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
- package/dist/extensions/testserver/credential-facts.d.ts +6 -2
- package/dist/extensions/testserver/credential-facts.js +29 -11
- package/dist/extensions/testserver/lifecycle.js +7 -1
- package/dist/extensions/testserver/limit.d.ts +3 -0
- package/dist/extensions/testserver/limit.js +3 -0
- package/dist/extensions/testserver/provision.d.ts +8 -1
- package/dist/extensions/testserver/provision.js +8 -3
- package/dist/extensions/testserver/refusals.d.ts +6 -1
- package/dist/extensions/testserver/refusals.js +16 -1
- package/dist/extensions/testserver/resource.d.ts +1 -1
- package/dist/extensions/testserver/resource.js +1 -1
- package/dist/extensions/testserver/result.d.ts +1 -1
- package/dist/extensions/testserver/result.js +9 -4
- package/dist/planning/driver-file-lists.d.ts +0 -15
- package/dist/planning/driver-file-lists.js +2 -21
- package/dist/planning/plan-only.d.ts +3 -14
- package/dist/planning/plan-only.js +11 -20
- package/dist/planning/run-kind-flags.js +2 -2
- package/dist/planning/run-plan.d.ts +45 -12
- package/dist/planning/run-plan.js +4 -3
- package/dist/planning/suites.d.ts +1 -1
- package/dist/planning/suites.js +2 -2
- package/dist/planning/test-plan.d.ts +9 -0
- package/dist/planning/test-plan.js +9 -0
- package/dist/run-directory/recording.js +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.js +1 -1
- package/dist/runner/build-snapshots.d.ts +55 -29
- package/dist/runner/build-snapshots.js +130 -29
- package/dist/runner/context.d.ts +15 -7
- package/dist/runner/context.js +19 -6
- package/dist/runner/events.d.ts +16 -10
- package/dist/runner/gateways.d.ts +87 -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 +129 -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 +14 -14
- package/dist/runner/prepare.js +20 -11
- 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 +32 -29
- package/dist/runner/snapshot-choice.js +1 -1
- package/dist/runner/snapshot-inspect.d.ts +39 -40
- package/dist/runner/snapshot-inspect.js +55 -35
- package/dist/runner/snapshot-key.d.ts +13 -12
- package/dist/runner/snapshot-key.js +13 -12
- 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} +24 -23
- package/dist/runner/{recipe.js → vercel-sandbox-options.js} +70 -69
- 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 +1 -1
- package/dist/sdk/extension/secret-source.d.ts +1 -1
- package/dist/sdk/extension/secret-source.js +1 -1
- package/dist/sdk/extension/vercel-oidc-facts.d.ts +20 -0
- package/dist/sdk/extension/vercel-oidc-facts.js +20 -0
- package/dist/shared/cleanup.d.ts +3 -3
- package/dist/shared/cleanup.js +15 -5
- package/dist/shared/snapshot-text.d.ts +4 -4
- package/dist/shared/snapshot-text.js +11 -11
- package/dist/time/duration.js +1 -1
- package/package.json +3 -2
- package/skills/overview.md +4 -4
- package/skills/plan-runs.md +1 -1
- package/skills/read-run-output.md +6 -6
- package/dist/chunks/chunk-7EENF73W.js +0 -782
- package/dist/chunks/chunk-Z5PBVG3Y.js +0 -2599
- package/dist/commands/exec/across-sandboxes-run.d.ts +0 -180
- package/dist/commands/exec/across-sandboxes-run.js +0 -339
- package/dist/commands/exec/plan-only.d.ts +0 -10
- package/dist/commands/exec/plan-only.js +0 -45
- package/dist/commands/exec/run-command.d.ts +0 -475
- package/dist/commands/exec/run-command.js +0 -603
- package/dist/commands/exec/run-planned.d.ts +0 -20
- package/dist/commands/exec/run-planned.js +0 -22
- package/dist/commands/exec/sandbox-view.d.ts +0 -19
- package/dist/commands/exec/sandbox-view.js +0 -72
- package/dist/commands/test/plan.d.ts +0 -92
- package/dist/commands/test/plan.js +0 -125
- package/dist/core/sandbox-end.d.ts +0 -64
- package/dist/runner/live/snapshot-cache-gateway.d.ts +0 -12
- package/dist/runner/snapshot-cache.d.ts +0 -148
- package/dist/runner/snapshot-cache.js +0 -126
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { path, renderOutcome } from "@vercel/clinkr/vcli-kit";
|
|
2
2
|
import { defineOutcomes } from "@vercel/clinkr";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { configErrors } from "../../../config/index.js";
|
|
4
|
+
import { configErrors, credentialErrors, credentialSourceErrors } from "../../../config/index.js";
|
|
5
5
|
import { suiteNotFoundErrors } from "../../../planning/suite-not-found.js";
|
|
6
6
|
import { builtAtText, REJECTION_REASONS, REJECTIONS_SHOWN, rejectionText } from "../../../shared/snapshot-text.js";
|
|
7
7
|
import { short } from "../../../shared/text.js";
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import { runErrors } from "../../exec/outcomes.js";
|
|
9
|
+
import { PROJECT_FIELDS, projectDisplayText, sharedListFailedError } from "../access.js";
|
|
10
|
+
/** Why a run here doesn't start from a snapshot: a run's own reasons, or that it is another runner's. */
|
|
11
|
+
const reasonSchema = z.enum([...REJECTION_REASONS, "other-runner"]);
|
|
10
12
|
const snapshotSchema = z.object({
|
|
11
13
|
/** The snapshot's id in Vercel Sandbox. */
|
|
12
14
|
snapshotId: z.string(),
|
|
13
|
-
/** The runner
|
|
14
|
-
|
|
15
|
+
/** The Vercel Sandbox runner's name, region, and runtime it was built for. */
|
|
16
|
+
runner: z.string(),
|
|
15
17
|
region: z.string(),
|
|
16
18
|
runtime: z.string(),
|
|
17
19
|
/** The team and project ids it was built for. */
|
|
@@ -26,43 +28,118 @@ const snapshotSchema = z.object({
|
|
|
26
28
|
/** When it was created and when it expires, as ISO times. */
|
|
27
29
|
createdAt: z.string(),
|
|
28
30
|
expiresAt: z.string(),
|
|
29
|
-
/** Whether it had expired when storm read the
|
|
31
|
+
/** Whether it had expired when storm read the local snapshot index. */
|
|
30
32
|
expired: z.boolean(),
|
|
31
33
|
/** Whether a run here, with a credential for its team and project, starts from it. */
|
|
32
34
|
picked: z.boolean(),
|
|
33
|
-
/** Why a run here doesn't start from it; null for a picked one, and when storm picked for no
|
|
35
|
+
/** Why a run here doesn't start from it; null for a picked one, and when storm picked for no runner. */
|
|
34
36
|
reason: reasonSchema.nullable(),
|
|
35
37
|
});
|
|
38
|
+
/** One entry of the shared snapshot index, as `--shared` lists it. */
|
|
39
|
+
const sharedEntrySchema = z.object({
|
|
40
|
+
/** The stopped named sandbox that holds the entry in the Vercel project. */
|
|
41
|
+
sandboxName: z.string(),
|
|
42
|
+
/** Its base, the commit it was built at, a full SHA. */
|
|
43
|
+
base: z.string(),
|
|
44
|
+
/**
|
|
45
|
+
* What storm verified of it: `ready` (its snapshot exists, is created, and has more than an hour left),
|
|
46
|
+
* `expires-soon` (its snapshot is created and unexpired, but has an hour or less left), `unknown-expiry` (its
|
|
47
|
+
* snapshot is created, but neither the snapshot nor the sandbox tag carries a valid expiry timestamp), `building`
|
|
48
|
+
* (a build still owns the sandbox), `expired` (its snapshot is created, but expired), `missing` (its snapshot is not
|
|
49
|
+
* found or not created), `no-snapshot` (the sandbox holds no snapshot), or `failed` (the build sandbox ended failed
|
|
50
|
+
* or aborted).
|
|
51
|
+
*/
|
|
52
|
+
status: z.enum([
|
|
53
|
+
"ready",
|
|
54
|
+
"expires-soon",
|
|
55
|
+
"unknown-expiry",
|
|
56
|
+
"building",
|
|
57
|
+
"expired",
|
|
58
|
+
"missing",
|
|
59
|
+
"no-snapshot",
|
|
60
|
+
"failed",
|
|
61
|
+
]),
|
|
62
|
+
/** The sandbox's own status, such as `stopped`, `running`, or `snapshotting`. */
|
|
63
|
+
sandboxStatus: z.string(),
|
|
64
|
+
/** The snapshot's id and status in Vercel Sandbox; null when the sandbox holds none or storm didn't read it. */
|
|
65
|
+
snapshotId: z.string().nullable(),
|
|
66
|
+
snapshotStatus: z.string().nullable(),
|
|
67
|
+
/** When it was created, and when it expires, as ISO times; `expiresAt` is null when storm doesn't know. */
|
|
68
|
+
createdAt: z.string(),
|
|
69
|
+
expiresAt: z.string().nullable(),
|
|
70
|
+
/** Whether it had expired when storm read the index. */
|
|
71
|
+
expired: z.boolean(),
|
|
72
|
+
/** Whether a run here starts from this shared entry (beating or filling in for the local snapshot index). */
|
|
73
|
+
picked: z.boolean(),
|
|
74
|
+
/** How many commits HEAD has that this entry's base lacks, when the entry is ready and at or behind the merge-base; else null. */
|
|
75
|
+
builtBehind: z.number().nullable(),
|
|
76
|
+
});
|
|
77
|
+
/** What `--shared` found in the shared snapshot index, or why it listed nothing. */
|
|
78
|
+
const sharedSchema = z.discriminatedUnion("kind", [
|
|
79
|
+
z.object({
|
|
80
|
+
kind: z.literal("listed"),
|
|
81
|
+
/** The Vercel project whose shared snapshot index it read. */
|
|
82
|
+
...PROJECT_FIELDS,
|
|
83
|
+
/** The runner's bucket: 16 hex characters in each entry's sandbox name. */
|
|
84
|
+
bucket: z.string(),
|
|
85
|
+
/** The bucket's entries, as the Sandbox API listed them. */
|
|
86
|
+
entries: z.array(sharedEntrySchema),
|
|
87
|
+
}),
|
|
88
|
+
z.object({
|
|
89
|
+
kind: z.literal("not-listed"),
|
|
90
|
+
/** Why storm has no bucket to read: no Git checkout, no Vercel Sandbox runner, or no base ref that shares history with HEAD. */
|
|
91
|
+
why: z.enum(["no-checkout", "no-runner", "no-base"]),
|
|
92
|
+
}),
|
|
93
|
+
]);
|
|
94
|
+
/** One shared snapshot index entry, with what the pick across both indexes says of it, as the result reports it. */
|
|
95
|
+
export function sharedEntryFacts(selection) {
|
|
96
|
+
const { entry } = selection;
|
|
97
|
+
return {
|
|
98
|
+
sandboxName: entry.sandboxName,
|
|
99
|
+
base: entry.base,
|
|
100
|
+
status: entry.status,
|
|
101
|
+
sandboxStatus: entry.sandboxStatus,
|
|
102
|
+
snapshotId: entry.snapshotId ?? null,
|
|
103
|
+
snapshotStatus: entry.snapshotStatus ?? null,
|
|
104
|
+
createdAt: entry.createdAt,
|
|
105
|
+
expiresAt: entry.expiresAt ?? null,
|
|
106
|
+
expired: entry.expired,
|
|
107
|
+
picked: selection.picked,
|
|
108
|
+
builtBehind: selection.builtBehind,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
36
111
|
const listedSchema = z.object({
|
|
37
|
-
/** Where the
|
|
112
|
+
/** Where the local snapshot index lives. */
|
|
38
113
|
directory: z.string(),
|
|
39
|
-
/** The config file whose runner
|
|
114
|
+
/** The config file whose Vercel Sandbox runner storm picked for; null when none applies. */
|
|
40
115
|
configFile: z.string().nullable(),
|
|
41
|
-
/** The
|
|
116
|
+
/** The runner a run here uses, when storm marked what it starts from; else why it marked nothing: the directory is in no Git checkout, no Vercel Sandbox runner applies, or no base ref of the runner shares history with HEAD. */
|
|
42
117
|
picking: z.discriminatedUnion("kind", [
|
|
43
|
-
z.object({ kind: z.literal("
|
|
44
|
-
z.object({ kind: z.literal("none"), why: z.enum(["no-checkout", "no-
|
|
118
|
+
z.object({ kind: z.literal("runner"), runner: z.string() }),
|
|
119
|
+
z.object({ kind: z.literal("none"), why: z.enum(["no-checkout", "no-runner", "no-base"]) }),
|
|
45
120
|
]),
|
|
46
|
-
/** Whether --all asked for other
|
|
121
|
+
/** Whether --all asked for other runners' snapshots too. */
|
|
47
122
|
all: z.boolean(),
|
|
48
123
|
/** HEAD's commit, a full SHA; null outside a Git checkout. */
|
|
49
124
|
head: z.string().nullable(),
|
|
50
|
-
/** HEAD's merge-base with a base ref of the
|
|
125
|
+
/** HEAD's merge-base with a base ref of the runner, a full SHA, and that ref; null when storm picked for no runner. */
|
|
51
126
|
mergeBase: z.string().nullable(),
|
|
52
127
|
mergeBaseRef: z.string().nullable(),
|
|
53
|
-
/** When storm read the
|
|
128
|
+
/** When storm read the local snapshot index, as an ISO time: what "ago" and "in" count from. */
|
|
54
129
|
readAt: z.string(),
|
|
55
|
-
/** The
|
|
56
|
-
|
|
57
|
-
/** The
|
|
130
|
+
/** The local snapshot index entries, in the table's order. */
|
|
131
|
+
local: z.array(snapshotSchema),
|
|
132
|
+
/** The local snapshot index files storm can't read, each with why. */
|
|
58
133
|
unreadable: z.array(z.object({ file: z.string(), reason: z.string() })),
|
|
134
|
+
/** With --shared, what the shared snapshot index of the Vercel project holds for the runner; null without --shared. */
|
|
135
|
+
shared: sharedSchema.nullable(),
|
|
59
136
|
});
|
|
60
137
|
/** One inspected snapshot as the result reports it. */
|
|
61
138
|
export function snapshotFacts(snapshot) {
|
|
62
139
|
const { entry } = snapshot;
|
|
63
140
|
return {
|
|
64
141
|
snapshotId: entry.snapshotId,
|
|
65
|
-
|
|
142
|
+
runner: entry.runnerName,
|
|
66
143
|
region: entry.region,
|
|
67
144
|
runtime: entry.runtime,
|
|
68
145
|
teamId: entry.teamId,
|
|
@@ -99,54 +176,139 @@ function baseCell(snapshot) {
|
|
|
99
176
|
const where = snapshot.builtBehind === 0 ? ", HEAD" : snapshot.inHistory === false ? ", not in history" : "";
|
|
100
177
|
return `${short(snapshot.base)}${where}`;
|
|
101
178
|
}
|
|
102
|
-
/** The table's rows, one per snapshot, with a `
|
|
179
|
+
/** The table's rows, one per snapshot, with a `RUNNER` column under `--all`. */
|
|
103
180
|
function tableOf(listed) {
|
|
104
181
|
const now = Date.parse(listed.readAt);
|
|
105
|
-
const
|
|
182
|
+
const runnerColumn = listed.all || listed.picking.kind === "none";
|
|
106
183
|
return {
|
|
107
|
-
columns: ["", "BASE", "CREATED", "EXPIRES", ...(
|
|
108
|
-
rows: listed.
|
|
184
|
+
columns: ["", "BASE", "CREATED", "EXPIRES", ...(runnerColumn ? ["RUNNER"] : []), "ID"],
|
|
185
|
+
rows: listed.local.map((snapshot) => [
|
|
109
186
|
snapshot.picked ? "▸" : "",
|
|
110
187
|
baseCell(snapshot),
|
|
111
188
|
`${spanText(now - Date.parse(snapshot.createdAt))} ago`,
|
|
112
189
|
snapshot.expired ? "expired" : `in ${spanText(Date.parse(snapshot.expiresAt) - now)}`,
|
|
113
|
-
...(
|
|
190
|
+
...(runnerColumn ? [snapshot.runner] : []),
|
|
114
191
|
snapshot.snapshotId,
|
|
115
192
|
]),
|
|
116
193
|
};
|
|
117
194
|
}
|
|
118
|
-
/**
|
|
195
|
+
/** A shared entry's status in words, for its row. */
|
|
196
|
+
function sharedStatusText(entry) {
|
|
197
|
+
switch (entry.status) {
|
|
198
|
+
case "ready":
|
|
199
|
+
return "ready";
|
|
200
|
+
case "expires-soon":
|
|
201
|
+
return "expires soon";
|
|
202
|
+
case "unknown-expiry":
|
|
203
|
+
return "expiry unknown";
|
|
204
|
+
case "building":
|
|
205
|
+
return `building (${entry.sandboxStatus})`;
|
|
206
|
+
case "expired":
|
|
207
|
+
return "expired";
|
|
208
|
+
case "missing":
|
|
209
|
+
return "missing";
|
|
210
|
+
case "no-snapshot":
|
|
211
|
+
return "no snapshot";
|
|
212
|
+
case "failed":
|
|
213
|
+
return entry.sandboxStatus === "aborted" ? "aborted" : "failed";
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/** A shared entry's expiry in words, for its row. */
|
|
217
|
+
function sharedExpiresText(entry, now) {
|
|
218
|
+
if (entry.expiresAt === null || Number.isNaN(Date.parse(entry.expiresAt)))
|
|
219
|
+
return "expiry unknown";
|
|
220
|
+
return `expires in ${spanText(Date.parse(entry.expiresAt) - now)}`;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The sections of `--shared`: `Shared snapshot index`, with the team and project, and one row per entry, labeled by its base
|
|
224
|
+
* (with `▸ ` when a run here starts from it), with its status, when it was created, when it expires, and its snapshot
|
|
225
|
+
* id; then, when the cache holds any, a label for the table of this machine's snapshots below.
|
|
226
|
+
*/
|
|
227
|
+
function sharedSections(listed) {
|
|
228
|
+
const { shared } = listed;
|
|
229
|
+
if (shared === null)
|
|
230
|
+
return [];
|
|
231
|
+
// A label right above the table, so it doesn't read as part of the shared snapshot index.
|
|
232
|
+
const local = listed.local.length === 0
|
|
233
|
+
? []
|
|
234
|
+
: [
|
|
235
|
+
{
|
|
236
|
+
heading: "Local index",
|
|
237
|
+
rows: [["Snapshots", `${listed.local.length}, in the table below`]],
|
|
238
|
+
},
|
|
239
|
+
];
|
|
240
|
+
if (shared.kind === "not-listed")
|
|
241
|
+
return [{ heading: "Shared snapshot index", rows: [["Not listed", UNPICKED_TEXT[shared.why]]] }, ...local];
|
|
242
|
+
const now = Date.parse(listed.readAt);
|
|
243
|
+
const entries = shared.entries.toSorted((a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt) || a.sandboxName.localeCompare(b.sandboxName));
|
|
244
|
+
return [
|
|
245
|
+
{
|
|
246
|
+
heading: "Shared snapshot index",
|
|
247
|
+
rows: [
|
|
248
|
+
["Project", projectDisplayText(shared)],
|
|
249
|
+
...(entries.length === 0
|
|
250
|
+
? [["Entries", "none"]]
|
|
251
|
+
: entries.map((entry) => [
|
|
252
|
+
`${entry.picked ? "▸ " : ""}${short(entry.base)}`,
|
|
253
|
+
[
|
|
254
|
+
sharedStatusText(entry),
|
|
255
|
+
`created ${spanText(now - Date.parse(entry.createdAt))} ago`,
|
|
256
|
+
...(entry.status === "ready" || entry.status === "expires-soon"
|
|
257
|
+
? [sharedExpiresText(entry, now)]
|
|
258
|
+
: []),
|
|
259
|
+
...(entry.snapshotId === null ? [] : [`snapshot ${entry.snapshotId}`]),
|
|
260
|
+
].join(", "),
|
|
261
|
+
])),
|
|
262
|
+
],
|
|
263
|
+
},
|
|
264
|
+
...local,
|
|
265
|
+
];
|
|
266
|
+
}
|
|
267
|
+
/** Why storm marked no snapshot, when it picked for no runner. */
|
|
119
268
|
const UNPICKED_TEXT = {
|
|
120
269
|
"no-checkout": "This directory is in no Git checkout, so storm can't say which snapshot a run starts from.",
|
|
121
|
-
"no-
|
|
122
|
-
"no-base": "No base ref of the runner
|
|
270
|
+
"no-runner": "No Vercel Sandbox runner applies here, so no run here starts from one of them.",
|
|
271
|
+
"no-base": "No base ref of the runner shares history with HEAD, so a run here can't pick a base.",
|
|
123
272
|
};
|
|
124
273
|
/**
|
|
125
|
-
* The lines after the table: for each team and project, the snapshot a run here starts from
|
|
126
|
-
*
|
|
274
|
+
* The lines after the table: for each team and project, the snapshot a run here starts from (from the local snapshot
|
|
275
|
+
* index or, with `--shared`, the shared snapshot index), or that it builds a runner snapshot; then why it starts from
|
|
276
|
+
* none of the runner's others, `REJECTIONS_SHOWN` at most.
|
|
127
277
|
*/
|
|
128
278
|
function explanationOf(listed) {
|
|
129
279
|
if (listed.picking.kind === "none")
|
|
130
280
|
return UNPICKED_TEXT[listed.picking.why];
|
|
131
|
-
const
|
|
132
|
-
const
|
|
281
|
+
const ofRunner = listed.local.filter((snapshot) => snapshot.reason !== "other-runner");
|
|
282
|
+
const sharedListed = listed.shared?.kind === "listed" ? listed.shared : null;
|
|
283
|
+
const sharedOwner = sharedListed === null ? null : `${sharedListed.teamId}/${sharedListed.projectId}`;
|
|
284
|
+
const sharedPick = sharedListed?.entries.find((entry) => entry.picked) ?? null;
|
|
285
|
+
const owners = [...new Set(ofRunner.map(({ teamId, projectId }) => `${teamId}/${projectId}`))];
|
|
286
|
+
if (sharedOwner !== null && sharedPick !== null && !owners.includes(sharedOwner))
|
|
287
|
+
owners.push(sharedOwner);
|
|
133
288
|
const building = listed.mergeBase === null
|
|
134
|
-
? "builds a
|
|
135
|
-
: `builds a
|
|
289
|
+
? "builds a runner snapshot"
|
|
290
|
+
: `builds a runner snapshot at the merge-base (${short(listed.mergeBase)})`;
|
|
136
291
|
const lines = [];
|
|
137
|
-
if (owners.length === 0)
|
|
138
|
-
lines.push(
|
|
292
|
+
if (owners.length === 0) {
|
|
293
|
+
lines.push(sharedListed === null
|
|
294
|
+
? `A run here ${building}: the local snapshot index holds no snapshot of runner ${listed.picking.runner}.`
|
|
295
|
+
: `A run here ${building}: neither the local snapshot index nor the shared snapshot index holds a fitting snapshot of runner ${listed.picking.runner}.`);
|
|
296
|
+
}
|
|
139
297
|
for (const owner of owners) {
|
|
140
298
|
const who = owners.length === 1 ? "A run here" : `A run here for team and project ${owner}`;
|
|
141
|
-
|
|
299
|
+
if (owner === sharedOwner && sharedPick !== null && sharedPick.snapshotId !== null) {
|
|
300
|
+
lines.push(`${who} starts from ${sharedPick.snapshotId}, ${builtAtText({ base: sharedPick.base, builtBehind: sharedPick.builtBehind, mergeBase: listed.mergeBase ?? undefined })}, from the shared snapshot index.`);
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
const owned = ofRunner.filter((snapshot) => `${snapshot.teamId}/${snapshot.projectId}` === owner);
|
|
142
304
|
const pick = owned.find((snapshot) => snapshot.picked);
|
|
143
305
|
lines.push(pick !== undefined
|
|
144
306
|
? `${who} starts from ${pick.snapshotId}, ${builtAtText({ base: pick.base, builtBehind: pick.builtBehind, mergeBase: listed.mergeBase ?? undefined })}.`
|
|
145
|
-
: `${who} ${building}: no
|
|
307
|
+
: `${who} ${building}: no snapshot fits.`);
|
|
146
308
|
}
|
|
147
309
|
if (owners.length > 1)
|
|
148
310
|
lines.push("The run's credential decides the team and project.");
|
|
149
|
-
const others =
|
|
311
|
+
const others = ofRunner.filter((snapshot) => !snapshot.picked && snapshot.reason !== null && snapshot.reason !== "other-runner");
|
|
150
312
|
for (const snapshot of others.slice(0, REJECTIONS_SHOWN))
|
|
151
313
|
lines.push(` ${snapshot.snapshotId}: ${rejectionText(snapshot.reason, snapshot)}`);
|
|
152
314
|
if (others.length > REJECTIONS_SHOWN)
|
|
@@ -158,29 +320,30 @@ export const outcomes = defineOutcomes({
|
|
|
158
320
|
results: {
|
|
159
321
|
listed: {
|
|
160
322
|
schema: listedSchema,
|
|
161
|
-
description: "The
|
|
323
|
+
description: "The runner snapshots in the local snapshot index (and, with --shared, the shared snapshot index), with the one a run here starts from marked; none is an empty list.",
|
|
162
324
|
render: (listed) => renderOutcome({
|
|
163
325
|
rows: [
|
|
164
|
-
["
|
|
165
|
-
...(listed.picking.kind === "
|
|
326
|
+
["Local index", path(listed.directory)],
|
|
327
|
+
...(listed.picking.kind === "runner" ? [["Runner", listed.picking.runner]] : []),
|
|
166
328
|
...(listed.configFile === null ? [] : [["Config", path(listed.configFile)]]),
|
|
167
329
|
],
|
|
168
|
-
...(listed.
|
|
169
|
-
|
|
170
|
-
|
|
330
|
+
...(listed.shared === null ? {} : { sections: sharedSections(listed) }),
|
|
331
|
+
...(listed.local.length === 0 ? {} : { table: tableOf(listed) }),
|
|
332
|
+
message: listed.local.length === 0 && listed.picking.kind === "none"
|
|
333
|
+
? `No runner snapshots are in the local snapshot index. ${UNPICKED_TEXT[listed.picking.why]}`
|
|
171
334
|
: explanationOf(listed),
|
|
172
335
|
...(listed.unreadable.length === 0
|
|
173
336
|
? {}
|
|
174
337
|
: {
|
|
175
338
|
warnings: listed.unreadable.map(({ file, reason }) => ({
|
|
176
339
|
reason: "snapshot_file_unreadable",
|
|
177
|
-
message: `storm can't read the
|
|
340
|
+
message: `storm can't read the local snapshot index file ${file}: ${reason}. No run starts from it.`,
|
|
178
341
|
})),
|
|
179
342
|
}),
|
|
180
343
|
next: [
|
|
181
344
|
{
|
|
182
345
|
type: "text",
|
|
183
|
-
text: "storm snapshots build builds a
|
|
346
|
+
text: "storm snapshots build builds a runner snapshot at the merge-base without a test run.",
|
|
184
347
|
},
|
|
185
348
|
],
|
|
186
349
|
}),
|
|
@@ -189,6 +352,14 @@ export const outcomes = defineOutcomes({
|
|
|
189
352
|
errors: {
|
|
190
353
|
invalidConfig: configErrors.invalidConfig,
|
|
191
354
|
...suiteNotFoundErrors,
|
|
355
|
+
missingTarget: credentialErrors.missingTarget,
|
|
356
|
+
...credentialSourceErrors,
|
|
357
|
+
runnerFailed: runErrors.runnerFailed,
|
|
358
|
+
sharedListFailed: sharedListFailedError({
|
|
359
|
+
description: "With --shared, the Vercel Sandbox API failed while storm listed the shared snapshot index.",
|
|
360
|
+
consequence: "",
|
|
361
|
+
next: "Run again, or drop --shared to list only the local snapshot index.",
|
|
362
|
+
}),
|
|
192
363
|
launchMachineHasNoSnapshot: {
|
|
193
364
|
exitCode: 2,
|
|
194
365
|
description: "The effective runner is the launch machine, which has no runner snapshot.",
|
|
@@ -210,9 +381,9 @@ export const outcomes = defineOutcomes({
|
|
|
210
381
|
],
|
|
211
382
|
}),
|
|
212
383
|
},
|
|
213
|
-
|
|
384
|
+
localIndexUnreadable: {
|
|
214
385
|
exitCode: 1,
|
|
215
|
-
description: "storm couldn't read the
|
|
386
|
+
description: "storm couldn't read the local snapshot index directory.",
|
|
216
387
|
schema: z.object({
|
|
217
388
|
/** The directory the read failed on. */
|
|
218
389
|
path: z.string(),
|
|
@@ -220,13 +391,13 @@ export const outcomes = defineOutcomes({
|
|
|
220
391
|
message: z.string(),
|
|
221
392
|
}),
|
|
222
393
|
render: ({ path: where, message }) => ({
|
|
223
|
-
message: `Couldn't read the
|
|
394
|
+
message: `Couldn't read the local snapshot index: ${message}`,
|
|
224
395
|
rows: [["Path", where]],
|
|
225
396
|
}),
|
|
226
397
|
},
|
|
227
398
|
checkoutFailed: {
|
|
228
399
|
exitCode: 1,
|
|
229
|
-
description: "git failed while storm checked the checkout or
|
|
400
|
+
description: "git failed while storm checked the checkout or an indexed snapshot's base, as a run here would refuse.",
|
|
230
401
|
schema: z.object({
|
|
231
402
|
/** What git said. */
|
|
232
403
|
message: z.string(),
|