@cnc-tools/storm 0.6.0 → 0.8.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 (174) hide show
  1. package/dist/build-info.js +1 -1
  2. package/dist/commands/exec/cleanup.d.ts +3 -3
  3. package/dist/commands/exec/cleanup.js +1 -1
  4. package/dist/commands/exec/command.d.ts +797 -1
  5. package/dist/commands/exec/command.js +1 -1
  6. package/dist/commands/exec/live-view.js +32 -15
  7. package/dist/commands/exec/metadata.d.ts +5 -2
  8. package/dist/commands/exec/metadata.js +4 -0
  9. package/dist/commands/exec/mint-failed.d.ts +28 -0
  10. package/dist/commands/exec/outcomes.d.ts +526 -0
  11. package/dist/commands/exec/outcomes.js +9 -0
  12. package/dist/commands/exec/progress.d.ts +14 -2
  13. package/dist/commands/exec/progress.js +57 -14
  14. package/dist/commands/exec/run-command.d.ts +10 -4
  15. package/dist/commands/exec/run-command.js +41 -8
  16. package/dist/commands/exec/run-metadata.d.ts +6 -3
  17. package/dist/commands/exec/run-metadata.js +6 -3
  18. package/dist/commands/exec/run-record.d.ts +83 -4
  19. package/dist/commands/exec/run-record.js +49 -1
  20. package/dist/commands/exec/tests-summary.d.ts +1 -1
  21. package/dist/commands/exec/tests-summary.js +1 -1
  22. package/dist/commands/exec/view.js +36 -4
  23. package/dist/commands/runs/facts.d.ts +25 -0
  24. package/dist/commands/runs/facts.js +36 -3
  25. package/dist/commands/runs/list/command.d.ts +154 -1
  26. package/dist/commands/runs/list/command.js +1 -1
  27. package/dist/commands/runs/list/outcomes.d.ts +41 -0
  28. package/dist/commands/runs/logs/command.d.ts +263 -1
  29. package/dist/commands/runs/logs/command.js +1 -1
  30. package/dist/commands/runs/logs/outcomes.d.ts +105 -0
  31. package/dist/commands/runs/show/command.d.ts +354 -1
  32. package/dist/commands/runs/show/command.js +1 -1
  33. package/dist/commands/runs/show/metadata.js +1 -1
  34. package/dist/commands/runs/show/outcomes.d.ts +96 -0
  35. package/dist/commands/runs/show/outcomes.js +30 -1
  36. package/dist/commands/vitest/command.d.ts +912 -1
  37. package/dist/commands/vitest/command.js +1 -1
  38. package/dist/commands/vitest/metadata.d.ts +5 -2
  39. package/dist/commands/vitest/metadata.js +4 -0
  40. package/dist/commands/vitest/outcomes.d.ts +320 -0
  41. package/dist/config/errors.d.ts +73 -0
  42. package/dist/config/schema.d.ts +1 -1
  43. package/dist/config-file/define.d.ts +4 -3
  44. package/dist/config-file/define.js +1 -1
  45. package/dist/config-file/toolchain.js +1 -1
  46. package/dist/core/command-slots.d.ts +8 -2
  47. package/dist/core/command-slots.js +6 -2
  48. package/dist/core/events.d.ts +9 -7
  49. package/dist/core/index.d.ts +1 -1
  50. package/dist/core/run-state.d.ts +30 -6
  51. package/dist/core/run-state.js +19 -4
  52. package/dist/core/run.d.ts +17 -4
  53. package/dist/core/run.js +61 -25
  54. package/dist/credential/index.d.ts +1 -0
  55. package/dist/credential/index.js +1 -0
  56. package/dist/credential/settle.d.ts +20 -0
  57. package/dist/credential/target.d.ts +6 -0
  58. package/dist/credential/target.js +7 -0
  59. package/dist/resources/github/command.d.ts +54 -2
  60. package/dist/resources/github/config.js +1 -1
  61. package/dist/resources/github/index.js +1 -1
  62. package/dist/resources/github/resource.js +2 -2
  63. package/dist/resources/testserver/command.d.ts +208 -10
  64. package/dist/resources/testserver/command.js +7 -0
  65. package/dist/resources/testserver/commands/create/command.d.ts +808 -1
  66. package/dist/resources/testserver/commands/create/command.js +64 -23
  67. package/dist/resources/testserver/commands/create/metadata.js +6 -2
  68. package/dist/resources/testserver/commands/create/outcomes.d.ts +347 -0
  69. package/dist/resources/testserver/commands/create/outcomes.js +14 -1
  70. package/dist/resources/testserver/commands/list/command.d.ts +84 -1
  71. package/dist/resources/testserver/commands/list/command.js +1 -1
  72. package/dist/resources/testserver/commands/list/outcomes.d.ts +16 -0
  73. package/dist/resources/testserver/config.js +14 -4
  74. package/dist/resources/testserver/events.d.ts +9 -0
  75. package/dist/resources/testserver/index.js +8 -7
  76. package/dist/resources/testserver/lane.js +1 -0
  77. package/dist/resources/testserver/live/gateways.d.ts +2 -0
  78. package/dist/resources/testserver/live/gateways.js +16 -3
  79. package/dist/resources/testserver/pool/channels.d.ts +5 -2
  80. package/dist/resources/testserver/pool/channels.js +1 -1
  81. package/dist/resources/testserver/pool/create.d.ts +6 -2
  82. package/dist/resources/testserver/pool/create.js +6 -5
  83. package/dist/resources/testserver/pool/index.d.ts +1 -0
  84. package/dist/resources/testserver/pool/index.js +1 -0
  85. package/dist/resources/testserver/pool/pull-request.d.ts +89 -0
  86. package/dist/resources/testserver/pool/pull-request.js +85 -0
  87. package/dist/resources/testserver/pr-build-facts.d.ts +130 -0
  88. package/dist/resources/testserver/pr-build-facts.js +261 -0
  89. package/dist/resources/testserver/presentation.d.ts +2 -2
  90. package/dist/resources/testserver/presentation.js +12 -3
  91. package/dist/resources/testserver/provider.d.ts +16 -6
  92. package/dist/resources/testserver/provider.js +46 -15
  93. package/dist/resources/testserver/pull-request/gateways.d.ts +117 -0
  94. package/dist/resources/testserver/pull-request/gateways.js +5 -0
  95. package/dist/resources/testserver/pull-request/index.d.ts +5 -0
  96. package/dist/resources/testserver/pull-request/index.js +6 -0
  97. package/dist/resources/testserver/pull-request/live/github-rest.d.ts +28 -0
  98. package/dist/resources/testserver/pull-request/live/github-rest.js +114 -0
  99. package/dist/resources/testserver/pull-request/live/github-token-gateway.d.ts +12 -0
  100. package/dist/resources/testserver/pull-request/live/github-token-gateway.js +39 -0
  101. package/dist/resources/testserver/pull-request/live/pull-request-gateway.d.ts +10 -0
  102. package/dist/resources/testserver/pull-request/live/pull-request-gateway.js +27 -0
  103. package/dist/resources/testserver/pull-request/live/testserver-workflow-gateway.d.ts +21 -0
  104. package/dist/resources/testserver/pull-request/live/testserver-workflow-gateway.js +64 -0
  105. package/dist/resources/testserver/ran.d.ts +5 -0
  106. package/dist/resources/testserver/ran.js +19 -3
  107. package/dist/resources/testserver/resource.d.ts +5 -1
  108. package/dist/resources/testserver/resource.js +2 -2
  109. package/dist/resources/testserver/sandbox/build-reference.d.ts +38 -0
  110. package/dist/resources/testserver/sandbox/build-reference.js +79 -0
  111. package/dist/resources/testserver/sandbox/index.d.ts +1 -0
  112. package/dist/resources/testserver/sandbox/index.js +1 -0
  113. package/dist/resources.d.ts +265 -15
  114. package/dist/runner/events.d.ts +64 -1
  115. package/dist/runner/gateways.d.ts +17 -6
  116. package/dist/runner/index.d.ts +5 -4
  117. package/dist/runner/index.js +4 -3
  118. package/dist/runner/live/snapshot-records.js +18 -4
  119. package/dist/runner/prepare.d.ts +23 -4
  120. package/dist/runner/prepare.js +13 -3
  121. package/dist/runner/ready.d.ts +7 -3
  122. package/dist/runner/ready.js +11 -5
  123. package/dist/runner/scope.d.ts +17 -1
  124. package/dist/runner/scope.js +4 -0
  125. package/dist/runner/snapshot-build.d.ts +3 -1
  126. package/dist/runner/snapshot-build.js +12 -2
  127. package/dist/runner/snapshot-cache.d.ts +46 -8
  128. package/dist/runner/snapshot-cache.js +60 -11
  129. package/dist/runner/snapshot-key.d.ts +12 -1
  130. package/dist/runner/snapshot-key.js +17 -1
  131. package/dist/runner/snapshot-save.d.ts +53 -0
  132. package/dist/runner/snapshot-save.js +148 -0
  133. package/dist/sdk/index.js +2 -2
  134. package/dist/story/align.d.ts +1 -1
  135. package/dist/story/align.js +1 -1
  136. package/dist/story/command-line.d.ts +34 -0
  137. package/dist/story/command-line.js +100 -0
  138. package/dist/story/definition.d.ts +22 -15
  139. package/dist/story/definition.js +2 -2
  140. package/dist/story/errors.js +1 -1
  141. package/dist/story/gateways.d.ts +45 -25
  142. package/dist/story/gateways.js +2 -2
  143. package/dist/story/host.d.ts +11 -8
  144. package/dist/story/host.js +37 -37
  145. package/dist/story/index.d.ts +2 -1
  146. package/dist/story/index.js +6 -5
  147. package/dist/story/json.d.ts +1 -1
  148. package/dist/story/json.js +2 -2
  149. package/dist/story/live/recording-gateway.d.ts +2 -0
  150. package/dist/story/live/{artifact-gateway.js → recording-gateway.js} +33 -12
  151. package/dist/story/mode.d.ts +2 -2
  152. package/dist/story/mode.js +1 -1
  153. package/dist/story/orphans.d.ts +23 -5
  154. package/dist/story/orphans.js +44 -8
  155. package/dist/story/recording.d.ts +62 -0
  156. package/dist/story/{artifact.js → recording.js} +31 -27
  157. package/dist/story/report.d.ts +21 -9
  158. package/dist/story/report.js +37 -25
  159. package/dist/story/settle.d.ts +23 -21
  160. package/dist/story/settle.js +17 -16
  161. package/dist/story/{run.d.ts → start.d.ts} +18 -17
  162. package/dist/story/{run.js → start.js} +66 -43
  163. package/dist/vercel-cli/context.js +1 -1
  164. package/dist/vercel-cli/index.js +1 -1
  165. package/dist/vitest/config.js +2 -2
  166. package/dist/vitest/fixtures.d.ts +1 -1
  167. package/dist/vitest/fixtures.js +1 -1
  168. package/dist/vitest/index.js +3 -3
  169. package/dist/vitest/plan.js +1 -1
  170. package/package.json +3 -3
  171. package/skills/overview.md +2 -0
  172. package/skills/testserver-builds.md +80 -0
  173. package/dist/story/artifact.d.ts +0 -60
  174. package/dist/story/live/artifact-gateway.d.ts +0 -2
