@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
@@ -7,7 +7,7 @@ import {
7
7
  parseTestEvent,
8
8
  systemClock,
9
9
  systemTimer
10
- } from "./chunk-ODQHQJLE.js";
10
+ } from "./chunk-5ED3IDUJ.js";
11
11
 
12
12
  // src/core/reports.ts
13
13
  var WARNINGS_HEADING = "Warnings";
@@ -301,9 +301,7 @@ function applyEvent(resources, state, event, at) {
301
301
  snapshot: void 0,
302
302
  uploadBytes: void 0,
303
303
  activity: void 0,
304
- kept: void 0,
305
- save: void 0,
306
- noSave: void 0
304
+ kept: void 0
307
305
  }
308
306
  };
309
307
  case "minting":
@@ -362,7 +360,7 @@ function applyEvent(resources, state, event, at) {
362
360
  status: "running",
363
361
  startedAt: at,
364
362
  endedAt: void 0,
365
- runnerSandbox: event.runnerSandbox,
363
+ keepMs: event.keepMs,
366
364
  resources: event.resources,
367
365
  resourceWarnings: 0,
368
366
  notStopped: 0,
@@ -436,9 +434,7 @@ function applyRunnerEvent(state, event, at) {
436
434
  kind: "reused",
437
435
  id: event.snapshotId,
438
436
  base: event.base,
439
- branch: event.branch,
440
- head: event.head,
441
- snapshot: event.snapshot
437
+ builtBehind: event.builtBehind
442
438
  }
443
439
  })
444
440
  );
@@ -455,14 +451,7 @@ function applyRunnerEvent(state, event, at) {
455
451
  kind: "built",
456
452
  id: event.snapshotId,
457
453
  base: event.base,
458
- branch: null,
459
- head: null,
460
- // A run builds its base snapshot at its own base.
461
- snapshot: {
462
- kind: "base",
463
- builtAt: event.base,
464
- builtBehind: event.builtBehind
465
- }
454
+ builtBehind: event.builtBehind
466
455
  },
467
456
  activity: void 0
468
457
  })
@@ -505,23 +494,11 @@ function applyRunnerEvent(state, event, at) {
505
494
  );
506
495
  case "sandbox-kept":
507
496
  return withRunner(state, () => ({ kept: { name: event.name, stopsAt: event.stopsAt } }));
508
- case "dev-snapshot-saving":
509
- return withRunner(state, () => ({ save: { kind: "saving", branch: event.branch } }));
510
- case "dev-snapshot-saved":
511
- return withRunner(state, () => ({
512
- save: { kind: "saved", id: event.snapshotId, branch: event.branch, head: event.head }
513
- }));
514
- case "dev-snapshot-not-saved":
515
- return withRunner(state, () => ({ save: { kind: "not-saved" } }));
516
- case "dev-snapshot-skipped":
517
- return withRunner(state, () => ({ noSave: event.reason }));
518
497
  // A step's outcome comes from its lane's end, not from the end of its output.
519
498
  case "output-started":
520
499
  case "output-ended":
521
500
  case "snapshot-entry-not-written":
522
501
  case "command-output-started":
523
- case "dev-snapshots-dropped":
524
- case "dev-snapshots-not-dropped":
525
502
  return state;
526
503
  }
527
504
  }
@@ -1200,16 +1177,17 @@ async function executeRun(definitionSet, context, resourceContexts2, request, co
1200
1177
  });
1201
1178
  }
1202
1179
  let cleanupStarted = false;
