@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
@@ -1,24 +1,33 @@
1
1
  import type { ListedTest, VitestListFailure, VitestListGateway } from "./gateways.ts";
2
2
  /** How long `vitest list` may run by default. */
3
3
  export declare const LIST_TIMEOUT_MS = 60000;
4
- /** How many tests a Vitest run would run, and in how many files. */
4
+ /**
5
+ * How many test files a Vitest run would run, and how many tests in them when they were counted (`countTests`); no
6
+ * `tests` when only the files were.
7
+ */
5
8
  export interface TestPlan {
6
- readonly tests: number;
9
+ readonly tests?: number;
7
10
  readonly files: number;
8
11
  }
9
12
  export interface ListVitestTestsOptions {
10
- /** Passed to `vitest list --json`, as `vitest run` takes them, such as `["--project", "e2e"]`. */
13
+ /** Passed to `vitest list`, as `vitest run` takes them, such as `["--project", "e2e"]`. */
11
14
  readonly args: readonly string[];
12
15
  /** Where vitest runs; default the current directory. */
13
16
  readonly cwd?: string;
14
17
  /** The `vitest` to start, such as the path of a `node_modules/.bin/vitest`; default `vitest` from `PATH`. */
15
18
  readonly executable?: string;
19
+ /**
20
+ * Whether to count each test too, with `vitest list <args> --json`, which imports every test file to collect its
21
+ * tests and applies a `-t`. By default it counts only the files, with `vitest list <args> --filesOnly --json`, which
22
+ * imports no test file and applies no `-t`.
23
+ */
24
+ readonly countTests?: boolean;
16
25
  /** How long `vitest list` may take; default `LIST_TIMEOUT_MS`, 60s. */
17
26
  readonly timeoutMs?: number;
18
27
  /** Stops `vitest list` when it aborts: the plan's failure is then `canceled`. */
19
28
  readonly signal?: AbortSignal;
20
29
  }
