@cnc-tools/storm 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application.d.ts +22 -13
- package/dist/application.js +21 -10
- package/dist/bin/run.d.ts +18 -0
- package/dist/bin/run.js +31 -0
- package/dist/bin/storm.js +42 -26
- package/dist/build-info.js +1 -1
- package/dist/chunks/{chunk-5CCP36QQ.js → chunk-2RNDPDTJ.js} +2 -2
- package/dist/chunks/chunk-2VP4GRJM.js +1219 -0
- package/dist/chunks/{chunk-SZEURWRS.js → chunk-4O5C2XGJ.js} +18 -15
- package/dist/chunks/{chunk-VL7WFTVQ.js → chunk-4WAMTUWZ.js} +419 -340
- package/dist/chunks/{chunk-QVS7HRU7.js → chunk-6UHIJXZG.js} +3 -3
- package/dist/chunks/{chunk-CN4EFA5J.js → chunk-72ZFEMAW.js} +1 -1
- package/dist/chunks/{chunk-4U4DZ7VG.js → chunk-7DZE67QM.js} +2 -2
- package/dist/chunks/{chunk-VUPZH7J2.js → chunk-BCBKYOHW.js} +1 -1
- package/dist/chunks/{chunk-QUHY6FGN.js → chunk-CKGZA25H.js} +1 -18
- package/dist/chunks/{chunk-ZG3WQ4UF.js → chunk-D27KILIA.js} +1 -1
- package/dist/chunks/{chunk-KC4KDJ5K.js → chunk-DADEYJDW.js} +174 -153
- package/dist/chunks/{chunk-R7XVBZOY.js → chunk-EEENLQHE.js} +59 -11
- package/dist/chunks/chunk-F4MOYHRY.js +198 -0
- package/dist/chunks/{chunk-CXAT7ZKP.js → chunk-FNBB6V4R.js} +1 -1
- package/dist/chunks/{chunk-OX7X4B2L.js → chunk-GRT3UIBV.js} +18 -1
- package/dist/chunks/chunk-HP3CURSZ.js +88 -0
- package/dist/chunks/{chunk-PN5ULTTH.js → chunk-HWIQ2S7K.js} +5 -5
- package/dist/chunks/chunk-JN3YY6ZH.js +2166 -0
- package/dist/chunks/{chunk-TJNFVNKR.js → chunk-LKTZ5OXS.js} +1 -1
- package/dist/chunks/{chunk-XEVHP5ZW.js → chunk-M7EKRGVD.js} +8 -8
- package/dist/chunks/chunk-MR77L2GK.js +340 -0
- package/dist/chunks/{chunk-L36GBUBB.js → chunk-RNAS7JHE.js} +1755 -522
- package/dist/chunks/{chunk-5GBMR4HM.js → chunk-RWIXDDCK.js} +4 -192
- package/dist/chunks/{chunk-5VXBKPW6.js → chunk-WV3DP6NR.js} +1 -1
- package/dist/chunks/{chunk-AWBSONHB.js → chunk-XBDRVFEV.js} +55 -16
- package/dist/chunks/{chunk-YV7GE6EV.js → chunk-YEPFSLQR.js} +480 -375
- package/dist/chunks/{live-app-PI3BAN6Y.js → live-app-R76JQXZL.js} +15 -13
- package/dist/commands/exec/across-sandboxes-outcomes.d.ts +1 -1
- package/dist/commands/exec/across-sandboxes-outcomes.js +4 -3
- package/dist/commands/exec/before-run.d.ts +123 -0
- package/dist/commands/exec/before-run.js +105 -0
- package/dist/commands/exec/command.d.ts +39 -4
- package/dist/commands/exec/command.js +31 -95
- package/dist/commands/exec/driver-plan.d.ts +9 -4
- package/dist/commands/exec/driver-plan.js +8 -8
- package/dist/commands/exec/exec-words.js +1 -1
- package/dist/commands/exec/execute-run.d.ts +39 -0
- package/dist/commands/exec/execute-run.js +325 -0
- package/dist/commands/exec/live-view.d.ts +3 -3
- package/dist/commands/exec/live-view.js +16 -15
- package/dist/commands/exec/metadata.js +1 -1
- package/dist/commands/exec/mint-failed.d.ts +38 -0
- package/dist/commands/exec/mint-failed.js +27 -4
- package/dist/commands/exec/outcomes.d.ts +38 -9
- package/dist/commands/exec/outcomes.js +32 -25
- package/dist/commands/exec/plan-run.d.ts +58 -150
- package/dist/commands/exec/plan-run.js +232 -88
- package/dist/commands/exec/planned-outcome.js +8 -1
- package/dist/commands/exec/progress.d.ts +10 -6
- package/dist/commands/exec/progress.js +38 -25
- package/dist/commands/exec/run-bin.d.ts +11 -11
- package/dist/commands/exec/run-bin.js +9 -9
- package/dist/commands/exec/run-flags.d.ts +69 -0
- package/dist/commands/exec/run-flags.js +58 -0
- package/dist/commands/exec/run-metadata.js +5 -5
- package/dist/commands/exec/run-summary.d.ts +58 -0
- package/dist/commands/exec/run-summary.js +205 -0
- package/dist/commands/exec/runner-refusals.d.ts +82 -0
- package/dist/commands/exec/runner-refusals.js +71 -0
- package/dist/commands/exec/sandbox-progress.js +3 -0
- package/dist/commands/exec/stopped-outcome.d.ts +12 -0
- package/dist/commands/exec/stopped-outcome.js +77 -0
- package/dist/commands/exec/view.d.ts +20 -11
- package/dist/commands/exec/view.js +103 -47
- package/dist/commands/runs/facts.d.ts +9 -4
- package/dist/commands/runs/facts.js +28 -11
- package/dist/commands/runs/list/command.d.ts +16 -6
- package/dist/commands/runs/list/command.js +10 -10
- package/dist/commands/runs/list/outcomes.d.ts +8 -3
- package/dist/commands/runs/logs/command.d.ts +6 -2
- package/dist/commands/runs/logs/command.js +10 -10
- package/dist/commands/runs/logs/outcomes.d.ts +3 -1
- package/dist/commands/runs/past-run.d.ts +14 -5
- package/dist/commands/runs/past-run.js +16 -5
- package/dist/commands/runs/show/command.d.ts +20 -8
- package/dist/commands/runs/show/command.js +30 -28
- package/dist/commands/runs/show/outcomes.d.ts +10 -4
- package/dist/commands/runs/show/outcomes.js +7 -5
- package/dist/commands/snapshots/access.d.ts +111 -0
- package/dist/commands/snapshots/access.js +96 -0
- package/dist/commands/snapshots/build/command.d.ts +360 -93
- package/dist/commands/snapshots/build/command.js +446 -150
- package/dist/commands/snapshots/build/metadata.d.ts +10 -0
- package/dist/commands/snapshots/build/metadata.js +31 -11
- package/dist/commands/snapshots/build/outcomes.d.ts +234 -43
- package/dist/commands/snapshots/build/outcomes.js +200 -36
- package/dist/commands/snapshots/list/command.d.ts +368 -27
- package/dist/commands/snapshots/list/command.js +296 -66
- package/dist/commands/snapshots/list/metadata.d.ts +16 -0
- package/dist/commands/snapshots/list/metadata.js +29 -6
- package/dist/commands/snapshots/list/outcomes.d.ts +245 -13
- package/dist/commands/snapshots/list/outcomes.js +221 -50
- package/dist/commands/snapshots/metadata.js +1 -1
- package/dist/commands/snapshots/prune/command.d.ts +430 -0
- package/dist/commands/snapshots/prune/command.js +161 -0
- package/dist/commands/snapshots/prune/metadata.d.ts +28 -0
- package/dist/commands/snapshots/prune/metadata.js +39 -0
- package/dist/commands/snapshots/prune/outcomes.d.ts +208 -0
- package/dist/commands/snapshots/prune/outcomes.js +78 -0
- package/dist/commands/suites/list/command.js +19 -18
- package/dist/commands/suites/list/outcomes.js +4 -4
- package/dist/commands/test/command.d.ts +39 -4
- package/dist/commands/test/command.js +50 -255
- package/dist/commands/test/metadata.js +1 -1
- package/dist/commands/test/outcomes.d.ts +19 -2
- package/dist/commands/test/outcomes.js +2 -2
- package/dist/config/check-runner.d.ts +5 -3
- package/dist/config/check-runner.js +33 -7
- package/dist/config/check-suites.js +1 -0
- package/dist/config/credential-resolver.d.ts +50 -5
- package/dist/config/credential-resolver.js +51 -19
- package/dist/config/credential-settle.d.ts +6 -2
- package/dist/config/credential-settle.js +11 -5
- package/dist/config/gateways.d.ts +7 -3
- package/dist/config/index.d.ts +4 -5
- package/dist/config/index.js +3 -4
- package/dist/config/live/config-gateway.js +5 -2
- package/dist/config/load.d.ts +21 -4
- package/dist/config/load.js +129 -15
- package/dist/config/runner.d.ts +7 -8
- package/dist/config/runner.js +1 -1
- package/dist/config/schema.d.ts +17 -5
- package/dist/config/schema.js +11 -3
- package/dist/config/typed-options.d.ts +1 -6
- package/dist/config/typed-options.js +2 -10
- package/dist/config-file/define.d.ts +1 -11
- package/dist/config-file/define.js +3 -3
- package/dist/config-file/runner.d.ts +5 -6
- package/dist/config-file/toolchain.d.ts +13 -7
- package/dist/config-file/toolchain.js +53 -37
- package/dist/context.d.ts +8 -6
- package/dist/context.js +7 -6
- package/dist/core/across-sandboxes.d.ts +7 -6
- package/dist/core/across-sandboxes.js +123 -152
- package/dist/core/coordinator.d.ts +166 -0
- package/dist/core/coordinator.js +233 -0
- package/dist/core/events.d.ts +2 -2
- package/dist/core/index.d.ts +4 -2
- package/dist/core/index.js +1 -1
- package/dist/core/outcomes.d.ts +148 -0
- package/dist/core/{sandbox-end.js → outcomes.js} +28 -4
- package/dist/core/resources.d.ts +31 -53
- package/dist/core/resources.js +32 -70
- package/dist/core/run-state.d.ts +7 -1
- package/dist/core/run-state.js +2 -0
- package/dist/core/run.d.ts +32 -236
- package/dist/core/run.js +106 -266
- package/dist/core/state-directory.d.ts +1 -1
- package/dist/core/state-directory.js +2 -2
- package/dist/credential/gateways.d.ts +15 -1
- package/dist/credential/index.d.ts +4 -3
- package/dist/credential/index.js +3 -2
- package/dist/credential/live/vercel-cli-gateway.d.ts +1 -1
- package/dist/credential/live/vercel-cli-gateway.js +1 -1
- package/dist/credential/live/vercel-oidc-token-gateway.d.ts +11 -0
- package/dist/credential/live/vercel-oidc-token-gateway.js +16 -0
- package/dist/credential/source.d.ts +73 -6
- package/dist/credential/source.js +55 -2
- package/dist/extension-commands.d.ts +6 -1
- package/dist/extension-commands.js +15 -1
- package/dist/extensions/github/resource.d.ts +1 -1
- package/dist/extensions/github/resource.js +1 -1
- package/dist/extensions/testserver/commands/pool/create/command.d.ts +35 -2
- package/dist/extensions/testserver/commands/pool/create/command.js +7 -7
- package/dist/extensions/testserver/commands/pool/create/metadata.js +5 -5
- package/dist/extensions/testserver/commands/pool/create/outcomes.d.ts +17 -1
- package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
- package/dist/extensions/testserver/credential-facts.d.ts +6 -2
- package/dist/extensions/testserver/credential-facts.js +29 -11
- package/dist/extensions/testserver/lifecycle.js +7 -1
- package/dist/extensions/testserver/limit.d.ts +3 -0
- package/dist/extensions/testserver/limit.js +3 -0
- package/dist/extensions/testserver/provision.d.ts +8 -1
- package/dist/extensions/testserver/provision.js +8 -3
- package/dist/extensions/testserver/refusals.d.ts +6 -1
- package/dist/extensions/testserver/refusals.js +16 -1
- package/dist/extensions/testserver/resource.d.ts +2 -2
- package/dist/extensions/testserver/resource.js +2 -2
- package/dist/extensions/testserver/result.d.ts +1 -1
- package/dist/extensions/testserver/result.js +9 -4
- package/dist/planning/driver-file-lists.d.ts +0 -15
- package/dist/planning/driver-file-lists.js +2 -21
- package/dist/planning/plan-only.d.ts +7 -15
- package/dist/planning/plan-only.js +16 -22
- package/dist/planning/run-kind-flags.js +2 -2
- package/dist/planning/run-plan.d.ts +45 -13
- package/dist/planning/run-plan.js +4 -3
- package/dist/planning/suites.d.ts +1 -1
- package/dist/planning/suites.js +2 -2
- package/dist/planning/test-plan.d.ts +9 -0
- package/dist/planning/test-plan.js +10 -2
- package/dist/run-directory/recording.js +2 -2
- package/dist/run-directory/run-record.d.ts +21 -6
- package/dist/run-directory/run-record.js +12 -9
- package/dist/runner/base.d.ts +0 -6
- package/dist/runner/base.js +1 -16
- package/dist/runner/build-snapshots.d.ts +55 -29
- package/dist/runner/build-snapshots.js +135 -35
- package/dist/runner/context.d.ts +15 -7
- package/dist/runner/context.js +19 -6
- package/dist/runner/events.d.ts +16 -10
- package/dist/runner/gateways.d.ts +92 -21
- package/dist/runner/gateways.js +1 -1
- package/dist/runner/index.d.ts +11 -7
- package/dist/runner/index.js +9 -4
- package/dist/runner/live/sandbox-errors.d.ts +2 -0
- package/dist/runner/live/sandbox-errors.js +4 -0
- package/dist/runner/live/sandbox-gateway.js +141 -3
- package/dist/runner/live/snapshot-index-gateway.d.ts +12 -0
- package/dist/runner/live/{snapshot-cache-gateway.js → snapshot-index-gateway.js} +11 -11
- package/dist/runner/live/snapshot-records.js +6 -7
- package/dist/runner/local-snapshot-index.d.ts +199 -0
- package/dist/runner/local-snapshot-index.js +211 -0
- package/dist/runner/network-policy.d.ts +6 -6
- package/dist/runner/network-policy.js +7 -7
- package/dist/runner/policy-writes.d.ts +1 -1
- package/dist/runner/policy-writes.js +1 -1
- package/dist/runner/prepare.d.ts +25 -24
- package/dist/runner/prepare.js +28 -20
- package/dist/runner/ready.d.ts +18 -10
- package/dist/runner/ready.js +104 -33
- package/dist/runner/sandboxed-command.d.ts +3 -3
- package/dist/runner/sandboxed-command.js +3 -3
- package/dist/runner/scope.d.ts +10 -6
- package/dist/runner/scope.js +10 -3
- package/dist/runner/secrets.d.ts +13 -13
- package/dist/runner/secrets.js +18 -15
- package/dist/runner/session.d.ts +8 -8
- package/dist/runner/session.js +3 -3
- package/dist/runner/shared-snapshot-entry.d.ts +92 -0
- package/dist/runner/shared-snapshot-entry.js +168 -0
- package/dist/runner/shared-snapshot-list.d.ts +81 -0
- package/dist/runner/shared-snapshot-list.js +155 -0
- package/dist/runner/shared-snapshot-lookup.d.ts +51 -0
- package/dist/runner/shared-snapshot-lookup.js +118 -0
- package/dist/runner/shared-snapshot-prune.d.ts +58 -0
- package/dist/runner/shared-snapshot-prune.js +133 -0
- package/dist/runner/snapshot-build.d.ts +42 -14
- package/dist/runner/snapshot-build.js +38 -28
- package/dist/runner/snapshot-choice.js +1 -1
- package/dist/runner/snapshot-inspect.d.ts +39 -40
- package/dist/runner/snapshot-inspect.js +58 -38
- package/dist/runner/snapshot-key.d.ts +30 -21
- package/dist/runner/snapshot-key.js +49 -29
- package/dist/runner/steps.d.ts +1 -1
- package/dist/runner/steps.js +1 -1
- package/dist/runner/{recipe-check.d.ts → vercel-sandbox-check.d.ts} +2 -2
- package/dist/runner/{recipe-check.js → vercel-sandbox-check.js} +3 -2
- package/dist/runner/{recipe.d.ts → vercel-sandbox-options.d.ts} +82 -82
- package/dist/runner/vercel-sandbox-options.js +510 -0
- package/dist/runner/{recipe-secrets.d.ts → vercel-sandbox-secrets.d.ts} +6 -6
- package/dist/runner/{recipe-secrets.js → vercel-sandbox-secrets.js} +20 -20
- package/dist/sdk/extension/commands.d.ts +8 -3
- package/dist/sdk/extension/commands.js +3 -1
- package/dist/sdk/extension/credential-diagnosis.d.ts +3 -1
- package/dist/sdk/extension/credential-diagnosis.js +25 -5
- package/dist/sdk/extension/credential-source.d.ts +20 -3
- package/dist/sdk/extension/credential-source.js +4 -4
- package/dist/sdk/extension/index.d.ts +3 -2
- package/dist/sdk/extension/index.js +2 -1
- package/dist/sdk/extension/resource-definition.d.ts +4 -3
- package/dist/sdk/extension/resource-definition.js +3 -2
- package/dist/sdk/extension/resource-factory.js +3 -4
- package/dist/sdk/extension/secret-source.d.ts +1 -1
- package/dist/sdk/extension/secret-source.js +1 -1
- package/dist/sdk/extension/vercel-oidc-facts.d.ts +20 -0
- package/dist/sdk/extension/vercel-oidc-facts.js +20 -0
- package/dist/sdk/run/present.d.ts +3 -3
- package/dist/sdk/run/present.js +1 -3
- package/dist/shared/cleanup.d.ts +3 -3
- package/dist/shared/cleanup.js +15 -5
- package/dist/shared/snapshot-text.d.ts +4 -4
- package/dist/shared/snapshot-text.js +11 -11
- package/dist/time/duration.js +1 -1
- package/package.json +3 -2
- package/skills/overview.md +6 -4
- package/skills/plan-runs.md +2 -2
- package/skills/read-run-output.md +6 -6
- package/dist/chunks/chunk-E4PJNZVG.js +0 -783
- package/dist/chunks/chunk-RAQEXKL6.js +0 -2591
- package/dist/commands/exec/across-sandboxes-run.d.ts +0 -180
- package/dist/commands/exec/across-sandboxes-run.js +0 -339
- package/dist/commands/exec/plan-only.d.ts +0 -10
- package/dist/commands/exec/plan-only.js +0 -46
- package/dist/commands/exec/run-command.d.ts +0 -476
- package/dist/commands/exec/run-command.js +0 -604
- package/dist/commands/exec/run-planned.d.ts +0 -20
- package/dist/commands/exec/run-planned.js +0 -22
- package/dist/commands/exec/sandbox-view.d.ts +0 -19
- package/dist/commands/exec/sandbox-view.js +0 -72
- package/dist/commands/test/plan.d.ts +0 -92
- package/dist/commands/test/plan.js +0 -128
- package/dist/config/recipe-run.d.ts +0 -33
- package/dist/config/recipe-run.js +0 -28
- package/dist/core/sandbox-end.d.ts +0 -64
- package/dist/runner/live/snapshot-cache-gateway.d.ts +0 -12
- package/dist/runner/recipe.js +0 -425
- package/dist/runner/snapshot-cache.d.ts +0 -148
- package/dist/runner/snapshot-cache.js +0 -126
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { type CommandError, type ExecutionContext } from "@vercel/clinkr";
|
|
2
|
-
import type { z } from "zod";
|
|
3
|
-
import type { StormApp } from "../../context.ts";
|
|
4
|
-
import { type ResourceLifecycles } from "../../core/index.ts";
|
|
5
|
-
import type { PlannedSandboxesRun, PlannedWhere } from "../../planning/run-plan.ts";
|
|
6
|
-
import type { DriverHints, RunTestPlan } from "../../sdk/extension/index.ts";
|
|
7
|
-
import type { PlanCommand, PlannedCommand, PlannedSettings, RunPlan } from "./plan-run.ts";
|
|
8
|
-
import { type RunCommandRequest, type RunPlanRequest } from "./run-command.ts";
|
|
9
|
-
import { sandboxesErrors, type sandboxesRanSchema } from "./across-sandboxes-outcomes.ts";
|
|
10
|
-
export declare const SANDBOXES_MAX_KEY = "runner.sandboxes.max";
|
|
11
|
-
export declare const SANDBOXES_DEFAULT_KEY = "runner.sandboxes.default";
|
|
12
|
-
type SandboxesMaxRefusal = ReturnType<typeof sandboxesErrors.missingSandboxesMax> | ReturnType<typeof sandboxesErrors.sandboxesOverMax>;
|
|
13
|
-
/** The runner sandboxes a run asks for: how many, and the flag that asked. */
|
|
14
|
-
export interface SandboxesAsk {
|
|
15
|
-
readonly count: number;
|
|
16
|
-
readonly flag: "--sandboxes" | "--file-lists";
|
|
17
|
-
}
|
|
18
|
-
export type AcrossSandboxesWhere = Extract<PlannedWhere, {
|
|
19
|
-
readonly kind: "runner";
|
|
20
|
-
}>;
|
|
21
|
-
/**
|
|
22
|
-
* Where a run across runner sandboxes runs: `where`, a runner sandbox. Every run across runner sandboxes uses the Vercel
|
|
23
|
-
* Sandbox runner: `planRun` refuses `--sandboxes` and `--file-lists` for the launch machine runner
|
|
24
|
-
* (`conflicting_options`), and `runner.sandboxes.default` lives in `vercelSandbox({ … })`. So any other `where` is a
|
|
25
|
-
* mistake in storm, and throws.
|
|
26
|
-
*/
|
|
27
|
-
export declare function acrossSandboxesWhere(where: PlannedWhere): AcrossSandboxesWhere;
|
|
28
|
-
/**
|
|
29
|
-
* A command's part of planning a run across runner sandboxes, once storm knows the run's runner and its max (`max`):
|
|
30
|
-
* the command's part of planning (`PlannedCommand`), with each runner sandbox's command and file list.
|
|
31
|
-
*/
|
|
32
|
-
export type PlanSandboxesRun<TTestPlan extends RunTestPlan, TRefusal> = (plan: {
|
|
33
|
-
readonly where: AcrossSandboxesWhere;
|
|
34
|
-
readonly max: number;
|
|
35
|
-
readonly settings: PlannedSettings;
|
|
36
|
-
}, signal: AbortSignal) => Promise<(PlannedCommand<TTestPlan> & {
|
|
37
|
-
readonly sandboxes: PlannedSandboxesRun;
|
|
38
|
-
}) | {
|
|
39
|
-
readonly ok: false;
|
|
40
|
-
readonly refusal: TRefusal;
|
|
41
|
-
}>;
|
|
42
|
-
/**
|
|
43
|
-
* How one command runs a planned run across runner sandboxes: its name, the driver and suite of a `storm test` run, its
|
|
44
|
-
* words, and its `sandboxes_ran` outcome, from what every such run reports and whether it saved no final test result.
|
|
45
|
-
*/
|
|
46
|
-
export interface AcrossSandboxesSpec<TRan> {
|
|
47
|
-
readonly name: string;
|
|
48
|
-
/** The driver and suite (`null` for the project's tests) of a `storm test` run; absent for `storm exec`. Recorded in `run.json`. */
|
|
49
|
-
readonly test?: {
|
|
50
|
-
readonly driver: string;
|
|
51
|
-
readonly suite: string | null;
|
|
52
|
-
} | undefined;
|
|
53
|
-
readonly hints: Pick<DriverHints, "noFinalResults">;
|
|
54
|
-
readonly extraMismatchHint?: string;
|
|
55
|
-
sandboxesRan(facts: z.input<typeof sandboxesRanSchema>, noFinalTestResults: boolean): TRan;
|
|
56
|
-
}
|
|
57
|
-
/** A planned run across runner sandboxes: its runner sandboxes, and the runner that each runner sandbox starts from. */
|
|
58
|
-
export type AcrossSandboxesPlan = RunPlan & {
|
|
59
|
-
readonly where: AcrossSandboxesWhere;
|
|
60
|
-
readonly sandboxes: PlannedSandboxesRun;
|
|
61
|
-
};
|
|
62
|
-
/** Keep time of each runner sandbox, in milliseconds: `--keep-sandbox`, else 0. */
|
|
63
|
-
export declare function sandboxKeepMs(flag: string | undefined): number;
|
|
64
|
-
/**
|
|
65
|
-
* Plans a run that asks for runner sandboxes (`asked`: `--sandboxes` or `--file-lists`), before it mints. It refuses a
|
|
66
|
-
* config file with no `runner.sandboxes` (`missing_sandboxes_max`) and more runner sandboxes than its max
|
|
67
|
-
* (`sandboxes_over_max`).
|
|
68
|
-
*/
|
|
69
|
-
export declare function planAskedSandboxesRun<TTestPlan extends RunTestPlan, TRefusal extends CommandError = never>(app: StormApp, request: RunPlanRequest, asked: SandboxesAsk, planSandboxes: PlanSandboxesRun<TTestPlan, TRefusal>, signal: AbortSignal): Promise<{
|
|
70
|
-
readonly ok: false;
|
|
71
|
-
readonly refusal: CommandError<"invalid_resource_options">;
|
|
72
|
-
} | {
|
|
73
|
-
readonly ok: false;
|
|
74
|
-
readonly refusal: CommandError<"missing_target">;
|
|
75
|
-
} | {
|
|
76
|
-
readonly ok: false;
|
|
77
|
-
readonly refusal: import("@vercel/clinkr").ClinkrError<"canceled">;
|
|
78
|
-
} | {
|
|
79
|
-
readonly ok: false;
|
|
80
|
-
readonly refusal: CommandError<"conflicting_options">;
|
|
81
|
-
} | {
|
|
82
|
-
readonly ok: false;
|
|
83
|
-
readonly refusal: CommandError<"credentials_invalid">;
|
|
84
|
-
} | {
|
|
85
|
-
readonly ok: false;
|
|
86
|
-
readonly refusal: CommandError<"keep_sandbox_unsafe_secret_env_vars">;
|
|
87
|
-
} | {
|
|
88
|
-
readonly ok: false;
|
|
89
|
-
readonly refusal: CommandError<"missing_runner">;
|
|
90
|
-
} | {
|
|
91
|
-
readonly ok: false;
|
|
92
|
-
readonly refusal: CommandError<"unsafe_secret_env_vars_invalid">;
|
|
93
|
-
} | {
|
|
94
|
-
readonly ok: false;
|
|
95
|
-
readonly refusal: TRefusal | SandboxesMaxRefusal;
|
|
96
|
-
} | {
|
|
97
|
-
readonly ok: true;
|
|
98
|
-
readonly planned: {
|
|
99
|
-
readonly ok: true;
|
|
100
|
-
readonly configFile: string | null;
|
|
101
|
-
readonly settings: import("../../config/resolve.ts").ResolvedSettings;
|
|
102
|
-
readonly where: PlannedWhere;
|
|
103
|
-
readonly argv: readonly string[];
|
|
104
|
-
readonly testPlan: TTestPlan;
|
|
105
|
-
readonly testFiles: readonly string[] | undefined;
|
|
106
|
-
readonly sandboxes: PlannedSandboxesRun | undefined;
|
|
107
|
-
readonly resources: {
|
|
108
|
-
readonly [key: string]: import("../../config/resolve.ts").ResolvedResourceRecord;
|
|
109
|
-
};
|
|
110
|
-
readonly planOptions: Readonly<{
|
|
111
|
-
path: string;
|
|
112
|
-
value: string | number | boolean;
|
|
113
|
-
from: "default" | "file" | "flag";
|
|
114
|
-
}>[];
|
|
115
|
-
};
|
|
116
|
-
readonly lifecycles: ResourceLifecycles;
|
|
117
|
-
}>;
|
|
118
|
-
/**
|
|
119
|
-
* Plans a run of a command that takes its runner sandboxes from `runner.sandboxes.default`: a run across runner
|
|
120
|
-
* sandboxes when the run has a runner whose recipe sets the default, and else a run that is not across runner
|
|
121
|
-
* sandboxes, planned by `planCommand`. A run that the default gives runner sandboxes refuses `--show-output`
|
|
122
|
-
* (`sandboxes_default_refused`).
|
|
123
|
-
*/
|
|
124
|
-
export declare function planDefaultSandboxesRun<TTestPlan extends RunTestPlan, TRefusal extends CommandError = never>(app: StormApp, request: RunPlanRequest, planCommand: PlanCommand<TTestPlan, TRefusal>, planSandboxes: PlanSandboxesRun<TTestPlan, TRefusal>, signal: AbortSignal): Promise<{
|
|
125
|
-
readonly ok: false;
|
|
126
|
-
readonly refusal: CommandError<"invalid_resource_options">;
|
|
127
|
-
} | {
|
|
128
|
-
readonly ok: false;
|
|
129
|
-
readonly refusal: CommandError<"missing_target">;
|
|
130
|
-
} | {
|
|
131
|
-
readonly ok: false;
|
|
132
|
-
readonly refusal: TRefusal;
|
|
133
|
-
} | {
|
|
134
|
-
readonly ok: false;
|
|
135
|
-
readonly refusal: import("@vercel/clinkr").ClinkrError<"canceled">;
|
|
136
|
-
} | {
|
|
137
|
-
readonly ok: false;
|
|
138
|
-
readonly refusal: CommandError<"conflicting_options">;
|
|
139
|
-
} | {
|
|
140
|
-
readonly ok: false;
|
|
141
|
-
readonly refusal: CommandError<"credentials_invalid">;
|
|
142
|
-
} | {
|
|
143
|
-
readonly ok: false;
|
|
144
|
-
readonly refusal: CommandError<"keep_sandbox_unsafe_secret_env_vars">;
|
|
145
|
-
} | {
|
|
146
|
-
readonly ok: false;
|
|
147
|
-
readonly refusal: CommandError<"missing_runner">;
|
|
148
|
-
} | {
|
|
149
|
-
readonly ok: false;
|
|
150
|
-
readonly refusal: CommandError<"sandboxes_default_refused">;
|
|
151
|
-
} | {
|
|
152
|
-
readonly ok: false;
|
|
153
|
-
readonly refusal: CommandError<"unsafe_secret_env_vars_invalid">;
|
|
154
|
-
} | {
|
|
155
|
-
readonly ok: true;
|
|
156
|
-
readonly planned: {
|
|
157
|
-
readonly ok: true;
|
|
158
|
-
readonly configFile: string | null;
|
|
159
|
-
readonly settings: import("../../config/resolve.ts").ResolvedSettings;
|
|
160
|
-
readonly where: PlannedWhere;
|
|
161
|
-
readonly argv: readonly string[];
|
|
162
|
-
readonly testPlan: TTestPlan;
|
|
163
|
-
readonly testFiles: readonly string[] | undefined;
|
|
164
|
-
readonly sandboxes: PlannedSandboxesRun | undefined;
|
|
165
|
-
readonly resources: {
|
|
166
|
-
readonly [key: string]: import("../../config/resolve.ts").ResolvedResourceRecord;
|
|
167
|
-
};
|
|
168
|
-
readonly planOptions: Readonly<{
|
|
169
|
-
path: string;
|
|
170
|
-
value: string | number | boolean;
|
|
171
|
-
from: "default" | "file" | "flag";
|
|
172
|
-
}>[];
|
|
173
|
-
};
|
|
174
|
-
readonly lifecycles: ResourceLifecycles;
|
|
175
|
-
}>;
|
|
176
|
-
/**
|
|
177
|
-
* Runs a planned run across runner sandboxes through the unified session, lifecycle, redaction, and outcome pipeline.
|
|
178
|
-
*/
|
|
179
|
-
export declare function runPlannedAcrossSandboxes<TRan>(context: ExecutionContext<StormApp>, request: RunCommandRequest, spec: AcrossSandboxesSpec<TRan>, planned: AcrossSandboxesPlan, lifecycles: ResourceLifecycles): Promise<TRan | import("@vercel/clinkr").ClinkrError<"canceled"> | CommandError<"credential_unused"> | CommandError<"invalid_config"> | CommandError<"mint_failed"> | CommandError<"missing_target"> | CommandError<"no_base_ref"> | CommandError<"resource_needs_runner_sandbox"> | CommandError<"resource_refused"> | CommandError<"resource_refused_before_run"> | CommandError<"runner_failed"> | CommandError<"snapshot_gone"> | CommandError<"spawn_failed"> | CommandError<"submodules_refused">>;
|
|
180
|
-
export {};
|
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
// A run across runner sandboxes, in two parts. Planning: `planAskedSandboxesRun` plans a run that asks for runner
|
|
2
|
-
// sandboxes (`--sandboxes` or `--file-lists`), and `planDefaultSandboxesRun` a run that takes them from
|
|
3
|
-
// `runner.sandboxes.default` when the recipe has one; both plan through `planCommandRun` (`run-command.ts`), as a run
|
|
4
|
-
// that is not across runner sandboxes does. Running: `runPlannedAcrossSandboxes` reuses `beforeRunStarts`,
|
|
5
|
-
// `runnerRequestFor`, `runLifecycle`, and `mapStoppedOutcome` from `run-command.ts`, routes runner
|
|
6
|
-
// sandbox headers and events through the shared `redactor`, tags test events with `sandbox` before calling
|
|
7
|
-
// `testsSummaryLines`, and shows the run through its view (`sandbox-view.ts`).
|
|
8
|
-
import { refused } from "@vercel/clinkr";
|
|
9
|
-
import { executeAcrossSandboxes, acrossSandboxesExitStatus, timedProgress, } from "../../core/index.js";
|
|
10
|
-
import { DEFINITION_SET } from "../../extensions.js";
|
|
11
|
-
import { lacksFinalResults } from "../../planning/final-results.js";
|
|
12
|
-
import { redactingObserver, redactingTerminal, redactor, redactStrings } from "../../planning/redaction.js";
|
|
13
|
-
import { fileListMismatches } from "../../planning/file-lists.js";
|
|
14
|
-
import { recordedPlan } from "../../planning/test-plan.js";
|
|
15
|
-
import { recordAcrossSandboxes, } from "../../run-directory/index.js";
|
|
16
|
-
import { RUN_CLEANUP } from "../../shared/cleanup.js";
|
|
17
|
-
import { sandboxConnectPage } from "../../shared/dashboard.js";
|
|
18
|
-
import { acrossSandboxesJobSummaryMarkdown } from "../../shared/job-summary.js";
|
|
19
|
-
import { testsSummaryLines } from "../../shared/tests-summary.js";
|
|
20
|
-
import { isoSecondsText, paint } from "../../shared/text.js";
|
|
21
|
-
import { waterfallLines } from "../../shared/waterfall.js";
|
|
22
|
-
import { testsChart } from "../../shared/worker-chart.js";
|
|
23
|
-
import { parseKeepTime } from "../../time/index.js";
|
|
24
|
-
import { beforeRunStarts, checkoutGit, displayPath, logsText, mapStoppedOutcome, planCommandRun, runLifecycle, runnerRequestFor, } from "./run-command.js";
|
|
25
|
-
import { acrossSandboxesEndLines, acrossSandboxesHeaderLines, showsFailed, } from "./sandbox-lines.js";
|
|
26
|
-
import { sandboxesDefaultErrors, sandboxesErrors } from "./across-sandboxes-outcomes.js";
|
|
27
|
-
import { sandboxProgress } from "./sandbox-progress.js";
|
|
28
|
-
import { sandboxView } from "./sandbox-view.js";
|
|
29
|
-
export const SANDBOXES_MAX_KEY = "runner.sandboxes.max";
|
|
30
|
-
export const SANDBOXES_DEFAULT_KEY = "runner.sandboxes.default";
|
|
31
|
-
const SHOW_OUTPUT_ACROSS_SANDBOXES = "a run across runner sandboxes prints status lines and no step output, and each runner sandbox entry of its run directory keeps its step logs; drop --show-output.";
|
|
32
|
-
/**
|
|
33
|
-
* Where a run across runner sandboxes runs: `where`, a runner sandbox. Every run across runner sandboxes uses the Vercel
|
|
34
|
-
* Sandbox runner: `planRun` refuses `--sandboxes` and `--file-lists` for the launch machine runner
|
|
35
|
-
* (`conflicting_options`), and `runner.sandboxes.default` lives in `vercelSandbox({ … })`. So any other `where` is a
|
|
36
|
-
* mistake in storm, and throws.
|
|
37
|
-
*/
|
|
38
|
-
export function acrossSandboxesWhere(where) {
|
|
39
|
-
if (where.kind !== "runner")
|
|
40
|
-
throw new Error("a run across runner sandboxes has a runner");
|
|
41
|
-
return where;
|
|
42
|
-
}
|
|
43
|
-
/** Keep time of each runner sandbox, in milliseconds: `--keep-sandbox`, else 0. */
|
|
44
|
-
export function sandboxKeepMs(flag) {
|
|
45
|
-
const minutes = flag === undefined ? 0 : (parseKeepTime(flag) ?? 0);
|
|
46
|
-
return minutes * 60_000;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Plans a run that asks for runner sandboxes (`asked`: `--sandboxes` or `--file-lists`), before it mints. It refuses a
|
|
50
|
-
* config file with no `runner.sandboxes` (`missing_sandboxes_max`) and more runner sandboxes than its max
|
|
51
|
-
* (`sandboxes_over_max`).
|
|
52
|
-
*/
|
|
53
|
-
export async function planAskedSandboxesRun(app, request, asked, planSandboxes, signal) {
|
|
54
|
-
return await planCommandRun(app, request, async (planned, planSignal, settings) => {
|
|
55
|
-
const where = acrossSandboxesWhere(planned);
|
|
56
|
-
const { configFile } = settings;
|
|
57
|
-
const policy = where.recipe.sandboxes;
|
|
58
|
-
if (policy === undefined)
|
|
59
|
-
return refused(sandboxesErrors.missingSandboxesMax({ flag: asked.flag, key: SANDBOXES_MAX_KEY, configFile }));
|
|
60
|
-
if (asked.count > policy.max)
|
|
61
|
-
return refused(sandboxesErrors.sandboxesOverMax({
|
|
62
|
-
flag: asked.flag,
|
|
63
|
-
sandboxes: asked.count,
|
|
64
|
-
key: SANDBOXES_MAX_KEY,
|
|
65
|
-
max: policy.max,
|
|
66
|
-
configFile,
|
|
67
|
-
}));
|
|
68
|
-
return await planSandboxes({ where, max: policy.max, settings }, planSignal);
|
|
69
|
-
}, signal);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Plans a run of a command that takes its runner sandboxes from `runner.sandboxes.default`: a run across runner
|
|
73
|
-
* sandboxes when the run has a runner whose recipe sets the default, and else a run that is not across runner
|
|
74
|
-
* sandboxes, planned by `planCommand`. A run that the default gives runner sandboxes refuses `--show-output`
|
|
75
|
-
* (`sandboxes_default_refused`).
|
|
76
|
-
*/
|
|
77
|
-
export async function planDefaultSandboxesRun(app, request, planCommand, planSandboxes, signal) {
|
|
78
|
-
const plan = await planCommandRun(app, request, async (where, planSignal, settings) => {
|
|
79
|
-
const policy = where.kind === "runner" ? where.recipe.sandboxes : undefined;
|
|
80
|
-
if (where.kind !== "runner" || policy?.default === undefined)
|
|
81
|
-
return await planCommand(where, planSignal, settings);
|
|
82
|
-
return await planSandboxes({ where, max: policy.max, settings }, planSignal);
|
|
83
|
-
}, signal);
|
|
84
|
-
if (!plan.ok || plan.planned.sandboxes === undefined)
|
|
85
|
-
return plan;
|
|
86
|
-
if (request.showOutput)
|
|
87
|
-
return refused(sandboxesDefaultErrors.sandboxesDefaultRefused({
|
|
88
|
-
key: SANDBOXES_DEFAULT_KEY,
|
|
89
|
-
sandboxes: plan.planned.sandboxes.sandboxes.length,
|
|
90
|
-
field: "showOutput",
|
|
91
|
-
problem: SHOW_OUTPUT_ACROSS_SANDBOXES,
|
|
92
|
-
configFile: plan.planned.configFile,
|
|
93
|
-
}));
|
|
94
|
-
return plan;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Runs a planned run across runner sandboxes through the unified session, lifecycle, redaction, and outcome pipeline.
|
|
98
|
-
*/
|
|
99
|
-
export async function runPlannedAcrossSandboxes(context, request, spec, planned, lifecycles) {
|
|
100
|
-
const { app, ui, signal } = context;
|
|
101
|
-
const { configFile, argv, where } = planned;
|
|
102
|
-
const sandboxes = planned.sandboxes.sandboxes;
|
|
103
|
-
const count = sandboxes.length;
|
|
104
|
-
// A run across runner sandboxes always has a test plan: its number of runner sandboxes, beside what it counted.
|
|
105
|
-
const plan = {
|
|
106
|
-
...(recordedPlan(planned.testPlan, planned.planOptions) ?? { options: [] }),
|
|
107
|
-
sandboxes: planned.sandboxes.count,
|
|
108
|
-
};
|
|
109
|
-
const before = await beforeRunStarts(context, lifecycles, planned, request, plan);
|
|
110
|
-
if (!before.ok)
|
|
111
|
-
return before.refusal;
|
|
112
|
-
const { used } = before;
|
|
113
|
-
const requested = await runnerRequestFor(app, where, used, {
|
|
114
|
-
configFile,
|
|
115
|
-
sandboxes: count,
|
|
116
|
-
keepMs: sandboxKeepMs(request.keepSandbox),
|
|
117
|
-
});
|
|
118
|
-
if (!requested.ok)
|
|
119
|
-
return requested.refusal;
|
|
120
|
-
const { runner } = requested;
|
|
121
|
-
// The resources' secrets, the credentials' values, and any unsafe secret environment variables' values.
|
|
122
|
-
const secrets = [...used.secrets, ...where.secrets];
|
|
123
|
-
const redact = redactor(secrets);
|
|
124
|
-
const git = await checkoutGit(app.context.checkout, app.cwd);
|
|
125
|
-
const recording = await recordAcrossSandboxes(app.context.runDirectories, {
|
|
126
|
-
definitionSet: DEFINITION_SET,
|
|
127
|
-
clock: app.context.clock,
|
|
128
|
-
cwd: app.cwd,
|
|
129
|
-
configFile,
|
|
130
|
-
argv,
|
|
131
|
-
...(spec.test === undefined ? {} : { test: spec.test }),
|
|
132
|
-
plan,
|
|
133
|
-
runner,
|
|
134
|
-
sandboxes,
|
|
135
|
-
git,
|
|
136
|
-
redact: (value) => redactStrings(value, redact),
|
|
137
|
-
});
|
|
138
|
-
const runDirectory = recording.opened.ok
|
|
139
|
-
? `${displayPath(recording.opened.path, app.env)}/`
|
|
140
|
-
: `none: couldn't make ${recording.opened.failure.path}: ${recording.opened.failure.message}`;
|
|
141
|
-
// Redact raw argv elements before shell-quoting so secrets containing apostrophes cannot bypass literal masking,
|
|
142
|
-
// and keep final header redaction for other fields such as runDirectory.
|
|
143
|
-
const view = sandboxView(app, ui.progress, sandboxProgress({
|
|
144
|
-
count,
|
|
145
|
-
listed: sandboxes.map(({ files }) => (files === null ? null : files.length)),
|
|
146
|
-
header: acrossSandboxesHeaderLines({
|
|
147
|
-
version: app.version,
|
|
148
|
-
commit: app.commit,
|
|
149
|
-
argv: argv.map(redact),
|
|
150
|
-
count,
|
|
151
|
-
runDirectory,
|
|
152
|
-
}).map(redact),
|
|
153
|
-
}));
|
|
154
|
-
const observer = recording.observer(view.observer);
|
|
155
|
-
const outcome = await runLifecycle({
|
|
156
|
-
execute: async () => await executeAcrossSandboxes(DEFINITION_SET, {
|
|
157
|
-
...app.context,
|
|
158
|
-
sandboxTerminal: (sandbox) => {
|
|
159
|
-
const terminal = recording.terminal(sandbox, app.context.runnerTerminal);
|
|
160
|
-
return secrets.length === 0 ? terminal : redactingTerminal(terminal, redact);
|
|
161
|
-
},
|
|
162
|
-
}, app.resourceContexts, {
|
|
163
|
-
version: app.version,
|
|
164
|
-
commit: app.commit,
|
|
165
|
-
configFile,
|
|
166
|
-
verbose: request.verbose,
|
|
167
|
-
runner,
|
|
168
|
-
sandboxes: sandboxes.map((sandbox) => ({
|
|
169
|
-
argv: sandbox.argv,
|
|
170
|
-
...(sandbox.files === null ? {} : { files: sandbox.files }),
|
|
171
|
-
})),
|
|
172
|
-
resources: used.requests,
|
|
173
|
-
skipped: used.skipped,
|
|
174
|
-
}, { signal }, timedProgress(app.context.clock, secrets.length === 0 ? observer : redactingObserver(observer, redact))),
|
|
175
|
-
redact,
|
|
176
|
-
hasSecrets: secrets.length > 0,
|
|
177
|
-
finishView: async () => view.finish(),
|
|
178
|
-
abandonRecording: async () => await recording.abandon(),
|
|
179
|
-
});
|
|
180
|
-
view.finish();
|
|
181
|
-
const recorded = await recording.end(outcome);
|
|
182
|
-
const mismatches = outcome.kind === "sandboxes_ran" ? listMismatches(recorded) : [];
|
|
183
|
-
await summarizeAcrossSandboxes(app, ui.progress, {
|
|
184
|
-
command: spec.name,
|
|
185
|
-
hints: spec.hints,
|
|
186
|
-
...(spec.extraMismatchHint === undefined ? {} : { extraMismatchHint: spec.extraMismatchHint }),
|
|
187
|
-
recording,
|
|
188
|
-
recorded,
|
|
189
|
-
outcome,
|
|
190
|
-
mismatches,
|
|
191
|
-
});
|
|
192
|
-
if (outcome.kind === "sandboxes_ran") {
|
|
193
|
-
app.exit.status = acrossSandboxesExitStatus(outcome.sandboxes);
|
|
194
|
-
const facts = sandboxesRanFacts(app, { outcome, recorded, recording, plan, runner, configFile, mismatches });
|
|
195
|
-
const everyExited0 = outcome.sandboxes.every(({ state, exitCode }) => state === "passed" && exitCode === 0);
|
|
196
|
-
const noFinalTestResults = lacksFinalResults(everyExited0 ? 0 : null, {
|
|
197
|
-
finalResults: recorded.tests.events.filter((event) => event.kind === "test-result").length,
|
|
198
|
-
partial: recorded.tests.unreadable > 0 || recorded.tests.incomplete !== undefined,
|
|
199
|
-
collected: true,
|
|
200
|
-
});
|
|
201
|
-
return spec.sandboxesRan(secrets.length === 0 ? facts : redactStrings(facts, redact), noFinalTestResults);
|
|
202
|
-
}
|
|
203
|
-
// Reuse the shared stopped-outcome mapper (including resource cancellation lines for canceled runs!).
|
|
204
|
-
const keptLines = recorded.sandboxes.flatMap(({ record }) => record.name === null || record.keptUntil === null
|
|
205
|
-
? []
|
|
206
|
-
: [`Kept runner sandbox ${record.sandbox}, ${record.name}, running until ${isoSecondsText(record.keptUntil)}.`]);
|
|
207
|
-
return mapStoppedOutcome(outcome, {
|
|
208
|
-
commandLine: outcome.kind === "canceled" && outcome.commandStopped === true
|
|
209
|
-
? "Each command that was running was stopped in its runner sandbox."
|
|
210
|
-
: "The command didn't run.",
|
|
211
|
-
keptLines,
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
function listMismatches(recorded) {
|
|
215
|
-
return fileListMismatches(recorded.sandboxes.map(({ record, tests }) => ({
|
|
216
|
-
sandbox: record.sandbox,
|
|
217
|
-
files: record.files,
|
|
218
|
-
exitCode: record.exitCode,
|
|
219
|
-
reported: tests.events.map((event) => event.file),
|
|
220
|
-
whole: tests.unreadable === 0 && tests.incomplete === undefined,
|
|
221
|
-
})));
|
|
222
|
-
}
|
|
223
|
-
async function summarizeAcrossSandboxes(app, progress, run) {
|
|
224
|
-
const { recording, recorded, hints } = run;
|
|
225
|
-
const { presentation } = app;
|
|
226
|
-
const width = Math.min(Math.max(presentation.columns ?? 80, 60), 120);
|
|
227
|
-
const style = paint(presentation.colorDepth !== "none");
|
|
228
|
-
// Tag each event with its runner sandbox so multi-sandbox worker counts aggregate per runner sandbox without
|
|
229
|
-
// colliding worker 0.
|
|
230
|
-
const events = recorded.sandboxes.flatMap((sandbox) => sandbox.tests.events.map((event) => ({ ...event, sandbox: sandbox.record.sandbox })));
|
|
231
|
-
const testsLines = testsSummaryLines(events, hints, recorded.tests.unreadable, recorded.tests.incomplete);
|
|
232
|
-
const failed = events.some((event) => event.kind === "test-result" && event.state === "fail");
|
|
233
|
-
const opened = recording.opened;
|
|
234
|
-
const summarized = await app.context.jobSummary.appendJobSummary(acrossSandboxesJobSummaryMarkdown(recorded.sandboxes.map(({ record }) => record), { command: run.command, logs: opened.ok ? opened.path : undefined, details: testsLines }));
|
|
235
|
-
if (progress === undefined)
|
|
236
|
-
return;
|
|
237
|
-
const ranSandboxes = run.outcome.kind === "sandboxes_ran" || run.outcome.kind === "canceled";
|
|
238
|
-
const sandboxes = recorded.sandboxes.map((sandbox) => {
|
|
239
|
-
const tests = sandbox.timeline.rows.find((row) => row.name === "command");
|
|
240
|
-
const charted = tests === undefined
|
|
241
|
-
? undefined
|
|
242
|
-
: testsChart(sandbox.tests.events, hints, sandbox.tests.unreadable, { runStartedAt: Date.parse(sandbox.timeline.startedAt), offsetMs: sandbox.workerOffsetMs, tests }, sandbox.tests.incomplete);
|
|
243
|
-
return {
|
|
244
|
-
sandbox: sandbox.record.sandbox,
|
|
245
|
-
waterfall: waterfallLines(sandbox.timeline, {
|
|
246
|
-
width,
|
|
247
|
-
colorDepth: presentation.colorDepth,
|
|
248
|
-
logs: undefined,
|
|
249
|
-
...(charted === undefined ? {} : { workers: charted.lanes, details: charted.notes }),
|
|
250
|
-
}),
|
|
251
|
-
};
|
|
252
|
-
});
|
|
253
|
-
const [first] = sandboxes;
|
|
254
|
-
const runId = opened.ok ? opened.id : undefined;
|
|
255
|
-
const records = recorded.sandboxes.map(({ record }) => record);
|
|
256
|
-
const lines = acrossSandboxesEndLines({
|
|
257
|
-
sandboxes: ranSandboxes ? sandboxes : [],
|
|
258
|
-
records,
|
|
259
|
-
tests: testsLines,
|
|
260
|
-
runId,
|
|
261
|
-
logs: logsText(recording, recorded.writeFailure, app.env, failed && !showsFailed(records, runId), false),
|
|
262
|
-
mismatches: run.mismatches,
|
|
263
|
-
...(run.extraMismatchHint === undefined ? {} : { extraMismatchHint: run.extraMismatchHint }),
|
|
264
|
-
paint: style,
|
|
265
|
-
});
|
|
266
|
-
const once = ranSandboxes || first === undefined ? [] : first.waterfall;
|
|
267
|
-
const summaryFailure = summarized.kind === "failed"
|
|
268
|
-
? [` couldn't append to the job summary at ${summarized.failure.path}: ${summarized.failure.message}`]
|
|
269
|
-
: [];
|
|
270
|
-
for (const line of [...once, ...lines, ...summaryFailure])
|
|
271
|
-
try {
|
|
272
|
-
await progress(line);
|
|
273
|
-
}
|
|
274
|
-
catch {
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
function sandboxesRanFacts(app, run) {
|
|
279
|
-
const { outcome, recorded, recording, plan, runner } = run;
|
|
280
|
-
const records = recorded.sandboxes.map(({ record }) => record);
|
|
281
|
-
const count = (state) => records.filter((record) => record.state === state).length;
|
|
282
|
-
const totals = records.flatMap(({ tests }) => (tests === null ? [] : [tests]));
|
|
283
|
-
const snapshotState = recorded.state.runner?.snapshot;
|
|
284
|
-
const { entry } = outcome.snapshot;
|
|
285
|
-
return {
|
|
286
|
-
version: app.version,
|
|
287
|
-
commit: app.commit,
|
|
288
|
-
configFile: run.configFile,
|
|
289
|
-
runId: recording.opened.ok ? recording.opened.id : null,
|
|
290
|
-
runDirectory: recording.opened.ok ? recording.opened.path : null,
|
|
291
|
-
sandboxes: records,
|
|
292
|
-
states: {
|
|
293
|
-
passed: count("passed"),
|
|
294
|
-
failed: count("failed"),
|
|
295
|
-
"not-started": count("not-started"),
|
|
296
|
-
canceled: count("canceled"),
|
|
297
|
-
},
|
|
298
|
-
tests: totals.length === 0
|
|
299
|
-
? null
|
|
300
|
-
: {
|
|
301
|
-
passed: totals.reduce((sum, { passed }) => sum + passed, 0),
|
|
302
|
-
failed: totals.reduce((sum, { failed }) => sum + failed, 0),
|
|
303
|
-
skipped: totals.reduce((sum, { skipped }) => sum + skipped, 0),
|
|
304
|
-
},
|
|
305
|
-
plan: {
|
|
306
|
-
...plan,
|
|
307
|
-
options: plan.options.map((option) => ({ ...option })),
|
|
308
|
-
...(plan.sandboxes === undefined ? {} : { sandboxes: { ...plan.sandboxes } }),
|
|
309
|
-
},
|
|
310
|
-
resources: DEFINITION_SET.reports.ranFacts(outcome.resources),
|
|
311
|
-
wallMs: recorded.wallMs,
|
|
312
|
-
runner: {
|
|
313
|
-
snapshotId: entry.snapshotId,
|
|
314
|
-
base: entry.base,
|
|
315
|
-
builtBehind: snapshotState !== undefined && snapshotState.kind !== "building" ? snapshotState.builtBehind : null,
|
|
316
|
-
built: outcome.snapshot.built,
|
|
317
|
-
vcpus: runner.prepared.vcpus,
|
|
318
|
-
region: entry.region,
|
|
319
|
-
runtime: entry.runtime,
|
|
320
|
-
uploadBytes: recorded.uploadBytes,
|
|
321
|
-
},
|
|
322
|
-
cleanup: RUN_CLEANUP.facts(outcome),
|
|
323
|
-
kept: outcome.sandboxes.flatMap(({ sandbox, runnerCleanup }) => {
|
|
324
|
-
const kept = runnerCleanup?.kept ?? null;
|
|
325
|
-
return kept === null
|
|
326
|
-
? []
|
|
327
|
-
: [{ sandbox, name: kept.name, stopsAt: kept.stopsAt, url: sandboxConnectPage(runner.target, kept.name) }];
|
|
328
|
-
}),
|
|
329
|
-
notKept: outcome.sandboxes.flatMap(({ sandbox, runnerCleanup }) => {
|
|
330
|
-
const notKept = runnerCleanup?.notKept ?? null;
|
|
331
|
-
return notKept === null ? [] : [{ sandbox, name: notKept.name, message: notKept.message }];
|
|
332
|
-
}),
|
|
333
|
-
fileListMismatches: run.mismatches.map(({ sandbox, missing, extra }) => ({
|
|
334
|
-
sandbox,
|
|
335
|
-
missing: [...missing],
|
|
336
|
-
extra: [...extra],
|
|
337
|
-
})),
|
|
338
|
-
};
|
|
339
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { StormApp } from "../../context.ts";
|
|
2
|
-
import type { ResourceLifecycles } from "../../core/index.ts";
|
|
3
|
-
import { type PlannedFacts } from "../../planning/plan-only.ts";
|
|
4
|
-
import type { RunPlan } from "./plan-run.ts";
|
|
5
|
-
/**
|
|
6
|
-
* The `planned` outcome of planned run `plan`, which starts nothing: the planned run, with each runner sandbox's
|
|
7
|
-
* command and file list when it is across runner sandboxes, and the vCPUs of each runner sandbox. The runner's local
|
|
8
|
-
* checks run for it (`prepareRunner`), so a refusal a run gets from them, `--plan-only` gets too.
|
|
9
|
-
*/
|
|
10
|
-
export declare function plannedRun<TPlanned>(app: StormApp, plan: RunPlan, lifecycles: ResourceLifecycles, planned: (facts: PlannedFacts) => TPlanned): Promise<TPlanned | 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">>;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// Thin CLI wiring for `--plan-only`: resolves `vcpus` via `prepareRunner` for a planned run, across runner sandboxes or
|
|
2
|
-
// not, builds redacted `PlannedFacts` through `src/planning/plan-only.ts`, and returns the `planned` outcome.
|
|
3
|
-
import { recipeRun } from "../../config/index.js";
|
|
4
|
-
import { buildPlannedFacts, plannedSecrets } from "../../planning/plan-only.js";
|
|
5
|
-
import { redactor, redactStrings } from "../../planning/redaction.js";
|
|
6
|
-
import { prepareRunner } from "../../runner/index.js";
|
|
7
|
-
import { prepareRefusal, recipeResources } from "./run-command.js";
|
|
8
|
-
/**
|
|
9
|
-
* The `planned` outcome of planned run `plan`, which starts nothing: the planned run, with each runner sandbox's
|
|
10
|
-
* command and file list when it is across runner sandboxes, and the vCPUs of each runner sandbox. The runner's local
|
|
11
|
-
* checks run for it (`prepareRunner`), so a refusal a run gets from them, `--plan-only` gets too.
|
|
12
|
-
*/
|
|
13
|
-
export async function plannedRun(app, plan, lifecycles, planned) {
|
|
14
|
-
const vcpus = await plannedVcpus(app, lifecycles, plan);
|
|
15
|
-
if (!vcpus.ok)
|
|
16
|
-
return vcpus.refusal;
|
|
17
|
-
return planned(buildPlannedFacts({
|
|
18
|
-
version: app.version,
|
|
19
|
-
commit: app.commit,
|
|
20
|
-
configFile: plan.configFile,
|
|
21
|
-
argv: plan.argv,
|
|
22
|
-
where: plan.where,
|
|
23
|
-
testPlan: plan.testPlan,
|
|
24
|
-
planOptions: plan.planOptions,
|
|
25
|
-
testFiles: plan.testFiles,
|
|
26
|
-
sandboxes: plan.sandboxes,
|
|
27
|
-
resources: plan.resources,
|
|
28
|
-
lifecycles,
|
|
29
|
-
vcpus: vcpus.vcpus,
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
/** The vCPUs of each runner sandbox of the planned run; null for a run with no runner. */
|
|
33
|
-
async function plannedVcpus(app, lifecycles, { where, configFile, resources, sandboxes }) {
|
|
34
|
-
if (where.kind !== "runner")
|
|
35
|
-
return { ok: true, vcpus: null };
|
|
36
|
-
const prepared = await prepareRunner(app.context, {
|
|
37
|
-
cwd: app.cwd,
|
|
38
|
-
recipe: where.recipe,
|
|
39
|
-
vcpusRun: recipeRun(recipeResources(resources), sandboxes?.sandboxes.length ?? 1),
|
|
40
|
-
});
|
|
41
|
-
if (prepared.kind === "ok")
|
|
42
|
-
return { ok: true, vcpus: prepared.prepared.vcpus };
|
|
43
|
-
const refusal = prepareRefusal(prepared, configFile);
|
|
44
|
-
const secrets = plannedSecrets(lifecycles, where, resources);
|
|
45
|
-
return { ok: false, refusal: secrets.length === 0 ? refusal : redactStrings(refusal, redactor(secrets)) };
|
|
46
|
-
}
|