@cnc-tools/storm 0.7.0 → 0.8.1
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/cleanup.d.ts +3 -3
- package/dist/commands/exec/cleanup.js +1 -1
- package/dist/commands/exec/command.d.ts +771 -1
- package/dist/commands/exec/command.js +1 -1
- package/dist/commands/exec/live-view.js +3 -2
- package/dist/commands/exec/metadata.d.ts +1 -1
- package/dist/commands/exec/metadata.js +4 -0
- package/dist/commands/exec/mint-failed.d.ts +28 -0
- package/dist/commands/exec/outcomes.d.ts +476 -0
- package/dist/commands/exec/progress.js +3 -5
- package/dist/commands/exec/run-command.d.ts +2 -2
- package/dist/commands/exec/run-metadata.d.ts +1 -1
- package/dist/commands/exec/run-metadata.js +1 -1
- package/dist/commands/exec/tests-summary.d.ts +1 -1
- package/dist/commands/exec/tests-summary.js +1 -1
- package/dist/commands/runs/facts.d.ts +2 -2
- package/dist/commands/runs/facts.js +1 -1
- package/dist/commands/runs/list/command.d.ts +129 -1
- package/dist/commands/runs/list/command.js +1 -1
- package/dist/commands/runs/list/outcomes.d.ts +16 -0
- package/dist/commands/runs/list/outcomes.js +1 -1
- package/dist/commands/runs/logs/command.d.ts +263 -1
- package/dist/commands/runs/logs/command.js +1 -1
- package/dist/commands/runs/logs/outcomes.d.ts +105 -0
- package/dist/commands/runs/logs/outcomes.js +1 -1
- package/dist/commands/runs/show/command.d.ts +329 -1
- package/dist/commands/runs/show/command.js +1 -1
- package/dist/commands/runs/show/outcomes.d.ts +71 -0
- package/dist/commands/runs/show/outcomes.js +3 -3
- package/dist/commands/vitest/command.d.ts +886 -1
- package/dist/commands/vitest/command.js +1 -1
- package/dist/commands/vitest/metadata.d.ts +1 -1
- package/dist/commands/vitest/metadata.js +4 -0
- package/dist/commands/vitest/outcomes.d.ts +295 -0
- package/dist/config/errors.d.ts +73 -0
- package/dist/config/schema.d.ts +1 -1
- package/dist/config-file/define.d.ts +4 -3
- package/dist/config-file/define.js +1 -1
- package/dist/config-file/toolchain.js +1 -1
- package/dist/core/command-slots.d.ts +8 -2
- package/dist/core/command-slots.js +6 -2
- package/dist/core/index.d.ts +1 -1
- package/dist/credential/index.d.ts +1 -0
- package/dist/credential/index.js +1 -0
- package/dist/credential/settle.d.ts +20 -0
- package/dist/credential/target.d.ts +6 -0
- package/dist/credential/target.js +7 -0
- package/dist/resources/github/command.d.ts +54 -2
- package/dist/resources/github/config.js +1 -1
- package/dist/resources/github/index.js +1 -1
- package/dist/resources/github/resource.js +2 -2
- package/dist/resources/testserver/command.d.ts +208 -10
- package/dist/resources/testserver/command.js +7 -0
- package/dist/resources/testserver/commands/create/command.d.ts +810 -1
- package/dist/resources/testserver/commands/create/command.js +73 -23
- package/dist/resources/testserver/commands/create/metadata.js +6 -2
- package/dist/resources/testserver/commands/create/outcomes.d.ts +347 -0
- package/dist/resources/testserver/commands/create/outcomes.js +14 -1
- package/dist/resources/testserver/commands/list/command.d.ts +84 -1
- package/dist/resources/testserver/commands/list/command.js +1 -1
- package/dist/resources/testserver/commands/list/outcomes.d.ts +16 -0
- package/dist/resources/testserver/config.js +14 -4
- package/dist/resources/testserver/events.d.ts +11 -0
- package/dist/resources/testserver/index.js +8 -7
- package/dist/resources/testserver/lane.js +1 -0
- package/dist/resources/testserver/live/gateways.d.ts +2 -0
- package/dist/resources/testserver/live/gateways.js +16 -3
- package/dist/resources/testserver/pool/channels.d.ts +5 -2
- package/dist/resources/testserver/pool/channels.js +1 -1
- package/dist/resources/testserver/pool/create.d.ts +9 -2
- package/dist/resources/testserver/pool/create.js +8 -5
- package/dist/resources/testserver/pool/gateways.d.ts +6 -0
- package/dist/resources/testserver/pool/index.d.ts +1 -0
- package/dist/resources/testserver/pool/index.js +1 -0
- package/dist/resources/testserver/pool/live/pool-records.js +6 -2
- package/dist/resources/testserver/pool/pull-request.d.ts +96 -0
- package/dist/resources/testserver/pool/pull-request.js +118 -0
- package/dist/resources/testserver/pr-build-facts.d.ts +130 -0
- package/dist/resources/testserver/pr-build-facts.js +261 -0
- package/dist/resources/testserver/presentation.d.ts +2 -2
- package/dist/resources/testserver/presentation.js +13 -3
- package/dist/resources/testserver/provider.d.ts +16 -6
- package/dist/resources/testserver/provider.js +55 -16
- package/dist/resources/testserver/pull-request/gateways.d.ts +117 -0
- package/dist/resources/testserver/pull-request/gateways.js +5 -0
- package/dist/resources/testserver/pull-request/index.d.ts +5 -0
- package/dist/resources/testserver/pull-request/index.js +6 -0
- package/dist/resources/testserver/pull-request/live/github-rest.d.ts +28 -0
- package/dist/resources/testserver/pull-request/live/github-rest.js +114 -0
- package/dist/resources/testserver/pull-request/live/github-token-gateway.d.ts +12 -0
- package/dist/resources/testserver/pull-request/live/github-token-gateway.js +39 -0
- package/dist/resources/testserver/pull-request/live/pull-request-gateway.d.ts +10 -0
- package/dist/resources/testserver/pull-request/live/pull-request-gateway.js +27 -0
- package/dist/resources/testserver/pull-request/live/testserver-workflow-gateway.d.ts +21 -0
- package/dist/resources/testserver/pull-request/live/testserver-workflow-gateway.js +64 -0
- package/dist/resources/testserver/ran.d.ts +5 -0
- package/dist/resources/testserver/ran.js +19 -3
- package/dist/resources/testserver/resource.d.ts +5 -1
- package/dist/resources/testserver/resource.js +2 -2
- package/dist/resources/testserver/sandbox/build-reference.d.ts +38 -0
- package/dist/resources/testserver/sandbox/build-reference.js +79 -0
- package/dist/resources/testserver/sandbox/index.d.ts +1 -0
- package/dist/resources/testserver/sandbox/index.js +1 -0
- package/dist/resources.d.ts +265 -15
- package/dist/sdk/index.js +2 -2
- package/dist/story/command-line.d.ts +34 -0
- package/dist/story/command-line.js +100 -0
- package/dist/story/index.d.ts +1 -0
- package/dist/story/index.js +3 -2
- package/dist/vercel-cli/context.js +1 -1
- package/dist/vercel-cli/index.js +1 -1
- package/dist/vitest/config.js +2 -2
- package/dist/vitest/fixtures.d.ts +1 -1
- package/dist/vitest/fixtures.js +1 -1
- package/dist/vitest/index.js +3 -3
- package/dist/vitest/plan.js +1 -1
- package/package.json +2 -3
- package/skills/overview.md +2 -0
- package/skills/testserver-builds.md +82 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Command lines a harness splits without a shell: a story's command, and the executable a `*_BIN` variable names in
|
|
2
|
+
// place of the package's own, such as a port of the tool to another language. Pure.
|
|
3
|
+
import { isAbsolute, resolve } from "node:path";
|
|
4
|
+
/** A command line the harness can't split into words: the story or the variable wrote it. */
|
|
5
|
+
export class InvalidCommandLine extends Error {
|
|
6
|
+
name = "InvalidCommandLine";
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* `command` split into words as a POSIX shell splits them: whitespace separates words; single quotes keep everything
|
|
10
|
+
* up to the next single quote; double quotes keep everything up to the next unescaped double quote, where a backslash
|
|
11
|
+
* escapes `"`, `\`, `$` and a backtick; a backslash outside quotes escapes the next character. A shell operator or
|
|
12
|
+
* expansion outside quotes (`|`, `&`, `;`, `<`, `>`, `(`, `)`, `$`, a backtick, `*`, `?`, `[`, `~`, `#`) and an
|
|
13
|
+
* unclosed quote throw `InvalidCommandLine`, since the harness runs no shell.
|
|
14
|
+
*/
|
|
15
|
+
export function splitCommandLine(command) {
|
|
16
|
+
const words = [];
|
|
17
|
+
let word;
|
|
18
|
+
let index = 0;
|
|
19
|
+
const add = (text) => {
|
|
20
|
+
word = (word ?? "") + text;
|
|
21
|
+
};
|
|
22
|
+
while (index < command.length) {
|
|
23
|
+
const char = command[index] ?? "";
|
|
24
|
+
if (/\s/u.test(char)) {
|
|
25
|
+
if (word !== undefined)
|
|
26
|
+
words.push(word);
|
|
27
|
+
word = undefined;
|
|
28
|
+
index += 1;
|
|
29
|
+
}
|
|
30
|
+
else if (char === "'") {
|
|
31
|
+
const end = command.indexOf("'", index + 1);
|
|
32
|
+
if (end === -1)
|
|
33
|
+
throw new InvalidCommandLine(`${JSON.stringify(command)} has an unclosed single quote`);
|
|
34
|
+
add(command.slice(index + 1, end));
|
|
35
|
+
index = end + 1;
|
|
36
|
+
}
|
|
37
|
+
else if (char === '"') {
|
|
38
|
+
let text = "";
|
|
39
|
+
index += 1;
|
|
40
|
+
while (command[index] !== '"') {
|
|
41
|
+
if (index >= command.length) {
|
|
42
|
+
throw new InvalidCommandLine(`${JSON.stringify(command)} has an unclosed double quote`);
|
|
43
|
+
}
|
|
44
|
+
const next = command[index + 1] ?? "";
|
|
45
|
+
if (command[index] === "\\" && ['"', "\\", "$", "`"].includes(next)) {
|
|
46
|
+
text += next;
|
|
47
|
+
index += 2;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
text += command[index] ?? "";
|
|
51
|
+
index += 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
add(text);
|
|
55
|
+
index += 1;
|
|
56
|
+
}
|
|
57
|
+
else if (char === "\\") {
|
|
58
|
+
if (index + 1 >= command.length)
|
|
59
|
+
throw new InvalidCommandLine(`${JSON.stringify(command)} ends in a backslash`);
|
|
60
|
+
add(command[index + 1] ?? "");
|
|
61
|
+
index += 2;
|
|
62
|
+
}
|
|
63
|
+
else if ("|&;<>()$`*?[~#".includes(char)) {
|
|
64
|
+
throw new InvalidCommandLine(`${JSON.stringify(command)} has ${JSON.stringify(char)} outside quotes, and the harness runs no shell`);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
add(char);
|
|
68
|
+
index += 1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (word !== undefined)
|
|
72
|
+
words.push(word);
|
|
73
|
+
return words;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The executable `variable`'s value in `env` names, or `fallback` when it is unset or empty. The value is split as
|
|
77
|
+
* `splitCommandLine` splits a story's command: its first word is the program, and the rest come before the story's
|
|
78
|
+
* arguments. A program word with a `/` that isn't absolute resolves against `base`; a word without one is looked up on
|
|
79
|
+
* `PATH`. A value that doesn't split, or holds only whitespace, throws an error that names the variable.
|
|
80
|
+
*/
|
|
81
|
+
export function storyExecutable({ variable, env, fallback, base }) {
|
|
82
|
+
const commandLine = env[variable];
|
|
83
|
+
if (commandLine === undefined || commandLine === "")
|
|
84
|
+
return fallback;
|
|
85
|
+
let words;
|
|
86
|
+
try {
|
|
87
|
+
words = splitCommandLine(commandLine);
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
throw new Error(`${variable} ${errorText(error)}`, { cause: error });
|
|
91
|
+
}
|
|
92
|
+
const [program, ...args] = words;
|
|
93
|
+
if (program === undefined)
|
|
94
|
+
throw new Error(`${variable} ${JSON.stringify(commandLine)} names no program`);
|
|
95
|
+
const file = program.includes("/") && !isAbsolute(program) ? resolve(base, program) : program;
|
|
96
|
+
return { file, args };
|
|
97
|
+
}
|
|
98
|
+
function errorText(error) {
|
|
99
|
+
return error instanceof Error ? error.message : String(error);
|
|
100
|
+
}
|
package/dist/story/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { recordingDirectory, recordingPath, parseRecording, type ParsedStoryRecording, STORY_RECORDING_SCHEMA_VERSION, type StoryRecording, type StoryCall, type StoryIdentity, } from "./recording.ts";
|
|
2
2
|
export { type AnyStoryTool, type StoryAgent, type StoryAgents, type StoryHandles, type StoryHarness, type StorySession, type StoryTool, type StoryToolCall, storyTool, } from "./definition.ts";
|
|
3
|
+
export { InvalidCommandLine, splitCommandLine, type StoryExecutable, type StoryExecutableOptions, storyExecutable, } from "./command-line.ts";
|
|
3
4
|
export { StoryDivergenceError, StoryStaleError } from "./errors.ts";
|
|
4
5
|
export { createStory, type StoryFunction, type StoryHostOptions } from "./host.ts";
|
|
5
6
|
export type { StoryJson } from "./json.ts";
|
package/dist/story/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
// Story core, exported as `@
|
|
1
|
+
// Story core, exported as `@vercel/storm/story`: stories whose agents call tools, each call's observation kept in
|
|
2
2
|
// a recording beside the story file and compared on every later Vitest run. `README.md` beside this file is its design
|
|
3
3
|
// and authoring guide. It depends only on Node builtins, `zod`, and `vitest` (an optional peer dependency of
|
|
4
|
-
// `@
|
|
4
|
+
// `@vercel/storm`), and on nothing else in storm; `.oxlintrc.json` checks the boundary.
|
|
5
5
|
export { recordingDirectory, recordingPath, parseRecording, STORY_RECORDING_SCHEMA_VERSION, } from "./recording.js";
|
|
6
6
|
export { storyTool, } from "./definition.js";
|
|
7
|
+
export { InvalidCommandLine, splitCommandLine, storyExecutable, } from "./command-line.js";
|
|
7
8
|
export { StoryDivergenceError, StoryStaleError } from "./errors.js";
|
|
8
9
|
export { createStory } from "./host.js";
|
|
9
10
|
export { STORY_RECORD_VARIABLE } from "./mode.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The Vercel CLI driver's gateway seams: its Context (the process gateway and clock, which travel together), the
|
|
2
2
|
// live Context, and `createVercelCli`, which takes a Context. Tests build the same shape over the fake and a clock
|
|
3
|
-
// driven by hand. Not part of `@
|
|
3
|
+
// driven by hand. Not part of `@vercel/storm/vercel-cli`'s published surface.
|
|
4
4
|
import { systemVercelCliClock } from "./clock.js";
|
|
5
5
|
import { liveVercelCliProcessGateway } from "./live/process-gateway.js";
|
|
6
6
|
/** The live Context: real processes and the system clock. */
|
package/dist/vercel-cli/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// storm's Vercel CLI driver, exported as `@
|
|
1
|
+
// storm's Vercel CLI driver, exported as `@vercel/storm/vercel-cli`: runs the production `vercel` CLI
|
|
2
2
|
// against a test's proxy, as a default identity or the token a call names, with `--token`, a saved login or logged
|
|
3
3
|
// out, in directories the test's invocations share, and reports each invocation with tokens redacted. It builds on
|
|
4
4
|
// the SDK only through `src/sdk/index.ts`, imports neither the Vitest adapter nor vitest, and depends otherwise only
|
package/dist/vitest/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// storm's Vitest config helpers, exported as `@
|
|
2
|
-
// this, never `@
|
|
1
|
+
// storm's Vitest config helpers, exported as `@vercel/storm/vitest/config`. A `vitest.config.ts` imports
|
|
2
|
+
// this, never `@vercel/storm/vitest`: loading the adapter's `test` extends vitest's, which throws inside a config
|
|
3
3
|
// file. So nothing here imports `./fixtures.ts` or vitest.
|
|
4
4
|
import { readRunPayload, RUN_PAYLOAD_VARIABLE, TESTSERVER_CONNECTION_FAILURE } from "../sdk/index.js";
|
|
5
5
|
import { sandboxCount } from "./sandbox.js";
|
|
@@ -18,7 +18,7 @@ declare module "vitest" {
|
|
|
18
18
|
* Every test, whatever it asks for, appends test events to the run payload's `testEvents` file when it names one:
|
|
19
19
|
* the file's start and finish, each attempt at a test, its start and how it ended, and each container start and how
|
|
20
20
|
* long it took. A retried test reports each attempt; its final result comes from `stormReporter`
|
|
21
|
-
* (`@
|
|
21
|
+
* (`@vercel/storm/vitest/config`), in vitest's main process. `stormEvents`, `stormFileEvents` and
|
|
22
22
|
* `stormTestEvents` are the adapter's own, which tests don't use.
|
|
23
23
|
*
|
|
24
24
|
* - `verbose` (per worker): whether the run is verbose, under a run's `--verbose`, from the run payload. Then
|
package/dist/vitest/fixtures.js
CHANGED
|
@@ -123,7 +123,7 @@ const fixtures = vitestTest
|
|
|
123
123
|
* Every test, whatever it asks for, appends test events to the run payload's `testEvents` file when it names one:
|
|
124
124
|
* the file's start and finish, each attempt at a test, its start and how it ended, and each container start and how
|
|
125
125
|
* long it took. A retried test reports each attempt; its final result comes from `stormReporter`
|
|
126
|
-
* (`@
|
|
126
|
+
* (`@vercel/storm/vitest/config`), in vitest's main process. `stormEvents`, `stormFileEvents` and
|
|
127
127
|
* `stormTestEvents` are the adapter's own, which tests don't use.
|
|
128
128
|
*
|
|
129
129
|
* - `verbose` (per worker): whether the run is verbose, under a run's `--verbose`, from the run payload. Then
|
package/dist/vitest/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// storm's Vitest adapter, exported as `@
|
|
1
|
+
// storm's Vitest adapter, exported as `@vercel/storm/vitest`: vitest's `test` extended with fixtures for
|
|
2
2
|
// the worker's Testserver sandbox, a container (shared by a test file's tests unless `containerScope` is `'test'`),
|
|
3
3
|
// its seeder and its proxy. A `vitest.config.ts` can't import it, since extending vitest's `test` throws there;
|
|
4
|
-
// `testserverWorkers` is in `./config.ts` (`@
|
|
4
|
+
// `testserverWorkers` is in `./config.ts` (`@vercel/storm/vitest/config`) for that reason, and isn't re-exported
|
|
5
5
|
// here. It imports the SDK only through `src/sdk/index.ts`, and the SDK never imports it. Besides Node builtins and
|
|
6
|
-
// the SDK, it depends only on `vitest`, an optional peer dependency of `@
|
|
6
|
+
// the SDK, it depends only on `vitest`, an optional peer dependency of `@vercel/storm`; `.oxlintrc.json` checks
|
|
7
7
|
// the boundary.
|
|
8
8
|
export { CONTAINER_SCOPE } from "./container-scope.js";
|
|
9
9
|
export { test } from "./fixtures.js";
|
package/dist/vitest/plan.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Planning a Vitest run before any Testserver sandbox is leased, exported as `@
|
|
1
|
+
// Planning a Vitest run before any Testserver sandbox is leased, exported as `@vercel/storm/vitest/plan`: finding
|
|
2
2
|
// `vitest` in `node_modules/.bin`, counting the tests `vitest run <args>` would run, sizing the Testserver sandboxes
|
|
3
3
|
// for them, and the `vitest run` argv. It is the adapter's one entry point for the CLI: `storm vitest` imports it
|
|
4
4
|
// and nothing else of the adapter. Like `config.ts`, it imports neither `./fixtures.ts` nor vitest: the CLI and a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cnc-tools/storm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Run a command against Vercel Testserver sandboxes",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -90,8 +90,7 @@
|
|
|
90
90
|
"registry": "https://registry.npmjs.org/"
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@
|
|
94
|
-
"@vercel/clinkr": "npm:clinkr@^0.8.2",
|
|
93
|
+
"@vercel/clinkr": "npm:clinkr@^0.10.0",
|
|
95
94
|
"@vercel/sandbox": "3.9.0",
|
|
96
95
|
"zod": "^4.6.5"
|
|
97
96
|
},
|
package/skills/overview.md
CHANGED
|
@@ -13,6 +13,7 @@ commands: all
|
|
|
13
13
|
- A **run** is one `storm vitest` or one `storm exec`. It runs one command: `vitest run` for `storm vitest`, the command after `--` for `storm exec`.
|
|
14
14
|
- A **runner run** runs the command in a **runner sandbox**, a Vercel Sandbox. This is the default.
|
|
15
15
|
- A **local run** runs the command on this machine. Add `--local` to make a local run.
|
|
16
|
+
- A **build** is one version of Testserver. A run uses `stable` unless you give `--testserver-build`.
|
|
16
17
|
- A **run id** is the name of a run, such as `20261103T192655-8277`. It is the start time of the run in UTC and a short suffix. `storm vitest` and `storm exec` print it at the end, in the `logs` line. With `--json`, the result gives it as `runId`.
|
|
17
18
|
- A **run directory** is the directory where a run writes what it did, on the machine that started the run. This is true for a runner run and for a local run. Its name is the run id. Do not read its files directly. Use the `runs` commands.
|
|
18
19
|
- A run is **active** while it goes on. A run is **finished** when it has ended and saved its test results. `runs show` shows test results only for a finished run.
|
|
@@ -31,3 +32,4 @@ commands: all
|
|
|
31
32
|
## Other skills
|
|
32
33
|
|
|
33
34
|
- To read the output and the errors of a run, run `storm skills get read-run-output`.
|
|
35
|
+
- To choose a build, or to run against a vercel/api pull request, run `storm skills get testserver-builds`.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testserver-builds
|
|
3
|
+
description: Choose the Testserver build that a run uses. Run against the build of a vercel/api pull request when a change needs API code that is not merged.
|
|
4
|
+
commands: [vitest, exec]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Testserver builds
|
|
8
|
+
|
|
9
|
+
Use this skill to choose the Testserver build of a run. Use it also when a change needs vercel/api code that is not merged.
|
|
10
|
+
|
|
11
|
+
## Concepts
|
|
12
|
+
|
|
13
|
+
- A **build** is one version of Testserver, such as `20261105T041247Z__65203e5`. Its name is a UTC time and a short commit.
|
|
14
|
+
- A **build channel** is a name that moves from build to build.
|
|
15
|
+
- `stable` is the default. A cron job in vercel/front promotes the newest main build to `stable` every 20 minutes, when the Testserver tests of vercel/front pass.
|
|
16
|
+
- `latest_main` is the newest build of the `main` branch of vercel/api.
|
|
17
|
+
- A **PR build** is a build of one vercel/api pull request. The `Testserver` workflow of vercel/api makes one for each push to the pull request. It builds the pull request merged into its base branch. In a stack, the base branch is the pull request below. Thus the PR build of the top pull request contains all the pull requests of the stack.
|
|
18
|
+
- The **head commit** of a pull request is the newest commit on its branch, such as `87343a6781b4f540893958e49e8eedaf5bb2b4ad`. Each PR build comes from the workflow run for one head commit.
|
|
19
|
+
- A **PR build reference** gives a vercel/api pull request as the build. Write it as `pr:<N>`, such as `pr:104196`, or as the URL of the pull request, such as `https://github.com/vercel/api/pull/104196`. storm changes the URL to `pr:<N>`.
|
|
20
|
+
|
|
21
|
+
A run with `pr:<N>` uses a PR build of the head commit of the pull request. If no PR build of that head commit exists, the run stops. It does not wait, and it does not use a PR build of an older head commit.
|
|
22
|
+
|
|
23
|
+
storm reads the head commit from GitHub on this machine. If the pool has a Testserver sandbox that was made for `pr:<N>` on the head commit, storm uses the PR build of the newest such Testserver sandbox. It does this only if that PR build has not expired. Then storm reads only the head commit from GitHub. If the workflow ran again on the same head commit, storm can use an older PR build of that head commit from the pool. If the pool has no usable PR build, storm reads the runs of the `Testserver` workflow and uses the newest PR build of the head commit. storm uses the first GitHub token that it finds: `GITHUB_TOKEN`, `GH_TOKEN`, or the output of `gh auth token`. The token must be able to read vercel/api and its Actions. The token stays on this machine.
|
|
24
|
+
|
|
25
|
+
## Choose a build
|
|
26
|
+
|
|
27
|
+
- Use `stable` for the required checks and in `storm.config.ts`.
|
|
28
|
+
- Use `latest_main` for vercel/api code that is merged but is not in `stable` yet.
|
|
29
|
+
- Use `pr:<N>` when the change needs vercel/api code in an open pull request.
|
|
30
|
+
- Do not write a PR build reference in `storm.config.ts`. Do not commit a PR build reference.
|
|
31
|
+
|
|
32
|
+
## Know when you need a PR build
|
|
33
|
+
|
|
34
|
+
- Tests skip with a note that a service "is not on this Testserver build". For example: `api-domains-registrar is not on this Testserver build`. The build does not have the service.
|
|
35
|
+
- Tests fail on vercel/api behavior that an open vercel/api pull request adds.
|
|
36
|
+
|
|
37
|
+
In each case, find the vercel/api pull request before you change the tests.
|
|
38
|
+
|
|
39
|
+
## Run against a vercel/api pull request
|
|
40
|
+
|
|
41
|
+
1. Find the number of the pull request. In a stack, use the top pull request. For example, run `gh pr list --repo vercel/api --author @me --json number,headRefName,baseRefName`. Or run `gh pr view <branch> --repo vercel/api --json number,headRefOid`.
|
|
42
|
+
2. Run `gh pr checks <N> --repo vercel/api`. Make sure that `Bundle & Publish` passed on the newest push.
|
|
43
|
+
3. Run `storm vitest --testserver-build pr:<N> --json`. Or run `storm exec --testserver-build pr:<N> --json -- <command>`.
|
|
44
|
+
4. Read `resources.testserverPool.build` in the result. Make sure that `pullRequest.headSha` is the head commit of the pull request. `resolved` is the PR build.
|
|
45
|
+
5. After a new push to the pull request, wait for `Bundle & Publish`. Then run the same command again. The run finds the new PR build. Do not change the command.
|
|
46
|
+
|
|
47
|
+
To make one Testserver sandbox on the PR build, run `storm pool create --build pr:<N> --ttl 10m --json`. Read `pullRequest.headSha` and `resolvedBuild`. To see the Testserver sandboxes in the pool, run `storm pool list --json`. Their `requestedBuild` is `pr:<N>`. For the options of these two commands, run `storm pool create --help` and `storm pool list --help`.
|
|
48
|
+
|
|
49
|
+
With `--testserver-no-create`, a run with `pr:<N>` uses only the Testserver sandboxes in the pool on that PR build. It does not make new ones.
|
|
50
|
+
|
|
51
|
+
To make runs more reliable, for example before a demo, make the Testserver sandboxes first. Run `storm pool create --build pr:<N> --json` one time for each Testserver sandbox. Then a run with `pr:<N>` reads only the head commit from GitHub. Its line `Build: …` ends with `(from the pool)`. A Testserver sandbox lives for its TTL, 5 hours or less. After a new push to the pull request, the runs do not use these Testserver sandboxes.
|
|
52
|
+
|
|
53
|
+
## If a run stops
|
|
54
|
+
|
|
55
|
+
Read `reason` in the error document. Read the facts of the error in `data`.
|
|
56
|
+
|
|
57
|
+
- `pull_request_unreadable`: storm could not read the pull request from GitHub. Read `data.kind` and `data.tokenOrigin`.
|
|
58
|
+
1. Run `gh auth status`.
|
|
59
|
+
2. Run `gh auth login`, or set `GITHUB_TOKEN` to a token that can read vercel/api.
|
|
60
|
+
3. Run the command again.
|
|
61
|
+
- `pr_build_not_ready`: the newest PR build is not from the head commit. Read `data.headSha` and `data.newest`.
|
|
62
|
+
1. Run `gh pr checks <N> --repo vercel/api`.
|
|
63
|
+
2. If `Bundle & Publish` runs, wait until it passes. Then run the command again.
|
|
64
|
+
3. If `Bundle & Publish` failed, read its log, and tell the user. Do not run the command again until a PR build passes.
|
|
65
|
+
- `pr_build_expired`: the PR build is 7 days old or more. The Testserver control plane does not use it. Push to the pull request, or run its `Testserver` workflow again. Then run the command again.
|
|
66
|
+
- `pr_builds_unlisted`: storm could not read the runs of the `Testserver` workflow from GitHub. Read `data.failure`.
|
|
67
|
+
1. Run `gh auth status`. Make sure that the token can read vercel/api.
|
|
68
|
+
2. Run the command again one time. If it fails again, tell the user.
|
|
69
|
+
|
|
70
|
+
Do not give a build name to get past one of these errors, unless the user tells you to.
|
|
71
|
+
|
|
72
|
+
## Land the change
|
|
73
|
+
|
|
74
|
+
1. Merge the vercel/api pull request or stack.
|
|
75
|
+
2. Wait until `stable` contains the change.
|
|
76
|
+
1. Run `gh pr view <N> --repo vercel/api --json mergedAt`.
|
|
77
|
+
2. Run `storm pool create --build stable --ttl 10m --json`, and read `resolvedBuild`.
|
|
78
|
+
3. The time at the start of `resolvedBuild` is in UTC. If it is after `mergedAt`, `stable` contains the change. If you are not sure, ask the user.
|
|
79
|
+
3. Run the required check of the client pull request again, on `stable`.
|
|
80
|
+
4. Merge the client pull request.
|
|
81
|
+
|
|
82
|
+
Do not merge the client pull request while its tests pass only on `pr:<N>`.
|