@cnc-tools/storm 0.12.0 → 0.14.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 (188) hide show
  1. package/dist/application.js +5 -1
  2. package/dist/bin/storm.js +6 -2
  3. package/dist/build-info.js +1 -1
  4. package/dist/chunks/{chunk-FK4RLDEK.js → chunk-27P2QSIM.js} +1 -1
  5. package/dist/chunks/{chunk-ODQHQJLE.js → chunk-5ED3IDUJ.js} +749 -1121
  6. package/dist/chunks/{chunk-FSP3SJ35.js → chunk-5TMHYH7G.js} +16 -46
  7. package/dist/chunks/{chunk-Y3BUNNRG.js → chunk-BFLYGMG3.js} +12 -7
  8. package/dist/chunks/{chunk-LQKNI3EG.js → chunk-BRUIATTR.js} +6 -6
  9. package/dist/chunks/{chunk-RYRJNHL7.js → chunk-HOKDKP5A.js} +3 -9
  10. package/dist/chunks/{chunk-SXW6XN4R.js → chunk-IVRRGGCD.js} +60 -20
  11. package/dist/chunks/{chunk-TMQQYHUX.js → chunk-QBR5VHJ7.js} +1 -1
  12. package/dist/chunks/{chunk-YT5OROR7.js → chunk-RA4L2ACU.js} +12 -2
  13. package/dist/chunks/{chunk-TEEZL3GA.js → chunk-RKONDLPS.js} +17 -71
  14. package/dist/chunks/{chunk-IYM44FUX.js → chunk-UC6DULWY.js} +2 -2
  15. package/dist/chunks/{chunk-4XT5RC5T.js → chunk-XPCUINWS.js} +6 -42
  16. package/dist/chunks/{chunk-U7M3ZB3Z.js → chunk-YBPTMJUM.js} +123 -180
  17. package/dist/chunks/{chunk-ISGQJIQM.js → chunk-Z5OXOZD3.js} +125 -83
  18. package/dist/chunks/{chunk-7D6LC5JY.js → chunk-ZH5R7W4A.js} +7 -39
  19. package/dist/chunks/{live-app-AZ5N5HBD.js → live-app-FBVWUUMT.js} +7 -7
  20. package/dist/commands/exec/command.d.ts +4 -90
  21. package/dist/commands/exec/command.js +15 -41
  22. package/dist/commands/exec/define-run-command.d.ts +19 -100
  23. package/dist/commands/exec/define-run-command.js +48 -15
  24. package/dist/commands/exec/driver-plan.d.ts +24 -16
  25. package/dist/commands/exec/driver-plan.js +34 -15
  26. package/dist/commands/exec/driver-refusals.js +7 -6
  27. package/dist/commands/exec/exec-words.d.ts +1 -1
  28. package/dist/commands/exec/exec-words.js +8 -2
  29. package/dist/commands/exec/final-results.d.ts +39 -0
  30. package/dist/commands/exec/final-results.js +29 -0
  31. package/dist/commands/exec/live-view.js +18 -22
  32. package/dist/commands/exec/metadata.js +1 -1
  33. package/dist/commands/exec/outcomes.d.ts +15 -109
  34. package/dist/commands/exec/outcomes.js +25 -39
  35. package/dist/commands/exec/plan-run.d.ts +11 -3
  36. package/dist/commands/exec/plan-run.js +3 -2
  37. package/dist/commands/exec/progress.d.ts +3 -19
  38. package/dist/commands/exec/progress.js +16 -60
  39. package/dist/commands/exec/run-command.d.ts +5 -24
  40. package/dist/commands/exec/run-command.js +32 -84
  41. package/dist/commands/exec/run-metadata.d.ts +0 -6
  42. package/dist/commands/exec/run-metadata.js +2 -8
  43. package/dist/commands/exec/snapshot-text.d.ts +7 -16
  44. package/dist/commands/exec/snapshot-text.js +9 -49
  45. package/dist/commands/exec/test-plan.d.ts +2 -1
  46. package/dist/commands/exec/test-plan.js +13 -4
  47. package/dist/commands/exec/tests-summary.d.ts +2 -2
  48. package/dist/commands/exec/view.js +2 -12
  49. package/dist/commands/exec/worker-chart.d.ts +1 -1
  50. package/dist/commands/playwright/command.d.ts +12 -97
  51. package/dist/commands/playwright/command.js +14 -14
  52. package/dist/commands/playwright/metadata.js +2 -2
  53. package/dist/commands/runs/facts.d.ts +1 -37
  54. package/dist/commands/runs/facts.js +4 -36
  55. package/dist/commands/runs/list/command.d.ts +0 -72
  56. package/dist/commands/runs/list/command.js +6 -6
  57. package/dist/commands/runs/list/outcomes.d.ts +0 -36
  58. package/dist/commands/runs/logs/command.js +6 -6
  59. package/dist/commands/runs/show/command.d.ts +2 -74
  60. package/dist/commands/runs/show/command.js +16 -43
  61. package/dist/commands/runs/show/metadata.js +1 -1
  62. package/dist/commands/runs/show/outcomes.d.ts +1 -37
  63. package/dist/commands/runs/show/outcomes.js +8 -42
  64. package/dist/commands/snapshots/build/command.d.ts +14 -411
  65. package/dist/commands/snapshots/build/command.js +59 -234
  66. package/dist/commands/snapshots/build/metadata.js +10 -7
  67. package/dist/commands/snapshots/build/outcomes.d.ts +11 -241
  68. package/dist/commands/snapshots/build/outcomes.js +29 -196
  69. package/dist/commands/snapshots/list/command.d.ts +2 -36
  70. package/dist/commands/snapshots/list/command.js +20 -56
  71. package/dist/commands/snapshots/list/metadata.js +1 -1
  72. package/dist/commands/snapshots/list/outcomes.d.ts +2 -37
  73. package/dist/commands/snapshots/list/outcomes.js +13 -53
  74. package/dist/commands/vitest/command.d.ts +14 -98
  75. package/dist/commands/vitest/command.js +14 -14
  76. package/dist/commands/vitest/metadata.js +2 -2
  77. package/dist/config/resolve.d.ts +1 -1
  78. package/dist/config/resolve.js +2 -1
  79. package/dist/config/schema.d.ts +8 -0
  80. package/dist/config/schema.js +5 -4
  81. package/dist/core/events.d.ts +5 -6
  82. package/dist/core/run-state.d.ts +7 -29
  83. package/dist/core/run-state.js +3 -26
  84. package/dist/core/run.d.ts +6 -14
  85. package/dist/core/run.js +17 -28
  86. package/dist/extensions/playwright/driver.js +17 -10
  87. package/dist/extensions/testserver/commands/pool/create/command.js +4 -4
  88. package/dist/extensions/testserver/commands/pool/list/command.js +2 -2
  89. package/dist/extensions/testserver/definition.d.ts +1 -1
  90. package/dist/extensions/testserver/extension.d.ts +1 -1
  91. package/dist/extensions/testserver/options/rules.d.ts +3 -3
  92. package/dist/extensions/testserver/options/rules.js +5 -5
  93. package/dist/extensions/testserver/resource.d.ts +1 -1
  94. package/dist/extensions/testserver/vercel-cli/index.d.ts +1 -0
  95. package/dist/extensions/testserver/vercel-cli/index.js +1 -0
  96. package/dist/extensions/testserver/vercel-cli/report.js +5 -2
  97. package/dist/extensions/testserver/vercel-cli/session-id.d.ts +8 -0
  98. package/dist/extensions/testserver/vercel-cli/session-id.js +16 -0
  99. package/dist/extensions/testserver/vitest/config.d.ts +2 -2
  100. package/dist/extensions/testserver/vitest/config.js +2 -2
  101. package/dist/extensions/testserver/vitest/container-scope.d.ts +25 -16
  102. package/dist/extensions/testserver/vitest/container-scope.js +32 -13
  103. package/dist/extensions/testserver/vitest/diagnostics.d.ts +5 -4
  104. package/dist/extensions/testserver/vitest/diagnostics.js +15 -8
  105. package/dist/extensions/testserver/vitest/fixtures.d.ts +10 -1
  106. package/dist/extensions/testserver/vitest/fixtures.js +36 -10
  107. package/dist/extensions/testserver/vitest/types.d.ts +9 -0
  108. package/dist/extensions/vitest/driver.js +28 -14
  109. package/dist/extensions/vitest/plan/gateways.d.ts +28 -5
  110. package/dist/extensions/vitest/plan/gateways.js +2 -2
  111. package/dist/extensions/vitest/plan/list-output.d.ts +5 -0
  112. package/dist/extensions/vitest/plan/list-output.js +23 -9
  113. package/dist/extensions/vitest/plan/live/list-gateway.d.ts +3 -2
  114. package/dist/extensions/vitest/plan/live/list-gateway.js +77 -64
  115. package/dist/extensions/vitest/plan/plan-over.d.ts +19 -7
  116. package/dist/extensions/vitest/plan/plan-over.js +18 -7
  117. package/dist/extensions/vitest/plan/plan.d.ts +14 -5
  118. package/dist/extensions/vitest/plan/plan.js +23 -9
  119. package/dist/extensions.d.ts +2 -2
  120. package/dist/run-directory/index.d.ts +1 -1
  121. package/dist/run-directory/index.js +0 -1
  122. package/dist/run-directory/plan.d.ts +3 -2
  123. package/dist/run-directory/plan.js +6 -3
  124. package/dist/run-directory/recording.js +2 -2
  125. package/dist/run-directory/run-record.d.ts +18 -135
  126. package/dist/run-directory/run-record.js +8 -68
  127. package/dist/runner/build-snapshots.d.ts +50 -114
  128. package/dist/runner/build-snapshots.js +70 -159
  129. package/dist/runner/events.d.ts +4 -88
  130. package/dist/runner/gateways.d.ts +5 -23
  131. package/dist/runner/index.d.ts +5 -6
  132. package/dist/runner/index.js +1 -1
  133. package/dist/runner/live/snapshot-records.js +7 -18
  134. package/dist/runner/prepare.d.ts +11 -22
  135. package/dist/runner/prepare.js +6 -17
  136. package/dist/runner/ready.d.ts +16 -45
  137. package/dist/runner/ready.js +34 -59
  138. package/dist/runner/recipe.d.ts +5 -45
  139. package/dist/runner/recipe.js +0 -41
  140. package/dist/runner/sandboxed-command.d.ts +5 -3
  141. package/dist/runner/sandboxed-command.js +10 -4
  142. package/dist/runner/scope.d.ts +8 -25
  143. package/dist/runner/scope.js +4 -8
  144. package/dist/runner/session.d.ts +18 -65
  145. package/dist/runner/session.js +15 -83
  146. package/dist/runner/snapshot-build.d.ts +2 -2
  147. package/dist/runner/snapshot-cache.d.ts +22 -74
  148. package/dist/runner/snapshot-cache.js +15 -107
  149. package/dist/runner/snapshot-inspect.d.ts +9 -13
  150. package/dist/runner/snapshot-inspect.js +48 -57
  151. package/dist/runner/snapshot-key.d.ts +9 -14
  152. package/dist/runner/snapshot-key.js +15 -22
  153. package/dist/sdk/extension/driver.d.ts +32 -6
  154. package/dist/sdk/extension/driver.js +12 -2
  155. package/dist/sdk/extension/index.d.ts +1 -1
  156. package/dist/sdk/extension/index.js +2 -1
  157. package/dist/sdk/extension/resource-definition.d.ts +6 -5
  158. package/dist/vendor/testserver-sdk/container/api-request.d.ts +2 -3
  159. package/dist/vendor/testserver-sdk/container/api-request.js +2 -3
  160. package/dist/vendor/testserver-sdk/container/container.d.ts +12 -2
  161. package/dist/vendor/testserver-sdk/container/container.js +10 -7
  162. package/dist/vendor/testserver-sdk/container/recorder.d.ts +29 -7
  163. package/dist/vendor/testserver-sdk/container/recorder.js +26 -14
  164. package/dist/vendor/testserver-sdk/index.d.ts +1 -1
  165. package/dist/vendor/testserver-sdk/index.js +1 -1
  166. package/dist/vendor/testserver-sdk/proxy/exchange.d.ts +24 -5
  167. package/dist/vendor/testserver-sdk/proxy/exchange.js +43 -25
  168. package/dist/vendor/testserver-sdk/proxy/faulted-exchange.js +15 -10
  169. package/dist/vendor/testserver-sdk/proxy/faults.d.ts +6 -5
  170. package/dist/vendor/testserver-sdk/proxy/proxy.d.ts +10 -1
  171. package/dist/vendor/testserver-sdk/proxy/proxy.js +5 -3
  172. package/dist/vendor/testserver-sdk/proxy/records.d.ts +17 -17
  173. package/dist/vendor/testserver-sdk/proxy/records.js +18 -17
  174. package/dist/vendor/testserver-sdk/records/body.d.ts +7 -9
  175. package/dist/vendor/testserver-sdk/records/body.js +10 -15
  176. package/dist/vendor/testserver-sdk/records/headers.d.ts +79 -0
  177. package/dist/vendor/testserver-sdk/records/headers.js +162 -0
  178. package/dist/vendor/testserver-sdk/records/index.d.ts +2 -1
  179. package/dist/vendor/testserver-sdk/records/index.js +4 -2
  180. package/dist/vendor/testserver-sdk/records/records.d.ts +19 -10
  181. package/package.json +5 -4
  182. package/skills/overview.md +5 -5
  183. package/skills/read-run-output.md +8 -9
  184. package/dist/runner/snapshot-save.d.ts +0 -70
  185. package/dist/runner/snapshot-save.js +0 -160
  186. package/dist/runner/snapshot-start.d.ts +0 -25
  187. package/dist/runner/snapshot-start.js +0 -16
  188. package/skills/testserver-builds.md +0 -82
