@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
@@ -3,39 +3,34 @@ import {
3
3
  } from "../../../chunks/chunk-T6AZIDZD.js";
4
4
  import {
5
5
  RUN_CLEANUP,
6
- headText,
7
6
  lineProgress,
8
7
  notDeletedText,
9
8
  notStoppedText,
10
9
  prepareRefusal,
11
- progressLine,
12
10
  runErrors,
13
- runSaveDefault,
14
11
  runnerFailureFacts
15
- } from "../../../chunks/chunk-U7M3ZB3Z.js";
12
+ } from "../../../chunks/chunk-YBPTMJUM.js";
16
13
  import "../../../chunks/chunk-I5GZLOLQ.js";
17
14
  import {
18
15
  redactStrings,
19
16
  redactor
20
- } from "../../../chunks/chunk-FK4RLDEK.js";
21
- import "../../../chunks/chunk-Y3BUNNRG.js";
22
- import {
23
- noSaveText
24
- } from "../../../chunks/chunk-4XT5RC5T.js";
17
+ } from "../../../chunks/chunk-27P2QSIM.js";
18
+ import "../../../chunks/chunk-BFLYGMG3.js";
19
+ import "../../../chunks/chunk-XPCUINWS.js";
25
20
  import {
26
21
  RESOURCES
27
- } from "../../../chunks/chunk-ISGQJIQM.js";
28
- import "../../../chunks/chunk-IYM44FUX.js";
29
- import "../../../chunks/chunk-LQKNI3EG.js";
22
+ } from "../../../chunks/chunk-Z5OXOZD3.js";
23
+ import "../../../chunks/chunk-UC6DULWY.js";
24
+ import "../../../chunks/chunk-BRUIATTR.js";
30
25
  import "../../../chunks/chunk-NMVODY3P.js";
31
- import "../../../chunks/chunk-TEEZL3GA.js";
26
+ import "../../../chunks/chunk-RKONDLPS.js";
32
27
  import {
33
28
  seconds,
34
29
  short
35
- } from "../../../chunks/chunk-TMQQYHUX.js";
30
+ } from "../../../chunks/chunk-QBR5VHJ7.js";
36
31
  import {
37
32
  megabytesText
38
- } from "../../../chunks/chunk-FSP3SJ35.js";
33
+ } from "../../../chunks/chunk-5TMHYH7G.js";
39
34
  import {
40
35
  RUNNER_SECRET_MIN_LENGTH,
41
36
  buildSnapshots,
@@ -46,10 +41,9 @@ import {
46
41
  loadSettingsFile,
47
42
  prepareSnapshotBuild,
48
43
  readRunnerSecrets,
49
- recipeRun,
50
44
  requireTarget
51
- } from "../../../chunks/chunk-ODQHQJLE.js";
52
- import "../../../chunks/chunk-YT5OROR7.js";
45
+ } from "../../../chunks/chunk-5ED3IDUJ.js";
46
+ import "../../../chunks/chunk-RA4L2ACU.js";
53
47
  import "../../../chunks/chunk-BW2ADH7U.js";
54
48
  import "../../../chunks/chunk-GQIL3AHY.js";
55
49
  import "../../../chunks/chunk-GSC6SRTW.js";
@@ -67,41 +61,16 @@ import { z as z2 } from "zod";
67
61
  import { z } from "zod";
68
62
  var snapshotSchema = z.object({
69
63
  snapshotId: z.string(),
70
- /** A base snapshot, built from a base, or a dev snapshot, saved from a runner sandbox. */
71
- kind: z.enum(["base", "dev"]),
72
- /** Its base, a full SHA. */
64
+ /** Its base, the commit it was built at, a full SHA. */
73
65
  base: z.string(),
74
- /** The commit it was built at: a base snapshot's base, or the commit that saved a dev snapshot. */
75
- builtAt: z.string(),
76
- /** For a dev snapshot, the branch of the run that saved it; null for a base snapshot and a detached HEAD. */
77
- branch: z.string().nullable(),
78
66
  /** When it expires, as an ISO time. */
79
67
  expiresAt: z.string()
80
68
  });