1203
- const startCleanup = async (runnerSandbox) => {
1180
+ const keepMs = request.runner === void 0 ? null : request.runner.keepMs;
1181
+ const startCleanup = async () => {
1204
1182
  if (cleanupStarted) return;
1205
1183
  cleanupStarted = true;
1206
- await progress.emit({ kind: "cleanup-started", runnerSandbox, resources: releasedResources(instances) });
1184
+ await progress.emit({ kind: "cleanup-started", keepMs, resources: releasedResources(instances) });
1207
1185
  };
1208
1186
  let resourceCleanup = {};
1209
1187
  let releasing;
1210
- const release = (runnerSandbox) => releasing ??= (async () => {
1188
+ const release = () => releasing ??= (async () => {
1211
1189
  try {
1212
- await startCleanup(runnerSandbox);
1190
+ await startCleanup();
1213
1191
  } finally {
1214
1192
  resourceCleanup = await releaseResources(instances, progress);
1215
1193
  }
@@ -1219,7 +1197,7 @@ async function executeRun(definitionSet, context, resourceContexts2, request, co
1219
1197
  try {
1220
1198
  ({ ended, runnerCleanup } = request.runner === void 0 ? { ended: await runUnsandboxed(context, request, instances, control, progress), runnerCleanup: null } : await runSandboxed(context, request, instances, control, progress, { startCleanup, release }));
1221
1199
  } finally {
1222
- await release(null);
1200
+ await release();
1223
1201
  }
1224
1202
  await progress.emit({
1225
1203
  kind: "cleanup-finished",
@@ -1295,11 +1273,7 @@ async function runSandboxed(context, request, instances, control, progress, clea
1295
1273
  const session = openRunnerSession(context, request.runner, { signal: control.signal, cleanup }, runnerProgress);
1296
1274
  try {
1297
1275
  const ended = await runInSandbox(context, request, instances, session, control, progress);
1298
- const finished = await session.finish();
1299
- return {
1300
- ended: ended.kind === "command-ended" ? { ...ended, runner: { ...ended.runner, save: finished.save, noSave: finished.noSave } } : ended,
1301
- runnerCleanup: finished.cleanup
1302
- };
1276
+ return { ended, runnerCleanup: await session.finish() };
1303
1277
  } finally {
1304
1278
  await session.close();
1305
1279
  }
@@ -1371,19 +1345,15 @@ async function runInSandbox(context, request, instances, session, control, progr
1371
1345
  resources: resourcesRan(instances),
1372
1346
  command,
1373
1347
  runner: {
1374
- snapshotId: ready.startedFrom.snapshotId,
1375
- base: ready.startedFrom.base,
1376
- snapshotBranch: ready.startedFrom.branch ?? null,
1377
- snapshotHead: ready.startedFrom.head ?? null,
1348
+ snapshotId: ready.snapshotId,
1349
+ base: ready.base,
1378
1350
  built: ready.built,
1379
- snapshot: ready.snapshot,
1351
+ builtBehind: ready.builtBehind,
1380
1352
  uploadBytes: ready.uploadBytes,
1381
1353
  vcpus: ready.vcpus,
1382
1354
  region: ready.region,
1383
1355
  runtime: ready.runtime,
1384
- buildMs: ready.buildMs,
1385
- save: null,
1386
- noSave: null
1356
+ buildMs: ready.buildMs
1387
1357
  }
1388
1358
  };
1389
1359
  }
@@ -2,7 +2,7 @@ import {
2
2
  DEFINITION_SET,
3
3
  EXTENSIONS,
4
4
  RESOURCES
5
- } from "./chunk-ISGQJIQM.js";
5
+ } from "./chunk-Z5OXOZD3.js";
6
6
  import {
7
7
  median,
8
8
  paint,
@@ -10,20 +10,20 @@ import {
10
10
  shortFile,
11
11
  truncate,
12
12
  visibleLength
13
- } from "./chunk-TMQQYHUX.js";
13
+ } from "./chunk-QBR5VHJ7.js";
14
14
  import {
15
15
  megabytesText,
16
16
  sameRow,
17
17
  setupPhaseKey,
18
18
  setupPhaseWords
19
- } from "./chunk-FSP3SJ35.js";
19
+ } from "./chunk-5TMHYH7G.js";
20
20
  import {
21
21
  CONFIG_FILE_NAME
22
- } from "./chunk-ODQHQJLE.js";
22
+ } from "./chunk-5ED3IDUJ.js";
23
23
  import {
24
24
  defaultResourceKey,
25
25
  optionKeyPath
26
- } from "./chunk-YT5OROR7.js";
26
+ } from "./chunk-RA4L2ACU.js";
27
27
 
28
28
  // src/commands/exec/tests-summary.ts
29
29
  var SLOWEST_FILES = 3;
@@ -560,7 +560,11 @@ function resourceFlagValues(request) {
560
560
 
561
561
  // src/commands/exec/test-plan.ts
562
562
  function recordedPlan(testPlan, options) {
563
- return testPlan.kind === "counted" ? { tests: testPlan.tests, files: testPlan.files, options: options.map((option) => ({ ...option })) } : void 0;
563
+ return testPlan.kind === "counted" ? {
564
+ ...testPlan.tests === void 0 ? {} : { tests: testPlan.tests },
565
+ files: testPlan.files,
566
+ options: options.map((option) => ({ ...option }))
567
+ } : void 0;
564
568
  }
565
569
  function testPlanLine(plan) {
566
570
  return `Running ${testPlanText(plan)}`;
@@ -569,7 +573,8 @@ function testPlanText(plan) {
569
573
  return [countText(plan), ...plan.options.map(planOptionText)].join("; ");
570
574
  }
571
575
  function countText({ tests, files }) {
572
- return `${tests} ${tests === 1 ? "test" : "tests"} in ${files} ${files === 1 ? "file" : "files"}`;
576
+ const inFiles = `in ${files} ${files === 1 ? "file" : "files"}`;
577
+ return tests === void 0 ? `tests ${inFiles}` : `${tests} ${tests === 1 ? "test" : "tests"} ${inFiles}`;
573
578
  }
574
579
  function planOptionText({ path, value, from }) {
575
580
  return `${path} ${String(value)} (${fromText(path, from)})`;
@@ -2,7 +2,7 @@ import {
2
2
  booleanOption,
3
3
  mustBe,
4
4
  nonEmptyString
5
- } from "./chunk-YT5OROR7.js";
5
+ } from "./chunk-RA4L2ACU.js";
6
6
 
7
7
  // src/extensions/testserver/options/channels.ts
8
8
  var BUILD_CHANNELS = ["stable", "latest_main"];
@@ -132,17 +132,17 @@ var TTL = "a whole number of minutes or hours from 10m to 5h";
132
132
  var ttl = z.string(mustBe(TTL)).refine((value) => parseTtl(value) !== void 0, mustBe(TTL));
133
133
  var testserverPoolRules = {
134
134
  /**
135
- * How many Testserver sandboxes a run gets: 1 to 32; by default 1, or with `storm vitest` or `storm playwright` one
136
- * per 4 test files it counted, at most 8.
135
+ * How many Testserver sandboxes a run gets: 1 to 32; by default 1, or one per 4 test files `storm vitest` or
136
+ * `storm playwright` counted, at most 8, for a run that counts (`testPlan`).
137
137
  */
138
138
  sandboxes: {
139
139
  schema: sandboxCount,
140
- // `storm vitest` and `storm playwright` size the run from its tests; a run that counts none, such as
141
- // `storm exec`'s, asks for one.
140
+ // `storm vitest` and `storm playwright` size the run from its test files where the config file sets `testPlan`; a
141
+ // run that counts none, such as `storm exec`'s, asks for one.
142
142
  default: ({ testPlan }) => testPlan.kind === "counted" ? sandboxesForTests(testPlan.files) : MIN_SANDBOXES,
143
143
  flag: {
144
144
  valueLabel: "N",
145
- description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or with storm vitest or storm playwright one per 4 test files it counted, at most 8. Gives the run the Testserver pool."
145
+ description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or one per 4 test files when storm vitest or storm playwright counts them (testPlan in storm.config.ts), at most 8. Gives the run the Testserver pool."
146
146
  }
147
147
  },
148
148
  /**
@@ -2,10 +2,10 @@ import {
2
2
  RESOURCE_FLAG_HELP,
3
3
  RESOURCE_USAGE_FLAGS,
4
4
  resourceRunExamples
5
- } from "./chunk-Y3BUNNRG.js";
5
+ } from "./chunk-BFLYGMG3.js";
6
6
 
7
7
  // src/commands/exec/run-metadata.ts
8
- var 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
+ var RUN_USAGE_FLAGS = `${RESOURCE_USAGE_FLAGS} [--credential <SOURCE>] [--scope <TEAM> --project <PROJECT>] [--unsandboxed | [--show-output] [--keep-sandbox <DURATION>]] [--verbose]`;
9
9
  var ownRunFields = (verbose) => ({
10
10
  credential: {
11
11
  valueLabel: "SOURCE",
@@ -14,15 +14,9 @@ var ownRunFields = (verbose) => ({
14
14
  unsandboxed: {
15
15
  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."
16
16
  },
17
- saveDevSnapshot: {
18
- 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."
19
- },
20
- noReuseDevSnapshot: {
21
- 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."
22
- },
23
17
  keepSandbox: {
24
18
  valueLabel: "DURATION",
25
- 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."
19
+ 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."
26
20
  },
27
21
  showOutput: {
28
22
  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,6 +1,6 @@
1
1
  import {
2
2
  runHelp
3
- } from "./chunk-RYRJNHL7.js";
3
+ } from "./chunk-HOKDKP5A.js";
4
4
  import {
5
5
  RAN_DESCRIPTION,
6
6
  RUN_CLI_OPTIONS,
@@ -8,17 +8,21 @@ import {
8
8
  RUN_REQUEST_FIELDS,
9
9
  canceledBeforeStart,
10
10
  checkoutFailedRefusal,
11
+ ranRenderer,
11
12
  ranSchema,
12
- renderRan,
13
13
  runCommand,
14
14
  runProblems
15
- } from "./chunk-U7M3ZB3Z.js";
15
+ } from "./chunk-YBPTMJUM.js";
16
+ import {
17
+ recordedPlan
18
+ } from "./chunk-BFLYGMG3.js";
16
19
  import {
17
20
  planSchema
18
- } from "./chunk-TEEZL3GA.js";
21
+ } from "./chunk-RKONDLPS.js";
19
22
  import {
20
- DRIVER_PLAN_FAILURE_KINDS
21
- } from "./chunk-YT5OROR7.js";
23
+ DRIVER_PLAN_FAILURE_KINDS,
24
+ NOT_COUNTED
25
+ } from "./chunk-RA4L2ACU.js";
22
26
  import {
23
27
  stormCommands
24
28
  } from "./chunk-43MWZLJR.js";
@@ -47,8 +51,10 @@ async function findRunBin(app, name, where) {
47
51
  }
48
52
 
49
53
  // src/commands/exec/driver-plan.ts
50
- async function planDriverCommand(app, driver, errors, args, where, signal) {
54
+ async function planDriverCommand(app, driver, errors, args, count, where, signal) {
51
55
  const { bin: name } = driver.program;
56
+ if (count === void 0 && where.kind === "runner")
57
+ return { ok: true, argv: driver.launch(name, args), testPlan: NOT_COUNTED.testPlan };
52
58
  const bin = await findRunBin(app, name, where);
53
59
  if (bin.kind === "checkout-failed") return refused(checkoutFailedRefusal(bin.failure));
54
60
  const planned = { args, cwd: bin.cwd };
@@ -59,16 +65,26 @@ async function planDriverCommand(app, driver, errors, args, where, signal) {
59
65
  planned
60
66
  )
61
67
  );
68
+ if (count === void 0) return { ok: true, argv: driver.launch(bin.runs, args), testPlan: NOT_COUNTED.testPlan };
62
69
  const contexts = app.driverContexts;
63
- const answer = await driver.plan(contexts[driver.name])({ ...planned, bin: bin.counts, signal });
70
+ const answer = await driver.plan(contexts[driver.name])({
71
+ ...planned,
72
+ bin: bin.counts,
73
+ countTests: count.countTests,
74
+ signal
75
+ });
64
76
  if (!answer.ok) {
65
77
  const { kind, message } = answer;
66
78
  if (kind === "canceled") return refused(canceledBeforeStart());
67
79
  return refused(errors.planFailed({ kind, message }, planned));
68
80
  }
69
81
  const { tests, files } = answer.plan;
70
- if (tests === 0) return refused(errors.noMatchingTests(planned));
71
- return { ok: true, argv: driver.launch(bin.runs, args), testPlan: { kind: "counted", tests, files } };
82
+ if ((tests ?? files) === 0) return refused(errors.noMatchingTests(planned));
83
+ return {
84
+ ok: true,
85
+ argv: driver.launch(bin.runs, args),
86
+ testPlan: { kind: "counted", ...tests === void 0 ? {} : { tests }, files }
87
+ };
72
88
  }
73
89
 
74
90
  // src/commands/exec/driver-refusals.ts
@@ -78,7 +94,7 @@ var plannedShape = {
78
94
  driver: z.string().min(1),
79
95
  /** The arguments given to the driver's program, which its plan step was given too. */
80
96
  args: z.array(z.string()),
81
- /** The directory the tests were counted in, on this machine. */
97
+ /** The directory the run was planned in, on this machine: where its program was looked for and its tests counted. */
82
98
  cwd: z.string()
83
99
  };
84
100
  function driverRefusals({ name, refusals }) {
@@ -105,7 +121,7 @@ function driverRefusals({ name, refusals }) {
105
121
  cwd: plannedShape.cwd
106
122
  }),
107
123
  render: ({ kind, message, cwd }) => ({
108
- message: `Couldn't count the tests in ${cwd}: ${/[.!?]$/.test(message) ? message : `${message}.`} The command didn't run.`,
124
+ message: `Couldn't plan the run in ${cwd}: ${/[.!?]$/.test(message) ? message : `${message}.`} The command didn't run.`,
109
125
  next: [{ type: "text", text: refusals.planFailed.next[kind] }]
110
126
  })
111
127
  }
@@ -130,31 +146,55 @@ function defineRunCommand(driver) {
130
146
  ran: {
131
147
  schema: ranSchema.extend({
132
148
  /**
133
- * The test plan: what the driver's plan step counted before the run, and each resource option whose default
134
- * is a function of it, with its value and where that came from.
149
+ * The test plan of a run that counted: what the driver's plan step counted before the run, and each resource
150
+ * option whose default is a function of it, with its value and where that came from. Absent for a run that
151
+ * counted nothing.
135
152
  */
136
- plan: planSchema
153
+ plan: planSchema.exactOptional()
137
154
  }),
138
155
  description: RAN_DESCRIPTION,
139
- render: renderRan
156
+ render: ranRenderer(driver.hints)
140
157
  }
141
158
  },
142
159
  errors: { ...RUN_ERRORS, ...errors.errors }
143
160
  });
161
+ const help = runHelp(driver.help, "args", { driver: driver.name });
144
162
  return stormCommands.define({
145
- requestSchema: z2.object({ ...RUN_REQUEST_FIELDS, args: z2.array(z2.string()).default([]) }),
163
+ requestSchema: z2.object({
164
+ ...RUN_REQUEST_FIELDS,
165
+ ...countTestsField(driver),
166
+ args: z2.array(z2.string()).default([])
167
+ }),
146
168
  cli: { options: RUN_CLI_OPTIONS, positionals: ["args"] },
147
- help: runHelp(driver.help, "args", { driver: driver.name }),
169
+ help: driver.countTests === void 0 ? help : { ...help, fields: { ...help.fields, countTests: { description: driver.countTests.description } } },
148
170
  response: counted,
149
171
  validate: runProblems,
150
172
  handler: async (context, request) => await runCommand(context, request, {
151
173
  name: driver.name,
152
174
  hints: driver.hints,
153
- planCommand: async (where, signal) => await planDriverCommand(context.app, driver, errors, request.args, where, signal),
154
- ran: (facts, { testPlan, options }) => counted.ran({ ...facts, plan: { tests: testPlan.tests, files: testPlan.files, options: [...options] } })
175
+ planCommand: async (where, signal, { testPlan }) => await planDriverCommand(
176
+ context.app,
177
+ driver,
178
+ errors,
179
+ request.args,
180
+ driverCount(driver, testPlan, request.countTests === true),
181
+ where,
182
+ signal
183
+ ),
184
+ ran: (facts, { testPlan, options }) => {
185
+ const plan = recordedPlan(testPlan, options);
186
+ return counted.ran({ ...facts, ...plan === void 0 ? {} : { plan } });
187
+ }
155
188
  })
156
189
  });
157
190
  }
191
+ function driverCount(driver, testPlan, countTests) {
192
+ if (!testPlan && !countTests) return void 0;
193
+ return { countTests: driver.countTests === void 0 || countTests };
194
+ }
195
+ function countTestsField(driver) {
196
+ return driver.countTests === void 0 ? {} : { countTests: z2.boolean().default(false) };
197
+ }
158
198
 
159
199
  export {
160
200
  defineRunCommand
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  secondsOf,
3
3
  secondsText
4
- } from "./chunk-FSP3SJ35.js";
4
+ } from "./chunk-5TMHYH7G.js";
5
5
 
6
6
  // src/commands/exec/text.ts
7
7
  function seconds(ms) {
@@ -214,8 +214,18 @@ function defineResource(spec) {
214
214
  // src/sdk/extension/driver.ts
215
215
  var DRIVER_PLAN_FAILURE_KINDS = ["start-failed", "timed-out", "exited", "unreadable-output"];
216
216
  function defineDriver(spec) {
217
- const { name, program, context, launch, plan, help, hints, refusals } = spec;
218
- const driver = { name, program, context, launch, plan, help, hints, refusals };
217
+ const { name, program, context, launch, plan, countTests, help, hints, refusals } = spec;
218
+ const driver = {
219
+ name,
220
+ program,
221
+ context,
222
+ launch,
223
+ plan,
224
+ ...countTests === void 0 ? {} : { countTests },
225
+ help,
226
+ hints,
227
+ refusals
228
+ };
219
229
  return driver;
220
230
  }
221
231
  function argsText(args) {
@@ -2,11 +2,11 @@ import {
2
2
  EMPTY_RUN_STATE,
3
3
  commandExitStatus,
4
4
  observeAll
5
- } from "./chunk-FSP3SJ35.js";
5
+ } from "./chunk-5TMHYH7G.js";
6
6
  import {
7
7
  parseTestEvent,
8
8
  testEventLine
9
- } from "./chunk-ODQHQJLE.js";
9
+ } from "./chunk-5ED3IDUJ.js";
10
10
 
11
11
  // src/run-directory/run-directory.ts
12
12
  import { join } from "node:path";
@@ -63,9 +63,12 @@ var planOptionSchema = z.object({
63
63
  from: z.enum(["flag", "file", "default"])
64
64
  });
65
65
  var planSchema = z.object({
66
- /** How many tests `vitest list --json <args>` or `playwright test <args> --list` counted. */
67
- tests: z.number().int().nonnegative(),
68
- /** How many distinct test files they are in. */
66
+ /**
67
+ * How many tests `vitest list <args> --json` or `playwright test <args> --list` counted; absent when the run counted
68
+ * only the test files, as `storm vitest` does without `--count-tests`.
69
+ */
70
+ tests: z.number().int().nonnegative().optional(),
71
+ /** How many distinct test files the run counted. */
69
72
  files: z.number().int().nonnegative(),
70
73
  /**
71
74
  * Each resource option whose default is a function of the test plan, with its value and where that came from; empty
@@ -94,52 +97,8 @@ var snapshotSchema = z2.object({
94
97
  id: z2.string(),
95
98
  base: z2.string(),
96
99
  built: z2.boolean(),
97
- branch: z2.string().nullable(),
98
- head: z2.string().nullable(),
99
- // A record written before these existed lacks them, and reads each as null.
100
- kind: z2.enum(["base", "dev"]).nullable().default(null),
101
- builtAt: z2.string().nullable().default(null),
102
- builtBehind: z2.number().nullable().default(null)
100
+ builtBehind: z2.number().nullable()
103
101
  });
104
- var noSaveReasonSchema = z2.enum([
105
- "no-save-flag",
106
- "recipe",
107
- "keep-sandbox",
108
- "ci",
109
- "not-trusted",
110
- "command-failed",
111
- "already-saved"
112
- ]);
113
- var saveSchema = z2.discriminatedUnion("kind", [
114
- z2.object({
115
- /** It saved the runner sandbox as a dev snapshot. */
116
- kind: z2.literal("saved"),
117
- /** The runner snapshot it saved. */
118
- snapshotId: z2.string(),
119
- /** The base it is of: the base of the runner snapshot the run started from, a full SHA. */
120
- base: z2.string(),
121
- /** HEAD's local branch as the run started; null when HEAD was detached. */
122
- branch: z2.string().nullable(),
123
- /** HEAD's commit as the run started, a full SHA, which the dev snapshot was built at. */
124
- head: z2.string(),
125
- /** How long the save took, in milliseconds, from the scrub's start until the snapshot was saved. */
126
- ms: z2.number(),
127
- /** The snapshot's size in bytes. */
128
- sizeBytes: z2.number(),
129
- /** Whether the runner snapshot cache recorded it; a later run starts from it only when it did. */
130
- entryWritten: z2.boolean()
131
- }),
132
- z2.object({
133
- /** It didn't save: the scrub or the save failed. */
134
- kind: z2.literal("failed"),
135
- step: z2.enum(["scrub", "save-snapshot"]),
136
- message: z2.string()
137
- }),
138
- z2.object({
139
- /** It didn't save, or recorded nothing: a signal stopped it. */
140
- kind: z2.literal("stopped")
141
- })
142
- ]);
143
102
  var whereSchema = z2.discriminatedUnion("kind", [
144
103
  z2.object({ kind: z2.literal("unsandboxed") }),
145
104
  z2.object({
@@ -154,15 +113,12 @@ var whereSchema = z2.discriminatedUnion("kind", [
154
113
  sandbox: z2.string().nullable(),
155
114
  snapshot: snapshotSchema.nullable(),
156
115
  keptUntil: z2.string().nullable(),
157
- save: saveSchema.nullable(),
158
- // A record written before these existed lacks them, and reads each as null.
159
- uploadBytes: z2.number().nullable().default(null),
160
- noSaveReason: noSaveReasonSchema.nullable().default(null)
116
+ uploadBytes: z2.number().nullable()
161
117
  })
162
118
  ]);
163
119
  var gitSchema = z2.object({ branch: z2.string().nullable(), commit: z2.string(), dirty: z2.boolean() });
164
120
  var runRecordSchema = z2.object({
165
- version: z2.literal(4),
121
+ version: z2.literal(5),
166
122
  startedAt: z2.string(),
167
123
  cwd: z2.string(),
168
124
  configFile: z2.string().nullable(),
@@ -231,12 +187,10 @@ function startedWhere(run) {
231
187
  sandbox: null,
232
188
  snapshot: null,
233
189
  keptUntil: null,
234
- save: null,
235
- uploadBytes: null,
236
- noSaveReason: null
190
+ uploadBytes: null
237
191
  };
238
192
  }
239
- function endedWhere(where, runner, save) {
193
+ function endedWhere(where, runner) {
240
194
  if (where.kind === "unsandboxed") return where;
241
195
  const snapshot = runner?.snapshot;
242
196
  return {
@@ -246,16 +200,10 @@ function endedWhere(where, runner, save) {
246
200
  id: snapshot.id,
247
201
  base: snapshot.base,
248
202
  built: snapshot.kind === "built",
249
- branch: snapshot.branch,
250
- head: snapshot.head,
251
- kind: snapshot.snapshot.kind,
252
- builtAt: snapshot.snapshot.builtAt,
253
- builtBehind: snapshot.snapshot.builtBehind
203
+ builtBehind: snapshot.builtBehind
254
204
  },
255
205
  keptUntil: runner?.kept?.stopsAt ?? null,
256
- save,
257
- uploadBytes: runner?.uploadBytes ?? null,
258
- noSaveReason: runner?.noSave ?? null
206
+ uploadBytes: runner?.uploadBytes ?? null
259
207
  };
260
208
  }
261
209
 
@@ -783,7 +731,7 @@ function summaryEvent(event) {
783
731
  async function recordRun(gateway, start) {
784
732
  const { definitionSet } = start;
785
733
  const record = start.redact({
786
- version: 4,
734
+ version: 5,
787
735
  startedAt: start.startedAt.toISOString(),
788
736
  cwd: start.cwd,
789
737
  configFile: start.configFile,
@@ -825,7 +773,7 @@ async function recordRun(gateway, start) {
825
773
  directory?.writeRun(
826
774
  runRecordText({
827
775
  ...record,
828
- where: endedWhere(record.where, state.runner, outcome.kind === "ran" ? outcome.runner?.save ?? null : null),
776
+ where: endedWhere(record.where, state.runner),
829
777
  ended: runEnd(outcome, state.command, tests, definitionSet.reports)
830
778
  })
831
779
  );
@@ -843,8 +791,6 @@ export {
843
791
  liveRunDirectoryGateway,
844
792
  unavailableRunDirectoryGateway,
845
793
  planSchema,
846
- noSaveReasonSchema,
847
- saveSchema,
848
794
  timelineSchema,
849
795
  recordRun,
850
796
  pastRuns
@@ -21,13 +21,13 @@ import {
21
21
  testserverPoolRules,
22
22
  ttlMinutes,
23
23
  unavailablePoolStoreGateway
24
- } from "./chunk-LQKNI3EG.js";
24
+ } from "./chunk-BRUIATTR.js";
25
25
  import {
26
26
  defineResource,
27
27
  describeCredentialFailure,
28
28
  optionKeyPath,
29
29
  tokenRequestFailureFacts
30
- } from "./chunk-YT5OROR7.js";
30
+ } from "./chunk-RA4L2ACU.js";
31
31
 
32
32
  // src/extensions/testserver/credential-facts.ts
33
33
  import { z } from "zod";