@@ -6,7 +6,7 @@ import {
6
6
  redactingObserver,
7
7
  redactingTerminal,
8
8
  redactor
9
- } from "./chunk-FK4RLDEK.js";
9
+ } from "./chunk-27P2QSIM.js";
10
10
  import {
11
11
  criticalPathStep,
12
12
  recordedPlan,
@@ -17,26 +17,23 @@ import {
17
17
  testsChart,
18
18
  testsSummaryLines,
19
19
  waterfallLines
20
- } from "./chunk-Y3BUNNRG.js";
20
+ } from "./chunk-BFLYGMG3.js";
21
21
  import {
22
22
  builtAtText,
23
- noSaveText,
24
23
  rejectionLines,
25
24
  snapshotCacheNoteText
26
- } from "./chunk-4XT5RC5T.js";
25
+ } from "./chunk-XPCUINWS.js";
27
26
  import {
28
27
  DEFINITION_SET,
29
28
  RESOURCES
30
- } from "./chunk-ISGQJIQM.js";
29
+ } from "./chunk-Z5OXOZD3.js";
31
30
  import {
32
31
  sandboxConnectPage
33
32
  } from "./chunk-NMVODY3P.js";
34
33
  import {
35
- noSaveReasonSchema,
36
34
  recordRun,
37
- saveSchema,
38
35
  timelineSchema
39
- } from "./chunk-TEEZL3GA.js";
36
+ } from "./chunk-RKONDLPS.js";
40
37
  import {
41
38
  isoSecondsText,
42
39
  keepTimeText,
@@ -49,7 +46,7 @@ import {
49
46
  truncate,
50
47
  visibleLength,
51
48
  withArticle
52
- } from "./chunk-TMQQYHUX.js";
49
+ } from "./chunk-QBR5VHJ7.js";
53
50
  import {
54
51
  EMPTY_RUN_STATE,
55
52
  cleanupProblems,
@@ -62,12 +59,11 @@ import {
62
59
  setupPhaseWords,
63
60
  timedProgress,
64
61
  warningTally
65
- } from "./chunk-FSP3SJ35.js";
62
+ } from "./chunk-5TMHYH7G.js";
66
63
  import {
67
64
  RUNNER_SECRET_MIN_LENGTH,
68
65
  configErrors,
69
66
  credentialErrors,
70
- devSnapshotsTrusted,
71
67
  fileSettings,
72
68
  invalidConfig,
73
69
  loadSettingsFile,
@@ -79,11 +75,11 @@ import {
79
75
  requireTarget,
80
76
  settleCredential,
81
77
  settleRunResources
82
- } from "./chunk-ODQHQJLE.js";
78
+ } from "./chunk-5ED3IDUJ.js";
83
79
  import {
84
80
  describeMintFailure,
85
81
  isCi
86
- } from "./chunk-YT5OROR7.js";
82
+ } from "./chunk-RA4L2ACU.js";
87
83
  import {
88
84
  NodeSignalCancellation
89
85
  } from "./chunk-BW2ADH7U.js";