@@ -15,7 +15,7 @@ export function command(cmd) {
15
15
  return cmd.define({
16
16
  requestSchema: z.object({ ...RUN_REQUEST_FIELDS, args: z.array(z.string()).default([]) }),
17
17
  cli: { options: RUN_CLI_OPTIONS, positionals: ["args"] },
18
- outcomes,
18
+ response: outcomes,
19
19
  validate: runProblems,
20
20
  handler: async (context, request) => await runCommand(context, request, {
21
21
  name: "vitest",
@@ -5,7 +5,7 @@ export declare const metadata: {
5
5
  fields: {
6
6
  testserverBuild: {
7
7
  readonly valueLabel: "BUILD";
8
- readonly description: "The build the Testserver sandboxes run: a build name or the build channel stable or latest_main, overriding resources.testserverPool.build in storm.config.ts; default stable. Gives the run a Testserver side.";
8
+ readonly description: "The build the Testserver sandboxes run: a build name, the build channel stable or latest_main, or a vercel/api pull request as pr:<N> or its URL, overriding resources.testserverPool.build in storm.config.ts; default stable. A pull request runs on the newest build made from its head commit, which storm reads from GitHub with GITHUB_TOKEN, GH_TOKEN or gh auth token, or refuses. Gives the run a Testserver side.";
9
9
  };
10
10
  testserverMinTimeLeft: {
11
11
  readonly valueLabel: "DURATION";
@@ -30,7 +30,10 @@ export declare const metadata: {
30
30
  readonly description: "Run the command on this machine instead of in a runner sandbox. 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.";
31
31
  };
32
32
  rebuildSnapshot: {
33
- readonly description: "Build a runner snapshot of the base whatever the runner snapshot cache holds, replacing an entry for the same base. Not with --local. No config key.";
33
+ readonly description: "Build a runner snapshot of the base whatever the runner snapshot cache holds, replacing an entry for the same base, and drop this branch's saved branch snapshots from the cache. Not with --local. No config key.";
34
+ };
35
+ saveSnapshot: {
36
+ readonly description: "Once the command ends on its own after a successful install and build, save the runner sandbox as this branch's runner snapshot, so the next run on the branch starts from this run's install and build outputs. The run 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 with it on a branch keeps no runner sandbox, even when it fails or stops before the save. With a detached HEAD it says so as it starts and keeps the runner sandbox as without the flag. Not with --local, or with --keep-sandbox above 0. No config key.";
34
37
  };
35
38
  keepSandbox: {
36
39
  readonly valueLabel: "DURATION";
@@ -23,6 +23,10 @@ export const metadata = {
23
23
  argv: "test/api -- -t creates",
24
24
  description: "Run the tests named creates in the files under test/api.",
25
25
  },
26
+ {
27
+ argv: "--testserver-build pr:104196",
28
+ description: "Run every test against the Testserver build of vercel/api pull request 104196's head commit.",
29
+ },
26
30
  {
27
31
  argv: "--local --testserver-no-create",
28
32
  description: "Run on this machine, on Testserver sandboxes already in the pool, never minting.",
@@ -14,10 +14,35 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
14
14
  runner: z.ZodNullable<z.ZodObject<{
15
15
  snapshotId: z.ZodString;
16
16
  base: z.ZodString;
17
+ snapshotBranch: z.ZodNullable<z.ZodString>;
18
+ snapshotHead: z.ZodNullable<z.ZodString>;
17
19
  built: z.ZodBoolean;
18
20
  vcpus: z.ZodNumber;
19
21
  region: z.ZodString;
20
22
  runtime: z.ZodString;
23
+ buildMs: z.ZodNumber;
24
+ save: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
25
+ kind: z.ZodLiteral<"saved">;
26
+ snapshotId: z.ZodString;
27
+ base: z.ZodString;
28
+ branch: z.ZodString;
29
+ head: z.ZodString;
30
+ ms: z.ZodNumber;
31
+ sizeBytes: z.ZodNumber;
32
+ entryWritten: z.ZodBoolean;
33
+ }, z.core.$strip>, z.ZodObject<{
34
+ kind: z.ZodLiteral<"skipped">;
35
+ reason: z.ZodLiteral<"detached-head">;
36
+ }, z.core.$strip>, z.ZodObject<{
37
+ kind: z.ZodLiteral<"failed">;
38
+ step: z.ZodEnum<{
39
+ "save-snapshot": "save-snapshot";
40
+ scrub: "scrub";
41
+ }>;
42
+ message: z.ZodString;
43
+ }, z.core.$strip>, z.ZodObject<{
44
+ kind: z.ZodLiteral<"stopped">;
45
+ }, z.core.$strip>], "kind">>;
21
46
  }, z.core.$strip>>;
22
47
  timeline: z.ZodObject<{
23
48
  startedAt: z.ZodString;
@@ -215,6 +240,45 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
215
240
  } & {
216
241
  readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
217
242
  }]>;
243
+ prBuildExpired: import("@vercel/clinkr").SharedError<"pr_build_expired", [{
244
+ pr: number;
245
+ headSha: string;
246
+ build: string;
247
+ expiresAt: string;
248
+ } & {
249
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
250
+ }]>;
251
+ prBuildNotReady: import("@vercel/clinkr").SharedError<"pr_build_not_ready", [{
252
+ pr: number;
253
+ headSha: string;
254
+ newest: {
255
+ build: string;
256
+ headSha: string;
257
+ createdAt: string;
258
+ } | null;
259
+ } & {
260
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
261
+ }]>;
262
+ prBuildsUnlisted: import("@vercel/clinkr").SharedError<"pr_builds_unlisted", [{
263
+ pr: number;
264
+ failure: {
265
+ kind: "connect-failed" | "http-error" | "malformed" | "not-found" | "rejected" | "timeout";
266
+ status: number | null;
267
+ detail: string;
268
+ };
269
+ } & {
270
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
271
+ }]>;
272
+ pullRequestUnreadable: import("@vercel/clinkr").SharedError<"pull_request_unreadable", [{
273
+ pr: number;
274
+ repo: string;
275
+ kind: "connect-failed" | "http-error" | "malformed" | "no-token" | "not-found" | "rejected" | "timeout";
276
+ status: number | null;
277
+ message: string | null;
278
+ tokenOrigin: "GH_TOKEN" | "GITHUB_TOKEN" | "gh auth token" | null;
279
+ } & {
280
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
281
+ }]>;
218
282
  runnerFailed: import("@vercel/clinkr").SharedError<"runner_failed", [data: {
219
283
  failure: {
220
284
  kind: "apply-failed" | "build-failed" | "install-failed" | "snapshot-build-step-failed";
@@ -270,4 +334,260 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
270
334
  } & {
271
335
  readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
272
336
  }]>;
337
+ }, {
338
+ readonly noMatchingTests: {
339
+ readonly exitCode: 1;
340
+ readonly description: "vitest list found no test for the arguments given to vitest run, so nothing was minted, leased or started.";
341
+ readonly schema: z.ZodObject<{
342
+ args: z.ZodArray<z.ZodString>;
343
+ cwd: z.ZodString;
344
+ }, z.core.$strip>;
345
+ readonly render: ({ args, cwd }: {
346
+ args: string[];
347
+ cwd: string;
348
+ }) => {
349
+ message: string;
350
+ next: {
351
+ type: "text";
352
+ text: string;
353
+ }[];
354
+ };
355
+ };
356
+ readonly vitestListFailed: {
357
+ readonly exitCode: 1;
358
+ readonly description: "storm couldn't count the tests before the run: vitest wasn't found or failed to start, didn't finish within 60s, exited other than 0, or printed something other than a list of tests. Nothing was minted, leased or started.";
359
+ readonly schema: z.ZodObject<{
360
+ args: z.ZodArray<z.ZodString>;
361
+ cwd: z.ZodString;
362
+ kind: z.ZodEnum<{
363
+ exited: "exited";
364
+ "start-failed": "start-failed";
365
+ "timed-out": "timed-out";
366
+ "unreadable-output": "unreadable-output";
367
+ }>;
368
+ message: z.ZodString;
369
+ }, z.core.$strip>;
370
+ readonly render: ({ kind, message, cwd }: {
371
+ args: string[];
372
+ cwd: string;
373
+ kind: "exited" | "start-failed" | "timed-out" | "unreadable-output";
374
+ message: string;
375
+ }) => {
376
+ message: string;
377
+ next: {
378
+ type: "text";
379
+ text: "Check that the package's vitest prints its list with --json, then retry." | "Check why vitest list doesn't finish, such as a global setup that waits, then retry." | "Fix what vitest list reports, then retry. vitest list takes the arguments vitest run does, but refuses some run-only options." | "Install vitest in the package, or run the command with storm exec, which counts nothing.";
380
+ }[];
381
+ };
382
+ };
383
+ readonly credentialRejected: import("@vercel/clinkr").SharedError<"credential_rejected", [{
384
+ origin: {
385
+ source: "mint";
386
+ team: string;
387
+ project: string;
388
+ } | {
389
+ source: "github-actions";
390
+ claims: {
391
+ aud: string;
392
+ repository: string;
393
+ } | null;
394
+ };
395
+ fix: string;
396
+ status: number;
397
+ vercelId: string | null;
398
+ ttlMinutes: number;
399
+ failedCreates: {
400
+ kind: "connect-failed" | "dropped" | "http-error" | "malformed" | "stream-ended" | "stream-error" | "timeout";
401
+ detail: string | null;
402
+ }[];
403
+ unpooled: {
404
+ testserverUrl: string;
405
+ path: string;
406
+ message: string;
407
+ }[];
408
+ sandboxMayExist: boolean;
409
+ } & {
410
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
411
+ }]>;
412
+ readonly credentialUnused: import("@vercel/clinkr").SharedError<"credential_unused", [data: {
413
+ flags: string[];
414
+ configFile: string | null;
415
+ }]>;
416
+ readonly githubFixtureRepoUnavailable: import("@vercel/clinkr").SharedError<"github_fixture_repo_unavailable", [{
417
+ repo: string;
418
+ status: number | null;
419
+ message: string;
420
+ } & {
421
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
422
+ }]>;
423
+ readonly githubTokenMissing: import("@vercel/clinkr").SharedError<"github_token_missing", [data: {
424
+ tokenEnv: string;
425
+ repo: string;
426
+ configFile: string | null;
427
+ requiredBy: "config" | "set";
428
+ }]>;
429
+ readonly invalidConfig: import("@vercel/clinkr").SharedError<"invalid_config", [data: {
430
+ file: string;
431
+ problems: {
432
+ key: string | null;
433
+ location: {
434
+ line: number;
435
+ column: number | null;
436
+ } | null;
437
+ problem: string;
438
+ }[];
439
+ }]>;
440
+ readonly invalidResourceOptions: import("@vercel/clinkr").SharedError<"invalid_resource_options", [data: {
441
+ configFile: string | null;
442
+ problems: {
443
+ key: string;
444
+ problem: string;
445
+ values: {
446
+ key: string;
447
+ value: string;
448
+ source: "default" | "file" | "flag";
449
+ }[];
450
+ }[];
451
+ }]>;
452
+ readonly mintFailed: import("@vercel/clinkr").SharedError<"mint_failed", [data: {
453
+ team: string;
454
+ project: string;
455
+ cause: string;
456
+ fix: string;
457
+ runner: boolean;
458
+ cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
459
+ }]>;
460
+ readonly missingRunner: import("@vercel/clinkr").SharedError<"missing_runner", [data: {
461
+ configFile: string | null;
462
+ }]>;
463
+ readonly missingTarget: import("@vercel/clinkr").SharedError<"missing_target", [data: {
464
+ missing: ("project" | "scope")[];
465
+ }]>;
466
+ readonly noBaseRef: import("@vercel/clinkr").SharedError<"no_base_ref", [data: {
467
+ refs: {
468
+ ref: string;
469
+ reason: "missing" | "unrelated";
470
+ }[];
471
+ }]>;
472
+ readonly noSandboxes: import("@vercel/clinkr").SharedError<"no_sandboxes", [{
473
+ requested: number;
474
+ ttlMinutes: number;
475
+ failedCreates: {
476
+ kind: "connect-failed" | "dropped" | "http-error" | "malformed" | "stream-ended" | "stream-error" | "timeout";
477
+ detail: string | null;
478
+ }[];
479
+ sandboxMayExist: boolean;
480
+ } & {
481
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
482
+ }]>;
483
+ readonly noUsableSandboxes: import("@vercel/clinkr").SharedError<"no_usable_sandboxes", [{
484
+ requested: number;
485
+ build: string;
486
+ } & {
487
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
488
+ }]>;
489
+ readonly poolUnavailable: import("@vercel/clinkr").SharedError<"pool_unavailable", [data: {
490
+ path: string;
491
+ message: string;
492
+ }]>;
493
+ readonly poolUnreadable: import("@vercel/clinkr").SharedError<"pool_unreadable", [{
494
+ path: string;
495
+ message: string;
496
+ } & {
497
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
498
+ }]>;
499
+ readonly prBuildExpired: import("@vercel/clinkr").SharedError<"pr_build_expired", [{
500
+ pr: number;
501
+ headSha: string;
502
+ build: string;
503
+ expiresAt: string;
504
+ } & {
505
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
506
+ }]>;
507
+ readonly prBuildNotReady: import("@vercel/clinkr").SharedError<"pr_build_not_ready", [{
508
+ pr: number;
509
+ headSha: string;
510
+ newest: {
511
+ build: string;
512
+ headSha: string;
513
+ createdAt: string;
514
+ } | null;
515
+ } & {
516
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
517
+ }]>;
518
+ readonly prBuildsUnlisted: import("@vercel/clinkr").SharedError<"pr_builds_unlisted", [{
519
+ pr: number;
520
+ failure: {
521
+ kind: "connect-failed" | "http-error" | "malformed" | "not-found" | "rejected" | "timeout";
522
+ status: number | null;
523
+ detail: string;
524
+ };
525
+ } & {
526
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
527
+ }]>;
528
+ readonly pullRequestUnreadable: import("@vercel/clinkr").SharedError<"pull_request_unreadable", [{
529
+ pr: number;
530
+ repo: string;
531
+ kind: "connect-failed" | "http-error" | "malformed" | "no-token" | "not-found" | "rejected" | "timeout";
532
+ status: number | null;
533
+ message: string | null;
534
+ tokenOrigin: "GH_TOKEN" | "GITHUB_TOKEN" | "gh auth token" | null;
535
+ } & {
536
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
537
+ }]>;
538
+ readonly runnerFailed: import("@vercel/clinkr").SharedError<"runner_failed", [data: {
539
+ failure: {
540
+ kind: "apply-failed" | "build-failed" | "install-failed" | "snapshot-build-step-failed";
541
+ label: string;
542
+ exitCode: number | null;
543
+ tail: string[];
544
+ } | {
545
+ kind: "sandbox-api-failed";
546
+ operation: string;
547
+ status: number | null;
548
+ message: string;
549
+ } | {
550
+ kind: "checkout-failed";
551
+ message: string;
552
+ command: string | null;
553
+ } | {
554
+ kind: "credential-claims-missing";
555
+ team: string;
556
+ project: string;
557
+ };
558
+ cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
559
+ }]>;
560
+ readonly snapshotGone: import("@vercel/clinkr").SharedError<"snapshot_gone", [data: {
561
+ snapshotId: string;
562
+ base: string;
563
+ removal: {
564
+ path: string;
565
+ message: string;
566
+ } | null;
567
+ cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
568
+ }]>;
569
+ readonly spawnFailed: import("@vercel/clinkr").SharedError<"spawn_failed", [data: {
570
+ executable: string;
571
+ message: string;
572
+ cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
573
+ }]>;
574
+ readonly submodulesRefused: import("@vercel/clinkr").SharedError<"submodules_refused", [data: {
575
+ paths: string[];
576
+ }]>;
577
+ readonly tokenRequestFailed: import("@vercel/clinkr").SharedError<"token_request_failed", [{
578
+ cause: "request-failed" | "variables-missing";
579
+ missing: ("ACTIONS_ID_TOKEN_REQUEST_TOKEN" | "ACTIONS_ID_TOKEN_REQUEST_URL")[] | null;
580
+ status: number | null;
581
+ said: string | null;
582
+ detail: string;
583
+ fix: string;
584
+ ttlMinutes: number;
585
+ failedCreates: {
586
+ kind: "connect-failed" | "dropped" | "http-error" | "malformed" | "stream-ended" | "stream-error" | "timeout";
587
+ detail: string | null;
588
+ }[];
589
+ sandboxMayExist: boolean;
590
+ } & {
591
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
592
+ }]>;
273
593
  }>;
@@ -54,5 +54,78 @@ export declare const configErrors: import("@vercel/clinkr").SharedErrors<{
54
54
  }, z.core.$strip>>;
55
55
  }, z.core.$strip>>;
56
56
  }, z.core.$strip>;
57
+ }, {
58
+ readonly invalidConfig: {
59
+ readonly exitCode: 2;
60
+ readonly description: "storm.config.ts can't be used: it can't be imported, doesn't default-export an object, has an unknown key, or a value in it is invalid. storm checks the whole file whenever a command loads it.";
61
+ readonly schema: z.ZodObject<{
62
+ file: z.ZodString;
63
+ problems: z.ZodArray<z.ZodObject<{
64
+ key: z.ZodNullable<z.ZodString>;
65
+ location: z.ZodNullable<z.ZodObject<{
66
+ line: z.ZodNumber;
67
+ column: z.ZodNullable<z.ZodNumber>;
68
+ }, z.core.$strip>>;
69
+ problem: z.ZodString;
70
+ }, z.core.$strip>>;
71
+ }, z.core.$strip>;
72
+ readonly render: ({ file, problems }: {
73
+ file: string;
74
+ problems: {
75
+ key: string | null;
76
+ location: {
77
+ line: number;
78
+ column: number | null;
79
+ } | null;
80
+ problem: string;
81
+ }[];
82
+ }) => {
83
+ message: string;
84
+ rows?: [string, string[]][];
85
+ next: {
86
+ type: "text";
87
+ text: string;
88
+ }[];
89
+ };
90
+ };
91
+ readonly invalidResourceOptions: {
92
+ readonly exitCode: 2;
93
+ readonly description: "A resource's options, once its defaults, storm.config.ts and the flags are merged, don't fit together, or one it requires is missing: such as resources.testserverPool.ttl not longer than its minTimeLeft. Each problem names the values it is about and where each came from.";
94
+ readonly schema: z.ZodObject<{
95
+ configFile: z.ZodNullable<z.ZodString>;
96
+ problems: z.ZodArray<z.ZodObject<{
97
+ key: z.ZodString;
98
+ problem: z.ZodString;
99
+ values: z.ZodArray<z.ZodObject<{
100
+ key: z.ZodString;
101
+ value: z.ZodString;
102
+ source: z.ZodEnum<{
103
+ default: "default";
104
+ file: "file";
105
+ flag: "flag";
106
+ }>;
107
+ }, z.core.$strip>>;
108
+ }, z.core.$strip>>;
109
+ }, z.core.$strip>;
110
+ readonly render: ({ configFile, problems }: {
111
+ configFile: string | null;
112
+ problems: {
113
+ key: string;
114
+ problem: string;
115
+ values: {
116
+ key: string;
117
+ value: string;
118
+ source: "default" | "file" | "flag";
119
+ }[];
120
+ }[];
121
+ }) => {
122
+ message: string;
123
+ rows?: [string, string[]][];
124
+ next: {
125
+ type: "text";
126
+ text: string;
127
+ }[];
128
+ };
129
+ };
57
130
  }>;
58
131
  export {};
@@ -3,7 +3,7 @@ import { type CheckedRecipe, type RunnerRecipe } from "../runner/index.ts";
3
3
  export declare const CONFIG_FILE_NAME = "storm.config.ts";
4
4
  /**
5
5
  * The settings a `storm.config.ts` can give at its top level, as the file gives them. A flag (`--scope`,
6
- * `--project`) overrides the file; none has a built-in default. `@cnc-tools/storm/config`'s `StormConfig` adds
6
+ * `--project`) overrides the file; none has a built-in default. `@vercel/storm/config`'s `StormConfig` adds
7
7
  * `resources` to these.
8
8
  */
9
9
  export interface ConfigSettings {
@@ -12,12 +12,13 @@ export type { RunnerRecipe, RunnerResources, RunnerStep, RunnerStepContext, Runn
12
12
  */
13
13
  export interface StormResources {
14
14
  /**
15
- * The Testserver pool resource, from `testserverPool()` in `@cnc-tools/storm/testserver`. Its presence gives a run
16
- * a Testserver side. `pool create` reads its `build` and `ttl` whether or not a run would.
15
+ * The Testserver pool resource, from `testserverPool()` in `@vercel/storm/testserver`. Its presence gives a run
16
+ * a Testserver side. `pool create` reads its `build` and `ttl` whether or not a run would. Its `build` may name a
17
+ * vercel/api pull request, as `pr:<N>` or its URL.
17
18
  */
18
19
  readonly testserverPool?: TestserverPoolResource;
19
20
  /**
20
- * The GitHub fixture repository resource, from `githubFixtureRepo()` in `@cnc-tools/storm/github`: one standing
21
+ * The GitHub fixture repository resource, from `githubFixtureRepo()` in `@vercel/storm/github`: one standing
21
22
  * GitHub repository, a token for it and a run prefix, handed to the command, whose branches under the run prefix the
22
23
  * run deletes once the command has stopped. Only a run, `vitest`'s or `exec`'s, reads it.
23
24
  */
@@ -1,4 +1,4 @@
1
- // The config file's published surface, `@cnc-tools/storm/config`. A user's `storm.config.ts` imports it, so it
1
+ // The config file's published surface, `@vercel/storm/config`. A user's `storm.config.ts` imports it, so it
2
2
  // imports nothing at run time but `toolchain.ts`, which imports nothing either: loading a config file pulls in no
3
3
  // Clinkr, zod or CLI code. Everything it takes from the modules, the top-level settings, the runner recipe's types and
4
4
  // each resource's factory type, is a type-only import, erased at run time.
@@ -1,4 +1,4 @@
1
- // The toolchain steps a pnpm workspace's runner recipe can use, exported from `@cnc-tools/storm/config`. Like
1
+ // The toolchain steps a pnpm workspace's runner recipe can use, exported from `@vercel/storm/config`. Like
2
2
  // `define.ts`, it imports nothing at run time, so a config file that uses it loads no Clinkr, zod or CLI code.
3
3
  /**
4
4
  * The runner snapshot's toolchain step for the root `package.json` at the base: `git` on `PATH`, a Node that meets
@@ -44,6 +44,12 @@ export interface ResourcesSettlement<K> {
44
44
  readonly secrets: readonly string[];
45
45
  readonly requests: ResourceRequests<K>;
46
46
  }
47
+ /**
48
+ * One `CommandError` per reason in `Reason`, not one whose reason is the union. TypeScript relates an object with a
49
+ * union-valued property to a union of objects only up to 25 combinations of its discriminants, and a dozen reasons
50
+ * times an error's three exit codes pass that, so a command's declared outcomes would refuse the union-valued one.
51
+ */
52
+ export type EachCommandError<Reason extends string> = Reason extends string ? CommandError<Reason> : never;
47
53
  /**
48
54
  * Every resource's command half, bound to its name, in provider order, over kinds map `K`. Every error is one of the
49
55
  * resources' (`ResourceReason<K>`).
@@ -57,10 +63,10 @@ export interface ResourcesSettlement<K> {
57
63
  * - `canceledLines`: what a canceled run changed in its resources, for a person, resource by resource.
58
64
  */
59
65
  export interface ResourceCommands<K> {
60
- settle(options: ResourceOptions<K>, env: Readonly<Record<string, string | undefined>>, configFile: string | null): Refusable<ResourcesSettlement<K>, CommandError<ResourceReason<K>>>;
66
+ settle(options: ResourceOptions<K>, env: Readonly<Record<string, string | undefined>>, configFile: string | null): Refusable<ResourcesSettlement<K>, EachCommandError<ResourceReason<K>>>;
61
67
  takesCredential(options: ResourceOptions<K>): boolean;
62
68
  refusalFacts(outcome: ResourceRefusal<K>): RefusalFact;
63
- unpreparedError(outcome: ResourceUnprepared<K>): CommandError<ResourceReason<K>>;
69
+ unpreparedError(outcome: ResourceUnprepared<K>): EachCommandError<ResourceReason<K>>;
64
70
  canceledLines(resources: ResourceCanceledFacts<K>, cleanup: ResourceCleanup<K>): readonly string[];
65
71
  }
66
72
  /** Every one of `providers`' command halves, bound to their names, in order. */
@@ -104,6 +104,10 @@ function commandSlotOf(provider) {
104
104
  canceledLines: (resources, cleanup) => half.canceledLines(resources[name], cleanup[name]),
105
105
  };
106
106
  }
107
+ /** `error` as the member of `EachCommandError` its reason names: the same value, typed per reason. */
108
+ function each(error) {
109
+ return error;
110
+ }
107
111
  /** Every one of `providers`' command halves, bound to their names, in order. */
108
112
  export function bindCommands(providers) {
109
113
  const slots = providers.map((provider) => commandSlotOf(provider));
@@ -122,7 +126,7 @@ export function bindCommands(providers) {
122
126
  if (settled === undefined)
123
127
  continue;
124
128
  if (!settled.ok)
125
- return settled;
129
+ return { ok: false, refusal: each(settled.refusal) };
126
130
  secrets = [...secrets, ...settled.secrets];
127
131
  requests = { ...requests, ...settled.requests };
128
132
  }
@@ -130,7 +134,7 @@ export function bindCommands(providers) {
130
134
  },
131
135
  takesCredential: (options) => slots.some((slot) => slot.takesCredential(options)),
132
136
  refusalFacts: (outcome) => first(slots.map((slot) => slot.refusalFacts(outcome)), `${outcome.resource}'s refusal`),
133
- unpreparedError: (outcome) => first(slots.map((slot) => slot.unpreparedError(outcome)), `${outcome.resource}'s prepare refusal`),
137
+ unpreparedError: (outcome) => each(first(slots.map((slot) => slot.unpreparedError(outcome)), `${outcome.resource}'s prepare refusal`)),
134
138
  canceledLines: (resources, released) => slots.flatMap((slot) => slot.canceledLines(resources, released)),
135
139
  };
136
140
  }
@@ -1,5 +1,5 @@
1
1
  import type { MintTarget } from "../credential/index.ts";
2
- import type { RunnerEvent, SnapshotCacheNote } from "../runner/index.ts";
2
+ import type { RunnerEvent, RunnerSandboxPlan, SnapshotCacheNote } from "../runner/index.ts";
3
3
  import type { Clock } from "../time/index.ts";
4
4
  import type { TestEvent } from "../sdk/index.ts";
5
5
  import type { AnyResources, ResourceEvent, ResourceFailures, ResourceHoldings, RunLane } from "./resource.ts";
@@ -15,7 +15,8 @@ export type LaneOutcome = "ready" | "failed" | "stopped";
15
15
  * provider order: none when it holds no resource with a lane, and `resources` the resources it holds, by name, in
16
16
  * provider order.
17
17
  * - `runner-prepared`: in a runner run, what the local checks found: the base, a full SHA, and the ref it is HEAD's
18
- * merge-base with; the untracked nested Git repositories the upload leaves out; and what the cache read noticed.
18
+ * merge-base with; the untracked nested Git repositories the upload leaves out; what the cache read noticed; and
19
+ * whether `--save-snapshot` saves nothing because HEAD is detached (`saveSkipped`).
19
20
  * - `minting`, `minted` and `requesting-token`: a credential's events (`CredentialEvent`): the run's one mint, which a
20
21
  * runner run makes for its runner sandbox and a resource makes in a local run, and a GitHub Actions OIDC token
21
22
  * request.
@@ -29,9 +30,10 @@ export type LaneOutcome = "ready" | "failed" | "stopped";
29
30
  * - `command-started`: the command started, or in a runner run is about to start in the runner sandbox.
30
31
  * - `command-ended`: the command ended as `outcome` after `ms`; `command` is its executable's name. A command the
31
32
  * run killed reports the runner's `command-stopped` instead.
32
- * - `cleanup-started`: the run is cleaning up: in a runner run (`runner`) stopping and deleting the runner's
33
- * sandboxes, but for the runner sandbox it keeps running `keepSandboxMs` when that is above 0 (always 0 in a local
34
- * run), then releasing its resources, holding what `holdings` says of each.
33
+ * - `cleanup-started`: the run is cleaning up: in a runner run (`runnerSandbox`, null in a local run) stopping and
34
+ * deleting the runner's sandboxes, but for the runner sandbox, which it keeps running `ms` when that is above 0
35
+ * (`keep`) or saves as a branch snapshot of `branch` while it releases the resources (`save`, only when the save
36
+ * runs); and releasing its resources, holding what `holdings` says of each.
35
37
  * - `cleanup-finished`: it is done; `resourceFailures` counts, for each resource the run held, what releasing it
36
38
  * couldn't do, and in a runner run `notStopped` and `notDeleted` sandboxes couldn't be stopped or deleted.
37
39
  * - `test`: in a runner run, a test event the command appended to the run payload's `testEvents` file, as it
@@ -53,6 +55,7 @@ export type RunEvent<K> = {
53
55
  readonly baseRef: string;
54
56
  readonly nestedRepositories: readonly string[];
55
57
  readonly notes: readonly SnapshotCacheNote[];
58
+ readonly saveSkipped: boolean;
56
59
  } | CredentialEvent | {
57
60
  readonly kind: "lanes-started";
58
61
  } | {
@@ -72,8 +75,7 @@ export type RunEvent<K> = {
72
75
  readonly ms: number;
73
76
  } | {
74
77
  readonly kind: "cleanup-started";
75
- readonly runner: boolean;
76
- readonly keepSandboxMs: number;
78
+ readonly runnerSandbox: RunnerSandboxPlan | null;
77
79
  readonly holdings: ResourceHoldings<K>;
78
80
  } | {
79
81
  readonly kind: "cleanup-finished";
@@ -1,5 +1,5 @@
1
1
  export { type AnyResourceError, type CommandProvider, defineRefusals, type RefusalDefinition, type RefusalDefinitions, type RefusalFact, type RefusalFactOf, type RefusalSchemaOf, type ResourceCleanupReport, type ResourceErrors, type ResourceRanReport, type ResourceSettleInput, type ResourceSettlement, type UnpreparedErrorOf, } from "./command-provider.ts";
2
- export { bindCommands, type ResourceCommands, type ResourceReports, resourceReports, type ResourcesSettlement, } from "./command-slots.ts";
2
+ export { bindCommands, type EachCommandError, type ResourceCommands, type ResourceReports, resourceReports, type ResourcesSettlement, } from "./command-slots.ts";
3
3
  export type { FittingConfig, Provider, ProviderList, ResourceCommandTree, ResourceHost } from "./provider.ts";
4
4
  export type { LaneDraw, LanePresentation, Paint, ReleaseTense, ResourceNotice, ResourcePresentation, } from "./presentation.ts";
5
5
  export { type PresentedLane, type ResourcePresentations, resourcePresentations } from "./presentations.ts";