@cnc-tools/storm 0.12.0 → 0.13.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.
Files changed (96) hide show
  1. package/dist/bin/storm.js +1 -1
  2. package/dist/build-info.js +1 -1
  3. package/dist/chunks/{chunk-4XT5RC5T.js → chunk-2NZXL6OH.js} +6 -42
  4. package/dist/chunks/{chunk-ISGQJIQM.js → chunk-5UMJNVKT.js} +1 -1
  5. package/dist/chunks/{chunk-FSP3SJ35.js → chunk-6EQKA7LI.js} +16 -46
  6. package/dist/chunks/{chunk-Y3BUNNRG.js → chunk-AX4EQZUS.js} +4 -4
  7. package/dist/chunks/{chunk-RYRJNHL7.js → chunk-DOFB2ACU.js} +3 -9
  8. package/dist/chunks/{chunk-SXW6XN4R.js → chunk-EGNP3S6C.js} +3 -3
  9. package/dist/chunks/{chunk-FK4RLDEK.js → chunk-N7E6DAUE.js} +1 -1
  10. package/dist/chunks/{chunk-U7M3ZB3Z.js → chunk-Q4TKRILH.js} +33 -167
  11. package/dist/chunks/{chunk-TMQQYHUX.js → chunk-RTILVSYQ.js} +1 -1
  12. package/dist/chunks/{chunk-7D6LC5JY.js → chunk-X4WBJIOF.js} +7 -39
  13. package/dist/chunks/{chunk-TEEZL3GA.js → chunk-YGS5VRQT.js} +11 -68
  14. package/dist/chunks/{chunk-ODQHQJLE.js → chunk-ZDJLKF2G.js} +742 -1117
  15. package/dist/chunks/{live-app-AZ5N5HBD.js → live-app-QFHS54SX.js} +4 -4
  16. package/dist/commands/exec/command.d.ts +2 -90
  17. package/dist/commands/exec/command.js +10 -10
  18. package/dist/commands/exec/define-run-command.d.ts +2 -90
  19. package/dist/commands/exec/live-view.js +18 -22
  20. package/dist/commands/exec/outcomes.d.ts +2 -106
  21. package/dist/commands/exec/outcomes.js +4 -35
  22. package/dist/commands/exec/progress.d.ts +3 -19
  23. package/dist/commands/exec/progress.js +16 -60
  24. package/dist/commands/exec/run-command.d.ts +4 -23
  25. package/dist/commands/exec/run-command.js +5 -79
  26. package/dist/commands/exec/run-metadata.d.ts +0 -6
  27. package/dist/commands/exec/run-metadata.js +2 -8
  28. package/dist/commands/exec/snapshot-text.d.ts +7 -16
  29. package/dist/commands/exec/snapshot-text.js +9 -49
  30. package/dist/commands/exec/view.js +2 -12
  31. package/dist/commands/playwright/command.d.ts +2 -90
  32. package/dist/commands/playwright/command.js +11 -11
  33. package/dist/commands/runs/facts.d.ts +1 -37
  34. package/dist/commands/runs/facts.js +4 -36
  35. package/dist/commands/runs/list/command.d.ts +0 -72
  36. package/dist/commands/runs/list/command.js +5 -5
  37. package/dist/commands/runs/list/outcomes.d.ts +0 -36
  38. package/dist/commands/runs/logs/command.js +5 -5
  39. package/dist/commands/runs/show/command.d.ts +0 -72
  40. package/dist/commands/runs/show/command.js +13 -40
  41. package/dist/commands/runs/show/metadata.js +1 -1
  42. package/dist/commands/runs/show/outcomes.d.ts +0 -36
  43. package/dist/commands/runs/show/outcomes.js +8 -42
  44. package/dist/commands/snapshots/build/command.d.ts +14 -411
  45. package/dist/commands/snapshots/build/command.js +56 -231
  46. package/dist/commands/snapshots/build/metadata.js +10 -7
  47. package/dist/commands/snapshots/build/outcomes.d.ts +11 -241
  48. package/dist/commands/snapshots/build/outcomes.js +29 -196
  49. package/dist/commands/snapshots/list/command.d.ts +2 -36
  50. package/dist/commands/snapshots/list/command.js +17 -53
  51. package/dist/commands/snapshots/list/metadata.js +1 -1
  52. package/dist/commands/snapshots/list/outcomes.d.ts +2 -37
  53. package/dist/commands/snapshots/list/outcomes.js +13 -53
  54. package/dist/commands/vitest/command.d.ts +2 -90
  55. package/dist/commands/vitest/command.js +11 -11
  56. package/dist/core/events.d.ts +5 -6
  57. package/dist/core/run-state.d.ts +7 -29
  58. package/dist/core/run-state.js +3 -26
  59. package/dist/core/run.d.ts +6 -14
  60. package/dist/core/run.js +17 -28
  61. package/dist/extensions/testserver/commands/pool/create/command.js +1 -1
  62. package/dist/run-directory/index.d.ts +1 -1
  63. package/dist/run-directory/index.js +0 -1
  64. package/dist/run-directory/recording.js +2 -2
  65. package/dist/run-directory/run-record.d.ts +14 -132
  66. package/dist/run-directory/run-record.js +8 -68
  67. package/dist/runner/build-snapshots.d.ts +50 -114
  68. package/dist/runner/build-snapshots.js +70 -159
  69. package/dist/runner/events.d.ts +4 -88
  70. package/dist/runner/gateways.d.ts +5 -23
  71. package/dist/runner/index.d.ts +5 -6
  72. package/dist/runner/index.js +1 -1
  73. package/dist/runner/live/snapshot-records.js +7 -18
  74. package/dist/runner/prepare.d.ts +11 -22
  75. package/dist/runner/prepare.js +6 -17
  76. package/dist/runner/ready.d.ts +16 -45
  77. package/dist/runner/ready.js +34 -59
  78. package/dist/runner/recipe.d.ts +0 -44
  79. package/dist/runner/recipe.js +0 -41
  80. package/dist/runner/scope.d.ts +8 -25
  81. package/dist/runner/scope.js +4 -8
  82. package/dist/runner/session.d.ts +18 -65
  83. package/dist/runner/session.js +15 -83
  84. package/dist/runner/snapshot-build.d.ts +2 -2
  85. package/dist/runner/snapshot-cache.d.ts +22 -74
  86. package/dist/runner/snapshot-cache.js +15 -107
  87. package/dist/runner/snapshot-inspect.d.ts +9 -13
  88. package/dist/runner/snapshot-inspect.js +48 -57
  89. package/dist/runner/snapshot-key.d.ts +9 -14
  90. package/dist/runner/snapshot-key.js +15 -22
  91. package/package.json +1 -1
  92. package/skills/read-run-output.md +8 -9
  93. package/dist/runner/snapshot-save.d.ts +0 -70
  94. package/dist/runner/snapshot-save.js +0 -160
  95. package/dist/runner/snapshot-start.d.ts +0 -25
  96. package/dist/runner/snapshot-start.js +0 -16
