@intentius/chant 0.124.52 → 0.124.55
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/__fixtures__/estate-ledger.d.ts +13 -0
- package/dist/__fixtures__/estate-ledger.d.ts.map +1 -0
- package/dist/__fixtures__/estate-ledger.js +67 -0
- package/dist/__fixtures__/oidc-emulator.d.ts +11 -1
- package/dist/__fixtures__/oidc-emulator.d.ts.map +1 -1
- package/dist/__fixtures__/oidc-emulator.js +26 -2
- package/dist/__fixtures__/product-words.d.ts +78 -0
- package/dist/__fixtures__/product-words.d.ts.map +1 -0
- package/dist/__fixtures__/product-words.js +43 -0
- package/dist/__golden__/wave-loop/op-by-apply-after-fails.json +10 -2
- package/dist/__golden__/wave-loop/op-by-apply-hold.json +20 -4
- package/dist/__golden__/wave-loop/op-by-apply-ignored.json +10 -2
- package/dist/__golden__/wave-loop/op-by-apply-pass.json +10 -2
- package/dist/__golden__/wave-loop/op-by-apply-skip.json +10 -2
- package/dist/__golden__/wave-loop/op-discover-rest-stops.json +22 -6
- package/dist/__golden__/wave-loop/op-discover-rest.json +44 -12
- package/dist/__golden__/wave-loop/op-discover-wide.json +12 -3
- package/dist/__golden__/wave-loop/op-held-on.json +28 -7
- package/dist/__golden__/wave-loop/op-hooks-apply-fails.json +22 -6
- package/dist/__golden__/wave-loop/op-hooks-fail-after-apply.json +22 -6
- package/dist/__golden__/wave-loop/op-hooks-fail-before-apply.json +4 -2
- package/dist/__golden__/wave-loop/op-hooks-held.json +26 -8
- package/dist/__golden__/wave-loop/op-hooks-hold-before-apply.json +18 -4
- package/dist/__golden__/wave-loop/op-hooks-pass.json +22 -6
- package/dist/__golden__/wave-loop/op-hooks-share.json +20 -7
- package/dist/__golden__/wave-loop/op-outcome-held.json +12 -3
- package/dist/__golden__/wave-loop/op-outcome-replan-approved.json +16 -5
- package/dist/__golden__/wave-loop/op-outcome-replan-forever.json +48 -21
- package/dist/__golden__/wave-loop/op-outcome-replan.json +16 -5
- package/dist/__golden__/wave-loop/op-outcome-stood-down.json +12 -3
- package/dist/__golden__/wave-loop/op-outcome-unreadable.json +12 -3
- package/dist/__golden__/wave-loop/op-overridden.json +28 -7
- package/dist/__golden__/wave-loop/op-per-run.json +20 -4
- package/dist/__golden__/wave-loop/op-point.json +18 -4
- package/dist/__golden__/wave-loop/op-pr-review.json +10 -2
- package/dist/__golden__/wave-loop/op-spend-change-only.json +10 -2
- package/dist/__golden__/wave-loop/op-spend.json +10 -2
- package/dist/__golden__/wave-loop/op-wave-commands.json +56 -13
- package/dist/__golden__/wave-loop/op-wide.json +20 -4
- package/dist/audit/discover.d.ts.map +1 -1
- package/dist/audit/discover.js +3 -1
- package/dist/behaviour.d.ts +1 -1
- package/dist/behaviour.d.ts.map +1 -1
- package/dist/bucket-check/azure.d.ts +108 -0
- package/dist/bucket-check/azure.d.ts.map +1 -0
- package/dist/bucket-check/azure.js +258 -0
- package/dist/bucket-check/fixtures/azure.json +153 -0
- package/dist/bucket-check/fixtures/gcs.json +148 -0
- package/dist/bucket-check/fixtures/s3.json +277 -0
- package/dist/bucket-check/gcs.d.ts +77 -0
- package/dist/bucket-check/gcs.d.ts.map +1 -0
- package/dist/bucket-check/gcs.js +202 -0
- package/dist/bucket-check/index.d.ts +48 -0
- package/dist/bucket-check/index.d.ts.map +1 -0
- package/dist/bucket-check/index.js +44 -0
- package/dist/bucket-check/s3.d.ts +116 -0
- package/dist/bucket-check/s3.d.ts.map +1 -0
- package/dist/bucket-check/s3.js +362 -0
- package/dist/bucket-check/types.d.ts +66 -0
- package/dist/bucket-check/types.d.ts.map +1 -0
- package/dist/bucket-check/types.js +31 -0
- package/dist/bucket-check/wire.d.ts +27 -0
- package/dist/bucket-check/wire.d.ts.map +1 -0
- package/dist/bucket-check/wire.js +32 -0
- package/dist/bucket-check.d.ts +6 -0
- package/dist/bucket-check.d.ts.map +1 -0
- package/dist/bucket-check.js +5 -0
- package/dist/capabilities/templates.d.ts +65 -0
- package/dist/capabilities/templates.d.ts.map +1 -0
- package/dist/capabilities/templates.js +192 -0
- package/dist/capabilities/templates.json +145 -0
- package/dist/change-set-graph.d.ts +35 -3
- package/dist/change-set-graph.d.ts.map +1 -1
- package/dist/change-set-graph.js +60 -9
- package/dist/change-set.d.ts +65 -7
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +22 -12
- package/dist/ci-agent.d.ts +381 -0
- package/dist/ci-agent.d.ts.map +1 -0
- package/dist/ci-agent.js +833 -0
- package/dist/ci-control.d.ts +42 -0
- package/dist/ci-control.d.ts.map +1 -0
- package/dist/ci-control.js +42 -0
- package/dist/ci-estate/delivery.d.ts +137 -0
- package/dist/ci-estate/delivery.d.ts.map +1 -0
- package/dist/ci-estate/delivery.js +311 -0
- package/dist/ci-estate/overdue.d.ts +34 -0
- package/dist/ci-estate/overdue.d.ts.map +1 -0
- package/dist/ci-estate/overdue.js +58 -0
- package/dist/ci-estate/page.d.ts +134 -0
- package/dist/ci-estate/page.d.ts.map +1 -0
- package/dist/ci-estate/page.js +233 -0
- package/dist/ci-estate/rows.d.ts +118 -0
- package/dist/ci-estate/rows.d.ts.map +1 -0
- package/dist/ci-estate/rows.js +126 -0
- package/dist/ci-estate.d.ts +68 -0
- package/dist/ci-estate.d.ts.map +1 -0
- package/dist/ci-estate.js +83 -0
- package/dist/ci-handover.d.ts +29 -5
- package/dist/ci-handover.d.ts.map +1 -1
- package/dist/ci-handover.js +50 -16
- package/dist/ci-identity.d.ts +89 -9
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +91 -16
- package/dist/ci-product-words.d.ts +290 -0
- package/dist/ci-product-words.d.ts.map +1 -0
- package/dist/ci-product-words.js +373 -0
- package/dist/ci-product.d.ts +82 -0
- package/dist/ci-product.d.ts.map +1 -0
- package/dist/ci-product.js +78 -0
- package/dist/cli/commands/audit.d.ts +2 -2
- package/dist/cli/commands/audit.d.ts.map +1 -1
- package/dist/cli/commands/audit.js +3 -2
- package/dist/cli/commands/carve.js +2 -2
- package/dist/cli/commands/import-index.d.ts +52 -0
- package/dist/cli/commands/import-index.d.ts.map +1 -0
- package/dist/cli/commands/import-index.js +226 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +1 -1
- package/dist/cli/commands/lint.d.ts.map +1 -1
- package/dist/cli/commands/lint.js +4 -2
- package/dist/cli/handlers/agent.d.ts +17 -0
- package/dist/cli/handlers/agent.d.ts.map +1 -0
- package/dist/cli/handlers/agent.js +114 -0
- package/dist/cli/handlers/approve-confirm.d.ts +84 -0
- package/dist/cli/handlers/approve-confirm.d.ts.map +1 -0
- package/dist/cli/handlers/approve-confirm.js +142 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +19 -1
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +43 -1
- package/dist/cli/handlers/ci-check.d.ts +3 -0
- package/dist/cli/handlers/ci-check.d.ts.map +1 -0
- package/dist/cli/handlers/ci-check.js +34 -0
- package/dist/cli/handlers/ci-forge-check.d.ts +3 -0
- package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -0
- package/dist/cli/handlers/ci-forge-check.js +89 -0
- package/dist/cli/handlers/components.d.ts.map +1 -1
- package/dist/cli/handlers/components.js +11 -2
- package/dist/cli/handlers/fan-out.d.ts.map +1 -1
- package/dist/cli/handlers/fan-out.js +20 -3
- package/dist/cli/handlers/gate-pending.d.ts +11 -0
- package/dist/cli/handlers/gate-pending.d.ts.map +1 -0
- package/dist/cli/handlers/gate-pending.js +44 -0
- package/dist/cli/handlers/graph.d.ts.map +1 -1
- package/dist/cli/handlers/graph.js +22 -4
- package/dist/cli/handlers/index-cloud.d.ts +14 -0
- package/dist/cli/handlers/index-cloud.d.ts.map +1 -0
- package/dist/cli/handlers/index-cloud.js +22 -0
- package/dist/cli/handlers/index-diff.d.ts +18 -0
- package/dist/cli/handlers/index-diff.d.ts.map +1 -0
- package/dist/cli/handlers/index-diff.js +142 -0
- package/dist/cli/handlers/init.d.ts.map +1 -1
- package/dist/cli/handlers/init.js +1 -0
- package/dist/cli/handlers/ledger.js +1 -1
- package/dist/cli/handlers/lifecycle-drift.d.ts +29 -0
- package/dist/cli/handlers/lifecycle-drift.d.ts.map +1 -0
- package/dist/cli/handlers/lifecycle-drift.js +69 -0
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.js +188 -28
- package/dist/cli/handlers/lock.d.ts.map +1 -1
- package/dist/cli/handlers/lock.js +64 -5
- package/dist/cli/handlers/misc.d.ts +9 -0
- package/dist/cli/handlers/misc.d.ts.map +1 -1
- package/dist/cli/handlers/misc.js +77 -0
- package/dist/cli/handlers/notify-relay.d.ts +15 -0
- package/dist/cli/handlers/notify-relay.d.ts.map +1 -0
- package/dist/cli/handlers/notify-relay.js +130 -0
- package/dist/cli/handlers/pr-env.d.ts.map +1 -1
- package/dist/cli/handlers/pr-env.js +42 -11
- package/dist/cli/handlers/pr.d.ts +38 -3
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +668 -207
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +110 -17
- package/dist/cli/handlers/query.d.ts.map +1 -1
- package/dist/cli/handlers/query.js +28 -4
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +3 -0
- package/dist/cli/handlers/run-wave.d.ts +8 -0
- package/dist/cli/handlers/run-wave.d.ts.map +1 -1
- package/dist/cli/handlers/run-wave.js +71 -1
- package/dist/cli/handlers/run.d.ts +6 -1
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +86 -1
- package/dist/cli/handlers/scenario.d.ts.map +1 -1
- package/dist/cli/handlers/scenario.js +8 -7
- package/dist/cli/handlers/search.d.ts +34 -4
- package/dist/cli/handlers/search.d.ts.map +1 -1
- package/dist/cli/handlers/search.js +216 -36
- package/dist/cli/handlers/serve.d.ts.map +1 -1
- package/dist/cli/handlers/serve.js +10 -1
- package/dist/cli/main.d.ts +11 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +179 -14
- package/dist/cli/mcp/ledger-tools.d.ts +36 -0
- package/dist/cli/mcp/ledger-tools.d.ts.map +1 -0
- package/dist/cli/mcp/ledger-tools.js +122 -0
- package/dist/cli/mcp/lifecycle-tools.d.ts.map +1 -1
- package/dist/cli/mcp/lifecycle-tools.js +3 -2
- package/dist/cli/mcp/product-tools.d.ts +78 -0
- package/dist/cli/mcp/product-tools.d.ts.map +1 -0
- package/dist/cli/mcp/product-tools.js +93 -0
- package/dist/cli/mcp/read-only.d.ts +34 -0
- package/dist/cli/mcp/read-only.d.ts.map +1 -0
- package/dist/cli/mcp/read-only.js +61 -0
- package/dist/cli/mcp/report-tools.d.ts +48 -0
- package/dist/cli/mcp/report-tools.d.ts.map +1 -0
- package/dist/cli/mcp/report-tools.js +128 -0
- package/dist/cli/mcp/resource-handlers.d.ts.map +1 -1
- package/dist/cli/mcp/resource-handlers.js +4 -3
- package/dist/cli/mcp/server.d.ts +28 -1
- package/dist/cli/mcp/server.d.ts.map +1 -1
- package/dist/cli/mcp/server.js +86 -15
- package/dist/cli/mcp/workspace-tools.js +1 -1
- package/dist/cli/mcp-config.d.ts +9 -2
- package/dist/cli/mcp-config.d.ts.map +1 -1
- package/dist/cli/mcp-config.js +8 -3
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +112 -5
- package/dist/cli/registry.d.ts +54 -1
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/cloud-lister/aws.d.ts +35 -0
- package/dist/cloud-lister/aws.d.ts.map +1 -0
- package/dist/cloud-lister/aws.js +203 -0
- package/dist/cloud-lister/azure.d.ts +34 -0
- package/dist/cloud-lister/azure.d.ts.map +1 -0
- package/dist/cloud-lister/azure.js +129 -0
- package/dist/cloud-lister/common.d.ts +40 -0
- package/dist/cloud-lister/common.d.ts.map +1 -0
- package/dist/cloud-lister/common.js +83 -0
- package/dist/cloud-lister/credentials.d.ts +50 -0
- package/dist/cloud-lister/credentials.d.ts.map +1 -0
- package/dist/cloud-lister/credentials.js +86 -0
- package/dist/cloud-lister/fakes.d.ts +27 -0
- package/dist/cloud-lister/fakes.d.ts.map +1 -0
- package/dist/cloud-lister/fakes.js +50 -0
- package/dist/cloud-lister/gcp.d.ts +42 -0
- package/dist/cloud-lister/gcp.d.ts.map +1 -0
- package/dist/cloud-lister/gcp.js +143 -0
- package/dist/cloud-lister/guard.d.ts +49 -0
- package/dist/cloud-lister/guard.d.ts.map +1 -0
- package/dist/cloud-lister/guard.js +103 -0
- package/dist/cloud-lister/ids.d.ts +23 -0
- package/dist/cloud-lister/ids.d.ts.map +1 -0
- package/dist/cloud-lister/ids.js +42 -0
- package/dist/cloud-lister/index.d.ts +67 -0
- package/dist/cloud-lister/index.d.ts.map +1 -0
- package/dist/cloud-lister/index.js +102 -0
- package/dist/cloud-lister/kubernetes.d.ts +64 -0
- package/dist/cloud-lister/kubernetes.d.ts.map +1 -0
- package/dist/cloud-lister/kubernetes.js +276 -0
- package/dist/cloud-lister/markers.d.ts +31 -0
- package/dist/cloud-lister/markers.d.ts.map +1 -0
- package/dist/cloud-lister/markers.js +73 -0
- package/dist/cloud-lister/mask.d.ts +31 -0
- package/dist/cloud-lister/mask.d.ts.map +1 -0
- package/dist/cloud-lister/mask.js +74 -0
- package/dist/cloud-lister/sigv4.d.ts +64 -0
- package/dist/cloud-lister/sigv4.d.ts.map +1 -0
- package/dist/cloud-lister/sigv4.js +104 -0
- package/dist/cloud-lister/transport.d.ts +55 -0
- package/dist/cloud-lister/transport.d.ts.map +1 -0
- package/dist/cloud-lister/transport.js +86 -0
- package/dist/cloud-lister/types.d.ts +121 -0
- package/dist/cloud-lister/types.d.ts.map +1 -0
- package/dist/cloud-lister/types.js +24 -0
- package/dist/components/adoption.d.ts +69 -0
- package/dist/components/adoption.d.ts.map +1 -0
- package/dist/components/adoption.js +93 -0
- package/dist/components/apply-lease.d.ts +19 -0
- package/dist/components/apply-lease.d.ts.map +1 -0
- package/dist/components/apply-lease.js +41 -0
- package/dist/components/capability-plugin-loader.d.ts.map +1 -1
- package/dist/components/capability-plugin-loader.js +6 -0
- package/dist/components/capability-plugin.d.ts +9 -0
- package/dist/components/capability-plugin.d.ts.map +1 -1
- package/dist/components/capability.d.ts +337 -5
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/capability.js +14 -6
- package/dist/components/check-hooks.d.ts +113 -0
- package/dist/components/check-hooks.d.ts.map +1 -0
- package/dist/components/check-hooks.js +192 -0
- package/dist/components/ci-services.d.ts +57 -0
- package/dist/components/ci-services.d.ts.map +1 -0
- package/dist/components/ci-services.js +61 -0
- package/dist/components/cli-support.d.ts +34 -0
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/cli-support.js +67 -15
- package/dist/components/declared-reads.d.ts +38 -0
- package/dist/components/declared-reads.d.ts.map +1 -0
- package/dist/components/declared-reads.js +131 -0
- package/dist/components/deploy-units.d.ts.map +1 -1
- package/dist/components/deploy-units.js +4 -0
- package/dist/components/driver.d.ts +54 -4
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +90 -7
- package/dist/components/fan-out-run.d.ts +35 -1
- package/dist/components/fan-out-run.d.ts.map +1 -1
- package/dist/components/fan-out-run.js +138 -30
- package/dist/components/fan-out-support.d.ts +6 -0
- package/dist/components/fan-out-support.d.ts.map +1 -1
- package/dist/components/fan-out-support.js +4 -1
- package/dist/components/fan-out.d.ts +28 -0
- package/dist/components/fan-out.d.ts.map +1 -1
- package/dist/components/groups.d.ts +229 -0
- package/dist/components/groups.d.ts.map +1 -0
- package/dist/components/groups.js +777 -0
- package/dist/components/index.d.ts +6 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/plan-shape-conformance.d.ts +48 -0
- package/dist/components/plan-shape-conformance.d.ts.map +1 -0
- package/dist/components/plan-shape-conformance.js +122 -0
- package/dist/components/pr-env-ledger.d.ts +32 -0
- package/dist/components/pr-env-ledger.d.ts.map +1 -0
- package/dist/components/pr-env-ledger.js +39 -0
- package/dist/components/pr-env-ports.d.ts +12 -0
- package/dist/components/pr-env-ports.d.ts.map +1 -1
- package/dist/components/pr-env-ports.js +13 -3
- package/dist/components/pr-env-run.d.ts +6 -0
- package/dist/components/pr-env-run.d.ts.map +1 -1
- package/dist/components/pr-env-run.js +3 -2
- package/dist/components/pr-environment.d.ts +31 -3
- package/dist/components/pr-environment.d.ts.map +1 -1
- package/dist/components/pr-environment.js +25 -7
- package/dist/components/pr-pipeline.d.ts +169 -3
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +184 -9
- package/dist/components/pr-policy.d.ts +26 -2
- package/dist/components/pr-policy.d.ts.map +1 -1
- package/dist/components/pr-policy.js +41 -7
- package/dist/components/pr-run.d.ts +104 -4
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +290 -41
- package/dist/components/pr-targets.d.ts +24 -0
- package/dist/components/pr-targets.d.ts.map +1 -0
- package/dist/components/pr-targets.js +48 -0
- package/dist/components/product-pipeline.d.ts +217 -0
- package/dist/components/product-pipeline.d.ts.map +1 -0
- package/dist/components/product-pipeline.js +193 -0
- package/dist/components/promote-rounds.d.ts +9 -0
- package/dist/components/promote-rounds.d.ts.map +1 -1
- package/dist/components/promote-rounds.js +23 -2
- package/dist/components/promote.d.ts +23 -0
- package/dist/components/promote.d.ts.map +1 -1
- package/dist/components/promote.js +39 -6
- package/dist/components/release-compile.d.ts +22 -1
- package/dist/components/release-compile.d.ts.map +1 -1
- package/dist/components/release-compile.js +85 -0
- package/dist/components/release-gate.d.ts +23 -1
- package/dist/components/release-gate.d.ts.map +1 -1
- package/dist/components/release-gate.js +97 -33
- package/dist/components/release-promote.d.ts +15 -1
- package/dist/components/release-promote.d.ts.map +1 -1
- package/dist/components/release-promote.js +67 -2
- package/dist/components/repo-lock.d.ts +27 -0
- package/dist/components/repo-lock.d.ts.map +1 -0
- package/dist/components/repo-lock.js +49 -0
- package/dist/components/row-lease.d.ts +84 -0
- package/dist/components/row-lease.d.ts.map +1 -0
- package/dist/components/row-lease.js +110 -0
- package/dist/components/run-groups.d.ts +58 -0
- package/dist/components/run-groups.d.ts.map +1 -0
- package/dist/components/run-groups.js +78 -0
- package/dist/components/starter-plugin.d.ts +1 -0
- package/dist/components/starter-plugin.d.ts.map +1 -1
- package/dist/components/starter-plugin.js +6 -1
- package/dist/components/verbs/index.d.ts +1 -0
- package/dist/components/verbs/index.d.ts.map +1 -1
- package/dist/components/verbs/index.js +1 -0
- package/dist/components/verbs/member-outputs.d.ts +187 -0
- package/dist/components/verbs/member-outputs.d.ts.map +1 -0
- package/dist/components/verbs/member-outputs.js +218 -0
- package/dist/components/wave-plan.d.ts +34 -0
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +54 -2
- package/dist/config.d.ts +60 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +27 -0
- package/dist/control/applied.d.ts +89 -0
- package/dist/control/applied.d.ts.map +1 -0
- package/dist/control/applied.js +175 -0
- package/dist/control/consumers.d.ts +78 -0
- package/dist/control/consumers.d.ts.map +1 -0
- package/dist/control/consumers.js +172 -0
- package/dist/control/dispatch.d.ts +334 -0
- package/dist/control/dispatch.d.ts.map +1 -0
- package/dist/control/dispatch.js +519 -0
- package/dist/control/edges.d.ts +75 -0
- package/dist/control/edges.d.ts.map +1 -0
- package/dist/control/edges.js +133 -0
- package/dist/control/reconcile.d.ts +120 -0
- package/dist/control/reconcile.d.ts.map +1 -0
- package/dist/control/reconcile.js +178 -0
- package/dist/control/records.d.ts +187 -0
- package/dist/control/records.d.ts.map +1 -0
- package/dist/control/records.js +307 -0
- package/dist/deep-observation.d.ts +1 -13
- package/dist/deep-observation.d.ts.map +1 -1
- package/dist/deep-observation.js +5 -22
- package/dist/discovery/sandbox/bundle.d.ts.map +1 -1
- package/dist/discovery/sandbox/bundle.js +25 -1
- package/dist/drift-record.d.ts +542 -0
- package/dist/drift-record.d.ts.map +1 -0
- package/dist/drift-record.js +886 -0
- package/dist/engine-facts.d.ts +144 -0
- package/dist/engine-facts.d.ts.map +1 -0
- package/dist/engine-facts.js +13 -0
- package/dist/exit-codes.d.ts +48 -0
- package/dist/exit-codes.d.ts.map +1 -0
- package/dist/exit-codes.js +49 -0
- package/dist/forge-check/check.d.ts +63 -0
- package/dist/forge-check/check.d.ts.map +1 -0
- package/dist/forge-check/check.js +139 -0
- package/dist/forge-check/contract.d.ts +152 -0
- package/dist/forge-check/contract.d.ts.map +1 -0
- package/dist/forge-check/contract.js +118 -0
- package/dist/forge-check/forge.d.ts +42 -0
- package/dist/forge-check/forge.d.ts.map +1 -0
- package/dist/forge-check/forge.js +338 -0
- package/dist/forge-check/index.d.ts +24 -0
- package/dist/forge-check/index.d.ts.map +1 -0
- package/dist/forge-check/index.js +23 -0
- package/dist/forge-check/pulumi.d.ts +44 -0
- package/dist/forge-check/pulumi.d.ts.map +1 -0
- package/dist/forge-check/pulumi.js +184 -0
- package/dist/forge-check/read-only.d.ts +26 -0
- package/dist/forge-check/read-only.d.ts.map +1 -0
- package/dist/forge-check/read-only.js +53 -0
- package/dist/forge-check/trust.d.ts +94 -0
- package/dist/forge-check/trust.d.ts.map +1 -0
- package/dist/forge-check/trust.js +532 -0
- package/dist/forge-check/types.d.ts +80 -0
- package/dist/forge-check/types.d.ts.map +1 -0
- package/dist/forge-check/types.js +18 -0
- package/dist/forge-check.d.ts +6 -0
- package/dist/forge-check.d.ts.map +1 -0
- package/dist/forge-check.js +5 -0
- package/dist/gate-decision.d.ts +1 -0
- package/dist/gate-decision.d.ts.map +1 -1
- package/dist/gate-decision.js +2 -0
- package/dist/gate-policy.d.ts +47 -1
- package/dist/gate-policy.d.ts.map +1 -1
- package/dist/gate-policy.js +50 -2
- package/dist/graph-ir.d.ts +153 -2
- package/dist/graph-ir.d.ts.map +1 -1
- package/dist/graph-ir.js +224 -6
- package/dist/graph-refs.d.ts +145 -0
- package/dist/graph-refs.d.ts.map +1 -1
- package/dist/graph-refs.js +305 -0
- package/dist/graph-schema/fixtures/adopt.json +15 -0
- package/dist/graph-schema/fixtures/choudoufu.engine-graph.json +169 -0
- package/dist/graph-schema/fixtures/index.json +68 -0
- package/dist/graph-schema/fixtures/plunge.engine-graph.json +158 -0
- package/dist/graph-schema/fixtures.d.ts +23 -0
- package/dist/graph-schema/fixtures.d.ts.map +1 -0
- package/dist/graph-schema/fixtures.js +246 -0
- package/dist/graph-schema/generate.d.ts +15 -0
- package/dist/graph-schema/generate.d.ts.map +1 -0
- package/dist/graph-schema/generate.js +267 -0
- package/dist/graph-schema/graph.schema.json +1387 -0
- package/dist/health.schema.json +2 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/instance-nodes.d.ts +159 -0
- package/dist/instance-nodes.d.ts.map +1 -0
- package/dist/instance-nodes.js +231 -0
- package/dist/lexicon.d.ts +178 -6
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/adoption-file.d.ts +80 -0
- package/dist/lifecycle/adoption-file.d.ts.map +1 -0
- package/dist/lifecycle/adoption-file.js +122 -0
- package/dist/lifecycle/cloud-index.d.ts +186 -0
- package/dist/lifecycle/cloud-index.d.ts.map +1 -0
- package/dist/lifecycle/cloud-index.js +617 -0
- package/dist/lifecycle/derive-edges.d.ts +59 -0
- package/dist/lifecycle/derive-edges.d.ts.map +1 -0
- package/dist/lifecycle/derive-edges.js +126 -0
- package/dist/lifecycle/gate-applied.d.ts +6 -0
- package/dist/lifecycle/gate-applied.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts +29 -0
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.js +11 -1
- package/dist/lifecycle/gate-pending-by-plan.d.ts +75 -0
- package/dist/lifecycle/gate-pending-by-plan.d.ts.map +1 -0
- package/dist/lifecycle/gate-pending-by-plan.js +96 -0
- package/dist/lifecycle/gated-request-digest.d.ts +28 -0
- package/dist/lifecycle/gated-request-digest.d.ts.map +1 -0
- package/dist/lifecycle/gated-request-digest.js +35 -0
- package/dist/lifecycle/gated-request.d.ts +126 -0
- package/dist/lifecycle/gated-request.d.ts.map +1 -0
- package/dist/lifecycle/gated-request.js +205 -0
- package/dist/lifecycle/git.d.ts +10 -9
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +7 -1
- package/dist/lifecycle/identity-match.d.ts +148 -0
- package/dist/lifecycle/identity-match.d.ts.map +1 -0
- package/dist/lifecycle/identity-match.js +152 -0
- package/dist/lifecycle/index-diff.d.ts +264 -0
- package/dist/lifecycle/index-diff.d.ts.map +1 -0
- package/dist/lifecycle/index-diff.js +326 -0
- package/dist/lifecycle/index-document.d.ts +130 -0
- package/dist/lifecycle/index-document.d.ts.map +1 -0
- package/dist/lifecycle/index-document.js +188 -0
- package/dist/lifecycle/index-drift.d.ts +121 -0
- package/dist/lifecycle/index-drift.d.ts.map +1 -0
- package/dist/lifecycle/index-drift.js +178 -0
- package/dist/lifecycle/index-import.d.ts +171 -0
- package/dist/lifecycle/index-import.d.ts.map +1 -0
- package/dist/lifecycle/index-import.js +512 -0
- package/dist/lifecycle/index-join.d.ts +129 -0
- package/dist/lifecycle/index-join.d.ts.map +1 -0
- package/dist/lifecycle/index-join.js +248 -0
- package/dist/lifecycle/index.d.ts +4 -0
- package/dist/lifecycle/index.d.ts.map +1 -1
- package/dist/lifecycle/index.js +4 -0
- package/dist/lifecycle/ledger-read.d.ts.map +1 -1
- package/dist/lifecycle/ledger-read.js +7 -3
- package/dist/lifecycle/lock-rows.d.ts +76 -0
- package/dist/lifecycle/lock-rows.d.ts.map +1 -0
- package/dist/lifecycle/lock-rows.js +140 -0
- package/dist/lifecycle/observation-baseline.d.ts +61 -21
- package/dist/lifecycle/observation-baseline.d.ts.map +1 -1
- package/dist/lifecycle/observation-baseline.js +144 -19
- package/dist/lifecycle/observe.d.ts.map +1 -1
- package/dist/lifecycle/observe.js +6 -1
- package/dist/lifecycle/query.d.ts +94 -6
- package/dist/lifecycle/query.d.ts.map +1 -1
- package/dist/lifecycle/query.js +182 -9
- package/dist/lifecycle/release-catalog-site.d.ts +66 -0
- package/dist/lifecycle/release-catalog-site.d.ts.map +1 -0
- package/dist/lifecycle/release-catalog-site.js +232 -0
- package/dist/lifecycle/release-catalog.d.ts +201 -0
- package/dist/lifecycle/release-catalog.d.ts.map +1 -0
- package/dist/lifecycle/release-catalog.js +198 -0
- package/dist/lifecycle/release-changelog.d.ts +41 -0
- package/dist/lifecycle/release-changelog.d.ts.map +1 -0
- package/dist/lifecycle/release-changelog.js +38 -0
- package/dist/lifecycle/release-cut.d.ts +1 -0
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +1 -1
- package/dist/lifecycle/release-ledger.d.ts +16 -0
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +10 -0
- package/dist/lifecycle/release-publish.d.ts +43 -22
- package/dist/lifecycle/release-publish.d.ts.map +1 -1
- package/dist/lifecycle/release-read.d.ts.map +1 -1
- package/dist/lifecycle/release-read.js +3 -0
- package/dist/lifecycle/release-status.d.ts +86 -0
- package/dist/lifecycle/release-status.d.ts.map +1 -0
- package/dist/lifecycle/release-status.js +136 -0
- package/dist/lifecycle/replay.d.ts +10 -3
- package/dist/lifecycle/replay.d.ts.map +1 -1
- package/dist/lifecycle/replay.js +10 -6
- package/dist/lifecycle/resource-lock.d.ts +120 -0
- package/dist/lifecycle/resource-lock.d.ts.map +1 -0
- package/dist/lifecycle/resource-lock.js +317 -0
- package/dist/lifecycle/retention.d.ts.map +1 -1
- package/dist/lifecycle/retention.js +3 -0
- package/dist/lifecycle/run-ledger.d.ts.map +1 -1
- package/dist/lifecycle/run-ledger.js +9 -1
- package/dist/lifecycle/scenario.d.ts +4 -3
- package/dist/lifecycle/scenario.d.ts.map +1 -1
- package/dist/lifecycle/snapshot-store-fake.d.ts +9 -0
- package/dist/lifecycle/snapshot-store-fake.d.ts.map +1 -0
- package/dist/lifecycle/snapshot-store-fake.js +21 -0
- package/dist/lifecycle/snapshot-store-s3.d.ts +135 -0
- package/dist/lifecycle/snapshot-store-s3.d.ts.map +1 -0
- package/dist/lifecycle/snapshot-store-s3.js +219 -0
- package/dist/lifecycle/snapshot-store.d.ts +170 -0
- package/dist/lifecycle/snapshot-store.d.ts.map +1 -0
- package/dist/lifecycle/snapshot-store.js +831 -0
- package/dist/lifecycle/snapshot.d.ts +11 -0
- package/dist/lifecycle/snapshot.d.ts.map +1 -1
- package/dist/lifecycle/snapshot.js +18 -5
- package/dist/lifecycle/target-lock.d.ts +15 -0
- package/dist/lifecycle/target-lock.d.ts.map +1 -1
- package/dist/lifecycle/target-lock.js +25 -10
- package/dist/lifecycle/type-listing.d.ts +148 -0
- package/dist/lifecycle/type-listing.d.ts.map +1 -0
- package/dist/lifecycle/type-listing.js +166 -0
- package/dist/lint/component-checks.d.ts +15 -1
- package/dist/lint/component-checks.d.ts.map +1 -1
- package/dist/lint/component-checks.js +1 -0
- package/dist/lint/presets/relaxed.json +2 -1
- package/dist/lint/presets/strict.json +2 -1
- package/dist/lint/rules/__fixtures__/comp/comp008/fail/dns.component.d.ts +4 -0
- package/dist/lint/rules/__fixtures__/comp/comp008/fail/dns.component.d.ts.map +1 -0
- package/dist/lint/rules/__fixtures__/comp/comp008/fail/dns.component.js +13 -0
- package/dist/lint/rules/__fixtures__/comp/comp008/pass/dns.component.d.ts +4 -0
- package/dist/lint/rules/__fixtures__/comp/comp008/pass/dns.component.d.ts.map +1 -0
- package/dist/lint/rules/__fixtures__/comp/comp008/pass/dns.component.js +8 -0
- package/dist/lint/rules/comp/comp008-applies-signal-only-root.d.ts +33 -0
- package/dist/lint/rules/comp/comp008-applies-signal-only-root.d.ts.map +1 -0
- package/dist/lint/rules/comp/comp008-applies-signal-only-root.js +123 -0
- package/dist/lint/rules/comp/index.d.ts +2 -1
- package/dist/lint/rules/comp/index.d.ts.map +1 -1
- package/dist/lint/rules/comp/index.js +4 -1
- package/dist/mcp/types.d.ts +7 -0
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/notify-product.d.ts +43 -0
- package/dist/notify-product.d.ts.map +1 -0
- package/dist/notify-product.js +58 -0
- package/dist/notify-relay.d.ts +197 -0
- package/dist/notify-relay.d.ts.map +1 -0
- package/dist/notify-relay.js +321 -0
- package/dist/notify.d.ts +44 -4
- package/dist/notify.d.ts.map +1 -1
- package/dist/notify.js +77 -14
- package/dist/object-store/azure-blob.d.ts +129 -0
- package/dist/object-store/azure-blob.d.ts.map +1 -0
- package/dist/object-store/azure-blob.js +341 -0
- package/dist/object-store/common.d.ts +108 -0
- package/dist/object-store/common.d.ts.map +1 -0
- package/dist/object-store/common.js +80 -0
- package/dist/object-store/errors.d.ts +28 -0
- package/dist/object-store/errors.d.ts.map +1 -0
- package/dist/object-store/errors.js +21 -0
- package/dist/object-store/from-env.d.ts +18 -0
- package/dist/object-store/from-env.d.ts.map +1 -0
- package/dist/object-store/from-env.js +22 -0
- package/dist/object-store/gcs.d.ts +106 -0
- package/dist/object-store/gcs.d.ts.map +1 -0
- package/dist/object-store/gcs.js +393 -0
- package/dist/object-store/index.d.ts +9 -0
- package/dist/object-store/index.d.ts.map +1 -0
- package/dist/object-store/index.js +8 -0
- package/dist/object-store/s3.d.ts +146 -0
- package/dist/object-store/s3.d.ts.map +1 -0
- package/dist/object-store/s3.js +306 -0
- package/dist/observation.d.ts +19 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +18 -1
- package/dist/op/activities/activity-contracts.d.ts +1 -1
- package/dist/op/activities/activity-contracts.js +1 -1
- package/dist/op/activities/change-set.d.ts +6 -4
- package/dist/op/activities/change-set.d.ts.map +1 -1
- package/dist/op/activities/change-set.js +4 -2
- package/dist/op/activities/converge.d.ts.map +1 -1
- package/dist/op/activities/converge.js +2 -1
- package/dist/op/activities/index.d.ts +1 -1
- package/dist/op/activities/index.d.ts.map +1 -1
- package/dist/op/activities/index.js +1 -1
- package/dist/op/activities/review-agent.d.ts +55 -2
- package/dist/op/activities/review-agent.d.ts.map +1 -1
- package/dist/op/activities/review-agent.js +65 -5
- package/dist/op/activity-failure.d.ts +27 -0
- package/dist/op/activity-failure.d.ts.map +1 -1
- package/dist/op/activity-failure.js +31 -0
- package/dist/op/gate.d.ts +29 -1
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +59 -23
- package/dist/op/generate-pipeline.d.ts.map +1 -1
- package/dist/op/generate-pipeline.js +7 -1
- package/dist/op/index.d.ts +14 -2
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +8 -2
- package/dist/op/local-executor.d.ts +5 -1
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/local-executor.js +22 -8
- package/dist/op/op-waves-after-plan.d.ts +137 -0
- package/dist/op/op-waves-after-plan.d.ts.map +1 -0
- package/dist/op/op-waves-after-plan.js +163 -0
- package/dist/op/op-waves-capability-spec.d.ts +55 -0
- package/dist/op/op-waves-capability-spec.d.ts.map +1 -0
- package/dist/op/op-waves-capability-spec.js +94 -0
- package/dist/op/op-waves-capability.d.ts +197 -0
- package/dist/op/op-waves-capability.d.ts.map +1 -0
- package/dist/op/op-waves-capability.js +311 -0
- package/dist/op/op-waves-events.d.ts +54 -0
- package/dist/op/op-waves-events.d.ts.map +1 -0
- package/dist/op/op-waves-events.js +122 -0
- package/dist/op/op-waves-notify.d.ts +7 -1
- package/dist/op/op-waves-notify.d.ts.map +1 -1
- package/dist/op/op-waves-notify.js +35 -16
- package/dist/op/op-waves-release-port.d.ts +18 -0
- package/dist/op/op-waves-release-port.d.ts.map +1 -0
- package/dist/op/op-waves-release-port.js +61 -0
- package/dist/op/op-waves-release.d.ts +92 -0
- package/dist/op/op-waves-release.d.ts.map +1 -0
- package/dist/op/op-waves-release.js +97 -0
- package/dist/op/op-waves-run.d.ts +175 -4
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +981 -41
- package/dist/op/op-waves-stand-down.d.ts +60 -0
- package/dist/op/op-waves-stand-down.d.ts.map +1 -0
- package/dist/op/op-waves-stand-down.js +97 -0
- package/dist/op/op-waves.d.ts +152 -8
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +161 -17
- package/dist/op/runtime.d.ts +91 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/op/runtime.js +19 -0
- package/dist/op/stage-hooks.d.ts +45 -7
- package/dist/op/stage-hooks.d.ts.map +1 -1
- package/dist/op/stage-hooks.js +61 -3
- package/dist/op/steward-beside.d.ts.map +1 -1
- package/dist/op/steward-beside.js +2 -1
- package/dist/op/types.d.ts +2 -2
- package/dist/op/types.d.ts.map +1 -1
- package/dist/op/types.js +3 -2
- package/dist/otlp-metrics.d.ts +38 -0
- package/dist/otlp-metrics.d.ts.map +1 -0
- package/dist/otlp-metrics.js +82 -0
- package/dist/otlp.d.ts +249 -0
- package/dist/otlp.d.ts.map +1 -0
- package/dist/otlp.js +426 -0
- package/dist/override-gate.d.ts.map +1 -1
- package/dist/override-gate.js +5 -0
- package/dist/policy-packs.d.ts +69 -0
- package/dist/policy-packs.d.ts.map +1 -0
- package/dist/policy-packs.js +205 -0
- package/dist/policy-source.d.ts +51 -0
- package/dist/policy-source.d.ts.map +1 -0
- package/dist/policy-source.js +103 -0
- package/dist/pr-forge.d.ts +40 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +92 -0
- package/dist/pr-loop.d.ts +205 -12
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +330 -41
- package/dist/pr-post.d.ts +16 -0
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +26 -1
- package/dist/pr-report-url.d.ts +32 -4
- package/dist/pr-report-url.d.ts.map +1 -1
- package/dist/pr-report-url.js +46 -5
- package/dist/pr-requires.d.ts +13 -2
- package/dist/pr-requires.d.ts.map +1 -1
- package/dist/pr-requires.js +14 -0
- package/dist/pulumi-urn.d.ts +101 -0
- package/dist/pulumi-urn.d.ts.map +1 -0
- package/dist/pulumi-urn.js +131 -0
- package/dist/release-floors.d.ts +23 -0
- package/dist/release-floors.d.ts.map +1 -0
- package/dist/release-floors.js +22 -0
- package/dist/run-event.d.ts +26 -1
- package/dist/run-event.d.ts.map +1 -1
- package/dist/run-event.js +4 -1
- package/dist/sensitive-key.d.ts +23 -0
- package/dist/sensitive-key.d.ts.map +1 -0
- package/dist/sensitive-key.js +31 -0
- package/dist/sorted-json.d.ts +10 -0
- package/dist/sorted-json.d.ts.map +1 -0
- package/dist/sorted-json.js +14 -0
- package/dist/terraform/credentials.d.ts +59 -0
- package/dist/terraform/credentials.d.ts.map +1 -0
- package/dist/terraform/credentials.js +149 -0
- package/dist/utils.d.ts +1 -4
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -9
- package/dist/wave-runtime.d.ts +1 -1
- package/dist/wave-runtime.js +2 -2
- package/dist/wave-runtime.mjs +390 -285
- package/dist/workspace/adoption-report.d.ts +53 -0
- package/dist/workspace/adoption-report.d.ts.map +1 -0
- package/dist/workspace/adoption-report.js +76 -0
- package/dist/workspace/capabilities-contract.d.ts +7 -0
- package/dist/workspace/capabilities-contract.d.ts.map +1 -1
- package/dist/workspace/capabilities-contract.js +2 -1
- package/dist/workspace/capabilities.schema.json +98 -0
- package/dist/workspace/change-set.schema.json +42 -3
- package/dist/workspace/chant-migrations/chud-lexicon-exit.d.ts.map +1 -1
- package/dist/workspace/chant-migrations/chud-lexicon-exit.js +4 -1
- package/dist/workspace/ci-cloud-identity.d.ts +13 -1
- package/dist/workspace/ci-cloud-identity.d.ts.map +1 -1
- package/dist/workspace/ci-cloud-identity.js +30 -1
- package/dist/workspace/ci-lock-grain.d.ts +12 -0
- package/dist/workspace/ci-lock-grain.d.ts.map +1 -0
- package/dist/workspace/ci-lock-grain.js +27 -0
- package/dist/workspace/ci-run.d.ts +2 -1
- package/dist/workspace/ci-run.d.ts.map +1 -1
- package/dist/workspace/ci-run.js +6 -3
- package/dist/workspace/compose-graph.d.ts +10 -1
- package/dist/workspace/compose-graph.d.ts.map +1 -1
- package/dist/workspace/compose-graph.js +6 -1
- package/dist/workspace/conformance/index.d.ts +1 -1
- package/dist/workspace/conformance/index.d.ts.map +1 -1
- package/dist/workspace/conformance/index.js +6 -1
- package/dist/workspace/declaration.d.ts +16 -4
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +5 -2
- package/dist/workspace/declaration.schema.json +27 -3
- package/dist/workspace/drift-cli.d.ts +81 -0
- package/dist/workspace/drift-cli.d.ts.map +1 -0
- package/dist/workspace/drift-cli.js +322 -0
- package/dist/workspace/drift.schema.json +672 -0
- package/dist/workspace/exit-cli.d.ts +1 -1
- package/dist/workspace/exit-cli.d.ts.map +1 -1
- package/dist/workspace/exit-cli.js +2 -1
- package/dist/workspace/graph-cli.d.ts +2 -0
- package/dist/workspace/graph-cli.d.ts.map +1 -1
- package/dist/workspace/graph-cli.js +3 -0
- package/dist/workspace/graph.schema.json +72 -0
- package/dist/workspace/import-fetch.d.ts +4 -2
- package/dist/workspace/import-fetch.d.ts.map +1 -1
- package/dist/workspace/import-fetch.js +4 -2
- package/dist/workspace/import-init.d.ts.map +1 -1
- package/dist/workspace/import-init.js +4 -2
- package/dist/workspace/init.d.ts +5 -1
- package/dist/workspace/init.d.ts.map +1 -1
- package/dist/workspace/init.js +55 -9
- package/dist/workspace/ledger.schema.json +7 -3
- package/dist/workspace/lineage-upgrade-cli.d.ts +1 -1
- package/dist/workspace/lineage-upgrade-cli.d.ts.map +1 -1
- package/dist/workspace/lineage-upgrade-cli.js +2 -1
- package/dist/workspace/nested-graph.d.ts.map +1 -1
- package/dist/workspace/nested-graph.js +2 -0
- package/dist/workspace/pr-report.schema.json +125 -5
- package/dist/workspace/promote-waves.d.ts +112 -0
- package/dist/workspace/promote-waves.d.ts.map +1 -0
- package/dist/workspace/promote-waves.js +290 -0
- package/dist/workspace/promote.d.ts +85 -3
- package/dist/workspace/promote.d.ts.map +1 -1
- package/dist/workspace/promote.js +349 -62
- package/dist/workspace/reason-codes.d.ts +12 -0
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/reason-codes.js +14 -0
- package/dist/workspace/records-cli.d.ts +2 -2
- package/dist/workspace/records-cli.d.ts.map +1 -1
- package/dist/workspace/records-cli.js +3 -2
- package/dist/workspace/release-catalog.schema.json +277 -0
- package/dist/workspace/run-event.schema.json +18 -1
- package/dist/workspace/search-contract.d.ts +3 -3
- package/dist/workspace/search-contract.d.ts.map +1 -1
- package/dist/workspace/search-contract.js +2 -0
- package/dist/workspace/search.schema.json +103 -5
- package/dist/workspace/work-cli.d.ts +3 -1
- package/dist/workspace/work-cli.d.ts.map +1 -1
- package/dist/workspace/work-cli.js +7 -2
- package/dist/workspace/workspace-run.d.ts.map +1 -1
- package/dist/workspace/workspace-run.js +2 -1
- package/package.json +34 -1
- package/src/__fixtures__/drift-record/README.md +58 -0
- package/src/__fixtures__/drift-record/choudoufu-cone.ndjson +4 -0
- package/src/__fixtures__/drift-record/choudoufu-resource.ndjson +3 -0
- package/src/__fixtures__/drift-record/component-status-ledger.json +65 -0
- package/src/__fixtures__/drift-record/component-status.json +91 -0
- package/src/__fixtures__/drift-record/deep-diff.json +259 -0
- package/src/__fixtures__/drift-record/lifecycle-diff-live.json +825 -0
- package/src/__fixtures__/drift-record/live-diff.json +125 -0
- package/src/__fixtures__/estate-ledger.ts +101 -0
- package/src/__fixtures__/oidc-emulator.ts +31 -2
- package/src/__fixtures__/product-words.ts +44 -0
- package/src/__golden__/wave-loop/op-by-apply-after-fails.json +10 -2
- package/src/__golden__/wave-loop/op-by-apply-hold.json +20 -4
- package/src/__golden__/wave-loop/op-by-apply-ignored.json +10 -2
- package/src/__golden__/wave-loop/op-by-apply-pass.json +10 -2
- package/src/__golden__/wave-loop/op-by-apply-skip.json +10 -2
- package/src/__golden__/wave-loop/op-discover-rest-stops.json +22 -6
- package/src/__golden__/wave-loop/op-discover-rest.json +44 -12
- package/src/__golden__/wave-loop/op-discover-wide.json +12 -3
- package/src/__golden__/wave-loop/op-held-on.json +28 -7
- package/src/__golden__/wave-loop/op-hooks-apply-fails.json +22 -6
- package/src/__golden__/wave-loop/op-hooks-fail-after-apply.json +22 -6
- package/src/__golden__/wave-loop/op-hooks-fail-before-apply.json +4 -2
- package/src/__golden__/wave-loop/op-hooks-held.json +26 -8
- package/src/__golden__/wave-loop/op-hooks-hold-before-apply.json +18 -4
- package/src/__golden__/wave-loop/op-hooks-pass.json +22 -6
- package/src/__golden__/wave-loop/op-hooks-share.json +20 -7
- package/src/__golden__/wave-loop/op-outcome-held.json +12 -3
- package/src/__golden__/wave-loop/op-outcome-replan-approved.json +16 -5
- package/src/__golden__/wave-loop/op-outcome-replan-forever.json +48 -21
- package/src/__golden__/wave-loop/op-outcome-replan.json +16 -5
- package/src/__golden__/wave-loop/op-outcome-stood-down.json +12 -3
- package/src/__golden__/wave-loop/op-outcome-unreadable.json +12 -3
- package/src/__golden__/wave-loop/op-overridden.json +28 -7
- package/src/__golden__/wave-loop/op-per-run.json +20 -4
- package/src/__golden__/wave-loop/op-point.json +18 -4
- package/src/__golden__/wave-loop/op-pr-review.json +10 -2
- package/src/__golden__/wave-loop/op-spend-change-only.json +10 -2
- package/src/__golden__/wave-loop/op-spend.json +10 -2
- package/src/__golden__/wave-loop/op-wave-commands.json +56 -13
- package/src/__golden__/wave-loop/op-wide.json +20 -4
- package/src/audit/discover.e2e.test.ts +14 -0
- package/src/audit/discover.ts +3 -1
- package/src/behaviour.ts +1 -1
- package/src/bucket-check/azure.ts +307 -0
- package/src/bucket-check/bucket-check.test.ts +210 -0
- package/src/bucket-check/fixtures/azure.json +153 -0
- package/src/bucket-check/fixtures/gcs.json +148 -0
- package/src/bucket-check/fixtures/s3.json +277 -0
- package/src/bucket-check/gcs.ts +257 -0
- package/src/bucket-check/index.ts +61 -0
- package/src/bucket-check/s3.ts +433 -0
- package/src/bucket-check/types.ts +75 -0
- package/src/bucket-check/wire.ts +50 -0
- package/src/bucket-check.ts +5 -0
- package/src/capabilities/templates.json +145 -0
- package/src/capabilities/templates.test.ts +211 -0
- package/src/capabilities/templates.ts +203 -0
- package/src/cdk/advise.test.ts +1 -1
- package/src/change-set-bundle.test.ts +82 -0
- package/src/change-set-graph.ts +80 -9
- package/src/change-set.test.ts +24 -0
- package/src/change-set.ts +76 -14
- package/src/ci-agent.test.ts +348 -0
- package/src/ci-agent.ts +1026 -0
- package/src/ci-control.ts +174 -0
- package/src/ci-estate/delivery.ts +433 -0
- package/src/ci-estate/overdue.ts +81 -0
- package/src/ci-estate/page.ts +343 -0
- package/src/ci-estate/rows.ts +251 -0
- package/src/ci-estate.test.ts +281 -0
- package/src/ci-estate.ts +176 -0
- package/src/ci-handover.ts +67 -16
- package/src/ci-identity-database.test.ts +55 -0
- package/src/ci-identity-pulumi.test.ts +163 -0
- package/src/ci-identity-targets.test.ts +29 -2
- package/src/ci-identity.ts +134 -26
- package/src/ci-product-words.test.ts +101 -0
- package/src/ci-product-words.ts +536 -0
- package/src/ci-product.ts +174 -0
- package/src/ci-shared-reads.test.ts +145 -0
- package/src/cli/commands/audit.test.ts +1 -1
- package/src/cli/commands/audit.ts +3 -2
- package/src/cli/commands/carve.test.ts +1 -1
- package/src/cli/commands/carve.ts +2 -2
- package/src/cli/commands/import-index.test.ts +117 -0
- package/src/cli/commands/import-index.ts +265 -0
- package/src/cli/commands/init.ts +3 -1
- package/src/cli/commands/lint.ts +4 -2
- package/src/cli/component-wave-args.test.ts +16 -0
- package/src/cli/handlers/agent.ts +126 -0
- package/src/cli/handlers/approve-confirm.test.ts +276 -0
- package/src/cli/handlers/approve-confirm.ts +200 -0
- package/src/cli/handlers/approve.ts +18 -1
- package/src/cli/handlers/build.test.ts +7 -0
- package/src/cli/handlers/build.ts +44 -1
- package/src/cli/handlers/ci-check.ts +33 -0
- package/src/cli/handlers/ci-forge-check.ts +91 -0
- package/src/cli/handlers/components.test.ts +9 -0
- package/src/cli/handlers/components.ts +12 -2
- package/src/cli/handlers/fan-out.test.ts +10 -10
- package/src/cli/handlers/fan-out.ts +22 -3
- package/src/cli/handlers/gate-pending.ts +46 -0
- package/src/cli/handlers/graph.test.ts +42 -0
- package/src/cli/handlers/graph.ts +26 -4
- package/src/cli/handlers/index-cloud.ts +32 -0
- package/src/cli/handlers/index-diff.test.ts +68 -0
- package/src/cli/handlers/index-diff.ts +146 -0
- package/src/cli/handlers/init.ts +1 -0
- package/src/cli/handlers/ledger-root-member.test.ts +161 -0
- package/src/cli/handlers/ledger.ts +1 -1
- package/src/cli/handlers/lifecycle-drift.ts +73 -0
- package/src/cli/handlers/lifecycle.test.ts +33 -11
- package/src/cli/handlers/lifecycle.ts +205 -30
- package/src/cli/handlers/lock.test.ts +29 -2
- package/src/cli/handlers/lock.ts +66 -6
- package/src/cli/handlers/misc.ts +73 -0
- package/src/cli/handlers/notify-relay.ts +130 -0
- package/src/cli/handlers/pr-before-merge.test.ts +2 -1
- package/src/cli/handlers/pr-deploy-inputs.test.ts +7 -7
- package/src/cli/handlers/pr-env.ts +48 -11
- package/src/cli/handlers/pr-plan-targets.test.ts +155 -0
- package/src/cli/handlers/pr-waves-blocked.test.ts +42 -2
- package/src/cli/handlers/pr-waves.test.ts +8 -2
- package/src/cli/handlers/pr.test.ts +8 -8
- package/src/cli/handlers/pr.ts +669 -207
- package/src/cli/handlers/promote.test.ts +69 -5
- package/src/cli/handlers/promote.ts +103 -8
- package/src/cli/handlers/query.ts +27 -4
- package/src/cli/handlers/release.ts +2 -0
- package/src/cli/handlers/run-components-exit.test.ts +7 -7
- package/src/cli/handlers/run-declared-reads-cli.test.ts +187 -0
- package/src/cli/handlers/run-groups-cli.test.ts +229 -0
- package/src/cli/handlers/run-wave.ts +65 -1
- package/src/cli/handlers/run.test.ts +6 -4
- package/src/cli/handlers/run.ts +86 -1
- package/src/cli/handlers/scenario.test.ts +13 -0
- package/src/cli/handlers/scenario.ts +8 -7
- package/src/cli/handlers/search-index.test.ts +255 -0
- package/src/cli/handlers/search-json.test.ts +1 -1
- package/src/cli/handlers/search-ownership.test.ts +194 -0
- package/src/cli/handlers/search.ts +271 -38
- package/src/cli/handlers/serve.ts +10 -1
- package/src/cli/main.test.ts +7 -0
- package/src/cli/main.ts +182 -14
- package/src/cli/mcp/ledger-tools.ts +126 -0
- package/src/cli/mcp/lifecycle-tools.ts +3 -2
- package/src/cli/mcp/product-tools.test.ts +123 -0
- package/src/cli/mcp/product-tools.ts +129 -0
- package/src/cli/mcp/read-only.test.ts +134 -0
- package/src/cli/mcp/read-only.ts +68 -0
- package/src/cli/mcp/report-tools.ts +135 -0
- package/src/cli/mcp/resource-handlers.ts +4 -3
- package/src/cli/mcp/server.test.ts +5 -4
- package/src/cli/mcp/server.ts +90 -16
- package/src/cli/mcp/workspace-tools.ts +1 -1
- package/src/cli/mcp-config.ts +8 -3
- package/src/cli/parse-args.ts +82 -4
- package/src/cli/registry.ts +54 -1
- package/src/cloud-lister/aws.test.ts +202 -0
- package/src/cloud-lister/aws.ts +226 -0
- package/src/cloud-lister/azure.test.ts +132 -0
- package/src/cloud-lister/azure.ts +142 -0
- package/src/cloud-lister/common.ts +115 -0
- package/src/cloud-lister/credentials.ts +110 -0
- package/src/cloud-lister/fakes.ts +66 -0
- package/src/cloud-lister/gcp.test.ts +121 -0
- package/src/cloud-lister/gcp.ts +159 -0
- package/src/cloud-lister/guard.test.ts +198 -0
- package/src/cloud-lister/guard.ts +111 -0
- package/src/cloud-lister/ids.ts +54 -0
- package/src/cloud-lister/index.ts +134 -0
- package/src/cloud-lister/kubernetes.test.ts +160 -0
- package/src/cloud-lister/kubernetes.ts +284 -0
- package/src/cloud-lister/markers.ts +74 -0
- package/src/cloud-lister/mask.ts +77 -0
- package/src/cloud-lister/shape.test.ts +81 -0
- package/src/cloud-lister/sigv4.ts +127 -0
- package/src/cloud-lister/transport.ts +118 -0
- package/src/cloud-lister/types.ts +135 -0
- package/src/components/adoption.test.ts +140 -0
- package/src/components/adoption.ts +141 -0
- package/src/components/apply-lease.ts +49 -0
- package/src/components/capability-plugin-loader.ts +4 -0
- package/src/components/capability-plugin.ts +10 -0
- package/src/components/capability.ts +359 -6
- package/src/components/check-hooks.test.ts +66 -0
- package/src/components/check-hooks.ts +252 -0
- package/src/components/ci-services.test.ts +51 -0
- package/src/components/ci-services.ts +83 -0
- package/src/components/cli-support.ts +92 -15
- package/src/components/declared-reads.test.ts +103 -0
- package/src/components/declared-reads.ts +134 -0
- package/src/components/deploy-units.ts +4 -0
- package/src/components/driver.test.ts +3 -3
- package/src/components/driver.ts +127 -9
- package/src/components/fan-out-run.ts +163 -33
- package/src/components/fan-out-support.ts +10 -1
- package/src/components/fan-out.ts +30 -0
- package/src/components/groups.test.ts +320 -0
- package/src/components/groups.ts +895 -0
- package/src/components/index.ts +42 -0
- package/src/components/plan-shape-conformance.ts +130 -0
- package/src/components/pr-comment-preview.test.ts +54 -0
- package/src/components/pr-env-ledger.test.ts +9 -0
- package/src/components/pr-env-ledger.ts +43 -0
- package/src/components/pr-env-ports.ts +29 -4
- package/src/components/pr-env-run-bundle.test.ts +10 -0
- package/src/components/pr-env-run.test.ts +19 -0
- package/src/components/pr-env-run.ts +12 -2
- package/src/components/pr-environment.test.ts +29 -0
- package/src/components/pr-environment.ts +39 -7
- package/src/components/pr-pipeline.test.ts +15 -0
- package/src/components/pr-pipeline.ts +274 -9
- package/src/components/pr-policy.ts +45 -7
- package/src/components/pr-run.test.ts +516 -3
- package/src/components/pr-run.ts +350 -44
- package/src/components/pr-targets.test.ts +35 -0
- package/src/components/pr-targets.ts +45 -0
- package/src/components/product-pipeline.test.ts +200 -0
- package/src/components/product-pipeline.ts +341 -0
- package/src/components/promote-rounds.ts +25 -2
- package/src/components/promote.ts +64 -5
- package/src/components/registry.test.ts +1 -1
- package/src/components/release-compile.ts +87 -1
- package/src/components/release-gate.ts +115 -30
- package/src/components/release-groups.test.ts +362 -0
- package/src/components/release-promote.ts +65 -1
- package/src/components/repo-lock.ts +52 -0
- package/src/components/row-lease.test.ts +490 -0
- package/src/components/row-lease.ts +167 -0
- package/src/components/run-groups.ts +113 -0
- package/src/components/starter-plugin.ts +6 -0
- package/src/components/verbs/index.ts +1 -0
- package/src/components/verbs/member-outputs.test.ts +205 -0
- package/src/components/verbs/member-outputs.ts +308 -0
- package/src/components/wave-plan-policy.test.ts +19 -0
- package/src/components/wave-plan.ts +78 -4
- package/src/config.ts +44 -0
- package/src/control/__fixtures__/consumers/apps/consumers.json +15 -0
- package/src/control/__fixtures__/consumers/infra/consumers.json +23 -0
- package/src/control/applied.test.ts +148 -0
- package/src/control/applied.ts +191 -0
- package/src/control/consumers.test.ts +129 -0
- package/src/control/consumers.ts +192 -0
- package/src/control/control.test.ts +302 -0
- package/src/control/dispatch.ts +699 -0
- package/src/control/edges.test.ts +112 -0
- package/src/control/edges.ts +164 -0
- package/src/control/note-checkout.test.ts +91 -0
- package/src/control/reconcile.ts +250 -0
- package/src/control/records.ts +395 -0
- package/src/deep-observation.ts +5 -23
- package/src/discovery/sandbox/bundle.ts +25 -1
- package/src/drift-record.test.ts +596 -0
- package/src/drift-record.ts +1206 -0
- package/src/engine-facts.guard.test.ts +111 -0
- package/src/engine-facts.test.ts +177 -0
- package/src/engine-facts.ts +153 -0
- package/src/exit-codes.test.ts +31 -0
- package/src/exit-codes.ts +55 -0
- package/src/forge-check/check.ts +155 -0
- package/src/forge-check/contract.ts +215 -0
- package/src/forge-check/forge-check.test.ts +427 -0
- package/src/forge-check/forge.ts +318 -0
- package/src/forge-check/index.ts +43 -0
- package/src/forge-check/pulumi.ts +192 -0
- package/src/forge-check/read-only.ts +56 -0
- package/src/forge-check/trust.ts +527 -0
- package/src/forge-check/types.ts +78 -0
- package/src/forge-check.ts +5 -0
- package/src/gate-decision-bundle.test.ts +13 -0
- package/src/gate-decision.ts +3 -0
- package/src/gate-policy.ts +92 -3
- package/src/gated-waves-bundle.test.ts +1 -0
- package/src/graph-ir-live.test.ts +92 -0
- package/src/graph-ir.ts +317 -7
- package/src/graph-refs.ts +416 -0
- package/src/graph-schema/fixtures/adopt.json +15 -0
- package/src/graph-schema/fixtures/choudoufu.engine-graph.json +169 -0
- package/src/graph-schema/fixtures/index.json +68 -0
- package/src/graph-schema/fixtures/plunge.engine-graph.json +158 -0
- package/src/graph-schema/fixtures.ts +267 -0
- package/src/graph-schema/generate.ts +263 -0
- package/src/graph-schema/graph-schema.test.ts +153 -0
- package/src/graph-schema/graph.schema.json +1387 -0
- package/src/health.schema.json +2 -1
- package/src/identity.ts +2 -0
- package/src/index.ts +4 -0
- package/src/instance-nodes.ts +288 -0
- package/src/lexicon.ts +171 -6
- package/src/lifecycle/__fixtures__/index-diff/20261026T120000Z-aaaaaaaaaaaa.json +149 -0
- package/src/lifecycle/__fixtures__/index-diff/20261026T130000Z-bbbbbbbbbbbb.json +127 -0
- package/src/lifecycle/adoption-file.test.ts +100 -0
- package/src/lifecycle/adoption-file.ts +153 -0
- package/src/lifecycle/cloud-index.test.ts +516 -0
- package/src/lifecycle/cloud-index.ts +735 -0
- package/src/lifecycle/control-entries-ledger.test.ts +70 -0
- package/src/lifecycle/derive-edges.test.ts +193 -0
- package/src/lifecycle/derive-edges.ts +182 -0
- package/src/lifecycle/gate-applied.ts +6 -0
- package/src/lifecycle/gate-ledger.ts +36 -1
- package/src/lifecycle/gate-pending-by-plan.test.ts +69 -0
- package/src/lifecycle/gate-pending-by-plan.ts +133 -0
- package/src/lifecycle/gated-request-digest.ts +49 -0
- package/src/lifecycle/gated-request-ledger.test.ts +53 -0
- package/src/lifecycle/gated-request.ts +280 -0
- package/src/lifecycle/git.ts +10 -4
- package/src/lifecycle/identity-match.test.ts +308 -0
- package/src/lifecycle/identity-match.ts +276 -0
- package/src/lifecycle/index-diff.test.ts +198 -0
- package/src/lifecycle/index-diff.ts +475 -0
- package/src/lifecycle/index-document.test.ts +64 -0
- package/src/lifecycle/index-document.ts +298 -0
- package/src/lifecycle/index-drift.test.ts +191 -0
- package/src/lifecycle/index-drift.ts +304 -0
- package/src/lifecycle/index-import.test.ts +269 -0
- package/src/lifecycle/index-import.ts +654 -0
- package/src/lifecycle/index-join.test.ts +250 -0
- package/src/lifecycle/index-join.ts +304 -0
- package/src/lifecycle/index-store-load-bearing.test.ts +187 -0
- package/src/lifecycle/index.ts +4 -0
- package/src/lifecycle/ledger-read.ts +7 -3
- package/src/lifecycle/lock-rows.test.ts +109 -0
- package/src/lifecycle/lock-rows.ts +167 -0
- package/src/lifecycle/member-ledger.test.ts +25 -7
- package/src/lifecycle/observation-baseline.test.ts +72 -1
- package/src/lifecycle/observation-baseline.ts +190 -27
- package/src/lifecycle/observe.ts +6 -1
- package/src/lifecycle/publish-target-context.test.ts +108 -0
- package/src/lifecycle/query.test.ts +68 -1
- package/src/lifecycle/query.ts +208 -13
- package/src/lifecycle/release-catalog-site.test.ts +142 -0
- package/src/lifecycle/release-catalog-site.ts +291 -0
- package/src/lifecycle/release-catalog.test.ts +193 -0
- package/src/lifecycle/release-catalog.ts +353 -0
- package/src/lifecycle/release-changelog.test.ts +70 -0
- package/src/lifecycle/release-changelog.ts +71 -0
- package/src/lifecycle/release-cut.ts +2 -2
- package/src/lifecycle/release-ledger.ts +20 -0
- package/src/lifecycle/release-publish.ts +45 -22
- package/src/lifecycle/release-read.ts +2 -0
- package/src/lifecycle/release-status.test.ts +186 -0
- package/src/lifecycle/release-status.ts +176 -0
- package/src/lifecycle/replay.test.ts +9 -5
- package/src/lifecycle/replay.ts +9 -5
- package/src/lifecycle/resource-lock.test.ts +175 -0
- package/src/lifecycle/resource-lock.ts +354 -0
- package/src/lifecycle/retention.ts +2 -0
- package/src/lifecycle/run-ledger.ts +7 -1
- package/src/lifecycle/scenario.ts +4 -3
- package/src/lifecycle/snapshot-store-fake.ts +29 -0
- package/src/lifecycle/snapshot-store-s3.ts +280 -0
- package/src/lifecycle/snapshot-store.test.ts +385 -0
- package/src/lifecycle/snapshot-store.ts +980 -0
- package/src/lifecycle/snapshot.test.ts +13 -0
- package/src/lifecycle/snapshot.ts +23 -6
- package/src/lifecycle/target-lock.ts +24 -9
- package/src/lifecycle/type-listing.test.ts +166 -0
- package/src/lifecycle/type-listing.ts +309 -0
- package/src/lint/component-checks.ts +17 -1
- package/src/lint/config.test.ts +3 -0
- package/src/lint/presets/relaxed.json +2 -1
- package/src/lint/presets/strict.json +2 -1
- package/src/lint/rules/__fixtures__/comp/comp008/fail/dns.component.ts +15 -0
- package/src/lint/rules/__fixtures__/comp/comp008/pass/dns.component.ts +10 -0
- package/src/lint/rules/comp/comp.test.ts +2 -1
- package/src/lint/rules/comp/comp008-applies-signal-only-root.ts +121 -0
- package/src/lint/rules/comp/comp008.test.ts +77 -0
- package/src/lint/rules/comp/index.ts +4 -1
- package/src/mcp/types.ts +7 -0
- package/src/notify-product.ts +76 -0
- package/src/notify-relay.test.ts +213 -0
- package/src/notify-relay.ts +407 -0
- package/src/notify.ts +95 -14
- package/src/object-store/azure-blob.ts +374 -0
- package/src/object-store/common.ts +133 -0
- package/src/object-store/errors.ts +26 -0
- package/src/object-store/from-env.ts +36 -0
- package/src/object-store/gcs.ts +436 -0
- package/src/object-store/index.ts +8 -0
- package/src/object-store/object-store.test.ts +130 -0
- package/src/object-store/s3.ts +350 -0
- package/src/observation-edges.test.ts +33 -0
- package/src/observation.ts +36 -1
- package/src/op/activities/activity-contracts.ts +1 -1
- package/src/op/activities/change-set.ts +8 -5
- package/src/op/activities/converge.ts +2 -1
- package/src/op/activities/index.ts +1 -1
- package/src/op/activities/review-agent.open.test.ts +78 -0
- package/src/op/activities/review-agent.test.ts +13 -0
- package/src/op/activities/review-agent.ts +89 -5
- package/src/op/activity-failure.ts +36 -0
- package/src/op/gate.ts +81 -22
- package/src/op/generate-pipeline.ts +7 -1
- package/src/op/index.ts +23 -1
- package/src/op/local-executor.test.ts +80 -0
- package/src/op/local-executor.ts +27 -9
- package/src/op/op-waves-after-plan.test.ts +276 -0
- package/src/op/op-waves-after-plan.ts +238 -0
- package/src/op/op-waves-capability-spec.ts +113 -0
- package/src/op/op-waves-capability.test.ts +217 -0
- package/src/op/op-waves-capability.ts +370 -0
- package/src/op/op-waves-events.ts +135 -0
- package/src/op/op-waves-notify-words.test.ts +149 -0
- package/src/op/op-waves-notify.ts +41 -16
- package/src/op/op-waves-pull-request.test.ts +142 -0
- package/src/op/op-waves-release-port.ts +64 -0
- package/src/op/op-waves-release.test.ts +209 -0
- package/src/op/op-waves-release.ts +133 -0
- package/src/op/op-waves-run-record.test.ts +32 -0
- package/src/op/op-waves-run.ts +1142 -49
- package/src/op/op-waves-stand-down.test.ts +240 -0
- package/src/op/op-waves-stand-down.ts +108 -0
- package/src/op/op-waves-trace.test.ts +205 -0
- package/src/op/op-waves.test.ts +112 -0
- package/src/op/op-waves.ts +261 -20
- package/src/op/runtime.ts +104 -0
- package/src/op/stage-hooks-hold-record.test.ts +41 -0
- package/src/op/stage-hooks.ts +91 -12
- package/src/op/steward-beside.ts +2 -1
- package/src/op/types.ts +3 -2
- package/src/otlp-metrics.ts +96 -0
- package/src/otlp.test.ts +243 -0
- package/src/otlp.ts +544 -0
- package/src/override-gate-bundle.test.ts +2 -0
- package/src/override-gate.ts +4 -0
- package/src/policy-packs.ts +230 -0
- package/src/policy-source.test.ts +256 -0
- package/src/policy-source.ts +112 -0
- package/src/pr-forge.ts +123 -0
- package/src/pr-loop-bundle.test.ts +9 -2
- package/src/pr-loop-words.test.ts +155 -0
- package/src/pr-loop.test.ts +43 -0
- package/src/pr-loop.ts +478 -50
- package/src/pr-post.ts +32 -1
- package/src/pr-report-url.ts +62 -6
- package/src/pr-requires.test.ts +37 -1
- package/src/pr-requires.ts +16 -2
- package/src/product-subpaths-plain-node.e2e.test.ts +211 -0
- package/src/pulumi-urn.ts +151 -0
- package/src/release-floors.ts +22 -0
- package/src/run-event.ts +29 -1
- package/src/sensitive-key.ts +34 -0
- package/src/sorted-json.ts +17 -0
- package/src/stage-hooks-bundle.test.ts +8 -0
- package/src/terraform/credentials.test.ts +77 -0
- package/src/terraform/credentials.ts +162 -0
- package/src/utils.ts +2 -11
- package/src/wave-loop-golden.test.ts +2 -1
- package/src/wave-runtime.ts +2 -2
- package/src/workspace/adoption-report.test.ts +61 -0
- package/src/workspace/adoption-report.ts +103 -0
- package/src/workspace/capabilities-contract.test.ts +4 -0
- package/src/workspace/capabilities-contract.ts +9 -1
- package/src/workspace/capabilities.schema.json +98 -0
- package/src/workspace/change-set.schema.json +42 -3
- package/src/workspace/chant-migrations/chud-lexicon-exit.ts +4 -1
- package/src/workspace/ci-cloud-identity.ts +31 -1
- package/src/workspace/ci-lock-grain.test.ts +31 -0
- package/src/workspace/ci-lock-grain.ts +30 -0
- package/src/workspace/ci-report-url.test.ts +1 -1
- package/src/workspace/ci-run.test.ts +1 -1
- package/src/workspace/ci-run.ts +6 -3
- package/src/workspace/compose-graph.test.ts +12 -0
- package/src/workspace/compose-graph.ts +12 -1
- package/src/workspace/conformance/conformance.e2e.test.ts +2 -1
- package/src/workspace/conformance/index.ts +6 -1
- package/src/workspace/declaration.schema.json +27 -3
- package/src/workspace/declaration.test.ts +1 -1
- package/src/workspace/declaration.ts +26 -10
- package/src/workspace/drift-cli.test.ts +65 -0
- package/src/workspace/drift-cli.ts +370 -0
- package/src/workspace/drift.schema.json +672 -0
- package/src/workspace/exit-cli.ts +2 -1
- package/src/workspace/graph-cli.ts +5 -0
- package/src/workspace/graph.schema.json +72 -0
- package/src/workspace/import-fetch.ts +4 -2
- package/src/workspace/import-init.ts +4 -2
- package/src/workspace/init.test.ts +38 -1
- package/src/workspace/init.ts +50 -8
- package/src/workspace/intent-gaps.test.ts +18 -2
- package/src/workspace/ledger.schema.json +7 -3
- package/src/workspace/lineage-upgrade-cli.ts +2 -1
- package/src/workspace/nested-graph.ts +1 -0
- package/src/workspace/pr-report.schema.json +125 -5
- package/src/workspace/promote-waves.test.ts +296 -0
- package/src/workspace/promote-waves.ts +340 -0
- package/src/workspace/promote.test.ts +158 -4
- package/src/workspace/promote.ts +400 -58
- package/src/workspace/reason-codes.test.ts +4 -1
- package/src/workspace/reason-codes.ts +14 -0
- package/src/workspace/records-cli.ts +3 -2
- package/src/workspace/release-catalog.schema.json +277 -0
- package/src/workspace/run-event.schema.json +18 -1
- package/src/workspace/search-contract.ts +2 -0
- package/src/workspace/search.schema.json +103 -5
- package/src/workspace/work-cli.ts +8 -2
- package/src/workspace/workspace-run.ts +2 -1
package/dist/op/op-waves-run.js
CHANGED
|
@@ -49,8 +49,10 @@
|
|
|
49
49
|
* (`pointGateResumable`, #3835).
|
|
50
50
|
*/
|
|
51
51
|
import { execFileSync } from "node:child_process";
|
|
52
|
+
import { createHash } from "node:crypto";
|
|
52
53
|
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
53
54
|
import { dirname, isAbsolute, join, posix } from "node:path";
|
|
55
|
+
import { CHANT_EXIT } from "../exit-codes.js";
|
|
54
56
|
import { decideWaveGate, runWaveLoop, waveDigestMembers, waveSetDigest, writeWaveRecordFile, } from "../wave-engine.js";
|
|
55
57
|
import { blockedMembers, blockedWords, earlierWaveOutcomes, passesThrough, readWaveOutcomeFile, waveOutcomeFileName, writeWaveOutcomeFile, } from "../wave-blocked.js";
|
|
56
58
|
import { approveCommand, evaluateGate, gitGateLedgerPort } from "./gate.js";
|
|
@@ -58,9 +60,20 @@ import { isApprovalSpent } from "../lifecycle/gate-applied.js";
|
|
|
58
60
|
import { samePlanDigest } from "../lifecycle/plan-digest.js";
|
|
59
61
|
import { isLifecycleLocalNote } from "../lifecycle/local-note.js";
|
|
60
62
|
import { ciRunIdFromEnv } from "./gate-run-locator.js";
|
|
63
|
+
import { appendRunRecord, DEFAULT_RUN_ENV } from "../lifecycle/run-ledger.js";
|
|
64
|
+
import { pushLifecycleReport } from "../lifecycle/git.js";
|
|
65
|
+
import { resolveCiJob } from "../lifecycle/release-ledger.js";
|
|
66
|
+
import { foldPolicyRows, opWaveAfterPlanProblems, runOpWaveAfterPlanHooks } from "./op-waves-after-plan.js";
|
|
67
|
+
import { activeOtlp, RunEventTrace } from "../otlp.js";
|
|
68
|
+
import { joinRunEventSinks, resolveRunEventRun } from "../run-event-stream.js";
|
|
69
|
+
import { OpWaveRunEvents } from "./op-waves-events.js";
|
|
70
|
+
import { opWaveReleaseNames } from "./op-waves-release.js";
|
|
71
|
+
import { gitOpWaveReleasePort } from "./op-waves-release-port.js";
|
|
72
|
+
import { gitOpWaveNewerCommit, opWaveStandDownReason, tipAppliesTargets } from "./op-waves-stand-down.js";
|
|
73
|
+
import { applyOpWaveStep, opWaveCosts, opWaveCostVerdict, opWaveHoldsAt, opWaveHoldsProblems, opWavePolicyVerdicts, opWaveRegistry, opWaveStepChangeSet, planJsonOf, planOpWaveStep, } from "./op-waves-capability.js";
|
|
61
74
|
import { changeInvolvement, quorumProblems, quorumRuleLine, quorumRulesFor, quorumWaiting, recordedReviewApprovals, ruleNeedsProof, samePrincipal, trustQuorumJudge, } from "./gate-quorum.js";
|
|
62
75
|
import { OP_WAVE_DEFAULT_APPLY, OP_WAVE_GATE_POLICIES, OP_WAVE_HOOK_MOMENTS, GATE_APPROVAL_SOURCES, assertOpWaveHooks, assertOpWavesSpec, opWaveApplyHooksRunBy, opWaveGateName, opWaveHooksAt, opWaveOutcomeDir, opWavePointAt, opWavePointProblems, opWaveRecordPath, opWaveGroupRuns, opWaveGroupsProblem, opWaveShare, OP_LEDGER_NAME, opWavesInvolvedProblems, } from "./op-waves.js";
|
|
63
|
-
import { OP_WAVE_PENDING_RESERVED, opWaveArgv, pendingFields, readHoldRequest, runHookList, runStageHooks, runStageHooksAsync, spawnExec, spawnExecAsync, } from "./stage-hooks.js";
|
|
76
|
+
import { OP_WAVE_PENDING_RESERVED, opWaveArgv, pendingFields, holdFinishedPath, readHoldFinished, readHoldRequest, runHookList, runHookListAsync, runStageHooks, runStageHooksAsync, spawnExec, spawnExecAsync, } from "./stage-hooks.js";
|
|
64
77
|
export { OP_WAVE_PENDING_RESERVED, opWaveArgv, runStageHooks, runStageHooksAsync, spawnExecAsync };
|
|
65
78
|
export const OP_WAVE_APPLY_OUTCOMES = ["stood-down", "held", "replan"];
|
|
66
79
|
const gitShowAtBase = (base, path, cwd) => {
|
|
@@ -120,7 +133,7 @@ export function readOpWavePolicy(specFile, name, base, cwd, show = gitShowAtBase
|
|
|
120
133
|
const spend = spec.approvals?.spend === true;
|
|
121
134
|
const neverOverMcp = spec.neverOverMcp === true;
|
|
122
135
|
// #3836: the gate's decision point, the spec's for a wave the base does not have yet.
|
|
123
|
-
const asks = { ...pointAtBase(spec, name, `${specFile} at ${sha.slice(0, 12)}`), ...quorumAtBase(spec, `${specFile} at ${sha.slice(0, 12)}`) };
|
|
136
|
+
const asks = { ...pointAtBase(spec, name, `${specFile} at ${sha.slice(0, 12)}`), ...quorumAtBase(spec, `${specFile} at ${sha.slice(0, 12)}`), ...holdsAtBase(spec, `${specFile} at ${sha.slice(0, 12)}`), ...pullRequestGateAtBase(spec) };
|
|
124
137
|
const wave = spec.waves.find((w) => w.name === name);
|
|
125
138
|
if (!wave)
|
|
126
139
|
return { ...absent, spend, neverOverMcp, ...asks };
|
|
@@ -140,6 +153,11 @@ export function readOpWavePolicy(specFile, name, base, cwd, show = gitShowAtBase
|
|
|
140
153
|
}
|
|
141
154
|
return rules;
|
|
142
155
|
}
|
|
156
|
+
/** `approvals.pullRequest.gate` at base (#4550), when it names a gate. */
|
|
157
|
+
function pullRequestGateAtBase(spec) {
|
|
158
|
+
const gate = spec.approvals?.pullRequest?.gate;
|
|
159
|
+
return typeof gate === "string" && OP_LEDGER_NAME.test(gate) ? { pullRequestGate: gate } : {};
|
|
160
|
+
}
|
|
143
161
|
/** The approval rules at base (#4290), or why they cannot be read. A spec at base with none has none. */
|
|
144
162
|
function quorumAtBase(spec, where) {
|
|
145
163
|
const a = spec.approvals;
|
|
@@ -164,6 +182,16 @@ function quorumAtBase(spec, where) {
|
|
|
164
182
|
return { quorumRefused: `the approval rules in ${where} cannot be read (${problems.join("; ")})` };
|
|
165
183
|
return raw.length > 0 ? { quorum: raw, ...extra } : {};
|
|
166
184
|
}
|
|
185
|
+
/** The holds at base (#4545), or why they cannot be read. */
|
|
186
|
+
function holdsAtBase(spec, where) {
|
|
187
|
+
const raw = spec.holds;
|
|
188
|
+
if (raw === undefined)
|
|
189
|
+
return {};
|
|
190
|
+
const problems = opWaveHoldsProblems(raw);
|
|
191
|
+
if (problems.length > 0)
|
|
192
|
+
return { holdsRefused: `the holds in ${where} cannot be read (${problems.join("; ")})` };
|
|
193
|
+
return { holds: structuredClone(raw) };
|
|
194
|
+
}
|
|
167
195
|
/** The point wave `name` asks at base (#3836), or why it cannot be asked. */
|
|
168
196
|
function pointAtBase(spec, name, where) {
|
|
169
197
|
const raw = spec.waves.find((w) => w.name === name)?.point ?? spec.point;
|
|
@@ -186,6 +214,16 @@ export function opWaveRunsPath(spec, wave) {
|
|
|
186
214
|
export function opWavePlansPath(spec, wave) {
|
|
187
215
|
return `.chant/op-waves/${spec.name}/wave-${wave}/plans.json`;
|
|
188
216
|
}
|
|
217
|
+
/** The run ledger on `chant/lifecycle` (#4551): `appendRunRecord`, then a push. Honours `--no-record` through the git layer. */
|
|
218
|
+
export function gitOpWaveRunPort(opts) {
|
|
219
|
+
return {
|
|
220
|
+
async append(record) {
|
|
221
|
+
await appendRunRecord(record, opts);
|
|
222
|
+
const { pushWarning } = await pushLifecycleReport(opts);
|
|
223
|
+
return pushWarning ? { pushWarning } : {};
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
}
|
|
189
227
|
function planRun(opts, waveName, run) {
|
|
190
228
|
const op = run.op ?? opts.spec.op;
|
|
191
229
|
const plan = opWavePlanPath(opts.spec, opts.wave, run.target);
|
|
@@ -250,14 +288,22 @@ function writeRunsFile(at, runs, members, digest, path = opWaveRunsPath(at.spec,
|
|
|
250
288
|
* for all of them (#3762). A wave plan is written out as each run's plan file
|
|
251
289
|
* too, so a per-run `apply` or hook reads `{plan}` either way.
|
|
252
290
|
*/
|
|
253
|
-
function planRuns(at, runs, discover = false) {
|
|
291
|
+
async function planRuns(at, runs, discover = false) {
|
|
254
292
|
const { spec, k, wave, cwd, exec } = at;
|
|
255
|
-
if (!spec.planWave)
|
|
256
|
-
|
|
293
|
+
if (!spec.planWave) {
|
|
294
|
+
const members = runs.map((run) => planRun({ spec, wave: k, cwd, exec }, wave.name, run));
|
|
295
|
+
// #4545: a plan file's `changeSet` part, which a policy hold reads.
|
|
296
|
+
const parts = new Map(runs.flatMap((run) => {
|
|
297
|
+
const part = partOf(readPlanFileField(join(cwd, opWavePlanPath(spec, k, run.target)), "changeSet"));
|
|
298
|
+
return part ? [[run.target, part]] : [];
|
|
299
|
+
}));
|
|
300
|
+
return { members, ...(parts.size > 0 ? { parts } : {}) };
|
|
301
|
+
}
|
|
257
302
|
const runsPath = writeRunsFile(at, runs, undefined, undefined, undefined, discover);
|
|
258
303
|
const plans = opWavePlansPath(spec, k);
|
|
259
304
|
rmSync(join(cwd, plans), { force: true });
|
|
260
|
-
const
|
|
305
|
+
const planArgv = opWaveArgv(spec.planWave, { op: spec.op, wave: wave.name, runs: runsPath, plans });
|
|
306
|
+
const code = at.waveExec ? await at.waveExec(planArgv, cwd) : exec(planArgv, cwd);
|
|
261
307
|
if (code !== 0)
|
|
262
308
|
throw new Error(`planning wave ${k} (${wave.name}) exited ${code}`);
|
|
263
309
|
let parsed;
|
|
@@ -301,6 +347,14 @@ function planRuns(at, runs, discover = false) {
|
|
|
301
347
|
if (count !== undefined && (!Number.isInteger(count) || count < 0))
|
|
302
348
|
throw new Error(`the plans file of wave ${k} (${plans}): \`waves\` must be the number of waves found, a whole number`);
|
|
303
349
|
const pending = Array.isArray(parsed) ? undefined : pendingFields(parsed.pending, `the plans file of wave ${k} (${plans})`);
|
|
350
|
+
const changeSetDoc = Array.isArray(parsed) ? undefined : parsed.changeSet;
|
|
351
|
+
if (changeSetDoc !== undefined && (changeSetDoc === null || typeof changeSetDoc !== "object" || Array.isArray(changeSetDoc))) {
|
|
352
|
+
throw new Error(`the plans file of wave ${k} (${plans}): \`changeSet\` must be a change-set document`);
|
|
353
|
+
}
|
|
354
|
+
const parts = new Map(runs.flatMap((run) => {
|
|
355
|
+
const part = partOf(byTarget.get(run.target)?.changeSet);
|
|
356
|
+
return part ? [[run.target, part]] : [];
|
|
357
|
+
}));
|
|
304
358
|
const members = runs.map((run) => {
|
|
305
359
|
const m = member(run.target, run.op ?? spec.op, byTarget.get(run.target));
|
|
306
360
|
const path = join(cwd, opWavePlanPath(spec, k, run.target));
|
|
@@ -317,13 +371,241 @@ function planRuns(at, runs, discover = false) {
|
|
|
317
371
|
}
|
|
318
372
|
return {
|
|
319
373
|
members,
|
|
374
|
+
...(parts.size > 0 ? { parts } : {}),
|
|
320
375
|
...(pending ? { pending } : {}),
|
|
321
376
|
...(overriders ? { overriders: overriders } : {}),
|
|
322
377
|
...(overriders && overridersSource ? { overridersSource: overridersSource } : {}),
|
|
323
378
|
...(extras ? { extras } : {}),
|
|
324
379
|
...(count !== undefined ? { waves: count } : {}),
|
|
380
|
+
...(changeSetDoc !== undefined ? { changeSet: changeSetDoc } : {}),
|
|
325
381
|
};
|
|
326
382
|
}
|
|
383
|
+
/**
|
|
384
|
+
* Plan `runs` of wave `k` (#4545): through the spec's `step` when it names
|
|
385
|
+
* one, each run's plan kept on `at.steps` for its apply, else with the
|
|
386
|
+
* commands ({@link planRuns}).
|
|
387
|
+
*/
|
|
388
|
+
async function planWaveRuns(at, runs, discover = false) {
|
|
389
|
+
const { spec, k, wave, cwd } = at;
|
|
390
|
+
if (!spec.step)
|
|
391
|
+
return planRuns({ ...at, ...(at.options.waveExec ? { waveExec: at.options.waveExec } : {}) }, runs, discover);
|
|
392
|
+
const registry = await opWaveRegistry(at.options, cwd, at.options.capabilities);
|
|
393
|
+
const base = at.gateRule?.base ?? at.options.base;
|
|
394
|
+
const lockGrain = at.options.lockGrain ?? (await declaredLockGrain(cwd, base));
|
|
395
|
+
// #4613: a step's own policy engine (CrossGuard) reads its packs at the base the wave's rules were read at.
|
|
396
|
+
const policyBase = base && base !== "HEAD" ? base : undefined;
|
|
397
|
+
const plans = [];
|
|
398
|
+
for (const run of runs) {
|
|
399
|
+
const plan = await planOpWaveStep({ spec, wave, cwd, registry, planPath: opWavePlanPath(spec, k, run.target), lockGrain, ...(policyBase ? { policyBase } : {}) }, run);
|
|
400
|
+
at.steps?.set(run.target, plan);
|
|
401
|
+
plans.push(plan);
|
|
402
|
+
}
|
|
403
|
+
const members = plans.map((p) => ({
|
|
404
|
+
member: p.target,
|
|
405
|
+
planDigest: p.planDigest,
|
|
406
|
+
op: runs.find((r) => r.target === p.target)?.op ?? spec.op,
|
|
407
|
+
...(p.destructive ? { destructive: true } : {}),
|
|
408
|
+
...(p.empty ? { empty: true } : {}),
|
|
409
|
+
}));
|
|
410
|
+
const parts = new Map(plans.flatMap((p) => (p.part ? [[p.target, p.part]] : [])));
|
|
411
|
+
const changeSet = opWaveStepChangeSet(plans);
|
|
412
|
+
return { members, ...(parts.size > 0 ? { parts } : {}), ...(changeSet ? { changeSet } : {}) };
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* `ci.lockGrain` of the member holding `cwd` (#4552), read at `base`, behind
|
|
416
|
+
* a dynamic import so the wave-job runtime bundle leaves the declaration
|
|
417
|
+
* reader out. Null when none is declared or the declaration cannot be read
|
|
418
|
+
* there: each run then takes its lexicon's default.
|
|
419
|
+
*/
|
|
420
|
+
async function declaredLockGrain(cwd, base) {
|
|
421
|
+
try {
|
|
422
|
+
const { ciLockGrainAt } = await import("../workspace/ci-lock-grain.js");
|
|
423
|
+
return ciLockGrainAt(cwd, base);
|
|
424
|
+
}
|
|
425
|
+
catch {
|
|
426
|
+
return null;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Lease the rows of a wave's runs on the resource grain (#4552), before
|
|
431
|
+
* anything of the wave applies, all in one take. A held row makes the wave
|
|
432
|
+
* apply nothing with the `held` outcome, exit 5, naming the run that holds it.
|
|
433
|
+
*/
|
|
434
|
+
async function leaseWaveRows(options, ctx, runs) {
|
|
435
|
+
const rows = runs.flatMap((r) => {
|
|
436
|
+
const lock = ctx.steps?.get(r.target)?.lock;
|
|
437
|
+
return lock?.grain === "resource" ? lock.rows : [];
|
|
438
|
+
});
|
|
439
|
+
if (rows.length === 0)
|
|
440
|
+
return undefined;
|
|
441
|
+
const { leaseLockRows } = await import("../lifecycle/resource-lock.js");
|
|
442
|
+
const { PR_APPLY_GATE } = await import("../pr-loop.js");
|
|
443
|
+
const gate = options.lockGate ?? PR_APPLY_GATE;
|
|
444
|
+
let leased;
|
|
445
|
+
try {
|
|
446
|
+
leased = await leaseLockRows(gate, rows, { cwd: ctx.cwd, ...(options.lockLiveness ? { alive: options.lockLiveness } : {}) });
|
|
447
|
+
}
|
|
448
|
+
catch (err) {
|
|
449
|
+
return { failed: `wave ${ctx.k} (${ctx.wave.name}): could not hold the rows its runs change in ${gate}, so nothing was applied: ${err instanceof Error ? err.message : String(err)}` };
|
|
450
|
+
}
|
|
451
|
+
if (!leased.ok) {
|
|
452
|
+
const first = leased.held[0].holder;
|
|
453
|
+
return { outcome: "held", reason: leased.message, holder: { run: first.run, ...(first.url ? { url: first.url } : {}) } };
|
|
454
|
+
}
|
|
455
|
+
for (const h of leased.tookOver)
|
|
456
|
+
ctx.log(`wave ${ctx.k} (${ctx.wave.name}): took over the rows of run ${h.run}, which is gone`);
|
|
457
|
+
ctx.log(`wave ${ctx.k} (${ctx.wave.name}): holds ${leased.lease.keys.length} row${leased.lease.keys.length === 1 ? "" : "s"} of ${gate} while it applies`);
|
|
458
|
+
return leased.lease;
|
|
459
|
+
}
|
|
460
|
+
/** A wave's cost hold over its plans (#4545): each changing run priced, the sum against `approveAbove`. */
|
|
461
|
+
function costVerdictOf(hold, spec, k, members, steps, cwd, exec) {
|
|
462
|
+
const runs = members.map((m) => ({ target: m.member, plan: opWavePlanPath(spec, k, m.member), artifact: steps?.get(m.member)?.artifact, empty: m.empty === true }));
|
|
463
|
+
return opWaveCostVerdict(hold, opWaveCosts(hold, runs, cwd, exec));
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Run a wave's holds over its plans (#4545): the policy marks each run it
|
|
467
|
+
* denies or holds (the gate then settles them as a product's plan file
|
|
468
|
+
* would), and the cost adds its digest member and, over its amount, a hold.
|
|
469
|
+
* `failed` when the policy cannot run, or a run gave it no change set.
|
|
470
|
+
*/
|
|
471
|
+
async function runWaveHolds(ctx, holds, members, parts, base) {
|
|
472
|
+
const { spec, k, wave, cwd, log, options } = ctx;
|
|
473
|
+
// #4614: each run's ci.policy row, which the after-plan hooks and the run record read.
|
|
474
|
+
const out = { holds: [], extras: [], rows: new Map() };
|
|
475
|
+
if (!holds)
|
|
476
|
+
return out;
|
|
477
|
+
if (holds.policy) {
|
|
478
|
+
const missing = members.filter((m) => !parts?.has(m.member)).map((m) => m.member);
|
|
479
|
+
if (missing.length > 0)
|
|
480
|
+
return { failed: `wave ${k} (${wave.name}): holds.policy reads each run's change set, and the plans of ${missing.join(", ")} gave none, so nothing in it was applied` };
|
|
481
|
+
let head = options.head;
|
|
482
|
+
if (!head) {
|
|
483
|
+
try {
|
|
484
|
+
head = execFileSync("git", ["rev-parse", "HEAD"], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
485
|
+
}
|
|
486
|
+
catch {
|
|
487
|
+
head = "";
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
let got;
|
|
491
|
+
try {
|
|
492
|
+
got = await opWavePolicyVerdicts({ spec, gate: opWaveGateName(spec, k), env: spec.labels?.Env ?? wave.name, base, head, cwd, ...(options.holdExec ? { exec: options.holdExec } : {}) }, parts);
|
|
493
|
+
}
|
|
494
|
+
catch (err) {
|
|
495
|
+
return { failed: `wave ${k} (${wave.name}): ${err instanceof Error ? err.message : String(err)}, so nothing in it was applied` };
|
|
496
|
+
}
|
|
497
|
+
if ("note" in got)
|
|
498
|
+
log(`wave ${k} (${wave.name}): ${got.note}`);
|
|
499
|
+
else {
|
|
500
|
+
if (got.source) {
|
|
501
|
+
out.policySource = got.source;
|
|
502
|
+
log(`wave ${k} (${wave.name}): ci.policy read from ${got.source.repo}@${got.source.ref} at commit ${got.source.commit}`);
|
|
503
|
+
}
|
|
504
|
+
for (const m of members) {
|
|
505
|
+
const v = got.verdicts.get(m.member);
|
|
506
|
+
if (v && v.result !== "error") {
|
|
507
|
+
const rules = v.result === "held" ? v.holds : v.result === "denied" ? v.rules : [];
|
|
508
|
+
out.rows.set(m.member, { source: "ci.policy", result: v.result, rules, ...(v.reason ? { reason: v.reason } : {}) });
|
|
509
|
+
}
|
|
510
|
+
if (!v || v.result === "passed")
|
|
511
|
+
continue;
|
|
512
|
+
if (v.result === "error")
|
|
513
|
+
return { failed: `wave ${k} (${wave.name}): the policy did not run on ${m.member} (${v.reason ?? "no answer"}), so nothing in it was applied` };
|
|
514
|
+
if (v.result === "denied")
|
|
515
|
+
m.denied = { rules: v.rules, ...(v.reason ? { reason: v.reason } : {}) };
|
|
516
|
+
else
|
|
517
|
+
m.held = { rules: v.holds, ...(v.reason ? { reason: v.reason } : {}) };
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
if (holds.cost) {
|
|
522
|
+
const verdict = costVerdictOf(holds.cost, spec, k, members, ctx.steps, cwd, options.holdExec);
|
|
523
|
+
out.extras.push(verdict.member);
|
|
524
|
+
log(`wave ${k} (${wave.name}): cost ${verdict.monthlyDelta >= 0 ? "+" : ""}${verdict.monthlyDelta.toFixed(2)} ${verdict.currency} a month${verdict.unestimated.length ? `, ${verdict.unestimated.length} run${verdict.unestimated.length === 1 ? "" : "s"} not priced` : ""}`);
|
|
525
|
+
if (verdict.hold)
|
|
526
|
+
out.holds.push(verdict.hold);
|
|
527
|
+
}
|
|
528
|
+
return out;
|
|
529
|
+
}
|
|
530
|
+
/** The job's after-plan hooks (#4614), as a list. */
|
|
531
|
+
function afterPlanHooks(options) {
|
|
532
|
+
const given = options.afterPlan;
|
|
533
|
+
if (given === undefined)
|
|
534
|
+
return [];
|
|
535
|
+
return Array.isArray(given) ? given : [given];
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Run the after-plan hooks in the job's process over a wave's plans (#4614),
|
|
539
|
+
* fold their policy rows into each run's denial and hold, and put each run's
|
|
540
|
+
* rows and files on the result for the run record. With no hook, the rows
|
|
541
|
+
* chant's `holds.policy` gave still go on the result.
|
|
542
|
+
*/
|
|
543
|
+
async function runAfterPlan(ctx, members, parts, policyRows) {
|
|
544
|
+
const { spec, k, wave, cwd, options, result } = ctx;
|
|
545
|
+
const hooks = afterPlanHooks(options);
|
|
546
|
+
const job = options.decide ? "decide" : options.group !== undefined ? "group" : options.share !== undefined ? "share" : "wave";
|
|
547
|
+
const runs = members.map((m) => {
|
|
548
|
+
const plan = opWavePlanPath(spec, k, m.member);
|
|
549
|
+
const step = ctx.steps?.get(m.member);
|
|
550
|
+
const planJson = runPlanJson(ctx, m.member, plan);
|
|
551
|
+
const part = parts?.get(m.member) ?? step?.part;
|
|
552
|
+
const row = policyRows.get(m.member);
|
|
553
|
+
return {
|
|
554
|
+
spec: spec.name,
|
|
555
|
+
op: spec.op,
|
|
556
|
+
wave: k,
|
|
557
|
+
waveName: wave.name,
|
|
558
|
+
job,
|
|
559
|
+
target: m.member,
|
|
560
|
+
runOp: m.op,
|
|
561
|
+
planDigest: m.planDigest,
|
|
562
|
+
plan,
|
|
563
|
+
...(planJson ? { planJson } : {}),
|
|
564
|
+
...(step?.artifact !== undefined ? { artifact: step.artifact } : {}),
|
|
565
|
+
...(part ? { changeSet: part } : {}),
|
|
566
|
+
empty: m.empty === true,
|
|
567
|
+
destructive: m.destructive === true,
|
|
568
|
+
policy: row ? [row] : [],
|
|
569
|
+
cwd,
|
|
570
|
+
};
|
|
571
|
+
});
|
|
572
|
+
const out = hooks.length > 0 && runs.length > 0 ? await runOpWaveAfterPlanHooks(hooks, runs, ctx.log) : undefined;
|
|
573
|
+
if (out)
|
|
574
|
+
result.hooks.push(...out.outcomes);
|
|
575
|
+
const plans = { ...(result.plans ?? {}) };
|
|
576
|
+
for (const m of members) {
|
|
577
|
+
const mine = out?.runs.get(m.member);
|
|
578
|
+
const chant = policyRows.get(m.member);
|
|
579
|
+
const rows = [...(chant ? [chant] : []), ...(mine?.policy ?? [])];
|
|
580
|
+
if (mine?.policy.length) {
|
|
581
|
+
const folded = foldPolicyRows(mine.policy, { ...(m.denied ? { denied: m.denied } : {}), ...(m.held ? { held: m.held } : {}) });
|
|
582
|
+
if (folded.denied)
|
|
583
|
+
m.denied = folded.denied;
|
|
584
|
+
if (folded.held)
|
|
585
|
+
m.held = folded.held;
|
|
586
|
+
}
|
|
587
|
+
if (rows.length === 0 && !mine?.files.length)
|
|
588
|
+
continue;
|
|
589
|
+
plans[m.member] = { planDigest: m.planDigest, ...(rows.length ? { policy: rows } : {}), ...(mine?.files.length ? { files: [...mine.files] } : {}) };
|
|
590
|
+
}
|
|
591
|
+
if (Object.keys(plans).length > 0)
|
|
592
|
+
result.plans = plans;
|
|
593
|
+
return { ...(out?.failed ? { failed: out.failed } : {}), holds: out?.holds ?? [] };
|
|
594
|
+
}
|
|
595
|
+
/** One field of a plan file, or undefined when the file or the field is missing. */
|
|
596
|
+
function readPlanFileField(path, field) {
|
|
597
|
+
try {
|
|
598
|
+
return JSON.parse(readFileSync(path, "utf-8"))[field];
|
|
599
|
+
}
|
|
600
|
+
catch {
|
|
601
|
+
return undefined;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
/** A plan file's change-set part (#4545), when it gives one of the right shape. */
|
|
605
|
+
function partOf(value) {
|
|
606
|
+
const p = value;
|
|
607
|
+
return p && typeof p === "object" && p.member && typeof p.member.member === "string" && Array.isArray(p.entries) ? p : undefined;
|
|
608
|
+
}
|
|
327
609
|
/** A plans file's `members` (#3821): digest members that are no run, each named once and by no run's target. */
|
|
328
610
|
function extraMembers(value, targets, where) {
|
|
329
611
|
if (value === undefined)
|
|
@@ -354,7 +636,21 @@ export function opWaveSetDigest(spec, members, extras = []) {
|
|
|
354
636
|
return waveSetDigest(waveDigestMembers(members, { ...(spec.digest?.over ? { over: spec.digest.over } : {}), extras }));
|
|
355
637
|
}
|
|
356
638
|
const placeOf = (ctx) => ({ name: ctx.spec.name, op: ctx.spec.op, waveName: ctx.wave.name, k: ctx.k, cwd: ctx.cwd, exec: ctx.exec, log: ctx.log });
|
|
357
|
-
const hookRuns = (
|
|
639
|
+
const hookRuns = (ctx, runs, members) => runs.map((run) => {
|
|
640
|
+
const { spec, k } = ctx;
|
|
641
|
+
const m = members?.get(run.target);
|
|
642
|
+
if (!m)
|
|
643
|
+
return { target: run.target, op: run.op ?? spec.op };
|
|
644
|
+
const plan = opWavePlanPath(spec, k, run.target);
|
|
645
|
+
// #4614: the engine's plan document, from the step's artifact or the plan file's.
|
|
646
|
+
const planJson = runPlanJson(ctx, run.target, plan);
|
|
647
|
+
return { target: run.target, op: run.op ?? spec.op, plan, planDigest: m.planDigest, ...(planJson ? { planJson } : {}) };
|
|
648
|
+
});
|
|
649
|
+
/** The engine's plan document a run's plan names (#4614): the step's artifact, else the plan file's `artifact`. */
|
|
650
|
+
function runPlanJson(ctx, target, plan) {
|
|
651
|
+
const artifact = ctx.steps?.get(target)?.artifact ?? readPlanFileField(join(ctx.cwd, plan), "artifact");
|
|
652
|
+
return planJsonOf(artifact, ctx.cwd);
|
|
653
|
+
}
|
|
358
654
|
/**
|
|
359
655
|
* Run one moment's hooks in the wave job (#3762), recording each outcome on
|
|
360
656
|
* the result. A hook that held the wave on another gate (#3821) has that
|
|
@@ -367,7 +663,10 @@ async function runHooks(ctx, moment, hooks, runs, members, digest, extraEnv = {}
|
|
|
367
663
|
if (!hooks || hooks.length === 0)
|
|
368
664
|
return { holds: [] };
|
|
369
665
|
const runsPath = writeRunsFile(ctx, runs, members, digest);
|
|
370
|
-
const
|
|
666
|
+
const hookExec = ctx.options.hookExec;
|
|
667
|
+
const out = hookExec
|
|
668
|
+
? await runHookListAsync({ ...placeOf(ctx), exec: hookExec }, moment, hooks, hookRuns(ctx, runs, members), runsPath, extraEnv)
|
|
669
|
+
: runHookList(placeOf(ctx), moment, hooks, hookRuns(ctx, runs, members), runsPath, extraEnv);
|
|
371
670
|
ctx.result.hooks.push(...out.outcomes);
|
|
372
671
|
const back = { holds: out.holds, ...(out.failed ? { failed: out.failed } : {}) };
|
|
373
672
|
if (out.failed)
|
|
@@ -386,6 +685,7 @@ async function runHooks(ctx, moment, hooks, runs, members, digest, extraEnv = {}
|
|
|
386
685
|
}
|
|
387
686
|
const now = { op: held.op, gate: held.gate, digest: held.digest, approvedBy: held.approvedBy, approvedAt: held.approvedAt };
|
|
388
687
|
approved.push(now);
|
|
688
|
+
const target = hold.target ? { target: hold.target } : {};
|
|
389
689
|
const approvedEnv = {
|
|
390
690
|
...hold.env,
|
|
391
691
|
CHANT_HOLD_APPROVED: JSON.stringify(now),
|
|
@@ -394,15 +694,33 @@ async function runHooks(ctx, moment, hooks, runs, members, digest, extraEnv = {}
|
|
|
394
694
|
};
|
|
395
695
|
const holdPath = join(ctx.cwd, hold.env.CHANT_HOLD);
|
|
396
696
|
rmSync(holdPath, { force: true });
|
|
697
|
+
// #4623: a hold that asks chant to record its gate is spent here, before the re-run acts under the approval.
|
|
698
|
+
let spent;
|
|
699
|
+
let finishedAt;
|
|
700
|
+
if (hold.request.record) {
|
|
701
|
+
const got = await spendHeldGate(ctx, hold, now);
|
|
702
|
+
if ("failed" in got) {
|
|
703
|
+
ctx.result.hooks.push({ moment, name: hold.name, ...target, exit: 1, outcome: "failed" });
|
|
704
|
+
back.failed = got.failed;
|
|
705
|
+
ctx.log(back.failed);
|
|
706
|
+
return back;
|
|
707
|
+
}
|
|
708
|
+
spent = got.record;
|
|
709
|
+
const finishedRel = holdFinishedPath(hold.env.CHANT_HOLD);
|
|
710
|
+
finishedAt = join(ctx.cwd, finishedRel);
|
|
711
|
+
rmSync(finishedAt, { force: true });
|
|
712
|
+
approvedEnv.CHANT_HOLD_FINISHED = finishedRel;
|
|
713
|
+
}
|
|
397
714
|
let code;
|
|
398
715
|
try {
|
|
399
|
-
code = ctx.exec(hold.argv, ctx.cwd, approvedEnv);
|
|
716
|
+
code = hookExec ? await hookExec(hold.argv, ctx.cwd, approvedEnv) : ctx.exec(hold.argv, ctx.cwd, approvedEnv);
|
|
400
717
|
}
|
|
401
718
|
catch (err) {
|
|
402
719
|
ctx.log(`${hold.label} did not run: ${err instanceof Error ? err.message : String(err)}`);
|
|
403
720
|
code = 127;
|
|
404
721
|
}
|
|
405
|
-
|
|
722
|
+
if (spent && finishedAt)
|
|
723
|
+
await finishHeldGate(ctx, hold, spent, readHoldFinished(finishedAt, ctx.log, hold.label), code);
|
|
406
724
|
if (code === 0) {
|
|
407
725
|
ctx.result.hooks.push({ moment, name: hold.name, ...target, exit: code, outcome: "passed" });
|
|
408
726
|
ctx.log(`${hold.label}: ${held.approvedBy} approved ${held.op} / ${held.gate} at ${held.digest}, and the hook ran again and passed`);
|
|
@@ -474,6 +792,77 @@ function logRefused(log, label, check) {
|
|
|
474
792
|
for (const { resolution: r, reason } of check.refused ?? [])
|
|
475
793
|
log(`${label}: the approval by ${r.resolvedBy} at ${r.timestamp} does not count: ${reason}`);
|
|
476
794
|
}
|
|
795
|
+
/**
|
|
796
|
+
* Spend a held gate's approval before the hook runs again under it (#4623),
|
|
797
|
+
* when the hold asked chant to `record` the gate: an applied line in
|
|
798
|
+
* `_gates/<op>/applied.jsonl`, as a gated request's (#4551). A digest that
|
|
799
|
+
* already applied under this gate does not apply again, and a line that did
|
|
800
|
+
* not reach the remote stops the re-run, so two jobs never act on one
|
|
801
|
+
* approval.
|
|
802
|
+
*/
|
|
803
|
+
async function spendHeldGate(ctx, hold, approval) {
|
|
804
|
+
const { k, wave, cwd, options } = ctx;
|
|
805
|
+
const port = options.gates ?? gitGateLedgerPort({ cwd });
|
|
806
|
+
const label = `${approval.op} / ${approval.gate}`;
|
|
807
|
+
try {
|
|
808
|
+
if (!port.appendApplied)
|
|
809
|
+
throw new Error("this gate ledger cannot record an applied approval");
|
|
810
|
+
const prior = ((await port.readApplied?.(approval.op)) ?? []).filter((a) => a.gate === approval.gate && samePlanDigest(a.planDigest, approval.digest)).at(-1);
|
|
811
|
+
if (prior)
|
|
812
|
+
return { failed: `${hold.label}: ${label} at ${approval.digest} applied already under the approval by ${prior.approvedBy} (${prior.timestamp}); a held request applies once, so the hook did not run again` };
|
|
813
|
+
const commit = typeof hold.request.pending?.commit === "string" ? hold.request.pending.commit : undefined;
|
|
814
|
+
const runId = ciRunIdFromEnv();
|
|
815
|
+
const record = {
|
|
816
|
+
version: 1,
|
|
817
|
+
kind: "applied",
|
|
818
|
+
op: approval.op,
|
|
819
|
+
gate: approval.gate,
|
|
820
|
+
planDigest: approval.digest,
|
|
821
|
+
approvedAt: approval.approvedAt,
|
|
822
|
+
approvedBy: approval.approvedBy,
|
|
823
|
+
timestamp: options.now ?? new Date().toISOString(),
|
|
824
|
+
wave: { number: k, name: wave.name },
|
|
825
|
+
...(runId ? { runId } : {}),
|
|
826
|
+
...(commit ? { commit } : {}),
|
|
827
|
+
};
|
|
828
|
+
requireSpendPushed(await port.appendApplied(record));
|
|
829
|
+
ctx.log(`${hold.label}: ${label} applies under the approval by ${record.approvedBy} at ${record.approvedAt}, which is now spent`);
|
|
830
|
+
return { record };
|
|
831
|
+
}
|
|
832
|
+
catch (err) {
|
|
833
|
+
return { failed: `${hold.label}: could not record that ${label} applies under the approval by ${approval.approvedBy}, so the hook did not run again: ${err instanceof Error ? err.message : String(err)}` };
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Write the finished line of a held gate the hook ran again under (#4623):
|
|
838
|
+
* how it ended, from the hook's `CHANT_HOLD_FINISHED` file, else from its
|
|
839
|
+
* exit code, with the file's detail. A line that is not written is logged;
|
|
840
|
+
* the work under the approval is done either way.
|
|
841
|
+
*/
|
|
842
|
+
async function finishHeldGate(ctx, hold, spent, wrote, code) {
|
|
843
|
+
const port = ctx.options.gates ?? gitGateLedgerPort({ cwd: ctx.cwd });
|
|
844
|
+
const record = {
|
|
845
|
+
version: 1,
|
|
846
|
+
kind: "finished",
|
|
847
|
+
op: spent.op,
|
|
848
|
+
gate: spent.gate,
|
|
849
|
+
planDigest: spent.planDigest,
|
|
850
|
+
applied: spent.timestamp,
|
|
851
|
+
result: wrote?.result ?? (code === 0 ? "applied" : "failed"),
|
|
852
|
+
timestamp: ctx.options.now ?? new Date().toISOString(),
|
|
853
|
+
...(wrote?.detail ? { detail: wrote.detail } : {}),
|
|
854
|
+
};
|
|
855
|
+
try {
|
|
856
|
+
if (!port.appendFinished)
|
|
857
|
+
throw new Error("this gate ledger keeps no finished lines");
|
|
858
|
+
const pushed = await port.appendFinished(record);
|
|
859
|
+
if (!pushed.pushed && pushed.pushWarning && !isLifecycleLocalNote(pushed.pushWarning))
|
|
860
|
+
ctx.log(`${hold.label}: the finished line of ${spent.op} / ${spent.gate} was written and not pushed: ${pushed.pushWarning}`);
|
|
861
|
+
}
|
|
862
|
+
catch (err) {
|
|
863
|
+
ctx.log(`${hold.label}: the finished line of ${spent.op} / ${spent.gate} was not written: ${err instanceof Error ? err.message : String(err)}`);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
477
866
|
/**
|
|
478
867
|
* Settle a hold on another gate (#3821): an approval of that gate and digest
|
|
479
868
|
* under the wave's approval mode (`pr-review` counts the ledger alone, since
|
|
@@ -487,6 +876,19 @@ async function settleOtherGate(ctx, hold) {
|
|
|
487
876
|
const { port } = await gatePort(ctx.options, ctx.cwd, hold.request.gate, mode, rules.base);
|
|
488
877
|
const neverOverMcp = rules.neverOverMcp;
|
|
489
878
|
const now = ctx.options.now ?? new Date().toISOString();
|
|
879
|
+
// #4623: the file the request carries, stored once before the pending fact, which names its SHA-256.
|
|
880
|
+
const attachment = hold.request.attachment;
|
|
881
|
+
if (attachment !== undefined) {
|
|
882
|
+
try {
|
|
883
|
+
if (!port.storeRequestAttachment)
|
|
884
|
+
throw new Error("this gate ledger keeps no request files");
|
|
885
|
+
await port.storeRequestAttachment(op, hold.request.digest, attachment);
|
|
886
|
+
}
|
|
887
|
+
catch (err) {
|
|
888
|
+
log(`${op} / ${hold.request.gate}: the file ${hold.label} attached was not stored beside the pending fact: ${err instanceof Error ? err.message : String(err)}`);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
const proof = attachment !== undefined ? { proof: `sha256:${createHash("sha256").update(attachment).digest("hex")}` } : {};
|
|
490
892
|
const check = await evaluateGate(port, {
|
|
491
893
|
op,
|
|
492
894
|
gate: hold.request.gate,
|
|
@@ -494,7 +896,7 @@ async function settleOtherGate(ctx, hold) {
|
|
|
494
896
|
description: hold.request.description ?? `wave ${k} (${wave.name}) of ${spec.name} is held on it by ${hold.label}`,
|
|
495
897
|
now,
|
|
496
898
|
// #3839: the wave a hold belongs to, as a field, whatever the hook's own description says.
|
|
497
|
-
fields: { ...hold.request.pending, approvalMode: rules.approval, wave: { number: k, name: wave.name, op: spec.name }, heldBy: { hook: hold.name, moment: hold.moment, ...(hold.target ? { target: hold.target } : {}) } },
|
|
899
|
+
fields: { ...hold.request.pending, ...proof, approvalMode: rules.approval, wave: { number: k, name: wave.name, op: spec.name }, heldBy: { hook: hold.name, moment: hold.moment, ...(hold.target ? { target: hold.target } : {}) } },
|
|
498
900
|
...(neverOverMcp ? { neverOverMcp: true } : {}),
|
|
499
901
|
});
|
|
500
902
|
const base = { op, gate: hold.request.gate, digest: hold.request.digest, hook: hold.label };
|
|
@@ -654,8 +1056,226 @@ function noteHooksAtBase(ctx, rules) {
|
|
|
654
1056
|
* its plan command found.
|
|
655
1057
|
*/
|
|
656
1058
|
export async function runOpWave(options) {
|
|
1059
|
+
assertOpWavesSpec(options.spec);
|
|
1060
|
+
const afterPlanWrong = opWaveAfterPlanProblems(options.afterPlan);
|
|
1061
|
+
if (afterPlanWrong.length > 0)
|
|
1062
|
+
throw new Error(`Op waves "${options.spec.name}": ${afterPlanWrong.join("; ")}`);
|
|
1063
|
+
// #4551: one run record per job, on every way the job ends.
|
|
1064
|
+
const started = new Date().toISOString();
|
|
1065
|
+
// #4555: the job's run events and its trace, when a reader or an exporter wants them.
|
|
1066
|
+
const events = await openOpWaveEvents(options);
|
|
1067
|
+
if (events)
|
|
1068
|
+
jobEvents.set(options, events);
|
|
1069
|
+
events?.start();
|
|
1070
|
+
let result;
|
|
1071
|
+
try {
|
|
1072
|
+
result = await runOpWaveJob(options);
|
|
1073
|
+
}
|
|
1074
|
+
catch (err) {
|
|
1075
|
+
const record = await recordOpWaveRun(options, started, { error: err });
|
|
1076
|
+
await closeOpWaveEvents(options, events, record);
|
|
1077
|
+
throw err;
|
|
1078
|
+
}
|
|
1079
|
+
const record = await recordOpWaveRun(options, started, { result });
|
|
1080
|
+
await closeOpWaveEvents(options, events, record, result);
|
|
1081
|
+
return result;
|
|
1082
|
+
}
|
|
1083
|
+
/** Each running job's events (#4555), by its options, which every step of the job is handed. */
|
|
1084
|
+
const jobEvents = new WeakMap();
|
|
1085
|
+
/** The job's run events (#4555): to `options.events`, and to a trace when the exporter is on. Undefined when neither wants them. */
|
|
1086
|
+
async function openOpWaveEvents(options) {
|
|
1087
|
+
const log = options.log ?? ((line) => console.error(line));
|
|
1088
|
+
let exporter;
|
|
1089
|
+
try {
|
|
1090
|
+
exporter = options.otlp === false ? undefined : (options.otlp ?? activeOtlp());
|
|
1091
|
+
}
|
|
1092
|
+
catch (err) {
|
|
1093
|
+
log(`wave ${options.wave}: no trace is sent: ${err instanceof Error ? err.message : String(err)}`);
|
|
1094
|
+
}
|
|
1095
|
+
if (!options.events && !exporter)
|
|
1096
|
+
return undefined;
|
|
1097
|
+
let trace;
|
|
1098
|
+
if (exporter) {
|
|
1099
|
+
const run = await resolveRunEventRun({ kind: "op", name: options.spec.name, cwd: options.cwd ?? process.cwd() });
|
|
1100
|
+
trace = new RunEventTrace(run, { exporter });
|
|
1101
|
+
}
|
|
1102
|
+
return new OpWaveRunEvents(joinRunEventSinks(options.events, trace?.sink), trace);
|
|
1103
|
+
}
|
|
1104
|
+
/** Settle the job's events from its run record and send its trace (#4555). A trace that does not go out is a line in the log, never a change of exit code. */
|
|
1105
|
+
async function closeOpWaveEvents(options, events, record, result) {
|
|
1106
|
+
if (!events)
|
|
1107
|
+
return;
|
|
1108
|
+
jobEvents.delete(options);
|
|
1109
|
+
events.finish(record, { ...(result ? { moved: result.moved } : {}), ...(result?.blocked ? { blocked: result.blocked } : {}) });
|
|
1110
|
+
const problem = await events.trace?.flush();
|
|
1111
|
+
if (problem)
|
|
1112
|
+
(options.log ?? ((line) => console.error(line)))(`wave ${options.wave}: the trace was not sent: ${problem}`);
|
|
1113
|
+
}
|
|
1114
|
+
/** A target's apply began (#4555): its start time for the record, and its `step-start`. */
|
|
1115
|
+
function targetStarted(options, k, target) {
|
|
1116
|
+
jobEvents.get(options)?.stepStart(k, target);
|
|
1117
|
+
return Date.now();
|
|
1118
|
+
}
|
|
1119
|
+
/** A target's apply ended (#4555): its time and facts on the result, and its `step-settle`. */
|
|
1120
|
+
function targetSettled(options, result, k, target, startedMs, status, opts = {}) {
|
|
1121
|
+
const durationMs = Math.max(0, Date.now() - startedMs);
|
|
1122
|
+
result.targets = {
|
|
1123
|
+
...result.targets,
|
|
1124
|
+
[target]: {
|
|
1125
|
+
startedAt: new Date(startedMs).toISOString(),
|
|
1126
|
+
durationMs,
|
|
1127
|
+
...(opts.facts?.attributes ? { attributes: opts.facts.attributes } : {}),
|
|
1128
|
+
...(opts.facts?.spans?.length ? { spans: opts.facts.spans } : {}),
|
|
1129
|
+
},
|
|
1130
|
+
};
|
|
1131
|
+
jobEvents.get(options)?.stepSettle(k, target, status, durationMs, opts);
|
|
1132
|
+
// #4615: one log line per resource the engine reported.
|
|
1133
|
+
if (opts.facts?.resources?.length) {
|
|
1134
|
+
const log = options.log ?? ((line) => console.error(line));
|
|
1135
|
+
for (const line of opWaveResourceLines(target, opts.facts.resources))
|
|
1136
|
+
log(line);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
/** The log lines for what a target's engine reported per resource (#4615): `<target>: <resource> (<type>) ok in 412 ms, 3 calls`. */
|
|
1140
|
+
export function opWaveResourceLines(target, resources) {
|
|
1141
|
+
return resources.map((r) => {
|
|
1142
|
+
const what = r.name ? `${r.name}${r.type ? ` (${r.type})` : ""}` : `${r.resource}${r.type ? ` (${r.type})` : ""}`;
|
|
1143
|
+
const took = r.durationMs === null ? "" : ` in ${Math.round(r.durationMs)} ms`;
|
|
1144
|
+
const calls = r.calls !== undefined ? `, ${r.calls} call${r.calls === 1 ? "" : "s"}` : "";
|
|
1145
|
+
return `${target}: ${what} ${r.status === "ok" ? "ok" : "failed"}${took}${calls}`;
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
/** The run ledger's status and failure for a job's exit code (#4551), by chant's exit-code table. */
|
|
1149
|
+
function opWaveRunStatus(result) {
|
|
1150
|
+
const d = result.decision;
|
|
1151
|
+
switch (result.exitCode) {
|
|
1152
|
+
case CHANT_EXIT.done:
|
|
1153
|
+
case CHANT_EXIT.held:
|
|
1154
|
+
case CHANT_EXIT.superseded:
|
|
1155
|
+
return { status: "ok" };
|
|
1156
|
+
case CHANT_EXIT.waiting:
|
|
1157
|
+
return { status: d?.point?.question ? "waiting" : "gated" };
|
|
1158
|
+
case CHANT_EXIT.moved:
|
|
1159
|
+
return { status: "fail", failure: { code: "moved", reason: `plans moved since the decision: ${result.moved.join(", ") || "(none named)"}` } };
|
|
1160
|
+
case CHANT_EXIT.denied:
|
|
1161
|
+
return { status: "fail", failure: { code: "denied", reason: d?.refused?.message ?? `the policy denied ${d?.refused?.runs.join(", ") ?? "a run"}, and no override counts` } };
|
|
1162
|
+
case CHANT_EXIT.declined:
|
|
1163
|
+
return { status: "fail", failure: { code: "point-refused", reason: d?.refused?.message ?? "the gate's decision point was answered with an answer it does not pass on" } };
|
|
1164
|
+
default:
|
|
1165
|
+
return { status: "fail", failure: { code: "command-failed", reason: result.failed.length > 0 ? `failed: ${result.failed.join(", ")}` : "the wave job failed" } };
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* The run record of one `chant run wave` job (#4551): one phase per wave the
|
|
1170
|
+
* job walked, one step per run target. A run that applied is `ok`, one that
|
|
1171
|
+
* failed `fail`, and one that moved, was blocked or waited `skipped`.
|
|
1172
|
+
*/
|
|
1173
|
+
export function opWaveRunRecord(options, times, outcome) {
|
|
1174
|
+
const { spec } = options;
|
|
1175
|
+
const result = "result" in outcome ? outcome.result : { exitCode: CHANT_EXIT.failed, applied: [], failed: [], moved: [], hooks: [] };
|
|
1176
|
+
const d = result.decision;
|
|
1177
|
+
const applied = new Set(result.applied);
|
|
1178
|
+
const failedRuns = new Set(result.failed);
|
|
1179
|
+
const walked = result.rest?.length ? result.rest.map((r) => r.wave) : [options.wave];
|
|
1180
|
+
const last = walked[walked.length - 1];
|
|
1181
|
+
const phases = walked.map((k) => {
|
|
1182
|
+
const targets = k === last && d ? d.members.map((m) => m.member) : (spec.waves[k - 1]?.runs ?? []).map((r) => r.target);
|
|
1183
|
+
const steps = targets.map((t) => ({
|
|
1184
|
+
fn: t,
|
|
1185
|
+
status: failedRuns.has(t) ? "fail" : applied.has(t) ? "ok" : "skipped",
|
|
1186
|
+
durationMs: result.targets?.[t]?.durationMs ?? 0,
|
|
1187
|
+
}));
|
|
1188
|
+
const status = steps.some((x) => x.status === "fail") ? "fail" : steps.length > 0 && steps.every((x) => x.status === "skipped") ? "skipped" : "ok";
|
|
1189
|
+
return { name: `wave-${k}`, status, steps };
|
|
1190
|
+
});
|
|
1191
|
+
const verdict = "error" in outcome
|
|
1192
|
+
? { status: "fail", failure: { code: "command-failed", reason: outcome.error instanceof Error ? outcome.error.message : String(outcome.error) } }
|
|
1193
|
+
: opWaveRunStatus(result);
|
|
1194
|
+
const wave = {
|
|
1195
|
+
spec: spec.name,
|
|
1196
|
+
number: options.wave,
|
|
1197
|
+
name: spec.waves[options.wave - 1]?.name ?? `wave-${options.wave}`,
|
|
1198
|
+
job: options.decide ? "decide" : options.group !== undefined ? "group" : options.share !== undefined ? "share" : "wave",
|
|
1199
|
+
...(options.share !== undefined ? { share: options.share } : {}),
|
|
1200
|
+
...(options.group !== undefined ? { group: options.group } : {}),
|
|
1201
|
+
...(d?.digest ? { digest: d.digest } : {}),
|
|
1202
|
+
exitCode: result.exitCode,
|
|
1203
|
+
...(result.outcome && result.outcome.outcome !== "replan" ? { outcome: result.outcome.outcome } : {}),
|
|
1204
|
+
...(result.supersededBy ? { supersededBy: { ...result.supersededBy } } : {}),
|
|
1205
|
+
applied: [...result.applied],
|
|
1206
|
+
failed: [...result.failed],
|
|
1207
|
+
moved: [...result.moved],
|
|
1208
|
+
...(result.blocked && Object.keys(result.blocked).length > 0 ? { blocked: { ...result.blocked } } : {}),
|
|
1209
|
+
...(result.targets && Object.keys(result.targets).length > 0 ? { targets: { ...result.targets } } : {}),
|
|
1210
|
+
...(result.plans && Object.keys(result.plans).length > 0 ? { plans: { ...result.plans } } : {}),
|
|
1211
|
+
};
|
|
1212
|
+
const labels = { ...(spec.labels ?? {}) };
|
|
1213
|
+
return {
|
|
1214
|
+
op: spec.name,
|
|
1215
|
+
env: labels.Env ?? DEFAULT_RUN_ENV,
|
|
1216
|
+
started: times.started,
|
|
1217
|
+
ended: times.ended,
|
|
1218
|
+
status: verdict.status,
|
|
1219
|
+
labels,
|
|
1220
|
+
outcomes: {},
|
|
1221
|
+
phases,
|
|
1222
|
+
...(verdict.status === "gated" && d ? { gate: { name: d.gate, since: d.waitingSince ?? times.ended, ...(d.op !== spec.name ? { op: d.op } : {}) } } : {}),
|
|
1223
|
+
...(verdict.status === "waiting" && d?.point?.question ? { point: { ...d.point.question, since: d.waitingSince ?? times.ended } } : {}),
|
|
1224
|
+
...(times.gitSha ? { gitSha: times.gitSha } : {}),
|
|
1225
|
+
...(times.runOrigin ? { runOrigin: times.runOrigin } : {}),
|
|
1226
|
+
...(verdict.failure ? { failure: { ...verdict.failure, exitCode: result.exitCode } } : {}),
|
|
1227
|
+
wave,
|
|
1228
|
+
};
|
|
1229
|
+
}
|
|
1230
|
+
/** Append the job's run record (#4551). A failed write warns and never changes the job's exit code. */
|
|
1231
|
+
async function recordOpWaveRun(options, started, outcome) {
|
|
1232
|
+
const cwd = options.cwd ?? process.cwd();
|
|
1233
|
+
const port = options.runs ?? (options.gates ? undefined : gitOpWaveRunPort({ cwd }));
|
|
1234
|
+
const log = options.log ?? ((line) => console.error(line));
|
|
1235
|
+
let gitSha = options.head;
|
|
1236
|
+
if (gitSha === undefined) {
|
|
1237
|
+
try {
|
|
1238
|
+
gitSha = execFileSync("git", ["rev-parse", "HEAD"], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
1239
|
+
}
|
|
1240
|
+
catch {
|
|
1241
|
+
gitSha = undefined;
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
const ci = resolveCiJob();
|
|
1245
|
+
const record = opWaveRunRecord(options, { started, ended: new Date().toISOString(), ...(gitSha ? { gitSha } : {}), ...(ci ? { runOrigin: ci.runOrigin } : {}) }, outcome);
|
|
1246
|
+
// The record is built either way: the job's run events settle from it (#4555).
|
|
1247
|
+
if (!port)
|
|
1248
|
+
return record;
|
|
1249
|
+
try {
|
|
1250
|
+
const wrote = await port.append(record);
|
|
1251
|
+
if (wrote && wrote.pushWarning)
|
|
1252
|
+
log(`wave ${options.wave}: the run record was written and not pushed: ${wrote.pushWarning}`);
|
|
1253
|
+
}
|
|
1254
|
+
catch (err) {
|
|
1255
|
+
log(`wave ${options.wave}: could not record the run on the run ledger: ${err instanceof Error ? err.message : String(err)}`);
|
|
1256
|
+
}
|
|
1257
|
+
return record;
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Store the change-set document a wave's plans file gave (#4551), so the
|
|
1261
|
+
* pending fact can cite it. A document that is not one, or does not hash to
|
|
1262
|
+
* its digest, is logged and left out; it never blocks the gate.
|
|
1263
|
+
*/
|
|
1264
|
+
async function storeWaveChangeSet(options, ctx, decision, doc) {
|
|
1265
|
+
const ledger = options.gates ?? gitGateLedgerPort({ cwd: ctx.cwd });
|
|
1266
|
+
if (!ledger.storeChangeSet)
|
|
1267
|
+
return;
|
|
1268
|
+
try {
|
|
1269
|
+
await ledger.storeChangeSet(doc);
|
|
1270
|
+
decision.changeSet = doc.digest;
|
|
1271
|
+
}
|
|
1272
|
+
catch (err) {
|
|
1273
|
+
ctx.log(`wave ${ctx.k} (${ctx.wave.name}): the plans file's change set was not stored, so the pending fact cites none: ${err instanceof Error ? err.message : String(err)}`);
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
/** One job's plan, decide and apply, which {@link runOpWave} records. */
|
|
1277
|
+
async function runOpWaveJob(options) {
|
|
657
1278
|
const { spec } = options;
|
|
658
|
-
assertOpWavesSpec(spec);
|
|
659
1279
|
const log = options.log ?? ((line) => console.error(line));
|
|
660
1280
|
const cwd = options.cwd ?? process.cwd();
|
|
661
1281
|
const outcomeDir = options.outcomeDir ?? opWaveOutcomeDir(spec);
|
|
@@ -704,6 +1324,8 @@ async function runOpWaveLoop(options, log, applied, skip) {
|
|
|
704
1324
|
const { spec } = options;
|
|
705
1325
|
const last = spec.waves[spec.waves.length - 1];
|
|
706
1326
|
const rest = [];
|
|
1327
|
+
// #4555: each wave a `rest` job walks keeps its targets' times.
|
|
1328
|
+
const targets = {};
|
|
707
1329
|
const result = await runWaveLoop({
|
|
708
1330
|
first: options.wave,
|
|
709
1331
|
plan: (at) => planOpWave(options, at, at.k === options.wave ? skip : undefined),
|
|
@@ -723,6 +1345,7 @@ async function runOpWaveLoop(options, log, applied, skip) {
|
|
|
723
1345
|
},
|
|
724
1346
|
onward(k, outcome) {
|
|
725
1347
|
applied.push(...outcome.applied);
|
|
1348
|
+
Object.assign(targets, outcome.targets ?? {});
|
|
726
1349
|
// #3821: a `rest` wave goes on through the waves its plan command found.
|
|
727
1350
|
const found = outcome.decision?.discovered?.waves;
|
|
728
1351
|
const onward = k >= spec.waves.length && last.rest === true && options.share === undefined && options.group === undefined && !options.decide && outcome.exitCode === 0 && found !== undefined && k < found;
|
|
@@ -733,7 +1356,8 @@ async function runOpWaveLoop(options, log, applied, skip) {
|
|
|
733
1356
|
return onward;
|
|
734
1357
|
},
|
|
735
1358
|
});
|
|
736
|
-
|
|
1359
|
+
const timed = { ...targets, ...(result.targets ?? {}) };
|
|
1360
|
+
return { ...result, applied, ...(rest.length > 0 ? { rest } : {}), ...(Object.keys(timed).length > 0 ? { targets: timed } : {}) };
|
|
737
1361
|
}
|
|
738
1362
|
/**
|
|
739
1363
|
* Read the outcome files under `dir` for wave `k`'s job (#4322). A wave or
|
|
@@ -784,7 +1408,7 @@ function opWaveBefore(options, dir) {
|
|
|
784
1408
|
? `Nothing in wave ${k} (${wave.name}) ran: ${shown} waits at its gate. Approve it and run that wave's job again, then this one.`
|
|
785
1409
|
: `Nothing in wave ${k} (${wave.name}) ran: ${shown} did not apply, and only a failure lets the waves after it go on.`;
|
|
786
1410
|
const status = waiting.length > 0 ? "waiting" : "not-applied";
|
|
787
|
-
return { blocked: new Map(), stop: { exitCode: waiting.length > 0 ?
|
|
1411
|
+
return { blocked: new Map(), stop: { exitCode: waiting.length > 0 ? CHANT_EXIT.waiting : CHANT_EXIT.failed, line, members: Object.fromEntries((wave.runs ?? []).map((r) => [r.target, { status }])) } };
|
|
788
1412
|
}
|
|
789
1413
|
const runs = wave.runs ?? [];
|
|
790
1414
|
const index = new Map(runs.map((r, i) => [r.target, i]));
|
|
@@ -828,9 +1452,9 @@ function writeOpWaveOutcome(options, dir, result, members) {
|
|
|
828
1452
|
const failed = new Set(result.failed);
|
|
829
1453
|
const moved = new Set(result.moved);
|
|
830
1454
|
const otherwise = result.exitCode === 0 ? (options.decide ? "decided" : "unchanged")
|
|
831
|
-
: result.exitCode ===
|
|
832
|
-
: result.exitCode ===
|
|
833
|
-
: result.exitCode >=
|
|
1455
|
+
: result.exitCode === CHANT_EXIT.waiting ? "waiting"
|
|
1456
|
+
: result.exitCode === CHANT_EXIT.denied || result.exitCode === CHANT_EXIT.declined ? "refused"
|
|
1457
|
+
: result.exitCode >= CHANT_EXIT.moved && result.exitCode <= CHANT_EXIT.superseded ? "not-applied"
|
|
834
1458
|
: "failed";
|
|
835
1459
|
for (const t of targets) {
|
|
836
1460
|
const by = result.blocked?.[t];
|
|
@@ -902,7 +1526,7 @@ async function planOpWave(options, { k, pass }, skip) {
|
|
|
902
1526
|
ctx.gateRule = { approval: decision.approval, base: decision.base, neverOverMcp: decision.neverOverMcp === true };
|
|
903
1527
|
if (decision.status === "waiting" || decision.status === "refused") {
|
|
904
1528
|
log(`wave ${k} (${wave.name}) is ${decision.status === "refused" ? "refused by its policy" : `waiting on ${decision.heldOn?.gate ?? decision.gate}`}; nothing applied. ${decision.approve ?? ""}`.trim());
|
|
905
|
-
return { end: { ...result, exitCode: decision.status === "refused" ? refusedExit(decision) :
|
|
1529
|
+
return { end: { ...result, exitCode: decision.status === "refused" ? refusedExit(decision) : CHANT_EXIT.waiting } };
|
|
906
1530
|
}
|
|
907
1531
|
// The share runs the hooks its deciding job read at base, around its own slice.
|
|
908
1532
|
if (wave.discover) {
|
|
@@ -924,14 +1548,20 @@ async function planOpWave(options, { k, pass }, skip) {
|
|
|
924
1548
|
return { end: failed(ctx, `a hook before the plan failed, so nothing in ${part} of wave ${k} was planned or applied`) };
|
|
925
1549
|
if (before.waitingOn)
|
|
926
1550
|
return { end: await waitOnOther(ctx, decision, before.waitingOn) };
|
|
927
|
-
|
|
1551
|
+
if (spec.step)
|
|
1552
|
+
ctx.steps = new Map();
|
|
1553
|
+
const { members, parts: sliceParts } = await planWaveRuns(ctx, slice);
|
|
1554
|
+
// #4614: the after-plan hooks in the job's process, over the share's own plans.
|
|
1555
|
+
const inProcess = await runAfterPlan(ctx, members, sliceParts, new Map());
|
|
1556
|
+
if (inProcess.failed)
|
|
1557
|
+
return { end: failed(ctx, `${inProcess.failed}, so nothing in ${part} of wave ${k} was applied`) };
|
|
928
1558
|
const planned = new Map(members.map((m) => [m.member, m]));
|
|
929
1559
|
const after = await runHooks(ctx, "after-plan", decision.hooks?.["after-plan"], slice, planned);
|
|
930
1560
|
if (after.failed)
|
|
931
1561
|
return { end: failed(ctx, `a hook after the plan failed, so nothing in ${part} of wave ${k} was applied`) };
|
|
932
1562
|
if (after.waitingOn)
|
|
933
1563
|
return { end: await waitOnOther(ctx, decision, after.waitingOn) };
|
|
934
|
-
return { go: { kind: "share", ctx, decision, slice, planned, holds: [...before.holds, ...after.holds] } };
|
|
1564
|
+
return { go: { kind: "share", ctx, decision, slice, planned, holds: [...before.holds, ...inProcess.holds, ...after.holds] } };
|
|
935
1565
|
}
|
|
936
1566
|
// The policy, the approval mode and the hooks, read at base before anything runs.
|
|
937
1567
|
const rules = readOpWavePolicy(options.specFile, wave.name, options.base ?? spec.base ?? "HEAD^1", cwd, options.show);
|
|
@@ -990,7 +1620,33 @@ async function planOpWave(options, { k, pass }, skip) {
|
|
|
990
1620
|
return { end: failed(ctx, `a hook before the plan failed, so nothing in wave ${k} was planned or applied`) };
|
|
991
1621
|
if (before.waitingOn)
|
|
992
1622
|
return { end: await decided(ctx, decision, recordPath, before.waitingOn) };
|
|
993
|
-
|
|
1623
|
+
if (spec.step)
|
|
1624
|
+
ctx.steps = new Map();
|
|
1625
|
+
const { members, pending, overriders, overridersSource, extras: planExtras, waves: found, changeSet, parts } = await planWaveRuns(ctx, wave.runs, wave.discover === true);
|
|
1626
|
+
// #4545: the holds at base (else the change's), run over the plans before the gate decides.
|
|
1627
|
+
let extras = planExtras;
|
|
1628
|
+
let policyRows = new Map();
|
|
1629
|
+
if (rules.holdsRefused) {
|
|
1630
|
+
holds.push(rules.holdsRefused);
|
|
1631
|
+
log(`wave ${k} (${wave.name}): ${rules.holdsRefused}, so none runs and the wave waits for an approval`);
|
|
1632
|
+
}
|
|
1633
|
+
else {
|
|
1634
|
+
const held = await runWaveHolds(ctx, opWaveHoldsAt(rules.holds, spec.holds), members, parts, base);
|
|
1635
|
+
if ("failed" in held)
|
|
1636
|
+
return { end: failed(ctx, held.failed) };
|
|
1637
|
+
holds.push(...held.holds);
|
|
1638
|
+
if (held.extras.length > 0)
|
|
1639
|
+
extras = [...(extras ?? []), ...held.extras];
|
|
1640
|
+
policyRows = held.rows;
|
|
1641
|
+
// #4613: the decision names the shared policy commit its runs were judged by.
|
|
1642
|
+
if (held.policySource)
|
|
1643
|
+
decision.ciPolicySource = held.policySource;
|
|
1644
|
+
}
|
|
1645
|
+
// #4614: the after-plan hooks in the job's process, before the set digest and the gate.
|
|
1646
|
+
const inProcess = await runAfterPlan(ctx, members, parts, policyRows);
|
|
1647
|
+
if (inProcess.failed)
|
|
1648
|
+
return { end: failed(ctx, `${inProcess.failed}, so nothing in wave ${k} was approved or applied`) };
|
|
1649
|
+
holds.push(...inProcess.holds);
|
|
994
1650
|
if (wave.discover) {
|
|
995
1651
|
wave = { ...wave, runs: members.map((m) => ({ target: m.member, ...(m.op !== spec.op ? { op: m.op } : {}) })) };
|
|
996
1652
|
ctx.wave = wave;
|
|
@@ -1017,6 +1673,7 @@ async function planOpWave(options, { k, pass }, skip) {
|
|
|
1017
1673
|
...(overriders ? { overriders } : {}),
|
|
1018
1674
|
...(overridersSource ? { overridersSource } : {}),
|
|
1019
1675
|
...(extras ? { extras } : {}),
|
|
1676
|
+
...(changeSet ? { changeSet } : {}),
|
|
1020
1677
|
},
|
|
1021
1678
|
};
|
|
1022
1679
|
}
|
|
@@ -1066,6 +1723,13 @@ async function decideOpWave(options, { prior }, planned, digest) {
|
|
|
1066
1723
|
decision.extras = extras;
|
|
1067
1724
|
if (pending)
|
|
1068
1725
|
decision.pending = pending;
|
|
1726
|
+
if (planned.changeSet)
|
|
1727
|
+
await storeWaveChangeSet(options, ctx, decision, planned.changeSet);
|
|
1728
|
+
// #4550: a pull-request wave checks the pull request's approval against the plans file's change set.
|
|
1729
|
+
if (planned.changeSet)
|
|
1730
|
+
ctx.changeSetDoc = planned.changeSet;
|
|
1731
|
+
if (decision.approval === "pull-request" && planned.rules.pullRequestGate)
|
|
1732
|
+
decision.pullRequestGate = planned.rules.pullRequestGate;
|
|
1069
1733
|
const after = await runHooks(ctx, "after-plan", planned.rules.hooks["after-plan"], wave.runs, planned.planned, digest);
|
|
1070
1734
|
if (after.failed)
|
|
1071
1735
|
return { end: failed(ctx, `a hook after the plan failed, so nothing in wave ${k} was applied`) };
|
|
@@ -1124,7 +1788,7 @@ async function applyOpWave(options, planned, decidedWave) {
|
|
|
1124
1788
|
const { ctx, decision } = planned;
|
|
1125
1789
|
await applyStage(options, ctx, decision, decidedWave.runs, planned.planned, decidedWave.earlierHolds, decidedWave.recordPath);
|
|
1126
1790
|
if (planned.kind === "share" && ctx.result.exitCode === 0 && ctx.result.moved.length > 0)
|
|
1127
|
-
ctx.result.exitCode =
|
|
1791
|
+
ctx.result.exitCode = CHANT_EXIT.moved;
|
|
1128
1792
|
return ctx.result;
|
|
1129
1793
|
}
|
|
1130
1794
|
/**
|
|
@@ -1148,15 +1812,15 @@ async function decided(ctx, decision, recordPath, heldOn) {
|
|
|
1148
1812
|
const hook = await runGateHooks(ctx, decision, recordPath);
|
|
1149
1813
|
if (decision.status === "waiting") {
|
|
1150
1814
|
log(`Nothing in wave ${k} or after it ran. ${decision.heldOn ? `It waits on ${decision.heldOn.op} / ${decision.heldOn.gate}.` : "Read the plans, then"} approve: ${decision.approve} (with --resume, the approval also starts this job again)`);
|
|
1151
|
-
return { ...result, exitCode:
|
|
1815
|
+
return { ...result, exitCode: CHANT_EXIT.waiting };
|
|
1152
1816
|
}
|
|
1153
1817
|
if (decision.status === "refused" && decision.refused?.reason === "point") {
|
|
1154
1818
|
log(`Nothing in wave ${k} (${wave.name}) or after it ran: ${decision.refused.message}`);
|
|
1155
|
-
return { ...result, exitCode:
|
|
1819
|
+
return { ...result, exitCode: CHANT_EXIT.declined };
|
|
1156
1820
|
}
|
|
1157
1821
|
if (decision.status === "refused") {
|
|
1158
1822
|
log(`Nothing in wave ${k} (${wave.name}) or after it ran: the policy denied ${decision.refused?.runs.join(", ")}, and no override counts for ${decision.refused?.runs.length === 1 ? "it" : "them"}.`);
|
|
1159
|
-
return { ...result, exitCode:
|
|
1823
|
+
return { ...result, exitCode: CHANT_EXIT.denied };
|
|
1160
1824
|
}
|
|
1161
1825
|
if (hook.failed)
|
|
1162
1826
|
return failed(ctx, `wave ${k} (${wave.name}): ${hook.failed}, so nothing in it was applied`);
|
|
@@ -1176,7 +1840,7 @@ function markHeldOn(decision, heldOn) {
|
|
|
1176
1840
|
async function waitOnOther(ctx, decision, heldOn) {
|
|
1177
1841
|
markHeldOn(decision, heldOn);
|
|
1178
1842
|
ctx.log(`${shareLabel(ctx.options)} of wave ${ctx.k} (${ctx.wave.name}) waits on ${heldOn.op} / ${heldOn.gate}; nothing in it applied. Approve: ${heldOn.approve}`);
|
|
1179
|
-
return { ...ctx.result, decision, exitCode:
|
|
1843
|
+
return { ...ctx.result, decision, exitCode: CHANT_EXIT.waiting };
|
|
1180
1844
|
}
|
|
1181
1845
|
/**
|
|
1182
1846
|
* Run the `after-gate` hooks (#3821) once the gate decided. Their
|
|
@@ -1328,7 +1992,7 @@ async function spendOverrides(ctx, decision) {
|
|
|
1328
1992
|
}
|
|
1329
1993
|
/** The exit code of a refused wave: 8 when its decision point refused it (#3836), 7 when the product's policy did (#3821). */
|
|
1330
1994
|
function refusedExit(decision) {
|
|
1331
|
-
return decision.refused?.reason === "point" ?
|
|
1995
|
+
return decision.refused?.reason === "point" ? CHANT_EXIT.declined : CHANT_EXIT.denied;
|
|
1332
1996
|
}
|
|
1333
1997
|
function failed(ctx, line) {
|
|
1334
1998
|
ctx.log(line);
|
|
@@ -1352,7 +2016,17 @@ async function settleGate(options, ctx, decision) {
|
|
|
1352
2016
|
// #3784: under the spend rule at base, an approval a wave already applied under counts for nothing.
|
|
1353
2017
|
const spent = decision.spend === "base" ? ((await ledger.readApplied?.(spec.name)) ?? []).filter((a) => a.gate === gate) : undefined;
|
|
1354
2018
|
const held = decision.heldBy?.length ? `, held by ${decision.heldBy.join(", ")}` : "";
|
|
1355
|
-
|
|
2019
|
+
// Under the pull request's approval the pending fact waits for the coverage check: a wave the
|
|
2020
|
+
// pull request's approval covers applies with no pending line at its own gate (#4588).
|
|
2021
|
+
let deferred;
|
|
2022
|
+
const deciding = approval !== "pull-request" ? port : {
|
|
2023
|
+
...port,
|
|
2024
|
+
async appendPending(input) {
|
|
2025
|
+
deferred = input;
|
|
2026
|
+
return { record: { version: 1, kind: "pending", ...input }, pushed: false };
|
|
2027
|
+
},
|
|
2028
|
+
};
|
|
2029
|
+
const check = await decideWaveGate(deciding, {
|
|
1356
2030
|
op: spec.name,
|
|
1357
2031
|
gate,
|
|
1358
2032
|
digest,
|
|
@@ -1360,7 +2034,7 @@ async function settleGate(options, ctx, decision) {
|
|
|
1360
2034
|
now,
|
|
1361
2035
|
...(spent ? { spent } : {}),
|
|
1362
2036
|
// #3861: the approval mode the wave asked under, for readers deciding which approvals count.
|
|
1363
|
-
fields: { ...decision.pending, approvalMode: approval },
|
|
2037
|
+
fields: { ...decision.pending, ...(decision.changeSet ? { changeSet: decision.changeSet } : {}), approvalMode: approval },
|
|
1364
2038
|
...(decision.neverOverMcp ? { neverOverMcp: true } : {}),
|
|
1365
2039
|
});
|
|
1366
2040
|
if (check.satisfied) {
|
|
@@ -1381,6 +2055,29 @@ async function settleGate(options, ctx, decision) {
|
|
|
1381
2055
|
if (used) {
|
|
1382
2056
|
ctx.log(`wave ${k} (${wave.name}): the approval of ${digest} by ${used.approvedBy} at ${used.approvedAt} is spent: a wave applied under it at ${used.timestamp}. Applying it again needs a new approval`);
|
|
1383
2057
|
}
|
|
2058
|
+
if (approval === "pull-request") {
|
|
2059
|
+
const covered = await approveByPullRequest(options, ctx, decision, ledger);
|
|
2060
|
+
decision.coveredBy = covered.digest ? { digest: covered.digest } : { reason: covered.reason };
|
|
2061
|
+
if (covered.digest) {
|
|
2062
|
+
for (const key of ["pendingFact", "recorded", "waitingSince", "mismatch"])
|
|
2063
|
+
delete decision[key];
|
|
2064
|
+
decision.status = "approved";
|
|
2065
|
+
decision.via = "pull-request";
|
|
2066
|
+
decision.approvedBy = covered.approvedBy;
|
|
2067
|
+
decision.approvedAt = covered.approvedAt;
|
|
2068
|
+
ctx.log(`wave ${k} (${wave.name}) applies under the pull request's approval of ${covered.digest} at ${decision.pullRequestGate}, which covers its plans`);
|
|
2069
|
+
return;
|
|
2070
|
+
}
|
|
2071
|
+
if (deferred) {
|
|
2072
|
+
const written = await port.appendPending(deferred);
|
|
2073
|
+
decision.pendingFact = written.record;
|
|
2074
|
+
decision.waitingSince = written.record.timestamp;
|
|
2075
|
+
}
|
|
2076
|
+
ctx.log(`wave ${k} (${wave.name}): the pull request's approval does not cover it (${covered.reason}), so it waits at its own gate ${gate}`);
|
|
2077
|
+
decision.status = "waiting";
|
|
2078
|
+
decision.approve = approveCommand(spec.name, gate, undefined, digest);
|
|
2079
|
+
return;
|
|
2080
|
+
}
|
|
1384
2081
|
if (approval === "pr-review") {
|
|
1385
2082
|
const byReview = await approveByReview(options, { op: spec.name, gate, k, digest, cwd, now, port: ledger, ...(spent ? { spent } : {}) });
|
|
1386
2083
|
decision.review = byReview.review;
|
|
@@ -1400,6 +2097,51 @@ async function settleGate(options, ctx, decision) {
|
|
|
1400
2097
|
decision.status = "waiting";
|
|
1401
2098
|
decision.approve = approveCommand(spec.name, gate, undefined, digest, approval === "sealed");
|
|
1402
2099
|
}
|
|
2100
|
+
/**
|
|
2101
|
+
* Under `approval: "pull-request"` (#4550, ruling B): find an approval of the
|
|
2102
|
+
* pull request's gate, under the spec's op, whose change set covers every
|
|
2103
|
+
* member of this wave's plans (`planCoveredBy`, as a resume checks a wave
|
|
2104
|
+
* against the pull request's approval). The newest such approval wins. A
|
|
2105
|
+
* spent one counts for nothing under the spend rule. Needs the plans file's
|
|
2106
|
+
* change set; without one the wave waits at its own gate.
|
|
2107
|
+
*/
|
|
2108
|
+
async function approveByPullRequest(options, ctx, decision, ledger) {
|
|
2109
|
+
const prGate = decision.pullRequestGate;
|
|
2110
|
+
if (!prGate)
|
|
2111
|
+
return { reason: "the spec at base names no approvals.pullRequest.gate" };
|
|
2112
|
+
const fresh = ctx.changeSetDoc;
|
|
2113
|
+
if (!fresh)
|
|
2114
|
+
return { reason: "the plans file carries no change set to check the approval against" };
|
|
2115
|
+
const { planCoveredBy } = await import("../components/pr-run.js");
|
|
2116
|
+
const read = options.changeSets ?? (async (d) => {
|
|
2117
|
+
const { readStoredChangeSet } = await import("../lifecycle/change-set-store.js");
|
|
2118
|
+
const got = await readStoredChangeSet(d, { cwd: ctx.cwd });
|
|
2119
|
+
return got.status === "found" ? got.document : undefined;
|
|
2120
|
+
});
|
|
2121
|
+
const { resolutions } = await ledger.read(ctx.spec.name);
|
|
2122
|
+
const spent = decision.spend === "base" ? ((await ledger.readApplied?.(ctx.spec.name)) ?? []).filter((a) => a.gate === prGate) : [];
|
|
2123
|
+
const approvals = resolutions.filter((r) => r.gate === prGate && (r.changeSet ?? r.planDigest)).sort((a, b) => (a.timestamp < b.timestamp ? 1 : -1));
|
|
2124
|
+
if (approvals.length === 0)
|
|
2125
|
+
return { reason: `no approval stands at ${prGate}` };
|
|
2126
|
+
let reason = `no approval at ${prGate} covers it`;
|
|
2127
|
+
for (const r of approvals) {
|
|
2128
|
+
const digest = (r.changeSet ?? r.planDigest);
|
|
2129
|
+
if (spent.some((a) => a.planDigest === digest && a.approvedAt === r.timestamp)) {
|
|
2130
|
+
reason = `the approval of ${digest} at ${prGate} is spent`;
|
|
2131
|
+
continue;
|
|
2132
|
+
}
|
|
2133
|
+
const approved = await read(digest).catch(() => undefined);
|
|
2134
|
+
if (!approved) {
|
|
2135
|
+
reason = `the change set ${digest} the approval names is not stored`;
|
|
2136
|
+
continue;
|
|
2137
|
+
}
|
|
2138
|
+
const why = fresh.members.map((m) => planCoveredBy(approved, fresh, m.member)).find((w) => w !== undefined);
|
|
2139
|
+
if (why === undefined)
|
|
2140
|
+
return { digest, approvedBy: r.resolvedBy, approvedAt: r.timestamp, reason: "" };
|
|
2141
|
+
reason = why;
|
|
2142
|
+
}
|
|
2143
|
+
return { reason };
|
|
2144
|
+
}
|
|
1403
2145
|
/** The commits after `base` up to `head`, merge commits left out, for the `Requested-by:` trailers on them (#4333). */
|
|
1404
2146
|
const gitCommitsBetween = (cwd) => (base, head) => {
|
|
1405
2147
|
try {
|
|
@@ -1538,7 +2280,7 @@ async function settleQuorumGate(options, ctx, decision, rules) {
|
|
|
1538
2280
|
description: (typeof decision.pending?.description === "string" ? decision.pending.description : undefined) ?? `wave ${k} (${wave.name}): ${members.length} run${members.length === 1 ? "" : "s"}, gate ${policy}, approval ${approval}${held}`,
|
|
1539
2281
|
now,
|
|
1540
2282
|
...(spent ? { spent } : {}),
|
|
1541
|
-
fields: { ...decision.pending, approvalMode: approval },
|
|
2283
|
+
fields: { ...decision.pending, ...(decision.changeSet ? { changeSet: decision.changeSet } : {}), approvalMode: approval },
|
|
1542
2284
|
...(decision.neverOverMcp ? { neverOverMcp: true } : {}),
|
|
1543
2285
|
approval: { quorum: rules, mode: "log-only" },
|
|
1544
2286
|
judge,
|
|
@@ -1593,7 +2335,7 @@ async function settlePointGate(options, ctx, decision, point) {
|
|
|
1593
2335
|
planDigest: digest,
|
|
1594
2336
|
...(options.now ? { now: options.now } : {}),
|
|
1595
2337
|
// #3863: the plans file's pending fields and the spec's neverOverMcp, as settleGate passes them.
|
|
1596
|
-
fields: { ...decision.pending, approvalMode: decision.approval },
|
|
2338
|
+
fields: { ...decision.pending, ...(decision.changeSet ? { changeSet: decision.changeSet } : {}), approvalMode: decision.approval },
|
|
1597
2339
|
...(decision.neverOverMcp ? { neverOverMcp: true } : {}),
|
|
1598
2340
|
});
|
|
1599
2341
|
if (check.satisfied) {
|
|
@@ -1649,12 +2391,31 @@ async function settleHolds(options, ctx, decision, holds, recordPath) {
|
|
|
1649
2391
|
if (recordPath)
|
|
1650
2392
|
await runGateHooks(ctx, decision, recordPath);
|
|
1651
2393
|
log(`wave ${k} (${wave.name}) is held by ${holds.join(", ")}, and nobody approved ${decision.digest}; nothing applied. Approve: ${decision.approve}`);
|
|
1652
|
-
result.exitCode =
|
|
2394
|
+
result.exitCode = CHANT_EXIT.waiting;
|
|
1653
2395
|
return false;
|
|
1654
2396
|
}
|
|
1655
2397
|
log(`wave ${k} (${wave.name}) is held by ${holds.join(", ")}, and ${decision.approvedBy} approved its digest`);
|
|
1656
2398
|
return true;
|
|
1657
2399
|
}
|
|
2400
|
+
/**
|
|
2401
|
+
* The runs a failed `applyWave` call says it applied (#4291 on op waves):
|
|
2402
|
+
* `{ "applied": [<target>...] }` at `CHANT_APPLY_RUNS_RESULT`. Absent or
|
|
2403
|
+
* unreadable, none did, as before.
|
|
2404
|
+
*/
|
|
2405
|
+
function readAppliedRuns(path, label, log) {
|
|
2406
|
+
if (!existsSync(path))
|
|
2407
|
+
return undefined;
|
|
2408
|
+
try {
|
|
2409
|
+
const got = JSON.parse(readFileSync(path, "utf-8"));
|
|
2410
|
+
if (Array.isArray(got?.applied) && got.applied.every((t) => typeof t === "string"))
|
|
2411
|
+
return got.applied;
|
|
2412
|
+
}
|
|
2413
|
+
catch {
|
|
2414
|
+
// Read as absent below.
|
|
2415
|
+
}
|
|
2416
|
+
log(`${label}: CHANT_APPLY_RUNS_RESULT is not { "applied": [<target>...] }, so no run counts as applied`);
|
|
2417
|
+
return undefined;
|
|
2418
|
+
}
|
|
1658
2419
|
/** Read what an apply wrote to `CHANT_APPLY_OUTCOME` (#3821), or undefined when it wrote nothing. A file that says something else is logged and ignored. */
|
|
1659
2420
|
function readApplyOutcome(path, label, log) {
|
|
1660
2421
|
if (!existsSync(path))
|
|
@@ -1687,6 +2448,7 @@ async function callApply(options, ctx, decision, runs, planned, argv, call, reco
|
|
|
1687
2448
|
const filePath = `${dir}/${call.key}.json`;
|
|
1688
2449
|
const resultPath = `${dir}/${call.key}-result.json`;
|
|
1689
2450
|
const outcomePath = `${dir}/${call.key}-outcome.json`;
|
|
2451
|
+
const appliedRunsPath = `${dir}/${call.key}-runs-result.json`;
|
|
1690
2452
|
const handed = {};
|
|
1691
2453
|
if (byApply) {
|
|
1692
2454
|
for (const m of ["before-apply", "after-apply"])
|
|
@@ -1706,7 +2468,7 @@ async function callApply(options, ctx, decision, runs, planned, argv, call, reco
|
|
|
1706
2468
|
approved,
|
|
1707
2469
|
...(decision.heldBy?.length ? { heldBy: decision.heldBy } : {}),
|
|
1708
2470
|
runBy: byApply ? "apply" : "chant",
|
|
1709
|
-
runs: hookRuns(
|
|
2471
|
+
runs: hookRuns(ctx, runs, planned),
|
|
1710
2472
|
runsFile: call.runsPath,
|
|
1711
2473
|
hooks: handed,
|
|
1712
2474
|
outcomes: [...result.hooks],
|
|
@@ -1716,9 +2478,13 @@ async function callApply(options, ctx, decision, runs, planned, argv, call, reco
|
|
|
1716
2478
|
writeFileSync(join(cwd, filePath), JSON.stringify(file, null, 2) + "\n");
|
|
1717
2479
|
rmSync(join(cwd, resultPath), { force: true });
|
|
1718
2480
|
rmSync(join(cwd, outcomePath), { force: true });
|
|
2481
|
+
if (call.wave)
|
|
2482
|
+
rmSync(join(cwd, appliedRunsPath), { force: true });
|
|
1719
2483
|
let code;
|
|
1720
2484
|
try {
|
|
1721
|
-
|
|
2485
|
+
const env = { CHANT_HOOKS: filePath, CHANT_APPLY_OUTCOME: outcomePath, ...(call.wave ? { CHANT_APPLY_RUNS_RESULT: appliedRunsPath } : {}), ...(byApply ? { CHANT_HOOKS_RESULT: resultPath } : {}) };
|
|
2486
|
+
// #4588: an applyWave its caller runs in process.
|
|
2487
|
+
code = call.wave && options.waveExec ? await options.waveExec(argv, cwd, env) : exec(argv, cwd, env);
|
|
1722
2488
|
}
|
|
1723
2489
|
catch (err) {
|
|
1724
2490
|
log(`${call.label}: the apply did not run: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -1740,8 +2506,13 @@ async function callApply(options, ctx, decision, runs, planned, argv, call, reco
|
|
|
1740
2506
|
log(`${call.label}: the apply applied nothing: ${said.outcome}${said.reason ? ` (${said.reason})` : ""}${said.holder ? `, held by run ${said.holder.run}` : ""}`);
|
|
1741
2507
|
return { outcome: "applied-nothing", said };
|
|
1742
2508
|
}
|
|
2509
|
+
// #4291: a failed applyWave that says which runs applied fails only the others.
|
|
2510
|
+
const failedCall = () => {
|
|
2511
|
+
const applied = call.wave ? readAppliedRuns(join(cwd, appliedRunsPath), call.label, log) : undefined;
|
|
2512
|
+
return { outcome: "failed", ...(applied?.length ? { applied } : {}) };
|
|
2513
|
+
};
|
|
1743
2514
|
if (!byApply)
|
|
1744
|
-
return
|
|
2515
|
+
return code === 0 ? { outcome: "applied" } : failedCall();
|
|
1745
2516
|
let back = null;
|
|
1746
2517
|
try {
|
|
1747
2518
|
back = JSON.parse(readFileSync(join(cwd, resultPath), "utf-8"));
|
|
@@ -1770,7 +2541,7 @@ async function callApply(options, ctx, decision, runs, planned, argv, call, reco
|
|
|
1770
2541
|
if (afterFailed)
|
|
1771
2542
|
return { outcome: "applied", problem: `${call.label} applied, and then the after-apply hook ${afterFailed.name} failed` };
|
|
1772
2543
|
if (code !== 0)
|
|
1773
|
-
return
|
|
2544
|
+
return failedCall();
|
|
1774
2545
|
const skipped = ["before-apply", "after-apply"].filter((m) => handed[m] && !moments.includes(m));
|
|
1775
2546
|
if (skipped.length > 0) {
|
|
1776
2547
|
return { outcome: "applied", problem: `${call.label}: the apply exited 0 without running its ${skipped.join(" and ")} hooks (runOpWaveApplyHooks with CHANT_HOOKS), which the spec at base hands it` };
|
|
@@ -1806,13 +2577,78 @@ async function applyStage(options, ctx, decision, runs, planned, earlierHolds, r
|
|
|
1806
2577
|
await runGateHooks(ctx, decision, recordPath);
|
|
1807
2578
|
}
|
|
1808
2579
|
result.decision = decision;
|
|
1809
|
-
result.exitCode =
|
|
2580
|
+
result.exitCode = CHANT_EXIT.waiting;
|
|
1810
2581
|
return;
|
|
1811
2582
|
}
|
|
1812
2583
|
holds.push(...before.holds);
|
|
1813
2584
|
}
|
|
1814
2585
|
if (!(await settleHolds(options, ctx, decision, holds, recordPath)))
|
|
1815
2586
|
return;
|
|
2587
|
+
// #4552: on the resource grain the wave holds the rows its runs change, before its approval is spent.
|
|
2588
|
+
const lease = spec.step ? await leaseWaveRows(options, ctx, runs) : undefined;
|
|
2589
|
+
if (lease && "failed" in lease) {
|
|
2590
|
+
failed(ctx, lease.failed);
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
if (lease && "outcome" in lease) {
|
|
2594
|
+
log(`wave ${k} (${wave.name}): applied nothing: ${lease.reason}`);
|
|
2595
|
+
result.outcome = lease;
|
|
2596
|
+
result.exitCode = CHANT_EXIT.held;
|
|
2597
|
+
if (recordPath)
|
|
2598
|
+
writeRecord(recordPath, decision, result);
|
|
2599
|
+
return;
|
|
2600
|
+
}
|
|
2601
|
+
try {
|
|
2602
|
+
// #4581: under the lease the grain took, a newer commit that applies the same targets makes this apply stand down.
|
|
2603
|
+
if (await standDownForNewer(options, ctx, decision, runs, recordPath))
|
|
2604
|
+
return;
|
|
2605
|
+
await applyLeased(options, ctx, decision, runs, planned, byApply, recordPath);
|
|
2606
|
+
}
|
|
2607
|
+
finally {
|
|
2608
|
+
if (lease && !(await lease.release()))
|
|
2609
|
+
log(`wave ${k} (${wave.name}): could not let go of the rows it held; the next apply takes them over once this run is gone`);
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
/**
|
|
2613
|
+
* Stand down for a newer commit (#4581), when the spec's `standDown` (or
|
|
2614
|
+
* the job's option) asks: a newer commit on the branch whose spec at the
|
|
2615
|
+
* tip applies every one of `runs` in this wave makes the wave apply
|
|
2616
|
+
* nothing, with the `stood-down` outcome and exit 6. The approval is left
|
|
2617
|
+
* unspent. True when it stood down.
|
|
2618
|
+
*/
|
|
2619
|
+
async function standDownForNewer(options, ctx, decision, runs, recordPath) {
|
|
2620
|
+
const { spec, k, wave, cwd, log, result } = ctx;
|
|
2621
|
+
if (!(options.standDown ?? spec.standDown === true))
|
|
2622
|
+
return false;
|
|
2623
|
+
const newer = await (options.newerCommit ?? gitOpWaveNewerCommit)(cwd, options.head);
|
|
2624
|
+
if (!newer)
|
|
2625
|
+
return false;
|
|
2626
|
+
const targets = runs.map((r) => r.target);
|
|
2627
|
+
let atTip;
|
|
2628
|
+
try {
|
|
2629
|
+
const { text } = (options.show ?? gitShowAtBase)(newer.tip, options.specFile.replace(/^\.\//, "").split("\\").join(posix.sep), cwd);
|
|
2630
|
+
atTip = text === null ? null : parseOpWavesSpec(text, `${options.specFile} at ${newer.tip.slice(0, 12)}`);
|
|
2631
|
+
}
|
|
2632
|
+
catch (err) {
|
|
2633
|
+
log(`wave ${k} (${wave.name}): ${newer.branch} has a newer commit ${newer.tip.slice(0, 12)}, and its spec cannot be read (${err instanceof Error ? err.message : String(err)}), so this job applies`);
|
|
2634
|
+
return false;
|
|
2635
|
+
}
|
|
2636
|
+
if (!tipAppliesTargets(atTip, newer.branch, wave.name, targets)) {
|
|
2637
|
+
log(`wave ${k} (${wave.name}): ${newer.branch} has a newer commit ${newer.tip.slice(0, 12)}, and its wave does not apply every target of this job, so this job applies`);
|
|
2638
|
+
return false;
|
|
2639
|
+
}
|
|
2640
|
+
const reason = opWaveStandDownReason(newer, targets);
|
|
2641
|
+
log(`wave ${k} (${wave.name}): standing down, nothing applied: ${reason}`);
|
|
2642
|
+
result.outcome = { outcome: "stood-down", reason };
|
|
2643
|
+
result.supersededBy = { branch: newer.branch, commit: newer.tip };
|
|
2644
|
+
result.exitCode = CHANT_EXIT.superseded;
|
|
2645
|
+
if (recordPath)
|
|
2646
|
+
writeRecord(recordPath, decision, result);
|
|
2647
|
+
return true;
|
|
2648
|
+
}
|
|
2649
|
+
/** {@link applyStage} once its holds are settled and, on the resource grain, its rows held. */
|
|
2650
|
+
async function applyLeased(options, ctx, decision, runs, planned, byApply, recordPath) {
|
|
2651
|
+
const { spec, k, wave, log, result } = ctx;
|
|
1816
2652
|
if (!(await spendApproval(options, ctx, decision)))
|
|
1817
2653
|
return;
|
|
1818
2654
|
if (!(await spendOverrides(ctx, decision)))
|
|
@@ -1825,7 +2661,13 @@ async function applyStage(options, ctx, decision, runs, planned, earlierHolds, r
|
|
|
1825
2661
|
if (spec.applyWave) {
|
|
1826
2662
|
const runsPath = writeRunsFile(ctx, runs, planned, decision.digest);
|
|
1827
2663
|
const argv = opWaveArgv(spec.applyWave, { op: spec.op, wave: wave.name, runs: runsPath, plans: opWavePlansPath(spec, k) });
|
|
1828
|
-
|
|
2664
|
+
// #4555: one call applies every run, so each run's step spans that call.
|
|
2665
|
+
const startedMs = runs.map((r) => targetStarted(options, k, r.target))[0] ?? Date.now();
|
|
2666
|
+
const got = await callApply(options, ctx, decision, runs, planned, argv, { label: `wave ${k} (${wave.name})`, key: "hooks", runsPath, wave: true }, recordPath);
|
|
2667
|
+
const said = new Set(got.outcome === "failed" ? (got.applied ?? []) : []);
|
|
2668
|
+
const settle = (target) => (got.outcome === "applied" || said.has(target) ? "ok" : got.outcome === "failed" ? "failed" : "skipped");
|
|
2669
|
+
for (const r of runs)
|
|
2670
|
+
targetSettled(options, result, k, r.target, startedMs, settle(r.target));
|
|
1829
2671
|
if (got.outcome === "applied-nothing")
|
|
1830
2672
|
nothing = got.said;
|
|
1831
2673
|
else if (got.outcome === "applied") {
|
|
@@ -1835,6 +2677,14 @@ async function applyStage(options, ctx, decision, runs, planned, earlierHolds, r
|
|
|
1835
2677
|
}
|
|
1836
2678
|
else if (got.outcome === "waiting")
|
|
1837
2679
|
waiting = true;
|
|
2680
|
+
else if (said.size > 0) {
|
|
2681
|
+
// #4291: the apply said which runs applied, so a failure blocks only what depends on the others.
|
|
2682
|
+
const applied = runs.filter((r) => said.has(r.target)).map((r) => r.target);
|
|
2683
|
+
const failedRuns = runs.filter((r) => !said.has(r.target)).map((r) => r.target);
|
|
2684
|
+
log(`wave ${k} (${wave.name}): apply failed for ${failedRuns.join(", ")}; ${applied.join(", ")} applied`);
|
|
2685
|
+
result.applied.push(...applied);
|
|
2686
|
+
result.failed.push(...failedRuns);
|
|
2687
|
+
}
|
|
1838
2688
|
else {
|
|
1839
2689
|
log(`wave ${k} (${wave.name}): apply failed, so none of ${runs.map((r) => r.target).join(", ")} counts as applied`);
|
|
1840
2690
|
result.failed.push(...runs.map((r) => r.target));
|
|
@@ -1851,11 +2701,40 @@ async function applyStage(options, ctx, decision, runs, planned, earlierHolds, r
|
|
|
1851
2701
|
log(`${run.target}: blocked by ${by}, so not applied`);
|
|
1852
2702
|
continue;
|
|
1853
2703
|
}
|
|
2704
|
+
if (spec.step) {
|
|
2705
|
+
// #4545: the run applies through its step, with the plan the gate decided.
|
|
2706
|
+
const plan = ctx.steps?.get(run.target);
|
|
2707
|
+
if (!plan) {
|
|
2708
|
+
log(`${run.target}: this job holds no plan of it to apply`);
|
|
2709
|
+
result.failed.push(run.target);
|
|
2710
|
+
continue;
|
|
2711
|
+
}
|
|
2712
|
+
const registry = await opWaveRegistry(options, ctx.cwd, options.capabilities);
|
|
2713
|
+
const startedMs = targetStarted(options, k, run.target);
|
|
2714
|
+
const got = await applyOpWaveStep({ spec, wave, registry }, run, plan);
|
|
2715
|
+
targetSettled(options, result, k, run.target, startedMs, got.outcome === "applied" ? "ok" : got.outcome === "moved" ? "skipped" : "failed", {
|
|
2716
|
+
...(got.outcome !== "applied" ? { error: got.reason } : {}),
|
|
2717
|
+
...(got.facts ? { facts: got.facts } : {}),
|
|
2718
|
+
});
|
|
2719
|
+
if (got.outcome === "applied")
|
|
2720
|
+
result.applied.push(run.target);
|
|
2721
|
+
else if (got.outcome === "moved") {
|
|
2722
|
+
log(`${run.target}: its plan moved since wave ${k} was decided, so it was not applied: ${got.reason}`);
|
|
2723
|
+
result.moved.push(run.target);
|
|
2724
|
+
}
|
|
2725
|
+
else {
|
|
2726
|
+
log(`${run.target}: apply failed: ${got.reason}`);
|
|
2727
|
+
result.failed.push(run.target);
|
|
2728
|
+
}
|
|
2729
|
+
continue;
|
|
2730
|
+
}
|
|
1854
2731
|
const key = run.target.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
1855
2732
|
// Under runBy "apply" each run's apply runs its own apply-stage hooks, over a runs file of that run alone.
|
|
1856
2733
|
const runsPath = byApply ? writeRunsFile(ctx, [run], planned, decision.digest, `.chant/op-waves/${spec.name}/wave-${k}/${key}.runs.json`) : opWaveRunsPath(spec, k);
|
|
1857
2734
|
const argv = opWaveArgv(spec.apply ?? OP_WAVE_DEFAULT_APPLY, { op: run.op ?? spec.op, target: run.target, wave: wave.name, plan: opWavePlanPath(spec, k, run.target) });
|
|
2735
|
+
const startedMs = targetStarted(options, k, run.target);
|
|
1858
2736
|
const got = await callApply(options, ctx, decision, [run], planned, argv, { label: run.target, key: `${key}.hooks`, runsPath }, recordPath);
|
|
2737
|
+
targetSettled(options, result, k, run.target, startedMs, got.outcome === "applied" ? "ok" : got.outcome === "failed" ? "failed" : "skipped");
|
|
1859
2738
|
if (got.outcome === "applied-nothing") {
|
|
1860
2739
|
nothing = got.said;
|
|
1861
2740
|
break;
|
|
@@ -1875,6 +2754,8 @@ async function applyStage(options, ctx, decision, runs, planned, earlierHolds, r
|
|
|
1875
2754
|
}
|
|
1876
2755
|
}
|
|
1877
2756
|
}
|
|
2757
|
+
if (spec.step)
|
|
2758
|
+
await recordStepReleases(options, ctx, decision, runs);
|
|
1878
2759
|
if (recordPath && byApply)
|
|
1879
2760
|
writeRecord(recordPath, decision, result);
|
|
1880
2761
|
if (nothing) {
|
|
@@ -1884,19 +2765,24 @@ async function applyStage(options, ctx, decision, runs, planned, earlierHolds, r
|
|
|
1884
2765
|
return;
|
|
1885
2766
|
}
|
|
1886
2767
|
result.outcome = nothing;
|
|
1887
|
-
result.exitCode = nothing.outcome === "stood-down" ?
|
|
2768
|
+
result.exitCode = nothing.outcome === "stood-down" ? CHANT_EXIT.superseded : CHANT_EXIT.held;
|
|
1888
2769
|
if (recordPath)
|
|
1889
2770
|
writeRecord(recordPath, decision, result);
|
|
1890
2771
|
return;
|
|
1891
2772
|
}
|
|
1892
2773
|
if (waiting) {
|
|
1893
|
-
result.exitCode = decision.status === "refused" ? refusedExit(decision) :
|
|
2774
|
+
result.exitCode = decision.status === "refused" ? refusedExit(decision) : CHANT_EXIT.waiting;
|
|
1894
2775
|
return;
|
|
1895
2776
|
}
|
|
1896
2777
|
if (result.failed.length > 0) {
|
|
1897
2778
|
result.exitCode = 1;
|
|
1898
2779
|
return;
|
|
1899
2780
|
}
|
|
2781
|
+
// #4545: a run its step refused as moved applied nothing, so the wave exits moved and its after-apply hooks do not run.
|
|
2782
|
+
if (spec.step && result.moved.length > 0) {
|
|
2783
|
+
result.exitCode = CHANT_EXIT.moved;
|
|
2784
|
+
return;
|
|
2785
|
+
}
|
|
1900
2786
|
if (problems.length > 0) {
|
|
1901
2787
|
for (const p of problems)
|
|
1902
2788
|
log(p);
|
|
@@ -1911,6 +2797,56 @@ async function applyStage(options, ctx, decision, runs, planned, earlierHolds, r
|
|
|
1911
2797
|
if (recordPath && result.hooks.length > 0)
|
|
1912
2798
|
writeRecord(recordPath, decision, result);
|
|
1913
2799
|
}
|
|
2800
|
+
/**
|
|
2801
|
+
* The release records of the runs this wave applied through its step
|
|
2802
|
+
* (#4615), one per run, on the environment ledger each names. A record that
|
|
2803
|
+
* is not written is a line in the log; the job's exit code stays.
|
|
2804
|
+
*/
|
|
2805
|
+
async function recordStepReleases(options, ctx, decision, runs) {
|
|
2806
|
+
const { spec, k, wave, log, result } = ctx;
|
|
2807
|
+
if (options.releases === false)
|
|
2808
|
+
return;
|
|
2809
|
+
const port = options.releases ?? (options.gates ? undefined : gitOpWaveReleasePort({ cwd: ctx.cwd }));
|
|
2810
|
+
if (!port)
|
|
2811
|
+
return;
|
|
2812
|
+
const applied = new Set(result.applied);
|
|
2813
|
+
let gitSha = options.head;
|
|
2814
|
+
const requests = [];
|
|
2815
|
+
for (const run of runs) {
|
|
2816
|
+
if (!applied.has(run.target))
|
|
2817
|
+
continue;
|
|
2818
|
+
const names = opWaveReleaseNames(spec, wave, run);
|
|
2819
|
+
const plan = ctx.steps?.get(run.target);
|
|
2820
|
+
if (!names || !plan)
|
|
2821
|
+
continue;
|
|
2822
|
+
if (gitSha === undefined) {
|
|
2823
|
+
try {
|
|
2824
|
+
gitSha = execFileSync("git", ["rev-parse", "HEAD"], { cwd: ctx.cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
2825
|
+
}
|
|
2826
|
+
catch {
|
|
2827
|
+
gitSha = "";
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
requests.push({ ...names, target: run.target, planDigest: plan.planDigest, ...(gitSha ? { gitSha } : {}), ...(decision.approvedBy ? { approver: decision.approvedBy } : {}) });
|
|
2831
|
+
}
|
|
2832
|
+
if (requests.length === 0)
|
|
2833
|
+
return;
|
|
2834
|
+
let outcomes;
|
|
2835
|
+
try {
|
|
2836
|
+
outcomes = await port.record(requests);
|
|
2837
|
+
}
|
|
2838
|
+
catch (err) {
|
|
2839
|
+
log(`wave ${k} (${wave.name}): applied, and no release record was written: ${err instanceof Error ? err.message : String(err)}`);
|
|
2840
|
+
return;
|
|
2841
|
+
}
|
|
2842
|
+
for (const [i, req] of requests.entries()) {
|
|
2843
|
+
const got = outcomes[i];
|
|
2844
|
+
if (got?.recorded)
|
|
2845
|
+
log(`${req.target}: recorded on the "${got.env}" release ledger as ${got.component} ${got.digest}${got.releaseDigest ? ` under release ${got.releaseDigest}` : ""}`);
|
|
2846
|
+
else
|
|
2847
|
+
log(`${req.target}: applied, and no release record was written for ${req.component} in "${req.env}": ${got?.reason ?? "the port gave no answer"}`);
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
1914
2850
|
/**
|
|
1915
2851
|
* Record that the wave applies under its approval (#3784), which spends it:
|
|
1916
2852
|
* one line in `_gates/<name>/applied.jsonl`, before anything applies, as
|
|
@@ -2034,7 +2970,11 @@ export async function recordOpWaveHeadPlans(options) {
|
|
|
2034
2970
|
const last = spec.waves[spec.waves.length - 1];
|
|
2035
2971
|
for (let k = 1;; k++) {
|
|
2036
2972
|
const wave = spec.waves[k - 1] ?? last;
|
|
2037
|
-
const
|
|
2973
|
+
const steps = new Map();
|
|
2974
|
+
const { members, extras: planExtras, waves: found } = await planWaveRuns({ spec, k, wave, cwd, exec, options, steps }, wave.runs, wave.discover === true);
|
|
2975
|
+
// #4545: a cost hold's member is in the digest the merged wave decides, so the head's digest carries it too.
|
|
2976
|
+
const cost = spec.holds?.cost ? costVerdictOf(spec.holds.cost, spec, k, members, steps, cwd, options.holdExec).member : undefined;
|
|
2977
|
+
const extras = cost ? [...(planExtras ?? []), cost] : planExtras;
|
|
2038
2978
|
plans.waves.push({ wave: k, name: wave.name, digest: opWaveSetDigest(spec, members, extras) });
|
|
2039
2979
|
if (k >= spec.waves.length && !(last.rest && found !== undefined && k < found))
|
|
2040
2980
|
break;
|