@cnc-tools/storm 0.14.2 → 0.15.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/application.js +3 -1
- package/dist/bin/storm.js +9 -7
- package/dist/build-info.js +1 -1
- package/dist/chunks/chunk-4U4DZ7VG.js +40 -0
- package/dist/chunks/{chunk-GSC6SRTW.js → chunk-5CCP36QQ.js} +1 -1
- package/dist/chunks/chunk-5GBMR4HM.js +966 -0
- package/dist/chunks/{chunk-43MWZLJR.js → chunk-5VXBKPW6.js} +1 -1
- package/dist/chunks/{chunk-RA4L2ACU.js → chunk-AWBSONHB.js} +88 -34
- package/dist/chunks/{chunk-BRUIATTR.js → chunk-CN4EFA5J.js} +59 -12
- package/dist/chunks/{chunk-3HBPNQ4Y.js → chunk-CXAT7ZKP.js} +2 -2
- package/dist/chunks/chunk-E4PJNZVG.js +783 -0
- package/dist/chunks/{chunk-T6AZIDZD.js → chunk-F6N34UWB.js} +12 -244
- package/dist/chunks/{chunk-RUPD4TLT.js → chunk-KC4KDJ5K.js} +147 -26
- package/dist/chunks/{chunk-I7AN3DIJ.js → chunk-L36GBUBB.js} +1626 -676
- package/dist/chunks/{chunk-XZCDA5PE.js → chunk-OX7X4B2L.js} +7 -2
- package/dist/chunks/{chunk-UUBZTGLV.js → chunk-PN5ULTTH.js} +140 -130
- package/dist/chunks/chunk-QUHY6FGN.js +108 -0
- package/dist/chunks/chunk-QVS7HRU7.js +74 -0
- package/dist/chunks/{chunk-UC6DULWY.js → chunk-R7XVBZOY.js} +130 -39
- package/dist/chunks/{chunk-LUOHJ3LB.js → chunk-RAQEXKL6.js} +1120 -465
- package/dist/chunks/{chunk-GJOEPJJL.js → chunk-SZEURWRS.js} +446 -52
- package/dist/chunks/chunk-TJNFVNKR.js +246 -0
- package/dist/chunks/{chunk-BW2ADH7U.js → chunk-VUPZH7J2.js} +1 -1
- package/dist/chunks/{chunk-HDL4WKIB.js → chunk-XEVHP5ZW.js} +2 -2
- package/dist/chunks/{chunk-VH2POPW5.js → chunk-YV7GE6EV.js} +635 -79
- package/dist/chunks/{chunk-GQIL3AHY.js → chunk-ZG3WQ4UF.js} +1 -1
- package/dist/chunks/{live-app-SZGEILCQ.js → live-app-PI3BAN6Y.js} +28 -23
- package/dist/command-tree.d.ts +2 -2
- package/dist/command-tree.js +2 -2
- package/dist/commands/exec/across-sandboxes-outcomes.d.ts +364 -0
- package/dist/commands/exec/across-sandboxes-outcomes.js +229 -0
- package/dist/commands/exec/across-sandboxes-run.d.ts +180 -0
- package/dist/commands/exec/across-sandboxes-run.js +339 -0
- package/dist/commands/exec/command.d.ts +577 -75
- package/dist/commands/exec/command.js +165 -32
- package/dist/commands/exec/driver-plan.d.ts +8 -2
- package/dist/commands/exec/driver-plan.js +13 -3
- package/dist/commands/exec/exec-words.d.ts +17 -3
- package/dist/commands/exec/exec-words.js +27 -16
- package/dist/commands/exec/live-view.d.ts +3 -4
- package/dist/commands/exec/live-view.js +37 -28
- package/dist/commands/exec/metadata.js +2 -2
- package/dist/commands/exec/mint-failed.d.ts +4 -4
- package/dist/commands/exec/mint-failed.js +6 -6
- package/dist/commands/exec/outcomes.d.ts +530 -73
- package/dist/commands/exec/outcomes.js +202 -66
- package/dist/commands/exec/plan-only.d.ts +10 -0
- package/dist/commands/exec/plan-only.js +46 -0
- package/dist/commands/exec/plan-run.d.ts +54 -35
- package/dist/commands/exec/plan-run.js +81 -38
- package/dist/commands/exec/planned-outcome.d.ts +15 -0
- package/dist/commands/exec/planned-outcome.js +35 -0
- package/dist/commands/exec/progress.d.ts +2 -2
- package/dist/commands/exec/progress.js +35 -18
- package/dist/commands/exec/resource-refusals.d.ts +2 -2
- package/dist/commands/exec/resource-refusals.js +3 -3
- package/dist/commands/exec/run-bin.d.ts +1 -1
- package/dist/commands/exec/run-bin.js +2 -2
- package/dist/commands/exec/run-command.d.ts +345 -63
- package/dist/commands/exec/run-command.js +308 -258
- package/dist/commands/exec/run-metadata.d.ts +42 -8
- package/dist/commands/exec/run-metadata.js +40 -21
- package/dist/commands/exec/run-planned.d.ts +20 -0
- package/dist/commands/exec/run-planned.js +22 -0
- package/dist/commands/exec/sandbox-lines.d.ts +42 -0
- package/dist/commands/exec/sandbox-lines.js +59 -0
- package/dist/commands/exec/sandbox-progress.d.ts +30 -0
- package/dist/commands/exec/sandbox-progress.js +232 -0
- package/dist/commands/exec/sandbox-view.d.ts +19 -0
- package/dist/commands/exec/sandbox-view.js +72 -0
- package/dist/commands/exec/view.d.ts +3 -2
- package/dist/commands/exec/view.js +10 -6
- package/dist/commands/runs/facts.d.ts +51 -9
- package/dist/commands/runs/facts.js +49 -29
- package/dist/commands/runs/list/command.d.ts +80 -4
- package/dist/commands/runs/list/command.js +11 -10
- package/dist/commands/runs/list/metadata.js +1 -1
- package/dist/commands/runs/list/outcomes.d.ts +40 -2
- package/dist/commands/runs/logs/command.d.ts +103 -8
- package/dist/commands/runs/logs/command.js +139 -24
- package/dist/commands/runs/logs/metadata.d.ts +4 -0
- package/dist/commands/runs/logs/metadata.js +14 -7
- package/dist/commands/runs/logs/outcomes.d.ts +49 -2
- package/dist/commands/runs/logs/outcomes.js +110 -6
- package/dist/commands/runs/past-run.d.ts +77 -6
- package/dist/commands/runs/past-run.js +133 -4
- package/dist/commands/runs/show/command.d.ts +568 -10
- package/dist/commands/runs/show/command.js +634 -119
- package/dist/commands/runs/show/metadata.d.ts +17 -0
- package/dist/commands/runs/show/metadata.js +48 -7
- package/dist/commands/runs/show/outcomes.d.ts +276 -5
- package/dist/commands/runs/show/outcomes.js +484 -96
- package/dist/commands/snapshots/build/command.d.ts +109 -18
- package/dist/commands/snapshots/build/command.js +72 -36
- package/dist/commands/snapshots/build/metadata.d.ts +4 -0
- package/dist/commands/snapshots/build/metadata.js +5 -1
- package/dist/commands/snapshots/build/outcomes.d.ts +53 -8
- package/dist/commands/snapshots/build/outcomes.js +26 -3
- package/dist/commands/snapshots/list/command.d.ts +72 -7
- package/dist/commands/snapshots/list/command.js +57 -24
- package/dist/commands/snapshots/list/metadata.d.ts +4 -0
- package/dist/commands/snapshots/list/metadata.js +4 -0
- package/dist/commands/snapshots/list/outcomes.d.ts +31 -0
- package/dist/commands/snapshots/list/outcomes.js +25 -2
- package/dist/commands/suites/list/command.d.ts +129 -0
- package/dist/commands/suites/list/command.js +162 -0
- package/dist/commands/suites/list/metadata.d.ts +11 -0
- package/dist/commands/suites/list/metadata.js +15 -0
- package/dist/commands/suites/list/outcomes.d.ts +91 -0
- package/dist/commands/suites/list/outcomes.js +122 -0
- package/dist/commands/suites/metadata.js +8 -0
- package/dist/commands/test/command.d.ts +1389 -0
- package/dist/commands/test/command.js +583 -0
- package/dist/commands/test/metadata.js +8 -0
- package/dist/commands/test/outcomes.d.ts +765 -0
- package/dist/commands/test/outcomes.js +140 -0
- package/dist/commands/test/plan.d.ts +92 -0
- package/dist/commands/test/plan.js +128 -0
- package/dist/commands/test/test-words.d.ts +12 -0
- package/dist/commands/test/test-words.js +42 -0
- package/dist/config/check-resources.d.ts +14 -0
- package/dist/config/check-resources.js +98 -0
- package/dist/config/check-runner.d.ts +13 -0
- package/dist/config/check-runner.js +54 -0
- package/dist/config/check-suites.d.ts +14 -0
- package/dist/config/check-suites.js +99 -0
- package/dist/config/gateways.d.ts +24 -0
- package/dist/config/index.d.ts +6 -3
- package/dist/config/index.js +3 -1
- package/dist/config/live/file-lists-file-gateway.d.ts +4 -0
- package/dist/config/live/file-lists-file-gateway.js +27 -0
- package/dist/config/load.d.ts +11 -10
- package/dist/config/load.js +35 -103
- package/dist/config/recipe-run.d.ts +8 -1
- package/dist/config/recipe-run.js +2 -1
- package/dist/config/resolve.d.ts +3 -2
- package/dist/config/resolve.js +6 -3
- package/dist/config/resolver.d.ts +20 -6
- package/dist/config/resolver.js +11 -8
- package/dist/config/runner.d.ts +24 -0
- package/dist/config/runner.js +4 -0
- package/dist/config/schema.d.ts +26 -18
- package/dist/config/schema.js +41 -9
- package/dist/config/settings-file.d.ts +9 -3
- package/dist/config/settings-file.js +41 -4
- package/dist/config/suite.d.ts +39 -0
- package/dist/config/suite.js +5 -0
- package/dist/config-file/define.d.ts +49 -18
- package/dist/config-file/define.js +9 -8
- package/dist/config-file/runner.d.ts +12 -0
- package/dist/config-file/runner.js +9 -0
- package/dist/context.d.ts +12 -8
- package/dist/context.js +9 -3
- package/dist/core/across-sandboxes.d.ts +43 -0
- package/dist/core/across-sandboxes.js +319 -0
- package/dist/core/before-run.d.ts +5 -3
- package/dist/core/before-run.js +12 -1
- package/dist/core/events.d.ts +62 -6
- package/dist/core/events.js +14 -0
- package/dist/core/index.d.ts +4 -2
- package/dist/core/index.js +3 -1
- package/dist/core/payload.d.ts +2 -1
- package/dist/core/payload.js +2 -1
- package/dist/core/presentations.js +1 -1
- package/dist/core/resource.d.ts +1 -1
- package/dist/core/resources.d.ts +56 -6
- package/dist/core/resources.js +81 -5
- package/dist/core/run-state.js +9 -0
- package/dist/core/run.d.ts +77 -15
- package/dist/core/run.js +150 -86
- package/dist/core/sandbox-end.d.ts +64 -0
- package/dist/core/sandbox-end.js +128 -0
- package/dist/core/timeline.d.ts +4 -4
- package/dist/core/timeline.js +3 -3
- package/dist/credential/live/vercel-cli-gateway.d.ts +7 -0
- package/dist/credential/live/vercel-cli-gateway.js +14 -1
- package/dist/extensions/github/context.d.ts +1 -1
- package/dist/extensions/github/definition.d.ts +11 -9
- package/dist/extensions/github/definition.js +8 -6
- package/dist/extensions/github/extension.d.ts +3 -3
- package/dist/extensions/github/fixture-repo.d.ts +21 -2
- package/dist/extensions/github/fixture-repo.js +31 -2
- package/dist/extensions/github/index.d.ts +2 -2
- package/dist/extensions/github/index.js +2 -2
- package/dist/extensions/github/lifecycle.d.ts +16 -6
- package/dist/extensions/github/lifecycle.js +42 -25
- package/dist/extensions/github/options.d.ts +17 -11
- package/dist/extensions/github/options.js +14 -13
- package/dist/extensions/github/refusals.d.ts +23 -6
- package/dist/extensions/github/refusals.js +34 -12
- package/dist/extensions/github/resource.d.ts +21 -12
- package/dist/extensions/github/resource.js +16 -8
- package/dist/extensions/github/run/payload.d.ts +6 -6
- package/dist/extensions/github/run/payload.js +3 -5
- package/dist/extensions/github/split.d.ts +10 -0
- package/dist/extensions/github/split.js +12 -0
- package/dist/extensions/playwright/driver.js +6 -26
- package/dist/extensions/playwright/extension.js +1 -1
- package/dist/extensions/testserver/commands/pool/create/command.js +8 -8
- package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
- package/dist/extensions/testserver/definition.d.ts +4 -4
- package/dist/extensions/testserver/definition.js +41 -31
- package/dist/extensions/testserver/extension.d.ts +4 -5
- package/dist/extensions/testserver/extension.js +14 -41
- package/dist/extensions/testserver/index.d.ts +1 -1
- package/dist/extensions/testserver/index.js +1 -1
- package/dist/extensions/testserver/lifecycle.d.ts +10 -2
- package/dist/extensions/testserver/lifecycle.js +29 -6
- package/dist/extensions/testserver/options/rules.d.ts +5 -5
- package/dist/extensions/testserver/options/rules.js +10 -8
- package/dist/extensions/testserver/options/sandboxes.d.ts +4 -2
- package/dist/extensions/testserver/options/sandboxes.js +8 -3
- package/dist/extensions/testserver/pool/gateways.d.ts +29 -4
- package/dist/extensions/testserver/pool/index.d.ts +2 -2
- package/dist/extensions/testserver/pool/index.js +1 -1
- package/dist/extensions/testserver/pool/lease.d.ts +10 -0
- package/dist/extensions/testserver/pool/lease.js +21 -0
- package/dist/extensions/testserver/pool/live/pool-store-gateway.js +38 -3
- package/dist/extensions/testserver/refusals.d.ts +12 -0
- package/dist/extensions/testserver/refusals.js +18 -0
- package/dist/extensions/testserver/release.d.ts +16 -0
- package/dist/extensions/testserver/release.js +56 -4
- package/dist/extensions/testserver/resource.d.ts +4 -4
- package/dist/extensions/testserver/resource.js +1 -1
- package/dist/extensions/testserver/split.d.ts +9 -0
- package/dist/extensions/testserver/split.js +22 -0
- package/dist/extensions/testserver/vitest/fixtures.d.ts +5 -5
- package/dist/extensions/testserver/vitest/fixtures.js +9 -38
- package/dist/extensions/vitest/driver.d.ts +7 -0
- package/dist/extensions/vitest/driver.js +33 -37
- package/dist/extensions/vitest/extension.js +1 -1
- package/dist/extensions/vitest/plan/plan-over.d.ts +8 -1
- package/dist/extensions/vitest/plan/plan-over.js +16 -2
- package/dist/extensions.d.ts +17 -16
- package/dist/extensions.js +5 -4
- package/dist/forward-sigterm.js +1 -1
- package/dist/launcher-resolvers/local-services.d.ts +1 -1
- package/dist/live-app.js +4 -3
- package/dist/local-services.js +1 -1
- package/dist/planning/driver-file-lists.d.ts +61 -0
- package/dist/planning/driver-file-lists.js +66 -0
- package/dist/{commands/exec → planning}/driver-refusals.d.ts +11 -10
- package/dist/{commands/exec → planning}/driver-refusals.js +18 -14
- package/dist/planning/file-lists-file.d.ts +58 -0
- package/dist/planning/file-lists-file.js +105 -0
- package/dist/planning/file-lists.d.ts +28 -0
- package/dist/planning/file-lists.js +52 -0
- package/dist/{commands/exec → planning}/final-results.d.ts +1 -1
- package/dist/{commands/exec → planning}/final-results.js +6 -6
- package/dist/planning/plan-only.d.ts +81 -0
- package/dist/planning/plan-only.js +83 -0
- package/dist/{commands/exec → planning}/redaction.d.ts +2 -2
- package/dist/{commands/exec → planning}/redaction.js +5 -4
- package/dist/{commands/exec → planning}/resource-flags.d.ts +5 -12
- package/dist/{commands/exec → planning}/resource-flags.js +6 -16
- package/dist/planning/run-kind-flags.d.ts +20 -0
- package/dist/planning/run-kind-flags.js +48 -0
- package/dist/planning/run-plan.d.ts +30 -0
- package/dist/planning/run-plan.js +4 -0
- package/dist/planning/sandbox-placeholders.d.ts +22 -0
- package/dist/planning/sandbox-placeholders.js +60 -0
- package/dist/planning/suite-not-found.d.ts +37 -0
- package/dist/planning/suite-not-found.js +36 -0
- package/dist/planning/suites.d.ts +43 -0
- package/dist/planning/suites.js +89 -0
- package/dist/{commands/exec → planning}/test-plan.d.ts +8 -3
- package/dist/{commands/exec → planning}/test-plan.js +32 -4
- package/dist/playwright/reporter.d.ts +20 -8
- package/dist/playwright/reporter.js +195 -15
- package/dist/presentation.d.ts +10 -6
- package/dist/presentation.js +13 -15
- package/dist/run-directory/gateways.d.ts +60 -4
- package/dist/run-directory/index.d.ts +4 -4
- package/dist/run-directory/index.js +2 -1
- package/dist/run-directory/live/run-directory-gateway.js +92 -16
- package/dist/run-directory/plan.d.ts +35 -2
- package/dist/run-directory/plan.js +44 -7
- package/dist/run-directory/reader.d.ts +26 -5
- package/dist/run-directory/reader.js +24 -1
- package/dist/run-directory/recording.d.ts +75 -49
- package/dist/run-directory/recording.js +214 -28
- package/dist/run-directory/run-directory.d.ts +22 -1
- package/dist/run-directory/run-directory.js +24 -0
- package/dist/run-directory/run-record.d.ts +144 -21
- package/dist/run-directory/run-record.js +118 -19
- package/dist/run-directory/timeline-facts.js +4 -4
- package/dist/runner/build-snapshots.d.ts +7 -7
- package/dist/runner/build-snapshots.js +12 -16
- package/dist/runner/events.d.ts +29 -8
- package/dist/runner/gateways.d.ts +49 -6
- package/dist/runner/index.d.ts +6 -4
- package/dist/runner/index.js +3 -2
- package/dist/runner/live/sandbox-gateway.js +161 -31
- package/dist/runner/network-policy.d.ts +55 -0
- package/dist/runner/network-policy.js +46 -0
- package/dist/runner/policy-writes.d.ts +40 -0
- package/dist/runner/policy-writes.js +124 -0
- package/dist/runner/prepare.d.ts +6 -7
- package/dist/runner/ready.d.ts +39 -10
- package/dist/runner/ready.js +59 -47
- package/dist/runner/recipe-check.d.ts +6 -0
- package/dist/runner/recipe-check.js +29 -0
- package/dist/runner/recipe-secrets.d.ts +67 -0
- package/dist/runner/recipe-secrets.js +230 -0
- package/dist/runner/recipe.d.ts +115 -26
- package/dist/runner/recipe.js +147 -154
- package/dist/runner/sandboxed-command.d.ts +22 -8
- package/dist/runner/sandboxed-command.js +33 -10
- package/dist/runner/scope.d.ts +107 -21
- package/dist/runner/scope.js +274 -54
- package/dist/runner/secrets.d.ts +42 -31
- package/dist/runner/secrets.js +62 -40
- package/dist/runner/session.d.ts +59 -26
- package/dist/runner/session.js +82 -41
- package/dist/runner/snapshot-build.d.ts +7 -4
- package/dist/runner/snapshot-build.js +48 -28
- package/dist/runner/snapshot-choice.d.ts +37 -0
- package/dist/runner/snapshot-choice.js +38 -0
- package/dist/runner/snapshot-key.d.ts +16 -14
- package/dist/runner/snapshot-key.js +24 -18
- package/dist/runner/steps.d.ts +13 -5
- package/dist/runner/steps.js +34 -4
- package/dist/runner/time-limit.d.ts +10 -0
- package/dist/runner/time-limit.js +43 -0
- package/dist/sdk/extension/commands.d.ts +1 -7
- package/dist/sdk/extension/driver.d.ts +39 -46
- package/dist/sdk/extension/driver.js +6 -6
- package/dist/sdk/extension/index.d.ts +3 -3
- package/dist/sdk/extension/index.js +3 -4
- package/dist/sdk/extension/lifecycle.d.ts +52 -9
- package/dist/sdk/extension/lifecycle.js +1 -1
- package/dist/sdk/extension/resource-definition.d.ts +13 -10
- package/dist/sdk/extension/resource-definition.js +7 -2
- package/dist/sdk/extension/resource.d.ts +2 -2
- package/dist/sdk/extension/secret-source.d.ts +58 -0
- package/dist/sdk/extension/secret-source.js +78 -0
- package/dist/sdk/index.d.ts +2 -2
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/run/launcher.d.ts +1 -1
- package/dist/sdk/run/launcher.js +1 -1
- package/dist/sdk/run/payload.d.ts +16 -1
- package/dist/sdk/run/payload.js +17 -2
- package/dist/sdk/run/redact.js +2 -2
- package/dist/sdk/run/test-events.d.ts +23 -6
- package/dist/sdk/run/test-events.js +6 -4
- package/dist/sdk/run/test-result-writer.d.ts +8 -3
- package/dist/sdk/run/test-result-writer.js +22 -2
- package/dist/{commands/exec → shared}/cleanup.d.ts +3 -3
- package/dist/{commands/exec → shared}/cleanup.js +11 -6
- package/dist/shared/job-summary.d.ts +19 -0
- package/dist/{commands/exec → shared}/job-summary.js +17 -0
- package/dist/shared/sandbox-table.d.ts +48 -0
- package/dist/shared/sandbox-table.js +109 -0
- package/dist/{commands/exec → shared}/snapshot-text.d.ts +1 -1
- package/dist/{commands/exec → shared}/tests-summary.d.ts +22 -6
- package/dist/{commands/exec → shared}/tests-summary.js +74 -31
- package/dist/{commands/exec → shared}/text.d.ts +7 -2
- package/dist/{commands/exec → shared}/text.js +9 -1
- package/dist/{commands/exec → shared}/waterfall.d.ts +8 -6
- package/dist/{commands/exec → shared}/waterfall.js +71 -24
- package/dist/shared/worker-chart.d.ts +172 -0
- package/dist/shared/worker-chart.js +623 -0
- package/dist/vitest/config.d.ts +35 -11
- package/dist/vitest/config.js +47 -14
- package/dist/vitest/index.d.ts +1 -1
- package/dist/vitest/index.js +3 -3
- package/dist/vitest/sequencer.d.ts +23 -0
- package/dist/vitest/sequencer.js +73 -0
- package/dist/vitest/setup.d.ts +1 -0
- package/dist/vitest/setup.js +34 -0
- package/dist/vitest/test-events.d.ts +32 -6
- package/dist/vitest/test-events.js +25 -5
- package/dist/vitest/test-results.d.ts +8 -3
- package/dist/vitest/test-results.js +6 -0
- package/package.json +7 -2
- package/skills/overview.md +21 -17
- package/skills/plan-runs.md +67 -0
- package/skills/read-run-output.md +51 -19
- package/dist/chunks/chunk-E3QU74NX.js +0 -49
- package/dist/chunks/chunk-HP54VHGY.js +0 -201
- package/dist/chunks/chunk-NMVODY3P.js +0 -19
- package/dist/chunks/chunk-TVMEKVOW.js +0 -607
- package/dist/commands/exec/define-run-command.d.ts +0 -671
- package/dist/commands/exec/define-run-command.js +0 -91
- package/dist/commands/exec/job-summary.d.ts +0 -10
- package/dist/commands/exec/worker-chart.d.ts +0 -87
- package/dist/commands/exec/worker-chart.js +0 -343
- package/dist/commands/playwright/command.d.ts +0 -661
- package/dist/commands/playwright/command.js +0 -31
- package/dist/commands/playwright/metadata.js +0 -8
- package/dist/commands/vitest/command.d.ts +0 -662
- package/dist/commands/vitest/command.js +0 -31
- package/dist/commands/vitest/metadata.js +0 -8
- package/dist/sdk/extension/ci.d.ts +0 -2
- package/dist/sdk/extension/ci.js +0 -6
- package/dist/chunks/{chunk-YM6TZV4L.js → chunk-VL7WFTVQ.js} +52 -52
- package/dist/commands/{playwright → suites}/metadata.d.ts +1 -1
- package/dist/commands/{vitest → test}/metadata.d.ts +1 -1
- /package/dist/{commands → shared}/dashboard.d.ts +0 -0
- /package/dist/{commands → shared}/dashboard.js +0 -0
- /package/dist/{commands/exec → shared}/snapshot-text.js +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// Building a runner snapshot of a run's base: a build sandbox runs the toolchain steps, commits exactly the base's
|
|
2
|
-
// tracked files, runs the prebuild steps, and is saved as a snapshot, which the cache then records.
|
|
2
|
+
// tracked files, runs the prebuild steps, and is saved as a snapshot, which the cache then records. The sandbox scope
|
|
3
|
+
// grants the recipe's credentials before the first toolchain step, and revokes them before the snapshot save (or in the
|
|
4
|
+
// scope's fence if the build fails or is canceled).
|
|
3
5
|
import { runnerTags } from "./context.js";
|
|
4
|
-
import { stepSecrets } from "./secrets.js";
|
|
5
6
|
import { SNAPSHOT_EXPIRATION_MS } from "./snapshot-cache.js";
|
|
6
7
|
import { baseIndexScript, STAGED_FILES } from "./snapshot-key.js";
|
|
7
|
-
import { runStep, sandboxStop } from "./steps.js";
|
|
8
|
+
import { networkPolicyStop, runStep, sandboxStop } from "./steps.js";
|
|
8
9
|
/** How long a build sandbox may live: 30 minutes. */
|
|
9
10
|
export const BUILD_SANDBOX_TIMEOUT_MS = 30 * 60_000;
|
|
10
11
|
/** The label of the step between the toolchain and prebuild steps that commits the base's files. */
|
|
@@ -56,42 +57,61 @@ export async function buildSnapshot(context, request, control, progress) {
|
|
|
56
57
|
], signal);
|
|
57
58
|
if (!staged.ok)
|
|
58
59
|
return sandboxStop("upload", staged.failure);
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
secrets: stepSecrets(request.secrets, secrets),
|
|
64
|
-
});
|
|
60
|
+
// Every credential the recipe declares goes on the steps' requests, from before the first toolchain step until
|
|
61
|
+
// `saveSnapshot` revokes them before saving (or the scope's fence revokes them if a step fails or the build is
|
|
62
|
+
// canceled). storm's own base-index step falls inside: it runs only tar and git on the uploaded files, so it makes no
|
|
63
|
+
// request, and revoking and granting again around it would add two writes and their failures for nothing.
|
|
65
64
|
const steps = [
|
|
66
|
-
...prepared.toolchains
|
|
65
|
+
...prepared.toolchains,
|
|
67
66
|
{ label: BASE_INDEX_LABEL, script: baseIndexScript(base, staged.value.directory) },
|
|
68
|
-
...prepared.prebuild
|
|
67
|
+
...prepared.prebuild,
|
|
69
68
|
];
|
|
70
69
|
await progress.emit({ kind: "output-started", section: "snapshot", sandbox: sandbox.name, region: recipe.region });
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
let stop;
|
|
71
|
+
if (request.credentials.length > 0) {
|
|
72
|
+
const granted = await scope.grantCredentials(sandbox, request.credentials, signal);
|
|
73
|
+
if (!granted.ok)
|
|
74
|
+
stop = networkPolicyStop("inject", "snapshot-steps", granted.failure);
|
|
75
|
+
}
|
|
76
|
+
if (stop === undefined) {
|
|
77
|
+
for (const step of steps) {
|
|
78
|
+
if (signal.aborted) {
|
|
79
|
+
stop = { kind: "aborted" };
|
|
80
|
+
break;
|
|
79
81
|
}
|
|
80
|
-
:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
const ran = await runStep(context, { sandbox, phase: "snapshot", ...step }, progress, signal);
|
|
83
|
+
if (ran.kind === "succeeded")
|
|
84
|
+
continue;
|
|
85
|
+
stop =
|
|
86
|
+
ran.kind === "exited"
|
|
87
|
+
? {
|
|
88
|
+
kind: "failed",
|
|
89
|
+
failure: {
|
|
90
|
+
kind: "snapshot-build-step-failed",
|
|
91
|
+
label: step.label,
|
|
92
|
+
exitCode: ran.exitCode,
|
|
93
|
+
tail: ran.tail,
|
|
94
|
+
},
|
|
95
|
+
}
|
|
96
|
+
: sandboxStop("run-script", ran.failure);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
87
99
|
}
|
|
88
|
-
await progress.emit({
|
|
100
|
+
await progress.emit({
|
|
101
|
+
kind: "output-ended",
|
|
102
|
+
section: "snapshot",
|
|
103
|
+
outcome: stop === undefined ? "finished" : stop.kind === "aborted" ? "stopped" : "failed",
|
|
104
|
+
});
|
|
105
|
+
if (stop !== undefined)
|
|
106
|
+
return stop;
|
|
89
107
|
if (signal.aborted)
|
|
90
108
|
return { kind: "aborted" };
|
|
91
109
|
await progress.emit({ kind: "snapshot-saving" });
|
|
92
110
|
const saved = await scope.saveSnapshot(sandbox, { expirationMs: SNAPSHOT_EXPIRATION_MS });
|
|
93
111
|
if (!saved.ok)
|
|
94
|
-
return
|
|
112
|
+
return saved.failure.kind === "credential-not-revoked"
|
|
113
|
+
? networkPolicyStop("remove", "snapshot-save", saved.failure.failure)
|
|
114
|
+
: sandboxStop("save-snapshot", saved.failure);
|
|
95
115
|
const savedAt = context.clock.now();
|
|
96
116
|
const entry = {
|
|
97
117
|
teamId: access.teamId,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { RunnerContext } from "./context.ts";
|
|
2
|
+
import type { RunnerFailure, RunnerProgress } from "./events.ts";
|
|
3
|
+
import { type ChosenSnapshot, type ReadyRunnerRequest } from "./ready.ts";
|
|
4
|
+
import { type RunnerScopeFacts } from "./scope.ts";
|
|
5
|
+
/**
|
|
6
|
+
* How choosing a run's runner snapshot ended.
|
|
7
|
+
*
|
|
8
|
+
* - `chosen`: the run starts its runner sandboxes from `snapshot`.
|
|
9
|
+
* - `failed`: the build of a base snapshot, a Sandbox call, or the checkout failed.
|
|
10
|
+
* - `aborted`: the run's signal aborted. A base snapshot whose save had begun is still saved and cached, so the next
|
|
11
|
+
* run starts from it.
|
|
12
|
+
*/
|
|
13
|
+
export type SnapshotChoiceEnd = {
|
|
14
|
+
readonly kind: "chosen";
|
|
15
|
+
readonly snapshot: ChosenSnapshot;
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: "failed";
|
|
18
|
+
readonly failure: RunnerFailure;
|
|
19
|
+
} | {
|
|
20
|
+
readonly kind: "aborted";
|
|
21
|
+
};
|
|
22
|
+
/** How the choice ended (`SnapshotChoiceEnd`), with what closing its sandbox scope left (`cleanup`). */
|
|
23
|
+
export type SnapshotChoice = SnapshotChoiceEnd & {
|
|
24
|
+
readonly cleanup: RunnerScopeFacts;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Chooses the runner snapshot a prepared run starts from (`chooseSnapshot`), reporting to `progress`: the cached one
|
|
28
|
+
* for the access's team and project, or a base snapshot it builds. It starts no runner sandbox, and closes every
|
|
29
|
+
* sandbox it started however it ends, keeping none. `signal` is the command's cancel signal, which the scope listens
|
|
30
|
+
* to so a cancel reports `stopping`, revokes every credential at once, and stops its sandboxes. Optional `stop` stops
|
|
31
|
+
* the choice without reporting cancellation (for example, when a sibling preparation lane fails). A base snapshot's
|
|
32
|
+
* save isn't stopped by either signal, so after the choice it checks both and ends `aborted`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function chooseSnapshotForRun(context: RunnerContext, request: ReadyRunnerRequest, control: {
|
|
35
|
+
readonly signal: AbortSignal;
|
|
36
|
+
readonly stop?: AbortSignal;
|
|
37
|
+
}, progress: RunnerProgress): Promise<SnapshotChoice>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Choosing a run's runner snapshot once, apart from any runner sandbox: for a run that starts several runner sandboxes
|
|
2
|
+
// from one snapshot. It owns a sandbox scope of its own for the build sandbox, as `buildSnapshots` does, and closes it
|
|
3
|
+
// before it answers, so each runner session that follows starts from a snapshot that exists and waits on no other.
|
|
4
|
+
import { runnerNetworkPolicy } from "./network-policy.js";
|
|
5
|
+
import { chooseSnapshot } from "./ready.js";
|
|
6
|
+
import { runnerSandboxScope } from "./scope.js";
|
|
7
|
+
/**
|
|
8
|
+
* Chooses the runner snapshot a prepared run starts from (`chooseSnapshot`), reporting to `progress`: the cached one
|
|
9
|
+
* for the access's team and project, or a base snapshot it builds. It starts no runner sandbox, and closes every
|
|
10
|
+
* sandbox it started however it ends, keeping none. `signal` is the command's cancel signal, which the scope listens
|
|
11
|
+
* to so a cancel reports `stopping`, revokes every credential at once, and stops its sandboxes. Optional `stop` stops
|
|
12
|
+
* the choice without reporting cancellation (for example, when a sibling preparation lane fails). A base snapshot's
|
|
13
|
+
* save isn't stopped by either signal, so after the choice it checks both and ends `aborted`.
|
|
14
|
+
*/
|
|
15
|
+
export async function chooseSnapshotForRun(context, request, control, progress) {
|
|
16
|
+
const { signal, stop } = control;
|
|
17
|
+
const stageSignal = stop === undefined ? signal : AbortSignal.any([signal, stop]);
|
|
18
|
+
// The sandbox scope hears only the command's cancel signal, so a sibling stop ends the choice cleanly without
|
|
19
|
+
// reporting cancellation or stopping sandboxes outside the running step.
|
|
20
|
+
const scope = runnerSandboxScope(context, progress, {
|
|
21
|
+
keepMs: 0,
|
|
22
|
+
basePolicy: runnerNetworkPolicy(request.prepared.recipe),
|
|
23
|
+
signal,
|
|
24
|
+
});
|
|
25
|
+
try {
|
|
26
|
+
const chosen = await chooseSnapshot(context, request, { scope, signal: stageSignal }, progress);
|
|
27
|
+
const cleanup = await scope.close();
|
|
28
|
+
if (chosen.kind !== "ok")
|
|
29
|
+
return { ...chosen, cleanup };
|
|
30
|
+
if (stageSignal.aborted)
|
|
31
|
+
return { kind: "aborted", cleanup };
|
|
32
|
+
return { kind: "chosen", snapshot: chosen.value, cleanup };
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
await scope.close();
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { CheckoutGateway } from "./gateways.ts";
|
|
2
|
-
import { type CheckedRecipe, type
|
|
2
|
+
import { type CheckedRecipe, type RunnerStep } from "./recipe.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Bump when a runner snapshot changes in a way its steps' text doesn't show (the scripts between the steps, what is
|
|
5
5
|
* uploaded, the build sandbox), or the key's encoding changes, so earlier snapshots stop matching. 2 added each step's
|
|
6
|
-
* runner secret names. 3 dropped dev snapshots.
|
|
6
|
+
* runner secret names. 3 dropped dev snapshots. 4 replaced per-step runner secret names with the recipe's credential
|
|
7
|
+
* source identities (`credentials=`).
|
|
7
8
|
*/
|
|
8
|
-
export declare const SNAPSHOT_FORMAT =
|
|
9
|
+
export declare const SNAPSHOT_FORMAT = 4;
|
|
9
10
|
/** Where the repository lives in every runner and build sandbox. */
|
|
10
11
|
export declare const SANDBOX_ROOT = "/vercel/sandbox";
|
|
11
12
|
/** The names of the files uploaded to a sandbox's staging directory. */
|
|
@@ -32,22 +33,23 @@ export declare function baseIndexScript(base: string, staging: string): string;
|
|
|
32
33
|
*/
|
|
33
34
|
export declare function applyScript(staging: string, root?: string): string;
|
|
34
35
|
/**
|
|
35
|
-
* The snapshot key: sha256 hex over `format=<SNAPSHOT_FORMAT>`,
|
|
36
|
-
*
|
|
37
|
-
* and `<staging>`, and each prebuild step's
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* cache entry records it beside the key.
|
|
36
|
+
* The snapshot key: sha256 hex over `format=<SNAPSHOT_FORMAT>`, `credentials=<the secret source identities the recipe's
|
|
37
|
+
* credentials read, sorted, once each, joined with ",">`, each toolchain step's label and script, the base-index script
|
|
38
|
+
* with the placeholders `<base>` and `<staging>`, and each prebuild step's label and script, joined with NUL. A recipe
|
|
39
|
+
* without credentials gives `credentials=`. Every snapshot step gets every credential, so the source identities are in
|
|
40
|
+
* the key once, never the values, domains, or headers: a recipe that reads another source builds another snapshot, and
|
|
41
|
+
* every machine with the same recipe shares one. The base isn't in the key: a cache entry records it beside the key.
|
|
41
42
|
*/
|
|
42
43
|
export declare function snapshotKey(steps: {
|
|
44
|
+
readonly credentials: readonly string[];
|
|
43
45
|
readonly toolchains: readonly RunnerStep[];
|
|
44
46
|
readonly prebuild: readonly RunnerStep[];
|
|
45
47
|
}): string;
|
|
46
48
|
/** A recipe's snapshot steps at one base and their key, or the step key whose function failed there and why. */
|
|
47
49
|
export type SnapshotStepsAt = {
|
|
48
50
|
readonly ok: true;
|
|
49
|
-
readonly toolchains: readonly
|
|
50
|
-
readonly prebuild: readonly
|
|
51
|
+
readonly toolchains: readonly RunnerStep[];
|
|
52
|
+
readonly prebuild: readonly RunnerStep[];
|
|
51
53
|
readonly key: string;
|
|
52
54
|
} | {
|
|
53
55
|
readonly ok: false;
|
|
@@ -55,14 +57,14 @@ export type SnapshotStepsAt = {
|
|
|
55
57
|
readonly problem: string;
|
|
56
58
|
};
|
|
57
59
|
/**
|
|
58
|
-
* Evaluates `recipe`'s toolchain and prebuild steps at `base`,
|
|
59
|
-
*
|
|
60
|
+
* Evaluates `recipe`'s toolchain and prebuild steps at `base`, and computes their snapshot key with the secret source
|
|
61
|
+
* identities the recipe's credentials read.
|
|
60
62
|
*/
|
|
61
63
|
export declare function snapshotStepsAt(checkout: CheckoutGateway, request: {
|
|
62
64
|
readonly repoRoot: string;
|
|
63
65
|
readonly base: string;
|
|
64
66
|
readonly recipe: {
|
|
65
67
|
readonly snapshot: Pick<CheckedRecipe["snapshot"], "toolchains" | "prebuild">;
|
|
66
|
-
readonly
|
|
68
|
+
readonly credentials: CheckedRecipe["credentials"];
|
|
67
69
|
};
|
|
68
70
|
}): Promise<SnapshotStepsAt>;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
// What a runner snapshot is built from, and the scripts that commit a base in a build sandbox and a run's changes in
|
|
2
|
-
// a runner sandbox. The snapshot key hashes the steps' text and the
|
|
3
|
-
// a step means a new snapshot.
|
|
2
|
+
// a runner sandbox. The snapshot key hashes the steps' text and the secret source identities the recipe's credentials
|
|
3
|
+
// read, so editing a step means a new snapshot.
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import { baseStepContext } from "./base.js";
|
|
6
|
-
import { resolveSteps } from "./recipe.js";
|
|
6
|
+
import { credentialSourceIds, resolveSteps } from "./recipe.js";
|
|
7
7
|
/**
|
|
8
8
|
* Bump when a runner snapshot changes in a way its steps' text doesn't show (the scripts between the steps, what is
|
|
9
9
|
* uploaded, the build sandbox), or the key's encoding changes, so earlier snapshots stop matching. 2 added each step's
|
|
10
|
-
* runner secret names. 3 dropped dev snapshots.
|
|
10
|
+
* runner secret names. 3 dropped dev snapshots. 4 replaced per-step runner secret names with the recipe's credential
|
|
11
|
+
* source identities (`credentials=`).
|
|
11
12
|
*/
|
|
12
|
-
export const SNAPSHOT_FORMAT =
|
|
13
|
+
export const SNAPSHOT_FORMAT = 4;
|
|
13
14
|
/** Where the repository lives in every runner and build sandbox. */
|
|
14
15
|
export const SANDBOX_ROOT = "/vercel/sandbox";
|
|
15
16
|
/** The names of the files uploaded to a sandbox's staging directory. */
|
|
@@ -69,18 +70,19 @@ export function applyScript(staging, root = SANDBOX_ROOT) {
|
|
|
69
70
|
], root);
|
|
70
71
|
}
|
|
71
72
|
/**
|
|
72
|
-
* The snapshot key: sha256 hex over `format=<SNAPSHOT_FORMAT>`,
|
|
73
|
-
*
|
|
74
|
-
* and `<staging>`, and each prebuild step's
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* cache entry records it beside the key.
|
|
73
|
+
* The snapshot key: sha256 hex over `format=<SNAPSHOT_FORMAT>`, `credentials=<the secret source identities the recipe's
|
|
74
|
+
* credentials read, sorted, once each, joined with ",">`, each toolchain step's label and script, the base-index script
|
|
75
|
+
* with the placeholders `<base>` and `<staging>`, and each prebuild step's label and script, joined with NUL. A recipe
|
|
76
|
+
* without credentials gives `credentials=`. Every snapshot step gets every credential, so the source identities are in
|
|
77
|
+
* the key once, never the values, domains, or headers: a recipe that reads another source builds another snapshot, and
|
|
78
|
+
* every machine with the same recipe shares one. The base isn't in the key: a cache entry records it beside the key.
|
|
78
79
|
*/
|
|
79
80
|
export function snapshotKey(steps) {
|
|
80
|
-
const text = (list) => list.flatMap(({ label, script
|
|
81
|
+
const text = (list) => list.flatMap(({ label, script }) => [label, script]);
|
|
81
82
|
return createHash("sha256")
|
|
82
83
|
.update([
|
|
83
84
|
`format=${SNAPSHOT_FORMAT}`,
|
|
85
|
+
`credentials=${[...new Set(steps.credentials)].toSorted().join(",")}`,
|
|
84
86
|
...text(steps.toolchains),
|
|
85
87
|
baseIndexScript("<base>", "<staging>"),
|
|
86
88
|
...text(steps.prebuild),
|
|
@@ -88,22 +90,26 @@ export function snapshotKey(steps) {
|
|
|
88
90
|
.digest("hex");
|
|
89
91
|
}
|
|
90
92
|
/**
|
|
91
|
-
* Evaluates `recipe`'s toolchain and prebuild steps at `base`,
|
|
92
|
-
*
|
|
93
|
+
* Evaluates `recipe`'s toolchain and prebuild steps at `base`, and computes their snapshot key with the secret source
|
|
94
|
+
* identities the recipe's credentials read.
|
|
93
95
|
*/
|
|
94
96
|
export async function snapshotStepsAt(checkout, request) {
|
|
95
97
|
const context = baseStepContext(checkout, request);
|
|
96
|
-
const { snapshot
|
|
97
|
-
const toolchains = await resolveSteps(snapshot.toolchains, context
|
|
98
|
+
const { snapshot } = request.recipe;
|
|
99
|
+
const toolchains = await resolveSteps(snapshot.toolchains, context);
|
|
98
100
|
if (!toolchains.ok)
|
|
99
101
|
return { ok: false, path: ["snapshot", "toolchains"], problem: toolchains.problem };
|
|
100
|
-
const prebuild = await resolveSteps(snapshot.prebuild, context
|
|
102
|
+
const prebuild = await resolveSteps(snapshot.prebuild, context);
|
|
101
103
|
if (!prebuild.ok)
|
|
102
104
|
return { ok: false, path: ["snapshot", "prebuild"], problem: prebuild.problem };
|
|
103
105
|
return {
|
|
104
106
|
ok: true,
|
|
105
107
|
toolchains: toolchains.steps,
|
|
106
108
|
prebuild: prebuild.steps,
|
|
107
|
-
key: snapshotKey({
|
|
109
|
+
key: snapshotKey({
|
|
110
|
+
credentials: credentialSourceIds(request.recipe),
|
|
111
|
+
toolchains: toolchains.steps,
|
|
112
|
+
prebuild: prebuild.steps,
|
|
113
|
+
}),
|
|
108
114
|
};
|
|
109
115
|
}
|
package/dist/runner/steps.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Clock } from "../time/index.ts";
|
|
2
|
-
import { type RunnerFailure, type RunnerProgress, type RunnerSandboxCall, type RunnerStage, type RunnerStepPhase } from "./events.ts";
|
|
2
|
+
import { type NetworkPolicyPlace, type RunnerFailure, type RunnerProgress, type RunnerSandboxCall, type RunnerStage, type RunnerStepPhase } from "./events.ts";
|
|
3
3
|
import type { RunnerSandbox, RunnerSandboxFailure, RunnerSandboxGateway, RunnerStartFailure } from "./gateways.ts";
|
|
4
|
-
import type {
|
|
4
|
+
import type { NetworkPolicyWriteFailure } from "./network-policy.ts";
|
|
5
5
|
/** Every step's environment: no Git hook, prompt or update check gets in the way. */
|
|
6
6
|
export declare const STEP_ENV: Readonly<Record<string, string>>;
|
|
7
7
|
/**
|
|
@@ -23,8 +23,9 @@ export type StepOutcome = {
|
|
|
23
23
|
readonly failure: RunnerSandboxFailure;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
* Runs `script` in `sandbox` as a step labeled `label`, reporting it under `phase`. Its environment is `STEP_ENV
|
|
27
|
-
*
|
|
26
|
+
* Runs `script` in `sandbox` as a step labeled `label`, reporting it under `phase`. Its environment is `STEP_ENV`, for
|
|
27
|
+
* every step: no credential enters a step's environment; a credential reaches only the step's requests, through the
|
|
28
|
+
* sandbox's network policy (`RunnerSandboxScope.grantCredentials`).
|
|
28
29
|
*/
|
|
29
30
|
export declare function runStep(context: {
|
|
30
31
|
readonly runnerSandboxes: RunnerSandboxGateway;
|
|
@@ -34,8 +35,15 @@ export declare function runStep(context: {
|
|
|
34
35
|
readonly phase: RunnerStepPhase;
|
|
35
36
|
readonly label: string;
|
|
36
37
|
readonly script: string;
|
|
37
|
-
readonly secrets?: RunnerSecrets;
|
|
38
38
|
}, progress: RunnerProgress, signal: AbortSignal): Promise<StepOutcome>;
|
|
39
|
+
/**
|
|
40
|
+
* How a stage ends on a failed network policy write at `around`: granting credentials before the recipe's snapshot
|
|
41
|
+
* steps, its run steps, or the command, or revoking them before a snapshot save. A stop when the run was canceled, or
|
|
42
|
+
* closing the scope began, a failure otherwise.
|
|
43
|
+
*/
|
|
44
|
+
export declare function networkPolicyStop(operation: "inject" | "remove", around: NetworkPolicyPlace, failure: NetworkPolicyWriteFailure): Exclude<RunnerStage<never>, {
|
|
45
|
+
readonly kind: "ok";
|
|
46
|
+
}>;
|
|
39
47
|
/** A Sandbox failure other than an abort, as the runner reports it. */
|
|
40
48
|
export declare function sandboxApiFailure(operation: RunnerSandboxCall, failure: Exclude<RunnerStartFailure, {
|
|
41
49
|
readonly kind: "aborted";
|
package/dist/runner/steps.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Running one step in a sandbox: its output streamed line by line to the run's progress, its last lines kept for the
|
|
2
|
-
// error when it fails, and how long it took.
|
|
2
|
+
// error when it fails, and how long it took, plus translating Sandbox and network policy failures into stage outcomes.
|
|
3
3
|
import { progressQueue, } from "./events.js";
|
|
4
4
|
import { lineSplitter, outputTail, splitLines } from "./output.js";
|
|
5
5
|
/** Every step's environment: no Git hook, prompt or update check gets in the way. */
|
|
@@ -10,8 +10,9 @@ export const STEP_ENV = {
|
|
|
10
10
|
npm_config_update_notifier: "false",
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
* Runs `script` in `sandbox` as a step labeled `label`, reporting it under `phase`. Its environment is `STEP_ENV
|
|
14
|
-
*
|
|
13
|
+
* Runs `script` in `sandbox` as a step labeled `label`, reporting it under `phase`. Its environment is `STEP_ENV`, for
|
|
14
|
+
* every step: no credential enters a step's environment; a credential reaches only the step's requests, through the
|
|
15
|
+
* sandbox's network policy (`RunnerSandboxScope.grantCredentials`).
|
|
15
16
|
*/
|
|
16
17
|
export async function runStep(context, request, progress, signal) {
|
|
17
18
|
const { phase, label } = request;
|
|
@@ -26,7 +27,7 @@ export async function runStep(context, request, progress, signal) {
|
|
|
26
27
|
queue.add({ kind: "step-output", phase, stream, line });
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
|
-
const ran = await context.runnerSandboxes.runScript(request.sandbox, { script: request.script, env: { ...STEP_ENV
|
|
30
|
+
const ran = await context.runnerSandboxes.runScript(request.sandbox, { script: request.script, env: { ...STEP_ENV } }, ({ stream, data }) => emit(stream, splitters[stream].push(data)), signal);
|
|
30
31
|
emit("stdout", splitters.stdout.flush());
|
|
31
32
|
emit("stderr", splitters.stderr.flush());
|
|
32
33
|
await queue.flush();
|
|
@@ -38,6 +39,35 @@ export async function runStep(context, request, progress, signal) {
|
|
|
38
39
|
await progress.emit({ kind: "step-finished", phase, label, ms });
|
|
39
40
|
return { kind: "succeeded", ms };
|
|
40
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* How a stage ends on a failed network policy write at `around`: granting credentials before the recipe's snapshot
|
|
44
|
+
* steps, its run steps, or the command, or revoking them before a snapshot save. A stop when the run was canceled, or
|
|
45
|
+
* closing the scope began, a failure otherwise.
|
|
46
|
+
*/
|
|
47
|
+
export function networkPolicyStop(operation, around, failure) {
|
|
48
|
+
if (failure.kind === "aborted")
|
|
49
|
+
return { kind: "aborted" };
|
|
50
|
+
return {
|
|
51
|
+
kind: "failed",
|
|
52
|
+
failure: failure.kind === "timed-out"
|
|
53
|
+
? {
|
|
54
|
+
kind: "network-policy-failed",
|
|
55
|
+
operation,
|
|
56
|
+
around,
|
|
57
|
+
reason: "timed-out",
|
|
58
|
+
status: null,
|
|
59
|
+
message: `no answer within ${failure.limitMs / 1000} seconds`,
|
|
60
|
+
}
|
|
61
|
+
: {
|
|
62
|
+
kind: "network-policy-failed",
|
|
63
|
+
operation,
|
|
64
|
+
around,
|
|
65
|
+
reason: "api",
|
|
66
|
+
status: failure.status ?? null,
|
|
67
|
+
message: failure.message,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
41
71
|
/** A Sandbox failure other than an abort, as the runner reports it. */
|
|
42
72
|
export function sandboxApiFailure(operation, failure) {
|
|
43
73
|
if (failure.kind === "snapshot-gone")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Timer } from "../time/index.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Calls `call` with a signal that aborts after `ms` on `timer`: the call's answer, or null when it had none by then,
|
|
4
|
+
* when the wait ends. The call's answer comes first, so an instant answer wins against a timer that never waits.
|
|
5
|
+
*/
|
|
6
|
+
export declare function callWithin<T>(timer: Timer, ms: number, call: (signal: AbortSignal) => Promise<T>): Promise<T | null>;
|
|
7
|
+
/** Returned by `untilAborted` when the signal aborted before the promise settled. */
|
|
8
|
+
export declare const ABORTED: unique symbol;
|
|
9
|
+
/** `promise`'s answer, or `ABORTED` as soon as `signal` aborts, whether or not `promise` has answered by then. */
|
|
10
|
+
export declare function untilAborted<T>(promise: Promise<T>, signal: AbortSignal): Promise<T | typeof ABORTED>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// A call with a time limit: every platform call the runner bounds, such as a network policy write, each stop and delete
|
|
2
|
+
// of a sandbox, keeping the runner sandbox running, and the end of following the test events file, goes through it.
|
|
3
|
+
/**
|
|
4
|
+
* Calls `call` with a signal that aborts after `ms` on `timer`: the call's answer, or null when it had none by then,
|
|
5
|
+
* when the wait ends. The call's answer comes first, so an instant answer wins against a timer that never waits.
|
|
6
|
+
*/
|
|
7
|
+
export function callWithin(timer, ms, call) {
|
|
8
|
+
const abort = new AbortController();
|
|
9
|
+
const limit = new AbortController();
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
call(abort.signal).then((answer) => {
|
|
12
|
+
limit.abort();
|
|
13
|
+
resolve(answer);
|
|
14
|
+
}, (error) => {
|
|
15
|
+
limit.abort();
|
|
16
|
+
reject(error);
|
|
17
|
+
});
|
|
18
|
+
void timer.sleep(ms, limit.signal).then(() => {
|
|
19
|
+
if (limit.signal.aborted)
|
|
20
|
+
return;
|
|
21
|
+
abort.abort();
|
|
22
|
+
resolve(null);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** Returned by `untilAborted` when the signal aborted before the promise settled. */
|
|
27
|
+
export const ABORTED = Symbol("aborted");
|
|
28
|
+
/** `promise`'s answer, or `ABORTED` as soon as `signal` aborts, whether or not `promise` has answered by then. */
|
|
29
|
+
export function untilAborted(promise, signal) {
|
|
30
|
+
if (signal.aborted)
|
|
31
|
+
return Promise.resolve(ABORTED);
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
const onAbort = () => resolve(ABORTED);
|
|
34
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
35
|
+
promise.then((answer) => {
|
|
36
|
+
signal.removeEventListener("abort", onAbort);
|
|
37
|
+
resolve(answer);
|
|
38
|
+
}, (error) => {
|
|
39
|
+
signal.removeEventListener("abort", onAbort);
|
|
40
|
+
reject(error);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -47,16 +47,10 @@ interface ClinkrExample {
|
|
|
47
47
|
readonly description?: string;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* The run examples an extension brings to
|
|
51
|
-
* `storm exec`, which has no driver, and those for each driver's command, by the driver's name
|
|
52
|
-
* (`Driver.name`). A name is a plain string, with no import behind it: examples under a name no driver in the
|
|
53
|
-
* registry has show in no help.
|
|
50
|
+
* The run examples an extension brings to `storm exec`'s help, listed after `storm exec`'s own examples.
|
|
54
51
|
*/
|
|
55
52
|
export interface RunExamples {
|
|
56
53
|
readonly exec: readonly ClinkrExample[];
|
|
57
|
-
readonly drivers: {
|
|
58
|
-
readonly [driver: string]: readonly ClinkrExample[];
|
|
59
|
-
};
|
|
60
54
|
}
|
|
61
55
|
/** What an extension reads of each resource it brings: its definition's name. */
|
|
62
56
|
interface NamedResource {
|