@cnc-tools/storm 0.6.0 → 0.7.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.
- package/dist/build-info.js +1 -1
- package/dist/commands/exec/command.d.ts +26 -0
- package/dist/commands/exec/live-view.js +29 -13
- package/dist/commands/exec/metadata.d.ts +4 -1
- package/dist/commands/exec/outcomes.d.ts +50 -0
- package/dist/commands/exec/outcomes.js +9 -0
- package/dist/commands/exec/progress.d.ts +14 -2
- package/dist/commands/exec/progress.js +54 -9
- package/dist/commands/exec/run-command.d.ts +8 -2
- package/dist/commands/exec/run-command.js +41 -8
- package/dist/commands/exec/run-metadata.d.ts +5 -2
- package/dist/commands/exec/run-metadata.js +5 -2
- package/dist/commands/exec/run-record.d.ts +83 -4
- package/dist/commands/exec/run-record.js +49 -1
- package/dist/commands/exec/view.js +36 -4
- package/dist/commands/runs/facts.d.ts +25 -0
- package/dist/commands/runs/facts.js +36 -3
- package/dist/commands/runs/list/command.d.ts +25 -0
- package/dist/commands/runs/list/outcomes.d.ts +25 -0
- package/dist/commands/runs/show/command.d.ts +25 -0
- package/dist/commands/runs/show/metadata.js +1 -1
- package/dist/commands/runs/show/outcomes.d.ts +25 -0
- package/dist/commands/runs/show/outcomes.js +30 -1
- package/dist/commands/vitest/command.d.ts +26 -0
- package/dist/commands/vitest/metadata.d.ts +4 -1
- package/dist/commands/vitest/outcomes.d.ts +25 -0
- package/dist/core/events.d.ts +9 -7
- package/dist/core/run-state.d.ts +30 -6
- package/dist/core/run-state.js +19 -4
- package/dist/core/run.d.ts +17 -4
- package/dist/core/run.js +61 -25
- package/dist/runner/events.d.ts +64 -1
- package/dist/runner/gateways.d.ts +17 -6
- package/dist/runner/index.d.ts +5 -4
- package/dist/runner/index.js +4 -3
- package/dist/runner/live/snapshot-records.js +18 -4
- package/dist/runner/prepare.d.ts +23 -4
- package/dist/runner/prepare.js +13 -3
- package/dist/runner/ready.d.ts +7 -3
- package/dist/runner/ready.js +11 -5
- package/dist/runner/scope.d.ts +17 -1
- package/dist/runner/scope.js +4 -0
- package/dist/runner/snapshot-build.d.ts +3 -1
- package/dist/runner/snapshot-build.js +12 -2
- package/dist/runner/snapshot-cache.d.ts +46 -8
- package/dist/runner/snapshot-cache.js +60 -11
- package/dist/runner/snapshot-key.d.ts +12 -1
- package/dist/runner/snapshot-key.js +17 -1
- package/dist/runner/snapshot-save.d.ts +53 -0
- package/dist/runner/snapshot-save.js +148 -0
- package/dist/story/align.d.ts +1 -1
- package/dist/story/align.js +1 -1
- package/dist/story/definition.d.ts +22 -15
- package/dist/story/definition.js +2 -2
- package/dist/story/errors.js +1 -1
- package/dist/story/gateways.d.ts +45 -25
- package/dist/story/gateways.js +2 -2
- package/dist/story/host.d.ts +11 -8
- package/dist/story/host.js +37 -37
- package/dist/story/index.d.ts +1 -1
- package/dist/story/index.js +4 -4
- package/dist/story/json.d.ts +1 -1
- package/dist/story/json.js +2 -2
- package/dist/story/live/recording-gateway.d.ts +2 -0
- package/dist/story/live/{artifact-gateway.js → recording-gateway.js} +33 -12
- package/dist/story/mode.d.ts +2 -2
- package/dist/story/mode.js +1 -1
- package/dist/story/orphans.d.ts +23 -5
- package/dist/story/orphans.js +44 -8
- package/dist/story/recording.d.ts +62 -0
- package/dist/story/{artifact.js → recording.js} +31 -27
- package/dist/story/report.d.ts +21 -9
- package/dist/story/report.js +37 -25
- package/dist/story/settle.d.ts +23 -21
- package/dist/story/settle.js +17 -16
- package/dist/story/{run.d.ts → start.d.ts} +18 -17
- package/dist/story/{run.js → start.js} +66 -43
- package/package.json +1 -1
- package/dist/story/artifact.d.ts +0 -60
- package/dist/story/live/artifact-gateway.d.ts +0 -2
|
@@ -36,12 +36,43 @@ declare const snapshotSchema: z.ZodObject<{
|
|
|
36
36
|
id: z.ZodString;
|
|
37
37
|
base: z.ZodString;
|
|
38
38
|
built: z.ZodBoolean;
|
|
39
|
+
branch: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
40
|
+
head: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
39
41
|
}, z.core.$strip>;
|
|
40
42
|
/**
|
|
41
43
|
* The runner snapshot a runner sandbox started from: its id, the base it is of, which the run's changes were uploaded
|
|
42
|
-
* on top of,
|
|
44
|
+
* on top of, whether the run built it or reused a cached one, and for a branch snapshot the branch and HEAD commit of
|
|
45
|
+
* the run that saved it (each null for a base snapshot).
|
|
43
46
|
*/
|
|
44
47
|
export type RunRecordSnapshot = Readonly<z.output<typeof snapshotSchema>>;
|
|
48
|
+
/**
|
|
49
|
+
* How saving the runner sandbox as a branch snapshot ended (`--save-snapshot`), as a `ran` outcome and `run.json`
|
|
50
|
+
* report it.
|
|
51
|
+
*/
|
|
52
|
+
export declare const saveSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53
|
+
kind: z.ZodLiteral<"saved">;
|
|
54
|
+
snapshotId: z.ZodString;
|
|
55
|
+
base: z.ZodString;
|
|
56
|
+
branch: z.ZodString;
|
|
57
|
+
head: z.ZodString;
|
|
58
|
+
ms: z.ZodNumber;
|
|
59
|
+
sizeBytes: z.ZodNumber;
|
|
60
|
+
entryWritten: z.ZodBoolean;
|
|
61
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
62
|
+
kind: z.ZodLiteral<"skipped">;
|
|
63
|
+
reason: z.ZodLiteral<"detached-head">;
|
|
64
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
+
kind: z.ZodLiteral<"failed">;
|
|
66
|
+
step: z.ZodEnum<{
|
|
67
|
+
"save-snapshot": "save-snapshot";
|
|
68
|
+
scrub: "scrub";
|
|
69
|
+
}>;
|
|
70
|
+
message: z.ZodString;
|
|
71
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
72
|
+
kind: z.ZodLiteral<"stopped">;
|
|
73
|
+
}, z.core.$strip>], "kind">;
|
|
74
|
+
/** How saving the runner sandbox as a branch snapshot ended. */
|
|
75
|
+
export type RunRecordSave = z.output<typeof saveSchema>;
|
|
45
76
|
declare const whereSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
46
77
|
kind: z.ZodLiteral<"local">;
|
|
47
78
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -58,16 +89,40 @@ declare const whereSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
58
89
|
id: z.ZodString;
|
|
59
90
|
base: z.ZodString;
|
|
60
91
|
built: z.ZodBoolean;
|
|
92
|
+
branch: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
93
|
+
head: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
61
94
|
}, z.core.$strip>>;
|
|
62
95
|
keptUntil: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
96
|
+
save: z.ZodDefault<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
97
|
+
kind: z.ZodLiteral<"saved">;
|
|
98
|
+
snapshotId: z.ZodString;
|
|
99
|
+
base: z.ZodString;
|
|
100
|
+
branch: z.ZodString;
|
|
101
|
+
head: z.ZodString;
|
|
102
|
+
ms: z.ZodNumber;
|
|
103
|
+
sizeBytes: z.ZodNumber;
|
|
104
|
+
entryWritten: z.ZodBoolean;
|
|
105
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
106
|
+
kind: z.ZodLiteral<"skipped">;
|
|
107
|
+
reason: z.ZodLiteral<"detached-head">;
|
|
108
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
109
|
+
kind: z.ZodLiteral<"failed">;
|
|
110
|
+
step: z.ZodEnum<{
|
|
111
|
+
"save-snapshot": "save-snapshot";
|
|
112
|
+
scrub: "scrub";
|
|
113
|
+
}>;
|
|
114
|
+
message: z.ZodString;
|
|
115
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
116
|
+
kind: z.ZodLiteral<"stopped">;
|
|
117
|
+
}, z.core.$strip>], "kind">>>;
|
|
63
118
|
}, z.core.$strip>], "kind">;
|
|
64
119
|
/**
|
|
65
120
|
* Where a run's command ran: on this machine (`local`, with `--local`), or in a runner sandbox (`runner`): the control
|
|
66
121
|
* plane team and project it runs in, its region, runtime and vCPUs, and the run's base, HEAD's merge-base with
|
|
67
122
|
* `baseRef`, all known as the run starts; then, once the run is over, the runner sandbox's name and the runner snapshot
|
|
68
|
-
* it started from, each null when the run stopped before it,
|
|
69
|
-
* time, when the run kept it running (null when it stopped and deleted it)
|
|
70
|
-
* older base.
|
|
123
|
+
* it started from, each null when the run stopped before it, when the runner sandbox's timeout stops it, as an ISO
|
|
124
|
+
* time, when the run kept it running (null when it stopped and deleted it), and how saving it as a branch snapshot
|
|
125
|
+
* ended (null without `--save-snapshot`). A reused runner snapshot can be of an older base.
|
|
71
126
|
*/
|
|
72
127
|
export type RunRecordWhere = Readonly<z.output<typeof whereSchema>>;
|
|
73
128
|
declare const gitSchema: z.ZodObject<{
|
|
@@ -128,8 +183,32 @@ declare const runRecordSchema: z.ZodObject<{
|
|
|
128
183
|
id: z.ZodString;
|
|
129
184
|
base: z.ZodString;
|
|
130
185
|
built: z.ZodBoolean;
|
|
186
|
+
branch: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
187
|
+
head: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
131
188
|
}, z.core.$strip>>;
|
|
132
189
|
keptUntil: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
190
|
+
save: z.ZodDefault<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
191
|
+
kind: z.ZodLiteral<"saved">;
|
|
192
|
+
snapshotId: z.ZodString;
|
|
193
|
+
base: z.ZodString;
|
|
194
|
+
branch: z.ZodString;
|
|
195
|
+
head: z.ZodString;
|
|
196
|
+
ms: z.ZodNumber;
|
|
197
|
+
sizeBytes: z.ZodNumber;
|
|
198
|
+
entryWritten: z.ZodBoolean;
|
|
199
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
200
|
+
kind: z.ZodLiteral<"skipped">;
|
|
201
|
+
reason: z.ZodLiteral<"detached-head">;
|
|
202
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
203
|
+
kind: z.ZodLiteral<"failed">;
|
|
204
|
+
step: z.ZodEnum<{
|
|
205
|
+
"save-snapshot": "save-snapshot";
|
|
206
|
+
scrub: "scrub";
|
|
207
|
+
}>;
|
|
208
|
+
message: z.ZodString;
|
|
209
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
210
|
+
kind: z.ZodLiteral<"stopped">;
|
|
211
|
+
}, z.core.$strip>], "kind">>>;
|
|
133
212
|
}, z.core.$strip>], "kind">;
|
|
134
213
|
git: z.ZodNullable<z.ZodObject<{
|
|
135
214
|
branch: z.ZodNullable<z.ZodString>;
|
|
@@ -19,7 +19,53 @@ const endedSchema = z.object({
|
|
|
19
19
|
// Read on its own in `parseRunRecord`, so a resource's facts another storm wrote cost only themselves.
|
|
20
20
|
resources: z.unknown(),
|
|
21
21
|
});
|
|
22
|
-
const snapshotSchema = z.object({
|
|
22
|
+
const snapshotSchema = z.object({
|
|
23
|
+
id: z.string(),
|
|
24
|
+
base: z.string(),
|
|
25
|
+
built: z.boolean(),
|
|
26
|
+
// Absent from a run.json an earlier storm wrote, which started from no branch snapshot.
|
|
27
|
+
branch: z.string().nullable().default(null),
|
|
28
|
+
head: z.string().nullable().default(null),
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* How saving the runner sandbox as a branch snapshot ended (`--save-snapshot`), as a `ran` outcome and `run.json`
|
|
32
|
+
* report it.
|
|
33
|
+
*/
|
|
34
|
+
export const saveSchema = z.discriminatedUnion("kind", [
|
|
35
|
+
z.object({
|
|
36
|
+
/** It saved the runner sandbox as a branch snapshot. */
|
|
37
|
+
kind: z.literal("saved"),
|
|
38
|
+
/** The runner snapshot it saved. */
|
|
39
|
+
snapshotId: z.string(),
|
|
40
|
+
/** The base it is of: the base of the runner snapshot the run started from, a full SHA. */
|
|
41
|
+
base: z.string(),
|
|
42
|
+
/** The local branch it is for. */
|
|
43
|
+
branch: z.string(),
|
|
44
|
+
/** HEAD's commit as the run started, a full SHA. */
|
|
45
|
+
head: z.string(),
|
|
46
|
+
/** How long the save took, in milliseconds, from the scrub's start until the snapshot was saved. */
|
|
47
|
+
ms: z.number(),
|
|
48
|
+
/** The snapshot's size in bytes. */
|
|
49
|
+
sizeBytes: z.number(),
|
|
50
|
+
/** Whether the runner snapshot cache recorded it; a later run on the branch starts from it only when it did. */
|
|
51
|
+
entryWritten: z.boolean(),
|
|
52
|
+
}),
|
|
53
|
+
z.object({
|
|
54
|
+
/** It didn't save: HEAD was detached, so there is no branch to save for. */
|
|
55
|
+
kind: z.literal("skipped"),
|
|
56
|
+
reason: z.literal("detached-head"),
|
|
57
|
+
}),
|
|
58
|
+
z.object({
|
|
59
|
+
/** It didn't save: the scrub or the save failed. */
|
|
60
|
+
kind: z.literal("failed"),
|
|
61
|
+
step: z.enum(["scrub", "save-snapshot"]),
|
|
62
|
+
message: z.string(),
|
|
63
|
+
}),
|
|
64
|
+
z.object({
|
|
65
|
+
/** It didn't save, or recorded nothing: a signal stopped it. */
|
|
66
|
+
kind: z.literal("stopped"),
|
|
67
|
+
}),
|
|
68
|
+
]);
|
|
23
69
|
const whereSchema = z.discriminatedUnion("kind", [
|
|
24
70
|
z.object({ kind: z.literal("local") }),
|
|
25
71
|
z.object({
|
|
@@ -35,6 +81,8 @@ const whereSchema = z.discriminatedUnion("kind", [
|
|
|
35
81
|
snapshot: snapshotSchema.nullable(),
|
|
36
82
|
// Absent from a run.json an earlier storm wrote, which kept no runner sandbox.
|
|
37
83
|
keptUntil: z.string().nullable().default(null),
|
|
84
|
+
// Absent from a run.json an earlier storm wrote, which saved no branch snapshot.
|
|
85
|
+
save: saveSchema.nullable().default(null),
|
|
38
86
|
}),
|
|
39
87
|
]);
|
|
40
88
|
const gitSchema = z.object({ branch: z.string().nullable(), commit: z.string(), dirty: z.boolean() });
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { EMPTY_RUN_STATE } from "../../core/index.js";
|
|
5
5
|
import { applyStormRunEvent, RESOURCE_PRESENTATIONS, } from "../../resources.js";
|
|
6
6
|
import { activePhase, headerLine, phaseFrame, phaseRecord } from "./live-view.js";
|
|
7
|
-
import { cacheWriteFailureText, lineProgress, preparedNoteTexts, progressLine } from "./progress.js";
|
|
7
|
+
import { branchSnapshotSaveText, branchSnapshotsDropText, cacheWriteFailureText, lineProgress, preparedNoteTexts, progressLine, } from "./progress.js";
|
|
8
8
|
import { paint } from "./text.js";
|
|
9
9
|
/** The plain summary's width when stderr reports none: 80 columns. */
|
|
10
10
|
const PLAIN_WIDTH = 80;
|
|
@@ -139,9 +139,7 @@ function noticeLines(timed, origin, verbose) {
|
|
|
139
139
|
case "runner-prepared":
|
|
140
140
|
return preparedNoteTexts(event).map((text) => line("runner", text));
|
|
141
141
|
case "runner":
|
|
142
|
-
return event.event
|
|
143
|
-
? [line("runner", cacheWriteFailureText(event.event.failure))]
|
|
144
|
-
: [];
|
|
142
|
+
return runnerNoticeLines(event.event, line);
|
|
145
143
|
case "resource":
|
|
146
144
|
return RESOURCE_PRESENTATIONS.notices(event, { verbose }).map(({ lane, text }) => line(lane, text));
|
|
147
145
|
case "started":
|
|
@@ -161,3 +159,37 @@ function noticeLines(timed, origin, verbose) {
|
|
|
161
159
|
return [];
|
|
162
160
|
}
|
|
163
161
|
}
|
|
162
|
+
/** The runner's notices: a cache entry not written, what `--rebuild-snapshot` dropped, and how a save ended. */
|
|
163
|
+
function runnerNoticeLines(event, line) {
|
|
164
|
+
switch (event.kind) {
|
|
165
|
+
case "snapshot-entry-not-written":
|
|
166
|
+
return [line("runner", cacheWriteFailureText(event.failure))];
|
|
167
|
+
case "branch-snapshots-dropped":
|
|
168
|
+
case "branch-snapshots-not-dropped":
|
|
169
|
+
return [line("runner", branchSnapshotsDropText(event))];
|
|
170
|
+
case "branch-snapshot-saved":
|
|
171
|
+
case "branch-snapshot-not-saved":
|
|
172
|
+
return [line("cleanup", branchSnapshotSaveText(event))];
|
|
173
|
+
// The live view's phases show the rest.
|
|
174
|
+
case "snapshot-reused":
|
|
175
|
+
case "snapshot-build-started":
|
|
176
|
+
case "runner-sandbox-starting":
|
|
177
|
+
case "sandbox-started":
|
|
178
|
+
case "output-started":
|
|
179
|
+
case "output-ended":
|
|
180
|
+
case "step-started":
|
|
181
|
+
case "step-output":
|
|
182
|
+
case "step-finished":
|
|
183
|
+
case "snapshot-saving":
|
|
184
|
+
case "snapshot-built":
|
|
185
|
+
case "uploading":
|
|
186
|
+
case "uploaded":
|
|
187
|
+
case "command-output-started":
|
|
188
|
+
case "command-stopped":
|
|
189
|
+
case "stopping":
|
|
190
|
+
case "waiting-for-snapshot":
|
|
191
|
+
case "sandbox-kept":
|
|
192
|
+
case "branch-snapshot-saving":
|
|
193
|
+
return [];
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -46,8 +46,33 @@ export declare const runFactsSchema: z.ZodObject<{
|
|
|
46
46
|
id: z.ZodString;
|
|
47
47
|
base: z.ZodString;
|
|
48
48
|
built: z.ZodBoolean;
|
|
49
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
50
|
+
head: z.ZodNullable<z.ZodString>;
|
|
49
51
|
url: z.ZodString;
|
|
50
52
|
}, z.core.$strip>>;
|
|
53
|
+
save: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
54
|
+
kind: z.ZodLiteral<"saved">;
|
|
55
|
+
snapshotId: z.ZodString;
|
|
56
|
+
base: z.ZodString;
|
|
57
|
+
branch: z.ZodString;
|
|
58
|
+
head: z.ZodString;
|
|
59
|
+
ms: z.ZodNumber;
|
|
60
|
+
sizeBytes: z.ZodNumber;
|
|
61
|
+
entryWritten: z.ZodBoolean;
|
|
62
|
+
url: z.ZodString;
|
|
63
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
64
|
+
kind: z.ZodLiteral<"skipped">;
|
|
65
|
+
reason: z.ZodLiteral<"detached-head">;
|
|
66
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
67
|
+
kind: z.ZodLiteral<"failed">;
|
|
68
|
+
step: z.ZodEnum<{
|
|
69
|
+
"save-snapshot": "save-snapshot";
|
|
70
|
+
scrub: "scrub";
|
|
71
|
+
}>;
|
|
72
|
+
message: z.ZodString;
|
|
73
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
74
|
+
kind: z.ZodLiteral<"stopped">;
|
|
75
|
+
}, z.core.$strip>], "kind">>;
|
|
51
76
|
}, z.core.$strip>], "kind">>;
|
|
52
77
|
git: z.ZodNullable<z.ZodObject<{
|
|
53
78
|
branch: z.ZodNullable<z.ZodString>;
|
|
@@ -69,8 +69,40 @@ export const runFactsSchema = z.object({
|
|
|
69
69
|
keptUntil: z.string().nullable(),
|
|
70
70
|
/** How many whole minutes are left until keptUntil, as of reading the run, 0 once it has passed; null when keptUntil is. */
|
|
71
71
|
keptMinutesLeft: z.number().nullable(),
|
|
72
|
-
/** The runner snapshot it started from: its id, the base it is of, which the run's changes went on top of, whether this run built it or reused it, and its page in the Vercel dashboard. Null until known. */
|
|
73
|
-
snapshot: z
|
|
72
|
+
/** The runner snapshot it started from: its id, the base it is of, which the run's changes went on top of, whether this run built it or reused it, for a branch snapshot the branch and HEAD commit of the run that saved it (each null for a base snapshot), and its page in the Vercel dashboard. Null until known. */
|
|
73
|
+
snapshot: z
|
|
74
|
+
.object({
|
|
75
|
+
id: z.string(),
|
|
76
|
+
base: z.string(),
|
|
77
|
+
built: z.boolean(),
|
|
78
|
+
branch: z.string().nullable(),
|
|
79
|
+
head: z.string().nullable(),
|
|
80
|
+
url: z.string(),
|
|
81
|
+
})
|
|
82
|
+
.nullable(),
|
|
83
|
+
/** How saving the runner sandbox as a branch snapshot ended (--save-snapshot), as the run's ran result's runner.save says, with the saved snapshot's page in the Vercel dashboard (`url`, null unless saved); null without the flag. */
|
|
84
|
+
save: z
|
|
85
|
+
.discriminatedUnion("kind", [
|
|
86
|
+
z.object({
|
|
87
|
+
kind: z.literal("saved"),
|
|
88
|
+
snapshotId: z.string(),
|
|
89
|
+
base: z.string(),
|
|
90
|
+
branch: z.string(),
|
|
91
|
+
head: z.string(),
|
|
92
|
+
ms: z.number(),
|
|
93
|
+
sizeBytes: z.number(),
|
|
94
|
+
entryWritten: z.boolean(),
|
|
95
|
+
url: z.string(),
|
|
96
|
+
}),
|
|
97
|
+
z.object({ kind: z.literal("skipped"), reason: z.literal("detached-head") }),
|
|
98
|
+
z.object({
|
|
99
|
+
kind: z.literal("failed"),
|
|
100
|
+
step: z.enum(["scrub", "save-snapshot"]),
|
|
101
|
+
message: z.string(),
|
|
102
|
+
}),
|
|
103
|
+
z.object({ kind: z.literal("stopped") }),
|
|
104
|
+
])
|
|
105
|
+
.nullable(),
|
|
74
106
|
}),
|
|
75
107
|
])
|
|
76
108
|
.nullable(),
|
|
@@ -124,12 +156,13 @@ export function runFacts(run, now) {
|
|
|
124
156
|
function whereFacts(where, now) {
|
|
125
157
|
if (where.kind === "local")
|
|
126
158
|
return { kind: "local" };
|
|
127
|
-
const { sandbox, snapshot, keptUntil } = where;
|
|
159
|
+
const { sandbox, snapshot, keptUntil, save } = where;
|
|
128
160
|
return {
|
|
129
161
|
...where,
|
|
130
162
|
keptMinutesLeft: keptUntil === null ? null : Math.max(0, Math.floor((Date.parse(keptUntil) - now.getTime()) / 60_000)),
|
|
131
163
|
sandboxUrl: sandbox === null ? null : sandboxPage(where, sandbox),
|
|
132
164
|
snapshot: snapshot === null ? null : { ...snapshot, url: snapshotPage(where, snapshot.id) },
|
|
165
|
+
save: save?.kind === "saved" ? { ...save, url: snapshotPage(where, save.snapshotId) } : save,
|
|
133
166
|
};
|
|
134
167
|
}
|
|
135
168
|
/** `scope` as the result reports it. */
|
|
@@ -53,8 +53,33 @@ export declare function command(cmd: CommandBuilder<StormApp>): import("@vercel/
|
|
|
53
53
|
id: z.ZodString;
|
|
54
54
|
base: z.ZodString;
|
|
55
55
|
built: z.ZodBoolean;
|
|
56
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
57
|
+
head: z.ZodNullable<z.ZodString>;
|
|
56
58
|
url: z.ZodString;
|
|
57
59
|
}, z.core.$strip>>;
|
|
60
|
+
save: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
61
|
+
kind: z.ZodLiteral<"saved">;
|
|
62
|
+
snapshotId: z.ZodString;
|
|
63
|
+
base: z.ZodString;
|
|
64
|
+
branch: z.ZodString;
|
|
65
|
+
head: z.ZodString;
|
|
66
|
+
ms: z.ZodNumber;
|
|
67
|
+
sizeBytes: z.ZodNumber;
|
|
68
|
+
entryWritten: z.ZodBoolean;
|
|
69
|
+
url: z.ZodString;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
kind: z.ZodLiteral<"skipped">;
|
|
72
|
+
reason: z.ZodLiteral<"detached-head">;
|
|
73
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
74
|
+
kind: z.ZodLiteral<"failed">;
|
|
75
|
+
step: z.ZodEnum<{
|
|
76
|
+
"save-snapshot": "save-snapshot";
|
|
77
|
+
scrub: "scrub";
|
|
78
|
+
}>;
|
|
79
|
+
message: z.ZodString;
|
|
80
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
81
|
+
kind: z.ZodLiteral<"stopped">;
|
|
82
|
+
}, z.core.$strip>], "kind">>;
|
|
58
83
|
}, z.core.$strip>], "kind">>;
|
|
59
84
|
git: z.ZodNullable<z.ZodObject<{
|
|
60
85
|
branch: z.ZodNullable<z.ZodString>;
|
|
@@ -41,8 +41,33 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
|
|
|
41
41
|
id: z.ZodString;
|
|
42
42
|
base: z.ZodString;
|
|
43
43
|
built: z.ZodBoolean;
|
|
44
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
45
|
+
head: z.ZodNullable<z.ZodString>;
|
|
44
46
|
url: z.ZodString;
|
|
45
47
|
}, z.core.$strip>>;
|
|
48
|
+
save: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
|
+
kind: z.ZodLiteral<"saved">;
|
|
50
|
+
snapshotId: z.ZodString;
|
|
51
|
+
base: z.ZodString;
|
|
52
|
+
branch: z.ZodString;
|
|
53
|
+
head: z.ZodString;
|
|
54
|
+
ms: z.ZodNumber;
|
|
55
|
+
sizeBytes: z.ZodNumber;
|
|
56
|
+
entryWritten: z.ZodBoolean;
|
|
57
|
+
url: z.ZodString;
|
|
58
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
59
|
+
kind: z.ZodLiteral<"skipped">;
|
|
60
|
+
reason: z.ZodLiteral<"detached-head">;
|
|
61
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
62
|
+
kind: z.ZodLiteral<"failed">;
|
|
63
|
+
step: z.ZodEnum<{
|
|
64
|
+
"save-snapshot": "save-snapshot";
|
|
65
|
+
scrub: "scrub";
|
|
66
|
+
}>;
|
|
67
|
+
message: z.ZodString;
|
|
68
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
69
|
+
kind: z.ZodLiteral<"stopped">;
|
|
70
|
+
}, z.core.$strip>], "kind">>;
|
|
46
71
|
}, z.core.$strip>], "kind">>;
|
|
47
72
|
git: z.ZodNullable<z.ZodObject<{
|
|
48
73
|
branch: z.ZodNullable<z.ZodString>;
|
|
@@ -40,8 +40,33 @@ export declare function command(cmd: CommandBuilder<StormApp>): import("@vercel/
|
|
|
40
40
|
id: z.ZodString;
|
|
41
41
|
base: z.ZodString;
|
|
42
42
|
built: z.ZodBoolean;
|
|
43
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
44
|
+
head: z.ZodNullable<z.ZodString>;
|
|
43
45
|
url: z.ZodString;
|
|
44
46
|
}, z.core.$strip>>;
|
|
47
|
+
save: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
48
|
+
kind: z.ZodLiteral<"saved">;
|
|
49
|
+
snapshotId: z.ZodString;
|
|
50
|
+
base: z.ZodString;
|
|
51
|
+
branch: z.ZodString;
|
|
52
|
+
head: z.ZodString;
|
|
53
|
+
ms: z.ZodNumber;
|
|
54
|
+
sizeBytes: z.ZodNumber;
|
|
55
|
+
entryWritten: z.ZodBoolean;
|
|
56
|
+
url: z.ZodString;
|
|
57
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
58
|
+
kind: z.ZodLiteral<"skipped">;
|
|
59
|
+
reason: z.ZodLiteral<"detached-head">;
|
|
60
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
+
kind: z.ZodLiteral<"failed">;
|
|
62
|
+
step: z.ZodEnum<{
|
|
63
|
+
"save-snapshot": "save-snapshot";
|
|
64
|
+
scrub: "scrub";
|
|
65
|
+
}>;
|
|
66
|
+
message: z.ZodString;
|
|
67
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
68
|
+
kind: z.ZodLiteral<"stopped">;
|
|
69
|
+
}, z.core.$strip>], "kind">>;
|
|
45
70
|
}, z.core.$strip>], "kind">>;
|
|
46
71
|
git: z.ZodNullable<z.ZodObject<{
|
|
47
72
|
branch: z.ZodNullable<z.ZodString>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const metadata = {
|
|
2
|
-
description: "Show a past run from its run directory: its command, config file, working directory, the branch and commit it started from, start, how long it took and how it ended; where its command ran, on this machine or in a runner sandbox, with the sandbox's name, region, vCPUs, runtime and page in the Vercel dashboard, until when the run kept it running, with its Connect page while it runs, its control plane team and project, the run's base and the runner snapshot it started from, with its page; each Testserver sandbox it used, with its log viewer URL; the run logs it has, each with the storm runs logs command that prints it; its waterfall; and each test's final result, in color on a terminal that takes it. With --failed or --test, only the selected tests, how many of all they are, and each one's errors and test output, the last 8 MiB of what it printed, failure reports included. Without an id, the newest finished run of the storm.config.ts found from the working directory, or of every config with --all; pass the id `storm vitest` or `storm exec` printed when another run may have finished since. A run's test results are saved once it finishes. Changes nothing.",
|
|
2
|
+
description: "Show a past run from its run directory: its command, config file, working directory, the branch and commit it started from, start, how long it took and how it ended; where its command ran, on this machine or in a runner sandbox, with the sandbox's name, region, vCPUs, runtime and page in the Vercel dashboard, until when the run kept it running, with its Connect page while it runs, its control plane team and project, the run's base and the runner snapshot it started from, with a branch snapshot's branch and commit, and its page, and the branch snapshot the run saved, with its page, or why it saved none; each Testserver sandbox it used, with its log viewer URL; the run logs it has, each with the storm runs logs command that prints it; its waterfall; and each test's final result, in color on a terminal that takes it. With --failed or --test, only the selected tests, how many of all they are, and each one's errors and test output, the last 8 MiB of what it printed, failure reports included. Without an id, the newest finished run of the storm.config.ts found from the working directory, or of every config with --all; pass the id `storm vitest` or `storm exec` printed when another run may have finished since. A run's test results are saved once it finishes. Changes nothing.",
|
|
3
3
|
summary: "Show a past run and its tests.",
|
|
4
4
|
usages: ["[<id>] [--failed] [--test <TEXT>] [--all]"],
|
|
5
5
|
fields: {
|
|
@@ -28,8 +28,33 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
|
|
|
28
28
|
id: z.ZodString;
|
|
29
29
|
base: z.ZodString;
|
|
30
30
|
built: z.ZodBoolean;
|
|
31
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
32
|
+
head: z.ZodNullable<z.ZodString>;
|
|
31
33
|
url: z.ZodString;
|
|
32
34
|
}, z.core.$strip>>;
|
|
35
|
+
save: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
36
|
+
kind: z.ZodLiteral<"saved">;
|
|
37
|
+
snapshotId: z.ZodString;
|
|
38
|
+
base: z.ZodString;
|
|
39
|
+
branch: z.ZodString;
|
|
40
|
+
head: z.ZodString;
|
|
41
|
+
ms: z.ZodNumber;
|
|
42
|
+
sizeBytes: z.ZodNumber;
|
|
43
|
+
entryWritten: z.ZodBoolean;
|
|
44
|
+
url: z.ZodString;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
kind: z.ZodLiteral<"skipped">;
|
|
47
|
+
reason: z.ZodLiteral<"detached-head">;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
kind: z.ZodLiteral<"failed">;
|
|
50
|
+
step: z.ZodEnum<{
|
|
51
|
+
"save-snapshot": "save-snapshot";
|
|
52
|
+
scrub: "scrub";
|
|
53
|
+
}>;
|
|
54
|
+
message: z.ZodString;
|
|
55
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
56
|
+
kind: z.ZodLiteral<"stopped">;
|
|
57
|
+
}, z.core.$strip>], "kind">>;
|
|
33
58
|
}, z.core.$strip>], "kind">>;
|
|
34
59
|
git: z.ZodNullable<z.ZodObject<{
|
|
35
60
|
branch: z.ZodNullable<z.ZodString>;
|
|
@@ -231,11 +231,40 @@ function whereRows(shown) {
|
|
|
231
231
|
: [
|
|
232
232
|
[
|
|
233
233
|
"Snapshot",
|
|
234
|
-
[
|
|
234
|
+
[
|
|
235
|
+
`${snapshot.id} of ${short(snapshot.base)}, ${snapshot.built ? "built" : "reused"}${snapshot.branch === null || snapshot.head === null ? "" : `, branch ${snapshot.branch} at ${short(snapshot.head)}`}`,
|
|
236
|
+
` ${snapshot.url}`,
|
|
237
|
+
],
|
|
235
238
|
],
|
|
236
239
|
]),
|
|
240
|
+
...saveRows(where.save),
|
|
237
241
|
];
|
|
238
242
|
}
|
|
243
|
+
/** Each step of a branch snapshot's save, as a person names it. */
|
|
244
|
+
const SAVE_STEPS = { scrub: "scrub", "save-snapshot": "save" };
|
|
245
|
+
/** The row for the branch snapshot the run saved the runner sandbox as, or why it didn't; none without the flag. */
|
|
246
|
+
function saveRows(save) {
|
|
247
|
+
if (save === null)
|
|
248
|
+
return [];
|
|
249
|
+
switch (save.kind) {
|
|
250
|
+
case "saved":
|
|
251
|
+
return [
|
|
252
|
+
[
|
|
253
|
+
"Saved",
|
|
254
|
+
[
|
|
255
|
+
`${save.snapshotId} of ${short(save.base)}, branch ${save.branch} at ${short(save.head)}${save.entryWritten ? "" : ", not in the cache"}`,
|
|
256
|
+
` ${save.url}`,
|
|
257
|
+
],
|
|
258
|
+
],
|
|
259
|
+
];
|
|
260
|
+
case "skipped":
|
|
261
|
+
return [["Saved", { text: "nothing: HEAD was detached", tone: "muted" }]];
|
|
262
|
+
case "failed":
|
|
263
|
+
return [["Saved", { text: `nothing: the ${SAVE_STEPS[save.step]} failed: ${save.message}`, tone: "muted" }]];
|
|
264
|
+
case "stopped":
|
|
265
|
+
return [["Saved", { text: "nothing: the run stopped", tone: "muted" }]];
|
|
266
|
+
}
|
|
267
|
+
}
|
|
239
268
|
/**
|
|
240
269
|
* The row for the runner sandbox the run kept running, if it did: until when, in success while it still runs, with its
|
|
241
270
|
* Connect page in the Vercel dashboard, or muted once it has stopped.
|
|
@@ -22,6 +22,7 @@ export declare function command(cmd: CommandBuilder<StormApp>): import("@vercel/
|
|
|
22
22
|
}>>;
|
|
23
23
|
local: z.ZodDefault<z.ZodBoolean>;
|
|
24
24
|
rebuildSnapshot: z.ZodDefault<z.ZodBoolean>;
|
|
25
|
+
saveSnapshot: z.ZodDefault<z.ZodBoolean>;
|
|
25
26
|
showOutput: z.ZodDefault<z.ZodBoolean>;
|
|
26
27
|
keepSandbox: z.ZodOptional<z.ZodString>;
|
|
27
28
|
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -40,10 +41,35 @@ export declare function command(cmd: CommandBuilder<StormApp>): import("@vercel/
|
|
|
40
41
|
runner: z.ZodNullable<z.ZodObject<{
|
|
41
42
|
snapshotId: z.ZodString;
|
|
42
43
|
base: z.ZodString;
|
|
44
|
+
snapshotBranch: z.ZodNullable<z.ZodString>;
|
|
45
|
+
snapshotHead: z.ZodNullable<z.ZodString>;
|
|
43
46
|
built: z.ZodBoolean;
|
|
44
47
|
vcpus: z.ZodNumber;
|
|
45
48
|
region: z.ZodString;
|
|
46
49
|
runtime: z.ZodString;
|
|
50
|
+
buildMs: z.ZodNumber;
|
|
51
|
+
save: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
52
|
+
kind: z.ZodLiteral<"saved">;
|
|
53
|
+
snapshotId: z.ZodString;
|
|
54
|
+
base: z.ZodString;
|
|
55
|
+
branch: z.ZodString;
|
|
56
|
+
head: z.ZodString;
|
|
57
|
+
ms: z.ZodNumber;
|
|
58
|
+
sizeBytes: z.ZodNumber;
|
|
59
|
+
entryWritten: z.ZodBoolean;
|
|
60
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
+
kind: z.ZodLiteral<"skipped">;
|
|
62
|
+
reason: z.ZodLiteral<"detached-head">;
|
|
63
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
64
|
+
kind: z.ZodLiteral<"failed">;
|
|
65
|
+
step: z.ZodEnum<{
|
|
66
|
+
"save-snapshot": "save-snapshot";
|
|
67
|
+
scrub: "scrub";
|
|
68
|
+
}>;
|
|
69
|
+
message: z.ZodString;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
kind: z.ZodLiteral<"stopped">;
|
|
72
|
+
}, z.core.$strip>], "kind">>;
|
|
47
73
|
}, z.core.$strip>>;
|
|
48
74
|
timeline: z.ZodObject<{
|
|
49
75
|
startedAt: z.ZodString;
|
|
@@ -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";
|
|
@@ -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;
|