@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,13 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RUN_PAYLOAD_VARIABLE,
|
|
3
3
|
SANDBOX_TEST_EVENTS_PATH,
|
|
4
|
+
chooseSnapshotForRun,
|
|
4
5
|
credentialSourceFor,
|
|
5
6
|
lineSplitter,
|
|
6
7
|
openRunnerSession,
|
|
7
8
|
parseTestEvent,
|
|
8
9
|
systemClock,
|
|
9
10
|
systemTimer
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-L36GBUBB.js";
|
|
12
|
+
import {
|
|
13
|
+
describeMintFailure
|
|
14
|
+
} from "./chunk-AWBSONHB.js";
|
|
11
15
|
|
|
12
16
|
// src/core/reports.ts
|
|
13
17
|
var WARNINGS_HEADING = "Warnings";
|
|
@@ -53,6 +57,20 @@ function commandExitStatus(outcome) {
|
|
|
53
57
|
return number === void 0 ? 1 : 128 + number;
|
|
54
58
|
}
|
|
55
59
|
|
|
60
|
+
// src/core/setup-phases.ts
|
|
61
|
+
function setupPhaseKey({ resource, label }) {
|
|
62
|
+
return `${resource}\0${label}`;
|
|
63
|
+
}
|
|
64
|
+
function setupPhaseWords(phases) {
|
|
65
|
+
const resources = /* @__PURE__ */ new Map();
|
|
66
|
+
for (const { label, resource } of phases) {
|
|
67
|
+
const owners = resources.get(label) ?? /* @__PURE__ */ new Set();
|
|
68
|
+
resources.set(label, owners);
|
|
69
|
+
owners.add(resource);
|
|
70
|
+
}
|
|
71
|
+
return ({ label, resource }) => (resources.get(label)?.size ?? 0) > 1 ? `${label} (${resource})` : label;
|
|
72
|
+
}
|
|
73
|
+
|
|
56
74
|
// src/core/before-run.ts
|
|
57
75
|
function bindLifecycles(lookup, resourceContexts2) {
|
|
58
76
|
const { definitions: resources, named } = lookup;
|
|
@@ -73,6 +91,7 @@ function bindLifecycles(lookup, resourceContexts2) {
|
|
|
73
91
|
const skipped = [];
|
|
74
92
|
const secrets = [];
|
|
75
93
|
let needsVercelCredential = false;
|
|
94
|
+
const needRunnerSandbox = [];
|
|
76
95
|
const hiddenVariables = /* @__PURE__ */ new Set();
|
|
77
96
|
for (const [key, { definition, options, sources }] of Object.entries(inputs)) {
|
|
78
97
|
const answered = await lifecycleOf(definition, key).beforeRun({ options, sources });
|
|
@@ -84,9 +103,18 @@ function bindLifecycles(lookup, resourceContexts2) {
|
|
|
84
103
|
requests[key] = { definition, options, secrets: answered.use.secrets };
|
|
85
104
|
secrets.push(...Object.values(answered.use.secrets));
|
|
86
105
|
needsVercelCredential ||= answered.use.needsVercelCredential;
|
|
106
|
+
if (answered.use.needsRunnerSandbox) needRunnerSandbox.push(key);
|
|
87
107
|
for (const name of answered.use.hiddenVariables) hiddenVariables.add(name);
|
|
88
108
|
}
|
|
89
|
-
return {
|
|
109
|
+
return {
|
|
110
|
+
ok: true,
|
|
111
|
+
requests,
|
|
112
|
+
skipped,
|
|
113
|
+
secrets,
|
|
114
|
+
needsVercelCredential,
|
|
115
|
+
needRunnerSandbox,
|
|
116
|
+
hiddenVariables: [...hiddenVariables]
|
|
117
|
+
};
|
|
90
118
|
}
|
|
91
119
|
};
|
|
92
120
|
}
|
|
@@ -232,20 +260,6 @@ function resourceReports(lookup) {
|
|
|
232
260
|
};
|
|
233
261
|
}
|
|
234
262
|
|
|
235
|
-
// src/core/setup-phases.ts
|
|
236
|
-
function setupPhaseKey({ resource, label }) {
|
|
237
|
-
return `${resource}\0${label}`;
|
|
238
|
-
}
|
|
239
|
-
function setupPhaseWords(phases) {
|
|
240
|
-
const resources = /* @__PURE__ */ new Map();
|
|
241
|
-
for (const { label, resource } of phases) {
|
|
242
|
-
const owners = resources.get(label) ?? /* @__PURE__ */ new Set();
|
|
243
|
-
resources.set(label, owners);
|
|
244
|
-
owners.add(resource);
|
|
245
|
-
}
|
|
246
|
-
return ({ label, resource }) => (resources.get(label)?.size ?? 0) > 1 ? `${label} (${resource})` : label;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
263
|
// src/core/run-state.ts
|
|
250
264
|
var RUNNER_STEPS = ["snapshot", "start", "upload", "apply", "install", "build"];
|
|
251
265
|
var EMPTY_RUN_STATE = {
|
|
@@ -388,6 +402,13 @@ function applyEvent(resources, state, event, at) {
|
|
|
388
402
|
case "test-event-unreadable":
|
|
389
403
|
case "test-events-incomplete":
|
|
390
404
|
return state;
|
|
405
|
+
// A run across runner sandboxes keeps each runner sandbox's state apart, folded from the run's events and that
|
|
406
|
+
// runner sandbox's own: the run's state keeps none of a runner sandbox's events, and neither of its own events
|
|
407
|
+
// about runner sandboxes changes it.
|
|
408
|
+
case "sandboxes-started":
|
|
409
|
+
case "sandbox":
|
|
410
|
+
case "sandbox-ended":
|
|
411
|
+
return state;
|
|
391
412
|
// A resource's own events reach its progress, if it has its own. Its cleanup counts through `cleanup-finished`.
|
|
392
413
|
case "resource":
|
|
393
414
|
return withOwnLane(
|
|
@@ -510,6 +531,7 @@ function applyTestEvent(tests, event, at) {
|
|
|
510
531
|
passed: tests.passed + (event.state === "pass" ? 1 : 0),
|
|
511
532
|
failed: tests.failed + (event.state === "fail" ? 1 : 0)
|
|
512
533
|
};
|
|
534
|
+
if (!("worker" in event) || event.worker === void 0) return tests;
|
|
513
535
|
const existing = tests.workers.find((candidate) => candidate.worker === event.worker);
|
|
514
536
|
const worker = existing ?? {
|
|
515
537
|
worker: event.worker,
|
|
@@ -621,19 +643,19 @@ function timeline(resources, state) {
|
|
|
621
643
|
const waited = rows[index];
|
|
622
644
|
if (waited !== void 0) rows[index] = { ...waited, idleMs: last.readyAt - lane.readyAt };
|
|
623
645
|
}
|
|
624
|
-
if (command !== void 0) rows.push(row(
|
|
646
|
+
if (command !== void 0) rows.push(row(COMMAND, command));
|
|
625
647
|
if (cleanup !== void 0) rows.push(row(CLEANUP, cleanup));
|
|
626
648
|
const waitedOn = last?.ref ?? started[0]?.ref ?? (runnerStarted ? RUNNER : void 0);
|
|
627
649
|
return {
|
|
628
650
|
startedAt: new Date(origin).toISOString(),
|
|
629
651
|
totalMs,
|
|
630
652
|
rows,
|
|
631
|
-
criticalPath: command === void 0 ? [] : waitedOn === void 0 ? [
|
|
653
|
+
criticalPath: command === void 0 ? [] : waitedOn === void 0 ? [COMMAND] : [waitedOn, COMMAND]
|
|
632
654
|
};
|
|
633
655
|
}
|
|
634
656
|
var MINT = { name: "mint", resource: null };
|
|
635
657
|
var RUNNER = { name: "runner", resource: null };
|
|
636
|
-
var
|
|
658
|
+
var COMMAND = { name: "command", resource: null };
|
|
637
659
|
var CLEANUP = { name: "cleanup", resource: null };
|
|
638
660
|
function sameRow(a, b) {
|
|
639
661
|
return a.resource === null ? b.resource === null && a.name === b.name : a.resource === b.resource;
|
|
@@ -684,6 +706,19 @@ function driverContexts(drivers) {
|
|
|
684
706
|
}
|
|
685
707
|
|
|
686
708
|
// src/core/events.ts
|
|
709
|
+
var SANDBOX_FAILED_STAGES = [
|
|
710
|
+
"mint",
|
|
711
|
+
"snapshot",
|
|
712
|
+
"resource",
|
|
713
|
+
"checkout",
|
|
714
|
+
"start",
|
|
715
|
+
"upload",
|
|
716
|
+
"apply",
|
|
717
|
+
"install",
|
|
718
|
+
"build",
|
|
719
|
+
"command",
|
|
720
|
+
"storm"
|
|
721
|
+
];
|
|
687
722
|
function timedProgress(clock, observer) {
|
|
688
723
|
return { emit: (event) => observer.observe({ event, at: clock.now() }) };
|
|
689
724
|
}
|
|
@@ -967,7 +1002,8 @@ function runPayload(resources, options = {}) {
|
|
|
967
1002
|
version: 3,
|
|
968
1003
|
resources,
|
|
969
1004
|
...options.testEvents === void 0 ? {} : { testEvents: options.testEvents },
|
|
970
|
-
...options.verbose === true ? { verbose: true } : {}
|
|
1005
|
+
...options.verbose === true ? { verbose: true } : {},
|
|
1006
|
+
...options.sandbox === void 0 ? {} : { sandbox: options.sandbox }
|
|
971
1007
|
};
|
|
972
1008
|
}
|
|
973
1009
|
function commandEnvironment(env, payload) {
|
|
@@ -1053,6 +1089,20 @@ function instanceOf(resource, key, resourceContexts2, request) {
|
|
|
1053
1089
|
const one = acquired();
|
|
1054
1090
|
return one === void 0 ? {} : { [key]: { definition: name, payload: one.payload } };
|
|
1055
1091
|
},
|
|
1092
|
+
credentials: () => acquired()?.credentials ?? [],
|
|
1093
|
+
split: (sandboxes) => {
|
|
1094
|
+
const one = acquired();
|
|
1095
|
+
if (one === void 0) throw new Error(`${key} was split before it was acquired`);
|
|
1096
|
+
const answered = lifecycle.split({ payload: one.payload, sandboxes });
|
|
1097
|
+
if ("refused" in answered)
|
|
1098
|
+
return {
|
|
1099
|
+
kind: "refused",
|
|
1100
|
+
outcome: { kind: "resource_refused", resource: key, definition: name, refusal: answered }
|
|
1101
|
+
};
|
|
1102
|
+
if (answered.parts.length !== sandboxes)
|
|
1103
|
+
throw new Error(`${key}'s split answered ${answered.parts.length} parts for ${sandboxes} runner sandboxes`);
|
|
1104
|
+
return { kind: "split", parts: answered.parts.map((payload) => ({ [key]: { definition: name, payload } })) };
|
|
1105
|
+
},
|
|
1056
1106
|
ran: () => {
|
|
1057
1107
|
const one = acquired();
|
|
1058
1108
|
if (one === void 0 || one.result === void 0 && acquireWarnings.length === 0) return {};
|
|
@@ -1061,9 +1111,10 @@ function instanceOf(resource, key, resourceContexts2, request) {
|
|
|
1061
1111
|
return { [key]: { definition: name, facts, rows, warnings: [...acquireWarnings] } };
|
|
1062
1112
|
},
|
|
1063
1113
|
took: () => taken.length > 0,
|
|
1064
|
-
release: async (progress) => {
|
|
1114
|
+
release: async (progress, { runnerSandboxFenced }) => {
|
|
1065
1115
|
const released = await lifecycle.releaseAfterRun({
|
|
1066
1116
|
taken,
|
|
1117
|
+
runnerSandboxFenced,
|
|
1067
1118
|
report: report(progress, "cleanup", releaseWarnings)
|
|
1068
1119
|
});
|
|
1069
1120
|
if ("nothingTaken" in released) return {};
|
|
@@ -1129,6 +1180,50 @@ function resourcesPayload(instances) {
|
|
|
1129
1180
|
for (const instance of instances) resources = { ...resources, ...instance.payload() };
|
|
1130
1181
|
return resources;
|
|
1131
1182
|
}
|
|
1183
|
+
function resourcesCredentials(instances, configCredentials = []) {
|
|
1184
|
+
const all = [];
|
|
1185
|
+
const headerOwners = /* @__PURE__ */ new Map();
|
|
1186
|
+
const domainRequests = /* @__PURE__ */ new Map();
|
|
1187
|
+
const check = (owner, credential) => {
|
|
1188
|
+
const domain = credential.domain.toLowerCase();
|
|
1189
|
+
const header = credential.header.toLowerCase();
|
|
1190
|
+
const requests = credential.requests ?? "read";
|
|
1191
|
+
const slot = `${domain} ${header}`;
|
|
1192
|
+
const sameHeader = headerOwners.get(slot);
|
|
1193
|
+
if (sameHeader !== void 0)
|
|
1194
|
+
throw new Error(
|
|
1195
|
+
`${ownerText(sameHeader)} and ${ownerText(owner)} both give a credential for the header ${credential.header} on requests to ${credential.domain}; the firewall holds one value per header`
|
|
1196
|
+
);
|
|
1197
|
+
const sameDomain = domainRequests.get(domain);
|
|
1198
|
+
if (sameDomain !== void 0 && sameDomain.requests !== requests)
|
|
1199
|
+
throw new Error(
|
|
1200
|
+
`${ownerText(sameDomain.owner)} gives a credential for ${credential.domain} on ${sameDomain.requests} requests and ${ownerText(owner)} on ${requests} requests; the firewall holds one rule set per domain`
|
|
1201
|
+
);
|
|
1202
|
+
headerOwners.set(slot, owner);
|
|
1203
|
+
if (sameDomain === void 0) domainRequests.set(domain, { owner, requests });
|
|
1204
|
+
return { domain, header, value: credential.value, requests };
|
|
1205
|
+
};
|
|
1206
|
+
for (const credential of configCredentials) check({ config: true }, credential);
|
|
1207
|
+
for (const instance of instances) {
|
|
1208
|
+
const resource = instance.listing.resource;
|
|
1209
|
+
for (const credential of instance.credentials()) {
|
|
1210
|
+
all.push({ resource, credential: check({ resource }, credential) });
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
return all;
|
|
1214
|
+
}
|
|
1215
|
+
function ownerText(owner) {
|
|
1216
|
+
return "resource" in owner ? `resource ${owner.resource}` : "runner.credentials";
|
|
1217
|
+
}
|
|
1218
|
+
function splitAcquired(instances, sandboxes) {
|
|
1219
|
+
let parts = Array.from({ length: sandboxes }, () => ({}));
|
|
1220
|
+
for (const instance of instances) {
|
|
1221
|
+
const split = instance.split(sandboxes);
|
|
1222
|
+
if (split.kind === "refused") return split;
|
|
1223
|
+
parts = parts.map((part, index) => ({ ...part, ...split.parts[index] }));
|
|
1224
|
+
}
|
|
1225
|
+
return { kind: "split", parts };
|
|
1226
|
+
}
|
|
1132
1227
|
function resourcesRan(instances) {
|
|
1133
1228
|
let ran = {};
|
|
1134
1229
|
for (const instance of instances) ran = { ...ran, ...instance.ran() };
|
|
@@ -1140,12 +1235,12 @@ function runInstances(instances) {
|
|
|
1140
1235
|
function releasedResources(instances) {
|
|
1141
1236
|
return instances.filter((instance) => instance.took()).map((instance) => instance.listing.resource);
|
|
1142
1237
|
}
|
|
1143
|
-
async function releaseResources(instances, progress) {
|
|
1238
|
+
async function releaseResources(instances, progress, runner) {
|
|
1144
1239
|
let releaseFacts = {};
|
|
1145
1240
|
const thrown = [];
|
|
1146
1241
|
for (const instance of instances.toReversed()) {
|
|
1147
1242
|
try {
|
|
1148
|
-
releaseFacts = { ...releaseFacts, ...await instance.release(progress) };
|
|
1243
|
+
releaseFacts = { ...releaseFacts, ...await instance.release(progress, runner) };
|
|
1149
1244
|
} catch (error) {
|
|
1150
1245
|
thrown.push(error);
|
|
1151
1246
|
}
|
|
@@ -1158,8 +1253,7 @@ function resourceWarnings(cleanup) {
|
|
|
1158
1253
|
}
|
|
1159
1254
|
|
|
1160
1255
|
// src/core/run.ts
|
|
1161
|
-
async function
|
|
1162
|
-
const instances = resourceInstances(definitionSet[LOOKUP], resourceContexts2, request.resources);
|
|
1256
|
+
async function emitRunOpening(progress, request, instances) {
|
|
1163
1257
|
await progress.emit({
|
|
1164
1258
|
kind: "started",
|
|
1165
1259
|
version: request.version,
|
|
@@ -1178,8 +1272,59 @@ async function executeRun(definitionSet, context, resourceContexts2, request, co
|
|
|
1178
1272
|
notes: prepared.notes
|
|
1179
1273
|
});
|
|
1180
1274
|
}
|
|
1275
|
+
}
|
|
1276
|
+
async function mintCredential(context, target, signal, progress) {
|
|
1277
|
+
const canceled = () => ({ ...canceledStop(), commandStopped: false });
|
|
1278
|
+
if (signal.aborted) return { ok: false, outcome: canceled() };
|
|
1279
|
+
const mint = credentialSourceFor({ source: "mint", target }, context, progress);
|
|
1280
|
+
const minted = await mint.obtain();
|
|
1281
|
+
if (!minted.ok)
|
|
1282
|
+
return { ok: false, outcome: { kind: "mint_failed", failure: minted.failure.failure, target, runner: true } };
|
|
1283
|
+
const project = minted.credential.vercelProject();
|
|
1284
|
+
if (project === void 0)
|
|
1285
|
+
return {
|
|
1286
|
+
ok: false,
|
|
1287
|
+
outcome: { kind: "runner_failed", failure: { kind: "credential-claims-missing", target } }
|
|
1288
|
+
};
|
|
1289
|
+
if (signal.aborted) return { ok: false, outcome: canceled() };
|
|
1290
|
+
return { ok: true, mint, access: { credential: minted.credential, ...project } };
|
|
1291
|
+
}
|
|
1292
|
+
async function runCommandInSandbox(session, request, signal, progress, onStarted) {
|
|
1293
|
+
await progress.emit({ kind: "command-started", argv: request.argv });
|
|
1294
|
+
if (signal.aborted) return { ok: false, outcome: { ...canceledStop(), commandStopped: false } };
|
|
1295
|
+
onStarted?.();
|
|
1296
|
+
let testEvents = Promise.resolve();
|
|
1297
|
+
const sandboxed = await session.runCommand({
|
|
1298
|
+
argv: request.argv,
|
|
1299
|
+
runPayload: request.runPayload,
|
|
1300
|
+
...request.credentials === void 0 ? {} : { credentials: request.credentials },
|
|
1301
|
+
testEvents: {
|
|
1302
|
+
onLine: (line) => {
|
|
1303
|
+
const event = parseTestEvent(line);
|
|
1304
|
+
testEvents = testEvents.then(
|
|
1305
|
+
() => progress.emit(event === void 0 ? { kind: "test-event-unreadable" } : { kind: "test", event })
|
|
1306
|
+
);
|
|
1307
|
+
},
|
|
1308
|
+
onIncomplete: (message) => {
|
|
1309
|
+
testEvents = testEvents.then(() => progress.emit({ kind: "test-events-incomplete", message }));
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
});
|
|
1313
|
+
await testEvents;
|
|
1314
|
+
if (sandboxed.kind === "killed" || sandboxed.kind === "failed" && signal.aborted)
|
|
1315
|
+
return { ok: false, outcome: { ...canceledStop(), commandStopped: true } };
|
|
1316
|
+
if (sandboxed.kind === "failed") return { ok: false, outcome: { kind: "runner_failed", failure: sandboxed.failure } };
|
|
1317
|
+
const command = sandboxed.exitCode === null ? { kind: "no-exit-code" } : { kind: "exited", code: sandboxed.exitCode };
|
|
1318
|
+
await progress.emit({
|
|
1319
|
+
kind: "command-ended",
|
|
1320
|
+
command: posix.basename(request.argv[0] ?? ""),
|
|
1321
|
+
outcome: command,
|
|
1322
|
+
ms: sandboxed.ms
|
|
1323
|
+
});
|
|
1324
|
+
return { ok: true, command };
|
|
1325
|
+
}
|
|
1326
|
+
async function withResourceCleanup(instances, keepMs, progress, body) {
|
|
1181
1327
|
let cleanupStarted = false;
|
|
1182
|
-
const keepMs = request.runner === void 0 ? null : request.runner.keepMs;
|
|
1183
1328
|
const startCleanup = async () => {
|
|
1184
1329
|
if (cleanupStarted) return;
|
|
1185
1330
|
cleanupStarted = true;
|
|
@@ -1187,20 +1332,34 @@ async function executeRun(definitionSet, context, resourceContexts2, request, co
|
|
|
1187
1332
|
};
|
|
1188
1333
|
let resourceCleanup = {};
|
|
1189
1334
|
let releasing;
|
|
1190
|
-
const release = () => releasing ??= (async () => {
|
|
1335
|
+
const release = (runner) => releasing ??= (async () => {
|
|
1191
1336
|
try {
|
|
1192
1337
|
await startCleanup();
|
|
1193
1338
|
} finally {
|
|
1194
|
-
resourceCleanup = await releaseResources(instances, progress);
|
|
1339
|
+
resourceCleanup = await releaseResources(instances, progress, runner);
|
|
1195
1340
|
}
|
|
1196
1341
|
})();
|
|
1197
|
-
let
|
|
1198
|
-
let runnerCleanup = null;
|
|
1342
|
+
let value;
|
|
1199
1343
|
try {
|
|
1200
|
-
|
|
1344
|
+
value = await body({ startCleanup, release });
|
|
1201
1345
|
} finally {
|
|
1202
|
-
await release();
|
|
1346
|
+
await release({ runnerSandboxFenced: keepMs === null });
|
|
1203
1347
|
}
|
|
1348
|
+
return { value, resourceCleanup };
|
|
1349
|
+
}
|
|
1350
|
+
async function executeRun(definitionSet, context, resourceContexts2, request, control, progress) {
|
|
1351
|
+
const instances = resourceInstances(definitionSet[LOOKUP], resourceContexts2, request.resources);
|
|
1352
|
+
await emitRunOpening(progress, request, instances);
|
|
1353
|
+
const keepMs = request.runner === void 0 ? null : request.runner.keepMs;
|
|
1354
|
+
const {
|
|
1355
|
+
value: { ended, runnerCleanup },
|
|
1356
|
+
resourceCleanup
|
|
1357
|
+
} = await withResourceCleanup(
|
|
1358
|
+
instances,
|
|
1359
|
+
keepMs,
|
|
1360
|
+
progress,
|
|
1361
|
+
async (cleanup) => request.runner === void 0 ? { ended: await runUnsandboxed(context, request, instances, control, progress), runnerCleanup: null } : await runSandboxed(context, request, instances, control, progress, cleanup)
|
|
1362
|
+
);
|
|
1204
1363
|
await progress.emit({
|
|
1205
1364
|
kind: "cleanup-finished",
|
|
1206
1365
|
resourceWarnings: resourceWarnings(resourceCleanup),
|
|
@@ -1223,6 +1382,11 @@ async function runUnsandboxed(context, request, instances, control, progress) {
|
|
|
1223
1382
|
progress
|
|
1224
1383
|
});
|
|
1225
1384
|
if (acquisition.kind === "stopped") return acquisition.outcome;
|
|
1385
|
+
const crediting = resourcesCredentials(instances);
|
|
1386
|
+
if (crediting.length > 0)
|
|
1387
|
+
throw new Error(
|
|
1388
|
+
`resource ${crediting[0]?.resource ?? ""} answered sandbox credentials in a run with no runner sandbox; its beforeRun must say it needs one`
|
|
1389
|
+
);
|
|
1226
1390
|
await announceAcquired(instances, progress);
|
|
1227
1391
|
const terminal = context.runnerTerminal;
|
|
1228
1392
|
const env = commandEnvironment(
|
|
@@ -1275,27 +1439,21 @@ async function runSandboxed(context, request, instances, control, progress, clea
|
|
|
1275
1439
|
const session = openRunnerSession(context, request.runner, { signal: control.signal, cleanup }, runnerProgress);
|
|
1276
1440
|
try {
|
|
1277
1441
|
const ended = await runInSandbox(context, request, instances, session, control, progress);
|
|
1278
|
-
return { ended, runnerCleanup: await session.
|
|
1442
|
+
return { ended, runnerCleanup: await session.cleanUp() };
|
|
1279
1443
|
} finally {
|
|
1280
|
-
await session.
|
|
1444
|
+
await session.cleanUp();
|
|
1281
1445
|
}
|
|
1282
1446
|
}
|
|
1283
1447
|
async function runInSandbox(context, request, instances, session, control, progress) {
|
|
1284
1448
|
const { runner } = request;
|
|
1285
1449
|
const canceled = () => ({ ...canceledStop(), commandStopped: false });
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
const minted = await mint.obtain();
|
|
1289
|
-
if (!minted.ok) return { kind: "mint_failed", failure: minted.failure.failure, target: runner.target, runner: true };
|
|
1290
|
-
const project = minted.credential.vercelProject();
|
|
1291
|
-
if (project === void 0)
|
|
1292
|
-
return { kind: "runner_failed", failure: { kind: "credential-claims-missing", target: runner.target } };
|
|
1293
|
-
if (control.signal.aborted) return canceled();
|
|
1450
|
+
const credential = await mintCredential(context, runner.target, control.signal, progress);
|
|
1451
|
+
if (!credential.ok) return credential.outcome;
|
|
1294
1452
|
const acquisition = await readyBoth(
|
|
1295
1453
|
{
|
|
1296
1454
|
instances,
|
|
1297
|
-
credential: mint,
|
|
1298
|
-
ready: (signal) => session.ready(
|
|
1455
|
+
credential: credential.mint,
|
|
1456
|
+
ready: (signal) => session.ready(credential.access, signal)
|
|
1299
1457
|
},
|
|
1300
1458
|
control,
|
|
1301
1459
|
progress
|
|
@@ -1307,41 +1465,25 @@ async function runInSandbox(context, request, instances, session, control, progr
|
|
|
1307
1465
|
const { beside: readied } = acquisition;
|
|
1308
1466
|
if (readied?.kind !== "ready") return canceled();
|
|
1309
1467
|
const ready = readied.runner;
|
|
1468
|
+
const credentials = resourcesCredentials(instances, runner.credentials).map(({ credential: credential2 }) => credential2);
|
|
1310
1469
|
await announceAcquired(instances, progress);
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
},
|
|
1329
|
-
onIncomplete: (message) => {
|
|
1330
|
-
testEvents = testEvents.then(() => progress.emit({ kind: "test-events-incomplete", message }));
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
});
|
|
1334
|
-
await testEvents;
|
|
1335
|
-
if (sandboxed.kind === "killed" || sandboxed.kind === "failed" && control.signal.aborted)
|
|
1336
|
-
return { ...canceledStop(), commandStopped: true };
|
|
1337
|
-
if (sandboxed.kind === "failed") return { kind: "runner_failed", failure: sandboxed.failure };
|
|
1338
|
-
const command = sandboxed.exitCode === null ? { kind: "no-exit-code" } : { kind: "exited", code: sandboxed.exitCode };
|
|
1339
|
-
await progress.emit({
|
|
1340
|
-
kind: "command-ended",
|
|
1341
|
-
command: posix.basename(request.argv[0] ?? ""),
|
|
1342
|
-
outcome: command,
|
|
1343
|
-
ms: sandboxed.ms
|
|
1344
|
-
});
|
|
1470
|
+
const ran = await runCommandInSandbox(
|
|
1471
|
+
session,
|
|
1472
|
+
{
|
|
1473
|
+
argv: request.argv,
|
|
1474
|
+
runPayload: JSON.stringify(
|
|
1475
|
+
runPayload(resourcesPayload(instances), {
|
|
1476
|
+
testEvents: SANDBOX_TEST_EVENTS_PATH,
|
|
1477
|
+
...request.verbose === void 0 ? {} : { verbose: request.verbose }
|
|
1478
|
+
})
|
|
1479
|
+
),
|
|
1480
|
+
credentials
|
|
1481
|
+
},
|
|
1482
|
+
control.signal,
|
|
1483
|
+
progress
|
|
1484
|
+
);
|
|
1485
|
+
if (!ran.ok) return ran.outcome;
|
|
1486
|
+
const { command } = ran;
|
|
1345
1487
|
return {
|
|
1346
1488
|
kind: "command-ended",
|
|
1347
1489
|
resources: resourcesRan(instances),
|
|
@@ -1374,6 +1516,416 @@ async function readyBoth(request, control, progress) {
|
|
|
1374
1516
|
});
|
|
1375
1517
|
}
|
|
1376
1518
|
|
|
1519
|
+
// src/core/sandbox-end.ts
|
|
1520
|
+
function acrossSandboxesExitStatus(sandboxes) {
|
|
1521
|
+
return sandboxes.every(({ state }) => state === "passed") ? 0 : 1;
|
|
1522
|
+
}
|
|
1523
|
+
function sandboxEndFacts(end, commandStarted) {
|
|
1524
|
+
const short = (cause, failedStage, started = commandStarted) => ({
|
|
1525
|
+
state: started ? "failed" : "not-started",
|
|
1526
|
+
failedStage,
|
|
1527
|
+
exitCode: null,
|
|
1528
|
+
cause: oneLine(cause)
|
|
1529
|
+
});
|
|
1530
|
+
switch (end.kind) {
|
|
1531
|
+
case "ran": {
|
|
1532
|
+
const { command } = end;
|
|
1533
|
+
if (command.kind === "exited")
|
|
1534
|
+
return {
|
|
1535
|
+
state: command.code === 0 ? "passed" : "failed",
|
|
1536
|
+
failedStage: command.code === 0 ? null : "command",
|
|
1537
|
+
exitCode: command.code,
|
|
1538
|
+
cause: null
|
|
1539
|
+
};
|
|
1540
|
+
return {
|
|
1541
|
+
state: "failed",
|
|
1542
|
+
failedStage: "command",
|
|
1543
|
+
exitCode: null,
|
|
1544
|
+
cause: command.kind === "signaled" ? `signaled: ${command.signal}` : "no-exit-code"
|
|
1545
|
+
};
|
|
1546
|
+
}
|
|
1547
|
+
case "canceled":
|
|
1548
|
+
return { state: "canceled", failedStage: null, exitCode: null, cause: "canceled" };
|
|
1549
|
+
case "runner_failed": {
|
|
1550
|
+
const { failure } = end;
|
|
1551
|
+
const ranCommand = failure.kind === "sandbox-api-failed" && failure.operation === "run-command";
|
|
1552
|
+
return short(runnerFailureCause(failure), runnerFailureStage(failure), commandStarted || ranCommand);
|
|
1553
|
+
}
|
|
1554
|
+
case "mint_failed":
|
|
1555
|
+
return short(`mint-failed: ${describeMintFailure(end.failure, end.target).cause}`, "mint");
|
|
1556
|
+
case "snapshot_gone":
|
|
1557
|
+
return short("snapshot-gone", "snapshot");
|
|
1558
|
+
case "spawn_failed":
|
|
1559
|
+
return short(`spawn-failed: ${end.message}`, "command");
|
|
1560
|
+
case "resource_refused":
|
|
1561
|
+
return short(`resource-refused: ${end.resource}: ${end.refusal.message}`, "resource");
|
|
1562
|
+
case "threw":
|
|
1563
|
+
return short(`threw: ${end.message}`, "storm");
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
function runnerFailureStage(failure) {
|
|
1567
|
+
switch (failure.kind) {
|
|
1568
|
+
case "snapshot-build-step-failed":
|
|
1569
|
+
return "snapshot";
|
|
1570
|
+
case "apply-failed":
|
|
1571
|
+
return "apply";
|
|
1572
|
+
case "install-failed":
|
|
1573
|
+
return "install";
|
|
1574
|
+
case "build-failed":
|
|
1575
|
+
return "build";
|
|
1576
|
+
case "checkout-failed":
|
|
1577
|
+
return "checkout";
|
|
1578
|
+
case "credential-claims-missing":
|
|
1579
|
+
return "mint";
|
|
1580
|
+
case "sandbox-api-failed":
|
|
1581
|
+
switch (failure.operation) {
|
|
1582
|
+
case "start-build-sandbox":
|
|
1583
|
+
case "save-snapshot":
|
|
1584
|
+
return "snapshot";
|
|
1585
|
+
case "start-runner-sandbox":
|
|
1586
|
+
case "login-path":
|
|
1587
|
+
case "run-script":
|
|
1588
|
+
return "start";
|
|
1589
|
+
case "upload":
|
|
1590
|
+
return "upload";
|
|
1591
|
+
case "run-command":
|
|
1592
|
+
return "command";
|
|
1593
|
+
}
|
|
1594
|
+
// A policy write fails at the stage it guards: a snapshot build's steps or save, the install and build steps, or
|
|
1595
|
+
// the command.
|
|
1596
|
+
case "network-policy-failed":
|
|
1597
|
+
switch (failure.around) {
|
|
1598
|
+
case "snapshot-steps":
|
|
1599
|
+
case "snapshot-save":
|
|
1600
|
+
return "snapshot";
|
|
1601
|
+
case "run-steps":
|
|
1602
|
+
return "install";
|
|
1603
|
+
case "command":
|
|
1604
|
+
return "command";
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
function runnerFailureCause(failure) {
|
|
1609
|
+
switch (failure.kind) {
|
|
1610
|
+
case "sandbox-api-failed":
|
|
1611
|
+
return `${failure.operation}: ${failure.message}`;
|
|
1612
|
+
case "checkout-failed":
|
|
1613
|
+
return `checkout-failed: ${failure.failure.message}`;
|
|
1614
|
+
case "credential-claims-missing":
|
|
1615
|
+
return `credential-claims-missing: ${failure.target.team}/${failure.target.project}`;
|
|
1616
|
+
case "snapshot-build-step-failed":
|
|
1617
|
+
case "apply-failed":
|
|
1618
|
+
case "install-failed":
|
|
1619
|
+
case "build-failed":
|
|
1620
|
+
return `${failure.kind}: ${failure.exitCode === null ? "no exit code" : `exited ${failure.exitCode}`}`;
|
|
1621
|
+
case "network-policy-failed":
|
|
1622
|
+
return `network-policy-failed: ${failure.operation} around ${failure.around}: ${failure.status === null ? "" : `HTTP ${failure.status}: `}${failure.message}`;
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
function oneLine(text) {
|
|
1626
|
+
return text.trim().replace(/\s*\n\s*/g, " ");
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
// src/core/across-sandboxes.ts
|
|
1630
|
+
async function executeAcrossSandboxes(definitionSet, context, resourceContexts2, request, control, progress) {
|
|
1631
|
+
if (request.sandboxes.length === 0)
|
|
1632
|
+
throw new Error("executeAcrossSandboxes: a run across runner sandboxes has at least one runner sandbox");
|
|
1633
|
+
const instances = resourceInstances(definitionSet[LOOKUP], resourceContexts2, request.resources);
|
|
1634
|
+
const { runner } = request;
|
|
1635
|
+
await emitRunOpening(progress, request, instances);
|
|
1636
|
+
const { value: ended, resourceCleanup } = await withResourceCleanup(
|
|
1637
|
+
instances,
|
|
1638
|
+
runner.keepMs,
|
|
1639
|
+
progress,
|
|
1640
|
+
async (cleanup2) => {
|
|
1641
|
+
const all = await runAll(context, request, instances, control.signal, progress);
|
|
1642
|
+
await cleanup2.release({ runnerSandboxFenced: all.runnerSandboxesFenced });
|
|
1643
|
+
return all;
|
|
1644
|
+
}
|
|
1645
|
+
);
|
|
1646
|
+
const runnerCleanup = mergedCleanup(runner.target, ended.runnerCleanups);
|
|
1647
|
+
await progress.emit({
|
|
1648
|
+
kind: "cleanup-finished",
|
|
1649
|
+
resourceWarnings: resourceWarnings(resourceCleanup),
|
|
1650
|
+
notStopped: runnerCleanup.notStopped.length,
|
|
1651
|
+
notDeleted: runnerCleanup.notDeleted.length
|
|
1652
|
+
});
|
|
1653
|
+
if (ended.kind === "threw") throw ended.error;
|
|
1654
|
+
const cleanup = { runnerCleanup, resourceCleanup };
|
|
1655
|
+
if (ended.kind === "stopped") return { ...ended.stop, ...cleanup };
|
|
1656
|
+
const { sandboxes } = ended;
|
|
1657
|
+
if (ended.canceled || sandboxes.some(({ state }) => state === "canceled"))
|
|
1658
|
+
return {
|
|
1659
|
+
kind: "canceled",
|
|
1660
|
+
commandStopped: sandboxes.some(({ end }) => end.kind === "canceled" && end.commandStopped === true),
|
|
1661
|
+
...cleanup
|
|
1662
|
+
};
|
|
1663
|
+
if (ended.failed !== void 0) return { ...ended.failed, ...cleanup };
|
|
1664
|
+
const [first] = sandboxes;
|
|
1665
|
+
if (first?.end.kind === "snapshot_gone" && sandboxes.every(({ end }) => end.kind === "snapshot_gone"))
|
|
1666
|
+
return { kind: "snapshot_gone", entry: first.end.entry, removal: first.end.removal, ...cleanup };
|
|
1667
|
+
return { kind: "sandboxes_ran", sandboxes, snapshot: ended.snapshot, resources: resourcesRan(instances), ...cleanup };
|
|
1668
|
+
}
|
|
1669
|
+
function rankSetupEnd(canceled, snapshotFailure, resources) {
|
|
1670
|
+
if (canceled) return canceledStop();
|
|
1671
|
+
if (snapshotFailure !== void 0) return snapshotFailure;
|
|
1672
|
+
if (resources.kind === "stopped" && resources.stop.kind !== "canceled") return resources.stop;
|
|
1673
|
+
if (resources.kind === "threw") return { kind: "threw", message: errorMessage(resources.error) };
|
|
1674
|
+
return canceledStop();
|
|
1675
|
+
}
|
|
1676
|
+
function errorMessage(error) {
|
|
1677
|
+
return error instanceof Error ? error.message : String(error);
|
|
1678
|
+
}
|
|
1679
|
+
async function runAll(context, request, instances, cancelSignal, progress) {
|
|
1680
|
+
const count = request.sandboxes.length;
|
|
1681
|
+
const credential = await mintCredential(context, request.runner.target, cancelSignal, progress);
|
|
1682
|
+
if (!credential.ok) return stoppedBeforeSandboxes(count, credential.outcome, [], void 0, progress);
|
|
1683
|
+
const { access: access2, mint } = credential;
|
|
1684
|
+
await progress.emit({ kind: "lanes-started" });
|
|
1685
|
+
const stop = new AbortController();
|
|
1686
|
+
const stageSignal = AbortSignal.any([cancelSignal, stop.signal]);
|
|
1687
|
+
const parts = acquireAndSplit(instances, {
|
|
1688
|
+
credential: mint,
|
|
1689
|
+
signal: stageSignal,
|
|
1690
|
+
progress,
|
|
1691
|
+
sandboxes: count,
|
|
1692
|
+
runnerCredentials: request.runner.credentials
|
|
1693
|
+
}).then(
|
|
1694
|
+
(answered) => {
|
|
1695
|
+
if (answered.kind === "split") return answered;
|
|
1696
|
+
if (answered.stop.kind !== "canceled") stop.abort();
|
|
1697
|
+
return answered;
|
|
1698
|
+
},
|
|
1699
|
+
(error) => {
|
|
1700
|
+
stop.abort();
|
|
1701
|
+
return { kind: "threw", error };
|
|
1702
|
+
}
|
|
1703
|
+
);
|
|
1704
|
+
const gateOf = (index) => parts.then((settled) => {
|
|
1705
|
+
if (settled.kind === "split") {
|
|
1706
|
+
const resources = settled.parts[index];
|
|
1707
|
+
if (resources !== void 0) return { kind: "ready", resources, credentials: settled.credentials };
|
|
1708
|
+
}
|
|
1709
|
+
return { kind: "stopped", end: rankSetupEnd(cancelSignal.aborted, void 0, settled) };
|
|
1710
|
+
});
|
|
1711
|
+
try {
|
|
1712
|
+
const runnerProgress = { emit: (event) => progress.emit({ kind: "runner", event }) };
|
|
1713
|
+
const chosen = await chooseSnapshotForRun(
|
|
1714
|
+
context,
|
|
1715
|
+
{
|
|
1716
|
+
prepared: request.runner.prepared,
|
|
1717
|
+
access: access2,
|
|
1718
|
+
user: request.runner.user,
|
|
1719
|
+
credentials: request.runner.credentials
|
|
1720
|
+
},
|
|
1721
|
+
{ signal: cancelSignal, stop: stop.signal },
|
|
1722
|
+
runnerProgress
|
|
1723
|
+
);
|
|
1724
|
+
const choiceCleanup = { ...chosen.cleanup, target: request.runner.target };
|
|
1725
|
+
if (chosen.kind !== "chosen") {
|
|
1726
|
+
const snapshotFailure = chosen.kind === "failed" ? { kind: "runner_failed", failure: chosen.failure } : void 0;
|
|
1727
|
+
if (snapshotFailure !== void 0) stop.abort();
|
|
1728
|
+
await progress.emit({
|
|
1729
|
+
kind: "lane-ended",
|
|
1730
|
+
lane: "runner",
|
|
1731
|
+
resource: null,
|
|
1732
|
+
outcome: chosen.kind === "aborted" ? "stopped" : "failed"
|
|
1733
|
+
});
|
|
1734
|
+
const settled2 = await parts;
|
|
1735
|
+
const ending = rankSetupEnd(cancelSignal.aborted, snapshotFailure, settled2);
|
|
1736
|
+
const thrown = settled2.kind === "threw" ? { error: settled2.error } : void 0;
|
|
1737
|
+
return stoppedBeforeSandboxes(count, ending, [choiceCleanup], thrown, progress);
|
|
1738
|
+
}
|
|
1739
|
+
await progress.emit({ kind: "sandboxes-started", sandboxes: count });
|
|
1740
|
+
const ran = await Promise.all(
|
|
1741
|
+
request.sandboxes.map(
|
|
1742
|
+
(sandboxSpec, index) => runOneSandbox(
|
|
1743
|
+
context,
|
|
1744
|
+
{
|
|
1745
|
+
sandbox: index,
|
|
1746
|
+
count,
|
|
1747
|
+
sandboxSpec,
|
|
1748
|
+
access: access2,
|
|
1749
|
+
snapshot: chosen.snapshot,
|
|
1750
|
+
request,
|
|
1751
|
+
gate: gateOf(index),
|
|
1752
|
+
cancelSignal,
|
|
1753
|
+
stageSignal
|
|
1754
|
+
},
|
|
1755
|
+
progress
|
|
1756
|
+
)
|
|
1757
|
+
)
|
|
1758
|
+
);
|
|
1759
|
+
stop.abort();
|
|
1760
|
+
const settled = await parts;
|
|
1761
|
+
const progressFailure = ran.find((sandbox) => sandbox.progressFailure !== void 0)?.progressFailure;
|
|
1762
|
+
const sandboxes = ran.map(({ ended: sandbox }) => sandbox);
|
|
1763
|
+
const runnerSandboxesFenced = ran.every(({ fenced }) => fenced);
|
|
1764
|
+
const runnerCleanups = [
|
|
1765
|
+
choiceCleanup,
|
|
1766
|
+
...sandboxes.flatMap(({ runnerCleanup }) => runnerCleanup === null ? [] : [runnerCleanup])
|
|
1767
|
+
];
|
|
1768
|
+
if (settled.kind === "threw") return { kind: "threw", error: settled.error, runnerSandboxesFenced, runnerCleanups };
|
|
1769
|
+
if (progressFailure !== void 0)
|
|
1770
|
+
return { kind: "threw", error: progressFailure.error, runnerSandboxesFenced, runnerCleanups };
|
|
1771
|
+
return {
|
|
1772
|
+
kind: "sandboxes",
|
|
1773
|
+
sandboxes,
|
|
1774
|
+
snapshot: chosen.snapshot,
|
|
1775
|
+
failed: settled.kind === "stopped" && settled.stop.kind !== "canceled" ? settled.stop : void 0,
|
|
1776
|
+
canceled: ran.some(({ canceled }) => canceled),
|
|
1777
|
+
runnerSandboxesFenced,
|
|
1778
|
+
runnerCleanups
|
|
1779
|
+
};
|
|
1780
|
+
} catch (error) {
|
|
1781
|
+
stop.abort();
|
|
1782
|
+
await parts;
|
|
1783
|
+
throw error;
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
async function acquireAndSplit(instances, input) {
|
|
1787
|
+
const acquisition = await acquireResources(instances, {
|
|
1788
|
+
credential: input.credential,
|
|
1789
|
+
signal: input.signal,
|
|
1790
|
+
progress: input.progress
|
|
1791
|
+
});
|
|
1792
|
+
if (acquisition.kind === "stopped") return { kind: "stopped", stop: acquisition.outcome };
|
|
1793
|
+
const split = splitAcquired(instances, input.sandboxes);
|
|
1794
|
+
if (split.kind === "refused") return { kind: "stopped", stop: split.outcome };
|
|
1795
|
+
const credentials = resourcesCredentials(instances, input.runnerCredentials).map(({ credential }) => credential);
|
|
1796
|
+
await announceAcquired(instances, input.progress);
|
|
1797
|
+
return { ...split, credentials };
|
|
1798
|
+
}
|
|
1799
|
+
async function stoppedBeforeSandboxes(count, end, runnerCleanups, thrown, progress) {
|
|
1800
|
+
const facts = sandboxEndFacts(end, false);
|
|
1801
|
+
for (let sandbox = 0; sandbox < count; sandbox += 1)
|
|
1802
|
+
await progress.emit({ kind: "sandbox-ended", sandbox, ...facts });
|
|
1803
|
+
if (thrown !== void 0) return { kind: "threw", error: thrown.error, runnerCleanups, runnerSandboxesFenced: true };
|
|
1804
|
+
if (end.kind === "ran" || end.kind === "threw")
|
|
1805
|
+
throw new Error(`stoppedBeforeSandboxes: unexpected end kind ${end.kind}`);
|
|
1806
|
+
return { kind: "stopped", stop: end, runnerCleanups, runnerSandboxesFenced: true };
|
|
1807
|
+
}
|
|
1808
|
+
async function runOneSandbox(context, input, progress) {
|
|
1809
|
+
const { sandbox, count, sandboxSpec, request, cancelSignal, stageSignal } = input;
|
|
1810
|
+
const { argv } = sandboxSpec;
|
|
1811
|
+
const emitSandbox = async (event) => await progress.emit({ kind: "sandbox", sandbox, event });
|
|
1812
|
+
const ownProgress = { emit: emitSandbox };
|
|
1813
|
+
const runnerProgress = { emit: (event) => emitSandbox({ kind: "runner", event }) };
|
|
1814
|
+
let cleanupStarted = false;
|
|
1815
|
+
let fenced = false;
|
|
1816
|
+
const startCleanup = async () => {
|
|
1817
|
+
if (cleanupStarted) return;
|
|
1818
|
+
cleanupStarted = true;
|
|
1819
|
+
await emitSandbox({ kind: "cleanup-started", keepMs: request.runner.keepMs, resources: [] });
|
|
1820
|
+
};
|
|
1821
|
+
const session = openRunnerSession(
|
|
1822
|
+
{ ...context, runnerTerminal: context.sandboxTerminal(sandbox) },
|
|
1823
|
+
{ ...request.runner, snapshot: input.snapshot },
|
|
1824
|
+
// The run releases the resources once, after every runner sandbox's session: each session only says whether it
|
|
1825
|
+
// fenced its runner sandbox. A session that never released hasn't confirmed its fence. The scope hears only the
|
|
1826
|
+
// command's cancel signal, never storm's internal sibling-stop signal.
|
|
1827
|
+
{
|
|
1828
|
+
signal: cancelSignal,
|
|
1829
|
+
cleanup: {
|
|
1830
|
+
startCleanup,
|
|
1831
|
+
release: async (fence) => {
|
|
1832
|
+
fenced = fence.runnerSandboxFenced;
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
},
|
|
1836
|
+
runnerProgress
|
|
1837
|
+
);
|
|
1838
|
+
let commandStarted = false;
|
|
1839
|
+
let end;
|
|
1840
|
+
let canceled = false;
|
|
1841
|
+
let runnerCleanup = null;
|
|
1842
|
+
try {
|
|
1843
|
+
end = await sandboxBody(
|
|
1844
|
+
{
|
|
1845
|
+
sandbox,
|
|
1846
|
+
count,
|
|
1847
|
+
sandboxSpec,
|
|
1848
|
+
access: input.access,
|
|
1849
|
+
request,
|
|
1850
|
+
session,
|
|
1851
|
+
gate: input.gate,
|
|
1852
|
+
cancelSignal,
|
|
1853
|
+
stageSignal
|
|
1854
|
+
},
|
|
1855
|
+
ownProgress,
|
|
1856
|
+
() => {
|
|
1857
|
+
commandStarted = true;
|
|
1858
|
+
}
|
|
1859
|
+
);
|
|
1860
|
+
canceled = cancelSignal.aborted && end.kind !== "ran";
|
|
1861
|
+
runnerCleanup = await session.cleanUp();
|
|
1862
|
+
await emitSandbox({
|
|
1863
|
+
kind: "cleanup-finished",
|
|
1864
|
+
resourceWarnings: 0,
|
|
1865
|
+
notStopped: runnerCleanup.notStopped.length,
|
|
1866
|
+
notDeleted: runnerCleanup.notDeleted.length
|
|
1867
|
+
});
|
|
1868
|
+
} catch (error) {
|
|
1869
|
+
end = { kind: "threw", message: error instanceof Error ? error.message : String(error) };
|
|
1870
|
+
canceled = cancelSignal.aborted;
|
|
1871
|
+
runnerCleanup = await session.cleanUp().catch(() => runnerCleanup);
|
|
1872
|
+
}
|
|
1873
|
+
const facts = sandboxEndFacts(end, commandStarted);
|
|
1874
|
+
const ended = { sandbox, argv, end, ...facts, runnerCleanup };
|
|
1875
|
+
try {
|
|
1876
|
+
await progress.emit({ kind: "sandbox-ended", sandbox, ...facts });
|
|
1877
|
+
return { ended, progressFailure: void 0, fenced, canceled };
|
|
1878
|
+
} catch (error) {
|
|
1879
|
+
return { ended, progressFailure: { error }, fenced, canceled };
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
async function sandboxBody(input, progress, started) {
|
|
1883
|
+
const { sandbox, count, sandboxSpec, session, request, cancelSignal, stageSignal } = input;
|
|
1884
|
+
const { argv, files } = sandboxSpec;
|
|
1885
|
+
const stopped = async () => {
|
|
1886
|
+
const gated2 = await input.gate;
|
|
1887
|
+
return gated2.kind === "stopped" ? gated2.end : canceledStop();
|
|
1888
|
+
};
|
|
1889
|
+
if (stageSignal.aborted) return await stopped();
|
|
1890
|
+
const readied = await session.ready(input.access, stageSignal);
|
|
1891
|
+
await progress.emit({ kind: "lane-ended", lane: "runner", resource: null, outcome: runnerLaneOutcome2(readied) });
|
|
1892
|
+
if (readied.kind === "aborted") return await stopped();
|
|
1893
|
+
if (readied.kind === "failed") return { kind: "runner_failed", failure: readied.failure };
|
|
1894
|
+
if (readied.kind === "snapshot-gone")
|
|
1895
|
+
return { kind: "snapshot_gone", entry: readied.entry, removal: readied.removal };
|
|
1896
|
+
const gated = await input.gate;
|
|
1897
|
+
if (gated.kind === "stopped") return gated.end;
|
|
1898
|
+
const payload = JSON.stringify(
|
|
1899
|
+
runPayload(gated.resources, {
|
|
1900
|
+
testEvents: SANDBOX_TEST_EVENTS_PATH,
|
|
1901
|
+
...request.verbose === void 0 ? {} : { verbose: request.verbose },
|
|
1902
|
+
sandbox: { index: sandbox, count, ...files === void 0 ? {} : { files } }
|
|
1903
|
+
})
|
|
1904
|
+
);
|
|
1905
|
+
const ran = await runCommandInSandbox(
|
|
1906
|
+
session,
|
|
1907
|
+
{ argv, runPayload: payload, credentials: gated.credentials },
|
|
1908
|
+
cancelSignal,
|
|
1909
|
+
progress,
|
|
1910
|
+
started
|
|
1911
|
+
);
|
|
1912
|
+
if (!ran.ok) return ran.outcome;
|
|
1913
|
+
return { kind: "ran", command: ran.command };
|
|
1914
|
+
}
|
|
1915
|
+
function runnerLaneOutcome2(outcome) {
|
|
1916
|
+
if (outcome.kind === "ready") return "ready";
|
|
1917
|
+
return outcome.kind === "aborted" ? "stopped" : "failed";
|
|
1918
|
+
}
|
|
1919
|
+
function mergedCleanup(target, cleanups) {
|
|
1920
|
+
return {
|
|
1921
|
+
kept: null,
|
|
1922
|
+
notKept: null,
|
|
1923
|
+
notStopped: cleanups.flatMap(({ notStopped }) => notStopped),
|
|
1924
|
+
notDeleted: cleanups.flatMap(({ notDeleted }) => notDeleted),
|
|
1925
|
+
target
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1377
1929
|
export {
|
|
1378
1930
|
warningTally,
|
|
1379
1931
|
stateDirectoryPattern,
|
|
@@ -1391,11 +1943,15 @@ export {
|
|
|
1391
1943
|
resourcesOf,
|
|
1392
1944
|
driversOf,
|
|
1393
1945
|
driverContexts,
|
|
1946
|
+
SANDBOX_FAILED_STAGES,
|
|
1394
1947
|
timedProgress,
|
|
1395
1948
|
observeAll,
|
|
1396
1949
|
liveCommandGateway,
|
|
1397
1950
|
liveJobSummaryGateway,
|
|
1398
1951
|
liveProgressTerminal,
|
|
1399
1952
|
livePackageBinGateway,
|
|
1400
|
-
executeRun
|
|
1953
|
+
executeRun,
|
|
1954
|
+
acrossSandboxesExitStatus,
|
|
1955
|
+
sandboxEndFacts,
|
|
1956
|
+
executeAcrossSandboxes
|
|
1401
1957
|
};
|