@cnc-tools/storm 0.10.0 → 0.12.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/bin/storm.js +12 -9
- package/dist/build-info.js +1 -1
- package/dist/chunks/{chunk-YF3ICDBY.js → chunk-43MWZLJR.js} +1 -1
- package/dist/chunks/chunk-4XT5RC5T.js +98 -0
- package/dist/chunks/chunk-7D6LC5JY.js +340 -0
- package/dist/chunks/{chunk-WF4KJ7YG.js → chunk-BW2ADH7U.js} +1 -1
- package/dist/chunks/chunk-FK4RLDEK.js +40 -0
- package/dist/chunks/chunk-FSP3SJ35.js +1429 -0
- package/dist/chunks/{chunk-J6ZNYUDV.js → chunk-GQIL3AHY.js} +2 -3
- package/dist/chunks/chunk-GSC6SRTW.js +27 -0
- package/dist/chunks/chunk-ISGQJIQM.js +852 -0
- package/dist/chunks/chunk-IYM44FUX.js +1461 -0
- package/dist/chunks/{chunk-XHJGHJBW.js → chunk-LQKNI3EG.js} +38 -279
- package/dist/chunks/chunk-NMVODY3P.js +19 -0
- package/dist/chunks/{chunk-VJQLMGOH.js → chunk-ODQHQJLE.js} +2761 -3699
- package/dist/chunks/chunk-RYRJNHL7.js +55 -0
- package/dist/chunks/chunk-SXW6XN4R.js +161 -0
- package/dist/chunks/{chunk-OVXD7GES.js → chunk-T6AZIDZD.js} +43 -396
- package/dist/chunks/chunk-TEEZL3GA.js +851 -0
- package/dist/chunks/chunk-TMQQYHUX.js +80 -0
- package/dist/chunks/{chunk-AKKNF3WZ.js → chunk-U7M3ZB3Z.js} +565 -595
- package/dist/chunks/{chunk-JQ2HK4RN.js → chunk-Y3BUNNRG.js} +234 -57
- package/dist/chunks/{chunk-ZJ2USLAT.js → chunk-YM6TZV4L.js} +394 -416
- package/dist/chunks/chunk-YT5OROR7.js +271 -0
- package/dist/chunks/{live-app-RIJM3QFD.js → live-app-AZ5N5HBD.js} +36 -12
- package/dist/command-tree.d.ts +4 -1
- package/dist/command-tree.js +4 -1
- package/dist/commands/exec/cleanup.d.ts +3 -3
- package/dist/commands/exec/cleanup.js +6 -2
- package/dist/commands/exec/command.d.ts +56 -17
- package/dist/commands/exec/command.js +51 -39
- package/dist/commands/exec/define-run-command.d.ts +752 -0
- package/dist/commands/exec/define-run-command.js +58 -0
- package/dist/commands/exec/driver-plan.d.ts +30 -0
- package/dist/commands/exec/driver-plan.js +44 -0
- package/dist/commands/exec/driver-refusals.d.ts +89 -0
- package/dist/commands/exec/driver-refusals.js +65 -0
- package/dist/commands/exec/exec-words.d.ts +5 -0
- package/dist/commands/exec/exec-words.js +31 -0
- package/dist/commands/exec/job-summary.d.ts +1 -1
- package/dist/commands/exec/job-summary.js +1 -1
- package/dist/commands/exec/live-view.js +58 -28
- package/dist/commands/exec/mint-failed.js +5 -5
- package/dist/commands/exec/outcomes.d.ts +72 -10
- package/dist/commands/exec/outcomes.js +38 -10
- package/dist/commands/exec/plan-run.d.ts +3 -5
- package/dist/commands/exec/plan-run.js +3 -3
- package/dist/commands/exec/progress.d.ts +35 -15
- package/dist/commands/exec/progress.js +82 -57
- package/dist/commands/exec/resource-flags.d.ts +10 -3
- package/dist/commands/exec/resource-flags.js +25 -14
- package/dist/commands/exec/resource-refusals.d.ts +2 -2
- package/dist/commands/exec/resource-refusals.js +10 -10
- package/dist/commands/exec/run-bin.d.ts +35 -0
- package/dist/commands/exec/run-bin.js +32 -0
- package/dist/commands/exec/run-command.d.ts +85 -20
- package/dist/commands/exec/run-command.js +142 -238
- package/dist/commands/exec/run-metadata.d.ts +29 -17
- package/dist/commands/exec/run-metadata.js +38 -16
- package/dist/commands/exec/snapshot-text.d.ts +40 -0
- package/dist/commands/exec/snapshot-text.js +112 -0
- package/dist/commands/exec/test-plan.d.ts +3 -37
- package/dist/commands/exec/test-plan.js +11 -28
- package/dist/commands/exec/tests-summary.d.ts +21 -12
- package/dist/commands/exec/tests-summary.js +67 -39
- package/dist/commands/exec/text.d.ts +5 -0
- package/dist/commands/exec/text.js +7 -0
- package/dist/commands/exec/view.js +22 -13
- package/dist/commands/exec/waterfall.d.ts +3 -1
- package/dist/commands/exec/waterfall.js +20 -3
- package/dist/commands/exec/worker-chart.d.ts +19 -11
- package/dist/commands/exec/worker-chart.js +66 -36
- package/dist/commands/playwright/command.d.ts +746 -0
- package/dist/commands/playwright/command.js +31 -0
- package/dist/commands/playwright/metadata.d.ts +4 -0
- package/dist/commands/playwright/metadata.js +8 -0
- package/dist/commands/runs/facts.d.ts +22 -8
- package/dist/commands/runs/facts.js +19 -9
- package/dist/commands/runs/list/command.d.ts +34 -8
- package/dist/commands/runs/list/command.js +18 -13
- package/dist/commands/runs/list/outcomes.d.ts +17 -4
- package/dist/commands/runs/logs/command.js +20 -14
- package/dist/commands/runs/logs/outcomes.js +1 -1
- package/dist/commands/runs/past-run.d.ts +3 -27
- package/dist/commands/runs/past-run.js +3 -37
- package/dist/commands/runs/show/command.d.ts +36 -8
- package/dist/commands/runs/show/command.js +53 -33
- package/dist/commands/runs/show/metadata.js +1 -1
- package/dist/commands/runs/show/outcomes.d.ts +18 -4
- package/dist/commands/runs/show/outcomes.js +37 -16
- package/dist/commands/snapshots/build/command.d.ts +898 -0
- package/dist/commands/snapshots/build/command.js +511 -0
- package/dist/commands/snapshots/build/metadata.d.ts +28 -0
- package/dist/commands/snapshots/build/metadata.js +34 -0
- package/dist/commands/snapshots/build/outcomes.d.ts +484 -0
- package/dist/commands/snapshots/build/outcomes.js +322 -0
- package/dist/commands/snapshots/list/command.d.ts +272 -0
- package/dist/commands/snapshots/list/command.js +305 -0
- package/dist/commands/snapshots/list/metadata.d.ts +16 -0
- package/dist/commands/snapshots/list/metadata.js +24 -0
- package/dist/commands/snapshots/list/outcomes.d.ts +183 -0
- package/dist/commands/snapshots/list/outcomes.js +257 -0
- package/dist/commands/snapshots/metadata.d.ts +3 -0
- package/dist/commands/snapshots/metadata.js +7 -0
- package/dist/commands/vitest/command.d.ts +267 -298
- package/dist/commands/vitest/command.js +23 -174
- package/dist/commands/vitest/metadata.js +1 -1
- package/dist/config/credential-resolver.d.ts +6 -3
- package/dist/config/credential-resolver.js +6 -5
- package/dist/config-file/define.d.ts +1 -1
- package/dist/context.d.ts +44 -24
- package/dist/context.js +20 -13
- package/dist/core/before-run.d.ts +7 -6
- package/dist/core/before-run.js +9 -9
- package/dist/core/definition-lookup.d.ts +22 -0
- package/dist/core/definition-lookup.js +35 -0
- package/dist/core/drivers-of.d.ts +23 -0
- package/dist/core/drivers-of.js +13 -0
- package/dist/core/events.d.ts +6 -22
- package/dist/core/gateways.d.ts +38 -170
- package/dist/core/index.d.ts +13 -12
- package/dist/core/index.js +12 -11
- package/dist/core/launcher-context.d.ts +11 -0
- package/dist/core/launcher-context.js +31 -0
- package/dist/core/live/package-bin-gateway.d.ts +6 -0
- package/dist/core/live/package-bin-gateway.js +24 -0
- package/dist/core/package-bin.d.ts +7 -0
- package/dist/core/package-bin.js +30 -0
- package/dist/core/presentations.d.ts +5 -4
- package/dist/core/presentations.js +9 -9
- package/dist/core/resource-definition-set.d.ts +39 -0
- package/dist/core/resource-definition-set.js +31 -0
- package/dist/core/resource-reports.d.ts +38 -5
- package/dist/core/resource-reports.js +47 -17
- package/dist/core/resource.d.ts +4 -4
- package/dist/core/resources.d.ts +8 -7
- package/dist/core/resources.js +11 -13
- package/dist/core/run-state.d.ts +27 -16
- package/dist/core/run-state.js +50 -18
- package/dist/core/run.d.ts +42 -54
- package/dist/core/run.js +72 -122
- package/dist/core/setup-phases.d.ts +14 -0
- package/dist/core/setup-phases.js +24 -0
- package/dist/core/state-directory.d.ts +2 -2
- package/dist/core/state-directory.js +3 -3
- package/dist/core/timeline.d.ts +4 -2
- package/dist/core/timeline.js +11 -4
- package/dist/credential/events.d.ts +20 -0
- package/dist/credential/events.js +4 -0
- package/dist/credential/index.d.ts +2 -1
- package/dist/credential/index.js +6 -5
- package/dist/credential/source.d.ts +38 -26
- package/dist/credential/source.js +25 -34
- package/dist/extension-commands.d.ts +12 -6
- package/dist/extension-commands.js +16 -13
- package/dist/extensions/github/{world.d.ts → context.d.ts} +1 -1
- package/dist/extensions/github/context.js +3 -0
- package/dist/extensions/github/definition.d.ts +1 -1
- package/dist/extensions/github/definition.js +3 -3
- package/dist/extensions/github/extension.d.ts +1 -1
- package/dist/extensions/github/index.d.ts +2 -2
- package/dist/extensions/github/index.js +4 -4
- package/dist/extensions/github/lifecycle.d.ts +3 -3
- package/dist/extensions/github/lifecycle.js +14 -14
- package/dist/extensions/github/live/context.d.ts +6 -0
- package/dist/extensions/github/live/context.js +16 -0
- package/dist/extensions/github/resource.d.ts +1 -1
- package/dist/extensions/playwright/driver.d.ts +8 -0
- package/dist/extensions/playwright/driver.js +60 -0
- package/dist/extensions/playwright/extension.d.ts +2 -0
- package/dist/extensions/playwright/extension.js +12 -0
- package/dist/extensions/playwright/plan/gateways.d.ts +62 -0
- package/dist/extensions/playwright/plan/gateways.js +4 -0
- package/dist/extensions/playwright/plan/list-output.d.ts +26 -0
- package/dist/extensions/playwright/plan/list-output.js +101 -0
- package/dist/extensions/playwright/plan/live/list-gateway.d.ts +15 -0
- package/dist/extensions/playwright/plan/live/list-gateway.js +100 -0
- package/dist/extensions/playwright/plan/plan.d.ts +44 -0
- package/dist/extensions/playwright/plan/plan.js +53 -0
- package/dist/extensions/testserver/command-tree.d.ts +2 -2
- package/dist/extensions/testserver/command-tree.js +2 -3
- package/dist/extensions/testserver/commands/app.d.ts +7 -7
- package/dist/extensions/testserver/commands/pool/create/command.d.ts +5 -5
- package/dist/extensions/testserver/commands/pool/create/command.js +17 -12
- package/dist/extensions/testserver/commands/pool/list/command.js +8 -5
- package/dist/extensions/testserver/{world.d.ts → context.d.ts} +1 -1
- package/dist/extensions/testserver/context.js +4 -0
- package/dist/extensions/testserver/definition.d.ts +2 -2
- package/dist/extensions/testserver/definition.js +8 -7
- package/dist/extensions/testserver/events.d.ts +1 -1
- package/dist/extensions/testserver/extension.d.ts +4 -3
- package/dist/extensions/testserver/extension.js +33 -20
- package/dist/extensions/testserver/index.d.ts +2 -2
- package/dist/extensions/testserver/index.js +2 -2
- package/dist/extensions/testserver/lifecycle.d.ts +6 -5
- package/dist/extensions/testserver/lifecycle.js +9 -8
- package/dist/extensions/testserver/live/context.d.ts +8 -0
- package/dist/extensions/testserver/live/{world.js → context.js} +6 -7
- package/dist/extensions/testserver/options/rules.d.ts +3 -3
- package/dist/extensions/testserver/options/rules.js +5 -4
- package/dist/extensions/testserver/options/sandboxes.d.ts +3 -2
- package/dist/extensions/testserver/options/sandboxes.js +3 -2
- package/dist/extensions/testserver/playwright/index.d.ts +33 -0
- package/dist/extensions/testserver/playwright/index.js +43 -0
- package/dist/extensions/testserver/presentation.d.ts +4 -4
- package/dist/extensions/testserver/presentation.js +7 -7
- package/dist/extensions/testserver/progress.d.ts +3 -3
- package/dist/extensions/testserver/progress.js +3 -3
- package/dist/extensions/testserver/provision.d.ts +2 -2
- package/dist/extensions/testserver/provision.js +10 -10
- package/dist/extensions/testserver/resource.d.ts +2 -2
- package/dist/extensions/testserver/result.d.ts +2 -2
- package/dist/extensions/testserver/result.js +1 -1
- package/dist/extensions/testserver/run/connection.d.ts +1 -1
- package/dist/extensions/testserver/run/connection.js +3 -3
- package/dist/extensions/testserver/run/sandbox.d.ts +31 -0
- package/dist/extensions/testserver/run/sandbox.js +58 -0
- package/dist/extensions/testserver/run-sandbox.d.ts +2 -2
- package/dist/extensions/testserver/run-sandbox.js +3 -3
- package/dist/extensions/testserver/vercel-cli/arguments.d.ts +2 -2
- package/dist/extensions/testserver/vercel-cli/arguments.js +6 -6
- package/dist/extensions/testserver/vercel-cli/auth-config.d.ts +7 -7
- package/dist/extensions/testserver/vercel-cli/auth-config.js +4 -4
- package/dist/extensions/testserver/vercel-cli/clock.js +1 -1
- package/dist/extensions/testserver/vercel-cli/config-files.js +1 -1
- package/dist/extensions/testserver/vercel-cli/context.d.ts +1 -1
- package/dist/extensions/testserver/vercel-cli/context.js +2 -2
- package/dist/extensions/testserver/vercel-cli/entry.d.ts +1 -1
- package/dist/extensions/testserver/vercel-cli/entry.js +1 -1
- package/dist/extensions/testserver/vercel-cli/environment.d.ts +5 -5
- package/dist/extensions/testserver/vercel-cli/environment.js +6 -6
- package/dist/extensions/testserver/vercel-cli/gateways.d.ts +1 -1
- package/dist/extensions/testserver/vercel-cli/gateways.js +3 -3
- package/dist/extensions/testserver/vercel-cli/index.d.ts +1 -1
- package/dist/extensions/testserver/vercel-cli/index.js +8 -9
- package/dist/extensions/testserver/vercel-cli/invocation.d.ts +13 -12
- package/dist/extensions/testserver/vercel-cli/invocation.js +1 -1
- package/dist/extensions/testserver/vercel-cli/{driver.d.ts → invoker.d.ts} +18 -17
- package/dist/extensions/testserver/vercel-cli/{driver.js → invoker.js} +8 -8
- package/dist/extensions/testserver/vercel-cli/live/config-files.d.ts +2 -2
- package/dist/extensions/testserver/vercel-cli/live/config-files.js +2 -2
- package/dist/extensions/testserver/vercel-cli/live/process-gateway.js +1 -1
- package/dist/extensions/testserver/vercel-cli/report.js +2 -2
- package/dist/extensions/testserver/vercel-cli/verbose.js +1 -1
- package/dist/extensions/testserver/vitest/config.d.ts +8 -6
- package/dist/extensions/testserver/vitest/config.js +10 -16
- package/dist/extensions/testserver/vitest/container-scope.d.ts +11 -11
- package/dist/extensions/testserver/vitest/container-scope.js +9 -9
- package/dist/extensions/testserver/vitest/container-start.d.ts +6 -6
- package/dist/extensions/testserver/vitest/container-start.js +14 -11
- package/dist/extensions/testserver/vitest/diagnostics.d.ts +1 -1
- package/dist/extensions/testserver/vitest/fixtures.d.ts +12 -10
- package/dist/extensions/testserver/vitest/fixtures.js +44 -22
- package/dist/extensions/testserver/vitest/index.d.ts +1 -1
- package/dist/extensions/testserver/vitest/index.js +4 -4
- package/dist/extensions/testserver/vitest/types.d.ts +16 -18
- package/dist/extensions/testserver/vitest/types.js +2 -2
- package/dist/extensions/testserver/vitest/worker-sandbox.d.ts +8 -0
- package/dist/extensions/testserver/vitest/worker-sandbox.js +17 -0
- package/dist/extensions/vitest/driver.d.ts +8 -0
- package/dist/extensions/vitest/driver.js +62 -0
- package/dist/extensions/vitest/extension.d.ts +2 -0
- package/dist/extensions/vitest/extension.js +8 -0
- package/dist/{vitest → extensions/vitest/plan}/gateways.d.ts +1 -26
- package/dist/extensions/vitest/plan/gateways.js +3 -0
- package/dist/{vitest → extensions/vitest/plan}/live/list-gateway.d.ts +1 -2
- package/dist/{vitest → extensions/vitest/plan}/live/list-gateway.js +1 -20
- package/dist/extensions/vitest/plan/plan-over.d.ts +38 -0
- package/dist/extensions/vitest/plan/plan-over.js +31 -0
- package/dist/extensions/vitest/plan/plan.d.ts +24 -0
- package/dist/{vitest → extensions/vitest/plan}/plan.js +11 -26
- package/dist/extensions.d.ts +43 -30
- package/dist/extensions.js +50 -35
- package/dist/forward-sigterm.d.ts +8 -0
- package/dist/forward-sigterm.js +18 -0
- package/dist/launcher-resolvers/index.d.ts +1 -0
- package/dist/launcher-resolvers/index.js +2 -1
- package/dist/launcher-resolvers/local-services.d.ts +22 -0
- package/dist/launcher-resolvers/local-services.js +6 -0
- package/dist/live-app.js +9 -7
- package/dist/local-services.d.ts +11 -0
- package/dist/local-services.js +16 -0
- package/dist/playwright/index.d.ts +1 -0
- package/dist/playwright/index.js +4 -0
- package/dist/playwright/reporter.d.ts +96 -0
- package/dist/playwright/reporter.js +162 -0
- package/dist/playwright/worker-index.d.ts +7 -0
- package/dist/playwright/worker-index.js +20 -0
- package/dist/run-directory/gateways.d.ts +167 -0
- package/dist/run-directory/gateways.js +2 -0
- package/dist/run-directory/index.d.ts +8 -0
- package/dist/run-directory/index.js +13 -0
- package/dist/run-directory/plan.d.ts +35 -0
- package/dist/run-directory/plan.js +24 -0
- package/dist/run-directory/reader.d.ts +70 -0
- package/dist/run-directory/reader.js +51 -0
- package/dist/run-directory/recording.d.ts +95 -0
- package/dist/run-directory/recording.js +85 -0
- package/dist/{commands/exec → run-directory}/run-collector.d.ts +9 -8
- package/dist/{commands/exec → run-directory}/run-collector.js +8 -10
- package/dist/{core → run-directory}/run-directory.d.ts +3 -3
- package/dist/{core → run-directory}/run-directory.js +2 -2
- package/dist/{commands/exec → run-directory}/run-record.d.ts +94 -27
- package/dist/run-directory/run-record.js +229 -0
- package/dist/{commands/exec → run-directory}/timeline-facts.d.ts +5 -8
- package/dist/{commands/exec → run-directory}/timeline-facts.js +11 -25
- package/dist/runner/build-snapshots.d.ts +179 -0
- package/dist/runner/build-snapshots.js +235 -0
- package/dist/runner/context.js +2 -1
- package/dist/runner/events.d.ts +73 -33
- package/dist/runner/gateways.d.ts +30 -10
- package/dist/runner/index.d.ts +15 -17
- package/dist/runner/index.js +12 -14
- package/dist/runner/live/checkout-gateway.js +15 -7
- package/dist/runner/live/snapshot-records.js +8 -7
- package/dist/runner/prepare.d.ts +26 -26
- package/dist/runner/prepare.js +27 -14
- package/dist/runner/ready.d.ts +43 -10
- package/dist/runner/ready.js +51 -34
- package/dist/runner/recipe.d.ts +48 -4
- package/dist/runner/recipe.js +42 -1
- package/dist/runner/scope.d.ts +13 -13
- package/dist/runner/scope.js +9 -11
- package/dist/runner/secrets.d.ts +6 -0
- package/dist/runner/secrets.js +10 -0
- package/dist/runner/session.d.ts +128 -0
- package/dist/runner/session.js +138 -0
- package/dist/runner/snapshot-build.d.ts +21 -11
- package/dist/runner/snapshot-build.js +11 -16
- package/dist/runner/snapshot-cache.d.ts +140 -62
- package/dist/runner/snapshot-cache.js +145 -102
- package/dist/runner/snapshot-inspect.d.ts +89 -0
- package/dist/runner/snapshot-inspect.js +173 -0
- package/dist/runner/snapshot-key.d.ts +5 -2
- package/dist/runner/snapshot-key.js +1 -1
- package/dist/runner/snapshot-save.d.ts +35 -20
- package/dist/runner/snapshot-save.js +47 -37
- package/dist/runner/snapshot-start.d.ts +25 -0
- package/dist/runner/snapshot-start.js +16 -0
- package/dist/sdk/extension/ci.d.ts +2 -0
- package/dist/sdk/extension/ci.js +6 -0
- package/dist/sdk/extension/commands.d.ts +44 -28
- package/dist/sdk/extension/commands.js +15 -13
- package/dist/sdk/extension/driver.d.ts +143 -0
- package/dist/sdk/extension/driver.js +28 -0
- package/dist/sdk/extension/index.d.ts +3 -1
- package/dist/sdk/extension/index.js +16 -9
- package/dist/sdk/extension/{launcher-supplies.d.ts → launcher-context.d.ts} +3 -3
- package/dist/sdk/extension/launcher-context.js +5 -0
- package/dist/sdk/extension/lifecycle.d.ts +10 -8
- package/dist/sdk/extension/lifecycle.js +2 -2
- package/dist/sdk/extension/progress.js +2 -2
- package/dist/sdk/extension/resource-definition.d.ts +13 -13
- package/dist/sdk/extension/resource-definition.js +2 -2
- package/dist/sdk/extension/resource.d.ts +13 -13
- package/dist/sdk/extension/resource.js +11 -11
- package/dist/sdk/extension/time.js +2 -2
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +3 -1
- package/dist/sdk/run/launcher.d.ts +1 -1
- package/dist/sdk/run/launcher.js +4 -3
- package/dist/sdk/run/payload.js +1 -1
- package/dist/sdk/run/test-events.d.ts +24 -18
- package/dist/sdk/run/test-events.js +5 -4
- package/dist/sdk/run/test-result-writer.d.ts +77 -0
- package/dist/sdk/run/test-result-writer.js +143 -0
- package/dist/sdk/run/worker-test-event-writer.d.ts +13 -0
- package/dist/sdk/run/worker-test-event-writer.js +31 -0
- package/dist/vendor/testserver-sdk/container/container.d.ts +12 -12
- package/dist/vendor/testserver-sdk/container/container.js +39 -21
- package/dist/vendor/testserver-sdk/factories/build.d.ts +12 -40
- package/dist/vendor/testserver-sdk/factories/build.js +15 -66
- package/dist/vendor/testserver-sdk/factories/gateways.d.ts +1 -2
- package/dist/vendor/testserver-sdk/factories/index.d.ts +1 -3
- package/dist/vendor/testserver-sdk/factories/index.js +3 -5
- package/dist/vendor/testserver-sdk/index.d.ts +1 -2
- package/dist/vendor/testserver-sdk/index.js +5 -6
- package/dist/vendor/testserver-sdk/records/body.d.ts +1 -1
- package/dist/vendor/testserver-sdk/records/body.js +1 -1
- package/dist/vendor/testserver-sdk/testserver/failure.d.ts +4 -3
- package/dist/vendor/testserver-sdk/testserver/failure.js +4 -3
- package/dist/vitest/index.d.ts +2 -1
- package/dist/vitest/index.js +6 -4
- package/dist/vitest/test-events.d.ts +6 -16
- package/dist/vitest/test-events.js +15 -40
- package/dist/vitest/test-results.d.ts +9 -31
- package/dist/vitest/test-results.js +34 -105
- package/dist/vitest/worker-index.d.ts +6 -0
- package/dist/vitest/worker-index.js +17 -0
- package/package.json +23 -9
- package/skills/overview.md +6 -5
- package/skills/read-run-output.md +22 -7
- package/dist/chunks/chunk-AGWW3HDT.js +0 -2559
- package/dist/chunks/chunk-H2VCSNVU.js +0 -351
- package/dist/commands/exec/run-record.js +0 -135
- package/dist/commands/vitest/outcomes.d.ts +0 -379
- package/dist/commands/vitest/outcomes.js +0 -70
- package/dist/core/launcher-supplies.d.ts +0 -11
- package/dist/core/launcher-supplies.js +0 -28
- package/dist/core/mint.d.ts +0 -10
- package/dist/core/mint.js +0 -14
- package/dist/core/resource-registry.d.ts +0 -54
- package/dist/core/resource-registry.js +0 -57
- package/dist/extensions/github/live/world.d.ts +0 -6
- package/dist/extensions/github/live/world.js +0 -16
- package/dist/extensions/github/world.js +0 -3
- package/dist/extensions/testserver/live/world.d.ts +0 -8
- package/dist/extensions/testserver/vitest/sandbox.d.ts +0 -25
- package/dist/extensions/testserver/vitest/sandbox.js +0 -43
- package/dist/extensions/testserver/world.js +0 -4
- package/dist/sdk/extension/launcher-supplies.js +0 -3
- package/dist/story/align.d.ts +0 -37
- package/dist/story/align.js +0 -39
- package/dist/story/command-line.d.ts +0 -34
- package/dist/story/command-line.js +0 -100
- package/dist/story/definition.d.ts +0 -59
- package/dist/story/definition.js +0 -9
- package/dist/story/diff.d.ts +0 -9
- package/dist/story/diff.js +0 -97
- package/dist/story/errors.d.ts +0 -14
- package/dist/story/errors.js +0 -21
- package/dist/story/gateways.d.ts +0 -94
- package/dist/story/gateways.js +0 -3
- package/dist/story/host.d.ts +0 -30
- package/dist/story/host.js +0 -97
- package/dist/story/index.d.ts +0 -8
- package/dist/story/index.js +0 -10
- package/dist/story/json.d.ts +0 -16
- package/dist/story/json.js +0 -59
- package/dist/story/live/recording-gateway.d.ts +0 -2
- package/dist/story/live/recording-gateway.js +0 -103
- package/dist/story/mode.d.ts +0 -17
- package/dist/story/mode.js +0 -21
- package/dist/story/orphans.d.ts +0 -35
- package/dist/story/orphans.js +0 -51
- package/dist/story/recording.d.ts +0 -62
- package/dist/story/recording.js +0 -97
- package/dist/story/report.d.ts +0 -42
- package/dist/story/report.js +0 -130
- package/dist/story/sequence.d.ts +0 -30
- package/dist/story/sequence.js +0 -74
- package/dist/story/settle.d.ts +0 -96
- package/dist/story/settle.js +0 -71
- package/dist/story/start.d.ts +0 -50
- package/dist/story/start.js +0 -183
- package/dist/vendor/testserver-sdk/factories/definition.d.ts +0 -39
- package/dist/vendor/testserver-sdk/factories/definition.js +0 -16
- package/dist/vendor/testserver-sdk/factories/definitions.d.ts +0 -169
- package/dist/vendor/testserver-sdk/factories/definitions.js +0 -245
- package/dist/vendor/testserver-sdk/seed/index.d.ts +0 -1
- package/dist/vendor/testserver-sdk/seed/index.js +0 -3
- package/dist/vendor/testserver-sdk/seed/seed.d.ts +0 -221
- package/dist/vendor/testserver-sdk/seed/seed.js +0 -171
- package/dist/vitest/find-vitest.d.ts +0 -7
- package/dist/vitest/find-vitest.js +0 -28
- package/dist/vitest/gateways.js +0 -4
- package/dist/vitest/plan.d.ts +0 -51
- /package/dist/{vitest → extensions/vitest/plan}/list-output.d.ts +0 -0
- /package/dist/{vitest → extensions/vitest/plan}/list-output.js +0 -0
- /package/dist/{core → run-directory}/live/run-directory-gateway.d.ts +0 -0
- /package/dist/{core → run-directory}/live/run-directory-gateway.js +0 -0
|
@@ -2,111 +2,213 @@ import {
|
|
|
2
2
|
versionText
|
|
3
3
|
} from "./chunk-I5GZLOLQ.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
redactStrings,
|
|
6
|
+
redactingObserver,
|
|
7
|
+
redactingTerminal,
|
|
8
|
+
redactor
|
|
9
|
+
} from "./chunk-FK4RLDEK.js";
|
|
9
10
|
import {
|
|
10
|
-
NodeSignalCancellation
|
|
11
|
-
} from "./chunk-WF4KJ7YG.js";
|
|
12
|
-
import {
|
|
13
|
-
RESOURCE_FLAG_HELP,
|
|
14
|
-
RESOURCE_USAGE_FLAGS,
|
|
15
11
|
criticalPathStep,
|
|
16
12
|
recordedPlan,
|
|
17
13
|
resourceFlagFields,
|
|
18
14
|
resourceFlagProblems,
|
|
19
15
|
resourceFlagValues,
|
|
20
|
-
runRecordText,
|
|
21
|
-
saveSchema,
|
|
22
16
|
testPlanLine,
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
testsChart,
|
|
18
|
+
testsSummaryLines,
|
|
19
|
+
waterfallLines
|
|
20
|
+
} from "./chunk-Y3BUNNRG.js";
|
|
21
|
+
import {
|
|
22
|
+
builtAtText,
|
|
23
|
+
noSaveText,
|
|
24
|
+
rejectionLines,
|
|
25
|
+
snapshotCacheNoteText
|
|
26
|
+
} from "./chunk-4XT5RC5T.js";
|
|
27
|
+
import {
|
|
28
|
+
DEFINITION_SET,
|
|
29
|
+
RESOURCES
|
|
30
|
+
} from "./chunk-ISGQJIQM.js";
|
|
31
|
+
import {
|
|
32
|
+
sandboxConnectPage
|
|
33
|
+
} from "./chunk-NMVODY3P.js";
|
|
34
|
+
import {
|
|
35
|
+
noSaveReasonSchema,
|
|
36
|
+
recordRun,
|
|
37
|
+
saveSchema,
|
|
25
38
|
timelineSchema
|
|
26
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-TEEZL3GA.js";
|
|
27
40
|
import {
|
|
28
|
-
EMPTY_RUN_STATE,
|
|
29
|
-
RESOURCES,
|
|
30
|
-
RESOURCE_PRESENTATIONS,
|
|
31
|
-
RESOURCE_REPORTS,
|
|
32
|
-
RUN_CLEANUP,
|
|
33
|
-
RUN_DIRECTORIES_KEPT,
|
|
34
|
-
applyStormEvent,
|
|
35
|
-
cleanupProblems,
|
|
36
|
-
commandExitStatus,
|
|
37
|
-
executeRun,
|
|
38
41
|
isoSecondsText,
|
|
39
42
|
keepTimeText,
|
|
40
|
-
keptText,
|
|
41
|
-
megabytesText,
|
|
42
|
-
notDeletedText,
|
|
43
|
-
notKeptText,
|
|
44
|
-
notStoppedText,
|
|
45
|
-
observeAll,
|
|
46
43
|
paint,
|
|
47
44
|
releaseText,
|
|
48
|
-
resourceLifecycles,
|
|
49
|
-
runDirectoryObserver,
|
|
50
|
-
runnerCleanupWarnings,
|
|
51
45
|
seconds,
|
|
52
|
-
secondsOf,
|
|
53
|
-
secondsText,
|
|
54
46
|
short,
|
|
55
47
|
shortFile,
|
|
56
48
|
spread,
|
|
57
|
-
stepLog,
|
|
58
|
-
stormTimeline,
|
|
59
|
-
testEventsPath,
|
|
60
|
-
timedProgress,
|
|
61
49
|
truncate,
|
|
62
50
|
visibleLength,
|
|
51
|
+
withArticle
|
|
52
|
+
} from "./chunk-TMQQYHUX.js";
|
|
53
|
+
import {
|
|
54
|
+
EMPTY_RUN_STATE,
|
|
55
|
+
cleanupProblems,
|
|
56
|
+
commandExitStatus,
|
|
57
|
+
executeRun,
|
|
58
|
+
megabytesText,
|
|
59
|
+
secondsOf,
|
|
60
|
+
secondsText,
|
|
61
|
+
setupPhaseKey,
|
|
62
|
+
setupPhaseWords,
|
|
63
|
+
timedProgress,
|
|
63
64
|
warningTally
|
|
64
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-FSP3SJ35.js";
|
|
65
66
|
import {
|
|
66
67
|
RUNNER_SECRET_MIN_LENGTH,
|
|
67
68
|
configErrors,
|
|
68
69
|
credentialErrors,
|
|
70
|
+
devSnapshotsTrusted,
|
|
69
71
|
fileSettings,
|
|
70
72
|
invalidConfig,
|
|
71
73
|
loadSettingsFile,
|
|
72
74
|
mintTargetText,
|
|
73
75
|
parseKeepTime,
|
|
74
|
-
parseTestEvent,
|
|
75
76
|
prepareRunner,
|
|
76
77
|
readRunnerSecrets,
|
|
77
78
|
recipeRun,
|
|
78
|
-
redactSecrets,
|
|
79
79
|
requireTarget,
|
|
80
80
|
settleCredential,
|
|
81
|
-
settleRunResources
|
|
82
|
-
|
|
83
|
-
} from "./chunk-VJQLMGOH.js";
|
|
81
|
+
settleRunResources
|
|
82
|
+
} from "./chunk-ODQHQJLE.js";
|
|
84
83
|
import {
|
|
85
|
-
describeMintFailure
|
|
86
|
-
|
|
84
|
+
describeMintFailure,
|
|
85
|
+
isCi
|
|
86
|
+
} from "./chunk-YT5OROR7.js";
|
|
87
|
+
import {
|
|
88
|
+
NodeSignalCancellation
|
|
89
|
+
} from "./chunk-BW2ADH7U.js";
|
|
87
90
|
import {
|
|
88
91
|
defineErrors,
|
|
89
92
|
defineOutcomes,
|
|
90
93
|
refused,
|
|
91
94
|
renderOutcome
|
|
92
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-YM6TZV4L.js";
|
|
96
|
+
|
|
97
|
+
// src/commands/exec/cleanup.ts
|
|
98
|
+
import { z } from "zod";
|
|
99
|
+
var notStoppedSchema = z.object({
|
|
100
|
+
name: z.string(),
|
|
101
|
+
role: z.enum(["runner", "snapshot-build"]),
|
|
102
|
+
/** The sandbox's own timeout, in minutes, within which it stops. */
|
|
103
|
+
timeoutMinutes: z.number(),
|
|
104
|
+
message: z.string()
|
|
105
|
+
});
|
|
106
|
+
var notDeletedSchema = z.object({
|
|
107
|
+
name: z.string(),
|
|
108
|
+
role: z.enum(["runner", "snapshot-build"]),
|
|
109
|
+
message: z.string()
|
|
110
|
+
});
|
|
111
|
+
var keptSchema = z.object({
|
|
112
|
+
name: z.string(),
|
|
113
|
+
/** When its timeout stops it, as an ISO time: the keep time from when the run ended, or later. */
|
|
114
|
+
stopsAt: z.string(),
|
|
115
|
+
/** Its Connect page in the Vercel dashboard, which says how to open a shell in it. */
|
|
116
|
+
url: z.string()
|
|
117
|
+
});
|
|
118
|
+
var notKeptSchema = z.object({ name: z.string(), message: z.string() });
|
|
119
|
+
var runnerCleanupSchema = z.object({
|
|
120
|
+
kept: keptSchema.nullable(),
|
|
121
|
+
notKept: notKeptSchema.nullable(),
|
|
122
|
+
notStopped: z.array(notStoppedSchema),
|
|
123
|
+
notDeleted: z.array(notDeletedSchema)
|
|
124
|
+
});
|
|
125
|
+
function sandboxRole(role) {
|
|
126
|
+
return role === "runner" ? "runner sandbox" : "build sandbox";
|
|
127
|
+
}
|
|
128
|
+
function notStoppedText(sandbox) {
|
|
129
|
+
return `Couldn't stop the ${sandboxRole(sandbox.role)} ${sandbox.name}: ${sandbox.message}. Its own timeout stops it within ${sandbox.timeoutMinutes} minutes.`;
|
|
130
|
+
}
|
|
131
|
+
function notDeletedText(sandbox) {
|
|
132
|
+
return `Stopped the ${sandboxRole(sandbox.role)} ${sandbox.name}, but couldn't delete it: ${sandbox.message}. It stays listed in the Vercel project.`;
|
|
133
|
+
}
|
|
134
|
+
function keptText(kept) {
|
|
135
|
+
return `Kept the runner sandbox ${kept.name} running until ${isoSecondsText(kept.stopsAt)}, so you can connect to it: ${kept.url}`;
|
|
136
|
+
}
|
|
137
|
+
function notKeptText(sandbox) {
|
|
138
|
+
return `Couldn't keep the runner sandbox ${sandbox.name} running: ${sandbox.message}. Stopped and deleted it instead.`;
|
|
139
|
+
}
|
|
140
|
+
function runnerCleanupRows(cleanup) {
|
|
141
|
+
if (cleanup === null) return [];
|
|
142
|
+
const { kept, notKept } = cleanup;
|
|
143
|
+
return [
|
|
144
|
+
...kept === null ? [] : [["Sandbox kept", [`${kept.name}, running until ${isoSecondsText(kept.stopsAt)}`, kept.url]]],
|
|
145
|
+
...notKept === null ? [] : [["Sandbox not kept", notKeptText(notKept)]],
|
|
146
|
+
...cleanup.notStopped.length === 0 ? [] : [["Sandboxes not stopped", cleanup.notStopped.map(notStoppedText)]],
|
|
147
|
+
...cleanup.notDeleted.length === 0 ? [] : [["Sandboxes not deleted", cleanup.notDeleted.map(notDeletedText)]]
|
|
148
|
+
];
|
|
149
|
+
}
|
|
150
|
+
function runnerCleanupWarnings(cleanup) {
|
|
151
|
+
if (cleanup === null) return [];
|
|
152
|
+
return [
|
|
153
|
+
...cleanup.notKept === null ? [] : [{ reason: "runner_sandbox_not_kept", message: notKeptText(cleanup.notKept) }],
|
|
154
|
+
...cleanup.notStopped.map((sandbox) => ({
|
|
155
|
+
reason: "runner_sandbox_not_stopped",
|
|
156
|
+
message: notStoppedText(sandbox)
|
|
157
|
+
})),
|
|
158
|
+
...cleanup.notDeleted.map((sandbox) => ({
|
|
159
|
+
reason: "runner_sandbox_not_deleted",
|
|
160
|
+
message: notDeletedText(sandbox)
|
|
161
|
+
}))
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
function runCleanupOf(reports) {
|
|
165
|
+
const schema = z.object({ runner: runnerCleanupSchema.nullable(), resources: reports.cleanupSchema });
|
|
166
|
+
const rows = (cleanup) => [
|
|
167
|
+
...runnerCleanupRows(cleanup.runner),
|
|
168
|
+
...reports.cleanupRows(cleanup.resources)
|
|
169
|
+
];
|
|
170
|
+
return {
|
|
171
|
+
schema,
|
|
172
|
+
facts: ({ runnerCleanup, resourceCleanup }) => ({
|
|
173
|
+
runner: runnerCleanupOf(runnerCleanup),
|
|
174
|
+
resources: reports.cleanupFacts(resourceCleanup)
|
|
175
|
+
}),
|
|
176
|
+
rows
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
var RUN_CLEANUP = runCleanupOf(DEFINITION_SET.reports);
|
|
180
|
+
function runnerCleanupOf(report) {
|
|
181
|
+
if (report === null) return null;
|
|
182
|
+
const { kept, target } = report;
|
|
183
|
+
return {
|
|
184
|
+
kept: kept === null ? null : { name: kept.name, stopsAt: kept.stopsAt, url: sandboxConnectPage(target, kept.name) },
|
|
185
|
+
notKept: report.notKept === null ? null : { ...report.notKept },
|
|
186
|
+
notStopped: report.notStopped.map(({ name, role, timeoutMinutes, message }) => ({
|
|
187
|
+
name,
|
|
188
|
+
role,
|
|
189
|
+
timeoutMinutes,
|
|
190
|
+
message
|
|
191
|
+
})),
|
|
192
|
+
notDeleted: report.notDeleted.map(({ name, role, message }) => ({ name, role, message }))
|
|
193
|
+
};
|
|
194
|
+
}
|
|
93
195
|
|
|
94
196
|
// src/commands/exec/outcomes.ts
|
|
95
|
-
import { z as
|
|
197
|
+
import { z as z4 } from "zod";
|
|
96
198
|
|
|
97
199
|
// src/commands/exec/mint-failed.ts
|
|
98
|
-
import { z } from "zod";
|
|
200
|
+
import { z as z2 } from "zod";
|
|
99
201
|
var mintFailedErrors = defineErrors({
|
|
100
202
|
mintFailed: {
|
|
101
203
|
exitCode: 1,
|
|
102
204
|
description: "The vercel CLI couldn't mint a credential, so the command didn't run. In a sandboxed run, the credential was for the runner sandbox, which always needs one; in an unsandboxed run, for a resource that couldn't go on without it.",
|
|
103
|
-
schema:
|
|
104
|
-
team:
|
|
105
|
-
project:
|
|
106
|
-
cause:
|
|
107
|
-
fix:
|
|
205
|
+
schema: z2.object({
|
|
206
|
+
team: z2.string(),
|
|
207
|
+
project: z2.string(),
|
|
208
|
+
cause: z2.string(),
|
|
209
|
+
fix: z2.string(),
|
|
108
210
|
/** Whether the credential was for the runner sandbox, not for a resource. */
|
|
109
|
-
runner:
|
|
211
|
+
runner: z2.boolean(),
|
|
110
212
|
/** What the run couldn't clean up. */
|
|
111
213
|
cleanup: RUN_CLEANUP.schema
|
|
112
214
|
}),
|
|
@@ -122,14 +224,14 @@ var mintFailedErrors = defineErrors({
|
|
|
122
224
|
});
|
|
123
225
|
|
|
124
226
|
// src/commands/exec/resource-refusals.ts
|
|
125
|
-
import { z as
|
|
227
|
+
import { z as z3 } from "zod";
|
|
126
228
|
var refusalShape = {
|
|
127
229
|
/** The resource instance that refused, by its resource key. */
|
|
128
|
-
resource:
|
|
230
|
+
resource: z3.string().min(1),
|
|
129
231
|
/** The resource's own snake_case reason for refusing. */
|
|
130
|
-
refusal:
|
|
232
|
+
refusal: z3.string(),
|
|
131
233
|
/** The resource's own data about the refusal, which differs by resource and reason. */
|
|
132
|
-
data:
|
|
234
|
+
data: z3.record(z3.string(), z3.unknown())
|
|
133
235
|
};
|
|
134
236
|
function contentOf({ message, next, rows: own = [] }, rows) {
|
|
135
237
|
const all = [...own, ...rows];
|
|
@@ -139,17 +241,17 @@ var resourceRefusalErrors = defineErrors({
|
|
|
139
241
|
resourceRefusedBeforeRun: {
|
|
140
242
|
exitCode: 2,
|
|
141
243
|
description: "A resource's beforeRun refused the run before it started, so nothing was minted, acquired or started. data.resource names the resource by its key, data.refusal is the resource's own reason, and data.data its own data.",
|
|
142
|
-
schema:
|
|
244
|
+
schema: z3.object({
|
|
143
245
|
...refusalShape,
|
|
144
246
|
/** The config file that applied (its absolute path); null when none did. */
|
|
145
|
-
configFile:
|
|
247
|
+
configFile: z3.string().nullable()
|
|
146
248
|
}),
|
|
147
249
|
render: (_data, refusal) => contentOf(refusal, [])
|
|
148
250
|
},
|
|
149
251
|
resourceRefused: {
|
|
150
252
|
exitCode: 1,
|
|
151
253
|
description: "A resource refused while the run acquired its resources, so the command didn't run. data.resource names the resource by its key, data.refusal is the resource's own reason, and data.data its own data.",
|
|
152
|
-
schema:
|
|
254
|
+
schema: z3.object({
|
|
153
255
|
...refusalShape,
|
|
154
256
|
/** What the run couldn't clean up. */
|
|
155
257
|
cleanup: RUN_CLEANUP.schema
|
|
@@ -173,32 +275,32 @@ function resourceRefused(outcome, cleanup) {
|
|
|
173
275
|
}
|
|
174
276
|
|
|
175
277
|
// src/commands/exec/outcomes.ts
|
|
176
|
-
var runnerFailureSchema =
|
|
177
|
-
|
|
178
|
-
kind:
|
|
278
|
+
var runnerFailureSchema = z4.union([
|
|
279
|
+
z4.object({
|
|
280
|
+
kind: z4.enum(["snapshot-build-step-failed", "apply-failed", "install-failed", "build-failed"]),
|
|
179
281
|
/** The step's label. */
|
|
180
|
-
label:
|
|
282
|
+
label: z4.string(),
|
|
181
283
|
/** Its exit code; null when it ended without one. */
|
|
182
|
-
exitCode:
|
|
284
|
+
exitCode: z4.number().nullable(),
|
|
183
285
|
/** Its last 40 output lines. */
|
|
184
|
-
tail:
|
|
286
|
+
tail: z4.array(z4.string())
|
|
185
287
|
}),
|
|
186
|
-
|
|
187
|
-
kind:
|
|
288
|
+
z4.object({
|
|
289
|
+
kind: z4.literal("sandbox-api-failed"),
|
|
188
290
|
/** The Sandbox call that failed. */
|
|
189
|
-
operation:
|
|
291
|
+
operation: z4.string(),
|
|
190
292
|
/** The HTTP status the Sandbox API answered; null when it answered none. */
|
|
191
|
-
status:
|
|
192
|
-
message:
|
|
293
|
+
status: z4.number().nullable(),
|
|
294
|
+
message: z4.string()
|
|
193
295
|
}),
|
|
194
|
-
|
|
195
|
-
kind:
|
|
296
|
+
z4.object({
|
|
297
|
+
kind: z4.literal("checkout-failed"),
|
|
196
298
|
/** What git or tar said. */
|
|
197
|
-
message:
|
|
299
|
+
message: z4.string(),
|
|
198
300
|
/** The failed command; null when there was none. */
|
|
199
|
-
command:
|
|
301
|
+
command: z4.string().nullable()
|
|
200
302
|
}),
|
|
201
|
-
|
|
303
|
+
z4.object({ kind: z4.literal("credential-claims-missing"), team: z4.string(), project: z4.string() })
|
|
202
304
|
]);
|
|
203
305
|
function listed(names) {
|
|
204
306
|
if (names.length <= 1) return names.join("");
|
|
@@ -246,19 +348,19 @@ function runnerFailureText(failure) {
|
|
|
246
348
|
};
|
|
247
349
|
}
|
|
248
350
|
}
|
|
249
|
-
var ranSchema =
|
|
351
|
+
var ranSchema = z4.object({
|
|
250
352
|
/** storm's version. */
|
|
251
|
-
version:
|
|
353
|
+
version: z4.string(),
|
|
252
354
|
/** The git commit storm was built from, as its version line shows it (`3f2a9c1b7d4e`, `-dirty` appended when built from a tree with uncommitted changes); null when unknown. */
|
|
253
|
-
commit:
|
|
355
|
+
commit: z4.string().nullable(),
|
|
254
356
|
/** The config file the run's settings came from (its absolute path); null when none applied. */
|
|
255
|
-
configFile:
|
|
357
|
+
configFile: z4.string().nullable(),
|
|
256
358
|
/**
|
|
257
359
|
* What each acquired resource instance that reports something says of itself, keyed by resource key: its
|
|
258
360
|
* definition's name (`definition`), its facts (`facts`, what its acquire answered, unknown to the schema, or null
|
|
259
361
|
* when it answered none) and the warnings its acquire reported (`warnings`).
|
|
260
362
|
*/
|
|
261
|
-
resources:
|
|
363
|
+
resources: DEFINITION_SET.reports.ranSchema,
|
|
262
364
|
/**
|
|
263
365
|
* What the run's cleanup left: the runner sandbox it kept running and the runner's sandboxes it couldn't stop or
|
|
264
366
|
* delete (`runner`, null without a runner sandbox), and what releasing each of its resource instances couldn't do,
|
|
@@ -269,36 +371,46 @@ var ranSchema = z3.object({
|
|
|
269
371
|
* How the command ended: its exit code, or the signal that ended it; both null for a command in the runner sandbox
|
|
270
372
|
* that ended without an exit code.
|
|
271
373
|
*/
|
|
272
|
-
command:
|
|
374
|
+
command: z4.object({ exitCode: z4.number().nullable(), signal: z4.string().nullable() }),
|
|
273
375
|
/** The runner sandbox the command ran in; null without one. */
|
|
274
|
-
runner:
|
|
376
|
+
runner: z4.object({
|
|
275
377
|
/** The runner snapshot it started from. */
|
|
276
|
-
snapshotId:
|
|
378
|
+
snapshotId: z4.string(),
|
|
277
379
|
/** The runner snapshot's base, a full SHA. */
|
|
278
|
-
base:
|
|
279
|
-
/** For a
|
|
280
|
-
snapshotBranch:
|
|
281
|
-
/** For a
|
|
282
|
-
snapshotHead:
|
|
380
|
+
base: z4.string(),
|
|
381
|
+
/** For a dev snapshot, the local branch of the run that saved it; null for a base snapshot. */
|
|
382
|
+
snapshotBranch: z4.string().nullable(),
|
|
383
|
+
/** For a dev snapshot, the HEAD commit of the run that saved it, a full SHA; null for a base snapshot. */
|
|
384
|
+
snapshotHead: z4.string().nullable(),
|
|
385
|
+
/** The runner snapshot's kind: a base snapshot, built from its base, or a dev snapshot, saved from a run. */
|
|
386
|
+
snapshotKind: z4.enum(["base", "dev"]),
|
|
387
|
+
/** The commit the runner snapshot was built at, a full SHA: a base snapshot's base, or the commit that saved a dev snapshot. */
|
|
388
|
+
snapshotBuiltAt: z4.string(),
|
|
389
|
+
/** How many commits HEAD has that the snapshot's built-at commit lacks, 0 for a snapshot built at HEAD's commit; null when storm couldn't count them. */
|
|
390
|
+
builtBehind: z4.number().nullable(),
|
|
391
|
+
/** How many bytes of changes the run uploaded on top of the snapshot's base. */
|
|
392
|
+
uploadBytes: z4.number(),
|
|
283
393
|
/** Whether this run built the runner snapshot. */
|
|
284
|
-
built:
|
|
285
|
-
vcpus:
|
|
286
|
-
region:
|
|
287
|
-
runtime:
|
|
394
|
+
built: z4.boolean(),
|
|
395
|
+
vcpus: z4.number(),
|
|
396
|
+
region: z4.string(),
|
|
397
|
+
runtime: z4.string(),
|
|
288
398
|
/** How long the build step took, in milliseconds. */
|
|
289
|
-
buildMs:
|
|
290
|
-
/** How saving the runner sandbox as a
|
|
291
|
-
save: saveSchema.nullable()
|
|
399
|
+
buildMs: z4.number(),
|
|
400
|
+
/** How saving the runner sandbox as a dev snapshot ended; null when the run started no save. */
|
|
401
|
+
save: saveSchema.nullable(),
|
|
402
|
+
/** Why the run, whose command ended on its own, started no save of a dev snapshot; null when it started one. */
|
|
403
|
+
noSaveReason: noSaveReasonSchema.nullable()
|
|
292
404
|
}).nullable(),
|
|
293
405
|
/** The run's waterfall, as the run directory's timeline.json holds it: each lane's label, span and steps in milliseconds since the run started, how they ended, idle time, and the critical path. */
|
|
294
406
|
timeline: timelineSchema,
|
|
295
407
|
/** The run's run directory's run id, which `storm runs show` takes; null when the run couldn't make one. */
|
|
296
|
-
runId:
|
|
408
|
+
runId: z4.string().nullable()
|
|
297
409
|
});
|
|
298
410
|
var RAN_DESCRIPTION = "The command ran and ended. storm exits with its code, or 128 + n when signal n ended it, whatever this result's exit code.";
|
|
299
411
|
function renderRan(ran) {
|
|
300
412
|
const warnings = [
|
|
301
|
-
...
|
|
413
|
+
...DEFINITION_SET.reports.ranWarnings(ran.resources),
|
|
302
414
|
...ran.runner !== null && ran.command.exitCode === null && ran.command.signal === null ? [
|
|
303
415
|
{
|
|
304
416
|
reason: "sandboxed_no_exit_code",
|
|
@@ -306,7 +418,7 @@ function renderRan(ran) {
|
|
|
306
418
|
}
|
|
307
419
|
] : [],
|
|
308
420
|
...runnerCleanupWarnings(ran.cleanup.runner),
|
|
309
|
-
...
|
|
421
|
+
...DEFINITION_SET.reports.cleanupWarnings(ran.cleanup.resources)
|
|
310
422
|
];
|
|
311
423
|
const kept = ran.cleanup.runner?.kept ?? null;
|
|
312
424
|
return renderOutcome({
|
|
@@ -318,11 +430,11 @@ var runErrors = defineErrors({
|
|
|
318
430
|
credentialUnused: {
|
|
319
431
|
exitCode: 2,
|
|
320
432
|
description: "--credential was given to a run with no resource that takes a credential.",
|
|
321
|
-
schema:
|
|
433
|
+
schema: z4.object({
|
|
322
434
|
/** The flags given that none of the run's resources takes, as typed, such as --credential. */
|
|
323
|
-
flags:
|
|
435
|
+
flags: z4.array(z4.string()),
|
|
324
436
|
/** The config file that applied; null when none did. */
|
|
325
|
-
configFile:
|
|
437
|
+
configFile: z4.string().nullable()
|
|
326
438
|
}),
|
|
327
439
|
render: ({ flags }) => ({
|
|
328
440
|
message: `${flags.join(", ")} ${flags.length === 1 ? "applies" : "apply"} only to a run with a resource that takes a credential, and this run has none.`,
|
|
@@ -334,12 +446,31 @@ var runErrors = defineErrors({
|
|
|
334
446
|
]
|
|
335
447
|
})
|
|
336
448
|
},
|
|
449
|
+
devSnapshotsNotTrusted: {
|
|
450
|
+
exitCode: 2,
|
|
451
|
+
description: "--save-dev-snapshot was given to a sandboxed run whose runner recipe's install or build step names a runner secret, and the recipe doesn't set trustDevSnapshots: true. A dev snapshot holds what a command wrote, and those steps run on top of it in later runs with their secrets, so only the recipe grants that trust. Nothing was minted, acquired or created.",
|
|
452
|
+
schema: z4.object({
|
|
453
|
+
/** The flag given, as typed. */
|
|
454
|
+
flag: z4.string(),
|
|
455
|
+
/** The config file that gave the runner recipe; null when none did. */
|
|
456
|
+
configFile: z4.string().nullable()
|
|
457
|
+
}),
|
|
458
|
+
render: ({ flag, configFile }) => ({
|
|
459
|
+
message: `${flag} saves a dev snapshot, and the runner recipe${configFile === null ? "" : ` in ${configFile}`} doesn't trust dev snapshots: its install or build step names a runner secret.`,
|
|
460
|
+
next: [
|
|
461
|
+
{
|
|
462
|
+
type: "text",
|
|
463
|
+
text: `Drop ${flag}, or set trustDevSnapshots: true under the runner key of storm.config.ts, which trusts every command run from a checkout with those secrets.`
|
|
464
|
+
}
|
|
465
|
+
]
|
|
466
|
+
})
|
|
467
|
+
},
|
|
337
468
|
missingRunner: {
|
|
338
469
|
exitCode: 2,
|
|
339
470
|
description: "A sandboxed run (no --unsandboxed) needs a runner recipe, and no storm.config.ts gives a runner key.",
|
|
340
|
-
schema:
|
|
471
|
+
schema: z4.object({
|
|
341
472
|
/** The config file that applied; null when none did. */
|
|
342
|
-
configFile:
|
|
473
|
+
configFile: z4.string().nullable()
|
|
343
474
|
}),
|
|
344
475
|
render: ({ configFile }) => ({
|
|
345
476
|
message: configFile === null ? "A sandboxed run needs a runner recipe, and no storm.config.ts applies." : `A sandboxed run needs a runner recipe, and ${configFile} has no runner key.`,
|
|
@@ -354,13 +485,13 @@ var runErrors = defineErrors({
|
|
|
354
485
|
runnerSecretsInvalid: {
|
|
355
486
|
exitCode: 2,
|
|
356
487
|
description: "In a sandboxed run, launcher environment variables the runner recipe's secrets key names can't be used, so the run didn't start: it minted, acquired and created nothing. Each variable has one problem, the first of: missing, unset or empty; multiline, its value holds a carriage return or a line feed, which line-by-line output would split past storm's redaction; short, its value holds fewer than 8 characters, and storm shows each value as <token> wherever it appears in what it prints and writes, so a value that short would hide ordinary output.",
|
|
357
|
-
schema:
|
|
488
|
+
schema: z4.object({
|
|
358
489
|
/** Each variable storm can't use and why, in the recipe's order. */
|
|
359
|
-
variables:
|
|
490
|
+
variables: z4.array(z4.object({ name: z4.string(), problem: z4.enum(["missing", "multiline", "short"]) })),
|
|
360
491
|
/** The fewest characters a runner secret's value may have. */
|
|
361
|
-
minLength:
|
|
492
|
+
minLength: z4.number(),
|
|
362
493
|
/** The config file that gave the runner recipe. */
|
|
363
|
-
configFile:
|
|
494
|
+
configFile: z4.string().nullable()
|
|
364
495
|
}),
|
|
365
496
|
render: ({ variables, minLength, configFile }) => {
|
|
366
497
|
const named = (problem) => variables.filter((variable) => variable.problem === problem).map(({ name }) => name);
|
|
@@ -394,9 +525,9 @@ var runErrors = defineErrors({
|
|
|
394
525
|
noBaseRef: {
|
|
395
526
|
exitCode: 1,
|
|
396
527
|
description: "In a sandboxed run, none of the runner recipe's baseRefs exists locally and shares history with HEAD, so there is no base. storm never fetches.",
|
|
397
|
-
schema:
|
|
528
|
+
schema: z4.object({
|
|
398
529
|
/** Each ref in baseRefs, and why it gave no base. */
|
|
399
|
-
refs:
|
|
530
|
+
refs: z4.array(z4.object({ ref: z4.string(), reason: z4.enum(["missing", "unrelated"]) }))
|
|
400
531
|
}),
|
|
401
532
|
render: ({ refs }) => ({
|
|
402
533
|
message: `No base for the runner: none of ${refs.map(({ ref }) => ref).join(", ")} exists locally and shares history with HEAD. The command didn't run.`,
|
|
@@ -419,7 +550,7 @@ var runErrors = defineErrors({
|
|
|
419
550
|
submodulesRefused: {
|
|
420
551
|
exitCode: 1,
|
|
421
552
|
description: "In a sandboxed run, the checkout has Git submodules, which neither the upload nor the base's files carry.",
|
|
422
|
-
schema:
|
|
553
|
+
schema: z4.object({ paths: z4.array(z4.string()) }),
|
|
423
554
|
render: ({ paths }) => ({
|
|
424
555
|
message: `The checkout has Git submodules, which the runner can't carry: ${paths.join(", ")}. The command didn't run.`,
|
|
425
556
|
next: [{ type: "text", text: "Run on this machine with --unsandboxed." }]
|
|
@@ -428,12 +559,12 @@ var runErrors = defineErrors({
|
|
|
428
559
|
snapshotGone: {
|
|
429
560
|
exitCode: 1,
|
|
430
561
|
description: "In a sandboxed run, the cached runner snapshot the run picked was gone (the Sandbox API answered 410), so its cache entry was removed and the command didn't run. The next run picks another runner snapshot or builds one.",
|
|
431
|
-
schema:
|
|
432
|
-
snapshotId:
|
|
562
|
+
schema: z4.object({
|
|
563
|
+
snapshotId: z4.string(),
|
|
433
564
|
/** The runner snapshot's base, a full SHA. */
|
|
434
|
-
base:
|
|
565
|
+
base: z4.string(),
|
|
435
566
|
/** Why its cache entry couldn't be removed; null when it was. */
|
|
436
|
-
removal:
|
|
567
|
+
removal: z4.object({ path: z4.string(), message: z4.string() }).nullable(),
|
|
437
568
|
/** What the run couldn't clean up. */
|
|
438
569
|
cleanup: RUN_CLEANUP.schema
|
|
439
570
|
}),
|
|
@@ -454,7 +585,7 @@ var runErrors = defineErrors({
|
|
|
454
585
|
runnerFailed: {
|
|
455
586
|
exitCode: 1,
|
|
456
587
|
description: "In a sandboxed run, the runner couldn't run the command: a snapshot build step, applying the changes, the install or the build failed (with the step's last 40 output lines), a Vercel Sandbox call failed, git or tar failed on this machine, or the credential names no team and project ids.",
|
|
457
|
-
schema:
|
|
588
|
+
schema: z4.object({
|
|
458
589
|
failure: runnerFailureSchema,
|
|
459
590
|
/** What the run couldn't clean up; its `runner` is null when the run failed before it started a sandbox. */
|
|
460
591
|
cleanup: RUN_CLEANUP.schema
|
|
@@ -472,11 +603,11 @@ var runErrors = defineErrors({
|
|
|
472
603
|
spawnFailed: {
|
|
473
604
|
exitCode: 1,
|
|
474
605
|
description: "The command couldn't start.",
|
|
475
|
-
schema:
|
|
606
|
+
schema: z4.object({
|
|
476
607
|
/** The command's first argument: what storm tried to run. */
|
|
477
|
-
executable:
|
|
608
|
+
executable: z4.string(),
|
|
478
609
|
/** What the OS said. */
|
|
479
|
-
message:
|
|
610
|
+
message: z4.string(),
|
|
480
611
|
/**
|
|
481
612
|
* What the run couldn't clean up; its `runner` is null, since only a run without a runner sandbox spawns its
|
|
482
613
|
* command here.
|
|
@@ -508,134 +639,6 @@ var outcomes = defineOutcomes({
|
|
|
508
639
|
errors: RUN_ERRORS
|
|
509
640
|
});
|
|
510
641
|
|
|
511
|
-
// src/commands/exec/redaction.ts
|
|
512
|
-
function redactor(secrets) {
|
|
513
|
-
const kept = secrets.filter((secret) => secret !== "");
|
|
514
|
-
return kept.length === 0 ? (text) => text : (text) => redactSecrets(text, kept);
|
|
515
|
-
}
|
|
516
|
-
function redactStrings(value, redact) {
|
|
517
|
-
if (typeof value === "string") return redact(value);
|
|
518
|
-
if (Array.isArray(value)) return value.map((each) => redactStrings(each, redact));
|
|
519
|
-
if (typeof value === "object" && value !== null) {
|
|
520
|
-
const prototype = Object.getPrototypeOf(value);
|
|
521
|
-
if (prototype !== Object.prototype && prototype !== null) return value;
|
|
522
|
-
return Object.fromEntries(
|
|
523
|
-
Object.entries(value).map(([key, each]) => [key, redactStrings(each, redact)])
|
|
524
|
-
);
|
|
525
|
-
}
|
|
526
|
-
return value;
|
|
527
|
-
}
|
|
528
|
-
function redactingObserver(observer, redact) {
|
|
529
|
-
return {
|
|
530
|
-
observe: async (timed) => await observer.observe({ event: redactStrings(timed.event, redact), at: timed.at })
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
function redactingTerminal(terminal, redact) {
|
|
534
|
-
return {
|
|
535
|
-
color: terminal.color,
|
|
536
|
-
writeStdout: (text) => terminal.writeStdout(redact(text)),
|
|
537
|
-
writeStderr: (text) => terminal.writeStderr(redact(text))
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
// src/commands/exec/plan-run.ts
|
|
542
|
-
async function planRun(app, lifecycles, request, planCommand, signal) {
|
|
543
|
-
const file = await loadSettingsFile(app.context.config, app.cwd, RESOURCES);
|
|
544
|
-
if (!file.ok) return file;
|
|
545
|
-
const configFile = file.path;
|
|
546
|
-
const settings = fileSettings(file, request);
|
|
547
|
-
let where;
|
|
548
|
-
if (request.unsandboxed) where = { kind: "unsandboxed" };
|
|
549
|
-
else {
|
|
550
|
-
if (settings.runner === void 0) return refused(runErrors.missingRunner({ configFile }));
|
|
551
|
-
const required = requireTarget(settings.scope, settings.project);
|
|
552
|
-
if (!required.ok) return required;
|
|
553
|
-
const recipe = settings.runner.value;
|
|
554
|
-
const secrets = readRunnerSecrets(recipe, app.env);
|
|
555
|
-
if (!secrets.ok)
|
|
556
|
-
return refused(
|
|
557
|
-
runErrors.runnerSecretsInvalid({
|
|
558
|
-
variables: secrets.variables.map(({ name, problem }) => ({ name, problem })),
|
|
559
|
-
minLength: RUNNER_SECRET_MIN_LENGTH,
|
|
560
|
-
configFile
|
|
561
|
-
})
|
|
562
|
-
);
|
|
563
|
-
where = { kind: "runner", recipe, target: required.target, secrets: secrets.values };
|
|
564
|
-
}
|
|
565
|
-
const merged = settleRunResources(file, request.given);
|
|
566
|
-
if (!merged.ok) return merged;
|
|
567
|
-
const command = await planCommand(where, signal);
|
|
568
|
-
if (signal.aborted) return refused(canceledBeforeStart());
|
|
569
|
-
if (!command.ok) {
|
|
570
|
-
const secrets = [
|
|
571
|
-
...where.kind === "runner" ? Object.values(where.secrets) : [],
|
|
572
|
-
...lifecycles.secrets(merged.options)
|
|
573
|
-
];
|
|
574
|
-
return refused(secrets.length === 0 ? command.refusal : redactStrings(command.refusal, redactor(secrets)));
|
|
575
|
-
}
|
|
576
|
-
const run = Object.freeze({ testPlan: command.testPlan });
|
|
577
|
-
const resolved = merged.plan(run);
|
|
578
|
-
if (!resolved.ok) return resolved;
|
|
579
|
-
return {
|
|
580
|
-
ok: true,
|
|
581
|
-
configFile,
|
|
582
|
-
settings,
|
|
583
|
-
where,
|
|
584
|
-
argv: command.argv,
|
|
585
|
-
testPlan: command.testPlan,
|
|
586
|
-
resources: resolved.resources,
|
|
587
|
-
planOptions: resolved.planned.map(planOption)
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
function planOption({ path, value, source }) {
|
|
591
|
-
return { path, value, from: source };
|
|
592
|
-
}
|
|
593
|
-
async function resourcesBeforeRun(lifecycles, plan, request) {
|
|
594
|
-
const { configFile, resources, settings } = plan;
|
|
595
|
-
const used = await lifecycles.beforeRun(resources);
|
|
596
|
-
if (!used.ok) return refused(resourceRefusedBeforeRun(used.resource, used.refusal, configFile));
|
|
597
|
-
if (request.credential !== void 0 && !used.needsVercelCredential)
|
|
598
|
-
return refused(runErrors.credentialUnused({ flags: ["--credential"], configFile }));
|
|
599
|
-
let where;
|
|
600
|
-
if (plan.where.kind === "runner") where = plan.where;
|
|
601
|
-
else if (used.needsVercelCredential) {
|
|
602
|
-
const chosen = settleCredential(request.credential ?? "mint", settings.scope, settings.project);
|
|
603
|
-
if (!chosen.ok) return chosen;
|
|
604
|
-
where = { kind: "unsandboxed", credential: chosen.credential };
|
|
605
|
-
} else where = { kind: "unsandboxed", credential: void 0 };
|
|
606
|
-
return { ok: true, where, used };
|
|
607
|
-
}
|
|
608
|
-
function canceledBeforeStart() {
|
|
609
|
-
return outcomes.canceled({ changed: "The command didn't run.\nNothing was minted, acquired or started." });
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
// src/commands/exec/run-command.ts
|
|
613
|
-
import { z as z4 } from "zod";
|
|
614
|
-
|
|
615
|
-
// src/commands/exec/job-summary.ts
|
|
616
|
-
function jobSummaryMarkdown(timeline, extras) {
|
|
617
|
-
const lines = [`### storm ${extras.command}`, ""];
|
|
618
|
-
if (timeline.rows.length > 0) {
|
|
619
|
-
lines.push("| Lane | Start | Duration | Idle | Steps |", "| --- | ---: | ---: | ---: | --- |");
|
|
620
|
-
for (const row of timeline.rows) lines.push(tableRow(row));
|
|
621
|
-
lines.push("");
|
|
622
|
-
}
|
|
623
|
-
if (timeline.criticalPath.length > 0) {
|
|
624
|
-
const path = timeline.criticalPath.map((step) => criticalPathStep(step, timeline));
|
|
625
|
-
lines.push(`Critical path: ${path.join(" \u2192 ")}`, "");
|
|
626
|
-
}
|
|
627
|
-
for (const detail of extras.details ?? []) lines.push(`${detail.trim()} `);
|
|
628
|
-
if ((extras.details ?? []).length > 0) lines.push("");
|
|
629
|
-
if (extras.logs !== void 0) lines.push(`Run directory: \`${extras.logs}\``, "");
|
|
630
|
-
return lines.join("\n");
|
|
631
|
-
}
|
|
632
|
-
function tableRow(row) {
|
|
633
|
-
const outcome = row.outcome === "done" ? "" : ` (${row.outcome})`;
|
|
634
|
-
const steps = row.steps.map((step) => `${step.name} ${seconds(step.endMs - step.startMs)}`).join(" \xB7 ");
|
|
635
|
-
const idle = row.idleMs > 0 ? seconds(row.idleMs) : "";
|
|
636
|
-
return `| ${row.label}${outcome} | +${seconds(row.startMs)} | ${seconds(row.endMs - row.startMs)} | ${idle} | ${steps} |`;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
642
|
// src/commands/exec/progress.ts
|
|
640
643
|
function lineProgress(write, options = { github: false }) {
|
|
641
644
|
let failed = false;
|
|
@@ -664,7 +667,7 @@ function plainRenderer(options) {
|
|
|
664
667
|
cleanupStartedAt: void 0,
|
|
665
668
|
folded: false
|
|
666
669
|
};
|
|
667
|
-
const resources =
|
|
670
|
+
const resources = DEFINITION_SET.presentations.plain({ verbose: options.verbose === true });
|
|
668
671
|
return ({ event, at }) => {
|
|
669
672
|
const now = at.getTime();
|
|
670
673
|
state.origin ??= now;
|
|
@@ -678,9 +681,14 @@ function progressLine(elapsedMs, lane, text) {
|
|
|
678
681
|
return `[+${secondsText(secondsOf(elapsedMs))}] ${lane.padEnd(LANE_WIDTH)} ${text}`;
|
|
679
682
|
}
|
|
680
683
|
var LANE_WIDTH = Math.max(
|
|
681
|
-
...[
|
|
682
|
-
|
|
683
|
-
|
|
684
|
+
...[
|
|
685
|
+
"run",
|
|
686
|
+
"mint",
|
|
687
|
+
"runner",
|
|
688
|
+
"command",
|
|
689
|
+
"cleanup",
|
|
690
|
+
...DEFINITION_SET.presentations.laneKinds.map(({ lane }) => lane)
|
|
691
|
+
].map((lane) => lane.length)
|
|
684
692
|
);
|
|
685
693
|
function eventLines(event, now, state, line, options) {
|
|
686
694
|
const since = (start) => seconds(now - (start ?? now));
|
|
@@ -759,7 +767,7 @@ function eventLines(event, now, state, line, options) {
|
|
|
759
767
|
}
|
|
760
768
|
case "runner-prepared":
|
|
761
769
|
return [
|
|
762
|
-
line("runner", `base ${short(event.base)}, HEAD
|
|
770
|
+
line("runner", `merge-base ${short(event.base)}, of HEAD and ${event.baseRef}`),
|
|
763
771
|
...preparedNoteTexts(event).map((text) => line("runner", text))
|
|
764
772
|
];
|
|
765
773
|
// The command's own output carries its tests' results; the summary counts them.
|
|
@@ -777,12 +785,7 @@ function runnerLines(event, state, line, options) {
|
|
|
777
785
|
case "snapshot-reused":
|
|
778
786
|
return [line("runner", snapshotReusedText(event))];
|
|
779
787
|
case "snapshot-build-started":
|
|
780
|
-
return
|
|
781
|
-
line(
|
|
782
|
-
"runner",
|
|
783
|
-
`building a runner snapshot of base ${short(event.base)} (${event.reason === "rebuild" ? "--rebuild-snapshot" : "no cached runner snapshot fits"}); this takes a few minutes: ${event.summary}`
|
|
784
|
-
)
|
|
785
|
-
];
|
|
788
|
+
return snapshotBuildTexts(event).map((text) => line("runner", text));
|
|
786
789
|
case "runner-sandbox-starting":
|
|
787
790
|
return [];
|
|
788
791
|
case "sandbox-started":
|
|
@@ -812,7 +815,7 @@ function runnerLines(event, state, line, options) {
|
|
|
812
815
|
return [
|
|
813
816
|
line(
|
|
814
817
|
"runner",
|
|
815
|
-
`built
|
|
818
|
+
`built base snapshot ${event.snapshotId} at ${short(event.base)} in ${seconds(event.ms)} (${megabytesText(event.sizeBytes)})`
|
|
816
819
|
)
|
|
817
820
|
];
|
|
818
821
|
case "snapshot-entry-not-written":
|
|
@@ -841,26 +844,45 @@ function runnerLines(event, state, line, options) {
|
|
|
841
844
|
];
|
|
842
845
|
case "sandbox-kept":
|
|
843
846
|
return [line("cleanup", `kept the runner sandbox ${event.name} running until ${isoSecondsText(event.stopsAt)}`)];
|
|
844
|
-
// The cleanup line says the run saves a
|
|
845
|
-
case "
|
|
847
|
+
// The cleanup line says the run saves a dev snapshot.
|
|
848
|
+
case "dev-snapshot-saving":
|
|
846
849
|
return [];
|
|
847
|
-
case "
|
|
848
|
-
case "
|
|
849
|
-
return [line("cleanup",
|
|
850
|
-
case "
|
|
851
|
-
|
|
852
|
-
|
|
850
|
+
case "dev-snapshot-saved":
|
|
851
|
+
case "dev-snapshot-not-saved":
|
|
852
|
+
return [line("cleanup", devSnapshotSaveText(event))];
|
|
853
|
+
case "dev-snapshot-skipped":
|
|
854
|
+
return [line("cleanup", devSnapshotSkippedText(event))];
|
|
855
|
+
case "dev-snapshots-dropped":
|
|
856
|
+
case "dev-snapshots-not-dropped":
|
|
857
|
+
return [line("runner", devSnapshotsDropText(event))];
|
|
853
858
|
}
|
|
854
859
|
}
|
|
855
860
|
function snapshotReusedText(event) {
|
|
856
|
-
|
|
857
|
-
|
|
861
|
+
return `snapshot ${event.snapshotId}, ${builtAtText({ ...event.snapshot, atMergeBase: event.snapshot.builtAt === event.base })}`;
|
|
862
|
+
}
|
|
863
|
+
function snapshotBuildTexts(event) {
|
|
864
|
+
const building = `building a base snapshot at ${short(event.base)}`;
|
|
865
|
+
const tail = `this takes a few minutes: ${event.summary}`;
|
|
866
|
+
const { why } = event;
|
|
867
|
+
switch (why.kind) {
|
|
868
|
+
case "no-snapshot":
|
|
869
|
+
return [`${building} (${SNAPSHOT_BUILD_REASON_TEXT[why.kind]}); ${tail}`, ...rejectionLines(why.rejected)];
|
|
870
|
+
case "full":
|
|
871
|
+
case "base":
|
|
872
|
+
return [`${building} (${SNAPSHOT_BUILD_REASON_TEXT[why.kind]}); ${tail}`];
|
|
873
|
+
}
|
|
858
874
|
}
|
|
859
|
-
function
|
|
860
|
-
|
|
861
|
-
|
|
875
|
+
function devSnapshotSkippedText(event) {
|
|
876
|
+
return `no new dev snapshot: ${noSaveText(event.reason)}`;
|
|
877
|
+
}
|
|
878
|
+
function devSnapshotSaveText(event) {
|
|
879
|
+
if (event.kind === "dev-snapshot-saved") {
|
|
880
|
+
return `saved dev snapshot ${event.snapshotId} for ${headText(event.branch)} at ${short(event.head)} in ${seconds(event.ms)} (${megabytesText(event.sizeBytes)})`;
|
|
862
881
|
}
|
|
863
|
-
return `not saving a
|
|
882
|
+
return `not saving a dev snapshot: ${notSavedReason(event.save)}`;
|
|
883
|
+
}
|
|
884
|
+
function headText(branch) {
|
|
885
|
+
return branch ?? "a detached HEAD";
|
|
864
886
|
}
|
|
865
887
|
function notSavedReason(save) {
|
|
866
888
|
switch (save.kind) {
|
|
@@ -870,11 +892,16 @@ function notSavedReason(save) {
|
|
|
870
892
|
return "the run is stopping";
|
|
871
893
|
}
|
|
872
894
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
895
|
+
var SNAPSHOT_BUILD_REASON_TEXT = {
|
|
896
|
+
"no-snapshot": "no cached snapshot fits",
|
|
897
|
+
full: "--full",
|
|
898
|
+
base: "the cache has no base snapshot at that commit"
|
|
899
|
+
};
|
|
900
|
+
function devSnapshotsDropText(event) {
|
|
901
|
+
if (event.kind === "dev-snapshots-not-dropped")
|
|
902
|
+
return `couldn't drop a dev snapshot built on the replaced base snapshot from the cache: ${event.message}; a later run may start from it`;
|
|
876
903
|
const count = event.snapshotIds.length;
|
|
877
|
-
return `dropped ${count}
|
|
904
|
+
return `dropped ${count} dev ${count === 1 ? "snapshot" : "snapshots"} built on the replaced base snapshot from the cache: ${event.snapshotIds.join(", ")}`;
|
|
878
905
|
}
|
|
879
906
|
function releasingText(instances) {
|
|
880
907
|
const release = releaseText(
|
|
@@ -891,7 +918,7 @@ function closeFold(state) {
|
|
|
891
918
|
function cleanupText(sandbox, release) {
|
|
892
919
|
if (sandbox === null) return release === void 0 ? "nothing to release" : `${release}\u2026`;
|
|
893
920
|
if (sandbox.kind === "save")
|
|
894
|
-
return `saving a
|
|
921
|
+
return `saving a dev snapshot of ${headText(sandbox.branch)}${release === void 0 ? "" : ` while ${release}`}\u2026`;
|
|
895
922
|
const sandboxes = sandbox.ms > 0 ? `keeping the runner sandbox running ${keepTimeText(sandbox.ms)}` : "stopping and deleting the runner's sandboxes";
|
|
896
923
|
return `${sandboxes}${release === void 0 ? "" : `, then ${release}`}\u2026`;
|
|
897
924
|
}
|
|
@@ -905,18 +932,6 @@ function commandEnd(outcome) {
|
|
|
905
932
|
return "ended without an exit code";
|
|
906
933
|
}
|
|
907
934
|
}
|
|
908
|
-
function noteText(note) {
|
|
909
|
-
switch (note.kind) {
|
|
910
|
-
case "cache-unreadable":
|
|
911
|
-
return `couldn't read the runner snapshot cache at ${note.failure.path}: ${note.failure.message}; treating it as empty`;
|
|
912
|
-
case "expired-entry-not-removed":
|
|
913
|
-
return `couldn't remove the expired cache entry for runner snapshot ${note.entry.snapshotId} at ${note.failure.path}: ${note.failure.message}`;
|
|
914
|
-
case "candidate-steps-failed":
|
|
915
|
-
return `not reusing cached runner snapshots of base ${short(note.base)}: runner.${note.path.join(".")} ${note.problem.replace(/\.$/, "")}`;
|
|
916
|
-
case "candidate-check-failed":
|
|
917
|
-
return `not reusing cached runner snapshots of base ${short(note.base)}: ${note.failure.message.replace(/\.$/, "")}`;
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
935
|
function resourceWarningText(warning) {
|
|
921
936
|
return `warning: ${warning.message}`;
|
|
922
937
|
}
|
|
@@ -926,14 +941,52 @@ function skippedText(skipped) {
|
|
|
926
941
|
function preparedNoteTexts(prepared) {
|
|
927
942
|
return [
|
|
928
943
|
...prepared.nestedRepositories.length === 0 ? [] : [`leaving out untracked nested Git repositories: ${prepared.nestedRepositories.join(", ")}`],
|
|
929
|
-
...prepared.notes.map(
|
|
930
|
-
...prepared.saveSkipped ? ["not saving a branch snapshot: HEAD is detached"] : []
|
|
944
|
+
...prepared.notes.map(snapshotCacheNoteText)
|
|
931
945
|
];
|
|
932
946
|
}
|
|
933
947
|
function cacheWriteFailureText(failure) {
|
|
934
948
|
return `couldn't record the runner snapshot in the cache at ${failure.path}: ${failure.message}; later runs won't reuse it`;
|
|
935
949
|
}
|
|
936
950
|
|
|
951
|
+
// src/commands/exec/run-command.ts
|
|
952
|
+
import { z as z5 } from "zod";
|
|
953
|
+
|
|
954
|
+
// src/forward-sigterm.ts
|
|
955
|
+
function forwardSigterm(signal) {
|
|
956
|
+
const terminate = new AbortController();
|
|
957
|
+
const forward = () => {
|
|
958
|
+
const reason = signal.reason;
|
|
959
|
+
if (reason instanceof NodeSignalCancellation && reason.signal === "SIGTERM") terminate.abort(reason);
|
|
960
|
+
};
|
|
961
|
+
if (signal.aborted) forward();
|
|
962
|
+
else signal.addEventListener("abort", forward, { once: true });
|
|
963
|
+
return { terminate: terminate.signal, release: () => signal.removeEventListener("abort", forward) };
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
// src/commands/exec/job-summary.ts
|
|
967
|
+
function jobSummaryMarkdown(timeline, extras) {
|
|
968
|
+
const lines = [`### storm ${extras.command}`, ""];
|
|
969
|
+
if (timeline.rows.length > 0) {
|
|
970
|
+
lines.push("| Lane | Start | Duration | Idle | Steps |", "| --- | ---: | ---: | ---: | --- |");
|
|
971
|
+
for (const row of timeline.rows) lines.push(tableRow(row));
|
|
972
|
+
lines.push("");
|
|
973
|
+
}
|
|
974
|
+
if (timeline.criticalPath.length > 0) {
|
|
975
|
+
const path = timeline.criticalPath.map((step) => criticalPathStep(step, timeline));
|
|
976
|
+
lines.push(`Critical path: ${path.join(" \u2192 ")}`, "");
|
|
977
|
+
}
|
|
978
|
+
for (const detail of extras.details ?? []) lines.push(`${detail.trim()} `);
|
|
979
|
+
if ((extras.details ?? []).length > 0) lines.push("");
|
|
980
|
+
if (extras.logs !== void 0) lines.push(`Run directory: \`${extras.logs}\``, "");
|
|
981
|
+
return lines.join("\n");
|
|
982
|
+
}
|
|
983
|
+
function tableRow(row) {
|
|
984
|
+
const outcome = row.outcome === "done" ? "" : ` (${row.outcome})`;
|
|
985
|
+
const steps = row.steps.map((step) => `${step.name} ${seconds(step.endMs - step.startMs)}`).join(" \xB7 ");
|
|
986
|
+
const idle = row.idleMs > 0 ? seconds(row.idleMs) : "";
|
|
987
|
+
return `| ${row.label}${outcome} | +${seconds(row.startMs)} | ${seconds(row.endMs - row.startMs)} | ${idle} | ${steps} |`;
|
|
988
|
+
}
|
|
989
|
+
|
|
937
990
|
// src/commands/exec/live-view.ts
|
|
938
991
|
var SPINNER = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
939
992
|
var INDENT = " ".repeat(LANE_WIDTH + 5);
|
|
@@ -949,10 +1002,10 @@ function activePhase(state) {
|
|
|
949
1002
|
return void 0;
|
|
950
1003
|
}
|
|
951
1004
|
function instanceLanes(state) {
|
|
952
|
-
return
|
|
1005
|
+
return DEFINITION_SET.presentations.lanes(state.instances ?? []);
|
|
953
1006
|
}
|
|
954
1007
|
function startedLanes(state) {
|
|
955
|
-
return
|
|
1008
|
+
return DEFINITION_SET.presentations.lanes(
|
|
956
1009
|
Object.entries(state.resources).map(([resource, { definition }]) => ({ resource, definition }))
|
|
957
1010
|
);
|
|
958
1011
|
}
|
|
@@ -960,7 +1013,7 @@ function headerLine(state, paint2) {
|
|
|
960
1013
|
const version = state.version === void 0 ? "" : versionText(state.version.version, state.version.commit);
|
|
961
1014
|
const header = [
|
|
962
1015
|
`storm ${version}`.trimEnd(),
|
|
963
|
-
...state.base === void 0 ? [] : [`base ${short(state.base.sha)} (
|
|
1016
|
+
...state.base === void 0 ? [] : [`merge-base ${short(state.base.sha)} (with ${state.base.ref})`]
|
|
964
1017
|
].join(" \xB7 ");
|
|
965
1018
|
return paint2.strong(header);
|
|
966
1019
|
}
|
|
@@ -1054,7 +1107,8 @@ function lanesFrame(state, view) {
|
|
|
1054
1107
|
].filter((part) => part !== "").join(" ");
|
|
1055
1108
|
const crumbs = stepsText(
|
|
1056
1109
|
runner.steps.filter((step) => step !== current),
|
|
1057
|
-
view
|
|
1110
|
+
view,
|
|
1111
|
+
void 0
|
|
1058
1112
|
);
|
|
1059
1113
|
const runnerText = stopping(runner.status) ? `stopping \xB7 ${currentText}` : currentText;
|
|
1060
1114
|
const runnerRow = view.row(
|
|
@@ -1096,7 +1150,7 @@ function lanesRecord(state, view) {
|
|
|
1096
1150
|
elapsed(view, runner.startedAt, runner.endedAt)
|
|
1097
1151
|
)
|
|
1098
1152
|
);
|
|
1099
|
-
const steps = stepsText(runner.steps, view);
|
|
1153
|
+
const steps = stepsText(runner.steps, view, runner.uploadBytes);
|
|
1100
1154
|
if (steps !== "") lines.push(view.line(`${INDENT}${steps}`));
|
|
1101
1155
|
}
|
|
1102
1156
|
return lines;
|
|
@@ -1105,8 +1159,11 @@ function runnerGlyph(runner, view) {
|
|
|
1105
1159
|
return view.glyph(runner.steps.some(({ status }) => status === "failed") ? "failed" : runner.status);
|
|
1106
1160
|
}
|
|
1107
1161
|
function snapshotText(step, runner) {
|
|
1108
|
-
if (runner.snapshot?.kind === "
|
|
1109
|
-
|
|
1162
|
+
if (runner.snapshot?.kind === "built") return "snapshot built";
|
|
1163
|
+
if (runner.snapshot?.kind === "reused") {
|
|
1164
|
+
const { snapshot, base } = runner.snapshot;
|
|
1165
|
+
return `snapshot ${builtAtText({ ...snapshot, atMergeBase: snapshot.builtAt === base })}`;
|
|
1166
|
+
}
|
|
1110
1167
|
return `snapshot build ${step.status === "running" ? "stopped" : step.status}`;
|
|
1111
1168
|
}
|
|
1112
1169
|
function stepLabel(step, runner) {
|
|
@@ -1136,12 +1193,13 @@ function activityText(runner) {
|
|
|
1136
1193
|
}
|
|
1137
1194
|
}
|
|
1138
1195
|
var WAITING_FOR_SNAPSHOT = "waiting for the runner snapshot still saving";
|
|
1139
|
-
function stepsText(steps, view) {
|
|
1196
|
+
function stepsText(steps, view, uploadBytes) {
|
|
1140
1197
|
return steps.filter(
|
|
1141
1198
|
(step) => step.status !== "pending" && step.status !== "running" && step.startedAt !== void 0 && step.endedAt !== void 0 && (step.endedAt > step.startedAt || step.status !== "done")
|
|
1142
1199
|
).map((step) => {
|
|
1143
1200
|
const mark = step.status === "done" ? "" : ` ${view.glyph(step.status)}`;
|
|
1144
|
-
|
|
1201
|
+
const size = step.name === "upload" && uploadBytes !== void 0 ? ` (${megabytesText(uploadBytes)})` : "";
|
|
1202
|
+
return `${step.name} ${seconds((step.endedAt ?? 0) - (step.startedAt ?? 0))}${size}${mark}`;
|
|
1145
1203
|
}).join(" \xB7 ");
|
|
1146
1204
|
}
|
|
1147
1205
|
function unsandboxedResourcesFrame(state, view) {
|
|
@@ -1195,20 +1253,33 @@ function testsLine(state, command, view, live) {
|
|
|
1195
1253
|
}
|
|
1196
1254
|
function testsProgress(tests, view, room) {
|
|
1197
1255
|
const { paint: paint2, now } = view;
|
|
1198
|
-
const running = tests.workers.filter((worker) => worker.file !== void 0 || worker.
|
|
1199
|
-
const waiting = tests.workers.
|
|
1256
|
+
const running = tests.workers.filter((worker) => worker.file !== void 0 || worker.settingUp.length > 0);
|
|
1257
|
+
const waiting = waitingText(tests.workers.map(({ settingUp }) => settingUp));
|
|
1200
1258
|
const longest = [...running].toSorted((a, b) => (a.fileStartedAt ?? 0) - (b.fileStartedAt ?? 0))[0];
|
|
1201
1259
|
const longestMs = longest?.fileStartedAt === void 0 || now === void 0 ? void 0 : now - longest.fileStartedAt;
|
|
1202
1260
|
const text = (showWaiting) => [
|
|
1203
1261
|
`${tests.passed} passed`,
|
|
1204
1262
|
...tests.failed === 0 ? [] : [paint2.failed(`${tests.failed} failed`)],
|
|
1205
1263
|
`${tests.filesDone} ${tests.filesDone === 1 ? "file" : "files"} done`,
|
|
1206
|
-
`${running.length} running${waiting === 0 || !showWaiting ? "" : ` (${waiting}
|
|
1264
|
+
`${running.length} running${waiting === void 0 || !showWaiting ? "" : ` (${waiting})`}`,
|
|
1207
1265
|
...longest?.file === void 0 || longestMs === void 0 || longestMs < LONG_FILE_MS ? [] : [`longest: ${shortFile(longest.file)} ${seconds(longestMs)}`]
|
|
1208
1266
|
].join(" \xB7 ");
|
|
1209
1267
|
const full = text(true);
|
|
1210
1268
|
return visibleLength(full) <= room ? full : text(false);
|
|
1211
1269
|
}
|
|
1270
|
+
function waitingText(waiting) {
|
|
1271
|
+
const words = setupPhaseWords(waiting.flat());
|
|
1272
|
+
const counts = /* @__PURE__ */ new Map();
|
|
1273
|
+
for (const phases of waiting)
|
|
1274
|
+
for (const phase of phases) {
|
|
1275
|
+
const key = setupPhaseKey(phase);
|
|
1276
|
+
const group = counts.get(key) ?? { text: words(phase), count: 0 };
|
|
1277
|
+
counts.set(key, group);
|
|
1278
|
+
group.count += 1;
|
|
1279
|
+
}
|
|
1280
|
+
if (counts.size === 0) return void 0;
|
|
1281
|
+
return [...counts.values()].map(({ text, count }) => `${count} waiting on ${withArticle(text)}`).join(", ");
|
|
1282
|
+
}
|
|
1212
1283
|
function cleanupLine(cleanup, runner, view, record) {
|
|
1213
1284
|
const done = record || cleanup.status !== "running";
|
|
1214
1285
|
const release = releaseText(cleanup.resources, done);
|
|
@@ -1230,8 +1301,8 @@ function runnerSandboxText(sandbox, runner, done) {
|
|
|
1230
1301
|
return !done && sandbox.ms > 0 ? `keeping the runner sandbox running ${keepTimeText(sandbox.ms)}` : removed;
|
|
1231
1302
|
case "save": {
|
|
1232
1303
|
const save = runner?.save;
|
|
1233
|
-
if (save?.kind === "saved") return `saved
|
|
1234
|
-
return !done && save?.kind !== "not-saved" ? `saving a
|
|
1304
|
+
if (save?.kind === "saved") return `saved dev snapshot ${save.id} of ${headText(save.branch)}`;
|
|
1305
|
+
return !done && save?.kind !== "not-saved" ? `saving a dev snapshot of ${headText(sandbox.branch)}` : removed;
|
|
1235
1306
|
}
|
|
1236
1307
|
}
|
|
1237
1308
|
}
|
|
@@ -1318,7 +1389,7 @@ function liveView(context, colors, options) {
|
|
|
1318
1389
|
observer: {
|
|
1319
1390
|
observe: async (timed) => {
|
|
1320
1391
|
if (finished) return;
|
|
1321
|
-
state =
|
|
1392
|
+
state = DEFINITION_SET.applyEvent(state, timed);
|
|
1322
1393
|
const next = activePhase(state);
|
|
1323
1394
|
if (next !== phase) {
|
|
1324
1395
|
print([
|
|
@@ -1363,7 +1434,7 @@ function noticeLines(timed, origin, verbose) {
|
|
|
1363
1434
|
case "runner":
|
|
1364
1435
|
return runnerNoticeLines(event.event, line);
|
|
1365
1436
|
case "resource":
|
|
1366
|
-
return
|
|
1437
|
+
return DEFINITION_SET.presentations.notices(event, { verbose }).map(({ lane, text }) => line(lane, text));
|
|
1367
1438
|
// A line a resource instance reported prints as it is, in its lane, and a warning marked as one.
|
|
1368
1439
|
case "resource-notice":
|
|
1369
1440
|
return [line(event.lane, event.text)];
|
|
@@ -1394,15 +1465,19 @@ function runnerNoticeLines(event, line) {
|
|
|
1394
1465
|
switch (event.kind) {
|
|
1395
1466
|
case "snapshot-entry-not-written":
|
|
1396
1467
|
return [line("runner", cacheWriteFailureText(event.failure))];
|
|
1397
|
-
case "
|
|
1398
|
-
case "
|
|
1399
|
-
return [line("runner",
|
|
1400
|
-
case "
|
|
1401
|
-
case "
|
|
1402
|
-
return [line("cleanup",
|
|
1468
|
+
case "dev-snapshots-dropped":
|
|
1469
|
+
case "dev-snapshots-not-dropped":
|
|
1470
|
+
return [line("runner", devSnapshotsDropText(event))];
|
|
1471
|
+
case "dev-snapshot-saved":
|
|
1472
|
+
case "dev-snapshot-not-saved":
|
|
1473
|
+
return [line("cleanup", devSnapshotSaveText(event))];
|
|
1474
|
+
case "dev-snapshot-skipped":
|
|
1475
|
+
return [line("cleanup", devSnapshotSkippedText(event))];
|
|
1476
|
+
// The runner row shows the build; its reasons, when a cached snapshot didn't fit, are lines of their own.
|
|
1477
|
+
case "snapshot-build-started":
|
|
1478
|
+
return event.why.kind === "no-snapshot" && event.why.rejected.length > 0 ? snapshotBuildTexts(event).map((text) => line("runner", text)) : [];
|
|
1403
1479
|
// The live view's phases show the rest.
|
|
1404
1480
|
case "snapshot-reused":
|
|
1405
|
-
case "snapshot-build-started":
|
|
1406
1481
|
case "runner-sandbox-starting":
|
|
1407
1482
|
case "sandbox-started":
|
|
1408
1483
|
case "output-started":
|
|
@@ -1419,82 +1494,99 @@ function runnerNoticeLines(event, line) {
|
|
|
1419
1494
|
case "stopping":
|
|
1420
1495
|
case "waiting-for-snapshot":
|
|
1421
1496
|
case "sandbox-kept":
|
|
1422
|
-
case "
|
|
1497
|
+
case "dev-snapshot-saving":
|
|
1423
1498
|
return [];
|
|
1424
1499
|
}
|
|
1425
1500
|
}
|
|
1426
1501
|
|
|
1427
|
-
// src/commands/exec/run
|
|
1428
|
-
function
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
let
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1502
|
+
// src/commands/exec/plan-run.ts
|
|
1503
|
+
async function planRun(app, lifecycles, request, planCommand, signal) {
|
|
1504
|
+
const file = await loadSettingsFile(app.context.config, app.cwd, RESOURCES);
|
|
1505
|
+
if (!file.ok) return file;
|
|
1506
|
+
const configFile = file.path;
|
|
1507
|
+
const settings = fileSettings(file, request);
|
|
1508
|
+
let where;
|
|
1509
|
+
if (request.unsandboxed) where = { kind: "unsandboxed" };
|
|
1510
|
+
else {
|
|
1511
|
+
if (settings.runner === void 0) return refused(runErrors.missingRunner({ configFile }));
|
|
1512
|
+
const required = requireTarget(settings.scope, settings.project);
|
|
1513
|
+
if (!required.ok) return required;
|
|
1514
|
+
const recipe = settings.runner.value;
|
|
1515
|
+
const secrets = readRunnerSecrets(recipe, app.env);
|
|
1516
|
+
if (!secrets.ok)
|
|
1517
|
+
return refused(
|
|
1518
|
+
runErrors.runnerSecretsInvalid({
|
|
1519
|
+
variables: secrets.variables.map(({ name, problem }) => ({ name, problem })),
|
|
1520
|
+
minLength: RUNNER_SECRET_MIN_LENGTH,
|
|
1521
|
+
configFile
|
|
1522
|
+
})
|
|
1523
|
+
);
|
|
1524
|
+
where = { kind: "runner", recipe, target: required.target, secrets: secrets.values };
|
|
1525
|
+
}
|
|
1526
|
+
const merged = settleRunResources(file, request.given);
|
|
1527
|
+
if (!merged.ok) return merged;
|
|
1528
|
+
const command = await planCommand(where, signal);
|
|
1529
|
+
if (signal.aborted) return refused(canceledBeforeStart());
|
|
1530
|
+
if (!command.ok) {
|
|
1531
|
+
const secrets = [
|
|
1532
|
+
...where.kind === "runner" ? Object.values(where.secrets) : [],
|
|
1533
|
+
...lifecycles.secrets(merged.options)
|
|
1534
|
+
];
|
|
1535
|
+
return refused(secrets.length === 0 ? command.refusal : redactStrings(command.refusal, redactor(secrets)));
|
|
1536
|
+
}
|
|
1537
|
+
const run = Object.freeze({ testPlan: command.testPlan });
|
|
1538
|
+
const resolved = merged.plan(run);
|
|
1539
|
+
if (!resolved.ok) return resolved;
|
|
1438
1540
|
return {
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
workerOffsetMs = Math.min(workerOffsetMs, timed.at.getTime() - event.event.at);
|
|
1448
|
-
} else if (event.kind === "test-event-unreadable") unreadable += 1;
|
|
1449
|
-
else if (event.kind === "test-events-incomplete") incomplete ??= event.message;
|
|
1450
|
-
}
|
|
1451
|
-
},
|
|
1452
|
-
readStaged: async (runDirectory, redact) => {
|
|
1453
|
-
const read = await runDirectory.readTestEvents((line) => {
|
|
1454
|
-
const event = parseTestEvent(line);
|
|
1455
|
-
if (event === void 0) unreadable += 1;
|
|
1456
|
-
else collect(redactStrings(event, redact));
|
|
1457
|
-
});
|
|
1458
|
-
if (!read.ok) incomplete ??= read.failure.message;
|
|
1459
|
-
},
|
|
1460
|
-
finish: () => ({
|
|
1461
|
-
state,
|
|
1462
|
-
tests: { events, unreadable, incomplete },
|
|
1463
|
-
workerOffsetMs: workerOffsetMs === Infinity ? 0 : workerOffsetMs
|
|
1464
|
-
})
|
|
1541
|
+
ok: true,
|
|
1542
|
+
configFile,
|
|
1543
|
+
settings,
|
|
1544
|
+
where,
|
|
1545
|
+
argv: command.argv,
|
|
1546
|
+
testPlan: command.testPlan,
|
|
1547
|
+
resources: resolved.resources,
|
|
1548
|
+
planOptions: resolved.planned.map(planOption)
|
|
1465
1549
|
};
|
|
1466
1550
|
}
|
|
1467
|
-
function
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1551
|
+
function planOption({ path, value, source }) {
|
|
1552
|
+
return { path, value, from: source };
|
|
1553
|
+
}
|
|
1554
|
+
async function resourcesBeforeRun(lifecycles, plan, request) {
|
|
1555
|
+
const { configFile, resources, settings } = plan;
|
|
1556
|
+
const used = await lifecycles.beforeRun(resources);
|
|
1557
|
+
if (!used.ok) return refused(resourceRefusedBeforeRun(used.resource, used.refusal, configFile));
|
|
1558
|
+
if (request.credential !== void 0 && !used.needsVercelCredential)
|
|
1559
|
+
return refused(runErrors.credentialUnused({ flags: ["--credential"], configFile }));
|
|
1560
|
+
let where;
|
|
1561
|
+
if (plan.where.kind === "runner") where = plan.where;
|
|
1562
|
+
else if (used.needsVercelCredential) {
|
|
1563
|
+
const chosen = settleCredential(request.credential ?? "mint", settings.scope, settings.project);
|
|
1564
|
+
if (!chosen.ok) return chosen;
|
|
1565
|
+
where = { kind: "unsandboxed", credential: chosen.credential };
|
|
1566
|
+
} else where = { kind: "unsandboxed", credential: void 0 };
|
|
1567
|
+
return { ok: true, where, used };
|
|
1568
|
+
}
|
|
1569
|
+
function canceledBeforeStart() {
|
|
1570
|
+
return outcomes.canceled({ changed: "The command didn't run.\nNothing was minted, acquired or started." });
|
|
1479
1571
|
}
|
|
1480
1572
|
|
|
1481
1573
|
// src/commands/exec/run-command.ts
|
|
1482
1574
|
var OWN_RUN_FIELDS = {
|
|
1483
|
-
scope:
|
|
1484
|
-
project:
|
|
1485
|
-
credential:
|
|
1486
|
-
unsandboxed:
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
showOutput:
|
|
1490
|
-
keepSandbox:
|
|
1491
|
-
verbose:
|
|
1575
|
+
scope: z5.string().min(1).optional(),
|
|
1576
|
+
project: z5.string().min(1).optional(),
|
|
1577
|
+
credential: z5.enum(["mint", "github-actions"]).optional(),
|
|
1578
|
+
unsandboxed: z5.boolean().default(false),
|
|
1579
|
+
saveDevSnapshot: z5.boolean().optional(),
|
|
1580
|
+
noReuseDevSnapshot: z5.boolean().default(false),
|
|
1581
|
+
showOutput: z5.boolean().default(false),
|
|
1582
|
+
keepSandbox: z5.string().optional(),
|
|
1583
|
+
verbose: z5.boolean().default(false)
|
|
1492
1584
|
};
|
|
1493
1585
|
var RUN_REQUEST_FIELDS = { ...OWN_RUN_FIELDS, ...resourceFlagFields(Object.keys(OWN_RUN_FIELDS)) };
|
|
1494
1586
|
var RUN_CLI_OPTIONS = { project: { short: "p" } };
|
|
1495
|
-
var runRequestSchema =
|
|
1587
|
+
var runRequestSchema = z5.object(RUN_REQUEST_FIELDS);
|
|
1496
1588
|
async function runCommand({ app, ui, signal }, request, spec) {
|
|
1497
|
-
const lifecycles =
|
|
1589
|
+
const lifecycles = DEFINITION_SET.lifecycles(app.resourceContexts);
|
|
1498
1590
|
const planned = await planRun(
|
|
1499
1591
|
app,
|
|
1500
1592
|
lifecycles,
|
|
@@ -1525,13 +1617,7 @@ async function runCommand({ app, ui, signal }, request, spec) {
|
|
|
1525
1617
|
const { run } = requested;
|
|
1526
1618
|
const secrets = [...used.secrets, ...Object.values(run.runner?.secrets ?? {})];
|
|
1527
1619
|
const redact = redactor(secrets);
|
|
1528
|
-
const
|
|
1529
|
-
const forward = () => {
|
|
1530
|
-
const reason = signal.reason;
|
|
1531
|
-
if (reason instanceof NodeSignalCancellation && reason.signal === "SIGTERM") terminate.abort(reason);
|
|
1532
|
-
};
|
|
1533
|
-
if (signal.aborted) forward();
|
|
1534
|
-
else signal.addEventListener("abort", forward, { once: true });
|
|
1620
|
+
const sigterm = forwardSigterm(signal);
|
|
1535
1621
|
const view = runView({
|
|
1536
1622
|
presentation: app.presentation,
|
|
1537
1623
|
progress: ui.progress,
|
|
@@ -1540,57 +1626,37 @@ async function runCommand({ app, ui, signal }, request, spec) {
|
|
|
1540
1626
|
verbose: request.verbose
|
|
1541
1627
|
});
|
|
1542
1628
|
const git = await checkoutGit(app.context.checkout, app.cwd);
|
|
1543
|
-
const
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
git
|
|
1554
|
-
},
|
|
1555
|
-
redact
|
|
1556
|
-
);
|
|
1557
|
-
const opened = await app.context.runDirectories.open({
|
|
1558
|
-
startedAt,
|
|
1559
|
-
keep: RUN_DIRECTORIES_KEPT,
|
|
1560
|
-
run: runRecordText(record)
|
|
1629
|
+
const recording = await recordRun(app.context.runDirectories, {
|
|
1630
|
+
definitionSet: DEFINITION_SET,
|
|
1631
|
+
startedAt: app.context.clock.now(),
|
|
1632
|
+
cwd: app.cwd,
|
|
1633
|
+
configFile,
|
|
1634
|
+
argv,
|
|
1635
|
+
plan,
|
|
1636
|
+
run,
|
|
1637
|
+
git,
|
|
1638
|
+
redact: (value) => redactStrings(value, redact)
|
|
1561
1639
|
});
|
|
1562
|
-
const
|
|
1563
|
-
const
|
|
1564
|
-
const observers = [collector.observer, view.observer];
|
|
1565
|
-
if (directory !== void 0) observers.push(runDirectoryObserver(directory));
|
|
1566
|
-
const observer = observeAll(...observers);
|
|
1567
|
-
const terminal = teeTerminal(view.runnerTerminal, directory);
|
|
1640
|
+
const observer = recording.observer(view.observer);
|
|
1641
|
+
const terminal = recording.terminal(view.runnerTerminal);
|
|
1568
1642
|
let outcome;
|
|
1569
1643
|
try {
|
|
1570
1644
|
const ended = await executeRun(
|
|
1571
|
-
|
|
1645
|
+
DEFINITION_SET,
|
|
1572
1646
|
{ ...app.context, runnerTerminal: secrets.length === 0 ? terminal : redactingTerminal(terminal, redact) },
|
|
1573
|
-
app.
|
|
1574
|
-
run.runner === void 0 &&
|
|
1575
|
-
{ signal, terminate: terminate
|
|
1647
|
+
app.resourceContexts,
|
|
1648
|
+
run.runner === void 0 && recording.testEvents !== void 0 ? { ...run, testEvents: recording.testEvents } : run,
|
|
1649
|
+
{ signal, terminate: sigterm.terminate },
|
|
1576
1650
|
timedProgress(app.context.clock, secrets.length === 0 ? observer : redactingObserver(observer, redact))
|
|
1577
1651
|
);
|
|
1578
1652
|
outcome = secrets.length === 0 ? ended : redactStrings(ended, redact);
|
|
1579
1653
|
} catch (error) {
|
|
1580
1654
|
await view.finish([]);
|
|
1581
|
-
await
|
|
1655
|
+
await recording.abandon();
|
|
1582
1656
|
throw error;
|
|
1583
1657
|
}
|
|
1584
|
-
|
|
1585
|
-
const ran = await summarize(app, {
|
|
1586
|
-
command: spec.name,
|
|
1587
|
-
view,
|
|
1588
|
-
collector,
|
|
1589
|
-
opened,
|
|
1590
|
-
redact,
|
|
1591
|
-
record,
|
|
1592
|
-
outcome
|
|
1593
|
-
});
|
|
1658
|
+
sigterm.release();
|
|
1659
|
+
const ran = await summarize(app, { command: spec.name, hints: spec.hints, view, recording, outcome });
|
|
1594
1660
|
switch (outcome.kind) {
|
|
1595
1661
|
case "ran": {
|
|
1596
1662
|
app.exit.status = commandExitStatus(outcome.command);
|
|
@@ -1600,7 +1666,7 @@ async function runCommand({ app, ui, signal }, request, spec) {
|
|
|
1600
1666
|
version: app.version,
|
|
1601
1667
|
commit: app.commit,
|
|
1602
1668
|
configFile,
|
|
1603
|
-
resources:
|
|
1669
|
+
resources: DEFINITION_SET.reports.ranFacts(outcome.resources),
|
|
1604
1670
|
cleanup: RUN_CLEANUP.facts(outcome),
|
|
1605
1671
|
command: command.kind === "exited" ? { exitCode: command.code, signal: null } : command.kind === "signaled" ? { exitCode: null, signal: command.signal } : { exitCode: null, signal: null },
|
|
1606
1672
|
runner: outcome.runner === void 0 ? null : {
|
|
@@ -1608,31 +1674,36 @@ async function runCommand({ app, ui, signal }, request, spec) {
|
|
|
1608
1674
|
base: outcome.runner.base,
|
|
1609
1675
|
snapshotBranch: outcome.runner.snapshotBranch,
|
|
1610
1676
|
snapshotHead: outcome.runner.snapshotHead,
|
|
1677
|
+
snapshotKind: outcome.runner.snapshot.kind,
|
|
1678
|
+
snapshotBuiltAt: outcome.runner.snapshot.builtAt,
|
|
1679
|
+
builtBehind: outcome.runner.snapshot.builtBehind,
|
|
1680
|
+
uploadBytes: outcome.runner.uploadBytes,
|
|
1611
1681
|
built: outcome.runner.built,
|
|
1612
1682
|
vcpus: outcome.runner.vcpus,
|
|
1613
1683
|
region: outcome.runner.region,
|
|
1614
1684
|
runtime: outcome.runner.runtime,
|
|
1615
1685
|
buildMs: outcome.runner.buildMs,
|
|
1616
|
-
save: outcome.runner.save
|
|
1686
|
+
save: outcome.runner.save,
|
|
1687
|
+
noSaveReason: outcome.runner.noSave
|
|
1617
1688
|
},
|
|
1618
1689
|
timeline: ran,
|
|
1619
|
-
runId:
|
|
1690
|
+
runId: recording.opened.ok ? recording.opened.id : null
|
|
1620
1691
|
},
|
|
1621
1692
|
{ testPlan, options: planOptions }
|
|
1622
1693
|
);
|
|
1623
1694
|
}
|
|
1624
|
-
case "
|
|
1695
|
+
case "resource_refused":
|
|
1625
1696
|
return resourceRefused(outcome, RUN_CLEANUP.facts(outcome));
|
|
1626
1697
|
// The run's mint: in a sandboxed run for the runner sandbox, in an unsandboxed run for a resource that needed it:
|
|
1627
1698
|
// its `acquireForRun` answered `mintFailed`, which the launcher owns.
|
|
1628
|
-
case "
|
|
1699
|
+
case "mint_failed":
|
|
1629
1700
|
return mintFailedErrors.mintFailed({
|
|
1630
1701
|
...outcome.target,
|
|
1631
1702
|
...describeMintFailure(outcome.failure, outcome.target),
|
|
1632
1703
|
runner: outcome.runner,
|
|
1633
1704
|
cleanup: RUN_CLEANUP.facts(outcome)
|
|
1634
1705
|
});
|
|
1635
|
-
case "
|
|
1706
|
+
case "spawn_failed":
|
|
1636
1707
|
return runErrors.spawnFailed({
|
|
1637
1708
|
executable: outcome.executable,
|
|
1638
1709
|
message: outcome.message,
|
|
@@ -1641,12 +1712,12 @@ async function runCommand({ app, ui, signal }, request, spec) {
|
|
|
1641
1712
|
});
|
|
1642
1713
|
case "canceled":
|
|
1643
1714
|
return outcomes.canceled({ changed: canceledChanges(outcome) });
|
|
1644
|
-
case "
|
|
1715
|
+
case "runner_failed":
|
|
1645
1716
|
return runErrors.runnerFailed({
|
|
1646
1717
|
failure: runnerFailureFacts(outcome.failure),
|
|
1647
1718
|
cleanup: RUN_CLEANUP.facts(outcome)
|
|
1648
1719
|
});
|
|
1649
|
-
case "
|
|
1720
|
+
case "snapshot_gone":
|
|
1650
1721
|
return runErrors.snapshotGone({
|
|
1651
1722
|
snapshotId: outcome.entry.snapshotId,
|
|
1652
1723
|
base: outcome.entry.base,
|
|
@@ -1656,15 +1727,9 @@ async function runCommand({ app, ui, signal }, request, spec) {
|
|
|
1656
1727
|
}
|
|
1657
1728
|
}
|
|
1658
1729
|
function runProblems(request) {
|
|
1659
|
-
const { credential, unsandboxed,
|
|
1730
|
+
const { credential, unsandboxed, saveDevSnapshot, showOutput, keepSandbox } = request;
|
|
1660
1731
|
return [
|
|
1661
1732
|
...resourceFlagProblems(request),
|
|
1662
|
-
...rebuildSnapshot && unsandboxed ? [
|
|
1663
|
-
{
|
|
1664
|
-
field: "rebuildSnapshot",
|
|
1665
|
-
message: "--rebuild-snapshot builds a runner snapshot; drop it or --unsandboxed."
|
|
1666
|
-
}
|
|
1667
|
-
] : [],
|
|
1668
1733
|
...!unsandboxed && credential === "github-actions" ? [
|
|
1669
1734
|
{
|
|
1670
1735
|
field: "credential",
|
|
@@ -1689,16 +1754,16 @@ function runProblems(request) {
|
|
|
1689
1754
|
message: "--keep-sandbox keeps a sandboxed run's runner sandbox; drop it or --unsandboxed."
|
|
1690
1755
|
}
|
|
1691
1756
|
] : [],
|
|
1692
|
-
...
|
|
1757
|
+
...saveDevSnapshot === true && unsandboxed ? [
|
|
1693
1758
|
{
|
|
1694
|
-
field: "
|
|
1695
|
-
message: "--save-snapshot saves a sandboxed run's runner sandbox; drop it or --unsandboxed."
|
|
1759
|
+
field: "saveDevSnapshot",
|
|
1760
|
+
message: "--save-dev-snapshot saves a sandboxed run's runner sandbox; drop it or --unsandboxed."
|
|
1696
1761
|
}
|
|
1697
1762
|
] : [],
|
|
1698
|
-
...
|
|
1763
|
+
...saveDevSnapshot === true && keepsSandbox(keepSandbox) ? [
|
|
1699
1764
|
{
|
|
1700
|
-
field: "
|
|
1701
|
-
message: "--save-snapshot saves the runner sandbox instead of keeping it; drop --keep-sandbox or set it to 0."
|
|
1765
|
+
field: "saveDevSnapshot",
|
|
1766
|
+
message: "--save-dev-snapshot saves the runner sandbox instead of keeping it; drop --keep-sandbox or set it to 0."
|
|
1702
1767
|
}
|
|
1703
1768
|
] : []
|
|
1704
1769
|
];
|
|
@@ -1714,13 +1779,17 @@ async function runRequestFor(app, options) {
|
|
|
1714
1779
|
};
|
|
1715
1780
|
return { ok: true, run: run2 };
|
|
1716
1781
|
}
|
|
1782
|
+
if (request.saveDevSnapshot && !devSnapshotsTrusted(where.recipe))
|
|
1783
|
+
return {
|
|
1784
|
+
ok: false,
|
|
1785
|
+
refusal: runErrors.devSnapshotsNotTrusted({ flag: "--save-dev-snapshot", configFile })
|
|
1786
|
+
};
|
|
1717
1787
|
const prepared = await prepareRunner(app.context, {
|
|
1718
1788
|
cwd: app.cwd,
|
|
1719
1789
|
recipe: where.recipe,
|
|
1720
1790
|
// The recipe's `vcpus` reads each of the run's resources by its definition: one its `beforeRun` skipped isn't.
|
|
1721
1791
|
vcpusRun: recipeRun(recipeResources(used.requests)),
|
|
1722
|
-
|
|
1723
|
-
saveSnapshot: request.saveSnapshot
|
|
1792
|
+
reuseDevSnapshots: !request.noReuseDevSnapshot && where.recipe.reuseDevSnapshot
|
|
1724
1793
|
});
|
|
1725
1794
|
if (prepared.kind !== "ok") {
|
|
1726
1795
|
const refusal = prepareRefusal(prepared, configFile);
|
|
@@ -1730,7 +1799,7 @@ async function runRequestFor(app, options) {
|
|
|
1730
1799
|
refusal: secrets.length === 0 ? refusal : redactStrings(refusal, redactor(secrets))
|
|
1731
1800
|
};
|
|
1732
1801
|
}
|
|
1733
|
-
const
|
|
1802
|
+
const keepMs = keepSandboxMinutes(request.keepSandbox, where.recipe, app.env) * 6e4;
|
|
1734
1803
|
const run = {
|
|
1735
1804
|
...base,
|
|
1736
1805
|
resources: used.requests,
|
|
@@ -1740,7 +1809,8 @@ async function runRequestFor(app, options) {
|
|
|
1740
1809
|
target: where.target,
|
|
1741
1810
|
user: app.user,
|
|
1742
1811
|
secrets: where.secrets,
|
|
1743
|
-
|
|
1812
|
+
save: saveMode(request, where.recipe, app.env),
|
|
1813
|
+
keepMs
|
|
1744
1814
|
}
|
|
1745
1815
|
};
|
|
1746
1816
|
return { ok: true, run };
|
|
@@ -1766,36 +1836,19 @@ function checkoutFailedRefusal(failure) {
|
|
|
1766
1836
|
});
|
|
1767
1837
|
}
|
|
1768
1838
|
async function summarize(app, run) {
|
|
1769
|
-
const { view,
|
|
1770
|
-
const
|
|
1771
|
-
|
|
1772
|
-
const
|
|
1773
|
-
const { state, tests } = collected;
|
|
1774
|
-
const ran = stormTimeline(state);
|
|
1775
|
-
const timeline = timelineFacts(ran);
|
|
1776
|
-
directory?.publishTestEvents();
|
|
1777
|
-
directory?.writeTimeline(JSON.stringify(timeline, null, 2));
|
|
1778
|
-
directory?.writeRun(
|
|
1779
|
-
runRecordText({
|
|
1780
|
-
...run.record,
|
|
1781
|
-
where: endedWhere(
|
|
1782
|
-
run.record.where,
|
|
1783
|
-
state.runner,
|
|
1784
|
-
run.outcome.kind === "ran" ? run.outcome.runner?.save ?? null : null
|
|
1785
|
-
),
|
|
1786
|
-
ended: runEnd(run.outcome, state.command, tests)
|
|
1787
|
-
})
|
|
1788
|
-
);
|
|
1789
|
-
const writeFailure = await directory?.close();
|
|
1839
|
+
const { view, recording } = run;
|
|
1840
|
+
const recorded = await recording.end(run.outcome);
|
|
1841
|
+
const { timeline, tests } = recorded;
|
|
1842
|
+
const logs = recording.opened.ok ? recording.opened.path : void 0;
|
|
1790
1843
|
const failed = tests.events.some((event) => event.kind === "test-result" && event.state === "fail");
|
|
1791
|
-
const testsLines = testsSummaryLines(tests.events, tests.unreadable, tests.incomplete);
|
|
1792
|
-
const stepLogs = failedStepLogs(
|
|
1793
|
-
const clock = workerClock(
|
|
1794
|
-
const charted = clock === void 0 ? void 0 : testsChart(tests.events, tests.unreadable, clock, tests.incomplete);
|
|
1844
|
+
const testsLines = testsSummaryLines(tests.events, run.hints, tests.unreadable, tests.incomplete);
|
|
1845
|
+
const stepLogs = failedStepLogs(timeline, recording, app.env);
|
|
1846
|
+
const clock = workerClock(recorded);
|
|
1847
|
+
const charted = clock === void 0 ? void 0 : testsChart(tests.events, run.hints, tests.unreadable, clock, tests.incomplete);
|
|
1795
1848
|
const summarized = await app.context.jobSummary.appendJobSummary(
|
|
1796
1849
|
jobSummaryMarkdown(timeline, {
|
|
1797
1850
|
command: run.command,
|
|
1798
|
-
logs
|
|
1851
|
+
logs,
|
|
1799
1852
|
details: [...testsLines, ...stepLogs]
|
|
1800
1853
|
})
|
|
1801
1854
|
);
|
|
@@ -1803,7 +1856,7 @@ async function summarize(app, run) {
|
|
|
1803
1856
|
waterfallLines(timeline, {
|
|
1804
1857
|
width: view.width,
|
|
1805
1858
|
paint: view.paint,
|
|
1806
|
-
logs: logsText(
|
|
1859
|
+
logs: logsText(recording, recorded.writeFailure, app.env, failed),
|
|
1807
1860
|
...charted === void 0 ? {} : { workers: charted.lanes },
|
|
1808
1861
|
details: [
|
|
1809
1862
|
...charted?.notes ?? testsLines,
|
|
@@ -1814,55 +1867,26 @@ async function summarize(app, run) {
|
|
|
1814
1867
|
);
|
|
1815
1868
|
return timeline;
|
|
1816
1869
|
}
|
|
1817
|
-
function workerClock(
|
|
1818
|
-
const tests =
|
|
1870
|
+
function workerClock({ timeline, workerOffsetMs }) {
|
|
1871
|
+
const tests = timeline.rows.find((row) => row.name === "tests");
|
|
1819
1872
|
if (tests === void 0) return void 0;
|
|
1820
|
-
return { runStartedAt: Date.parse(
|
|
1821
|
-
}
|
|
1822
|
-
function teeTerminal(terminal, directory) {
|
|
1823
|
-
if (directory === void 0) return terminal;
|
|
1824
|
-
return {
|
|
1825
|
-
color: terminal.color,
|
|
1826
|
-
writeStdout: (text) => {
|
|
1827
|
-
directory.appendCommandOutput(text);
|
|
1828
|
-
terminal.writeStdout(text);
|
|
1829
|
-
},
|
|
1830
|
-
writeStderr: (text) => {
|
|
1831
|
-
directory.appendCommandOutput(text);
|
|
1832
|
-
terminal.writeStderr(text);
|
|
1833
|
-
}
|
|
1834
|
-
};
|
|
1873
|
+
return { runStartedAt: Date.parse(timeline.startedAt), offsetMs: workerOffsetMs, tests };
|
|
1835
1874
|
}
|
|
1836
1875
|
function displayPath(path, env) {
|
|
1837
1876
|
const home = env["HOME"];
|
|
1838
1877
|
if (home === void 0 || home === "" || !path.startsWith(`${home}/`)) return path;
|
|
1839
1878
|
return `~${path.slice(home.length)}`;
|
|
1840
1879
|
}
|
|
1841
|
-
function logsText(opened, writeFailure, env, failed) {
|
|
1880
|
+
function logsText({ opened }, writeFailure, env, failed) {
|
|
1842
1881
|
if (!opened.ok) return `none: couldn't make ${opened.failure.path}: ${opened.failure.message}`;
|
|
1843
|
-
const path = `${displayPath(opened.
|
|
1882
|
+
const path = `${displayPath(opened.path, env)}/`;
|
|
1844
1883
|
const problems = [
|
|
1845
1884
|
...writeFailure === void 0 ? [] : [`couldn't write ${writeFailure.path}: ${writeFailure.message}`],
|
|
1846
1885
|
...opened.pruneFailures.slice(0, 1).map((failure) => `couldn't remove ${failure.path}: ${failure.message}`)
|
|
1847
1886
|
];
|
|
1848
|
-
const show = `storm runs show ${opened.
|
|
1887
|
+
const show = `storm runs show ${opened.id}${failed ? " --failed" : ""}`;
|
|
1849
1888
|
return `${problems.length === 0 ? path : `${path} (${problems.join("; ")})`} \xB7 ${show}`;
|
|
1850
1889
|
}
|
|
1851
|
-
function runEnd(outcome, ran, tests) {
|
|
1852
|
-
const command = outcome.kind === "ran" ? outcome.command : void 0;
|
|
1853
|
-
const ranRecords = outcome.kind === "ran" ? outcome.resources : void 0;
|
|
1854
|
-
const ms = ran?.outcome === void 0 || ran.outcome === "stopped" || ran.endedAt === void 0 ? null : ran.endedAt - ran.startedAt;
|
|
1855
|
-
return {
|
|
1856
|
-
outcome: outcome.kind,
|
|
1857
|
-
exitCode: command === void 0 ? null : commandExitStatus(command),
|
|
1858
|
-
signal: command?.kind === "signaled" ? command.signal : null,
|
|
1859
|
-
ms,
|
|
1860
|
-
tests: testTotals(tests.events),
|
|
1861
|
-
testsIncomplete: tests.incomplete ?? null,
|
|
1862
|
-
resources: ranRecords === void 0 ? null : RESOURCE_REPORTS.ranFacts(ranRecords),
|
|
1863
|
-
resourceRows: ranRecords === void 0 ? [] : RESOURCE_REPORTS.ranRows(ranRecords)
|
|
1864
|
-
};
|
|
1865
|
-
}
|
|
1866
1890
|
async function checkoutGit(checkout, cwd) {
|
|
1867
1891
|
const root = await checkout.repositoryRoot({ cwd });
|
|
1868
1892
|
if (!root.ok) return null;
|
|
@@ -1877,55 +1901,30 @@ function recipeResources(requests) {
|
|
|
1877
1901
|
})
|
|
1878
1902
|
);
|
|
1879
1903
|
}
|
|
1904
|
+
function keepsSandbox(flag) {
|
|
1905
|
+
return flag !== void 0 && (parseKeepTime(flag) ?? 0) > 0;
|
|
1906
|
+
}
|
|
1907
|
+
function saveMode(request, recipe, env) {
|
|
1908
|
+
const flag = request.saveDevSnapshot;
|
|
1909
|
+
if (flag !== void 0) return flag ? { kind: "always" } : { kind: "never", reason: "no-save-flag" };
|
|
1910
|
+
if (keepsSandbox(request.keepSandbox)) return { kind: "never", reason: "keep-sandbox" };
|
|
1911
|
+
if (recipe.saveDevSnapshot !== void 0)
|
|
1912
|
+
return recipe.saveDevSnapshot ? { kind: "always" } : { kind: "never", reason: "recipe" };
|
|
1913
|
+
if (isCi(env)) return { kind: "never", reason: "ci" };
|
|
1914
|
+
return devSnapshotsTrusted(recipe) ? { kind: "new-head" } : { kind: "never", reason: "not-trusted" };
|
|
1915
|
+
}
|
|
1916
|
+
function runSaveDefault(recipe, env) {
|
|
1917
|
+
return saveMode({}, recipe, env);
|
|
1918
|
+
}
|
|
1880
1919
|
var DEFAULT_KEEP_SANDBOX_MINUTES = 30;
|
|
1881
1920
|
function keepSandboxMinutes(flag, recipe, env) {
|
|
1882
1921
|
const fromFlag = flag === void 0 ? void 0 : parseKeepTime(flag);
|
|
1883
1922
|
return fromFlag ?? recipe.keepSandboxMinutes ?? (isCi(env) ? 0 : DEFAULT_KEEP_SANDBOX_MINUTES);
|
|
1884
1923
|
}
|
|
1885
|
-
function
|
|
1886
|
-
const
|
|
1887
|
-
return ci !== void 0 && ci !== "" && ci !== "0" && ci.toLowerCase() !== "false";
|
|
1888
|
-
}
|
|
1889
|
-
function startedWhere(run) {
|
|
1890
|
-
if (run.runner === void 0) return { kind: "unsandboxed" };
|
|
1891
|
-
const { prepared, target } = run.runner;
|
|
1892
|
-
return {
|
|
1893
|
-
kind: "runner",
|
|
1894
|
-
team: target.team,
|
|
1895
|
-
project: target.project,
|
|
1896
|
-
region: prepared.recipe.region,
|
|
1897
|
-
runtime: prepared.recipe.runtime,
|
|
1898
|
-
vcpus: prepared.vcpus,
|
|
1899
|
-
base: prepared.base,
|
|
1900
|
-
baseRef: prepared.baseRef,
|
|
1901
|
-
sandbox: null,
|
|
1902
|
-
snapshot: null,
|
|
1903
|
-
keptUntil: null,
|
|
1904
|
-
save: null
|
|
1905
|
-
};
|
|
1906
|
-
}
|
|
1907
|
-
function endedWhere(where, runner, save) {
|
|
1908
|
-
if (where.kind === "unsandboxed") return where;
|
|
1909
|
-
const snapshot = runner?.snapshot;
|
|
1910
|
-
return {
|
|
1911
|
-
...where,
|
|
1912
|
-
sandbox: runner?.sandbox?.name ?? null,
|
|
1913
|
-
snapshot: snapshot === void 0 || snapshot.kind === "building" ? null : {
|
|
1914
|
-
id: snapshot.id,
|
|
1915
|
-
base: snapshot.base,
|
|
1916
|
-
built: snapshot.kind === "built",
|
|
1917
|
-
branch: snapshot.branch,
|
|
1918
|
-
head: snapshot.head
|
|
1919
|
-
},
|
|
1920
|
-
keptUntil: runner?.kept?.stopsAt ?? null,
|
|
1921
|
-
save
|
|
1922
|
-
};
|
|
1923
|
-
}
|
|
1924
|
-
function failedStepLogs(ran, directory, env) {
|
|
1925
|
-
if (directory === void 0) return [];
|
|
1926
|
-
const runner = ran.rows.find((row) => row.name === "runner");
|
|
1924
|
+
function failedStepLogs(timeline, recording, env) {
|
|
1925
|
+
const runner = timeline.rows.find((row) => row.name === "runner");
|
|
1927
1926
|
return (runner?.steps ?? []).filter((step) => step.outcome === "failed").flatMap((step) => {
|
|
1928
|
-
const log = stepLog(
|
|
1927
|
+
const log = recording.stepLog(step.name);
|
|
1929
1928
|
return log === void 0 ? [] : [` failed ${step.name}, whole output: ${displayPath(log, env)}`];
|
|
1930
1929
|
});
|
|
1931
1930
|
}
|
|
@@ -1952,7 +1951,7 @@ function canceledChanges(outcome) {
|
|
|
1952
1951
|
];
|
|
1953
1952
|
const cleanup = RUN_CLEANUP.facts(outcome).runner;
|
|
1954
1953
|
if (cleanup !== null) lines.push(...runnerCleanupLines(cleanup));
|
|
1955
|
-
lines.push(...
|
|
1954
|
+
lines.push(...DEFINITION_SET.reports.canceledLines(outcome.resourceCleanup));
|
|
1956
1955
|
return lines.join("\n");
|
|
1957
1956
|
}
|
|
1958
1957
|
function runnerCleanupLines({ kept, notKept, notStopped, notDeleted }) {
|
|
@@ -1969,55 +1968,26 @@ function runnerCleanupLines({ kept, notKept, notStopped, notDeleted }) {
|
|
|
1969
1968
|
];
|
|
1970
1969
|
}
|
|
1971
1970
|
|
|
1972
|
-
// src/commands/exec/run-metadata.ts
|
|
1973
|
-
var RUN_USAGE_FLAGS = `${RESOURCE_USAGE_FLAGS} [--credential <SOURCE>] [--scope <TEAM> --project <PROJECT>] [--unsandboxed | [--rebuild-snapshot] [--save-snapshot] [--show-output] [--keep-sandbox <DURATION>]] [--verbose]`;
|
|
1974
|
-
var OWN_RUN_FIELDS2 = {
|
|
1975
|
-
credential: {
|
|
1976
|
-
valueLabel: "SOURCE",
|
|
1977
|
-
description: "The credential source: mint, the default, mints one with the vercel CLI for --scope and --project; github-actions requests a GitHub Actions OIDC token, in a GitHub Actions job with permissions id-token: write, anew once it is 4 minutes old, and needs no --scope or --project. Only --unsandboxed takes it: a sandboxed run needs the mint. Only a run with a resource that takes a credential takes it, as that resource's options decide; otherwise it is credential_unused. No config key."
|
|
1978
|
-
},
|
|
1979
|
-
unsandboxed: {
|
|
1980
|
-
description: "Run the command on this machine, with no isolation: it sees this machine's files and environment, less the variables the resources drop. Without it, the command runs in a Vercel Sandbox started from a runner snapshot of the base, with this checkout's changes applied, installed and built, from the runner key of storm.config.ts, and its output streams back with paths rewritten to this checkout's. No config key."
|
|
1981
|
-
},
|
|
1982
|
-
rebuildSnapshot: {
|
|
1983
|
-
description: "Build a runner snapshot of the base whatever the runner snapshot cache holds, replacing an entry for the same base, and drop this branch's saved branch snapshots from the cache. Not with --unsandboxed. No config key."
|
|
1984
|
-
},
|
|
1985
|
-
saveSnapshot: {
|
|
1986
|
-
description: "Once the command ends on its own after a successful install and build, save the runner sandbox as this branch's runner snapshot, so the next run on the branch starts from this run's install and build outputs. The run resets the working tree to the snapshot's base, keeps .git and ignored files such as node_modules and build outputs, and empties /tmp; the snapshot keeps whatever the command wrote there and to $HOME, a resource's token included. A run with it on a branch keeps no runner sandbox, even when it fails or stops before the save. With a detached HEAD it says so as it starts and keeps the runner sandbox as without the flag. Not with --unsandboxed, or with --keep-sandbox above 0. No config key."
|
|
1987
|
-
},
|
|
1988
|
-
keepSandbox: {
|
|
1989
|
-
valueLabel: "DURATION",
|
|
1990
|
-
description: "How long the runner sandbox keeps running once the run ends, however it ends, so you can connect to it from its page in the Vercel dashboard: 0, which stops and deletes it with the run's other sandboxes, or a whole number of minutes or hours up to 5h (30m, 2h). The run asks Vercel Sandbox to extend the runner sandbox's timeout when it would stop sooner; it never shortens it, so the sandbox may run past the keep time until its own timeout. The run says until when it runs, and storm runs show and runs list say so too. Default: keepSandbox in the runner recipe, else 30m, or 0 when CI is set. Not with --unsandboxed."
|
|
1991
|
-
},
|
|
1992
|
-
showOutput: {
|
|
1993
|
-
description: "In a sandboxed run on a terminal, print the runner's step output (a snapshot build, the install, the build) above the live view instead of keeping only each step's last line there. Plain output always prints it. Either way, the run directory keeps it whole. Not with --unsandboxed. No config key."
|
|
1994
|
-
},
|
|
1995
|
-
verbose: {
|
|
1996
|
-
description: "Print more as it happens: each resource's detailed progress, the runner's step output as with --show-output, and verbose in the run payload, which has the Vitest adapter's reporters print each test as it finishes and its fixtures print each container start, proxied request and vercel invocation, for passing tests too. No config key."
|
|
1997
|
-
},
|
|
1998
|
-
scope: {
|
|
1999
|
-
valueLabel: "TEAM",
|
|
2000
|
-
description: "The control plane team: the Vercel team whose project the credential is minted for and a sandboxed run's sandboxes run in. Required, from this flag or scope in storm.config.ts, unless an unsandboxed run has no resource that takes a credential or takes --credential github-actions."
|
|
2001
|
-
},
|
|
2002
|
-
project: {
|
|
2003
|
-
valueLabel: "PROJECT",
|
|
2004
|
-
description: "The control plane project: the Vercel project, within the team, to mint the credential for. Required, from this flag or project in storm.config.ts, unless an unsandboxed run has no resource that takes a credential or takes --credential github-actions."
|
|
2005
|
-
}
|
|
2006
|
-
};
|
|
2007
|
-
var RUN_FIELDS = { ...RESOURCE_FLAG_HELP, ...OWN_RUN_FIELDS2 };
|
|
2008
|
-
|
|
2009
1971
|
export {
|
|
1972
|
+
notStoppedText,
|
|
1973
|
+
notDeletedText,
|
|
1974
|
+
RUN_CLEANUP,
|
|
2010
1975
|
ranSchema,
|
|
2011
1976
|
RAN_DESCRIPTION,
|
|
2012
1977
|
renderRan,
|
|
1978
|
+
runErrors,
|
|
2013
1979
|
RUN_ERRORS,
|
|
2014
1980
|
outcomes,
|
|
1981
|
+
lineProgress,
|
|
1982
|
+
progressLine,
|
|
1983
|
+
headText,
|
|
2015
1984
|
canceledBeforeStart,
|
|
2016
1985
|
RUN_REQUEST_FIELDS,
|
|
2017
1986
|
RUN_CLI_OPTIONS,
|
|
2018
1987
|
runCommand,
|
|
2019
1988
|
runProblems,
|
|
1989
|
+
prepareRefusal,
|
|
2020
1990
|
checkoutFailedRefusal,
|
|
2021
|
-
|
|
2022
|
-
|
|
1991
|
+
runSaveDefault,
|
|
1992
|
+
runnerFailureFacts
|
|
2023
1993
|
};
|