@@ -5,7 +5,7 @@ import { configErrors, credentialErrors } from "../../config/index.js";
5
5
  import { keptText, RUN_CLEANUP, runnerCleanupWarnings } from "./cleanup.js";
6
6
  import { mintFailedErrors } from "./mint-failed.js";
7
7
  import { resourceRefusalErrors } from "./resource-refusals.js";
8
- import { noSaveReasonSchema, saveSchema, timelineSchema } from "../../run-directory/index.js";
8
+ import { timelineSchema } from "../../run-directory/index.js";
9
9
  /** Why the runner couldn't run the command. */
10
10
  const runnerFailureSchema = z.union([
11
11
  z.object({
@@ -114,18 +114,10 @@ export const ranSchema = z.object({
114
114
  .object({
115
115
  /** The runner snapshot it started from. */
116
116
  snapshotId: z.string(),
117
- /** The runner snapshot's base, a full SHA. */
117
+ /** The runner snapshot's base, a full SHA: the commit it was built at. */
118
118
  base: z.string(),
119
- /** For a dev snapshot, the local branch of the run that saved it; null for a base snapshot. */
120
- snapshotBranch: z.string().nullable(),
121
- /** For a dev snapshot, the HEAD commit of the run that saved it, a full SHA; null for a base snapshot. */
122
- snapshotHead: z.string().nullable(),
123
- /** The runner snapshot's kind: a base snapshot, built from its base, or a dev snapshot, saved from a run. */
124
- snapshotKind: z.enum(["base", "dev"]),
125
- /** The commit the runner snapshot was built at, a full SHA: a base snapshot's base, or the commit that saved a dev snapshot. */
126
- snapshotBuiltAt: z.string(),
127
- /** How many commits HEAD has that the snapshot's built-at commit lacks, 0 for a snapshot built at HEAD's commit; null when storm couldn't count them. */
128
- builtBehind: z.number().nullable(),
119
+ /** How many commits HEAD has that the snapshot's base lacks, 0 for a snapshot built at HEAD's commit. */
120
+ builtBehind: z.number(),
129
121
  /** How many bytes of changes the run uploaded on top of the snapshot's base. */
130
122
  uploadBytes: z.number(),
131
123
  /** Whether this run built the runner snapshot. */
@@ -135,10 +127,6 @@ export const ranSchema = z.object({
135
127
  runtime: z.string(),
136
128
  /** How long the build step took, in milliseconds. */
137
129
  buildMs: z.number(),
138
- /** How saving the runner sandbox as a dev snapshot ended; null when the run started no save. */
139
- save: saveSchema.nullable(),
140
- /** Why the run, whose command ended on its own, started no save of a dev snapshot; null when it started one. */
141
- noSaveReason: noSaveReasonSchema.nullable(),
142
130
  })
143
131
  .nullable(),
144
132
  /** The run's waterfall, as the run directory's timeline.json holds it: each lane's label, span and steps in milliseconds since the run started, how they ended, idle time, and the critical path. */
@@ -192,25 +180,6 @@ export const runErrors = defineErrors({
192
180
  ],
193
181
  }),
194
182
  },
195
- devSnapshotsNotTrusted: {
196
- exitCode: 2,
197
- description: "--save-dev-snapshot was given to a sandboxed run whose runner recipe's install or build step names a runner secret, and the recipe doesn't set trustDevSnapshots: true. A dev snapshot holds what a command wrote, and those steps run on top of it in later runs with their secrets, so only the recipe grants that trust. Nothing was minted, acquired or created.",
198
- schema: z.object({
199
- /** The flag given, as typed. */
200
- flag: z.string(),
201
- /** The config file that gave the runner recipe; null when none did. */
202
- configFile: z.string().nullable(),
203
- }),
204
- render: ({ flag, configFile }) => ({
205
- message: `${flag} saves a dev snapshot, and the runner recipe${configFile === null ? "" : ` in ${configFile}`} doesn't trust dev snapshots: its install or build step names a runner secret.`,
206
- next: [
207
- {
208
- type: "text",
209
- text: `Drop ${flag}, or set trustDevSnapshots: true under the runner key of storm.config.ts, which trusts every command run from a checkout with those secrets.`,
210
- },
211
- ],
212
- }),
213
- },
214
183
  missingRunner: {
215
184
  exitCode: 2,
216
185
  description: "A sandboxed run (no --unsandboxed) needs a runner recipe, and no storm.config.ts gives a runner key.",
@@ -37,11 +37,12 @@ export declare function progressLine(elapsedMs: number, lane: ProgressLane, text
37
37
  export declare const LANE_WIDTH: number;
38
38
  /**
39
39
  * The line that says which runner snapshot the run starts from: its id, and where it was built, in commits a person
40
- * knows. It names no kind of snapshot. The snapshot's base is the run's merge-base.
40
+ * knows: at HEAD's commit, at the run's merge-base (`mergeBase`, undefined when the run didn't say it), or some commits
41
+ * before HEAD.
41
42
  */
42
43
  export declare function snapshotReusedText(event: Extract<RunnerEvent, {
43
44
  readonly kind: "snapshot-reused";
44
- }>): string;
45
+ }>, mergeBase: string | undefined): string;
45
46
  /**
46
47
  * The lines that say the run builds a base snapshot: where and why, then why each cached snapshot of the recipe
47
48
  * doesn't fit.
@@ -49,23 +50,6 @@ export declare function snapshotReusedText(event: Extract<RunnerEvent, {
49
50
  export declare function snapshotBuildTexts(event: Extract<RunnerEvent, {
50
51
  readonly kind: "snapshot-build-started";
51
52
  }>): string[];
52
- /** Why a run whose command ended on its own saves no dev snapshot, as its line says. */
53
- export declare function devSnapshotSkippedText(event: Extract<RunnerEvent, {
54
- readonly kind: "dev-snapshot-skipped";
55
- }>): string;
56
- /** How saving a dev snapshot ended, as its line says. */
57
- export declare function devSnapshotSaveText(event: Extract<RunnerEvent, {
58
- readonly kind: "dev-snapshot-saved" | "dev-snapshot-not-saved";
59
- }>): string;
60
- /** HEAD as a save's lines name it: its branch, or that it is detached. */
61
- export declare function headText(branch: string | null): string;
62
- /**
63
- * What `storm snapshots build --full` did to the entries of the dev snapshots built on the base snapshot it replaced,
64
- * as its line says.
65
- */
66
- export declare function devSnapshotsDropText(event: Extract<RunnerEvent, {
67
- readonly kind: "dev-snapshots-dropped" | "dev-snapshots-not-dropped";
68
- }>): string;
69
53
  /** How a command ended, as its end line and the live view say. */
70
54
  export declare function commandEnd(outcome: RanCommand): string;
71
55
  /** A warning a resource instance reported, as a line in its lane: `warning: <message>`. */
@@ -2,7 +2,7 @@ import { mintTargetText } from "../../credential/index.js";
2
2
  import { megabytesText, secondsOf, secondsText, warningTally, } from "../../core/index.js";
3
3
  import { DEFINITION_SET } from "../../extensions.js";
4
4
  import { versionText } from "../../version.js";
5
- import { builtAtText, noSaveText, rejectionLines, snapshotCacheNoteText } from "./snapshot-text.js";
5
+ import { builtAtText, rejectionLines, snapshotCacheNoteText } from "./snapshot-text.js";
6
6
  import { isoSecondsText, keepTimeText, releaseText, seconds, short } from "./text.js";
7
7
  /**
8
8
  * A run's progress as plain lines through `write`, one call per line. Each of storm's own lines starts with the
@@ -47,6 +47,7 @@ export function plainRenderer(options) {
47
47
  lanesStartedAt: undefined,
48
48
  readyAt: { runner: undefined, resources: {} },
49
49
  cleanupStartedAt: undefined,
50
+ mergeBase: undefined,
50
51
  folded: false,
51
52
  };
52
53
  const resources = DEFINITION_SET.presentations.plain({ verbose: options.verbose === true });
@@ -141,7 +142,7 @@ function eventLines(event, now, state, line, options) {
141
142
  return [line("command", `${event.command} ${commandEnd(event.outcome)} after ${seconds(event.ms)}`)];
142
143
  case "cleanup-started":
143
144
  state.cleanupStartedAt = now;
144
- return [line("cleanup", cleanupText(event.runnerSandbox, releaseText(event.resources, false)))];
145
+ return [line("cleanup", cleanupText(event.keepMs, releaseText(event.resources, false)))];
145
146
  case "cleanup-finished": {
146
147
  const problems = [
147
148
  ...(event.notStopped === 0 ? [] : [`${event.notStopped} not stopped`]),
@@ -153,6 +154,7 @@ function eventLines(event, now, state, line, options) {
153
154
  ];
154
155
  }
155
156
  case "runner-prepared":
157
+ state.mergeBase = event.base;
156
158
  return [
157
159
  line("runner", `merge-base ${short(event.base)}, of HEAD and ${event.baseRef}`),
158
160
  ...preparedNoteTexts(event).map((text) => line("runner", text)),
@@ -171,7 +173,7 @@ function eventLines(event, now, state, line, options) {
171
173
  function runnerLines(event, state, line, options) {
172
174
  switch (event.kind) {
173
175
  case "snapshot-reused":
174
- return [line("runner", snapshotReusedText(event))];
176
+ return [line("runner", snapshotReusedText(event, state.mergeBase))];
175
177
  case "snapshot-build-started":
176
178
  return snapshotBuildTexts(event).map((text) => line("runner", text));
177
179
  case "runner-sandbox-starting":
@@ -223,25 +225,15 @@ function runnerLines(event, state, line, options) {
223
225
  ];
224
226
  case "sandbox-kept":
225
227
  return [line("cleanup", `kept the runner sandbox ${event.name} running until ${isoSecondsText(event.stopsAt)}`)];
226
- // The cleanup line says the run saves a dev snapshot.
227
- case "dev-snapshot-saving":
228
- return [];
229
- case "dev-snapshot-saved":
230
- case "dev-snapshot-not-saved":
231
- return [line("cleanup", devSnapshotSaveText(event))];
232
- case "dev-snapshot-skipped":
233
- return [line("cleanup", devSnapshotSkippedText(event))];
234
- case "dev-snapshots-dropped":
235
- case "dev-snapshots-not-dropped":
236
- return [line("runner", devSnapshotsDropText(event))];
237
228
  }
238
229
  }
239
230
  /**
240
231
  * The line that says which runner snapshot the run starts from: its id, and where it was built, in commits a person
241
- * knows. It names no kind of snapshot. The snapshot's base is the run's merge-base.
232
+ * knows: at HEAD's commit, at the run's merge-base (`mergeBase`, undefined when the run didn't say it), or some commits
233
+ * before HEAD.
242
234
  */
243
- export function snapshotReusedText(event) {
244
- return `snapshot ${event.snapshotId}, ${builtAtText({ ...event.snapshot, atMergeBase: event.snapshot.builtAt === event.base })}`;
235
+ export function snapshotReusedText(event, mergeBase) {
236
+ return `snapshot ${event.snapshotId}, ${builtAtText({ base: event.base, builtBehind: event.builtBehind, mergeBase })}`;
245
237
  }
246
238
  /**
247
239
  * The lines that say the run builds a base snapshot: where and why, then why each cached snapshot of the recipe
@@ -259,45 +251,12 @@ export function snapshotBuildTexts(event) {
259
251
  return [`${building} (${SNAPSHOT_BUILD_REASON_TEXT[why.kind]}); ${tail}`];
260
252
  }
261
253
  }
262
- /** Why a run whose command ended on its own saves no dev snapshot, as its line says. */
263
- export function devSnapshotSkippedText(event) {
264
- return `no new dev snapshot: ${noSaveText(event.reason)}`;
265
- }
266
- /** How saving a dev snapshot ended, as its line says. */
267
- export function devSnapshotSaveText(event) {
268
- if (event.kind === "dev-snapshot-saved") {
269
- return `saved dev snapshot ${event.snapshotId} for ${headText(event.branch)} at ${short(event.head)} in ${seconds(event.ms)} (${megabytesText(event.sizeBytes)})`;
270
- }
271
- return `not saving a dev snapshot: ${notSavedReason(event.save)}`;
272
- }
273
- /** HEAD as a save's lines name it: its branch, or that it is detached. */
274
- export function headText(branch) {
275
- return branch ?? "a detached HEAD";
276
- }
277
- function notSavedReason(save) {
278
- switch (save.kind) {
279
- case "failed":
280
- return `the ${save.step === "scrub" ? "scrub" : "save"} failed: ${save.message}`;
281
- case "stopped":
282
- return "the run is stopping";
283
- }
284
- }
285
254
  /** Why a base snapshot is being built, as its line says in parentheses. */
286
255
  const SNAPSHOT_BUILD_REASON_TEXT = {
287
256
  "no-snapshot": "no cached snapshot fits",
288
257
  full: "--full",
289
258
  base: "the cache has no base snapshot at that commit",
290
259
  };
291
- /**
292
- * What `storm snapshots build --full` did to the entries of the dev snapshots built on the base snapshot it replaced,
293
- * as its line says.
294
- */
295
- export function devSnapshotsDropText(event) {
296
- if (event.kind === "dev-snapshots-not-dropped")
297
- return `couldn't drop a dev snapshot built on the replaced base snapshot from the cache: ${event.message}; a later run may start from it`;
298
- const count = event.snapshotIds.length;
299
- return `dropped ${count} dev ${count === 1 ? "snapshot" : "snapshots"} built on the replaced base snapshot from the cache: ${event.snapshotIds.join(", ")}`;
300
- }
301
260
  /**
302
261
  * What a stopping run says it releases of its resource instances, such as ` and releasing a, b`, by their resource
303
262
  * keys: every instance the run takes, since it doesn't know yet what each acquire took.
@@ -314,18 +273,15 @@ function closeFold(state) {
314
273
  return ["::endgroup::"];
315
274
  }
316
275
  /**
317
- * What cleaning up does, as its first line says: with a runner sandbox (`sandbox`, null without one), saving the
318
- * runner sandbox as a dev snapshot while the resources are released, or keeping it running when its keep time is
319
- * above 0, else stopping and deleting the runner's sandboxes; then releasing the resource instances (`release`, none
320
- * when it releases none).
276
+ * What cleaning up does, as its first line says: with a runner sandbox (`keepMs`, null without one), keeping it running
277
+ * when its keep time is above 0, else stopping and deleting the runner's sandboxes; then releasing the resource
278
+ * instances (`release`, none when it releases none).
321
279
  */
322
- function cleanupText(sandbox, release) {
323
- if (sandbox === null)
280
+ function cleanupText(keepMs, release) {
281
+ if (keepMs === null)
324
282
  return release === undefined ? "nothing to release" : `${release}…`;
325
- if (sandbox.kind === "save")
326
- return `saving a dev snapshot of ${headText(sandbox.branch)}${release === undefined ? "" : ` while ${release}`}…`;
327
- const sandboxes = sandbox.ms > 0
328
- ? `keeping the runner sandbox running ${keepTimeText(sandbox.ms)}`
283
+ const sandboxes = keepMs > 0
284
+ ? `keeping the runner sandbox running ${keepTimeText(keepMs)}`
329
285
  : "stopping and deleting the runner's sandboxes";
330
286
  return `${sandboxes}${release === undefined ? "" : `, then ${release}`}…`;
331
287
  }
@@ -1,7 +1,7 @@
1
1
  import type { ArgumentIssue, CommandError, CommandResult, ExecutionContext } from "@vercel/clinkr";
2
2
  import { z } from "zod";
3
3
  import type { StormApp } from "../../context.ts";
4
- import { type CheckedRecipe, type CheckoutFailure, type PrepareRunnerOutcome, type RunnerSaveMode } from "../../runner/index.ts";
4
+ import { type CheckoutFailure, type PrepareRunnerOutcome } from "../../runner/index.ts";
5
5
  import { type DriverHints, type RunTestPlan } from "../../sdk/extension/index.ts";
6
6
  import { type RunRunnerFailure } from "../../core/index.ts";
7
7
  import { type PlanOption } from "../../run-directory/index.ts";
@@ -19,8 +19,6 @@ export declare const RUN_REQUEST_FIELDS: {
19
19
  mint: "mint";
20
20
  }>>;
21
21
  unsandboxed: z.ZodDefault<z.ZodBoolean>;
22
- saveDevSnapshot: z.ZodOptional<z.ZodBoolean>;
23
- noReuseDevSnapshot: z.ZodDefault<z.ZodBoolean>;
24
22
  showOutput: z.ZodDefault<z.ZodBoolean>;
25
23
  keepSandbox: z.ZodOptional<z.ZodString>;
26
24
  verbose: z.ZodDefault<z.ZodBoolean>;
@@ -39,8 +37,6 @@ declare const runRequestSchema: z.ZodObject<{
39
37
  mint: "mint";
40
38
  }>>;
41
39
  unsandboxed: z.ZodDefault<z.ZodBoolean>;
42
- saveDevSnapshot: z.ZodOptional<z.ZodBoolean>;
43
- noReuseDevSnapshot: z.ZodDefault<z.ZodBoolean>;
44
40
  showOutput: z.ZodDefault<z.ZodBoolean>;
45
41
  keepSandbox: z.ZodOptional<z.ZodString>;
46
42
  verbose: z.ZodDefault<z.ZodBoolean>;
@@ -104,18 +100,8 @@ export interface RunCommandSpec<TTestPlan extends RunTestPlan, TRan, TRefusal> {
104
100
  * always mints, for the runner sandbox, so it needs `scope` and `project` whatever its resources are. In a sandboxed
105
101
  * run, the first SIGINT, SIGTERM or SIGHUP stops the run in any phase: the sandboxed command is killed, every sandbox
106
102
  * the run started is stopped and deleted, the resources are released, and the run cancels. `storm snapshots build`
107
- * builds runner snapshots without a run. A sandboxed run saves the runner sandbox as a dev snapshot at HEAD's
108
- * commit once the command exited 0, while the resources are released, so a later run from this checkout at that
109
- * commit or on top of it starts from it, unless it started from a dev snapshot built at HEAD's commit: one save per
110
- * commit (`saveMode`). It saves none when `CI` is set, `--keep-sandbox` is above 0, or the recipe's install or build
111
- * step names a runner secret and the recipe doesn't set `trustDevSnapshots`. `--save-dev-snapshot` (not with
112
- * `--unsandboxed` or a `--keep-sandbox` above 0) saves once the command ended on its own, whatever its exit code and
113
- * whatever the run started from, under `CI` too; on a recipe that doesn't trust dev snapshots it is
114
- * `dev_snapshots_not_trusted`, a usage error that names the recipe key, before the runner's local checks.
115
- * `--save-dev-snapshot=false` saves none. The recipe's `saveDevSnapshot` says the same for every run that gives
116
- * neither that flag nor a `--keep-sandbox` above 0. `--no-reuse-dev-snapshot`, or the recipe's `reuseDevSnapshot: false`, starts
117
- * the run from a base snapshot. A run whose save starts keeps no runner sandbox, however the save ends; one whose
118
- * save never starts, such as one whose command failed without the flag, keeps it for the keep time.
103
+ * builds runner snapshots without a run. A run saves no runner snapshot as it ends: it keeps the runner sandbox for
104
+ * the keep time.
119
105
  *
120
106
  * `--credential` (no config key) picks the credential source: `mint`, the default, or `github-actions`, which requests
121
107
  * a GitHub Actions OIDC token instead and so needs no `--scope` or `--project`; any given are unused. A sandboxed run
@@ -148,7 +134,7 @@ export interface RunCommandSpec<TTestPlan extends RunTestPlan, TRan, TRefusal> {
148
134
  * storm reads the resources' secrets for it from each one's pure `secrets`, over its options merged once, each function
149
135
  * default given `NOT_COUNTED` (`settleRunResources`), whether or not the checks across them pass.
150
136
  */
151
- export declare function runCommand<TTestPlan extends RunTestPlan, TRan extends CommandResult, TRefusal extends CommandError = never>({ app, ui, signal }: ExecutionContext<StormApp>, request: RunCommandRequest, spec: RunCommandSpec<TTestPlan, TRan, TRefusal>): Promise<TRan | TRefusal | import("@vercel/clinkr").ClinkrError<"canceled"> | CommandError<"credential_unused"> | CommandError<"dev_snapshots_not_trusted"> | CommandError<"invalid_config"> | CommandError<"invalid_resource_options"> | CommandError<"mint_failed"> | CommandError<"missing_runner"> | CommandError<"missing_target"> | CommandError<"no_base_ref"> | CommandError<"resource_refused"> | CommandError<"resource_refused_before_run"> | CommandError<"runner_failed"> | CommandError<"runner_secrets_invalid"> | CommandError<"snapshot_gone"> | CommandError<"spawn_failed"> | CommandError<"submodules_refused">>;
137
+ export declare function runCommand<TTestPlan extends RunTestPlan, TRan extends CommandResult, TRefusal extends CommandError = never>({ app, ui, signal }: ExecutionContext<StormApp>, request: RunCommandRequest, spec: RunCommandSpec<TTestPlan, TRan, TRefusal>): Promise<TRan | TRefusal | import("@vercel/clinkr").ClinkrError<"canceled"> | CommandError<"credential_unused"> | CommandError<"invalid_config"> | CommandError<"invalid_resource_options"> | CommandError<"mint_failed"> | CommandError<"missing_runner"> | CommandError<"missing_target"> | CommandError<"no_base_ref"> | CommandError<"resource_refused"> | CommandError<"resource_refused_before_run"> | CommandError<"runner_failed"> | CommandError<"runner_secrets_invalid"> | CommandError<"snapshot_gone"> | CommandError<"spawn_failed"> | CommandError<"submodules_refused">>;
152
138
  /** What is wrong with a run's request that its schema can't say, as `validate` reports it. */
153
139
  export declare function runProblems(request: RunCommandRequest): readonly ArgumentIssue[];
154
140
  /**
@@ -163,11 +149,6 @@ export declare function prepareRefusal(prepared: Exclude<PrepareRunnerOutcome, {
163
149
  * `runner_failed` with `checkout-failed`, holding nothing.
164
150
  */
165
151
  export declare function checkoutFailedRefusal(failure: CheckoutFailure): CommandError<"runner_failed">;
166
- /**
167
- * The save mode of a run here that gives neither `--save-dev-snapshot` nor `--keep-sandbox`: the recipe default, else
168
- * the built-in default. `storm snapshots build` reads it to say when it saves a dev snapshot that such a run would not.
169
- */
170
- export declare function runSaveDefault(recipe: Pick<CheckedRecipe, "saveDevSnapshot" | "run" | "trustDevSnapshots">, env: Readonly<Record<string, string | undefined>>): RunnerSaveMode;
171
152
  /** How long a runner sandbox keeps running once its run ends, when neither the flag nor the recipe says. */
172
153
  export declare const DEFAULT_KEEP_SANDBOX_MINUTES = 30;
173
154
  /** A runner failure as outcomes report it. */
@@ -5,7 +5,7 @@
5
5
  import { z } from "zod";
6
6
  import { forwardSigterm } from "../../forward-sigterm.js";
7
7
  import { describeMintFailure } from "../../credential/index.js";
8
- import { prepareRunner, devSnapshotsTrusted, } from "../../runner/index.js";
8
+ import { prepareRunner, } from "../../runner/index.js";
9
9
  import { invalidConfig, recipeRun } from "../../config/index.js";
10
10
  import { isCi } from "../../sdk/extension/index.js";
11
11
  import { commandExitStatus, executeRun, timedProgress, } from "../../core/index.js";
@@ -31,8 +31,6 @@ const OWN_RUN_FIELDS = {
31
31
  project: z.string().min(1).optional(),
32
32
  credential: z.enum(["mint", "github-actions"]).optional(),
33
33
  unsandboxed: z.boolean().default(false),
34
- saveDevSnapshot: z.boolean().optional(),
35
- noReuseDevSnapshot: z.boolean().default(false),
36
34
  showOutput: z.boolean().default(false),
37
35
  keepSandbox: z.string().optional(),
38
36
  verbose: z.boolean().default(false),
@@ -78,18 +76,8 @@ const runRequestSchema = z.object(RUN_REQUEST_FIELDS);
78
76
  * always mints, for the runner sandbox, so it needs `scope` and `project` whatever its resources are. In a sandboxed
79
77
  * run, the first SIGINT, SIGTERM or SIGHUP stops the run in any phase: the sandboxed command is killed, every sandbox
80
78
  * the run started is stopped and deleted, the resources are released, and the run cancels. `storm snapshots build`
81
- * builds runner snapshots without a run. A sandboxed run saves the runner sandbox as a dev snapshot at HEAD's
82
- * commit once the command exited 0, while the resources are released, so a later run from this checkout at that
83
- * commit or on top of it starts from it, unless it started from a dev snapshot built at HEAD's commit: one save per
84
- * commit (`saveMode`). It saves none when `CI` is set, `--keep-sandbox` is above 0, or the recipe's install or build
85
- * step names a runner secret and the recipe doesn't set `trustDevSnapshots`. `--save-dev-snapshot` (not with
86
- * `--unsandboxed` or a `--keep-sandbox` above 0) saves once the command ended on its own, whatever its exit code and
87
- * whatever the run started from, under `CI` too; on a recipe that doesn't trust dev snapshots it is
88
- * `dev_snapshots_not_trusted`, a usage error that names the recipe key, before the runner's local checks.
89
- * `--save-dev-snapshot=false` saves none. The recipe's `saveDevSnapshot` says the same for every run that gives
90
- * neither that flag nor a `--keep-sandbox` above 0. `--no-reuse-dev-snapshot`, or the recipe's `reuseDevSnapshot: false`, starts
91
- * the run from a base snapshot. A run whose save starts keeps no runner sandbox, however the save ends; one whose
92
- * save never starts, such as one whose command failed without the flag, keeps it for the keep time.
79
+ * builds runner snapshots without a run. A run saves no runner snapshot as it ends: it keeps the runner sandbox for
80
+ * the keep time.
93
81
  *
94
82
  * `--credential` (no config key) picks the credential source: `mint`, the default, or `github-actions`, which requests
95
83
  * a GitHub Actions OIDC token instead and so needs no `--scope` or `--project`; any given are unused. A sandboxed run
@@ -220,19 +208,13 @@ export async function runCommand({ app, ui, signal }, request, spec) {
220
208
  : {
221
209
  snapshotId: outcome.runner.snapshotId,
222
210
  base: outcome.runner.base,
223
- snapshotBranch: outcome.runner.snapshotBranch,
224
- snapshotHead: outcome.runner.snapshotHead,
225
- snapshotKind: outcome.runner.snapshot.kind,
226
- snapshotBuiltAt: outcome.runner.snapshot.builtAt,
227
- builtBehind: outcome.runner.snapshot.builtBehind,
211
+ builtBehind: outcome.runner.builtBehind,
228
212
  uploadBytes: outcome.runner.uploadBytes,
229
213
  built: outcome.runner.built,
230
214
  vcpus: outcome.runner.vcpus,
231
215
  region: outcome.runner.region,
232
216
  runtime: outcome.runner.runtime,
233
217
  buildMs: outcome.runner.buildMs,
234
- save: outcome.runner.save,
235
- noSaveReason: outcome.runner.noSave,
236
218
  },
237
219
  timeline: ran,
238
220
  runId: recording.opened.ok ? recording.opened.id : null,
@@ -274,7 +256,7 @@ export async function runCommand({ app, ui, signal }, request, spec) {
274
256
  }
275
257
  /** What is wrong with a run's request that its schema can't say, as `validate` reports it. */
276
258
  export function runProblems(request) {
277
- const { credential, unsandboxed, saveDevSnapshot, showOutput, keepSandbox } = request;
259
+ const { credential, unsandboxed, showOutput, keepSandbox } = request;
278
260
  return [
279
261
  ...resourceFlagProblems(request),
280
262
  ...(!unsandboxed && credential === "github-actions"
@@ -309,22 +291,6 @@ export function runProblems(request) {
309
291
  },
310
292
  ]
311
293
  : []),
312
- ...(saveDevSnapshot === true && unsandboxed
313
- ? [
314
- {
315
- field: "saveDevSnapshot",
316
- message: "--save-dev-snapshot saves a sandboxed run's runner sandbox; drop it or --unsandboxed.",
317
- },
318
- ]
319
- : []),
320
- ...(saveDevSnapshot === true && keepsSandbox(keepSandbox)
321
- ? [
322
- {
323
- field: "saveDevSnapshot",
324
- message: "--save-dev-snapshot saves the runner sandbox instead of keeping it; drop --keep-sandbox or set it to 0.",
325
- },
326
- ]
327
- : []),
328
294
  ];
329
295
  }
330
296
  /**
@@ -346,18 +312,11 @@ async function runRequestFor(app, options) {
346
312
  };
347
313
  return { ok: true, run };
348
314
  }
349
- // No run flag grants the trust a recipe whose install or build takes a runner secret needs to save a dev snapshot.
350
- if (request.saveDevSnapshot && !devSnapshotsTrusted(where.recipe))
351
- return {
352
- ok: false,
353
- refusal: runErrors.devSnapshotsNotTrusted({ flag: "--save-dev-snapshot", configFile }),
354
- };
355
315
  const prepared = await prepareRunner(app.context, {
356
316
  cwd: app.cwd,
357
317
  recipe: where.recipe,
358
318
  // The recipe's `vcpus` reads each of the run's resources by its definition: one its `beforeRun` skipped isn't.
359
319
  vcpusRun: recipeRun(recipeResources(used.requests)),
360
- reuseDevSnapshots: !request.noReuseDevSnapshot && where.recipe.reuseDevSnapshot,
361
320
  });
362
321
  if (prepared.kind !== "ok") {
363
322
  const refusal = prepareRefusal(prepared, configFile);
@@ -377,7 +336,6 @@ async function runRequestFor(app, options) {
377
336
  target: where.target,
378
337
  user: app.user,
379
338
  secrets: where.secrets,
380
- save: saveMode(request, where.recipe, app.env),
381
339
  keepMs,
382
340
  },
383
341
  };
@@ -504,38 +462,6 @@ function recipeResources(requests) {
504
462
  return [key, { definition, options }];
505
463
  }));
506
464
  }
507
- /** Whether `--keep-sandbox` asks for a keep time above 0. `validate` refused a flag this can't read. */
508
- function keepsSandbox(flag) {
509
- return flag !== undefined && (parseKeepTime(flag) ?? 0) > 0;
510
- }
511
- /**
512
- * Whether a sandboxed run saves its runner sandbox as a dev snapshot (`RunnerSaveMode`): `--save-dev-snapshot` as
513
- * given, `always` or `never`; else never when `--keep-sandbox` asks to keep the runner sandbox, since a save deletes
514
- * it and the flag is this run's own; else the recipe's `saveDevSnapshot` as given, with `CI` set too, as its
515
- * `keepSandbox` applies there. With none of them it saves once per commit, once a command exits 0 (`new-head`), so a
516
- * failed command's runner sandbox is kept for a person to connect to, but never when `CI` is set, since the runner
517
- * snapshot cache is this machine's and a CI machine's next run rarely finds it, and never when the recipe's install
518
- * or build step names a runner secret and it doesn't set `trustDevSnapshots` (`devSnapshotsTrusted`).
519
- */
520
- function saveMode(request, recipe, env) {
521
- const flag = request.saveDevSnapshot;
522
- if (flag !== undefined)
523
- return flag ? { kind: "always" } : { kind: "never", reason: "no-save-flag" };
524
- if (keepsSandbox(request.keepSandbox))
525
- return { kind: "never", reason: "keep-sandbox" };
526
- if (recipe.saveDevSnapshot !== undefined)
527
- return recipe.saveDevSnapshot ? { kind: "always" } : { kind: "never", reason: "recipe" };
528
- if (isCi(env))
529
- return { kind: "never", reason: "ci" };
530
- return devSnapshotsTrusted(recipe) ? { kind: "new-head" } : { kind: "never", reason: "not-trusted" };
531
- }
532
- /**
533
- * The save mode of a run here that gives neither `--save-dev-snapshot` nor `--keep-sandbox`: the recipe default, else
534
- * the built-in default. `storm snapshots build` reads it to say when it saves a dev snapshot that such a run would not.
535
- */
536
- export function runSaveDefault(recipe, env) {
537
- return saveMode({}, recipe, env);
538
- }
539
465
  /** How long a runner sandbox keeps running once its run ends, when neither the flag nor the recipe says. */
540
466
  export const DEFAULT_KEEP_SANDBOX_MINUTES = 30;
541
467
  /**
@@ -15,12 +15,6 @@ export declare function runFields(verbose: string): {
15
15
  unsandboxed: {
16
16
  description: string;
17
17
  };
18
- saveDevSnapshot: {
19
- description: string;
20
- };
21
- noReuseDevSnapshot: {
22
- description: string;
23
- };
24
18
  keepSandbox: {
25
19
  valueLabel: string;
26
20
  description: string;
@@ -5,7 +5,7 @@
5
5
  // test runner: what `--verbose` does under a driver's program is the driver's to say (`DriverHelp.verbose`).
6
6
  import { RESOURCE_FLAG_HELP, RESOURCE_USAGE_FLAGS, resourceRunExamples } from "./resource-flags.js";
7
7
  /** The flags every run takes, as a usage line names them, before the command's own arguments. */
8
- export const RUN_USAGE_FLAGS = `${RESOURCE_USAGE_FLAGS} [--credential <SOURCE>] [--scope <TEAM> --project <PROJECT>] [--unsandboxed | [--save-dev-snapshot[=false]] [--no-reuse-dev-snapshot] [--show-output] [--keep-sandbox <DURATION>]] [--verbose]`;
8
+ export const RUN_USAGE_FLAGS = `${RESOURCE_USAGE_FLAGS} [--credential <SOURCE>] [--scope <TEAM> --project <PROJECT>] [--unsandboxed | [--show-output] [--keep-sandbox <DURATION>]] [--verbose]`;
9
9
  /**
10
10
  * The field descriptions of the run's own flags. `--verbose`'s ends in `verbose`, the driver's words for what
11
11
  * `verbose` in the run payload does under its program (`DriverHelp.verbose`).
@@ -18,15 +18,9 @@ const ownRunFields = (verbose) => ({
18
18
  unsandboxed: {
19
19
  description: "Run the command on this machine, with no isolation: it sees this machine's files and environment, less the variables the resources drop. Without it, the command runs in a Vercel Sandbox started from a runner snapshot of the base, with this checkout's changes applied, installed and built, from the runner key of storm.config.ts, and its output streams back with paths rewritten to this checkout's. No config key.",
20
20
  },
21
- saveDevSnapshot: {
22
- description: "Save the runner sandbox as a dev snapshot at HEAD's commit once the command ends on its own, after a successful install and build, whatever the command's exit code and whatever the run started from, under CI too, so a later run from this checkout at that commit, or at a commit on top of it, starts from this run's installed packages and build outputs. Not with --unsandboxed, or with --keep-sandbox above 0. --save-dev-snapshot=false saves none. Without the flag, a sandboxed run saves one when the command exits 0, unless it started from a dev snapshot built at HEAD's commit, so each commit saves once; it saves none when the command fails, when CI is set, with --keep-sandbox above 0, or when the runner recipe's install or build step names a runner secret and the recipe doesn't set trustDevSnapshots: true, since those steps would run in a later run on top of what the command wrote in this run. Such a recipe also reuses no dev snapshot, and this flag is a usage error for it: only the recipe's trustDevSnapshots: true grants that trust. A detached HEAD saves as any HEAD does. The save resets the working tree to the snapshot's base, keeps .git and ignored files such as node_modules and build outputs, and empties /tmp; the snapshot keeps whatever the command wrote there and to $HOME, a resource's token included. A run that starts a save keeps no runner sandbox, however the save ends; a run that starts none, such as one a signal stops, one whose install or build fails, or, without the flag, one whose command fails, keeps it for the keep time. Without the flag and without --keep-sandbox above 0, saveDevSnapshot in the runner recipe says the same as the flag for every run: false saves none, true saves as --save-dev-snapshot does.",
23
- },
24
- noReuseDevSnapshot: {
25
- description: "Start this run from a base snapshot: no dev snapshot counts when the run picks its runner snapshot. The run may still save one. Without the flag, a run starts from the cached runner snapshot of its merge-base whose commit is the fewest commits behind HEAD in HEAD's history, and a dev snapshot counts only when this checkout saved it at HEAD's commit or at an ancestor of it. reuseDevSnapshot: false in the runner recipe says the same for every run.",
26
- },
27
21
  keepSandbox: {
28
22
  valueLabel: "DURATION",
29
- description: "How long the runner sandbox keeps running once the run ends, however it ends, so you can connect to it from its page in the Vercel dashboard: 0, which stops and deletes it with the run's other sandboxes, or a whole number of minutes or hours up to 5h (30m, 2h). A run that starts saving a dev snapshot keeps no runner sandbox (see --save-dev-snapshot); given above 0, this flag has the run save none. The run asks Vercel Sandbox to extend the runner sandbox's timeout when it would stop sooner; it never shortens it, so the sandbox may run past the keep time until its own timeout. The run says until when it runs, and storm runs show and runs list say so too. Default: keepSandbox in the runner recipe, else 30m, or 0 when CI is set. Not with --unsandboxed.",
23
+ description: "How long the runner sandbox keeps running once the run ends, however it ends, so you can connect to it from its page in the Vercel dashboard: 0, which stops and deletes it with the run's other sandboxes, or a whole number of minutes or hours up to 5h (30m, 2h). The run asks Vercel Sandbox to extend the runner sandbox's timeout when it would stop sooner; it never shortens it, so the sandbox may run past the keep time until its own timeout. The run says until when it runs, and storm runs show and runs list say so too. Default: keepSandbox in the runner recipe, else 30m, or 0 when CI is set. Not with --unsandboxed.",
30
24
  },
31
25
  showOutput: {
32
26
  description: "In a sandboxed run on a terminal, print the runner's step output (a snapshot build, the install, the build) above the live view instead of keeping only each step's last line there. Plain output always prints it. Either way, the run directory keeps it whole. Not with --unsandboxed. No config key.",
@@ -1,27 +1,20 @@
1
- import type { RejectedSnapshot, RunnerNoSaveReason, SnapshotCacheNote, SnapshotRejectionReason } from "../../runner/index.ts";
1
+ import type { RejectedSnapshot, SnapshotCacheNote, SnapshotRejectionReason } from "../../runner/index.ts";
2
2
  /** How many of the snapshots a run doesn't start from its build line lists, before it counts the rest. */
3
3
  export declare const REJECTIONS_SHOWN = 5;
4
4
  /** `count` commits, as text: `1 commit`, `24 commits`. */
5
5
  export declare function commitsText(count: number): string;
6
6
  /**
7
7
  * Where a runner snapshot was built, from the commits a run knows: at HEAD's commit, at the run's merge-base, or some
8
- * commits before HEAD. It names no kind. `atMergeBase` is whether the built-at commit is the run's base, which each
9
- * caller compares itself, so a run record written before every snapshot a run started from was at its merge-base
10
- * still reads true; a count storm doesn't have is null.
8
+ * commits before HEAD. A snapshot is built at its `base`; `mergeBase` is the run's own, undefined when the run didn't
9
+ * say it; a count storm doesn't have is null.
11
10
  */
12
11
  export declare function builtAtText(snapshot: {
13
- readonly builtAt: string;
12
+ readonly base: string;
14
13
  readonly builtBehind: number | null;
15
- readonly atMergeBase: boolean;
14
+ readonly mergeBase: string | undefined;
16
15
  }): string;
17
- /**
18
- * Why a run doesn't start from a cached snapshot, as a person reads it after the snapshot's id. It reads only the root
19
- * of the checkout that saved the snapshot (`repoRoot`, null for a base snapshot), its built-at commit (`builtAt`) and
20
- * its base (`base`).
21
- */
16
+ /** Why a run doesn't start from a cached snapshot, as a person reads it after the snapshot's id. */
22
17
  export declare function rejectionText(reason: SnapshotRejectionReason, snapshot: {
23
- readonly repoRoot: string | null;
24
- readonly builtAt: string;
25
18
  readonly base: string;
26
19
  }): string;
27
20
  /**
@@ -29,10 +22,8 @@ export declare function rejectionText(reason: SnapshotRejectionReason, snapshot:
29
22
  * at most, then how many more `storm snapshots list` shows.
30
23
  */
31
24
  export declare function rejectionLines(rejected: readonly RejectedSnapshot[]): string[];
32
- /** Why a run whose command ended on its own saved no dev snapshot, as its cleanup line says after the colon. */
33
- export declare function noSaveText(reason: RunnerNoSaveReason): string;
34
25
  /** Every reason a run doesn't start from a cached snapshot, for a schema. */
35
- export declare const REJECTION_REASONS: readonly ["expired", "expires-soon", "other-checkout", "reuse-off", "not-trusted", "other-base", "steps-changed", "not-in-history", "other-owner", "not-picked"];
26
+ export declare const REJECTION_REASONS: readonly ["expired", "expires-soon", "other-base", "steps-changed", "other-owner"];
36
27
  /**
37
28
  * What removing expired entries from the runner snapshot cache noticed, as a run's and `storm snapshots build`'s
38
29
  * progress line.