81
- var baseSnapshotSchema = snapshotSchema.extend({ cached: z.boolean() }).nullable();
82
- function baseSnapshotOf(baseSnapshot) {
83
- return baseSnapshot === null ? null : { ...snapshotOf(baseSnapshot.entry), cached: baseSnapshot.cached };
84
- }
85
- function builtRows(baseSnapshot, named) {
86
- if (baseSnapshot === null || baseSnapshot.snapshotId === named?.snapshotId) return [];
87
- return [["Built", `${snapshotText(baseSnapshot)}${baseSnapshot.cached ? "" : ", not in the cache"}`]];
88
- }
89
69
  function snapshotOf(entry) {
90
- return {
91
- snapshotId: entry.snapshotId,
92
- kind: entry.head === void 0 ? "base" : "dev",
93
- base: entry.base,
94
- builtAt: entry.head ?? entry.base,
95
- branch: entry.branch ?? null,
96
- expiresAt: entry.expiresAt
97
- };
70
+ return { snapshotId: entry.snapshotId, base: entry.base, expiresAt: entry.expiresAt };
98
71
  }
99
- var noDevSnapshotReasonSchema = z.enum(["not-trusted", "reuse-off", "base-only"]);
100
- function baseChecksOf(warnings) {
101
- return {
102
- uncommitted: warnings === null ? null : warnings.some(({ kind }) => kind === "uncommitted"),
103
- onBaseRef: warnings === null ? null : !warnings.some(({ kind }) => kind === "not-on-base-ref")
104
- };
72
+ function snapshotText({ snapshotId, base }) {
73
+ return `base snapshot ${snapshotId} at ${short(base)}`;
105
74
  }
106
75
  var whereFields = {
107
76
  /** The config file that gave the runner recipe. */
@@ -115,70 +84,29 @@ var whereFields = {
115
84
  /** What it built at: HEAD's merge-base with `baseRef`, or with --base the commit the ref names, a full SHA. */
116
85
  base: z.string(),
117
86
  baseRef: z.string(),
118
- /** Why it saved no dev snapshot; null when it saved one, or the checkout's dev snapshot is up to date. */
119
- noDevSnapshotReason: noDevSnapshotReasonSchema.nullable(),
120
87
  /** With --base, whether the working tree had uncommitted changes, which a base snapshot doesn't hold; else null. */
121
88
  uncommitted: z.boolean().nullable(),
122
89
  /**
123
- * With --base, whether one of the recipe's baseRefs holds the commit in its history; else null. When none does, a
124
- * rewrite of the commit makes the snapshot unusable.
90
+ * With --base, whether the commit is HEAD's merge-base with a base ref; else null. A run here starts only from a
91
+ * snapshot at its merge-base.
125
92
  */
126
- onBaseRef: z.boolean().nullable()
93
+ atMergeBase: z.boolean().nullable()
127
94
  };
128
- var savedAgainstRunDefaultSchema = z.enum(["recipe", "ci"]);
129
- var droppedSchema = z.object({ snapshotIds: z.array(z.string()), failures: z.array(z.string()) });
130
95
  var builtSchema = z.object({
131
96
  ...whereFields,
132
- /** The base snapshot it built, and whether the cache holds it; null when it built none. */
133
- baseSnapshot: baseSnapshotSchema,
134
- /** The snapshot the runner sandbox started from; null when it started none. */
135
- startedFrom: snapshotSchema.nullable(),
136
- /** The dev snapshot it saved at HEAD's commit, how long the save took and its size; null when it saved none. */
137
- devSnapshot: snapshotSchema.extend({ ms: z.number(), sizeBytes: z.number() }).nullable(),
138
- /** What --full dropped from the cache: the dev snapshots built on the base snapshot it replaced, and what failed. */
139
- dropped: droppedSchema,
140
- /**
141
- * Why a run here that gives no flag would save no dev snapshot, when this build saved one: the recipe sets
142
- * `saveDevSnapshot: false` (`recipe`), or `CI` is set (`ci`), each a run's `noSaveReason`. Both are defaults for
143
- * runs, and this command is not a run. Null when it saved none, or when such a run would save one too.
144
- */
145
- savedAgainstRunDefault: savedAgainstRunDefaultSchema.nullable(),
97
+ /** The base snapshot it built and cached. */
98
+ snapshot: snapshotSchema,
99
+ /** How long the build took, and the snapshot's size. */
100
+ ms: z.number(),
101
+ sizeBytes: z.number(),
146
102
  /** What the build couldn't clean up. */
147
103
  cleanup: RUN_CLEANUP.schema
148
104
  });
149
105
  var upToDateSchema = z.object({
150
106
  ...whereFields,
151
- /** The snapshot the next run here starts from, or with --base the base snapshot the cache holds at that commit. */
107
+ /** The base snapshot the cache holds at that commit for the team and project. */
152
108
  snapshot: snapshotSchema
153
109
  });
154
- var NO_DEV_SNAPSHOT_TEXT = {
155
- "not-trusted": "the runner recipe doesn't trust dev snapshots (trustDevSnapshots)",
156
- "reuse-off": "the runner recipe reuses no dev snapshot (reuseDevSnapshot: false)",
157
- "base-only": "--base builds only a base snapshot"
158
- };
159
- function noDevSnapshotFact(devSnapshots) {
160
- if (devSnapshots === null) return "base-only";
161
- return devSnapshots === "reuse" ? null : devSnapshots;
162
- }
163
- function snapshotText({ kind, snapshotId, builtAt }) {
164
- return `${kind} snapshot ${snapshotId} at ${short(builtAt)}`;
165
- }
166
- function droppedOf(dropped) {
167
- return dropped === null ? null : { snapshotIds: [...dropped.snapshotIds], failures: dropped.failures.map(({ message }) => message) };
168
- }
169
- function droppedRows(full, dropped) {
170
- if (dropped === null)
171
- return full ? [
172
- [
173
- "Dropped",
174
- "nothing: the new base snapshot isn't cached, so the one it replaces and its dev snapshots stay usable"
175
- ]
176
- ] : [];
177
- return [
178
- ...dropped.snapshotIds.length === 0 ? [] : [["Dropped", dropped.snapshotIds.join(", ")]],
179
- ...dropped.failures.length === 0 ? [] : [["Not dropped", dropped.failures]]
180
- ];
181
- }
182
110
  function warningsOf(facts) {
183
111
  return [
184
112
  ...facts.uncommitted === true ? [
@@ -187,10 +115,10 @@ function warningsOf(facts) {
187
115
  message: "The working tree has uncommitted changes: a base snapshot holds only the commit's tracked files."
188
116
  }
189
117
  ] : [],
190
- ...facts.onBaseRef === false ? [
118
+ ...facts.atMergeBase === false ? [
191
119
  {
192
- reason: "commit_not_on_base_ref",
193
- message: `${facts.baseRef}'s commit is in the history of none of the runner recipe's baseRefs: a rewrite of it makes the snapshot unusable.`
120
+ reason: "commit_not_merge_base",
121
+ message: `${facts.baseRef}'s commit is not HEAD's merge-base, so a run here doesn't start from the snapshot: a run starts only from a snapshot at its merge-base.`
194
122
  }
195
123
  ] : []
196
124
  ];
@@ -199,43 +127,24 @@ var outcomes = defineOutcomes({
199
127
  results: {
200
128
  built: {
201
129
  schema: builtSchema,
202
- description: "It built what the cache lacked: a base snapshot, a dev snapshot at HEAD's commit, or both; with --base, a base snapshot at that commit. savedAgainstRunDefault says when it saved a dev snapshot that a run here with no flag would not save, because the recipe sets saveDevSnapshot: false or CI is set.",
130
+ description: "It built a base snapshot that the cache lacked, at the merge-base or, with --base, at the commit the ref names, and cached it.",
203
131
  render: (built) => {
204
- const next = built.devSnapshot ?? built.baseSnapshot;
205
- const rows = [
206
- ["Recipe", built.recipe],
207
- ...builtRows(built.baseSnapshot, next),
208
- ...built.startedFrom === null || built.startedFrom.snapshotId === built.baseSnapshot?.snapshotId ? [] : [["Started from", snapshotText(built.startedFrom)]],
209
- ...built.devSnapshot === null ? [] : [
210
- [
211
- "Saved",
212
- `${snapshotText(built.devSnapshot)} in ${seconds(built.devSnapshot.ms)} (${megabytesText(built.devSnapshot.sizeBytes)})`
213
- ]
214
- ],
215
- ...built.dropped.snapshotIds.length === 0 ? [] : [["Dropped", built.dropped.snapshotIds.join(", ")]],
216
- ...RUN_CLEANUP.rows(built.cleanup)
217
- ];
218
- const message = built.noDevSnapshotReason === "base-only" || next === null ? `Built ${next === null ? "nothing" : snapshotText(next)}.` : `The next run here starts from ${snapshotText(next)}.${built.noDevSnapshotReason === null ? "" : ` It saved no dev snapshot: ${NO_DEV_SNAPSHOT_TEXT[built.noDevSnapshotReason]}.`}${built.savedAgainstRunDefault === null ? "" : ` It saved a dev snapshot although ${noSaveText(built.savedAgainstRunDefault)}: that is a default for runs, and this command is not a run.`}`;
219
- const warnings = [
220
- ...warningsOf(built),
221
- ...built.dropped.failures.map((failure) => ({
222
- reason: "dev_snapshot_not_dropped",
223
- message: `Couldn't drop a dev snapshot built on the replaced base snapshot from the cache: ${failure}. A later run may start from it.`
224
- }))
225
- ];
226
- return renderOutcome({ rows, message, ...warnings.length === 0 ? {} : { warnings } });
132
+ const warnings = warningsOf(built);
133
+ return renderOutcome({
134
+ rows: [["Recipe", built.recipe], ...RUN_CLEANUP.rows(built.cleanup)],
135
+ message: `Built ${snapshotText(built.snapshot)} in ${seconds(built.ms)} (${megabytesText(built.sizeBytes)}).`,
136
+ ...warnings.length === 0 ? {} : { warnings }
137
+ });
227
138
  }
228
139
  },
229
140
  upToDate: {
230
141
  schema: upToDateSchema,
231
- description: "Nothing to build, so nothing started: the next run here starts from a dev snapshot built at HEAD's commit with a clean working tree, or, for a recipe that saves no dev snapshot, from a base snapshot that fits; with --base, the cache holds a base snapshot at that commit.",
142
+ description: "Nothing to build, so nothing started: the cache holds a base snapshot at the commit, the merge-base or the one --base names, for the team and project.",
232
143
  render: (facts) => {
233
- const { snapshot } = facts;
234
- const message = facts.noDevSnapshotReason === "base-only" ? `The cache holds ${snapshotText(snapshot)} for this team and project. --full builds a new one.` : `Up to date: the next run here starts from ${snapshotText(snapshot)}.${facts.noDevSnapshotReason === null ? "" : ` It saves no dev snapshot: ${NO_DEV_SNAPSHOT_TEXT[facts.noDevSnapshotReason]}.`}`;
235
144
  const warnings = warningsOf(facts);
236
145
  return renderOutcome({
237
146
  rows: [["Recipe", facts.recipe]],
238
- message,
147
+ message: `The cache holds ${snapshotText(facts.snapshot)} for this team and project. --full builds a new one.`,
239
148
  ...warnings.length === 0 ? {} : { warnings }
240
149
  });
241
150
  }
@@ -251,7 +160,6 @@ var outcomes = defineOutcomes({
251
160
  mintFailed: credentialSourceErrors.mintFailed,
252
161
  tokenRequestFailed: credentialSourceErrors.tokenRequestFailed,
253
162
  runnerFailed: runErrors.runnerFailed,
254
- snapshotGone: runErrors.snapshotGone,
255
163
  refNotFound: {
256
164
  exitCode: 1,
257
165
  description: "--base names no commit in this clone: storm resolves it from local refs only, and never fetches.",
@@ -264,34 +172,9 @@ var outcomes = defineOutcomes({
264
172
  next: [{ type: "text", text: `Fetch the ref, such as git fetch origin, then run again.` }]
265
173
  })
266
174
  },
267
- devSnapshotNotSaved: {
268
- exitCode: 1,
269
- description: "It readied a runner sandbox for this checkout but couldn't save it as a dev snapshot: the scrub or the save failed. baseSnapshot names the base snapshot it built first, if any, and whether the cache holds it.",
270
- schema: z.object({
271
- /** What failed, the scrub or the save, with what it said. */
272
- step: z.enum(["scrub", "save-snapshot"]),
273
- message: z.string(),
274
- /** The base snapshot it built first, and whether the cache holds it; null when it built none. */
275
- baseSnapshot: baseSnapshotSchema,
276
- cleanup: RUN_CLEANUP.schema
277
- }),
278
- render: ({
279
- step,
280
- message,
281
- baseSnapshot,
282
- cleanup
283
- }) => {
284
- const rows = [...builtRows(baseSnapshot, null), ...RUN_CLEANUP.rows(cleanup)];
285
- return {
286
- message: `Couldn't save the dev snapshot: the ${step === "scrub" ? "scrub" : "save"} failed: ${message}`,
287
- ...rows.length === 0 ? {} : { rows },
288
- next: [{ type: "text", text: "Run storm snapshots build again." }]
289
- };
290
- }
291
- },
292
175
  snapshotNotCached: {
293
176
  exitCode: 1,
294
- description: "It saved the snapshot the build ends with, the dev snapshot or, with --base or a recipe that saves no dev snapshot, the base snapshot, but couldn't write its cache entry, so no run finds it.",
177
+ description: "It built and saved the base snapshot, but couldn't write its cache entry, so no run finds it.",
295
178
  schema: z.object({
296
179
  /** The snapshot it saved, whose cache entry it couldn't write. */
297
180
  snapshot: snapshotSchema,
@@ -299,29 +182,11 @@ var outcomes = defineOutcomes({
299
182
  path: z.string(),
300
183
  /** What the operating system said. */
301
184
  message: z.string(),
302
- /**
303
- * The base snapshot it built, and whether the cache holds it; null when it built none. With --base or a recipe
304
- * that saves no dev snapshot, it is `snapshot`, not cached.
305
- */
306
- baseSnapshot: baseSnapshotSchema,
307
- /** Whether --full was given: build without the cache, and drop the dev snapshots on the base snapshot it replaces. */
308
- full: z.boolean(),
309
- /**
310
- * What --full dropped from the cache: the dev snapshots built on the base snapshot it replaced, and what failed;
311
- * null when it dropped nothing: without --full, or when the new base snapshot isn't cached, so the one it
312
- * replaces and its dev snapshots stay usable.
313
- */
314
- dropped: droppedSchema.nullable(),
315
185
  cleanup: RUN_CLEANUP.schema
316
186
  }),
317
187
  render: (facts) => ({
318
188
  message: `Saved ${snapshotText(facts.snapshot)}, but couldn't write its cache entry: ${facts.message}`,
319
- rows: [
320
- ["Path", facts.path],
321
- ...builtRows(facts.baseSnapshot, facts.snapshot),
322
- ...droppedRows(facts.full, facts.dropped),
323
- ...RUN_CLEANUP.rows(facts.cleanup)
324
- ],
189
+ rows: [["Path", facts.path], ...RUN_CLEANUP.rows(facts.cleanup)],
325
190
  next: [
326
191
  {
327
192
  type: "text",
@@ -367,18 +232,18 @@ var command_default = stormCommands.define({
367
232
  configFile
368
233
  });
369
234
  const redact = redactor(Object.values(secrets.values));
370
- const mode = request.base === void 0 ? { kind: "checkout", full: request.full } : { kind: "base", ref: request.base, full: request.full };
371
235
  const prepared = await prepareSnapshotBuild(app.context, {
372
236
  cwd: app.cwd,
373
237
  recipe,
374
- vcpusRun: recipeRun({}),
375
- mode
238
+ ref: request.base,
239
+ full: request.full
376
240
  });
377
241
  if (prepared.kind === "ref-not-found") return outcomes.refNotFound({ ref: prepared.ref });
378
242
  if (prepared.kind !== "ok") return redactStrings(prepareRefusal(prepared, configFile), redact);
379
243
  const { build } = prepared;
380
244
  const progress = buildProgress(app, ui.progress, (line) => redactStrings(line, redact));
381
- if (build.kind === "checkout") await progress.prepared(build.prepared);
245
+ if (build.ref === null && build.mergeBase !== null)
246
+ await progress.prepared({ base: build.mergeBase.commit, baseRef: build.mergeBase.ref });
382
247
  if (signal.aborted) return outcomes.canceled({ changed: "Nothing was built.\nNothing was minted or started." });
383
248
  const got = await chosen.source.obtain();
384
249
  if (!got.ok) return got.refusal;
@@ -396,40 +261,26 @@ var command_default = stormCommands.define({
396
261
  );
397
262
  const outcome = redactStrings(ended, redact);
398
263
  const cleanup = RUN_CLEANUP.facts({ runnerCleanup: { ...outcome.cleanup, target }, resourceCleanup: {} });
399
- const head = build.kind === "checkout" ? build.prepared.head.commit : build.head.commit;
400
264
  const where = {
401
265
  configFile,
402
266
  recipe: recipe.name,
403
267
  team: target.team,
404
268
  project: target.project,
405
- head,
406
- base: build.kind === "checkout" ? build.prepared.base : build.plan.base,
407
- baseRef: build.kind === "checkout" ? build.prepared.baseRef : build.ref,
408
- noDevSnapshotReason: noDevSnapshotFact(build.kind === "checkout" ? build.prepared.devSnapshots : null),
409
- ...baseChecksOf(build.kind === "base" ? build.warnings : null)
269
+ head: build.head.commit,
270
+ base: build.plan.base,
271
+ baseRef: build.ref ?? build.mergeBase?.ref ?? build.plan.base,
272
+ // What a --base build checked of its commit, for its warnings; null for a build at the merge-base.
273
+ ...build.ref === null ? { uncommitted: null, atMergeBase: null } : { uncommitted: build.head.dirty, atMergeBase: build.atMergeBase }
410
274
  };
411
275
  switch (outcome.kind) {
412
276
  case "up-to-date":
413
277
  return outcomes.upToDate({ ...where, snapshot: snapshotOf(outcome.snapshot) });
414
- case "built": {
415
- const { devSnapshot } = outcome;
416
- const runDefault = runSaveDefault(recipe, app.env);
417
- const savedAgainstRunDefault = devSnapshot !== null && runDefault.kind === "never" && (runDefault.reason === "recipe" || runDefault.reason === "ci") ? runDefault.reason : null;
278
+ case "built":
418
279
  return outcomes.built({
419
280
  ...where,
420
- baseSnapshot: baseSnapshotOf(outcome.baseSnapshot),
421
- startedFrom: outcome.startedFrom === null ? null : snapshotOf(outcome.startedFrom),
422
- devSnapshot: devSnapshot === null ? null : { ...snapshotOf(devSnapshot.entry), ms: devSnapshot.ms, sizeBytes: devSnapshot.sizeBytes },
423
- dropped: droppedOf(outcome.dropped) ?? { snapshotIds: [], failures: [] },
424
- savedAgainstRunDefault,
425
- cleanup
426
- });
427
- }
428
- case "dev-snapshot-not-saved":
429
- return outcomes.devSnapshotNotSaved({
430
- step: outcome.step,
431
- message: outcome.message,
432
- baseSnapshot: baseSnapshotOf(outcome.baseSnapshot),
281
+ snapshot: snapshotOf(outcome.snapshot),
282
+ ms: outcome.ms,
283
+ sizeBytes: outcome.sizeBytes,
433
284
  cleanup
434
285
  });
435
286
  case "not-cached":
@@ -437,16 +288,6 @@ var command_default = stormCommands.define({
437
288
  snapshot: snapshotOf(outcome.snapshot),
438
289
  path: outcome.failure.path,
439
290
  message: outcome.failure.message,
440
- baseSnapshot: baseSnapshotOf(outcome.baseSnapshot),
441
- full: build.full,
442
- dropped: droppedOf(outcome.dropped),
443
- cleanup
444
- });
445
- case "snapshot-gone":
446
- return runErrors.snapshotGone({
447
- snapshotId: outcome.entry.snapshotId,
448
- base: outcome.entry.base,
449
- removal: outcome.removal === void 0 ? null : { ...outcome.removal },
450
291
  cleanup
451
292
  });
452
293
  case "failed":
@@ -457,17 +298,13 @@ var command_default = stormCommands.define({
457
298
  }
458
299
  });
459
300
  function abortedChanges(outcome, runner) {
460
- const { baseSnapshot, dropped } = outcome;
301
+ const { snapshot } = outcome;
461
302
  const problems = runner === null ? [] : [...runner.notStopped.map(notStoppedText), ...runner.notDeleted.map(notDeletedText)];
462
303
  return [
463
304
  "The build stopped.",
464
- ...baseSnapshot === null ? [] : [
465
- baseSnapshot.cached ? `It saved and cached ${snapshotText(snapshotOf(baseSnapshot.entry))} first.` : `It saved ${snapshotText(snapshotOf(baseSnapshot.entry))} first, but couldn't write its cache entry, so no run finds it.`
305
+ ...snapshot === null ? [] : [
306
+ snapshot.cached ? `It saved and cached ${snapshotText(snapshotOf(snapshot.entry))} first.` : `It saved ${snapshotText(snapshotOf(snapshot.entry))} first, but couldn't write its cache entry, so no run finds it.`
466
307
  ],
467
- ...dropped === null || dropped.snapshotIds.length === 0 ? [] : [`It dropped the dev snapshots built on the base snapshot it replaced: ${dropped.snapshotIds.join(", ")}.`],
468
- ...(dropped?.failures ?? []).map(
469
- ({ message }) => `Couldn't drop a dev snapshot built on the replaced base snapshot from the cache: ${message}. A later run may start from it.`
470
- ),
471
308
  ...problems.length === 0 ? ["Every sandbox it started is stopped and deleted."] : problems
472
309
  ].join("\n");
473
310
  }
@@ -475,13 +312,9 @@ function buildProgress(app, progress, redact) {
475
312
  if (progress === void 0) return { emit: async () => {
476
313
  }, prepared: async () => {
477
314
  } };
478
- const write = (line) => progress(redact(line));
479
- const observer = lineProgress(write, { github: app.presentation.github === true });
480
- let origin;
315
+ const observer = lineProgress((line) => progress(redact(line)), { github: app.presentation.github === true });
481
316
  const observe = async (event) => {
482
- const at = app.context.clock.now();
483
- origin ??= at.getTime();
484
- await observer.observe({ event, at });
317
+ await observer.observe({ event, at: app.context.clock.now() });
485
318
  };
486
319
  return {
487
320
  prepared: async (prepared) => {
@@ -489,19 +322,11 @@ function buildProgress(app, progress, redact) {
489
322
  kind: "runner-prepared",
490
323
  base: prepared.base,
491
324
  baseRef: prepared.baseRef,
492
- nestedRepositories: prepared.upload.nestedRepositories,
493
- notes: prepared.notes
325
+ nestedRepositories: [],
326
+ notes: []
494
327
  });
495
328
  },
496
329
  emit: async (event) => {
497
- if (event.kind === "dev-snapshot-saving") {
498
- const at = app.context.clock.now();
499
- origin ??= at.getTime();
500
- await write(
501
- progressLine(at.getTime() - origin, "cleanup", `saving a dev snapshot of ${headText(event.branch)}\u2026`)
502
- );
503
- return;
504
- }
505
330
  await observe({ kind: "runner", event });
506
331
  }
507
332
  };
@@ -1,16 +1,16 @@
1
1
  // src/commands/snapshots/build/metadata.ts
2
2
  var metadata = {
3
- description: "Build what the runner snapshot cache on this machine lacks for this checkout, with no test run: it acquires no resource, runs no command, and writes no run directory. It mints a credential as a run does, and prints the runner's progress lines and step output as a run does when stderr isn't a terminal. With no flag it prepares the next run: it picks a runner snapshot as a run does and builds a base snapshot at the merge-base when none fits; a dev snapshot built at HEAD's commit, with a clean working tree, is up to date and starts nothing; otherwise it starts a runner sandbox from the pick, uploads and applies this checkout's changes, runs the recipe's install and build, and saves the sandbox as a dev snapshot at HEAD's commit. This command is not a run, so no run default applies to it: the recipe's saveDevSnapshot, CI, and the keep time do not change what it saves. When it saves a dev snapshot although a run here saves none by default, it says so. Two recipe keys do change what it saves, because no run would start from its dev snapshot: a recipe whose install or build step names a runner secret and that doesn't set trustDevSnapshots, or that sets reuseDevSnapshot: false, gets no dev snapshot, only a base snapshot when none fits. Every sandbox it starts is stopped and deleted, however it ends.",
4
- summary: "Build the runner snapshots this checkout lacks.",
3
+ description: "Build one base snapshot that the runner snapshot cache on this machine lacks, with no test run: it acquires no resource, runs no command, and writes no run directory. It mints a credential as a run does, and prints the runner's progress lines and step output as a run does when stderr isn't a terminal. With no flag it builds at HEAD's merge-base with a base ref, which a run builds by itself when the cache has nothing that fits. With --base <ref> it builds at the commit the ref names, such as a base ref commit that later branches will start from. A run starts only from a snapshot at its merge-base, so a snapshot of any other commit is unused until a run's merge-base is that commit. When the cache holds a base snapshot at the commit for the team and project with more than an hour left, it starts nothing, unless --full. Every sandbox it starts is stopped and deleted, however it ends.",
4
+ summary: "Build a base snapshot the runner snapshot cache lacks.",
5
5
  help: {
6
6
  usages: ["[--full] [--base <REF>] [--scope <TEAM> --project <PROJECT>]"],
7
7
  fields: {
8
8
  full: {
9
- description: "Use nothing from the cache: build a new base snapshot at the merge-base, or at --base's commit, which replaces the cache entry of a base snapshot there, then, without --base, the working tree on top. It removes the cache entries of every dev snapshot built on the base snapshot it replaced, from any checkout, and says which; the snapshots are left to expire."
9
+ description: "Build a new base snapshot at the commit whatever the cache holds, which replaces the cache entry of the base snapshot there."
10
10
  },
11
11
  base: {
12
12
  valueLabel: "REF",
13
- description: "Build only a base snapshot, at the commit this ref names, resolved from local refs (storm never fetches), and no dev snapshot. When the cache holds one there for the team and project with more than an hour left, it starts nothing, unless --full. The commit need not be in HEAD's history; it warns when the working tree has uncommitted changes, which a base snapshot doesn't hold, and when the commit is in the history of none of the recipe's baseRefs, since a rewrite of it makes the snapshot unusable."
13
+ description: "Build at the commit this ref names, resolved from local refs (storm never fetches), instead of at the merge-base. A run starts from the snapshot only when that commit is its merge-base. It warns when the working tree has uncommitted changes, which a base snapshot doesn't hold, and when the commit is not HEAD's merge-base, so a run here would not start from the snapshot."
14
14
  },
15
15
  scope: {
16
16
  valueLabel: "TEAM",
@@ -22,9 +22,12 @@ var metadata = {
22
22
  }
23
23
  },
24
24
  examples: [
25
- { argv: "", description: "Build what the next run here starts from, and save a dev snapshot at HEAD." },
26
- { argv: "--full", description: "Build a fresh base snapshot at the merge-base, and a dev snapshot on top." },
27
- { argv: "--base origin/main", description: "Build only a base snapshot at origin/main's commit." },
25
+ { argv: "", description: "Build a base snapshot at the merge-base, when the cache has none." },
26
+ {
27
+ argv: "--base origin/main",
28
+ description: "Build a base snapshot at origin/main's commit, which runs on branches from it start from."
29
+ },
30
+ { argv: "--full", description: "Build a fresh base snapshot at the merge-base." },
28
31
  { argv: "--json", description: "Build, then print what was built as JSON." }
29
32
  ]
30
33
  }