21
- /** A Vitest run's test plan, or why its tests couldn't be listed. */
30
+ /** A Vitest run's test plan, or why its tests or files couldn't be listed. */
22
31
  export type VitestPlanResult = {
23
32
  readonly ok: true;
24
33
  readonly plan: TestPlan;
@@ -27,12 +36,15 @@ export type VitestPlanResult = {
27
36
  readonly failure: VitestListFailure;
28
37
  };
29
38
  /**
30
- * Lists the tests `vitest run <args>` would run over `gateway`, with `vitest list <args> --json` (`executable`, else
31
- * `vitest` from `PATH`), and counts them; or says why it couldn't: `vitest` failed to start, didn't finish within
39
+ * Lists the test files `vitest run <args>` would run over `gateway`, with `vitest list <args> --filesOnly --json`
40
+ * (`executable`, else `vitest` from `PATH`), or its tests with `vitest list <args> --json` when `countTests` is set,
41
+ * and counts them; or says why it couldn't: `vitest` failed to start, didn't finish within
32
42
  * `timeoutMs`, exited other than 0 (with the last line of its stderr that isn't a stack frame), printed something other
33
- * than a list of tests, or was stopped by `signal` (`canceled`). Throws a `TypeError` unless `timeoutMs` is a positive
43
+ * than a list of tests or files, or was stopped by `signal` (`canceled`). Throws a `TypeError` unless `timeoutMs` is a positive
34
44
  * number.
35
45
  */
36
46
  export declare function planVitestRunOver(options: ListVitestTestsOptions, gateway: VitestListGateway): Promise<VitestPlanResult>;
37
47
  /** The plan of the tests listed: how many, and in how many distinct files. */
38
48
  export declare function planOf(tests: readonly ListedTest[]): TestPlan;
49
+ /** The plan of the files listed: how many distinct files, and no number of tests. */
50
+ export declare function planOfFiles(files: readonly string[]): TestPlan;
@@ -1,14 +1,16 @@
1
- // Planning a Vitest run over a given list gateway: counting the tests `vitest run <args>` would run. storm's Vitest
1
+ // Planning a Vitest run over a given list gateway: counting the test files `vitest run <args>` would run, and its tests
2
+ // when asked. storm's Vitest
2
3
  // driver (`../driver.ts`) plans with it over its Context's gateway, and tests plan with it over the fake. The published
3
4
  // `plan.ts` plans with it over the live gateway, and this file is not a published export, so a consumer of
4
5
  // `@vercel/storm/vitest/plan` sees no gateway. It imports no vitest and nothing of storm outside this folder.
5
6
  /** How long `vitest list` may run by default. */
6
7
  export const LIST_TIMEOUT_MS = 60_000;
7
8
  /**
8
- * Lists the tests `vitest run <args>` would run over `gateway`, with `vitest list <args> --json` (`executable`, else
9
- * `vitest` from `PATH`), and counts them; or says why it couldn't: `vitest` failed to start, didn't finish within
9
+ * Lists the test files `vitest run <args>` would run over `gateway`, with `vitest list <args> --filesOnly --json`
10
+ * (`executable`, else `vitest` from `PATH`), or its tests with `vitest list <args> --json` when `countTests` is set,
11
+ * and counts them; or says why it couldn't: `vitest` failed to start, didn't finish within
10
12
  * `timeoutMs`, exited other than 0 (with the last line of its stderr that isn't a stack frame), printed something other
11
- * than a list of tests, or was stopped by `signal` (`canceled`). Throws a `TypeError` unless `timeoutMs` is a positive
13
+ * than a list of tests or files, or was stopped by `signal` (`canceled`). Throws a `TypeError` unless `timeoutMs` is a positive
12
14
  * number.
13
15
  */
14
16
  export async function planVitestRunOver(options, gateway) {
@@ -16,16 +18,25 @@ export async function planVitestRunOver(options, gateway) {
16
18
  if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
17
19
  throw new TypeError(`planVitestRun: timeoutMs is ${String(timeoutMs)}, not a positive number`);
18
20
  }
19
- const listed = await gateway.listTests({
21
+ const request = {
20
22
  args: options.args,
21
23
  ...(options.cwd === undefined ? {} : { cwd: options.cwd }),
22
24
  ...(options.executable === undefined ? {} : { executable: options.executable }),
23
25
  timeoutMs,
24
26
  ...(options.signal === undefined ? {} : { signal: options.signal }),
25
- });
26
- return listed.ok ? { ok: true, plan: planOf(listed.tests) } : { ok: false, failure: listed.failure };
27
+ };
28
+ if (options.countTests === true) {
29
+ const listed = await gateway.listTests(request);
30
+ return listed.ok ? { ok: true, plan: planOf(listed.tests) } : { ok: false, failure: listed.failure };
31
+ }
32
+ const listed = await gateway.listFiles(request);
33
+ return listed.ok ? { ok: true, plan: planOfFiles(listed.files) } : { ok: false, failure: listed.failure };
27
34
  }
28
35
  /** The plan of the tests listed: how many, and in how many distinct files. */
29
36
  export function planOf(tests) {
30
37
  return { tests: tests.length, files: new Set(tests.map((test) => test.file)).size };
31
38
  }
39
+ /** The plan of the files listed: how many distinct files, and no number of tests. */
40
+ export function planOfFiles(files) {
41
+ return { files: new Set(files).size };
42
+ }
@@ -3,10 +3,11 @@ import { type ListVitestTestsOptions, type TestPlan, type VitestPlanResult } fro
3
3
  export type { ListedTest, VitestListFailure } from "./gateways.ts";
4
4
  export { LIST_TIMEOUT_MS, type ListVitestTestsOptions, type TestPlan, type VitestPlanResult } from "./plan-over.ts";
5
5
  /**
6
- * Lists the tests `vitest run <args>` would run, with `vitest list <args> --json` (`executable`, else `vitest` from
7
- * `PATH`), and counts them; or says why it couldn't: `vitest` failed to start, didn't finish within `timeoutMs`, exited
8
- * other than 0 (with the last line of its stderr that isn't a stack frame), printed something other than a list of
9
- * tests, or was stopped by `signal` (`canceled`). Throws a `TypeError` unless `timeoutMs` is a positive number.
6
+ * Lists the test files `vitest run <args>` would run, with `vitest list <args> --filesOnly --json` (`executable`, else
7
+ * `vitest` from `PATH`), or its tests with `vitest list <args> --json` when `countTests` is set, and counts them; or
8
+ * says why it couldn't: `vitest` failed to start, didn't finish within `timeoutMs`, exited other than 0 (with the last
9
+ * line of its stderr that isn't a stack frame), printed something other than a list of tests or files, or was stopped
10
+ * by `signal` (`canceled`). Throws a `TypeError` unless `timeoutMs` is a positive number.
10
11
  */
11
12
  export declare function planVitestRun(options: ListVitestTestsOptions): Promise<VitestPlanResult>;
12
13
  /**
@@ -18,7 +19,15 @@ export declare function listVitestTests(options: ListVitestTestsOptions): Promis
18
19
  export declare function vitestRunArgv(executable: string, args: readonly string[]): readonly string[];
19
20
  /** The plan `vitest list --json` printed: its tests, and their distinct files. Throws when it isn't a list of tests. */
20
21
  export declare function parseVitestList(stdout: string): TestPlan;
21
- /** A plan as a phrase, such as `65 tests in 19 files` or `1 test in 1 file`. */
22
+ /**
23
+ * The plan `vitest list --filesOnly --json` printed: its distinct files, and no number of tests. Throws when it isn't a
24
+ * list of files.
25
+ */
26
+ export declare function parseVitestFileList(stdout: string): TestPlan;
27
+ /**
28
+ * A plan as a phrase, such as `65 tests in 19 files` or `1 test in 1 file`, or `tests in 19 files` for a plan that
29
+ * counted only the files.
30
+ */
22
31
  export declare function formatPlan(plan: TestPlan): string;
23
32
  /** Why the tests couldn't be listed, as a sentence. */
24
33
  export declare function describeVitestListFailure(failure: VitestListFailure): string;
@@ -1,17 +1,18 @@
1
1
  // Planning a Vitest run before anything is acquired or started, exported as `@vercel/storm/vitest/plan`: counting the
2
- // tests `vitest run <args>` would run, and the `vitest run` argv. A launcher script that counts the tests itself plans
2
+ // test files `vitest run <args>` would run, or its tests, and the `vitest run` argv. A launcher script that counts the tests itself plans
3
3
  // with it. storm's Vitest driver (`../driver.ts`) plans over its own Context instead, with `plan-over.ts`, which this
4
4
  // file plans with over the live list gateway. It imports no vitest and nothing of storm outside this folder: the
5
5
  // launcher and a launcher script run outside a Vitest run.
6
- import { readVitestList } from "./list-output.js";
6
+ import { readVitestFileList, readVitestList } from "./list-output.js";
7
7
  import { liveVitestListGateway } from "./live/list-gateway.js";
8
- import { planOf, planVitestRunOver, } from "./plan-over.js";
8
+ import { planOf, planOfFiles, planVitestRunOver, } from "./plan-over.js";
9
9
  export { LIST_TIMEOUT_MS } from "./plan-over.js";
10
10
  /**
11
- * Lists the tests `vitest run <args>` would run, with `vitest list <args> --json` (`executable`, else `vitest` from
12
- * `PATH`), and counts them; or says why it couldn't: `vitest` failed to start, didn't finish within `timeoutMs`, exited
13
- * other than 0 (with the last line of its stderr that isn't a stack frame), printed something other than a list of
14
- * tests, or was stopped by `signal` (`canceled`). Throws a `TypeError` unless `timeoutMs` is a positive number.
11
+ * Lists the test files `vitest run <args>` would run, with `vitest list <args> --filesOnly --json` (`executable`, else
12
+ * `vitest` from `PATH`), or its tests with `vitest list <args> --json` when `countTests` is set, and counts them; or
13
+ * says why it couldn't: `vitest` failed to start, didn't finish within `timeoutMs`, exited other than 0 (with the last
14
+ * line of its stderr that isn't a stack frame), printed something other than a list of tests or files, or was stopped
15
+ * by `signal` (`canceled`). Throws a `TypeError` unless `timeoutMs` is a positive number.
15
16
  */
16
17
  export async function planVitestRun(options) {
17
18
  return await planVitestRunOver(options, liveVitestListGateway);
@@ -34,9 +35,22 @@ export function vitestRunArgv(executable, args) {
34
35
  export function parseVitestList(stdout) {
35
36
  return planOf(readVitestList(stdout));
36
37
  }
37
- /** A plan as a phrase, such as `65 tests in 19 files` or `1 test in 1 file`. */
38
+ /**
39
+ * The plan `vitest list --filesOnly --json` printed: its distinct files, and no number of tests. Throws when it isn't a
40
+ * list of files.
41
+ */
42
+ export function parseVitestFileList(stdout) {
43
+ return planOfFiles(readVitestFileList(stdout));
44
+ }
45
+ /**
46
+ * A plan as a phrase, such as `65 tests in 19 files` or `1 test in 1 file`, or `tests in 19 files` for a plan that
47
+ * counted only the files.
48
+ */
38
49
  export function formatPlan(plan) {
39
- return `${plan.tests} ${plan.tests === 1 ? "test" : "tests"} in ${plan.files} ${plan.files === 1 ? "file" : "files"}`;
50
+ const files = `${plan.files} ${plan.files === 1 ? "file" : "files"}`;
51
+ return plan.tests === undefined
52
+ ? `tests in ${files}`
53
+ : `${plan.tests} ${plan.tests === 1 ? "test" : "tests"} in ${files}`;
40
54
  }
41
55
  /** Why the tests couldn't be listed, as a sentence. */
42
56
  export function describeVitestListFailure(failure) {
@@ -26,7 +26,7 @@ export declare const EXTENSIONS: readonly [import("./sdk/extension/commands.ts")
26
26
  readonly default: ({ testPlan }: import("./sdk/extension/resource-definition.ts").PlannedRun) => number;
27
27
  readonly flag: {
28
28
  readonly valueLabel: "N";
29
- readonly 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.";
29
+ readonly 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.";
30
30
  };
31
31
  };
32
32
  readonly build: {
@@ -91,7 +91,7 @@ export declare const RESOURCES: readonly [import("./sdk/extension/resource-defin
91
91
  readonly default: ({ testPlan }: import("./sdk/extension/resource-definition.ts").PlannedRun) => number;
92
92
  readonly flag: {
93
93
  readonly valueLabel: "N";
94
- readonly 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.";
94
+ readonly 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.";
95
95
  };
96
96
  };
97
97
  readonly build: {
@@ -4,5 +4,5 @@ export { RUNS_SUBPATH } from "./run-directory.ts";
4
4
  export { recordRun, type RunRecorded, type RunRecording } from "./recording.ts";
5
5
  export { type ListedRun, pastRuns } from "./reader.ts";
6
6
  export { type PlanOption, planSchema, type TestPlanFacts } from "./plan.ts";
7
- export { noSaveReasonSchema, type RunRecordGit, type RunRecordWhere, saveSchema } from "./run-record.ts";
7
+ export type { RunRecordGit, RunRecordWhere } from "./run-record.ts";
8
8
  export { type TimelineFacts, type TimelineFactsRow, timelineSchema } from "./timeline-facts.ts";
@@ -9,5 +9,4 @@ export { RUNS_SUBPATH } from "./run-directory.js";
9
9
  export { recordRun } from "./recording.js";
10
10
  export { pastRuns } from "./reader.js";
11
11
  export { planSchema } from "./plan.js";
12
- export { noSaveReasonSchema, saveSchema } from "./run-record.js";
13
12
  export { timelineSchema } from "./timeline-facts.js";
@@ -15,7 +15,7 @@ declare const planOptionSchema: z.ZodObject<{
15
15
  export type PlanOption = Readonly<z.output<typeof planOptionSchema>>;
16
16
  /** A run's test plan, as `vitest`'s and `playwright`'s `ran` outcomes, `run.json` and `runs show` hold it. */
17
17
  export declare const planSchema: z.ZodObject<{
18
- tests: z.ZodNumber;
18
+ tests: z.ZodOptional<z.ZodNumber>;
19
19
  files: z.ZodNumber;
20
20
  options: z.ZodArray<z.ZodObject<{
21
21
  path: z.ZodString;
@@ -28,7 +28,8 @@ export declare const planSchema: z.ZodObject<{
28
28
  }, z.core.$strip>>;
29
29
  }, z.core.$strip>;
30
30
  /**
31
- * A run's test plan: how many tests `vitest list` or `playwright test --list` counted, in how many files, and each
31
+ * A run's test plan: how many test files `vitest list` or `playwright test --list` counted, how many tests in them
32
+ * when it counted those too, and each
32
33
  * resource option whose default is a function of the planned run, with its value and where that came from.
33
34
  */
34
35
  export type TestPlanFacts = Readonly<z.output<typeof planSchema>>;
@@ -12,9 +12,12 @@ const planOptionSchema = z.object({
12
12
  });
13
13
  /** A run's test plan, as `vitest`'s and `playwright`'s `ran` outcomes, `run.json` and `runs show` hold it. */
14
14
  export const planSchema = z.object({
15
- /** How many tests `vitest list --json <args>` or `playwright test <args> --list` counted. */
16
- tests: z.number().int().nonnegative(),
17
- /** How many distinct test files they are in. */
15
+ /**
16
+ * How many tests `vitest list <args> --json` or `playwright test <args> --list` counted; absent when the run counted
17
+ * only the test files, as `storm vitest` does without `--count-tests`.
18
+ */
19
+ tests: z.number().int().nonnegative().optional(),
20
+ /** How many distinct test files the run counted. */
18
21
  files: z.number().int().nonnegative(),
19
22
  /**
20
23
  * Each resource option whose default is a function of the test plan, with its value and where that came from; empty
@@ -24,7 +24,7 @@ import { timelineFacts } from "./timeline-facts.js";
24
24
  export async function recordRun(gateway, start) {
25
25
  const { definitionSet } = start;
26
26
  const record = start.redact({
27
- version: 4,
27
+ version: 5,
28
28
  startedAt: start.startedAt.toISOString(),
29
29
  cwd: start.cwd,
30
30
  configFile: start.configFile,
@@ -72,7 +72,7 @@ export async function recordRun(gateway, start) {
72
72
  directory?.writeTimeline(JSON.stringify(timeline, null, 2));
73
73
  directory?.writeRun(runRecordText({
74
74
  ...record,
75
- where: endedWhere(record.where, state.runner, outcome.kind === "ran" ? (outcome.runner?.save ?? null) : null),
75
+ where: endedWhere(record.where, state.runner),
76
76
  ended: runEnd(outcome, state.command, tests, definitionSet.reports),
77
77
  }));
78
78
  const writeFailure = await directory?.close();
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import { type ResourceReports, type RunOutcome, type RunRequest, type RunState } from "../core/index.ts";
3
- import type { RunnerSave } from "../runner/index.ts";
4
3
  import type { Row } from "../sdk/extension/index.ts";
5
4
  import type { TestEvent } from "../sdk/run/launcher.ts";
6
5
  import { type TestPlanFacts } from "./plan.ts";
@@ -55,59 +54,15 @@ declare const snapshotSchema: z.ZodObject<{
55
54
  id: z.ZodString;
56
55
  base: z.ZodString;
57
56
  built: z.ZodBoolean;
58
- branch: z.ZodNullable<z.ZodString>;
59
- head: z.ZodNullable<z.ZodString>;
60
- kind: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
61
- base: "base";
62
- dev: "dev";
63
- }>>>;
64
- builtAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
65
- builtBehind: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
57
+ builtBehind: z.ZodNullable<z.ZodNumber>;
66
58
  }, z.core.$strip>;
67
- /** Why a run whose command ended on its own started no save of a dev snapshot (`RunnerNoSaveReason`). */
68
- export declare const noSaveReasonSchema: z.ZodEnum<{
69
- "already-saved": "already-saved";
70
- ci: "ci";
71
- "command-failed": "command-failed";
72
- "keep-sandbox": "keep-sandbox";
73
- "no-save-flag": "no-save-flag";
74
- "not-trusted": "not-trusted";
75
- recipe: "recipe";
76
- }>;
77
59
  /**
78
60
  * The runner snapshot a runner sandbox started from: its id, the base it is of, which the run's changes were uploaded
79
- * on top of, whether the run built it or reused a cached one, and for a dev snapshot the HEAD commit of the run that
80
- * saved it and its branch (the commit is null for a base snapshot, the branch for a base snapshot and for a run on a
81
- * detached HEAD); then its kind, the commit it was built at (a base snapshot's base, or the commit that saved a dev
82
- * snapshot), and how many commits HEAD has that its built-at commit lacks (`builtBehind`), each null when unknown or in
83
- * a record written before it existed. A record written before storm required a snapshot's base to be the merge-base
84
- * may still hold that base's count of commits behind the merge-base, which the schema drops as it reads.
61
+ * on top of and the commit it was built at, whether the run built it or reused a cached one, and how many commits HEAD
62
+ * has that its base lacks (`builtBehind`), null when the run state had no count. Version 5 records only base snapshots; storm does not read a version 4
63
+ * record, whose dev snapshot count may have been measured from another commit than its base.
85
64
  */
86
65
  export type RunRecordSnapshot = Readonly<z.output<typeof snapshotSchema>>;
87
- /**
88
- * How saving the runner sandbox as a dev snapshot ended, as a `ran` outcome and `run.json` report it.
89
- */
90
- export declare const saveSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
91
- kind: z.ZodLiteral<"saved">;
92
- snapshotId: z.ZodString;
93
- base: z.ZodString;
94
- branch: z.ZodNullable<z.ZodString>;
95
- head: z.ZodString;
96
- ms: z.ZodNumber;
97
- sizeBytes: z.ZodNumber;
98
- entryWritten: z.ZodBoolean;
99
- }, z.core.$strip>, z.ZodObject<{
100
- kind: z.ZodLiteral<"failed">;
101
- step: z.ZodEnum<{
102
- "save-snapshot": "save-snapshot";
103
- scrub: "scrub";
104
- }>;
105
- message: z.ZodString;
106
- }, z.core.$strip>, z.ZodObject<{
107
- kind: z.ZodLiteral<"stopped">;
108
- }, z.core.$strip>], "kind">;
109
- /** How saving the runner sandbox as a dev snapshot ended. */
110
- export type RunRecordSave = z.output<typeof saveSchema>;
111
66
  declare const whereSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
112
67
  kind: z.ZodLiteral<"unsandboxed">;
113
68
  }, z.core.$strip>, z.ZodObject<{
@@ -124,55 +79,18 @@ declare const whereSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
124
79
  id: z.ZodString;
125
80
  base: z.ZodString;
126
81
  built: z.ZodBoolean;
127
- branch: z.ZodNullable<z.ZodString>;
128
- head: z.ZodNullable<z.ZodString>;
129
- kind: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
130
- base: "base";
131
- dev: "dev";
132
- }>>>;
133
- builtAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
134
- builtBehind: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
82
+ builtBehind: z.ZodNullable<z.ZodNumber>;
135
83
  }, z.core.$strip>>;
136
84
  keptUntil: z.ZodNullable<z.ZodString>;
137
- save: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
138
- kind: z.ZodLiteral<"saved">;
139
- snapshotId: z.ZodString;
140
- base: z.ZodString;
141
- branch: z.ZodNullable<z.ZodString>;
142
- head: z.ZodString;
143
- ms: z.ZodNumber;
144
- sizeBytes: z.ZodNumber;
145
- entryWritten: z.ZodBoolean;
146
- }, z.core.$strip>, z.ZodObject<{
147
- kind: z.ZodLiteral<"failed">;
148
- step: z.ZodEnum<{
149
- "save-snapshot": "save-snapshot";
150
- scrub: "scrub";
151
- }>;
152
- message: z.ZodString;
153
- }, z.core.$strip>, z.ZodObject<{
154
- kind: z.ZodLiteral<"stopped">;
155
- }, z.core.$strip>], "kind">>;
156
- uploadBytes: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
157
- noSaveReason: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
158
- "already-saved": "already-saved";
159
- ci: "ci";
160
- "command-failed": "command-failed";
161
- "keep-sandbox": "keep-sandbox";
162
- "no-save-flag": "no-save-flag";
163
- "not-trusted": "not-trusted";
164
- recipe: "recipe";
165
- }>>>;
85
+ uploadBytes: z.ZodNullable<z.ZodNumber>;
166
86
  }, z.core.$strip>], "kind">;
167
87
  /**
168
88
  * Where the command ran: on this machine (`unsandboxed`, with `--unsandboxed`), or in a runner sandbox (`runner`):
169
89
  * the control plane team and project it runs in, its region, runtime and vCPUs, and the run's base, HEAD's merge-base
170
90
  * with `baseRef`, all known as the run starts; then, once the run is over, the runner sandbox's name and the runner
171
91
  * snapshot it started from, each null when the run stopped before it, when the runner sandbox's timeout stops it, as an
172
- * ISO time, when the run kept it running (null when it stopped and deleted it), how saving it as a dev snapshot
173
- * ended (null when the run started no save), how many bytes of changes the run uploaded, and why a run whose command
174
- * ended on its own started no save (each null when unknown). A record written by an older storm can name a reused
175
- * runner snapshot of an older base.
92
+ * ISO time, when the run kept it running (null when it stopped and deleted it), and how many bytes of changes the run
93
+ * uploaded (null when the run stopped before the upload).
176
94
  */
177
95
  export type RunRecordWhere = Readonly<z.output<typeof whereSchema>>;
178
96
  declare const gitSchema: z.ZodObject<{
@@ -186,18 +104,19 @@ declare const gitSchema: z.ZodObject<{
186
104
  */
187
105
  export type RunRecordGit = Readonly<z.output<typeof gitSchema>>;
188
106
  /**
189
- * A `storm vitest` run's test plan: how many tests `vitest list` counted, in how many files, and each resource option
190
- * whose default is a function of the planned run, with its value and where that came from (`plan.ts`).
107
+ * A `storm vitest` or `storm playwright` run's test plan: how many test files it counted, how many tests in them when
108
+ * it counted those too, and each resource option whose default is a function of the planned run, with its value and
109
+ * where that came from (`plan.ts`).
191
110
  */
192
111
  export type RunRecordPlan = TestPlanFacts;
193
112
  declare const runRecordSchema: z.ZodObject<{
194
- version: z.ZodLiteral<4>;
113
+ version: z.ZodLiteral<5>;
195
114
  startedAt: z.ZodString;
196
115
  cwd: z.ZodString;
197
116
  configFile: z.ZodNullable<z.ZodString>;
198
117
  argv: z.ZodReadonly<z.ZodArray<z.ZodString>>;
199
118
  plan: z.ZodExactOptional<z.ZodObject<{
200
- tests: z.ZodNumber;
119
+ tests: z.ZodOptional<z.ZodNumber>;
201
120
  files: z.ZodNumber;
202
121
  options: z.ZodArray<z.ZodObject<{
203
122
  path: z.ZodString;
@@ -225,45 +144,10 @@ declare const runRecordSchema: z.ZodObject<{
225
144
  id: z.ZodString;
226
145
  base: z.ZodString;
227
146
  built: z.ZodBoolean;
228
- branch: z.ZodNullable<z.ZodString>;
229
- head: z.ZodNullable<z.ZodString>;
230
- kind: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
231
- base: "base";
232
- dev: "dev";
233
- }>>>;
234
- builtAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
235
- builtBehind: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
147
+ builtBehind: z.ZodNullable<z.ZodNumber>;
236
148
  }, z.core.$strip>>;
237
149
  keptUntil: z.ZodNullable<z.ZodString>;
238
- save: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
239
- kind: z.ZodLiteral<"saved">;
240
- snapshotId: z.ZodString;
241
- base: z.ZodString;
242
- branch: z.ZodNullable<z.ZodString>;
243
- head: z.ZodString;
244
- ms: z.ZodNumber;
245
- sizeBytes: z.ZodNumber;
246
- entryWritten: z.ZodBoolean;
247
- }, z.core.$strip>, z.ZodObject<{
248
- kind: z.ZodLiteral<"failed">;
249
- step: z.ZodEnum<{
250
- "save-snapshot": "save-snapshot";
251
- scrub: "scrub";
252
- }>;
253
- message: z.ZodString;
254
- }, z.core.$strip>, z.ZodObject<{
255
- kind: z.ZodLiteral<"stopped">;
256
- }, z.core.$strip>], "kind">>;
257
- uploadBytes: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
258
- noSaveReason: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
259
- "already-saved": "already-saved";
260
- ci: "ci";
261
- "command-failed": "command-failed";
262
- "keep-sandbox": "keep-sandbox";
263
- "no-save-flag": "no-save-flag";
264
- "not-trusted": "not-trusted";
265
- recipe: "recipe";
266
- }>>>;
150
+ uploadBytes: z.ZodNullable<z.ZodNumber>;
267
151
  }, z.core.$strip>], "kind">;
268
152
  git: z.ZodNullable<z.ZodObject<{
269
153
  branch: z.ZodNullable<z.ZodString>;
@@ -298,7 +182,7 @@ export type RunRecord = Readonly<Omit<z.output<typeof runRecordSchema>, "ended">
298
182
  }>;
299
183
  /** `run.json`'s text for `record`. */
300
184
  export declare function runRecordText(record: RunRecord): string;
301
- /** The run `text` records; undefined when there is no text, or it isn't a version 4 `run.json`. */
185
+ /** The run `text` records; undefined when there is no text, or it isn't a version 5 `run.json`. */
302
186
  export declare function parseRunRecord(text: string | undefined): RunRecord | undefined;
303
187
  /** The totals of `events`' final results; null without one. */
304
188
  export declare function testTotals(events: readonly TestEvent[]): RunTestTotals | null;
@@ -318,8 +202,7 @@ export declare function startedWhere(run: RunRequest): RunRecordWhere;
318
202
  /**
319
203
  * `where` once the run is over, from the runner's final state: for a sandboxed run, the runner sandbox the run started,
320
204
  * the runner snapshot it started from, which the run reused or built, when its timeout stops the runner sandbox it
321
- * kept running, and how saving it as a dev snapshot ended (`save`). Each is null when the run stopped before it,
322
- * kept no runner sandbox, or saved none.
205
+ * kept running. Each is null when the run stopped before it, or kept no runner sandbox.
323
206
  */
324
- export declare function endedWhere(where: RunRecordWhere, runner: RunState["runner"], save: RunnerSave | null): RunRecordWhere;
207
+ export declare function endedWhere(where: RunRecordWhere, runner: RunState["runner"]): RunRecordWhere;
325
208
  export {};
@@ -1,6 +1,6 @@
1
1
  // What a run records about itself in its run directory's `run.json`, which `storm runs` reads back: written as
2
2
  // the run directory opens, then replaced with how the run ended once it is over. The run directory gateway stores the
3
- // text; this file owns its shape, version 4, and what goes in it: where the command runs, as the run starts and
3
+ // text; this file owns its shape, version 5, and what goes in it: where the command runs, as the run starts and
4
4
  // once it is over, and how the run ended. Reading it back asks the resource definition set nothing: each resource
5
5
  // instance's facts read as recorded, beside its definition's name, and `runs show` lists the rows storm rendered for
6
6
  // them when the run ended, so a past run reads the same after a resource definition is renamed or its extension
@@ -27,56 +27,8 @@ const snapshotSchema = z.object({
27
27
  id: z.string(),
28
28
  base: z.string(),
29
29
  built: z.boolean(),
30
- branch: z.string().nullable(),
31
- head: z.string().nullable(),
32
- // A record written before these existed lacks them, and reads each as null.
33
- kind: z.enum(["base", "dev"]).nullable().default(null),
34
- builtAt: z.string().nullable().default(null),
35
- builtBehind: z.number().nullable().default(null),
30
+ builtBehind: z.number().nullable(),
36
31
  });
37
- /** Why a run whose command ended on its own started no save of a dev snapshot (`RunnerNoSaveReason`). */
38
- export const noSaveReasonSchema = z.enum([
39
- "no-save-flag",
40
- "recipe",
41
- "keep-sandbox",
42
- "ci",
43
- "not-trusted",
44
- "command-failed",
45
- "already-saved",
46
- ]);
47
- /**
48
- * How saving the runner sandbox as a dev snapshot ended, as a `ran` outcome and `run.json` report it.
49
- */
50
- export const saveSchema = z.discriminatedUnion("kind", [
51
- z.object({
52
- /** It saved the runner sandbox as a dev snapshot. */
53
- kind: z.literal("saved"),
54
- /** The runner snapshot it saved. */
55
- snapshotId: z.string(),
56
- /** The base it is of: the base of the runner snapshot the run started from, a full SHA. */
57
- base: z.string(),
58
- /** HEAD's local branch as the run started; null when HEAD was detached. */
59
- branch: z.string().nullable(),
60
- /** HEAD's commit as the run started, a full SHA, which the dev snapshot was built at. */
61
- head: z.string(),
62
- /** How long the save took, in milliseconds, from the scrub's start until the snapshot was saved. */
63
- ms: z.number(),
64
- /** The snapshot's size in bytes. */
65
- sizeBytes: z.number(),
66
- /** Whether the runner snapshot cache recorded it; a later run starts from it only when it did. */
67
- entryWritten: z.boolean(),
68
- }),
69
- z.object({
70
- /** It didn't save: the scrub or the save failed. */
71
- kind: z.literal("failed"),
72
- step: z.enum(["scrub", "save-snapshot"]),
73
- message: z.string(),
74
- }),
75
- z.object({
76
- /** It didn't save, or recorded nothing: a signal stopped it. */
77
- kind: z.literal("stopped"),
78
- }),
79
- ]);
80
32
  const whereSchema = z.discriminatedUnion("kind", [
81
33
  z.object({ kind: z.literal("unsandboxed") }),
82
34
  z.object({
@@ -91,15 +43,12 @@ const whereSchema = z.discriminatedUnion("kind", [
91
43
  sandbox: z.string().nullable(),
92
44
  snapshot: snapshotSchema.nullable(),
93
45
  keptUntil: z.string().nullable(),
94
- save: saveSchema.nullable(),
95
- // A record written before these existed lacks them, and reads each as null.
96
- uploadBytes: z.number().nullable().default(null),
97
- noSaveReason: noSaveReasonSchema.nullable().default(null),
46
+ uploadBytes: z.number().nullable(),
98
47
  }),
99
48
  ]);
100
49
  const gitSchema = z.object({ branch: z.string().nullable(), commit: z.string(), dirty: z.boolean() });
101
50
  const runRecordSchema = z.object({
102
- version: z.literal(4),
51
+ version: z.literal(5),
103
52
  startedAt: z.string(),
104
53
  cwd: z.string(),
105
54
  configFile: z.string().nullable(),
@@ -114,7 +63,7 @@ const runRecordSchema = z.object({
114
63
  export function runRecordText(record) {
115
64
  return JSON.stringify(record);
116
65
  }
117
- /** The run `text` records; undefined when there is no text, or it isn't a version 4 `run.json`. */
66
+ /** The run `text` records; undefined when there is no text, or it isn't a version 5 `run.json`. */
118
67
  export function parseRunRecord(text) {
119
68
  if (text === undefined)
120
69
  return undefined;
@@ -191,18 +140,15 @@ export function startedWhere(run) {
191
140
  sandbox: null,
192
141
  snapshot: null,
193
142
  keptUntil: null,
194
- save: null,
195
143
  uploadBytes: null,
196
- noSaveReason: null,
197
144
  };
198
145
  }
199
146
  /**
200
147
  * `where` once the run is over, from the runner's final state: for a sandboxed run, the runner sandbox the run started,
201
148
  * the runner snapshot it started from, which the run reused or built, when its timeout stops the runner sandbox it
202
- * kept running, and how saving it as a dev snapshot ended (`save`). Each is null when the run stopped before it,
203
- * kept no runner sandbox, or saved none.
149
+ * kept running. Each is null when the run stopped before it, or kept no runner sandbox.
204
150
  */
205
- export function endedWhere(where, runner, save) {
151
+ export function endedWhere(where, runner) {
206
152
  if (where.kind === "unsandboxed")
207
153
  return where;
208
154
  const snapshot = runner?.snapshot;
@@ -215,15 +161,9 @@ export function endedWhere(where, runner, save) {
215
161
  id: snapshot.id,
216
162
  base: snapshot.base,
217
163
  built: snapshot.kind === "built",
218
- branch: snapshot.branch,
219
- head: snapshot.head,
220
- kind: snapshot.snapshot.kind,
221
- builtAt: snapshot.snapshot.builtAt,
222
- builtBehind: snapshot.snapshot.builtBehind,
164
+ builtBehind: snapshot.builtBehind,
223
165
  },
224
166
  keptUntil: runner?.kept?.stopsAt ?? null,
225
- save,
226
167
  uploadBytes: runner?.uploadBytes ?? null,
227
- noSaveReason: runner?.noSave ?? null,
228
168
  };
229
169
  }