@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
|
@@ -7,7 +7,8 @@ import { megabytesText } from "../../../core/index.js";
|
|
|
7
7
|
import { RUN_CLEANUP } from "../../../shared/cleanup.js";
|
|
8
8
|
import { seconds, short } from "../../../shared/text.js";
|
|
9
9
|
import { runErrors } from "../../exec/outcomes.js";
|
|
10
|
-
|
|
10
|
+
import { PROJECT_FIELDS } from "../access.js";
|
|
11
|
+
/** A runner snapshot, as the result names it. */
|
|
11
12
|
const snapshotSchema = z.object({
|
|
12
13
|
snapshotId: z.string(),
|
|
13
14
|
/** Its base, the commit it was built at, a full SHA. */
|
|
@@ -15,65 +16,182 @@ const snapshotSchema = z.object({
|
|
|
15
16
|
/** When it expires, as an ISO time. */
|
|
16
17
|
expiresAt: z.string(),
|
|
17
18
|
});
|
|
18
|
-
/** A
|
|
19
|
+
/** A local snapshot index entry as the result names it. */
|
|
19
20
|
export function snapshotOf(entry) {
|
|
20
21
|
return { snapshotId: entry.snapshotId, base: entry.base, expiresAt: entry.expiresAt };
|
|
21
22
|
}
|
|
22
23
|
/** A snapshot in words: its id and its base. */
|
|
23
24
|
export function snapshotText({ snapshotId, base }) {
|
|
24
|
-
return `
|
|
25
|
+
return `runner snapshot ${snapshotId} at ${short(base)}`;
|
|
25
26
|
}
|
|
26
|
-
/** What every result says of
|
|
27
|
-
const
|
|
28
|
-
/** The config file that gave the runner recipe. */
|
|
29
|
-
configFile: z.string().nullable(),
|
|
30
|
-
recipe: z.string(),
|
|
31
|
-
/** The team and project the credential was minted for: the sandboxes ran there, and the snapshots are theirs. */
|
|
32
|
-
team: z.string(),
|
|
33
|
-
project: z.string(),
|
|
34
|
-
/** HEAD's commit, a full SHA. */
|
|
35
|
-
head: z.string(),
|
|
27
|
+
/** What every runner's result says of what it built at, and of the commit a --base build checked. */
|
|
28
|
+
const baseFields = {
|
|
36
29
|
/** What it built at: HEAD's merge-base with `baseRef`, or with --base the commit the ref names, a full SHA. */
|
|
37
30
|
base: z.string(),
|
|
38
31
|
baseRef: z.string(),
|
|
39
32
|
/** With --base, whether the working tree had uncommitted changes, which a base snapshot doesn't hold; else null. */
|
|
40
33
|
uncommitted: z.boolean().nullable(),
|
|
34
|
+
/** With --base, whether the commit is HEAD's merge-base with a base ref; else null. */
|
|
35
|
+
atMergeBase: z.boolean().nullable(),
|
|
41
36
|
/**
|
|
42
|
-
* With --base, whether the commit is HEAD's merge-base
|
|
43
|
-
* snapshot at its merge-base.
|
|
37
|
+
* With --base, whether the commit is an ancestor of HEAD's merge-base, a commit behind it on the base ref (false at
|
|
38
|
+
* the merge-base itself); else null. A run here starts only from a snapshot at its merge-base or at such a commit.
|
|
44
39
|
*/
|
|
45
|
-
|
|
40
|
+
ancestorOfMergeBase: z.boolean().nullable(),
|
|
41
|
+
};
|
|
42
|
+
/** What every single runner's result says of where the build ran, and of what it built at. */
|
|
43
|
+
const whereFields = {
|
|
44
|
+
/** The config file that gave the Vercel Sandbox runner. */
|
|
45
|
+
configFile: z.string().nullable(),
|
|
46
|
+
runner: z.string(),
|
|
47
|
+
/** The Vercel project the sandboxes ran in, whose snapshots they are. */
|
|
48
|
+
...PROJECT_FIELDS,
|
|
49
|
+
/** HEAD's commit, a full SHA. */
|
|
50
|
+
head: z.string(),
|
|
51
|
+
...baseFields,
|
|
46
52
|
};
|
|
47
53
|
const builtSchema = z.object({
|
|
48
54
|
...whereFields,
|
|
49
|
-
/** The
|
|
55
|
+
/** The runner snapshot it built and indexed. */
|
|
50
56
|
snapshot: snapshotSchema,
|
|
51
57
|
/** How long the build took, and the snapshot's size. */
|
|
52
58
|
ms: z.number(),
|
|
53
59
|
sizeBytes: z.number(),
|
|
60
|
+
/**
|
|
61
|
+
* With --publish, the stopped sandbox that holds the runner snapshot as the shared snapshot index entry; null without
|
|
62
|
+
* --publish.
|
|
63
|
+
*/
|
|
64
|
+
sandboxName: z.string().nullable(),
|
|
65
|
+
/**
|
|
66
|
+
* Whether the local snapshot index on this machine recorded the snapshot. Only --publish ends `built` without it,
|
|
67
|
+
* since a run finds the snapshot in the shared snapshot index.
|
|
68
|
+
*/
|
|
69
|
+
localIndexWritten: z.boolean(),
|
|
54
70
|
/** What the build couldn't clean up. */
|
|
55
71
|
cleanup: RUN_CLEANUP.schema,
|
|
56
72
|
});
|
|
57
73
|
const upToDateSchema = z.object({
|
|
58
74
|
...whereFields,
|
|
59
|
-
/** The
|
|
75
|
+
/** The runner snapshot the local snapshot index holds, or with --publish the shared snapshot index holds, at that commit. */
|
|
60
76
|
snapshot: snapshotSchema,
|
|
77
|
+
/** With --publish, the stopped sandbox that holds it as the shared snapshot index entry; null without --publish. */
|
|
78
|
+
sandboxName: z.string().nullable(),
|
|
79
|
+
});
|
|
80
|
+
const alreadyBuildingSchema = z.object({
|
|
81
|
+
...whereFields,
|
|
82
|
+
/** The shared snapshot index entry's sandbox, which another build owns. */
|
|
83
|
+
sandboxName: z.string(),
|
|
84
|
+
/** Its status, such as `running` or `snapshotting`; null when another build took the name as this one started. */
|
|
85
|
+
status: z.string().nullable(),
|
|
86
|
+
});
|
|
87
|
+
const runnerBuildCommon = {
|
|
88
|
+
runner: z.string(),
|
|
89
|
+
region: z.string(),
|
|
90
|
+
runtime: z.string(),
|
|
91
|
+
/** Whether the top-level runner uses this runner configuration. */
|
|
92
|
+
topLevel: z.boolean(),
|
|
93
|
+
/** The suites whose effective runner uses this runner configuration, in declaration order. */
|
|
94
|
+
suites: z.array(z.string()),
|
|
95
|
+
...baseFields,
|
|
96
|
+
};
|
|
97
|
+
/** One runner that --all-suites built or checked. */
|
|
98
|
+
const runnerBuildSchema = z.discriminatedUnion("result", [
|
|
99
|
+
z.object({
|
|
100
|
+
...runnerBuildCommon,
|
|
101
|
+
result: z.literal("built"),
|
|
102
|
+
/** The runner snapshot it built. */
|
|
103
|
+
snapshot: snapshotSchema,
|
|
104
|
+
/** With --publish, the shared snapshot index entry's sandbox; null without --publish. */
|
|
105
|
+
sandboxName: z.string().nullable(),
|
|
106
|
+
/** How long the build took, in milliseconds. */
|
|
107
|
+
ms: z.number(),
|
|
108
|
+
/** The snapshot's size, in bytes. */
|
|
109
|
+
sizeBytes: z.number(),
|
|
110
|
+
/** Whether the local snapshot index on this machine recorded the snapshot. */
|
|
111
|
+
localIndexWritten: z.boolean(),
|
|
112
|
+
}),
|
|
113
|
+
z.object({
|
|
114
|
+
...runnerBuildCommon,
|
|
115
|
+
result: z.literal("up_to_date"),
|
|
116
|
+
/** The runner snapshot it found. */
|
|
117
|
+
snapshot: snapshotSchema,
|
|
118
|
+
/** With --publish, the shared snapshot index entry's sandbox; null without --publish. */
|
|
119
|
+
sandboxName: z.string().nullable(),
|
|
120
|
+
}),
|
|
121
|
+
z.object({
|
|
122
|
+
...runnerBuildCommon,
|
|
123
|
+
result: z.literal("already_building"),
|
|
124
|
+
/** The shared snapshot index entry's sandbox, which another build owns. */
|
|
125
|
+
sandboxName: z.string(),
|
|
126
|
+
/** Its status, such as `running` or `snapshotting`; null when another build took the name as this one started. */
|
|
127
|
+
status: z.string().nullable(),
|
|
128
|
+
}),
|
|
129
|
+
]);
|
|
130
|
+
const allSuitesBuiltSchema = z.object({
|
|
131
|
+
configFile: z.string().nullable(),
|
|
132
|
+
/** The Vercel project the sandboxes ran in, whose snapshots they are. */
|
|
133
|
+
...PROJECT_FIELDS,
|
|
134
|
+
/** HEAD's commit, a full SHA. */
|
|
135
|
+
head: z.string(),
|
|
136
|
+
/** Each distinct runner, in the order the config file first declares it, and how its build ended. */
|
|
137
|
+
runners: z.array(runnerBuildSchema),
|
|
138
|
+
/** What the builds couldn't clean up. */
|
|
139
|
+
cleanup: RUN_CLEANUP.schema,
|
|
61
140
|
});
|
|
141
|
+
/** A sandbox status in words, for the already-building line. */
|
|
142
|
+
function statusText(status) {
|
|
143
|
+
return status === null ? "another build took its name first" : `status ${status}`;
|
|
144
|
+
}
|
|
145
|
+
/** What `already_building` says: the sandbox another build owns and its status. */
|
|
146
|
+
function alreadyBuildingText(facts) {
|
|
147
|
+
return `Sandbox ${facts.sandboxName} is already building this runner snapshot (${statusText(facts.status)}), so nothing started.`;
|
|
148
|
+
}
|
|
149
|
+
/** What `up_to_date` says: where the snapshot is. */
|
|
150
|
+
function upToDateText(facts) {
|
|
151
|
+
return facts.sandboxName === null
|
|
152
|
+
? `The local snapshot index holds ${snapshotText(facts.snapshot)} for this team and project. --full builds a new one.`
|
|
153
|
+
: `The shared snapshot index holds ${snapshotText(facts.snapshot)} for this team and project. --full builds a new one.`;
|
|
154
|
+
}
|
|
155
|
+
/** What `built` says: the snapshot, how long it took, its size, and where it was published. */
|
|
156
|
+
function builtText(facts) {
|
|
157
|
+
const published = facts.sandboxName === null ? "" : ", and published it to the shared snapshot index";
|
|
158
|
+
return `Built ${snapshotText(facts.snapshot)} in ${seconds(facts.ms)} (${megabytesText(facts.sizeBytes)})${published}.`;
|
|
159
|
+
}
|
|
160
|
+
/** Who uses a runner, in words: the top level, then each suite. */
|
|
161
|
+
export function usedByText(facts) {
|
|
162
|
+
return [...(facts.topLevel ? ["the top level"] : []), ...facts.suites.map((suite) => `suite ${suite}`)].join(", ");
|
|
163
|
+
}
|
|
164
|
+
/** One --all-suites runner's result, in words. */
|
|
165
|
+
function runnerBuildText(facts) {
|
|
166
|
+
const where = `${facts.runner} (${usedByText(facts)})`;
|
|
167
|
+
switch (facts.result) {
|
|
168
|
+
case "already_building":
|
|
169
|
+
return `${where}: ${alreadyBuildingText(facts)}`;
|
|
170
|
+
case "up_to_date":
|
|
171
|
+
return `${where}: ${upToDateText(facts)}`;
|
|
172
|
+
case "built":
|
|
173
|
+
return `${where}: ${builtText(facts)}`;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const LOCAL_INDEX_NOT_WRITTEN = {
|
|
177
|
+
reason: "local_index_not_written",
|
|
178
|
+
message: "The local snapshot index couldn't record the snapshot; a run here finds it in the shared snapshot index instead.",
|
|
179
|
+
};
|
|
62
180
|
function warningsOf(facts) {
|
|
63
181
|
return [
|
|
64
182
|
...(facts.uncommitted === true
|
|
65
183
|
? [
|
|
66
184
|
{
|
|
67
185
|
reason: "uncommitted_changes_not_included",
|
|
68
|
-
message: "The working tree has uncommitted changes: a
|
|
186
|
+
message: "The working tree has uncommitted changes: a runner snapshot holds only the commit's tracked files.",
|
|
69
187
|
},
|
|
70
188
|
]
|
|
71
189
|
: []),
|
|
72
|
-
...(facts.atMergeBase === false
|
|
190
|
+
...(facts.atMergeBase === false && facts.ancestorOfMergeBase === false
|
|
73
191
|
? [
|
|
74
192
|
{
|
|
75
|
-
reason: "
|
|
76
|
-
message: `${facts.baseRef}'s commit is
|
|
193
|
+
reason: "commit_not_merge_base_or_ancestor",
|
|
194
|
+
message: `${facts.baseRef}'s commit is neither HEAD's merge-base nor an ancestor of it, so a run here doesn't start from the snapshot: a run starts only from a snapshot at its merge-base or at a commit behind it on the base ref.`,
|
|
77
195
|
},
|
|
78
196
|
]
|
|
79
197
|
: []),
|
|
@@ -84,30 +202,77 @@ export const outcomes = defineOutcomes({
|
|
|
84
202
|
results: {
|
|
85
203
|
built: {
|
|
86
204
|
schema: builtSchema,
|
|
87
|
-
description: "It built a
|
|
205
|
+
description: "It built a runner snapshot that the local snapshot index lacked, at the merge-base or, with --base, at the commit the ref names, and indexed it.",
|
|
88
206
|
render: (built) => {
|
|
89
|
-
const warnings = warningsOf(built);
|
|
207
|
+
const warnings = [...warningsOf(built), ...(built.localIndexWritten ? [] : [LOCAL_INDEX_NOT_WRITTEN])];
|
|
90
208
|
return renderOutcome({
|
|
91
|
-
rows: [["
|
|
92
|
-
message:
|
|
209
|
+
rows: [["Runner", built.runner], ...RUN_CLEANUP.rows(built.cleanup)],
|
|
210
|
+
message: builtText(built),
|
|
93
211
|
...(warnings.length === 0 ? {} : { warnings }),
|
|
94
212
|
});
|
|
95
213
|
},
|
|
96
214
|
},
|
|
97
215
|
upToDate: {
|
|
98
216
|
schema: upToDateSchema,
|
|
99
|
-
description: "Nothing to build, so nothing started: the
|
|
217
|
+
description: "Nothing to build, so nothing started: the local snapshot index holds a runner snapshot at the commit, the merge-base or the one --base names, for the team and project. With --publish, the shared snapshot index holds it instead, and the local snapshot index now records it too.",
|
|
218
|
+
render: (facts) => {
|
|
219
|
+
const warnings = warningsOf(facts);
|
|
220
|
+
return renderOutcome({
|
|
221
|
+
rows: [["Runner", facts.runner]],
|
|
222
|
+
message: upToDateText(facts),
|
|
223
|
+
...(warnings.length === 0 ? {} : { warnings }),
|
|
224
|
+
});
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
alreadyBuilding: {
|
|
228
|
+
schema: alreadyBuildingSchema,
|
|
229
|
+
description: "With --publish, another build already owns the shared snapshot index entry's sandbox for the commit, so nothing started.",
|
|
100
230
|
render: (facts) => {
|
|
101
231
|
const warnings = warningsOf(facts);
|
|
102
232
|
return renderOutcome({
|
|
103
|
-
rows: [
|
|
104
|
-
|
|
233
|
+
rows: [
|
|
234
|
+
["Runner", facts.runner],
|
|
235
|
+
["Sandbox", facts.sandboxName],
|
|
236
|
+
],
|
|
237
|
+
message: alreadyBuildingText(facts),
|
|
238
|
+
...(warnings.length === 0 ? {} : { warnings }),
|
|
239
|
+
});
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
allSuitesBuilt: {
|
|
243
|
+
schema: allSuitesBuiltSchema,
|
|
244
|
+
description: "With --all-suites, it built or checked the runner snapshot of each distinct vercelSandbox({ … }) runner that the top level and the suites use.",
|
|
245
|
+
render: (facts) => {
|
|
246
|
+
// Each runner's warnings come from the same facts as a single build's; one --base gives every runner the same
|
|
247
|
+
// commit, so a warning they share shows once.
|
|
248
|
+
const warnings = [
|
|
249
|
+
...new Map(facts.runners.flatMap(warningsOf).map((warning) => [`${warning.reason}\0${warning.message}`, warning])).values(),
|
|
250
|
+
...(facts.runners.some((runner) => runner.result === "built" && !runner.localIndexWritten)
|
|
251
|
+
? [LOCAL_INDEX_NOT_WRITTEN]
|
|
252
|
+
: []),
|
|
253
|
+
];
|
|
254
|
+
return renderOutcome({
|
|
255
|
+
rows: [["Runners", facts.runners.map(runnerBuildText)], ...RUN_CLEANUP.rows(facts.cleanup)],
|
|
256
|
+
message: `Built or checked ${facts.runners.length === 1 ? "1 runner" : `${facts.runners.length} runners`}.`,
|
|
105
257
|
...(warnings.length === 0 ? {} : { warnings }),
|
|
106
258
|
});
|
|
107
259
|
},
|
|
108
260
|
},
|
|
109
261
|
},
|
|
110
262
|
errors: {
|
|
263
|
+
conflictingOptions: {
|
|
264
|
+
exitCode: 2,
|
|
265
|
+
description: "--suite and --all-suites were both given: --suite builds one runner, and --all-suites builds them all.",
|
|
266
|
+
schema: z.object({
|
|
267
|
+
/** Each conflicting flag, as typed, and why it doesn't fit. */
|
|
268
|
+
conflicts: z.array(z.object({ flag: z.string(), message: z.string() })),
|
|
269
|
+
}),
|
|
270
|
+
render: ({ conflicts, }) => ({
|
|
271
|
+
message: conflicts.map(({ message }) => message).join(" "),
|
|
272
|
+
rows: [["Conflicts", conflicts.map(({ flag }) => flag)]],
|
|
273
|
+
next: [{ type: "text", text: "Pass --suite <name> or --all-suites, not both." }],
|
|
274
|
+
}),
|
|
275
|
+
},
|
|
111
276
|
invalidConfig: configErrors.invalidConfig,
|
|
112
277
|
...suiteNotFoundErrors,
|
|
113
278
|
missingRunner: runErrors.missingRunner,
|
|
@@ -136,8 +301,7 @@ export const outcomes = defineOutcomes({
|
|
|
136
301
|
credentialsInvalid: runErrors.credentialsInvalid,
|
|
137
302
|
noBaseRef: runErrors.noBaseRef,
|
|
138
303
|
submodulesRefused: runErrors.submodulesRefused,
|
|
139
|
-
|
|
140
|
-
tokenRequestFailed: credentialSourceErrors.tokenRequestFailed,
|
|
304
|
+
...credentialSourceErrors,
|
|
141
305
|
runnerFailed: runErrors.runnerFailed,
|
|
142
306
|
refNotFound: {
|
|
143
307
|
exitCode: 1,
|
|
@@ -151,20 +315,20 @@ export const outcomes = defineOutcomes({
|
|
|
151
315
|
next: [{ type: "text", text: `Fetch the ref, such as git fetch origin, then run again.` }],
|
|
152
316
|
}),
|
|
153
317
|
},
|
|
154
|
-
|
|
318
|
+
snapshotNotIndexed: {
|
|
155
319
|
exitCode: 1,
|
|
156
|
-
description: "It built and saved the
|
|
320
|
+
description: "It built and saved the runner snapshot, but couldn't write its local snapshot index entry, so no run finds it.",
|
|
157
321
|
schema: z.object({
|
|
158
|
-
/** The snapshot it saved, whose
|
|
322
|
+
/** The snapshot it saved, whose local snapshot index entry it couldn't write. */
|
|
159
323
|
snapshot: snapshotSchema,
|
|
160
|
-
/** The
|
|
324
|
+
/** The local snapshot index file the write failed on. */
|
|
161
325
|
path: z.string(),
|
|
162
326
|
/** What the operating system said. */
|
|
163
327
|
message: z.string(),
|
|
164
328
|
cleanup: RUN_CLEANUP.schema,
|
|
165
329
|
}),
|
|
166
330
|
render: (facts) => ({
|
|
167
|
-
message: `Saved ${snapshotText(facts.snapshot)}, but couldn't write its
|
|
331
|
+
message: `Saved ${snapshotText(facts.snapshot)}, but couldn't write its local snapshot index entry: ${facts.message}`,
|
|
168
332
|
rows: [["Path", facts.path], ...RUN_CLEANUP.rows(facts.cleanup)],
|
|
169
333
|
next: [
|
|
170
334
|
{
|