@@ -94,6 +90,38 @@ import {
94
90
  renderOutcome
95
91
  } from "./chunk-YM6TZV4L.js";
96
92
 
93
+ // src/commands/exec/exec-words.ts
94
+ var EXEC_HELP = {
95
+ usage: "-- <command...>",
96
+ args: "The command to run, after --, as an argument list with no shell. Unsandboxed, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR when neither is set; in a sandboxed run, the runner recipe's cwd, its env, the runner's PATH, STORM_RUN, and FORCE_COLOR or NO_COLOR when that env sets neither, with paths under the repository's root rewritten.",
97
+ verbose: "which asks the command to print what each test does as it happens, for passing tests too",
98
+ examples: [
99
+ {
100
+ argv: "-- pnpm test",
101
+ description: "Run the package's test script in a runner sandbox, with the runner recipe, team, project and resources from storm.config.ts."
102
+ },
103
+ {
104
+ argv: "--keep-sandbox 2h -- pnpm test",
105
+ description: "Run the tests in a runner sandbox and keep it running 2 hours after the run, to debug in it."
106
+ },
107
+ {
108
+ argv: "--unsandboxed -- node scripts/smoke.mjs",
109
+ description: "Run a Node.js script on this machine, with the resources storm.config.ts declares, if any."
110
+ }
111
+ ]
112
+ };
113
+ var EXEC_HINTS = {
114
+ // The command's test runner reported no final result. Which one it is the launcher can't tell, so the hint names
115
+ // storm's reporter for each: the Vitest one and the Playwright one, by their published paths.
116
+ noFinalResults: "add storm's reporter to the test runner's config (stormReporter() from @vercel/storm/vitest/config for Vitest, @vercel/storm/playwright/reporter for Playwright)",
117
+ // The command may run no test at all, so the steps say they apply if it does, and name storm's reporter for each test
118
+ // runner, under either npm name.
119
+ addReporter: [
120
+ `If the command runs tests, add storm's reporter to its test runner's config: for Vitest, set test.reporters to stormReporters() from "@vercel/storm/vitest/config"; for Playwright, add ["@vercel/storm/playwright/reporter"] to the reporter list. In a package that installs storm as @cnc-tools/storm, use "@cnc-tools/storm/vitest/config" or "@cnc-tools/storm/playwright/reporter".`,
121
+ "Remove any --reporter from the test runner's arguments, since it replaces the config's reporters, storm's among them. Then run the same storm exec command again."
122
+ ]
123
+ };
124
+
97
125
  // src/commands/exec/cleanup.ts
