@cnc-tools/storm 0.5.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/combine-errors.js +2 -2
- package/dist/commands/dashboard.js +1 -1
- package/dist/commands/{run → exec}/cleanup.d.ts +1 -1
- package/dist/commands/{run → exec}/cleanup.js +1 -1
- package/dist/commands/{run/outcomes.d.ts → exec/command.d.ts} +103 -112
- package/dist/commands/exec/command.js +23 -0
- package/dist/commands/{run → exec}/job-summary.d.ts +5 -1
- package/dist/commands/{run → exec}/job-summary.js +5 -2
- package/dist/commands/{run → exec}/live-view.js +29 -13
- package/dist/commands/exec/metadata.d.ts +69 -0
- package/dist/commands/exec/metadata.js +55 -0
- package/dist/commands/{run → exec}/mint-failed.js +4 -4
- package/dist/commands/exec/outcomes.d.ts +664 -0
- package/dist/commands/exec/outcomes.js +347 -0
- package/dist/commands/{run → exec}/progress.d.ts +14 -2
- package/dist/commands/{run → exec}/progress.js +54 -9
- package/dist/commands/exec/run-command.d.ts +227 -0
- package/dist/commands/exec/run-command.js +696 -0
- package/dist/commands/exec/run-metadata.d.ts +59 -0
- package/dist/commands/exec/run-metadata.js +61 -0
- package/dist/commands/{run → exec}/run-record.d.ts +110 -5
- package/dist/commands/{run → exec}/run-record.js +57 -1
- package/dist/commands/exec/testserver-flags.d.ts +48 -0
- package/dist/commands/exec/testserver-flags.js +80 -0
- package/dist/commands/{run → exec}/view.js +36 -4
- package/dist/commands/runs/facts.d.ts +25 -0
- package/dist/commands/runs/facts.js +38 -5
- package/dist/commands/runs/list/command.d.ts +25 -0
- package/dist/commands/runs/list/outcomes.d.ts +25 -0
- package/dist/commands/runs/logs/metadata.js +1 -1
- package/dist/commands/runs/logs/outcomes.js +4 -1
- package/dist/commands/runs/past-run.d.ts +2 -2
- package/dist/commands/runs/past-run.js +2 -2
- package/dist/commands/runs/show/command.d.ts +25 -0
- package/dist/commands/runs/show/metadata.js +2 -2
- package/dist/commands/runs/show/outcomes.d.ts +25 -0
- package/dist/commands/runs/show/outcomes.js +37 -5
- package/dist/commands/vitest/command.d.ts +325 -0
- package/dist/commands/vitest/command.js +138 -0
- package/dist/commands/vitest/metadata.d.ts +69 -0
- package/dist/commands/vitest/metadata.js +35 -0
- package/dist/commands/vitest/outcomes.d.ts +298 -0
- package/dist/commands/vitest/outcomes.js +77 -0
- package/dist/config/index.d.ts +2 -1
- package/dist/config/index.js +1 -0
- package/dist/config/resolve.d.ts +3 -3
- package/dist/config/resolve.js +3 -3
- package/dist/config/resource-config.d.ts +2 -2
- package/dist/config/schema.d.ts +1 -1
- package/dist/config/set.d.ts +15 -4
- package/dist/config/set.js +28 -12
- package/dist/config-file/define.d.ts +8 -6
- package/dist/context.d.ts +6 -3
- package/dist/context.js +4 -2
- package/dist/core/command-provider.d.ts +1 -1
- package/dist/core/events.d.ts +9 -7
- package/dist/core/presentation.js +1 -1
- package/dist/core/presentations.js +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/resources/testserver/command.d.ts +1 -1
- package/dist/resources/testserver/command.js +1 -1
- package/dist/resources/testserver/config.d.ts +1 -1
- package/dist/resources/testserver/config.js +3 -2
- package/dist/resources/testserver/credential-facts.js +1 -1
- package/dist/resources/testserver/resource.d.ts +2 -2
- package/dist/resources/testserver/sandbox/create.d.ts +2 -2
- package/dist/resources/testserver/sandbox/create.js +2 -2
- package/dist/resources.d.ts +9 -6
- package/dist/resources.js +3 -3
- 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 +1 -1
- package/dist/sdk/payload/payload.d.ts +2 -2
- package/dist/sdk/payload/payload.js +2 -2
- 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/dist/vercel-cli/driver.d.ts +1 -1
- package/dist/vercel-cli/entry.d.ts +1 -1
- package/dist/vercel-cli/entry.js +1 -1
- package/dist/vercel-cli/verbose.d.ts +2 -2
- package/dist/vercel-cli/verbose.js +2 -2
- package/dist/vitest/config.d.ts +5 -5
- package/dist/vitest/config.js +5 -5
- package/dist/vitest/find-vitest.d.ts +7 -0
- package/dist/vitest/find-vitest.js +28 -0
- package/dist/vitest/fixtures.d.ts +2 -2
- package/dist/vitest/fixtures.js +3 -3
- package/dist/vitest/gateways.d.ts +37 -6
- package/dist/vitest/gateways.js +3 -2
- package/dist/vitest/live/list-gateway.d.ts +7 -3
- package/dist/vitest/live/list-gateway.js +55 -8
- package/dist/vitest/plan.d.ts +41 -8
- package/dist/vitest/plan.js +47 -16
- package/dist/vitest/sandbox.d.ts +1 -1
- package/dist/vitest/sandbox.js +1 -1
- package/dist/vitest/test-events.d.ts +2 -2
- package/dist/vitest/test-events.js +3 -3
- package/dist/vitest/test-results.d.ts +1 -1
- package/dist/vitest/test-results.js +1 -1
- package/dist/vitest/types.d.ts +1 -1
- package/package.json +2 -2
- package/skills/overview.md +5 -4
- package/skills/read-run-output.md +1 -1
- package/dist/commands/run/command.d.ts +0 -327
- package/dist/commands/run/command.js +0 -620
- package/dist/commands/run/metadata.d.ts +0 -47
- package/dist/commands/run/metadata.js +0 -83
- package/dist/commands/run/outcomes.js +0 -332
- package/dist/story/artifact.d.ts +0 -60
- package/dist/story/live/artifact-gateway.d.ts +0 -2
- /package/dist/commands/{run → exec}/live-view.d.ts +0 -0
- /package/dist/commands/{run → exec}/mint-failed.d.ts +0 -0
- /package/dist/commands/{run → exec}/redaction.d.ts +0 -0
- /package/dist/commands/{run → exec}/redaction.js +0 -0
- /package/dist/commands/{run → exec}/run-collector.d.ts +0 -0
- /package/dist/commands/{run → exec}/run-collector.js +0 -0
- /package/dist/commands/{run → exec}/tests-summary.d.ts +0 -0
- /package/dist/commands/{run → exec}/tests-summary.js +0 -0
- /package/dist/commands/{run → exec}/text.d.ts +0 -0
- /package/dist/commands/{run → exec}/text.js +0 -0
- /package/dist/commands/{run → exec}/view.d.ts +0 -0
- /package/dist/commands/{run → exec}/waterfall.d.ts +0 -0
- /package/dist/commands/{run → exec}/waterfall.js +0 -0
- /package/dist/commands/{run → exec}/worker-chart.d.ts +0 -0
- /package/dist/commands/{run → exec}/worker-chart.js +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** The flags every run takes, as a usage line names them, before the command's own arguments. */
|
|
2
|
+
export declare const RUN_USAGE_FLAGS = "[--testserver-sandboxes <N>] [--testserver-build <BUILD>] [--testserver-min-time-left <DURATION>] [--testserver-ttl <DURATION> | --testserver-no-create] [--set <KEY=VALUE>]... [--credential <SOURCE>] [--scope <TEAM> --project <PROJECT>] [--local | [--rebuild-snapshot] [--save-snapshot] [--show-output] [--keep-sandbox <DURATION>]] [--verbose]";
|
|
3
|
+
/** The field descriptions of the flags every run takes. */
|
|
4
|
+
export declare const RUN_FIELDS: {
|
|
5
|
+
readonly testserverSandboxes: {
|
|
6
|
+
readonly valueLabel: "N";
|
|
7
|
+
readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1. Gives the run a Testserver side.";
|
|
8
|
+
};
|
|
9
|
+
readonly testserverBuild: {
|
|
10
|
+
readonly valueLabel: "BUILD";
|
|
11
|
+
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.";
|
|
12
|
+
};
|
|
13
|
+
readonly testserverMinTimeLeft: {
|
|
14
|
+
readonly valueLabel: "DURATION";
|
|
15
|
+
readonly description: "The least time left a Testserver sandbox from the pool needs, in whole minutes or hours (30m, 2h), overriding resources.testserverPool.minTimeLeft in storm.config.ts; default 30m. Gives the run a Testserver side.";
|
|
16
|
+
};
|
|
17
|
+
readonly testserverTtl: {
|
|
18
|
+
readonly valueLabel: "DURATION";
|
|
19
|
+
readonly description: "How long each Testserver sandbox the run creates lives, 10m to 5h and longer than minTimeLeft, overriding resources.testserverPool.ttl in storm.config.ts; default 5h. Not with noCreate. Gives the run a Testserver side.";
|
|
20
|
+
};
|
|
21
|
+
readonly testserverNoCreate: {
|
|
22
|
+
readonly description: "Run only on Testserver sandboxes already in the pool, never minting for Testserver or creating: needs no --scope or --project with --local, and takes no --testserver-ttl. Turns on resources.testserverPool.noCreate whatever storm.config.ts says; without it, the file's noCreate, default false, applies. Gives the run a Testserver side.";
|
|
23
|
+
};
|
|
24
|
+
readonly set: {
|
|
25
|
+
readonly valueLabel: "KEY=VALUE";
|
|
26
|
+
readonly description: "Set a resource's option for this run by its key path in storm.config.ts, resources.<name>.<option>, overriding the file and the default; repeat it for each option. The key paths: resources.githubFixtureRepo.repo, the GitHub repository as owner/name, required; resources.githubFixtureRepo.tokenEnv, the host environment variable holding its token, required; resources.githubFixtureRepo.optional, true or false, default false: false refuses the run without the token, true goes on without the repository. The Testserver pool resource's options have their own flags, --testserver-<option>, which --set doesn't take. Any --set of a resource's option gives the run that resource, as storm.config.ts does. An unknown key path, one given twice, one with its own flag, or a value its option refuses is a usage error. Options that don't fit together once merged, or a required one nothing gives, are invalid_resource_options, naming where each value came from.";
|
|
27
|
+
};
|
|
28
|
+
readonly credential: {
|
|
29
|
+
readonly valueLabel: "SOURCE";
|
|
30
|
+
readonly description: "The credential source: mint, the default, mints one with the vercel CLI for --scope and --project; github-actions requests a GitHub Actions OIDC token, in a GitHub Actions job with permissions id-token: write, anew once it is 4 minutes old, and needs no --scope or --project. Only --local takes it: a runner run needs the mint. Only a run holding a resource that takes a credential takes it, the Testserver pool resource without noCreate (resources.testserverPool in storm.config.ts, or any --testserver-* flag but --testserver-no-create); otherwise it is credential_unused. No config key.";
|
|
31
|
+
};
|
|
32
|
+
readonly local: {
|
|
33
|
+
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.";
|
|
34
|
+
};
|
|
35
|
+
readonly rebuildSnapshot: {
|
|
36
|
+
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.";
|
|
37
|
+
};
|
|
38
|
+
readonly saveSnapshot: {
|
|
39
|
+
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.";
|
|
40
|
+
};
|
|
41
|
+
readonly keepSandbox: {
|
|
42
|
+
readonly valueLabel: "DURATION";
|
|
43
|
+
readonly description: "How long the runner sandbox keeps running once the run ends, however it ends, so you can connect to it from its page in the Vercel dashboard: 0, which stops and deletes it with the run's other sandboxes, or a whole number of minutes or hours up to 5h (30m, 2h). The run asks Vercel Sandbox to extend the runner sandbox's timeout when it would stop sooner; it never shortens it, so the sandbox may run past the keep time until its own timeout. The run says until when it runs, and storm runs show and runs list say so too. Default: keepSandbox in the runner recipe, else 30m, or 0 when CI is set. Not with --local.";
|
|
44
|
+
};
|
|
45
|
+
readonly showOutput: {
|
|
46
|
+
readonly description: "In a runner run on a terminal, print the runner's step output (a snapshot build, the install, the build) above the live view instead of keeping only each step's last line there. Plain output always prints it. Either way, the run directory keeps it whole. Not with --local. No config key.";
|
|
47
|
+
};
|
|
48
|
+
readonly verbose: {
|
|
49
|
+
readonly description: "Print more as it happens: each Testserver sandbox create's progress messages, the runner's step output as with --show-output, and verbose in the run payload, which has the Vitest adapter's reporters print each test as it finishes and its fixtures print each container start, proxied request and vercel invocation, for passing tests too. No config key.";
|
|
50
|
+
};
|
|
51
|
+
readonly scope: {
|
|
52
|
+
readonly valueLabel: "TEAM";
|
|
53
|
+
readonly description: "The control plane team: the Vercel team whose project's development OIDC tokens the Testserver control plane trusts. Required, from this flag or scope in storm.config.ts, unless --local without a Testserver side, with noCreate or with --credential github-actions.";
|
|
54
|
+
};
|
|
55
|
+
readonly project: {
|
|
56
|
+
readonly valueLabel: "PROJECT";
|
|
57
|
+
readonly description: "The control plane project: the Vercel project, within the team, to mint the credential for. Required, from this flag or project in storm.config.ts, unless --local without a Testserver side, with noCreate or with --credential github-actions.";
|
|
58
|
+
};
|
|
59
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// The help every run's command shares, `exec`'s and `vitest`'s: the usage of the flags every run takes, and their field
|
|
2
|
+
// descriptions. Clinkr loads each command's metadata eagerly for navigation, so this module imports nothing.
|
|
3
|
+
/** The flags every run takes, as a usage line names them, before the command's own arguments. */
|
|
4
|
+
export const RUN_USAGE_FLAGS = "[--testserver-sandboxes <N>] [--testserver-build <BUILD>] [--testserver-min-time-left <DURATION>] [--testserver-ttl <DURATION> | --testserver-no-create] [--set <KEY=VALUE>]... [--credential <SOURCE>] [--scope <TEAM> --project <PROJECT>] [--local | [--rebuild-snapshot] [--save-snapshot] [--show-output] [--keep-sandbox <DURATION>]] [--verbose]";
|
|
5
|
+
/** The field descriptions of the flags every run takes. */
|
|
6
|
+
export const RUN_FIELDS = {
|
|
7
|
+
testserverSandboxes: {
|
|
8
|
+
valueLabel: "N",
|
|
9
|
+
description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1. Gives the run a Testserver side.",
|
|
10
|
+
},
|
|
11
|
+
testserverBuild: {
|
|
12
|
+
valueLabel: "BUILD",
|
|
13
|
+
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.",
|
|
14
|
+
},
|
|
15
|
+
testserverMinTimeLeft: {
|
|
16
|
+
valueLabel: "DURATION",
|
|
17
|
+
description: "The least time left a Testserver sandbox from the pool needs, in whole minutes or hours (30m, 2h), overriding resources.testserverPool.minTimeLeft in storm.config.ts; default 30m. Gives the run a Testserver side.",
|
|
18
|
+
},
|
|
19
|
+
testserverTtl: {
|
|
20
|
+
valueLabel: "DURATION",
|
|
21
|
+
description: "How long each Testserver sandbox the run creates lives, 10m to 5h and longer than minTimeLeft, overriding resources.testserverPool.ttl in storm.config.ts; default 5h. Not with noCreate. Gives the run a Testserver side.",
|
|
22
|
+
},
|
|
23
|
+
testserverNoCreate: {
|
|
24
|
+
description: "Run only on Testserver sandboxes already in the pool, never minting for Testserver or creating: needs no --scope or --project with --local, and takes no --testserver-ttl. Turns on resources.testserverPool.noCreate whatever storm.config.ts says; without it, the file's noCreate, default false, applies. Gives the run a Testserver side.",
|
|
25
|
+
},
|
|
26
|
+
set: {
|
|
27
|
+
valueLabel: "KEY=VALUE",
|
|
28
|
+
description: "Set a resource's option for this run by its key path in storm.config.ts, resources.<name>.<option>, overriding the file and the default; repeat it for each option. The key paths: resources.githubFixtureRepo.repo, the GitHub repository as owner/name, required; resources.githubFixtureRepo.tokenEnv, the host environment variable holding its token, required; resources.githubFixtureRepo.optional, true or false, default false: false refuses the run without the token, true goes on without the repository. The Testserver pool resource's options have their own flags, --testserver-<option>, which --set doesn't take. Any --set of a resource's option gives the run that resource, as storm.config.ts does. An unknown key path, one given twice, one with its own flag, or a value its option refuses is a usage error. Options that don't fit together once merged, or a required one nothing gives, are invalid_resource_options, naming where each value came from.",
|
|
29
|
+
},
|
|
30
|
+
credential: {
|
|
31
|
+
valueLabel: "SOURCE",
|
|
32
|
+
description: "The credential source: mint, the default, mints one with the vercel CLI for --scope and --project; github-actions requests a GitHub Actions OIDC token, in a GitHub Actions job with permissions id-token: write, anew once it is 4 minutes old, and needs no --scope or --project. Only --local takes it: a runner run needs the mint. Only a run holding a resource that takes a credential takes it, the Testserver pool resource without noCreate (resources.testserverPool in storm.config.ts, or any --testserver-* flag but --testserver-no-create); otherwise it is credential_unused. No config key.",
|
|
33
|
+
},
|
|
34
|
+
local: {
|
|
35
|
+
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.",
|
|
36
|
+
},
|
|
37
|
+
rebuildSnapshot: {
|
|
38
|
+
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.",
|
|
39
|
+
},
|
|
40
|
+
saveSnapshot: {
|
|
41
|
+
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.",
|
|
42
|
+
},
|
|
43
|
+
keepSandbox: {
|
|
44
|
+
valueLabel: "DURATION",
|
|
45
|
+
description: "How long the runner sandbox keeps running once the run ends, however it ends, so you can connect to it from its page in the Vercel dashboard: 0, which stops and deletes it with the run's other sandboxes, or a whole number of minutes or hours up to 5h (30m, 2h). The run asks Vercel Sandbox to extend the runner sandbox's timeout when it would stop sooner; it never shortens it, so the sandbox may run past the keep time until its own timeout. The run says until when it runs, and storm runs show and runs list say so too. Default: keepSandbox in the runner recipe, else 30m, or 0 when CI is set. Not with --local.",
|
|
46
|
+
},
|
|
47
|
+
showOutput: {
|
|
48
|
+
description: "In a runner run on a terminal, print the runner's step output (a snapshot build, the install, the build) above the live view instead of keeping only each step's last line there. Plain output always prints it. Either way, the run directory keeps it whole. Not with --local. No config key.",
|
|
49
|
+
},
|
|
50
|
+
verbose: {
|
|
51
|
+
description: "Print more as it happens: each Testserver sandbox create's progress messages, the runner's step output as with --show-output, and verbose in the run payload, which has the Vitest adapter's reporters print each test as it finishes and its fixtures print each container start, proxied request and vercel invocation, for passing tests too. No config key.",
|
|
52
|
+
},
|
|
53
|
+
scope: {
|
|
54
|
+
valueLabel: "TEAM",
|
|
55
|
+
description: "The control plane team: the Vercel team whose project's development OIDC tokens the Testserver control plane trusts. Required, from this flag or scope in storm.config.ts, unless --local without a Testserver side, with noCreate or with --credential github-actions.",
|
|
56
|
+
},
|
|
57
|
+
project: {
|
|
58
|
+
valueLabel: "PROJECT",
|
|
59
|
+
description: "The control plane project: the Vercel project, within the team, to mint the credential for. Required, from this flag or project in storm.config.ts, unless --local without a Testserver side, with noCreate or with --credential github-actions.",
|
|
60
|
+
},
|
|
61
|
+
};
|
|
@@ -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<{
|
|
@@ -80,12 +135,38 @@ declare const gitSchema: z.ZodObject<{
|
|
|
80
135
|
* tree had uncommitted changes or untracked files.
|
|
81
136
|
*/
|
|
82
137
|
export type RunRecordGit = Readonly<z.output<typeof gitSchema>>;
|
|
138
|
+
declare const planSchema: z.ZodObject<{
|
|
139
|
+
tests: z.ZodNumber;
|
|
140
|
+
files: z.ZodNumber;
|
|
141
|
+
sandboxes: z.ZodNullable<z.ZodNumber>;
|
|
142
|
+
sandboxesFrom: z.ZodNullable<z.ZodEnum<{
|
|
143
|
+
auto: "auto";
|
|
144
|
+
file: "file";
|
|
145
|
+
flag: "flag";
|
|
146
|
+
}>>;
|
|
147
|
+
}, z.core.$strip>;
|
|
148
|
+
/**
|
|
149
|
+
* A `storm vitest` run's test plan: how many tests `vitest list` counted, in how many files, and, with a Testserver
|
|
150
|
+
* side, how many Testserver sandboxes the run asked for and where that count came from (`--testserver-sandboxes`, the
|
|
151
|
+
* config file's `resources.testserverPool.sandboxes`, or sized automatically from the files); both null without one.
|
|
152
|
+
*/
|
|
153
|
+
export type RunRecordPlan = Readonly<z.output<typeof planSchema>>;
|
|
83
154
|
declare const runRecordSchema: z.ZodObject<{
|
|
84
155
|
version: z.ZodLiteral<1>;
|
|
85
156
|
startedAt: z.ZodString;
|
|
86
157
|
cwd: z.ZodString;
|
|
87
158
|
configFile: z.ZodNullable<z.ZodString>;
|
|
88
159
|
argv: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
160
|
+
plan: z.ZodExactOptional<z.ZodObject<{
|
|
161
|
+
tests: z.ZodNumber;
|
|
162
|
+
files: z.ZodNumber;
|
|
163
|
+
sandboxes: z.ZodNullable<z.ZodNumber>;
|
|
164
|
+
sandboxesFrom: z.ZodNullable<z.ZodEnum<{
|
|
165
|
+
auto: "auto";
|
|
166
|
+
file: "file";
|
|
167
|
+
flag: "flag";
|
|
168
|
+
}>>;
|
|
169
|
+
}, z.core.$strip>>;
|
|
89
170
|
where: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
90
171
|
kind: z.ZodLiteral<"local">;
|
|
91
172
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -102,8 +183,32 @@ declare const runRecordSchema: z.ZodObject<{
|
|
|
102
183
|
id: z.ZodString;
|
|
103
184
|
base: z.ZodString;
|
|
104
185
|
built: z.ZodBoolean;
|
|
186
|
+
branch: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
187
|
+
head: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
105
188
|
}, z.core.$strip>>;
|
|
106
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">>>;
|
|
107
212
|
}, z.core.$strip>], "kind">;
|
|
108
213
|
git: z.ZodNullable<z.ZodObject<{
|
|
109
214
|
branch: z.ZodNullable<z.ZodString>;
|
|
@@ -126,7 +231,7 @@ declare const runRecordSchema: z.ZodObject<{
|
|
|
126
231
|
}, z.core.$strip>;
|
|
127
232
|
/**
|
|
128
233
|
* A run as `run.json` records it: when it started, the working directory and config file it ran with (null when
|
|
129
|
-
* none applied),
|
|
234
|
+
* none applied), its command's argv, a `storm vitest` run's test plan, where its command ran, the Git checkout it started from (null outside one,
|
|
130
235
|
* or when git couldn't say), and, once it is over, how it ended.
|
|
131
236
|
*/
|
|
132
237
|
export type RunRecord = Readonly<Omit<z.output<typeof runRecordSchema>, "ended"> & {
|
|
@@ -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,15 +81,25 @@ 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() });
|
|
89
|
+
const planSchema = z.object({
|
|
90
|
+
tests: z.number().int().nonnegative(),
|
|
91
|
+
files: z.number().int().nonnegative(),
|
|
92
|
+
sandboxes: z.number().int().positive().nullable(),
|
|
93
|
+
sandboxesFrom: z.enum(["flag", "file", "auto"]).nullable(),
|
|
94
|
+
});
|
|
41
95
|
const runRecordSchema = z.object({
|
|
42
96
|
version: z.literal(1),
|
|
43
97
|
startedAt: z.string(),
|
|
44
98
|
cwd: z.string(),
|
|
45
99
|
configFile: z.string().nullable(),
|
|
46
100
|
argv: z.array(z.string()).readonly(),
|
|
101
|
+
// Only a `storm vitest` run has one.
|
|
102
|
+
plan: planSchema.exactOptional(),
|
|
47
103
|
where: whereSchema,
|
|
48
104
|
git: gitSchema.nullable(),
|
|
49
105
|
ended: endedSchema.exactOptional(),
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type AnyResourceConfig, type OwnFlags, type SettingsFile } from "../../config/index.ts";
|
|
2
|
+
import { type StormSetValues } from "../../resources.ts";
|
|
3
|
+
/** The Testserver pool resource's options as the command line gives them, each checked; one not given is absent. */
|
|
4
|
+
export type TestserverPoolFlagValues = NonNullable<StormSetValues["testserverPool"]>;
|
|
5
|
+
/** One of the Testserver pool resource's options. */
|
|
6
|
+
type TestserverPoolOption = keyof TestserverPoolFlagValues;
|
|
7
|
+
/** The request field of an option's flag: `testserver` and the option's name, such as `testserverMinTimeLeft`. */
|
|
8
|
+
type TestserverField<O extends string> = `testserver${Capitalize<O>}`;
|
|
9
|
+
/** An option's flag: its request field and its spelling, which Clinkr derives from the field. */
|
|
10
|
+
interface TestserverFlag<O extends string> {
|
|
11
|
+
readonly field: TestserverField<O>;
|
|
12
|
+
readonly flag: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Each Testserver pool option's flag, by option. An option the resource gains or loses fails to compile here until its
|
|
16
|
+
* flag follows; the run's request fields (`RUN_REQUEST_FIELDS`) declare each by hand, and the run's help names each
|
|
17
|
+
* flag.
|
|
18
|
+
*/
|
|
19
|
+
export declare const TESTSERVER_FLAGS: {
|
|
20
|
+
readonly [O in TestserverPoolOption]-?: TestserverFlag<O>;
|
|
21
|
+
};
|
|
22
|
+
/** What a run's request holds of the flags: each field, `undefined` when its flag wasn't given. */
|
|
23
|
+
export type TestserverFlagRequest = {
|
|
24
|
+
readonly [O in TestserverPoolOption as TestserverField<O>]?: unknown;
|
|
25
|
+
};
|
|
26
|
+
/** The key path of each option with a flag, with that flag, for `parseSetFlags`, which refuses them by the flag. */
|
|
27
|
+
export declare const TESTSERVER_OWN_FLAGS: OwnFlags;
|
|
28
|
+
/** A flag value its option's rule refuses, as `validate` reports it. */
|
|
29
|
+
export interface TestserverFlagProblem {
|
|
30
|
+
readonly field: string;
|
|
31
|
+
readonly message: string;
|
|
32
|
+
}
|
|
33
|
+
/** Each flag value in `request` its option's rule refuses, such as `--testserver-sandboxes` of 40. */
|
|
34
|
+
export declare function testserverFlagProblems(request: TestserverFlagRequest): readonly TestserverFlagProblem[];
|
|
35
|
+
/**
|
|
36
|
+
* The values `--set` gave, `sets`, with the Testserver pool options the flags in `request` gave. `--set` takes none of
|
|
37
|
+
* them, so nothing is overridden. Any flag gives the run the Testserver pool resource, as the file's section does.
|
|
38
|
+
*/
|
|
39
|
+
export declare function withTestserverFlags(sets: StormSetValues, request: TestserverFlagRequest): StormSetValues;
|
|
40
|
+
/** Where a held Testserver pool resource's `sandboxes` came from: its flag, the file's section, or its default. */
|
|
41
|
+
export type TestserverSandboxesSource = "flag" | "file" | "default";
|
|
42
|
+
/**
|
|
43
|
+
* Where the Testserver sandbox count of a run holding the Testserver pool resource came from: `--testserver-sandboxes`
|
|
44
|
+
* in `request`, else `resources.testserverPool.sandboxes` in `file`, else the option's default. `--set` takes no
|
|
45
|
+
* Testserver pool option, so these are the only sources.
|
|
46
|
+
*/
|
|
47
|
+
export declare function testserverSandboxesSource(request: TestserverFlagRequest, file: SettingsFile<readonly AnyResourceConfig[]>): TestserverSandboxesSource;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// A run's own flags for the Testserver pool resource's options, `exec`'s and `vitest`'s, `--testserver-<option>`, the
|
|
2
|
+
// one way to give one on the command line: `--set` refuses their key paths and names the flag (`TESTSERVER_OWN_FLAGS`).
|
|
3
|
+
// Each flag's value passes its option's rule, as a value from the file does, and counts as a flag's when the options
|
|
4
|
+
// are merged, so the precedence (flag, then file, then default) and the checks across options stay the resource
|
|
5
|
+
// config's.
|
|
6
|
+
import { fileOptions, givenOptionsOf, optionKeyPath, } from "../../config/index.js";
|
|
7
|
+
import { RESOURCE_CONFIGS } from "../../resources.js";
|
|
8
|
+
/**
|
|
9
|
+
* Each Testserver pool option's flag, by option. An option the resource gains or loses fails to compile here until its
|
|
10
|
+
* flag follows; the run's request fields (`RUN_REQUEST_FIELDS`) declare each by hand, and the run's help names each
|
|
11
|
+
* flag.
|
|
12
|
+
*/
|
|
13
|
+
export const TESTSERVER_FLAGS = {
|
|
14
|
+
sandboxes: { field: "testserverSandboxes", flag: "--testserver-sandboxes" },
|
|
15
|
+
build: { field: "testserverBuild", flag: "--testserver-build" },
|
|
16
|
+
minTimeLeft: { field: "testserverMinTimeLeft", flag: "--testserver-min-time-left" },
|
|
17
|
+
ttl: { field: "testserverTtl", flag: "--testserver-ttl" },
|
|
18
|
+
noCreate: { field: "testserverNoCreate", flag: "--testserver-no-create" },
|
|
19
|
+
};
|
|
20
|
+
function isTestserverPoolConfig(config) {
|
|
21
|
+
return config.name === "testserverPool";
|
|
22
|
+
}
|
|
23
|
+
function testserverPoolConfig() {
|
|
24
|
+
const config = RESOURCE_CONFIGS.find(isTestserverPoolConfig);
|
|
25
|
+
if (config === undefined)
|
|
26
|
+
throw new Error("The registry has no testserverPool resource config");
|
|
27
|
+
return config;
|
|
28
|
+
}
|
|
29
|
+
const CONFIG = testserverPoolConfig();
|
|
30
|
+
/** Each option's rule, by name, as the generic machinery reads them. */
|
|
31
|
+
const RULES = CONFIG.options;
|
|
32
|
+
/** The key path of each option with a flag, with that flag, for `parseSetFlags`, which refuses them by the flag. */
|
|
33
|
+
export const TESTSERVER_OWN_FLAGS = Object.fromEntries(Object.entries(TESTSERVER_FLAGS).map(([option, { flag }]) => [optionKeyPath(CONFIG.name, option), flag]));
|
|
34
|
+
/** Checks each flag given in `request` by its option's rule. */
|
|
35
|
+
function readTestserverFlags(request) {
|
|
36
|
+
const values = {};
|
|
37
|
+
const problems = [];
|
|
38
|
+
for (const [option, { field, flag }] of Object.entries(TESTSERVER_FLAGS)) {
|
|
39
|
+
const value = request[field];
|
|
40
|
+
if (value === undefined)
|
|
41
|
+
continue;
|
|
42
|
+
const rule = RULES[option];
|
|
43
|
+
if (rule === undefined)
|
|
44
|
+
throw new Error(`testserverPool has no option ${option}`);
|
|
45
|
+
const checked = rule.check(value);
|
|
46
|
+
if (checked.ok)
|
|
47
|
+
values[option] = checked.value;
|
|
48
|
+
else
|
|
49
|
+
problems.push(...checked.problems.map(({ problem }) => ({ field, message: `${flag} ${problem}.` })));
|
|
50
|
+
}
|
|
51
|
+
if (problems.length > 0)
|
|
52
|
+
return { ok: false, problems };
|
|
53
|
+
return { ok: true, values: Object.keys(values).length === 0 ? undefined : givenOptionsOf(CONFIG, values) };
|
|
54
|
+
}
|
|
55
|
+
/** Each flag value in `request` its option's rule refuses, such as `--testserver-sandboxes` of 40. */
|
|
56
|
+
export function testserverFlagProblems(request) {
|
|
57
|
+
const read = readTestserverFlags(request);
|
|
58
|
+
return read.ok ? [] : read.problems;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The values `--set` gave, `sets`, with the Testserver pool options the flags in `request` gave. `--set` takes none of
|
|
62
|
+
* them, so nothing is overridden. Any flag gives the run the Testserver pool resource, as the file's section does.
|
|
63
|
+
*/
|
|
64
|
+
export function withTestserverFlags(sets, request) {
|
|
65
|
+
const read = readTestserverFlags(request);
|
|
66
|
+
// `validate` refused every flag value its option's rule refuses.
|
|
67
|
+
if (!read.ok)
|
|
68
|
+
throw new Error(`The flags should have been refused: ${read.problems.map((p) => p.message).join(" ")}`);
|
|
69
|
+
return read.values === undefined ? sets : { ...sets, testserverPool: read.values };
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Where the Testserver sandbox count of a run holding the Testserver pool resource came from: `--testserver-sandboxes`
|
|
73
|
+
* in `request`, else `resources.testserverPool.sandboxes` in `file`, else the option's default. `--set` takes no
|
|
74
|
+
* Testserver pool option, so these are the only sources.
|
|
75
|
+
*/
|
|
76
|
+
export function testserverSandboxesSource(request, file) {
|
|
77
|
+
if (request[TESTSERVER_FLAGS.sandboxes.field] !== undefined)
|
|
78
|
+
return "flag";
|
|
79
|
+
return fileOptions(file, CONFIG)?.sandboxes === undefined ? "default" : "file";
|
|
80
|
+
}
|
|
@@ -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>;
|