@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.
- 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 +797 -1
- package/dist/commands/exec/command.js +1 -1
- package/dist/commands/exec/live-view.js +32 -15
- package/dist/commands/exec/metadata.d.ts +5 -2
- 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 +526 -0
- package/dist/commands/exec/outcomes.js +9 -0
- package/dist/commands/exec/progress.d.ts +14 -2
- package/dist/commands/exec/progress.js +57 -14
- package/dist/commands/exec/run-command.d.ts +10 -4
- package/dist/commands/exec/run-command.js +41 -8
- package/dist/commands/exec/run-metadata.d.ts +6 -3
- package/dist/commands/exec/run-metadata.js +6 -3
- package/dist/commands/exec/run-record.d.ts +83 -4
- package/dist/commands/exec/run-record.js +49 -1
- package/dist/commands/exec/tests-summary.d.ts +1 -1
- package/dist/commands/exec/tests-summary.js +1 -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 +154 -1
- package/dist/commands/runs/list/command.js +1 -1
- package/dist/commands/runs/list/outcomes.d.ts +41 -0
- 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/show/command.d.ts +354 -1
- package/dist/commands/runs/show/command.js +1 -1
- package/dist/commands/runs/show/metadata.js +1 -1
- package/dist/commands/runs/show/outcomes.d.ts +96 -0
- package/dist/commands/runs/show/outcomes.js +30 -1
- package/dist/commands/vitest/command.d.ts +912 -1
- package/dist/commands/vitest/command.js +1 -1
- package/dist/commands/vitest/metadata.d.ts +5 -2
- package/dist/commands/vitest/metadata.js +4 -0
- package/dist/commands/vitest/outcomes.d.ts +320 -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/events.d.ts +9 -7
- package/dist/core/index.d.ts +1 -1
- 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/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 +808 -1
- package/dist/resources/testserver/commands/create/command.js +64 -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 +9 -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 +6 -2
- package/dist/resources/testserver/pool/create.js +6 -5
- package/dist/resources/testserver/pool/index.d.ts +1 -0
- package/dist/resources/testserver/pool/index.js +1 -0
- package/dist/resources/testserver/pool/pull-request.d.ts +89 -0
- package/dist/resources/testserver/pool/pull-request.js +85 -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 +12 -3
- package/dist/resources/testserver/provider.d.ts +16 -6
- package/dist/resources/testserver/provider.js +46 -15
- 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/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/sdk/index.js +2 -2
- package/dist/story/align.d.ts +1 -1
- package/dist/story/align.js +1 -1
- package/dist/story/command-line.d.ts +34 -0
- package/dist/story/command-line.js +100 -0
- 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 +2 -1
- package/dist/story/index.js +6 -5
- 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/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 +3 -3
- package/skills/overview.md +2 -0
- package/skills/testserver-builds.md +80 -0
- package/dist/story/artifact.d.ts +0 -60
- package/dist/story/live/artifact-gateway.d.ts +0 -2
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,80 @@
|
|
|
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 the newest PR build of the head commit of the pull request. If that PR build does not exist, the run stops. It does not wait, and it does not use an older PR build.
|
|
22
|
+
|
|
23
|
+
storm reads the head commit and the runs of the `Testserver` workflow from GitHub on this machine. It 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
|
+
## If a run stops
|
|
52
|
+
|
|
53
|
+
Read `reason` in the error document. Read the facts of the error in `data`.
|
|
54
|
+
|
|
55
|
+
- `pull_request_unreadable`: storm could not read the pull request from GitHub. Read `data.kind` and `data.tokenOrigin`.
|
|
56
|
+
1. Run `gh auth status`.
|
|
57
|
+
2. Run `gh auth login`, or set `GITHUB_TOKEN` to a token that can read vercel/api.
|
|
58
|
+
3. Run the command again.
|
|
59
|
+
- `pr_build_not_ready`: the newest PR build is not from the head commit. Read `data.headSha` and `data.newest`.
|
|
60
|
+
1. Run `gh pr checks <N> --repo vercel/api`.
|
|
61
|
+
2. If `Bundle & Publish` runs, wait until it passes. Then run the command again.
|
|
62
|
+
3. If `Bundle & Publish` failed, read its log, and tell the user. Do not run the command again until a PR build passes.
|
|
63
|
+
- `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.
|
|
64
|
+
- `pr_builds_unlisted`: storm could not read the runs of the `Testserver` workflow from GitHub. Read `data.failure`.
|
|
65
|
+
1. Run `gh auth status`. Make sure that the token can read vercel/api.
|
|
66
|
+
2. Run the command again one time. If it fails again, tell the user.
|
|
67
|
+
|
|
68
|
+
Do not give a build name to get past one of these errors, unless the user tells you to.
|
|
69
|
+
|
|
70
|
+
## Land the change
|
|
71
|
+
|
|
72
|
+
1. Merge the vercel/api pull request or stack.
|
|
73
|
+
2. Wait until `stable` contains the change.
|
|
74
|
+
1. Run `gh pr view <N> --repo vercel/api --json mergedAt`.
|
|
75
|
+
2. Run `storm pool create --build stable --ttl 10m --json`, and read `resolvedBuild`.
|
|
76
|
+
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.
|
|
77
|
+
3. Run the required check of the client pull request again, on `stable`.
|
|
78
|
+
4. Merge the client pull request.
|
|
79
|
+
|
|
80
|
+
Do not merge the client pull request while its tests pass only on `pr:<N>`.
|
package/dist/story/artifact.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { type StoryJson } from "./json.ts";
|
|
2
|
-
/** The artifact format this version of story writes and reads. */
|
|
3
|
-
export declare const STORY_ARTIFACT_SCHEMA_VERSION = 1;
|
|
4
|
-
/** Which story an artifact belongs to: the story file's name (no directory) and the story's full test name. */
|
|
5
|
-
export interface StoryIdentity {
|
|
6
|
-
readonly file: string;
|
|
7
|
-
readonly name: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* One tool call: the agent, the tool, the input the tool ran with (after its schema parsed it), and what its
|
|
11
|
-
* `observe` returned. (agent, tool, input) is the call's key.
|
|
12
|
-
*/
|
|
13
|
-
export interface StoryCall {
|
|
14
|
-
readonly agent: string;
|
|
15
|
-
readonly tool: string;
|
|
16
|
-
readonly input: StoryJson;
|
|
17
|
-
readonly observation: StoryJson;
|
|
18
|
-
}
|
|
19
|
-
/** One story's artifact. */
|
|
20
|
-
export interface StoryArtifact {
|
|
21
|
-
readonly schemaVersion: typeof STORY_ARTIFACT_SCHEMA_VERSION;
|
|
22
|
-
readonly story: StoryIdentity;
|
|
23
|
-
readonly calls: readonly StoryCall[];
|
|
24
|
-
}
|
|
25
|
-
/** An artifact's text, read back: the artifact, or why it can't be one. */
|
|
26
|
-
export type ParsedStoryArtifact = {
|
|
27
|
-
readonly ok: true;
|
|
28
|
-
readonly artifact: StoryArtifact;
|
|
29
|
-
} | {
|
|
30
|
-
readonly ok: false;
|
|
31
|
-
readonly problem: string;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* The directory that holds a story file's artifacts: `<story file dir>/__story__/<story file name>`
|
|
35
|
-
* (`__story__/slot-surface.story.test.ts`). Each story file has a directory of its own, so the path alone says which
|
|
36
|
-
* file owns an artifact, whatever the artifact holds.
|
|
37
|
-
*/
|
|
38
|
-
export declare function artifactDirectory(storyFile: string): string;
|
|
39
|
-
/**
|
|
40
|
-
* Where a story's artifact lives: `<artifactDirectory>/<slug>-<id8>.json`. The slug is the story's name for people,
|
|
41
|
-
* cut to 80 characters; `id8`, the first 8 hex characters of the SHA-256 of the canonical JSON of
|
|
42
|
-
* `{ file, story }` (the file's name and the story's full name), keeps two stories whose names slug alike apart.
|
|
43
|
-
*/
|
|
44
|
-
export declare function artifactPath(storyFile: string, story: string): string;
|
|
45
|
-
/**
|
|
46
|
-
* `text` lowercased, each run of characters other than ASCII letters and digits replaced by one `-`, with no `-` at
|
|
47
|
-
* either end, cut to `max` characters; `story` when nothing is left.
|
|
48
|
-
*/
|
|
49
|
-
export declare function slugify(text: string, max: number): string;
|
|
50
|
-
/**
|
|
51
|
-
* The artifact's text: its fields in a fixed order (`schemaVersion`, `story`, `calls`, and each call's `agent`,
|
|
52
|
-
* `tool`, `input`, `observation`), each input and observation's keys sorted, indented by 2 spaces, with a trailing
|
|
53
|
-
* newline. The same artifact always gives the same bytes.
|
|
54
|
-
*/
|
|
55
|
-
export declare function serializeArtifact(artifact: StoryArtifact): string;
|
|
56
|
-
/**
|
|
57
|
-
* `text` as an artifact, or the problem: it isn't JSON, its `schemaVersion` isn't 1, or its fields don't have the
|
|
58
|
-
* artifact's shape (unknown fields included).
|
|
59
|
-
*/
|
|
60
|
-
export declare function parseArtifact(text: string): ParsedStoryArtifact;
|