98
126
  import { z } from "zod";
99
127
  var notStoppedSchema = z.object({
@@ -196,6 +224,19 @@ function runnerCleanupOf(report) {
196
224
  // src/commands/exec/outcomes.ts
197
225
  import { z as z4 } from "zod";
198
226
 
227
+ // src/commands/exec/final-results.ts
228
+ function lacksFinalResults(exitCode, read) {
229
+ return exitCode === 0 && read.collected && read.finalResults === 0 && !read.partial;
230
+ }
231
+ var NO_FINAL_RESULTS_MESSAGE = "The command exited 0, but storm got no final test result from it, so the run saved no test results. A test runner reports them only with storm's reporter in its config, and a --reporter on its command line replaces the config's reporters.";
232
+ function noFinalResultsContent(noFinalTestResults, hints) {
233
+ if (!noFinalTestResults) return { warnings: [], next: [] };
234
+ return {
235
+ warnings: [{ reason: "no_final_test_results", message: NO_FINAL_RESULTS_MESSAGE }],
236
+ next: hints.addReporter.map((text) => ({ type: "text", text }))
237
+ };
238
+ }
239
+
199
240
  // src/commands/exec/mint-failed.ts
200
241
  import { z as z2 } from "zod";
201
242
  var mintFailedErrors = defineErrors({
@@ -376,18 +417,10 @@ var ranSchema = z4.object({
376
417
  runner: z4.object({
377
418
  /** The runner snapshot it started from. */
378
419
  snapshotId: z4.string(),
379
- /** The runner snapshot's base, a full SHA. */
420
+ /** The runner snapshot's base, a full SHA: the commit it was built at. */
380
421
  base: z4.string(),
381
- /** For a dev snapshot, the local branch of the run that saved it; null for a base snapshot. */
382
- snapshotBranch: z4.string().nullable(),
383
- /** For a dev snapshot, the HEAD commit of the run that saved it, a full SHA; null for a base snapshot. */
384
- snapshotHead: z4.string().nullable(),
385
- /** The runner snapshot's kind: a base snapshot, built from its base, or a dev snapshot, saved from a run. */
386
- snapshotKind: z4.enum(["base", "dev"]),
387
- /** The commit the runner snapshot was built at, a full SHA: a base snapshot's base, or the commit that saved a dev snapshot. */
388
- snapshotBuiltAt: z4.string(),
389
- /** 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. */
390
- builtBehind: z4.number().nullable(),
422
+ /** How many commits HEAD has that the snapshot's base lacks, 0 for a snapshot built at HEAD's commit. */
423
+ builtBehind: z4.number(),
391
424
  /** How many bytes of changes the run uploaded on top of the snapshot's base. */
392
425
  uploadBytes: z4.number(),
393
426
  /** Whether this run built the runner snapshot. */
@@ -396,19 +429,25 @@ var ranSchema = z4.object({
396
429
  region: z4.string(),
397
430
  runtime: z4.string(),
398
431
  /** How long the build step took, in milliseconds. */
399
- buildMs: z4.number(),
400
- /** How saving the runner sandbox as a dev snapshot ended; null when the run started no save. */
401
- save: saveSchema.nullable(),
402
- /** Why the run, whose command ended on its own, started no save of a dev snapshot; null when it started one. */
403
- noSaveReason: noSaveReasonSchema.nullable()
432
+ buildMs: z4.number()
404
433
  }).nullable(),
405
434
  /** 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. */
406
435
  timeline: timelineSchema,
407
436
  /** The run's run directory's run id, which `storm runs show` takes; null when the run couldn't make one. */
408
- runId: z4.string().nullable()
437
+ runId: z4.string().nullable(),
438
+ /**
439
+ * Whether the run saved no final test result though its command exited 0: storm handed the command a test events
440
+ * file and read every line of it, and none was a final result. Then the result warns `no_final_test_results`, whose
441
+ * next steps add storm's reporter to the test runner's config.
442
+ */
443
+ noFinalTestResults: z4.boolean()
409
444
  });
410
- var RAN_DESCRIPTION = "The command ran and ended. storm exits with its code, or 128 + n when signal n ended it, whatever this result's exit code.";
411
- function renderRan(ran) {
445
+ var RAN_DESCRIPTION = "The command ran and ended. storm exits with its code, or 128 + n when signal n ended it, whatever this result's exit code. A run whose command exited 0 but saved no final test result warns no_final_test_results.";
446
+ function ranRenderer(hints) {
447
+ return (ran) => renderRan(ran, hints);
448
+ }
449
+ function renderRan(ran, hints) {
450
+ const noFinal = noFinalResultsContent(ran.noFinalTestResults, hints);
412
451
  const warnings = [
413
452
  ...DEFINITION_SET.reports.ranWarnings(ran.resources),
414
453
  ...ran.runner !== null && ran.command.exitCode === null && ran.command.signal === null ? [
@@ -418,12 +457,14 @@ function renderRan(ran) {
418
457
  }
419
458
  ] : [],
420
459
  ...runnerCleanupWarnings(ran.cleanup.runner),
421
- ...DEFINITION_SET.reports.cleanupWarnings(ran.cleanup.resources)
460
+ ...DEFINITION_SET.reports.cleanupWarnings(ran.cleanup.resources),
461
+ ...noFinal.warnings
422
462
  ];
423
463
  const kept = ran.cleanup.runner?.kept ?? null;
424
464
  return renderOutcome({
425
465
  ...kept === null ? {} : { message: keptText(kept) },
426
- ...warnings.length === 0 ? {} : { warnings }
466
+ ...warnings.length === 0 ? {} : { warnings },
467
+ ...noFinal.next.length === 0 ? {} : { next: [...noFinal.next] }
427
468
  });
428
469
  }
429
470
  var runErrors = defineErrors({
@@ -446,25 +487,6 @@ var runErrors = defineErrors({
446
487
  ]
447
488
  })
448
489
  },
449
- devSnapshotsNotTrusted: {
450
- exitCode: 2,
451
- 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.",
452
- schema: z4.object({
453
- /** The flag given, as typed. */
454
- flag: z4.string(),
455
- /** The config file that gave the runner recipe; null when none did. */
456
- configFile: z4.string().nullable()
457
- }),
458
- render: ({ flag, configFile }) => ({
459
- 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.`,
460
- next: [
461
- {
462
- type: "text",
463
- 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.`
464
- }
465
- ]
466
- })
467
- },
468
490
  missingRunner: {
469
491
  exitCode: 2,
470
492
  description: "A sandboxed run (no --unsandboxed) needs a runner recipe, and no storm.config.ts gives a runner key.",
@@ -635,7 +657,7 @@ var RUN_ERRORS = {
635
657
  ...runErrors
636
658
  };
637
659
  var outcomes = defineOutcomes({
638
- results: { ran: { schema: ranSchema, description: RAN_DESCRIPTION, render: renderRan } },
660
+ results: { ran: { schema: ranSchema, description: RAN_DESCRIPTION, render: ranRenderer(EXEC_HINTS) } },
639
661
  errors: RUN_ERRORS
640
662
  });
641
663
 
@@ -665,6 +687,7 @@ function plainRenderer(options) {
665
687
  lanesStartedAt: void 0,
666
688
  readyAt: { runner: void 0, resources: {} },
667
689
  cleanupStartedAt: void 0,
690
+ mergeBase: void 0,
668
691
  folded: false
669
692
  };
670
693
  const resources = DEFINITION_SET.presentations.plain({ verbose: options.verbose === true });
@@ -751,7 +774,7 @@ function eventLines(event, now, state, line, options) {
751
774
  return [line("command", `${event.command} ${commandEnd(event.outcome)} after ${seconds(event.ms)}`)];
752
775
  case "cleanup-started":
753
776
  state.cleanupStartedAt = now;
754
- return [line("cleanup", cleanupText(event.runnerSandbox, releaseText(event.resources, false)))];
777
+ return [line("cleanup", cleanupText(event.keepMs, releaseText(event.resources, false)))];
755
778
  case "cleanup-finished": {
756
779
  const problems = [
757
780
  ...event.notStopped === 0 ? [] : [`${event.notStopped} not stopped`],
@@ -766,6 +789,7 @@ function eventLines(event, now, state, line, options) {
766
789
  ];
767
790
  }
768
791
  case "runner-prepared":
792
+ state.mergeBase = event.base;
769
793
  return [
770
794
  line("runner", `merge-base ${short(event.base)}, of HEAD and ${event.baseRef}`),
771
795
  ...preparedNoteTexts(event).map((text) => line("runner", text))
@@ -783,7 +807,7 @@ function eventLines(event, now, state, line, options) {
783
807
  function runnerLines(event, state, line, options) {
784
808
  switch (event.kind) {
785
809
  case "snapshot-reused":
786
- return [line("runner", snapshotReusedText(event))];
810
+ return [line("runner", snapshotReusedText(event, state.mergeBase))];
787
811
  case "snapshot-build-started":
788
812
  return snapshotBuildTexts(event).map((text) => line("runner", text));
789
813
  case "runner-sandbox-starting":
@@ -844,21 +868,10 @@ function runnerLines(event, state, line, options) {
844
868
  ];
845
869
  case "sandbox-kept":
846
870
  return [line("cleanup", `kept the runner sandbox ${event.name} running until ${isoSecondsText(event.stopsAt)}`)];
847
- // The cleanup line says the run saves a dev snapshot.
848
- case "dev-snapshot-saving":
849
- return [];
850
- case "dev-snapshot-saved":
851
- case "dev-snapshot-not-saved":
852
- return [line("cleanup", devSnapshotSaveText(event))];
853
- case "dev-snapshot-skipped":
854
- return [line("cleanup", devSnapshotSkippedText(event))];
855
- case "dev-snapshots-dropped":
856
- case "dev-snapshots-not-dropped":
857
- return [line("runner", devSnapshotsDropText(event))];
858
871
  }
859
872
  }
860
- function snapshotReusedText(event) {
861
- return `snapshot ${event.snapshotId}, ${builtAtText({ ...event.snapshot, atMergeBase: event.snapshot.builtAt === event.base })}`;
873
+ function snapshotReusedText(event, mergeBase) {
874
+ return `snapshot ${event.snapshotId}, ${builtAtText({ base: event.base, builtBehind: event.builtBehind, mergeBase })}`;
862
875
  }
863
876
  function snapshotBuildTexts(event) {
864
877
  const building = `building a base snapshot at ${short(event.base)}`;
@@ -872,37 +885,11 @@ function snapshotBuildTexts(event) {
872
885
  return [`${building} (${SNAPSHOT_BUILD_REASON_TEXT[why.kind]}); ${tail}`];
873
886
  }
874
887
  }
875
- function devSnapshotSkippedText(event) {
876
- return `no new dev snapshot: ${noSaveText(event.reason)}`;
877
- }
878
- function devSnapshotSaveText(event) {
879
- if (event.kind === "dev-snapshot-saved") {
880
- return `saved dev snapshot ${event.snapshotId} for ${headText(event.branch)} at ${short(event.head)} in ${seconds(event.ms)} (${megabytesText(event.sizeBytes)})`;
881
- }
882
- return `not saving a dev snapshot: ${notSavedReason(event.save)}`;
883
- }
884
- function headText(branch) {
885
- return branch ?? "a detached HEAD";
886
- }
887
- function notSavedReason(save) {
888
- switch (save.kind) {
889
- case "failed":
890
- return `the ${save.step === "scrub" ? "scrub" : "save"} failed: ${save.message}`;
891
- case "stopped":
892
- return "the run is stopping";
893
- }
894
- }
895
888
  var SNAPSHOT_BUILD_REASON_TEXT = {
896
889
  "no-snapshot": "no cached snapshot fits",
897
890
  full: "--full",
898
891
  base: "the cache has no base snapshot at that commit"
899
892
  };
900
- function devSnapshotsDropText(event) {
901
- if (event.kind === "dev-snapshots-not-dropped")
902
- 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`;
903
- const count = event.snapshotIds.length;
904
- return `dropped ${count} dev ${count === 1 ? "snapshot" : "snapshots"} built on the replaced base snapshot from the cache: ${event.snapshotIds.join(", ")}`;
905
- }
906
893
  function releasingText(instances) {
907
894
  const release = releaseText(
908
895
  instances.map(({ resource }) => resource),
@@ -915,11 +902,9 @@ function closeFold(state) {
915
902
  state.folded = false;
916
903
  return ["::endgroup::"];
917
904
  }
918
- function cleanupText(sandbox, release) {
919
- if (sandbox === null) return release === void 0 ? "nothing to release" : `${release}\u2026`;
920
- if (sandbox.kind === "save")
921
- return `saving a dev snapshot of ${headText(sandbox.branch)}${release === void 0 ? "" : ` while ${release}`}\u2026`;
922
- const sandboxes = sandbox.ms > 0 ? `keeping the runner sandbox running ${keepTimeText(sandbox.ms)}` : "stopping and deleting the runner's sandboxes";
905
+ function cleanupText(keepMs, release) {
906
+ if (keepMs === null) return release === void 0 ? "nothing to release" : `${release}\u2026`;
907
+ const sandboxes = keepMs > 0 ? `keeping the runner sandbox running ${keepTimeText(keepMs)}` : "stopping and deleting the runner's sandboxes";
923
908
  return `${sandboxes}${release === void 0 ? "" : `, then ${release}`}\u2026`;
924
909
  }
925
910
  function commandEnd(outcome) {
@@ -1141,7 +1126,7 @@ function lanesRecord(state, view) {
1141
1126
  const snapshot = runner.steps.find(({ name }) => name === "snapshot");
1142
1127
  const parts = [
1143
1128
  ...runner.sandbox === void 0 ? [] : [`${runner.sandbox.name} \xB7 ${runner.sandbox.region} \xB7 ${runner.sandbox.vcpus} vCPU`],
1144
- ...snapshot === void 0 || snapshot.status === "pending" ? [] : [snapshotText(snapshot, runner)],
1129
+ ...snapshot === void 0 || snapshot.status === "pending" ? [] : [snapshotText(snapshot, runner, state.base?.sha)],
1145
1130
  ...runner.status === "failed" || runner.status === "stopped" ? [runner.status] : []
1146
1131
  ];
1147
1132
  lines.push(
@@ -1158,11 +1143,11 @@ function lanesRecord(state, view) {
1158
1143
  function runnerGlyph(runner, view) {
1159
1144
  return view.glyph(runner.steps.some(({ status }) => status === "failed") ? "failed" : runner.status);
1160
1145
  }
1161
- function snapshotText(step, runner) {
1146
+ function snapshotText(step, runner, mergeBase) {
1162
1147
  if (runner.snapshot?.kind === "built") return "snapshot built";
1163
1148
  if (runner.snapshot?.kind === "reused") {
1164
- const { snapshot, base } = runner.snapshot;
1165
- return `snapshot ${builtAtText({ ...snapshot, atMergeBase: snapshot.builtAt === base })}`;
1149
+ const { base, builtBehind } = runner.snapshot;
1150
+ return `snapshot ${builtAtText({ base, builtBehind, mergeBase })}`;
1166
1151
  }
1167
1152
  return `snapshot build ${step.status === "running" ? "stopped" : step.status}`;
1168
1153
  }
@@ -1283,8 +1268,8 @@ function waitingText(waiting) {
1283
1268
  function cleanupLine(cleanup, runner, view, record) {
1284
1269
  const done = record || cleanup.status !== "running";
1285
1270
  const release = releaseText(cleanup.resources, done);
1286
- const { runnerSandbox } = cleanup;
1287
- const text = !done && cleanup.waiting ? `${WAITING_FOR_SNAPSHOT}\u2026` : runnerSandbox === null ? release ?? "nothing to release" : `${runnerSandboxText(runnerSandbox, runner, done)}${release === void 0 ? "" : `, ${release}`}`;
1271
+ const { keepMs } = cleanup;
1272
+ const text = !done && cleanup.waiting ? `${WAITING_FOR_SNAPSHOT}\u2026` : keepMs === null ? release ?? "nothing to release" : `${runnerSandboxText(keepMs, runner, done)}${release === void 0 ? "" : `, ${release}`}`;
1288
1273
  const leftBehind = cleanupProblems(cleanup);
1289
1274
  const ending = done ? leftBehind === 0 ? "" : `: ${leftBehind} left behind` : "\u2026";
1290
1275
  return view.row(
@@ -1292,19 +1277,11 @@ function cleanupLine(cleanup, runner, view, record) {
1292
1277
  elapsed(view, cleanup.startedAt, cleanup.endedAt)
1293
1278
  );
1294
1279
  }
1295
- function runnerSandboxText(sandbox, runner, done) {
1280
+ function runnerSandboxText(keepMs, runner, done) {
1296
1281
  const kept = runner?.kept;
1297
1282
  if (kept !== void 0) return `kept the runner sandbox until ${isoSecondsText(kept.stopsAt)}`;
1298
1283
  const removed = `${done ? "stopped and deleted" : "stopping and deleting"} the runner sandbox`;
1299
- switch (sandbox.kind) {
1300
- case "keep":
1301
- return !done && sandbox.ms > 0 ? `keeping the runner sandbox running ${keepTimeText(sandbox.ms)}` : removed;
1302
- case "save": {
1303
- const save = runner?.save;
1304
- if (save?.kind === "saved") return `saved dev snapshot ${save.id} of ${headText(save.branch)}`;
1305
- return !done && save?.kind !== "not-saved" ? `saving a dev snapshot of ${headText(sandbox.branch)}` : removed;
1306
- }
1307
- }
1284
+ return !done && keepMs > 0 ? `keeping the runner sandbox running ${keepTimeText(keepMs)}` : removed;
1308
1285
  }
1309
1286
  function statusGlyph(status, now, paint2) {
1310
1287
  switch (status) {
@@ -1465,14 +1442,6 @@ function runnerNoticeLines(event, line) {
1465
1442
  switch (event.kind) {
1466
1443
  case "snapshot-entry-not-written":
1467
1444
  return [line("runner", cacheWriteFailureText(event.failure))];
1468
- case "dev-snapshots-dropped":
1469
- case "dev-snapshots-not-dropped":
1470
- return [line("runner", devSnapshotsDropText(event))];
1471
- case "dev-snapshot-saved":
1472
- case "dev-snapshot-not-saved":
1473
- return [line("cleanup", devSnapshotSaveText(event))];
1474
- case "dev-snapshot-skipped":
1475
- return [line("cleanup", devSnapshotSkippedText(event))];
1476
1445
  // The runner row shows the build; its reasons, when a cached snapshot didn't fit, are lines of their own.
1477
1446
  case "snapshot-build-started":
1478
1447
  return event.why.kind === "no-snapshot" && event.why.rejected.length > 0 ? snapshotBuildTexts(event).map((text) => line("runner", text)) : [];
@@ -1494,7 +1463,6 @@ function runnerNoticeLines(event, line) {
1494
1463
  case "stopping":
1495
1464
  case "waiting-for-snapshot":
1496
1465
  case "sandbox-kept":
1497
- case "dev-snapshot-saving":
1498
1466
  return [];
1499
1467
  }
1500
1468
  }
@@ -1525,7 +1493,7 @@ async function planRun(app, lifecycles, request, planCommand, signal) {
1525
1493
  }
1526
1494
  const merged = settleRunResources(file, request.given);
1527
1495
  if (!merged.ok) return merged;
1528
- const command = await planCommand(where, signal);
1496
+ const command = await planCommand(where, signal, { testPlan: settings.testPlan?.value === true });
1529
1497
  if (signal.aborted) return refused(canceledBeforeStart());
1530
1498
  if (!command.ok) {
1531
1499
  const secrets = [
@@ -1576,8 +1544,6 @@ var OWN_RUN_FIELDS = {
1576
1544
  project: z5.string().min(1).optional(),
1577
1545
  credential: z5.enum(["mint", "github-actions"]).optional(),
1578
1546
  unsandboxed: z5.boolean().default(false),
1579
- saveDevSnapshot: z5.boolean().optional(),
1580
- noReuseDevSnapshot: z5.boolean().default(false),
1581
1547
  showOutput: z5.boolean().default(false),
1582
1548
  keepSandbox: z5.string().optional(),
1583
1549
  verbose: z5.boolean().default(false)
@@ -1639,6 +1605,7 @@ async function runCommand({ app, ui, signal }, request, spec) {
1639
1605
  });
1640
1606
  const observer = recording.observer(view.observer);
1641
1607
  const terminal = recording.terminal(view.runnerTerminal);
1608
+ const collected = run.runner !== void 0 || recording.testEvents !== void 0;
1642
1609
  let outcome;
1643
1610
  try {
1644
1611
  const ended = await executeRun(
@@ -1656,11 +1623,18 @@ async function runCommand({ app, ui, signal }, request, spec) {
1656
1623
  throw error;
1657
1624
  }
1658
1625
  sigterm.release();
1659
- const ran = await summarize(app, { command: spec.name, hints: spec.hints, view, recording, outcome });
1626
+ const { timeline: ran, finalResults } = await summarize(app, {
1627
+ command: spec.name,
1628
+ hints: spec.hints,
1629
+ view,
1630
+ recording,
1631
+ outcome
1632
+ });
1660
1633
  switch (outcome.kind) {
1661
1634
  case "ran": {
1662
- app.exit.status = commandExitStatus(outcome.command);
1663
1635
  const { command } = outcome;
1636
+ const runId = recording.opened.ok ? recording.opened.id : null;
1637
+ app.exit.status = commandExitStatus(outcome.command);
1664
1638
  return spec.ran(
1665
1639
  {
1666
1640
  version: app.version,
@@ -1672,22 +1646,20 @@ async function runCommand({ app, ui, signal }, request, spec) {
1672
1646
  runner: outcome.runner === void 0 ? null : {
1673
1647
  snapshotId: outcome.runner.snapshotId,
1674
1648
  base: outcome.runner.base,
1675
- snapshotBranch: outcome.runner.snapshotBranch,
1676
- snapshotHead: outcome.runner.snapshotHead,
1677
- snapshotKind: outcome.runner.snapshot.kind,
1678
- snapshotBuiltAt: outcome.runner.snapshot.builtAt,
1679
- builtBehind: outcome.runner.snapshot.builtBehind,
1649
+ builtBehind: outcome.runner.builtBehind,
1680
1650
  uploadBytes: outcome.runner.uploadBytes,
1681
1651
  built: outcome.runner.built,
1682
1652
  vcpus: outcome.runner.vcpus,
1683
1653
  region: outcome.runner.region,
1684
1654
  runtime: outcome.runner.runtime,
1685
- buildMs: outcome.runner.buildMs,
1686
- save: outcome.runner.save,
1687
- noSaveReason: outcome.runner.noSave
1655
+ buildMs: outcome.runner.buildMs
1688
1656
  },
1689
1657
  timeline: ran,
1690
- runId: recording.opened.ok ? recording.opened.id : null
1658
+ runId,
1659
+ noFinalTestResults: lacksFinalResults(command.kind === "exited" ? command.code : null, {
1660
+ ...finalResults,
1661
+ collected
1662
+ })
1691
1663
  },
1692
1664
  { testPlan, options: planOptions }
1693
1665
  );
@@ -1727,7 +1699,7 @@ async function runCommand({ app, ui, signal }, request, spec) {
1727
1699
  }
1728
1700
  }
1729
1701
  function runProblems(request) {
1730
- const { credential, unsandboxed, saveDevSnapshot, showOutput, keepSandbox } = request;
1702
+ const { credential, unsandboxed, showOutput, keepSandbox } = request;
1731
1703
  return [
1732
1704
  ...resourceFlagProblems(request),
1733
1705
  ...!unsandboxed && credential === "github-actions" ? [
@@ -1753,18 +1725,6 @@ function runProblems(request) {
1753
1725
  field: "keepSandbox",
1754
1726
  message: "--keep-sandbox keeps a sandboxed run's runner sandbox; drop it or --unsandboxed."
1755
1727
  }
1756
- ] : [],
1757
- ...saveDevSnapshot === true && unsandboxed ? [
1758
- {
1759
- field: "saveDevSnapshot",
1760
- message: "--save-dev-snapshot saves a sandboxed run's runner sandbox; drop it or --unsandboxed."
1761
- }
1762
- ] : [],
1763
- ...saveDevSnapshot === true && keepsSandbox(keepSandbox) ? [
1764
- {
1765
- field: "saveDevSnapshot",
1766
- message: "--save-dev-snapshot saves the runner sandbox instead of keeping it; drop --keep-sandbox or set it to 0."
1767
- }
1768
1728
  ] : []
1769
1729
  ];
1770
1730
  }
@@ -1779,17 +1739,11 @@ async function runRequestFor(app, options) {
1779
1739
  };
1780
1740
  return { ok: true, run: run2 };
1781
1741
  }
1782
- if (request.saveDevSnapshot && !devSnapshotsTrusted(where.recipe))
1783
- return {
1784
- ok: false,
1785
- refusal: runErrors.devSnapshotsNotTrusted({ flag: "--save-dev-snapshot", configFile })
1786
- };
1787
1742
  const prepared = await prepareRunner(app.context, {
1788
1743
  cwd: app.cwd,
1789
1744
  recipe: where.recipe,
1790
1745
  // The recipe's `vcpus` reads each of the run's resources by its definition: one its `beforeRun` skipped isn't.
1791
- vcpusRun: recipeRun(recipeResources(used.requests)),
1792
- reuseDevSnapshots: !request.noReuseDevSnapshot && where.recipe.reuseDevSnapshot
1746
+ vcpusRun: recipeRun(recipeResources(used.requests))
1793
1747
  });
1794
1748
  if (prepared.kind !== "ok") {
1795
1749
  const refusal = prepareRefusal(prepared, configFile);
@@ -1809,7 +1763,6 @@ async function runRequestFor(app, options) {
1809
1763
  target: where.target,
1810
1764
  user: app.user,
1811
1765
  secrets: where.secrets,
1812
- save: saveMode(request, where.recipe, app.env),
1813
1766
  keepMs
1814
1767
  }
1815
1768
  };
@@ -1865,7 +1818,13 @@ async function summarize(app, run) {
1865
1818
  ]
1866
1819
  })
1867
1820
  );
1868
- return timeline;
1821
+ return {
1822
+ timeline,
1823
+ finalResults: {
1824
+ finalResults: tests.events.filter((event) => event.kind === "test-result").length,
1825
+ partial: tests.unreadable > 0 || tests.incomplete !== void 0
1826
+ }
1827
+ };
1869
1828
  }
1870
1829
  function workerClock({ timeline, workerOffsetMs }) {
1871
1830
  const tests = timeline.rows.find((row) => row.name === "tests");
@@ -1901,21 +1860,6 @@ function recipeResources(requests) {
1901
1860
  })
1902
1861
  );
1903
1862
  }
1904
- function keepsSandbox(flag) {
1905
- return flag !== void 0 && (parseKeepTime(flag) ?? 0) > 0;
1906
- }
1907
- function saveMode(request, recipe, env) {
1908
- const flag = request.saveDevSnapshot;
1909
- if (flag !== void 0) return flag ? { kind: "always" } : { kind: "never", reason: "no-save-flag" };
1910
- if (keepsSandbox(request.keepSandbox)) return { kind: "never", reason: "keep-sandbox" };
1911
- if (recipe.saveDevSnapshot !== void 0)
1912
- return recipe.saveDevSnapshot ? { kind: "always" } : { kind: "never", reason: "recipe" };
1913
- if (isCi(env)) return { kind: "never", reason: "ci" };
1914
- return devSnapshotsTrusted(recipe) ? { kind: "new-head" } : { kind: "never", reason: "not-trusted" };
1915
- }
1916
- function runSaveDefault(recipe, env) {
1917
- return saveMode({}, recipe, env);
1918
- }
1919
1863
  var DEFAULT_KEEP_SANDBOX_MINUTES = 30;
1920
1864
  function keepSandboxMinutes(flag, recipe, env) {
1921
1865
  const fromFlag = flag === void 0 ? void 0 : parseKeepTime(flag);
@@ -1969,18 +1913,18 @@ function runnerCleanupLines({ kept, notKept, notStopped, notDeleted }) {
1969
1913
  }
1970
1914
 
1971
1915
  export {
1916
+ EXEC_HELP,
1917
+ EXEC_HINTS,
1972
1918
  notStoppedText,
1973
1919
  notDeletedText,
1974
1920
  RUN_CLEANUP,
1975
1921
  ranSchema,
1976
1922
  RAN_DESCRIPTION,
1977
- renderRan,
1923
+ ranRenderer,
1978
1924
  runErrors,
1979
1925
  RUN_ERRORS,
1980
1926
  outcomes,
1981
1927
  lineProgress,
1982
- progressLine,
1983
- headText,
1984
1928
  canceledBeforeStart,
1985
1929
  RUN_REQUEST_FIELDS,
1986
1930
  RUN_CLI_OPTIONS,
@@ -1988,6 +1932,5 @@ export {
1988
1932
  runProblems,
1989
1933
  prepareRefusal,
1990
1934
  checkoutFailedRefusal,
1991
- runSaveDefault,
1992
1935
  runnerFailureFacts
1993
1936
  };