@intentius/chant 0.124.54 → 0.124.56
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/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.map +1 -1
- package/dist/capabilities/templates.js +1 -2
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +2 -3
- package/dist/ci-agent.d.ts +381 -0
- package/dist/ci-agent.d.ts.map +1 -0
- package/dist/ci-agent.js +832 -0
- package/dist/ci-audit/attribution.d.ts +111 -0
- package/dist/ci-audit/attribution.d.ts.map +1 -0
- package/dist/ci-audit/attribution.js +194 -0
- package/dist/ci-audit/audit-log.d.ts +144 -0
- package/dist/ci-audit/audit-log.d.ts.map +1 -0
- package/dist/ci-audit/audit-log.js +149 -0
- package/dist/ci-audit/index.d.ts +12 -0
- package/dist/ci-audit/index.d.ts.map +1 -0
- package/dist/ci-audit/index.js +12 -0
- package/dist/ci-audit/unrecorded.d.ts +74 -0
- package/dist/ci-audit/unrecorded.d.ts.map +1 -0
- package/dist/ci-audit/unrecorded.js +95 -0
- package/dist/ci-audit.d.ts +3 -0
- package/dist/ci-audit.d.ts.map +1 -0
- package/dist/ci-audit.js +2 -0
- package/dist/ci-control.d.ts +42 -0
- package/dist/ci-control.d.ts.map +1 -0
- package/dist/ci-control.js +41 -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 +92 -0
- package/dist/ci-estate.d.ts.map +1 -0
- package/dist/ci-estate.js +82 -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 +82 -7
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +86 -15
- package/dist/ci-job-guard.d.ts +139 -0
- package/dist/ci-job-guard.d.ts.map +1 -0
- package/dist/ci-job-guard.js +287 -0
- package/dist/ci-jobs.d.ts +7 -0
- package/dist/ci-jobs.d.ts.map +1 -1
- package/dist/ci-jobs.js +7 -0
- package/dist/ci-product-words.d.ts +296 -0
- package/dist/ci-product-words.d.ts.map +1 -0
- package/dist/ci-product-words.js +407 -0
- package/dist/ci-product.d.ts +117 -0
- package/dist/ci-product.d.ts.map +1 -0
- package/dist/ci-product.js +113 -0
- package/dist/ci-respond-run.d.ts +73 -0
- package/dist/ci-respond-run.d.ts.map +1 -0
- package/dist/ci-respond-run.js +247 -0
- package/dist/ci-respond.d.ts +189 -0
- package/dist/ci-respond.d.ts.map +1 -0
- package/dist/ci-respond.js +285 -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/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/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/audit-log.d.ts +12 -0
- package/dist/cli/handlers/audit-log.d.ts.map +1 -0
- package/dist/cli/handlers/audit-log.js +81 -0
- package/dist/cli/handlers/build.d.ts +7 -0
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +124 -1
- package/dist/cli/handlers/ci-check-job.d.ts +11 -0
- package/dist/cli/handlers/ci-check-job.d.ts.map +1 -0
- package/dist/cli/handlers/ci-check-job.js +27 -0
- 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 +63 -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/e2e-safe-run.d.ts +12 -0
- package/dist/cli/handlers/e2e-safe-run.d.ts.map +1 -0
- package/dist/cli/handlers/e2e-safe-run.js +23 -0
- package/dist/cli/handlers/fan-out.js +4 -0
- 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/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 +6 -2
- package/dist/cli/handlers/lifecycle-drift.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle-drift.js +7 -2
- package/dist/cli/handlers/lock.d.ts.map +1 -1
- package/dist/cli/handlers/lock.js +64 -5
- 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 +43 -3
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +908 -205
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +21 -2
- 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 +160 -2
- 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/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 +178 -13
- 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/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/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-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 +164 -3
- package/dist/cli/registry.d.ts +73 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/cloud-lister/sigv4.d.ts +42 -7
- package/dist/cloud-lister/sigv4.d.ts.map +1 -1
- package/dist/cloud-lister/sigv4.js +72 -22
- package/dist/components/adoption.d.ts +69 -0
- package/dist/components/adoption.d.ts.map +1 -0
- package/dist/components/adoption.js +92 -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.d.ts +159 -5
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/capability.js +39 -6
- package/dist/components/check-hooks.d.ts +116 -0
- package/dist/components/check-hooks.d.ts.map +1 -0
- package/dist/components/check-hooks.js +192 -0
- package/dist/components/check-steps.d.ts +74 -0
- package/dist/components/check-steps.d.ts.map +1 -0
- package/dist/components/check-steps.js +102 -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 +60 -0
- package/dist/components/cli-support.d.ts +13 -0
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/cli-support.js +10 -2
- package/dist/components/driver.d.ts +32 -3
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +59 -5
- package/dist/components/fan-out-run.d.ts +12 -0
- package/dist/components/fan-out-run.d.ts.map +1 -1
- package/dist/components/fan-out-run.js +56 -16
- package/dist/components/groups.d.ts.map +1 -1
- package/dist/components/groups.js +23 -5
- 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 +38 -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 +32 -4
- package/dist/components/pr-environment.d.ts.map +1 -1
- package/dist/components/pr-environment.js +26 -8
- package/dist/components/pr-pipeline.d.ts +297 -5
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +329 -18
- 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 +71 -0
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +91 -7
- 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 +250 -0
- package/dist/components/product-pipeline.d.ts.map +1 -0
- package/dist/components/product-pipeline.js +212 -0
- package/dist/components/promote.d.ts +6 -0
- package/dist/components/promote.d.ts.map +1 -1
- package/dist/components/promote.js +4 -1
- 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-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/wave-plan.d.ts +42 -0
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +72 -4
- 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/discovery/sandbox/bundle.d.ts.map +1 -1
- package/dist/discovery/sandbox/bundle.js +25 -1
- package/dist/e2e-harness/bucket.d.ts +21 -0
- package/dist/e2e-harness/bucket.d.ts.map +1 -0
- package/dist/e2e-harness/bucket.js +61 -0
- package/dist/e2e-harness/claim.d.ts +70 -0
- package/dist/e2e-harness/claim.d.ts.map +1 -0
- package/dist/e2e-harness/claim.js +98 -0
- package/dist/e2e-harness/driver.d.ts +64 -0
- package/dist/e2e-harness/driver.d.ts.map +1 -0
- package/dist/e2e-harness/driver.js +243 -0
- package/dist/e2e-harness/forgejo.d.ts +77 -0
- package/dist/e2e-harness/forgejo.d.ts.map +1 -0
- package/dist/e2e-harness/forgejo.js +205 -0
- package/dist/e2e-harness/git.d.ts +32 -0
- package/dist/e2e-harness/git.d.ts.map +1 -0
- package/dist/e2e-harness/git.js +67 -0
- package/dist/e2e-harness/index.d.ts +22 -0
- package/dist/e2e-harness/index.d.ts.map +1 -0
- package/dist/e2e-harness/index.js +48 -0
- package/dist/e2e-harness/jobs.d.ts +8 -0
- package/dist/e2e-harness/jobs.d.ts.map +1 -0
- package/dist/e2e-harness/jobs.js +34 -0
- package/dist/e2e-harness/pins.d.ts +45 -0
- package/dist/e2e-harness/pins.d.ts.map +1 -0
- package/dist/e2e-harness/pins.js +44 -0
- package/dist/e2e-harness/ports.d.ts +113 -0
- package/dist/e2e-harness/ports.d.ts.map +1 -0
- package/dist/e2e-harness/ports.js +4 -0
- package/dist/e2e-harness/reports.d.ts +45 -0
- package/dist/e2e-harness/reports.d.ts.map +1 -0
- package/dist/e2e-harness/reports.js +57 -0
- package/dist/e2e-harness/safe-run-cli.d.ts +17 -0
- package/dist/e2e-harness/safe-run-cli.d.ts.map +1 -0
- package/dist/e2e-harness/safe-run-cli.js +43 -0
- package/dist/e2e-harness/safe-run.d.ts +61 -0
- package/dist/e2e-harness/safe-run.d.ts.map +1 -0
- package/dist/e2e-harness/safe-run.js +172 -0
- package/dist/e2e-harness/scenario.d.ts +11 -0
- package/dist/e2e-harness/scenario.d.ts.map +1 -0
- package/dist/e2e-harness/scenario.js +89 -0
- package/dist/e2e-harness/schemas/demo-cycle.schema.json +282 -0
- package/dist/e2e-harness/schemas/demo-step.schema.json +245 -0
- package/dist/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
- package/dist/e2e-harness/schemas/e2e-claims.schema.json +18 -0
- package/dist/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
- package/dist/e2e-harness/schemas/index.d.ts +191 -0
- package/dist/e2e-harness/schemas/index.d.ts.map +1 -0
- package/dist/e2e-harness/schemas/index.js +62 -0
- package/dist/e2e-harness/stack.d.ts +124 -0
- package/dist/e2e-harness/stack.d.ts.map +1 -0
- package/dist/e2e-harness/stack.js +207 -0
- package/dist/e2e-harness/steps.d.ts +11 -0
- package/dist/e2e-harness/steps.d.ts.map +1 -0
- package/dist/e2e-harness/steps.js +22 -0
- package/dist/e2e-harness.d.ts +3 -0
- package/dist/e2e-harness.d.ts.map +1 -0
- package/dist/e2e-harness.js +2 -0
- package/dist/engine-facts.d.ts.map +1 -1
- package/dist/engine-facts.js +1 -2
- package/dist/exit-codes.d.ts +54 -0
- package/dist/exit-codes.d.ts.map +1 -0
- package/dist/exit-codes.js +55 -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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/lexicon.d.ts +152 -6
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/adoption-file.d.ts +24 -0
- package/dist/lifecycle/adoption-file.d.ts.map +1 -1
- package/dist/lifecycle/adoption-file.js +1 -2
- package/dist/lifecycle/cloud-index.d.ts.map +1 -1
- package/dist/lifecycle/cloud-index.js +1 -2
- 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 +10 -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 +204 -0
- package/dist/lifecycle/identity-match.d.ts +15 -0
- package/dist/lifecycle/identity-match.d.ts.map +1 -1
- package/dist/lifecycle/identity-match.js +11 -6
- package/dist/lifecycle/index-diff.d.ts +40 -0
- package/dist/lifecycle/index-diff.d.ts.map +1 -1
- package/dist/lifecycle/index-diff.js +1 -2
- package/dist/lifecycle/index-document.d.ts.map +1 -1
- package/dist/lifecycle/index-document.js +1 -2
- package/dist/lifecycle/index-import.d.ts +4 -1
- package/dist/lifecycle/index-import.d.ts.map +1 -1
- package/dist/lifecycle/index-import.js +29 -32
- 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/query.d.ts +50 -3
- package/dist/lifecycle/query.d.ts.map +1 -1
- package/dist/lifecycle/query.js +97 -7
- 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 +9 -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 +106 -0
- package/dist/lifecycle/release-status.d.ts.map +1 -0
- package/dist/lifecycle/release-status.js +115 -0
- 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/snapshot-store-s3.d.ts +36 -3
- package/dist/lifecycle/snapshot-store-s3.d.ts.map +1 -1
- package/dist/lifecycle/snapshot-store-s3.js +9 -44
- package/dist/lifecycle/snapshot-store.d.ts.map +1 -1
- package/dist/lifecycle/snapshot-store.js +1 -2
- 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/wave-plans.d.ts +23 -7
- package/dist/lifecycle/wave-plans.d.ts.map +1 -1
- package/dist/lifecycle/wave-plans.js +9 -2
- 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/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/approval-status.d.ts +103 -0
- package/dist/op/approval-status.d.ts.map +1 -0
- package/dist/op/approval-status.js +197 -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 +12 -1
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +7 -1
- 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 +63 -0
- package/dist/op/op-waves-capability-spec.d.ts.map +1 -0
- package/dist/op/op-waves-capability-spec.js +115 -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 +96 -0
- package/dist/op/op-waves-run.d.ts +182 -6
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +1076 -44
- 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 +96 -0
- package/dist/op/op-waves.d.ts +187 -8
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +203 -19
- package/dist/op/runtime.d.ts +95 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/op/runtime.js +18 -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 +425 -0
- package/dist/override-gate.d.ts.map +1 -1
- package/dist/override-gate.js +5 -0
- package/dist/parallelism.d.ts +17 -0
- package/dist/parallelism.d.ts.map +1 -0
- package/dist/parallelism.js +33 -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 +102 -0
- package/dist/pr-forge.d.ts +40 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +146 -37
- package/dist/pr-loop.d.ts +158 -11
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +302 -44
- package/dist/pr-merge.d.ts +64 -0
- package/dist/pr-merge.d.ts.map +1 -0
- package/dist/pr-merge.js +78 -0
- package/dist/pr-post.d.ts +86 -1
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +141 -5
- 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 +45 -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/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/run-event.d.ts +26 -1
- package/dist/run-event.d.ts.map +1 -1
- package/dist/run-event.js +3 -1
- package/dist/scheduled-op-cloud.d.ts +32 -0
- package/dist/scheduled-op-cloud.d.ts.map +1 -0
- package/dist/scheduled-op-cloud.js +69 -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 +405 -287
- 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-lock-grain.d.ts +17 -0
- package/dist/workspace/ci-lock-grain.d.ts.map +1 -0
- package/dist/workspace/ci-lock-grain.js +21 -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 +10 -3
- 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.map +1 -1
- package/dist/workspace/drift-cli.js +8 -3
- 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/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/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/pr-report.schema.json +79 -3
- package/dist/workspace/promote.d.ts +1 -1
- package/dist/workspace/promote.d.ts.map +1 -1
- package/dist/workspace/promote.js +2 -1
- 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/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 +21 -1
- 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/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.test.ts +2 -3
- package/src/capabilities/templates.ts +1 -2
- package/src/cdk/advise.test.ts +1 -1
- package/src/change-set-bundle.test.ts +0 -1
- package/src/change-set.ts +2 -3
- package/src/ci-agent.test.ts +348 -0
- package/src/ci-agent.ts +1025 -0
- package/src/ci-audit/__fixtures__/cloudtrail-lookup-bucket.json +37 -0
- package/src/ci-audit/__fixtures__/cloudtrail-writes-window.json +59 -0
- package/src/ci-audit/attribution.ts +260 -0
- package/src/ci-audit/audit-log.ts +220 -0
- package/src/ci-audit/ci-audit.test.ts +175 -0
- package/src/ci-audit/index.ts +15 -0
- package/src/ci-audit/unrecorded.ts +140 -0
- package/src/ci-audit.ts +2 -0
- package/src/ci-control.ts +173 -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 +175 -0
- package/src/ci-handover.ts +67 -16
- package/src/ci-identity-database.test.ts +54 -0
- package/src/ci-identity-pulumi.test.ts +163 -0
- package/src/ci-identity-targets.test.ts +3 -1
- package/src/ci-identity.ts +123 -22
- package/src/ci-job-guard.test.ts +154 -0
- package/src/ci-job-guard.ts +319 -0
- package/src/ci-jobs.ts +8 -0
- package/src/ci-product-comment-targets.test.ts +45 -0
- package/src/ci-product-words.test.ts +101 -0
- package/src/ci-product-words.ts +565 -0
- package/src/ci-product.ts +226 -0
- package/src/ci-respond-run.ts +291 -0
- package/src/ci-respond.test.ts +264 -0
- package/src/ci-respond.ts +412 -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/init.ts +3 -1
- 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/audit-log.ts +74 -0
- package/src/cli/handlers/build-pr-loop-flags.test.ts +98 -0
- package/src/cli/handlers/build.test.ts +7 -0
- package/src/cli/handlers/build.ts +113 -1
- package/src/cli/handlers/ci-check-job.test.ts +114 -0
- package/src/cli/handlers/ci-check-job.ts +33 -0
- package/src/cli/handlers/ci-check.ts +63 -0
- package/src/cli/handlers/ci-forge-check.ts +91 -0
- package/src/cli/handlers/e2e-safe-run.ts +27 -0
- package/src/cli/handlers/fan-out.test.ts +10 -10
- package/src/cli/handlers/fan-out.ts +5 -0
- package/src/cli/handlers/gate-pending.ts +46 -0
- package/src/cli/handlers/init.ts +1 -0
- package/src/cli/handlers/ledger.ts +1 -1
- package/src/cli/handlers/lifecycle-drift.ts +7 -2
- package/src/cli/handlers/lock.test.ts +29 -2
- package/src/cli/handlers/lock.ts +66 -6
- 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-comment-targets.test.ts +166 -0
- package/src/cli/handlers/pr-plan-flags.test.ts +161 -0
- package/src/cli/handlers/pr-plan-targets.test.ts +155 -0
- package/src/cli/handlers/pr-waves-blocked.test.ts +5 -0
- 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 +879 -205
- package/src/cli/handlers/promote.test.ts +5 -5
- package/src/cli/handlers/promote.ts +22 -2
- package/src/cli/handlers/release.ts +2 -0
- package/src/cli/handlers/run-components-exit.test.ts +7 -7
- package/src/cli/handlers/run-wave.ts +144 -2
- package/src/cli/handlers/run.test.ts +6 -4
- package/src/cli/handlers/run.ts +86 -1
- package/src/cli/handlers/serve.ts +10 -1
- package/src/cli/main.test.ts +1 -1
- package/src/cli/main.ts +180 -13
- package/src/cli/mcp/ledger-tools.ts +126 -0
- 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/server.test.ts +5 -4
- package/src/cli/mcp/server.ts +90 -16
- package/src/cli/mcp-config.ts +8 -3
- package/src/cli/parse-args.ts +119 -2
- package/src/cli/registry.ts +73 -0
- package/src/cloud-lister/sigv4.ts +80 -23
- package/src/components/adoption.test.ts +140 -0
- package/src/components/adoption.ts +140 -0
- package/src/components/apply-lease.ts +49 -0
- package/src/components/capability.ts +180 -6
- package/src/components/check-hooks.test.ts +66 -0
- package/src/components/check-hooks.ts +255 -0
- package/src/components/check-steps.test.ts +70 -0
- package/src/components/check-steps.ts +158 -0
- package/src/components/ci-services.test.ts +51 -0
- package/src/components/ci-services.ts +82 -0
- package/src/components/cli-support.ts +23 -2
- package/src/components/driver.test.ts +3 -3
- package/src/components/driver.ts +73 -6
- package/src/components/fan-out-run.ts +68 -18
- package/src/components/groups.ts +21 -4
- package/src/components/plan-flags.test.ts +46 -0
- package/src/components/pr-comment-preview-targets.test.ts +34 -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 +42 -0
- package/src/components/pr-env-ports.ts +29 -4
- package/src/components/pr-env-run-bundle.test.ts +2 -14
- 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 +40 -8
- package/src/components/pr-pipeline-runners.test.ts +80 -0
- package/src/components/pr-pipeline.test.ts +15 -0
- package/src/components/pr-pipeline.ts +498 -18
- package/src/components/pr-policy.ts +45 -7
- package/src/components/pr-run.test.ts +1 -1
- package/src/components/pr-run.ts +138 -11
- package/src/components/pr-stale-job.test.ts +34 -0
- 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 +383 -0
- package/src/components/promote.ts +10 -1
- package/src/components/release-compile.ts +87 -1
- 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/wave-plan-policy.test.ts +19 -0
- package/src/components/wave-plan.ts +96 -6
- 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/discovery/sandbox/bundle.ts +25 -1
- package/src/e2e-harness/__project__/chant.config.ts +4 -0
- package/src/e2e-harness/__project__/src/compose.ts +33 -0
- package/src/e2e-harness/bucket.ts +69 -0
- package/src/e2e-harness/claim.test.ts +150 -0
- package/src/e2e-harness/claim.ts +140 -0
- package/src/e2e-harness/driver.test.ts +304 -0
- package/src/e2e-harness/driver.ts +294 -0
- package/src/e2e-harness/forgejo.ts +267 -0
- package/src/e2e-harness/git.ts +96 -0
- package/src/e2e-harness/index.ts +50 -0
- package/src/e2e-harness/jobs.ts +35 -0
- package/src/e2e-harness/pins.ts +52 -0
- package/src/e2e-harness/ports.ts +130 -0
- package/src/e2e-harness/reports.ts +79 -0
- package/src/e2e-harness/safe-run-cli.test.ts +102 -0
- package/src/e2e-harness/safe-run-cli.ts +54 -0
- package/src/e2e-harness/safe-run.ts +198 -0
- package/src/e2e-harness/scenario.ts +89 -0
- package/src/e2e-harness/schemas/README.md +62 -0
- package/src/e2e-harness/schemas/demo-cycle.schema.json +282 -0
- package/src/e2e-harness/schemas/demo-step.schema.json +245 -0
- package/src/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
- package/src/e2e-harness/schemas/e2e-claims.schema.json +18 -0
- package/src/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
- package/src/e2e-harness/schemas/index.ts +220 -0
- package/src/e2e-harness/schemas.test.ts +145 -0
- package/src/e2e-harness/stack.test.ts +124 -0
- package/src/e2e-harness/stack.ts +306 -0
- package/src/e2e-harness/steps.ts +30 -0
- package/src/e2e-harness.ts +2 -0
- package/src/engine-facts.test.ts +2 -3
- package/src/engine-facts.ts +1 -2
- package/src/exit-codes.test.ts +32 -0
- package/src/exit-codes.ts +61 -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 +11 -0
- package/src/gate-decision.ts +3 -0
- package/src/gate-policy.ts +92 -3
- package/src/gated-waves-bundle.test.ts +0 -1
- package/src/index.ts +2 -0
- package/src/lexicon.ts +143 -6
- package/src/lifecycle/adoption-file.ts +1 -2
- package/src/lifecycle/cloud-index.test.ts +2 -3
- package/src/lifecycle/cloud-index.ts +1 -2
- package/src/lifecycle/control-entries-ledger.test.ts +69 -0
- package/src/lifecycle/gate-applied.ts +6 -0
- package/src/lifecycle/gate-ledger.ts +35 -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 +279 -0
- package/src/lifecycle/identity-match.ts +25 -6
- package/src/lifecycle/index-diff.ts +1 -2
- package/src/lifecycle/index-document.ts +1 -2
- package/src/lifecycle/index-import.test.ts +14 -0
- package/src/lifecycle/index-import.ts +54 -34
- 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/publish-target-context.test.ts +108 -0
- package/src/lifecycle/query.test.ts +2 -3
- package/src/lifecycle/query.ts +109 -8
- 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 +192 -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 +19 -0
- package/src/lifecycle/release-publish.ts +45 -22
- package/src/lifecycle/release-read.ts +2 -0
- package/src/lifecycle/release-status.test.ts +185 -0
- package/src/lifecycle/release-status.ts +175 -0
- 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/snapshot-store-s3.ts +9 -45
- package/src/lifecycle/snapshot-store.ts +1 -2
- package/src/lifecycle/target-lock.ts +24 -9
- package/src/lifecycle/wave-plans.ts +33 -5
- 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/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/approval-status.test.ts +134 -0
- package/src/op/approval-status.ts +235 -0
- package/src/op/gate-review.test.ts +2 -1
- package/src/op/gate.ts +81 -22
- package/src/op/generate-pipeline.ts +7 -1
- package/src/op/index.ts +23 -0
- package/src/op/op-waves-after-plan.test.ts +288 -0
- package/src/op/op-waves-after-plan.ts +238 -0
- package/src/op/op-waves-capability-spec.ts +133 -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-parallelism.test.ts +89 -0
- package/src/op/op-waves-pull-request.test.ts +219 -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 +132 -0
- package/src/op/op-waves-run-record.test.ts +32 -0
- package/src/op/op-waves-run.ts +1235 -52
- package/src/op/op-waves-stand-down.test.ts +240 -0
- package/src/op/op-waves-stand-down.ts +107 -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 +320 -22
- package/src/op/runtime.ts +107 -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 +543 -0
- package/src/override-gate-bundle.test.ts +2 -0
- package/src/override-gate.ts +4 -0
- package/src/parallelism.test.ts +38 -0
- package/src/parallelism.ts +33 -0
- package/src/policy-packs.ts +230 -0
- package/src/policy-source.test.ts +256 -0
- package/src/policy-source.ts +111 -0
- package/src/pr-forge-bundle.test.ts +1 -1
- package/src/pr-forge.ts +175 -33
- package/src/pr-loop-bundle.test.ts +7 -3
- package/src/pr-loop-narrowed.test.ts +63 -0
- package/src/pr-loop-words.test.ts +155 -0
- package/src/pr-loop.ts +398 -52
- package/src/pr-merge.test.ts +100 -0
- package/src/pr-merge.ts +105 -0
- package/src/pr-post-stale.test.ts +163 -0
- package/src/pr-post.ts +190 -5
- package/src/pr-report-url.ts +61 -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 +212 -0
- package/src/release-floors.ts +1 -1
- package/src/run-event.ts +28 -1
- package/src/scheduled-op-cloud.ts +68 -0
- package/src/sorted-json.ts +17 -0
- package/src/stage-hooks-bundle.test.ts +6 -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/chant-migrations/chud-lexicon-exit.ts +4 -1
- package/src/workspace/ci-lock-grain.test.ts +31 -0
- package/src/workspace/ci-lock-grain.ts +29 -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 +10 -3
- 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.ts +8 -3
- package/src/workspace/exit-cli.ts +2 -1
- package/src/workspace/import-fetch.ts +4 -2
- package/src/workspace/import-init.ts +4 -2
- package/src/workspace/ledger.schema.json +7 -3
- package/src/workspace/lineage-upgrade-cli.ts +2 -1
- package/src/workspace/pr-report.schema.json +79 -3
- package/src/workspace/promote.ts +2 -1
- 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/work-cli.ts +8 -2
- package/src/workspace/workspace-run.ts +2 -1
package/dist/cli/handlers/pr.js
CHANGED
|
@@ -64,26 +64,29 @@
|
|
|
64
64
|
* through `--forge`.
|
|
65
65
|
*/
|
|
66
66
|
import { spawnSync } from "node:child_process";
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
67
|
+
import { CHANT_EXIT } from "../../exit-codes.js";
|
|
68
|
+
import { anyResourceGrain, leaseRowsOf as leaseRowsOfLocks, lockTargetsOf } from "../../lifecycle/lock-rows.js";
|
|
69
|
+
import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
70
|
+
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
69
71
|
import { loadChantConfig, resolveAutoReleaseDisabled } from "../../config.js";
|
|
70
72
|
import { resolveCommit, resolveMergeBase } from "../../components/changed-files.js";
|
|
71
73
|
import { deriveFanOut, fanOutRegistry } from "../../components/fan-out-support.js";
|
|
72
74
|
import { findComponentGroups, groupFanOut } from "../../components/groups.js";
|
|
73
|
-
import { applyPrSet, approvalOf, approversWhoAuthored, approversWithoutReview, decidePrGate, planPrSet, prReport, readOnlyLedger, prWavePlan, resumePrSet,
|
|
75
|
+
import { applyPrSet, approvalOf, approversWhoAuthored, approversWithoutReview, decidePrGate, planPrSet, prReport, readOnlyLedger, prWavePlan, resumePrSet, } from "../../components/pr-run.js";
|
|
74
76
|
import { composeChangeSet, verifyChangeSetDigest } from "../../change-set.js";
|
|
75
|
-
import { waveGateName } from "../../gated-waves.js";
|
|
76
77
|
import { blockedMembers, blockedWords, settleEarlierWaves } from "../../wave-blocked.js";
|
|
77
78
|
import { readFanOutAttempt, writeFanOutAttempt } from "../../components/fan-out-record.js";
|
|
78
79
|
import { componentInputDigests, progressThatCarries } from "../../components/fan-out-inputs.js";
|
|
79
|
-
import { samePlanDigest } from "../../lifecycle/plan-digest.js";
|
|
80
|
+
import { computePlanDigest, samePlanDigest } from "../../lifecycle/plan-digest.js";
|
|
80
81
|
import { evaluateGate, gateIsSealed, gitGateLedgerPort } from "../../op/gate.js";
|
|
81
82
|
import { emitGateStep, gateEventsOf, GATE_PHASE } from "../../run-event-stream.js";
|
|
82
83
|
import { openCliRunEvents, refusesEventsWithJson } from "../run-events.js";
|
|
83
84
|
import { openPrReportUpload, parseReportUrl, reportKey } from "../../pr-report-url.js";
|
|
84
|
-
import { describePlanChanged, PR_APPLY_GATE, prApproveCommand, prNoteMarker, prOp, prStatusDescription, prStatusContext, prStatusState, renderPrNote, } from "../../pr-loop.js";
|
|
85
|
+
import { describePlanChanged, PR_APPLY_GATE, prApproveCommand, prApproveCommands, prNoteMarker, prOp, prStatusDescription, prStatusContext, prStatusState, renderPrNote, } from "../../pr-loop.js";
|
|
85
86
|
import { FORGE_KINDS, forgeFromEnv, forgePrincipalOf } from "../../pr-forge.js";
|
|
86
87
|
import { GITHUB_COMMENT_LIMIT, GITLAB_NOTE_LIMIT } from "../../plan-summary.js";
|
|
88
|
+
import { upsertPlanNote } from "../../pr-post.js";
|
|
89
|
+
import { activeProductWords, commandWord, parseProductComment, productContext } from "../../ci-product-words.js";
|
|
87
90
|
import { resolveCliBuildParams, parseParamFlags } from "../build-params-cli.js";
|
|
88
91
|
import { formatError, formatInfo, formatSuccess, formatWarning } from "../format.js";
|
|
89
92
|
import { reportUninstalledDependencies } from "../dependencies.js";
|
|
@@ -92,8 +95,12 @@ import { resolveChangedUnits } from "./fan-out.js";
|
|
|
92
95
|
import { coverByMerges, greenOp } from "../../components/green-cover.js";
|
|
93
96
|
import { GATED_EXIT_CODE, autoReleaseRun, recordAutoReleasesForRun } from "./run.js";
|
|
94
97
|
import { appliedDigestOf } from "../../components/auto-release.js";
|
|
98
|
+
import { parseArgs } from "../parse-args.js";
|
|
95
99
|
import { withComponentEndpoint } from "../component-endpoint.js";
|
|
96
|
-
import { failedRunExitCode } from "../../components/driver.js";
|
|
100
|
+
import { assertPlanFlagsAccepted, assertTargetsAccepted, failedRunExitCode } from "../../components/driver.js";
|
|
101
|
+
import { PLAN_FLAG_ARGS, PlanFlagRefusedError, TargetsRefusedError } from "../../components/capability.js";
|
|
102
|
+
import { prPlanTargets } from "../../components/pr-targets.js";
|
|
103
|
+
import { PREVIEW_COMMENT_ENV } from "../../components/pr-pipeline.js";
|
|
97
104
|
import { prLoopHooksAt, runPrHooks } from "../../components/pr-hooks.js";
|
|
98
105
|
import { decidePrPolicyOverride, policyReviewOf, prLoopPolicyAt, prPolicyReport, runPrPolicy, spendPrPolicyOverride } from "../../components/pr-policy.js";
|
|
99
106
|
import { lexiconNames } from "../../lexicon-module.js";
|
|
@@ -123,6 +130,14 @@ export async function prepare(ctx, stage) {
|
|
|
123
130
|
}
|
|
124
131
|
if (args.fromAffected)
|
|
125
132
|
return fail(`pr-${stage} derives the change itself; drop --from-affected`);
|
|
133
|
+
// #4620: a target narrows the preview; an apply or a record covers what the approved plan covers.
|
|
134
|
+
if (stage !== "plan" && args.targets && args.targets.length > 0) {
|
|
135
|
+
return fail(`pr-${stage} applies or records what the pull request's approved plan covers, so it takes no --target`, "Narrow the plan with pr-plan --target, and approve that plan.");
|
|
136
|
+
}
|
|
137
|
+
// #4627: refresh and target dependents change what the preview plans, as a target does.
|
|
138
|
+
if (stage !== "plan" && (args.refresh || args.targetDependents)) {
|
|
139
|
+
return fail(`pr-${stage} applies or records what the pull request's approved plan covers, so it takes no ${args.refresh ? "--refresh" : "--target-dependents"}`, "Plan with pr-plan --refresh or --target-dependents, and approve that plan.");
|
|
140
|
+
}
|
|
126
141
|
let member;
|
|
127
142
|
if (args.members?.length) {
|
|
128
143
|
const checked = await checkMember(projectPath, args.members);
|
|
@@ -396,16 +411,154 @@ async function checkMember(projectPath, names) {
|
|
|
396
411
|
export function planAll(p, onRunEvent) {
|
|
397
412
|
return hookedPlan(p, p.plan.order, () => planBare(p, onRunEvent));
|
|
398
413
|
}
|
|
399
|
-
export function planBare(p, onRunEvent) {
|
|
414
|
+
export async function planBare(p, onRunEvent) {
|
|
415
|
+
const lockGrain = await declaredLockGrainOf(p);
|
|
400
416
|
return planPrSet({
|
|
401
417
|
components: p.components,
|
|
402
418
|
plan: p.plan,
|
|
403
419
|
registry: p.registry,
|
|
404
420
|
env: p.env,
|
|
405
421
|
seededOutputs: p.seededOutputs,
|
|
422
|
+
...(lockGrain ? { lockGrain } : {}),
|
|
423
|
+
// #4613: a step's own policy engine (CrossGuard) reads its packs at the base, as ci.policy is.
|
|
424
|
+
policyBase: p.base,
|
|
406
425
|
...(onRunEvent ? { onRunEvent } : {}),
|
|
426
|
+
...(p.targets ? { targets: p.targets } : {}),
|
|
427
|
+
...(p.parallelism !== undefined ? { parallelism: p.parallelism } : {}),
|
|
428
|
+
...(p.refresh ? { refresh: true } : {}),
|
|
429
|
+
...(p.targetDependents ? { targetDependents: true } : {}),
|
|
407
430
|
});
|
|
408
431
|
}
|
|
432
|
+
/**
|
|
433
|
+
* `pr-plan --refresh` and `--target-dependents` (#4627), from the line or
|
|
434
|
+
* the preview comment: set on `p`, or the exit code when a planned member's
|
|
435
|
+
* capability cannot honour one, named before anything plans, as
|
|
436
|
+
* {@link narrowToTargets} does for targets. `--target-dependents` needs a
|
|
437
|
+
* target.
|
|
438
|
+
*/
|
|
439
|
+
function planWithFlags(p, flags) {
|
|
440
|
+
if (!flags.refresh && !flags.targetDependents)
|
|
441
|
+
return undefined;
|
|
442
|
+
if (flags.targetDependents && !p.targets)
|
|
443
|
+
return fail("--target-dependents widens a --target to what depends on it, and nothing was narrowed", "Give --target <address> with it.");
|
|
444
|
+
const byName = new Map(p.components.map((c) => [c.name, c]));
|
|
445
|
+
for (const name of p.plan.order) {
|
|
446
|
+
const component = byName.get(name);
|
|
447
|
+
if (!component)
|
|
448
|
+
continue;
|
|
449
|
+
try {
|
|
450
|
+
assertPlanFlagsAccepted(component, p.registry, { ...(flags.refresh ? { refresh: true } : {}), ...(flags.targetDependents && p.targets?.[name] ? { targetDependents: true } : {}) });
|
|
451
|
+
}
|
|
452
|
+
catch (err) {
|
|
453
|
+
if (err instanceof PlanFlagRefusedError)
|
|
454
|
+
return fail(`${err.message}, so nothing was planned`, `Drop ${PLAN_FLAG_ARGS[err.flag]}, or plan only members whose steps take it.`);
|
|
455
|
+
throw err;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
if (flags.refresh)
|
|
459
|
+
p.refresh = true;
|
|
460
|
+
if (flags.targetDependents)
|
|
461
|
+
p.targetDependents = true;
|
|
462
|
+
console.error(formatInfo(`planning with ${[flags.refresh ? "--refresh" : "", flags.targetDependents ? "--target-dependents" : ""].filter(Boolean).join(" and ")}`));
|
|
463
|
+
return undefined;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* `pr-plan --comment-targets` (#4626): the `--target` addresses of the
|
|
467
|
+
* preview comment in {@link PREVIEW_COMMENT_ENV}, read with the product's
|
|
468
|
+
* grammar, or the exit code when the comment is refused. No comment, or one
|
|
469
|
+
* with no target: none. The checks `--target` makes follow in
|
|
470
|
+
* {@link narrowToTargets}.
|
|
471
|
+
*/
|
|
472
|
+
function commentTargets(env = process.env) {
|
|
473
|
+
const body = env[PREVIEW_COMMENT_ENV];
|
|
474
|
+
if (body === undefined || body.trim() === "")
|
|
475
|
+
return { targets: [] };
|
|
476
|
+
const words = activeProductWords();
|
|
477
|
+
const parsed = parseProductComment(words, body, env);
|
|
478
|
+
if (parsed === undefined)
|
|
479
|
+
return { targets: [] };
|
|
480
|
+
if (parsed.kind === "refused")
|
|
481
|
+
return fail(`the preview comment is refused: ${parsed.reason}, so nothing was planned`, `/${words.product} ${commandWord(words, "plan") ?? "plan"} --target <address> narrows the preview to the address.`);
|
|
482
|
+
if (parsed.kind !== "plan")
|
|
483
|
+
return { targets: [] };
|
|
484
|
+
// #4627: the comment's --refresh and --target-dependents too.
|
|
485
|
+
return { targets: parsed.targets ?? [], ...(parsed.refresh ? { refresh: true } : {}), ...(parsed.targetDependents ? { targetDependents: true } : {}) };
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* `pr-plan --target` (#4620): the addresses by member, set on `p`, or the
|
|
489
|
+
* exit code when a value is refused or a targeted member has a capability
|
|
490
|
+
* that cannot narrow, which is named before anything plans.
|
|
491
|
+
*/
|
|
492
|
+
function narrowToTargets(p, values) {
|
|
493
|
+
if (!values || values.length === 0)
|
|
494
|
+
return undefined;
|
|
495
|
+
const resolved = prPlanTargets(values, p.plan.order, new Set(p.components.map((c) => c.name)));
|
|
496
|
+
if ("error" in resolved)
|
|
497
|
+
return fail(resolved.error, "--target <address> narrows every member the pull request plans; --target <member>:<address> narrows one.");
|
|
498
|
+
const { targets } = resolved;
|
|
499
|
+
const byName = new Map(p.components.map((c) => [c.name, c]));
|
|
500
|
+
for (const [name, addresses] of Object.entries(targets)) {
|
|
501
|
+
try {
|
|
502
|
+
assertTargetsAccepted(byName.get(name), p.registry, { targets: addresses });
|
|
503
|
+
}
|
|
504
|
+
catch (err) {
|
|
505
|
+
if (err instanceof TargetsRefusedError)
|
|
506
|
+
return fail(`${err.message}, so nothing was planned`, "Drop --target, or name a member whose steps can narrow: --target <member>:<address>.");
|
|
507
|
+
throw err;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
p.targets = targets;
|
|
511
|
+
console.error(formatInfo(`narrowed to ${Object.entries(targets).map(([name, a]) => `${name}: ${a.join(", ")}`).join("; ") || "nothing planned"}`));
|
|
512
|
+
return undefined;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* `ci.lockGrain` of the stage's member (#4552), read from the declaration at
|
|
516
|
+
* base like `ci.locks`, so a change cannot pick its own grain. Undefined when
|
|
517
|
+
* none is declared: each member then takes its lexicon's default.
|
|
518
|
+
*/
|
|
519
|
+
async function declaredLockGrainOf(p) {
|
|
520
|
+
const { ciLockGrainAt } = await import("../../workspace/ci-lock-grain.js");
|
|
521
|
+
return ciLockGrainAt(process.cwd(), p.base, p.member) ?? undefined;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Lease the rows a set's members on the resource grain change (#4552),
|
|
525
|
+
* before anything applies: the refusal naming the run that holds one, the
|
|
526
|
+
* exit code when the rows file could not be written, or the lease to let go
|
|
527
|
+
* of once the apply ends (one that holds nothing when no member is on the
|
|
528
|
+
* resource grain).
|
|
529
|
+
*/
|
|
530
|
+
async function leaseSetRows(p, set) {
|
|
531
|
+
const leased = await leaseRowsOf(p, set);
|
|
532
|
+
return "failed" in leased ? fail(leased.failed) : leased;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* {@link leaseSetRows} without printing a failure (#4594), for a later round
|
|
536
|
+
* of `applyPrSet` (`leaseRound`), which records it on the round, and for a
|
|
537
|
+
* pull request environment's apply, which reports it.
|
|
538
|
+
*/
|
|
539
|
+
export async function leaseRowsOf(p, set, label = "this apply") {
|
|
540
|
+
const rows = leaseRowsOfLocks(set.locks);
|
|
541
|
+
if (rows.length === 0)
|
|
542
|
+
return { release: () => Promise.resolve(true) };
|
|
543
|
+
const { leaseLockRows } = await import("../../lifecycle/resource-lock.js");
|
|
544
|
+
let leased;
|
|
545
|
+
try {
|
|
546
|
+
leased = await leaseLockRows(p.gate, rows);
|
|
547
|
+
}
|
|
548
|
+
catch (err) {
|
|
549
|
+
return { failed: `could not hold the rows ${label} changes in ${p.gate}, so nothing of it was applied: ${err instanceof Error ? err.message : String(err)}` };
|
|
550
|
+
}
|
|
551
|
+
if (!leased.ok)
|
|
552
|
+
return { held: `${leased.message}, so nothing of ${label} was applied. Apply again once that run ends; a run that is gone, or whose lease is older than CHANT_LOCK_STALE seconds, is taken over.` };
|
|
553
|
+
for (const h of leased.tookOver)
|
|
554
|
+
console.error(formatInfo(`took over the rows of run ${h.run}, which is gone`));
|
|
555
|
+
console.error(formatInfo(`${label} holds ${leased.lease.keys.length} row${leased.lease.keys.length === 1 ? "" : "s"} of ${p.gate} while it applies`));
|
|
556
|
+
return leased.lease;
|
|
557
|
+
}
|
|
558
|
+
/** `applyPrSet`'s `leaseRound` (#4594): a round after the first leases the rows its own plan locks. */
|
|
559
|
+
export function leaseRoundRows(p) {
|
|
560
|
+
return ({ round, set }) => leaseRowsOf(p, set, `round ${round}`);
|
|
561
|
+
}
|
|
409
562
|
/**
|
|
410
563
|
* How a stage's report settles its run's events (#4041): a refusal waits on
|
|
411
564
|
* a person, as a gate does, and exits the same way.
|
|
@@ -461,7 +614,7 @@ async function publish(forge, report, note) {
|
|
|
461
614
|
if (report.member && report.status === "nothing" && !report.overdue?.length && !report.migrations?.length)
|
|
462
615
|
return;
|
|
463
616
|
try {
|
|
464
|
-
await forge
|
|
617
|
+
await upsertPlanNote(forge, report.pr, prNoteMarker(report.env, report.member), note);
|
|
465
618
|
}
|
|
466
619
|
catch (err) {
|
|
467
620
|
console.error(formatWarning({ message: `could not post the note on #${report.pr}: ${err instanceof Error ? err.message : String(err)}` }));
|
|
@@ -491,6 +644,15 @@ async function finish(ctx, p, report, upload) {
|
|
|
491
644
|
report = { ...report, policy: p.policyReport };
|
|
492
645
|
if (p.beforeMerge)
|
|
493
646
|
report = { ...report, beforeMerge: p.beforeMerge };
|
|
647
|
+
// #4617: with a checkout of the control repo named, its entries and apply records mark the cross-stack edges.
|
|
648
|
+
if (report.crossStackEdges?.length && process.env.CHANT_CONTROL_DIR) {
|
|
649
|
+
const { controlEdgeFactsFromEnv, remarkCrossStackEdges } = await import("../../control/edges.js");
|
|
650
|
+
report = remarkCrossStackEdges(report, await controlEdgeFactsFromEnv());
|
|
651
|
+
}
|
|
652
|
+
// #4573: each member's section its lexicon renders from its own part of the change set.
|
|
653
|
+
const details = await memberDetails(p, report);
|
|
654
|
+
if (details.length > 0)
|
|
655
|
+
report = { ...report, details };
|
|
494
656
|
const note = noteFor(report, p.forge);
|
|
495
657
|
writeOutputs(ctx, report, note, upload);
|
|
496
658
|
if (!ctx.args.noStatus)
|
|
@@ -582,9 +744,9 @@ async function judgePolicy(p, at) {
|
|
|
582
744
|
const why = err instanceof Error ? err.message : String(err);
|
|
583
745
|
if (at.stage === "plan") {
|
|
584
746
|
console.error(formatWarning({ message: `could not read the override ledger, so no override reads as standing: ${why}` }));
|
|
585
|
-
return { held, stop: { refusal: "policy-denied", code:
|
|
747
|
+
return { held, stop: { refusal: "policy-denied", code: CHANT_EXIT.denied, message: `The policy denied this plan: ${denied}.` } };
|
|
586
748
|
}
|
|
587
|
-
return { held, stop: { refusal: "policy-denied", code:
|
|
749
|
+
return { held, stop: { refusal: "policy-denied", code: CHANT_EXIT.denied, message: `The policy denied this plan (${denied}), and the override ledger could not be read or written: ${why}. Nothing was applied.` } };
|
|
588
750
|
}
|
|
589
751
|
if (decided.status === "overridden") {
|
|
590
752
|
report.override = decided.override;
|
|
@@ -600,7 +762,7 @@ async function judgePolicy(p, at) {
|
|
|
600
762
|
held,
|
|
601
763
|
stop: {
|
|
602
764
|
refusal: "policy-denied",
|
|
603
|
-
code:
|
|
765
|
+
code: CHANT_EXIT.denied,
|
|
604
766
|
message: `The policy denied this plan: ${denied}.${moved} Nothing was applied. ${who} override it: ${decided.command}`,
|
|
605
767
|
},
|
|
606
768
|
};
|
|
@@ -631,6 +793,18 @@ async function prPlan(ctx, stage) {
|
|
|
631
793
|
const p = await prepare(ctx, "plan");
|
|
632
794
|
if (typeof p === "number")
|
|
633
795
|
return p;
|
|
796
|
+
// #4626: the preview comment's --target addresses, read from the comment the job carries in a variable.
|
|
797
|
+
const fromComment = ctx.args.commentTargets ? commentTargets() : { targets: [] };
|
|
798
|
+
if (typeof fromComment === "number")
|
|
799
|
+
return fromComment;
|
|
800
|
+
const narrowed = narrowToTargets(p, [...(ctx.args.targets ?? []), ...fromComment.targets]);
|
|
801
|
+
if (narrowed !== undefined)
|
|
802
|
+
return narrowed;
|
|
803
|
+
const flagged = planWithFlags(p, { refresh: ctx.args.refresh === true || fromComment.refresh === true, targetDependents: ctx.args.targetDependents === true || fromComment.targetDependents === true });
|
|
804
|
+
if (flagged !== undefined)
|
|
805
|
+
return flagged;
|
|
806
|
+
if (ctx.args.parallelism !== undefined)
|
|
807
|
+
p.parallelism = ctx.args.parallelism;
|
|
634
808
|
const op = prOp(ctx.args.pr, p.member);
|
|
635
809
|
placeHooks(ctx, p, "plan", op);
|
|
636
810
|
const upload = openUpload(stage, "plan", ctx.args.pr, p);
|
|
@@ -679,11 +853,47 @@ async function prPlan(ctx, stage) {
|
|
|
679
853
|
printMembers(report);
|
|
680
854
|
if (status === "planned") {
|
|
681
855
|
console.error(formatInfo(`plan : ${report.digest}`));
|
|
682
|
-
console.error(formatInfo(approval.status === "approved" ? `approved by ${(approval.approvedBy ?? []).join(", ")}` : `approve : ${
|
|
856
|
+
console.error(formatInfo(approval.status === "approved" ? `approved by ${(approval.approvedBy ?? []).join(", ")}` : `approve : ${prApproveCommands(report).join("; ")}`));
|
|
683
857
|
}
|
|
684
858
|
if (judged.stop)
|
|
685
859
|
console.error(formatWarning({ message: judged.stop.message }));
|
|
686
|
-
|
|
860
|
+
// #4550: a capability's policy denial (pulumi-up's CrossGuard) exits as a denial, 7, not as a failed plan.
|
|
861
|
+
if (status === "plan-failed" && set.policyDenied)
|
|
862
|
+
return CHANT_EXIT.denied;
|
|
863
|
+
return status === "plan-failed" ? CHANT_EXIT.failed : judged.stop ? judged.stop.code : CHANT_EXIT.done;
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* The member detail sections (#4573): each lexicon the project lists that
|
|
867
|
+
* renders one (`prNoteDetail`) gets each member's part of the change set. A
|
|
868
|
+
* lexicon that cannot load, or throws, leaves the note as it was.
|
|
869
|
+
*/
|
|
870
|
+
async function memberDetails(p, report) {
|
|
871
|
+
if (report.changeSet.members.length === 0)
|
|
872
|
+
return [];
|
|
873
|
+
const { loadPlugin } = await import("../plugins.js");
|
|
874
|
+
const out = [];
|
|
875
|
+
for (const name of lexiconNames(p.config.lexicons ?? [])) {
|
|
876
|
+
let plugin;
|
|
877
|
+
try {
|
|
878
|
+
plugin = await loadPlugin(name);
|
|
879
|
+
}
|
|
880
|
+
catch {
|
|
881
|
+
continue;
|
|
882
|
+
}
|
|
883
|
+
if (!plugin.prNoteDetail)
|
|
884
|
+
continue;
|
|
885
|
+
for (const member of report.changeSet.members) {
|
|
886
|
+
try {
|
|
887
|
+
const detail = await plugin.prNoteDetail({ member: member.member, changeSet: report.changeSet, stage: report.stage });
|
|
888
|
+
if (detail && detail.lines.length > 0)
|
|
889
|
+
out.push({ member: member.member, ...(detail.title ? { title: detail.title } : {}), lines: detail.lines });
|
|
890
|
+
}
|
|
891
|
+
catch (err) {
|
|
892
|
+
console.error(formatWarning({ message: `the ${name} lexicon could not render ${member.member}'s detail: ${err instanceof Error ? err.message : String(err)}` }));
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
return out;
|
|
687
897
|
}
|
|
688
898
|
/**
|
|
689
899
|
* The migration files the pull request adds in a migration-directory member
|
|
@@ -732,13 +942,19 @@ async function overdueOps(forge, member) {
|
|
|
732
942
|
const { overdueOpsAt } = await import("../../op/schedule-overdue.js");
|
|
733
943
|
return overdueOpsAt({ forge, cwd: resolve("."), ...(member ? { member } : {}), log: (line) => console.error(formatWarning({ message: line })) });
|
|
734
944
|
}
|
|
735
|
-
/** chant components pr-apply --base <ref> [--pr <n>] [--env <env>] [--gate <name>] [--forge <kind>] [--require-review] [--output <dir>] [--json] [--events-json] [--report-url <url>] */
|
|
945
|
+
/** chant components pr-apply --base <ref> [--pr <n>] [--env <env>] [--gate <name>] [--forge <kind>] [--require-review] [--before-merge [--requires <list>]] [--output <dir>] [--json] [--events-json] [--report-url <url>] */
|
|
736
946
|
export function runComponentsPrApply(ctx) {
|
|
737
947
|
if (refusesEventsWithJson(ctx.args, "the stage's report"))
|
|
738
948
|
return Promise.resolve(1);
|
|
739
949
|
return withStageEvents("pr-apply", ctx, async (events) => {
|
|
740
950
|
// #4301: an apply before merge asks the forge its requires checks before any of the head's code loads, the config included.
|
|
741
951
|
let beforeMerge;
|
|
952
|
+
if (ctx.args.requires && !ctx.args.beforeMerge)
|
|
953
|
+
return fail("--requires names the checks of an apply before merge, so it needs --before-merge --pr <n>");
|
|
954
|
+
// #4636: the merge after the update, checked before anything applies.
|
|
955
|
+
const mergeProblem = await mergeArgsProblem(ctx.args);
|
|
956
|
+
if (mergeProblem)
|
|
957
|
+
return fail(mergeProblem);
|
|
742
958
|
if (ctx.args.beforeMerge) {
|
|
743
959
|
const checked = await beforeMergeChecks(ctx);
|
|
744
960
|
if (typeof checked === "number")
|
|
@@ -804,7 +1020,7 @@ async function prApply(ctx, stage, beforeMerge) {
|
|
|
804
1020
|
return held;
|
|
805
1021
|
if (held) {
|
|
806
1022
|
const set = { doc: composeChangeSet([]), members: [], plans: {}, outputs: {}, failed: false };
|
|
807
|
-
return stopper(ctx, p, events, upload)(prReport({ stage: "apply", pr, env: p.env, ...(p.member ? { member: p.member } : {}), base: p.base, head: p.head, op, gate: p.gate, plan: p.plan, signal: p.signal, set, approval: { status: "pending" }, status: "refused", refusal: "locked", message: held }),
|
|
1023
|
+
return stopper(ctx, p, events, upload)(prReport({ stage: "apply", pr, env: p.env, ...(p.member ? { member: p.member } : {}), base: p.base, head: p.head, op, gate: p.gate, plan: p.plan, signal: p.signal, set, approval: { status: "pending" }, status: "refused", refusal: "locked", message: held }), CHANT_EXIT.held);
|
|
808
1024
|
}
|
|
809
1025
|
}
|
|
810
1026
|
if (args.waveGate)
|
|
@@ -857,8 +1073,19 @@ async function prApply(ctx, stage, beforeMerge) {
|
|
|
857
1073
|
...base,
|
|
858
1074
|
approval: { status: "pending" },
|
|
859
1075
|
status: "plan-failed",
|
|
860
|
-
message:
|
|
861
|
-
|
|
1076
|
+
message: set.policyDenied
|
|
1077
|
+
? "The policy denied a member's plan, so nothing was applied."
|
|
1078
|
+
: "A member failed to plan, so there is no plan to compare with the approved one. Nothing was applied.",
|
|
1079
|
+
}), set.policyDenied ? CHANT_EXIT.denied : 1);
|
|
1080
|
+
}
|
|
1081
|
+
// #4552, ruling D: on the resource grain a pull request's locks name row keys, which only the plan knows.
|
|
1082
|
+
const lockTargets = lockTargetsOf(p.plan.order, set.locks);
|
|
1083
|
+
if (locks && anyResourceGrain(set.locks)) {
|
|
1084
|
+
const held = await heldLocksOf(p, pr, lockTargets);
|
|
1085
|
+
if (typeof held === "number")
|
|
1086
|
+
return held;
|
|
1087
|
+
if (held)
|
|
1088
|
+
return stop(prReport({ ...base, approval: { status: "pending" }, status: "refused", refusal: "locked", message: held }), CHANT_EXIT.held);
|
|
862
1089
|
}
|
|
863
1090
|
// #4022: keep the change set the gate binds on chant/lifecycle under its
|
|
864
1091
|
// digest before deciding the gate, so the plan an approval bound, or the
|
|
@@ -882,7 +1109,7 @@ async function prApply(ctx, stage, beforeMerge) {
|
|
|
882
1109
|
if (afterGate && decided.satisfied)
|
|
883
1110
|
return stop(prReport({ ...base, approval, status: "failed", message: afterGate }), 1);
|
|
884
1111
|
if (!decided.satisfied)
|
|
885
|
-
return stop(prReport({ ...base, approval, status: "refused", refusal: decided.refusal, message: decided.message }),
|
|
1112
|
+
return stop(prReport({ ...base, approval, status: "refused", refusal: decided.refusal, message: decided.message }), decided.refusal === "plan-changed" ? CHANT_EXIT.moved : CHANT_EXIT.waiting);
|
|
886
1113
|
via = decided.via;
|
|
887
1114
|
}
|
|
888
1115
|
const reviewOf = reviewFor(args, p, pr, green);
|
|
@@ -898,12 +1125,18 @@ async function prApply(ctx, stage, beforeMerge) {
|
|
|
898
1125
|
return stop(prReport({ ...base, approval, status: "refused", refusal: "policy-denied", message: unspent }), 1);
|
|
899
1126
|
// #4293, #4301: under ci.locks an apply before merge holds its targets until the pull request merges or closes.
|
|
900
1127
|
if (locks && beforeMerge && pr !== null) {
|
|
901
|
-
const taken = await takeApplyLocks(p, pr);
|
|
1128
|
+
const taken = await takeApplyLocks(p, pr, lockTargets);
|
|
902
1129
|
if (typeof taken === "number")
|
|
903
1130
|
return taken;
|
|
904
1131
|
if (taken)
|
|
905
|
-
return stop(prReport({ ...base, approval, status: "refused", refusal: "locked", message: taken }),
|
|
906
|
-
}
|
|
1132
|
+
return stop(prReport({ ...base, approval, status: "refused", refusal: "locked", message: taken }), CHANT_EXIT.held);
|
|
1133
|
+
}
|
|
1134
|
+
// #4552: on the resource grain the apply leases the rows it changes, whatever ci.locks says, and lets go when it ends.
|
|
1135
|
+
const lease = await leaseSetRows(p, set);
|
|
1136
|
+
if (typeof lease === "number")
|
|
1137
|
+
return lease;
|
|
1138
|
+
if ("held" in lease)
|
|
1139
|
+
return stop(prReport({ ...base, approval, status: "refused", refusal: "locked", message: lease.held }), CHANT_EXIT.held);
|
|
907
1140
|
// The record is written before the first component runs and again as each
|
|
908
1141
|
// one settles, so a run killed partway still knows what applied.
|
|
909
1142
|
const prior = resumed ? { completed: resumed.completed, outputs: resumed.outputs } : { completed: [], outputs: {} };
|
|
@@ -937,8 +1170,10 @@ async function prApply(ctx, stage, beforeMerge) {
|
|
|
937
1170
|
// #4288: the before-apply hooks, once the gate and the review let the apply through.
|
|
938
1171
|
const toApply = (resumed?.plan ?? p.plan).order.filter((name) => !completedSoFar.has(name));
|
|
939
1172
|
const beforeFailed = await runStageHook(p, "before-apply", toApply);
|
|
940
|
-
if (beforeFailed)
|
|
1173
|
+
if (beforeFailed) {
|
|
1174
|
+
await lease.release();
|
|
941
1175
|
return stop(prReport({ ...base, approval, status: "failed", message: beforeFailed }), 1);
|
|
1176
|
+
}
|
|
942
1177
|
// #3999: a round planned after an upstream applied waits on a gate of its
|
|
943
1178
|
// own, under the same identity.gates rule and the same review checks.
|
|
944
1179
|
const roundLedger = gitGateLedgerPort();
|
|
@@ -961,40 +1196,51 @@ async function prApply(ctx, stage, beforeMerge) {
|
|
|
961
1196
|
}
|
|
962
1197
|
return { satisfied: true, approval: roundApproval };
|
|
963
1198
|
};
|
|
964
|
-
const
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1199
|
+
const lockGrain = await declaredLockGrainOf(p);
|
|
1200
|
+
let applied;
|
|
1201
|
+
try {
|
|
1202
|
+
applied = await applyPrSet({
|
|
1203
|
+
components: p.components,
|
|
1204
|
+
plan: resumed?.plan ?? p.plan,
|
|
1205
|
+
registry: p.registry,
|
|
1206
|
+
env: p.env,
|
|
1207
|
+
set,
|
|
1208
|
+
...(lockGrain ? { lockGrain } : {}),
|
|
1209
|
+
policyBase: p.base,
|
|
1210
|
+
gate: p.gate,
|
|
1211
|
+
approval,
|
|
1212
|
+
decideRound,
|
|
1213
|
+
// #4594: a later round's plan may change rows the first did not, so it leases its own.
|
|
1214
|
+
leaseRound: leaseRoundRows(p),
|
|
1215
|
+
...(resumed ? { resumed: prior } : {}),
|
|
1216
|
+
// The apply is this run's waves, so the fan-out's own run framing is
|
|
1217
|
+
// dropped. The log's lines go to stderr with or without --events-json.
|
|
1218
|
+
onRunEvent: (body) => {
|
|
1219
|
+
events?.nested(body);
|
|
1220
|
+
log(body);
|
|
1221
|
+
},
|
|
1222
|
+
...(resumePath
|
|
1223
|
+
? {
|
|
1224
|
+
onComponentSettled: (settled, outputs) => {
|
|
1225
|
+
if (settled.status === "ok") {
|
|
1226
|
+
completedSoFar.add(settled.component);
|
|
1227
|
+
if (inputsNow[settled.component] !== undefined)
|
|
1228
|
+
inputsSoFar[settled.component] = inputsNow[settled.component];
|
|
1229
|
+
if (outputs)
|
|
1230
|
+
outputsSoFar[settled.component] = outputs;
|
|
1231
|
+
}
|
|
1232
|
+
else if (settled.status === "fail") {
|
|
1233
|
+
failedSoFar.push(settled.component);
|
|
1234
|
+
}
|
|
1235
|
+
recordAttempt();
|
|
1236
|
+
},
|
|
1237
|
+
}
|
|
1238
|
+
: {}),
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
finally {
|
|
1242
|
+
await lease.release();
|
|
1243
|
+
}
|
|
998
1244
|
recordAttempt();
|
|
999
1245
|
// #4288: the after-apply hooks, for the components that applied.
|
|
1000
1246
|
const afterFailed = await runStageHook(p, "after-apply", toApply.filter((name) => applied.run.completed.includes(name)), undefined, "the apply counts as failed though its components applied");
|
|
@@ -1006,19 +1252,93 @@ async function prApply(ctx, stage, beforeMerge) {
|
|
|
1006
1252
|
members: applied.members,
|
|
1007
1253
|
...(resumed ? { resumed: resumed.completed } : {}),
|
|
1008
1254
|
...(applied.rounds ? { rounds: applied.rounds } : {}),
|
|
1009
|
-
...(applied.status === "waiting" ? { message: waitingMessage(op, applied.rounds) } : {}),
|
|
1255
|
+
...(applied.held ? { message: applied.held } : applied.leaseFailed ? { message: applied.leaseFailed } : applied.status === "waiting" ? { message: waitingMessage(op, applied.rounds) } : {}),
|
|
1010
1256
|
});
|
|
1011
1257
|
// A component that stopped at a gate of its own leaves the apply waiting on
|
|
1012
1258
|
// a person. A step that refused its plan because the target moved since
|
|
1013
|
-
// the approval exits
|
|
1014
|
-
|
|
1259
|
+
// the approval exits 4 (moved), as a moved digest does before anything applies (#3997, #4553).
|
|
1260
|
+
// A later round whose rows another run holds exits 5 (held, #4594).
|
|
1261
|
+
const exit = afterFailed
|
|
1262
|
+
? 1
|
|
1263
|
+
: applied.held
|
|
1264
|
+
? CHANT_EXIT.held
|
|
1265
|
+
: applied.status === "applied"
|
|
1266
|
+
? 0
|
|
1267
|
+
: applied.status === "waiting"
|
|
1268
|
+
? GATED_EXIT_CODE
|
|
1269
|
+
: applied.leaseFailed
|
|
1270
|
+
? 1
|
|
1271
|
+
: failedRunExitCode(applied.run.results);
|
|
1015
1272
|
if (green && applied.status === "applied")
|
|
1016
1273
|
await recordGreenApplied(p, green, set.doc.digest, approval, via);
|
|
1017
1274
|
const code = await stop(report, exit, applied.run.status === "gated" ? "gated" : undefined);
|
|
1018
1275
|
if (applied.status === "applied" && !afterFailed)
|
|
1019
1276
|
console.error(formatSuccess(`applied the plan ${report.digest} approved by ${(approval.approvedBy ?? []).join(", ")}`));
|
|
1277
|
+
// #4636: an update before merge that applied every member merges the pull request, never the other way round.
|
|
1278
|
+
if (code === 0 && beforeMerge && pr !== null && args.merge === "auto" && applied.status === "applied" && !afterFailed)
|
|
1279
|
+
return mergeAfterUpdate(ctx, p, pr);
|
|
1020
1280
|
return code;
|
|
1021
1281
|
}
|
|
1282
|
+
/** `--merge`, `--merge-token-env` and `--merge-method` as one problem, or undefined when they hold together. */
|
|
1283
|
+
async function mergeArgsProblem(args) {
|
|
1284
|
+
const { PR_APPLY_MERGES, PR_MERGE_METHODS } = await import("../../pr-merge.js");
|
|
1285
|
+
if (args.merge === undefined) {
|
|
1286
|
+
if (args.mergeTokenEnv || args.mergeMethod)
|
|
1287
|
+
return "--merge-token-env and --merge-method go with --merge auto";
|
|
1288
|
+
return undefined;
|
|
1289
|
+
}
|
|
1290
|
+
if (!PR_APPLY_MERGES.includes(args.merge))
|
|
1291
|
+
return `--merge takes ${PR_APPLY_MERGES.join(" or ")}, not ${args.merge}`;
|
|
1292
|
+
if (args.merge === "manual")
|
|
1293
|
+
return args.mergeTokenEnv || args.mergeMethod ? "--merge manual leaves the merge to a person, so it takes no --merge-token-env or --merge-method" : undefined;
|
|
1294
|
+
if (!args.beforeMerge)
|
|
1295
|
+
return "--merge auto merges a pull request once its update before merge applied, so it needs --before-merge --pr <n>";
|
|
1296
|
+
if (!args.mergeTokenEnv)
|
|
1297
|
+
return "--merge auto merges with a token of its own, never the job's: --merge-token-env <VAR> (on GitLab a protected variable)";
|
|
1298
|
+
if (args.mergeMethod && !PR_MERGE_METHODS.includes(args.mergeMethod))
|
|
1299
|
+
return `--merge-method takes ${PR_MERGE_METHODS.join(", ")}, not ${args.mergeMethod}`;
|
|
1300
|
+
return undefined;
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* The merge after an update before merge applied (#4636): the apply's
|
|
1304
|
+
* records pushed to the ledger, the head checked again, then the forge's
|
|
1305
|
+
* merge with the token `--merge-token-env` names alone. A refusal is posted
|
|
1306
|
+
* on the pull request and exits as waiting (3); the update stays applied.
|
|
1307
|
+
*/
|
|
1308
|
+
async function mergeAfterUpdate(ctx, p, pr) {
|
|
1309
|
+
const { mergeAfterApply, mergeTokenEnv } = await import("../../pr-merge.js");
|
|
1310
|
+
const { pushLifecycleReport } = await import("../../lifecycle/git.js");
|
|
1311
|
+
const kind = p.forge?.kind ?? ctx.args.forge;
|
|
1312
|
+
if (!kind)
|
|
1313
|
+
return fail("--merge auto needs --forge <kind> to merge on");
|
|
1314
|
+
const env = mergeTokenEnv(ctx.args.mergeTokenEnv);
|
|
1315
|
+
if ("error" in env) {
|
|
1316
|
+
console.error(formatWarning({ message: `the pull request was not merged: ${env.error}` }));
|
|
1317
|
+
return CHANT_EXIT.waiting;
|
|
1318
|
+
}
|
|
1319
|
+
let forge;
|
|
1320
|
+
try {
|
|
1321
|
+
forge = forgeFromEnv(kind, env);
|
|
1322
|
+
}
|
|
1323
|
+
catch (err) {
|
|
1324
|
+
console.error(formatWarning({ message: `the pull request was not merged: ${err instanceof Error ? err.message : String(err)}` }));
|
|
1325
|
+
return CHANT_EXIT.waiting;
|
|
1326
|
+
}
|
|
1327
|
+
const pushed = await pushLifecycleReport();
|
|
1328
|
+
const merged = await mergeAfterApply({
|
|
1329
|
+
forge,
|
|
1330
|
+
pr,
|
|
1331
|
+
head: p.head,
|
|
1332
|
+
...(ctx.args.mergeMethod ? { method: ctx.args.mergeMethod } : {}),
|
|
1333
|
+
recorded: { pushed: pushed.pushed, ...(pushed.pushWarning ? { warning: pushed.pushWarning } : {}) },
|
|
1334
|
+
});
|
|
1335
|
+
if (merged.merged) {
|
|
1336
|
+
console.error(formatSuccess(`merged ${kind === "gitlab" ? `!${pr}` : `#${pr}`} at ${p.head.slice(0, 12)}${merged.sha ? ` as ${merged.sha.slice(0, 12)}` : ""}`));
|
|
1337
|
+
return 0;
|
|
1338
|
+
}
|
|
1339
|
+
console.error(formatWarning({ message: `the pull request was not merged: ${merged.reason}${merged.posted ? "; the reason is posted on it" : ""}` }));
|
|
1340
|
+
return CHANT_EXIT.waiting;
|
|
1341
|
+
}
|
|
1022
1342
|
/**
|
|
1023
1343
|
* Under `ci.locks` (#4293): the refusal when another open pull request holds
|
|
1024
1344
|
* a lock on a component this apply reaches, else null. The targets are the
|
|
@@ -1027,12 +1347,12 @@ async function prApply(ctx, stage, beforeMerge) {
|
|
|
1027
1347
|
* `--forge` every lock counts. A lock file that cannot be read stops the
|
|
1028
1348
|
* apply, since nothing then says the targets are free.
|
|
1029
1349
|
*/
|
|
1030
|
-
async function heldLocksOf(p, pr) {
|
|
1350
|
+
async function heldLocksOf(p, pr, targets = p.plan.order) {
|
|
1031
1351
|
const { heldTargetLocks, describeHeldTargetLocks } = await import("../../lifecycle/target-lock.js");
|
|
1032
1352
|
const isOpen = p.forge?.pullRequestOpen?.bind(p.forge);
|
|
1033
1353
|
let held;
|
|
1034
1354
|
try {
|
|
1035
|
-
held = await heldTargetLocks(p.gate,
|
|
1355
|
+
held = await heldTargetLocks(p.gate, targets, pr, { ...(isOpen ? { isOpen } : {}) });
|
|
1036
1356
|
}
|
|
1037
1357
|
catch (err) {
|
|
1038
1358
|
return fail(`could not read the target locks of ${p.gate}, so nothing was applied: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -1062,6 +1382,11 @@ async function beforeMergeChecks(ctx) {
|
|
|
1062
1382
|
return fail("--before-merge asks the forge whether the pull request is ready, so it needs --forge github|gitlab|forgejo");
|
|
1063
1383
|
if (!args.base)
|
|
1064
1384
|
return fail("pr-apply needs the commit the change is measured from: --base <ref>", "Before merge, the target branch's commit.");
|
|
1385
|
+
const { checkPrRequires, unmetRequires, parseRequiresList } = await import("../../pr-requires.js");
|
|
1386
|
+
// #4607: a product's `apply.requires` names the checks to ask; absent, all four.
|
|
1387
|
+
const only = args.requires ? parseRequiresList(args.requires) : undefined;
|
|
1388
|
+
if (only && "error" in only)
|
|
1389
|
+
return fail(only.error);
|
|
1065
1390
|
const cwd = resolve(".");
|
|
1066
1391
|
let forge;
|
|
1067
1392
|
let head;
|
|
@@ -1078,16 +1403,16 @@ async function beforeMergeChecks(ctx) {
|
|
|
1078
1403
|
const gate = args.gate ?? PR_APPLY_GATE;
|
|
1079
1404
|
const { ciWorkflowAt } = await import("../../workspace/ci-workflow-at.js");
|
|
1080
1405
|
const { appliesBeforeMerge } = await import("../../workspace/ci-workflow.js");
|
|
1081
|
-
const { checkPrRequires, unmetRequires } = await import("../../pr-requires.js");
|
|
1082
1406
|
const workflow = ciWorkflowAt(cwd, args.base, member);
|
|
1083
1407
|
const early = earlyStop(ctx, forge, { pr: args.pr, base, head, gate, ...(member ? { member } : {}) });
|
|
1084
1408
|
if (!appliesBeforeMerge(workflow)) {
|
|
1085
1409
|
return early({ requires: [] }, "before-merge-off", `The declaration at base sets ci.workflow to ${workflow ?? "nothing"}${member ? ` for ${member}` : ""}, and only apply-before-merge applies a pull request before it merges (ws-106). Nothing was applied.`, 1);
|
|
1086
1410
|
}
|
|
1087
1411
|
// The apply's own statuses never hold it back: chant ci run's, and the report's.
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1412
|
+
// #4550: under a product's words its own prefix too.
|
|
1413
|
+
const ignore = [...new Set([productContext(activeProductWords(), gate), productContext(activeProductWords(), PR_APPLY_GATE), `chant/${gate}`, `chant/${PR_APPLY_GATE}`, prStatusContext("apply", member)])];
|
|
1414
|
+
// ws-106 gives the declaration no way to leave a check out, so with no --requires all four are asked (#4336, #4607).
|
|
1415
|
+
const requires = await checkPrRequires(forge, args.pr, head, { ignore, ...(only ? { only: only.checks } : {}) });
|
|
1091
1416
|
for (const r of requires)
|
|
1092
1417
|
console.error(formatInfo(`${r.name}: ${r.passed ? "passed" : r.pending ? "pending" : "unmet"}, ${r.reason}`));
|
|
1093
1418
|
const unmet = unmetRequires(requires);
|
|
@@ -1113,13 +1438,13 @@ function earlyStop(ctx, forge, at) {
|
|
|
1113
1438
|
* refusal when another open pull request holds one, null once taken, or the
|
|
1114
1439
|
* exit code when the locks could not be written.
|
|
1115
1440
|
*/
|
|
1116
|
-
async function takeApplyLocks(p, pr) {
|
|
1441
|
+
async function takeApplyLocks(p, pr, targets = p.plan.order) {
|
|
1117
1442
|
const { takeTargetLocks, describeHeldTargetLocks } = await import("../../lifecycle/target-lock.js");
|
|
1118
1443
|
const isOpen = p.forge?.pullRequestOpen?.bind(p.forge);
|
|
1119
1444
|
const by = process.env.GITHUB_ACTOR ?? process.env.GITLAB_USER_LOGIN ?? process.env.USER ?? "unknown";
|
|
1120
1445
|
let result;
|
|
1121
1446
|
try {
|
|
1122
|
-
result = await takeTargetLocks(p.gate,
|
|
1447
|
+
result = await takeTargetLocks(p.gate, targets, { pr, by, at: new Date().toISOString(), stage: "apply", head: p.head }, { ...(isOpen ? { isOpen } : {}) });
|
|
1123
1448
|
}
|
|
1124
1449
|
catch (err) {
|
|
1125
1450
|
return fail(`could not take the target locks of ${p.gate}, so nothing was applied: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -1373,6 +1698,9 @@ function stopper(ctx, p, events, upload) {
|
|
|
1373
1698
|
return async (report, code, settle) => {
|
|
1374
1699
|
events?.settle(settle ?? settleOf(report.status), report.status === "plan-failed" || report.status === "failed" ? report.message ?? `pr-${report.stage} ${report.status}` : undefined);
|
|
1375
1700
|
await finish(ctx, p, report, upload);
|
|
1701
|
+
// #4629: a failed apply's triage and a refused apply's diff, on the pull request.
|
|
1702
|
+
if (report.stage === "apply" && (report.status === "failed" || report.status === "refused") && !ctx.args.noStatus)
|
|
1703
|
+
await respondApply(ctx, p, report);
|
|
1376
1704
|
console.error((code === 0 ? formatInfo : (m) => formatWarning({ message: m }))(`pr-${report.stage}: ${report.status}${report.refusal ? ` (${report.refusal})` : ""}`));
|
|
1377
1705
|
if (report.message)
|
|
1378
1706
|
console.error(report.message);
|
|
@@ -1380,6 +1708,22 @@ function stopper(ctx, p, events, upload) {
|
|
|
1380
1708
|
return code;
|
|
1381
1709
|
};
|
|
1382
1710
|
}
|
|
1711
|
+
/** The responses an apply's report calls for (#4629), from `--respond` over `CHANT_RESPOND`. Never throws. */
|
|
1712
|
+
async function respondApply(ctx, p, report) {
|
|
1713
|
+
try {
|
|
1714
|
+
const { parseRespondList } = await import("../../ci-respond.js");
|
|
1715
|
+
const given = ctx.args.respond ? parseRespondList(ctx.args.respond) : {};
|
|
1716
|
+
if ("error" in given) {
|
|
1717
|
+
console.error(formatWarning({ message: `no response was posted: ${given.error}` }));
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1720
|
+
const { respondPrApply } = await import("../../ci-respond-run.js");
|
|
1721
|
+
await respondPrApply(p.forge, report, given);
|
|
1722
|
+
}
|
|
1723
|
+
catch (err) {
|
|
1724
|
+
console.error(formatWarning({ message: `the apply's responses were not posted: ${err instanceof Error ? err.message : String(err)}` }));
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1383
1727
|
/**
|
|
1384
1728
|
* The `--require-review` check (#3183, #4000) of an approval's approvers,
|
|
1385
1729
|
* `what` naming the plan they approved. The pull request's reviews and
|
|
@@ -1457,6 +1801,10 @@ function settleWords(body) {
|
|
|
1457
1801
|
* pr-apply's job log (#4007): a line on stderr as each wave starts and as
|
|
1458
1802
|
* each component settles, so the log shows the waves in order while they run.
|
|
1459
1803
|
*/
|
|
1804
|
+
/** One wave's fan-out numbers its wave 1; the events and the log carry the derivation's number (#4003). */
|
|
1805
|
+
function inWave(body, wave) {
|
|
1806
|
+
return "wave" in body && typeof body.wave === "number" ? { ...body, wave } : body;
|
|
1807
|
+
}
|
|
1460
1808
|
function applyLog() {
|
|
1461
1809
|
let waves = 0;
|
|
1462
1810
|
return (body) => {
|
|
@@ -1565,6 +1913,7 @@ async function tryResume(p, attempt, file, op, inputsNow) {
|
|
|
1565
1913
|
registry: p.registry,
|
|
1566
1914
|
env: p.env,
|
|
1567
1915
|
seededOutputs: p.seededOutputs,
|
|
1916
|
+
policyBase: p.base,
|
|
1568
1917
|
record,
|
|
1569
1918
|
completed,
|
|
1570
1919
|
applied: outputs,
|
|
@@ -1619,21 +1968,20 @@ async function carryWaves(p, attempt, file, op, inputsNow) {
|
|
|
1619
1968
|
const outputs = Object.fromEntries(Object.entries(attempt.outputs).filter(([name]) => completed.includes(name)));
|
|
1620
1969
|
return { record, check, approval: approvalOf(check), completed, outputs };
|
|
1621
1970
|
}
|
|
1622
|
-
/** A run event with its wave renumbered to `wave`: the fan-out that applies one wave numbers it 1. */
|
|
1623
|
-
function inWave(body, wave) {
|
|
1624
|
-
return "wave" in body && typeof body.wave === "number" ? { ...body, wave } : body;
|
|
1625
|
-
}
|
|
1626
1971
|
/**
|
|
1627
1972
|
* `pr-apply --wave-gate <gate>` (#4003): apply the pull request's approved
|
|
1628
1973
|
* set a wave at a time, each wave planned after the one before it applied.
|
|
1629
1974
|
*
|
|
1630
1975
|
* The first job plans every member, as pr-apply does, and decides the pull
|
|
1631
|
-
* request's gate against that digest.
|
|
1632
|
-
*
|
|
1633
|
-
*
|
|
1634
|
-
* (`
|
|
1635
|
-
*
|
|
1636
|
-
*
|
|
1976
|
+
* request's gate against that digest. The waves then run on op waves
|
|
1977
|
+
* (#4588): the component waves spec (`componentWavesSpec`), each run a
|
|
1978
|
+
* component, planned and applied through the component plan-wave and
|
|
1979
|
+
* apply-wave steps (`chant components plan-wave|apply-wave`). Each wave is
|
|
1980
|
+
* planned against the outputs the waves before it left. When the approved
|
|
1981
|
+
* change set covers its plan (`planCoveredBy`, the op waves' `pull-request`
|
|
1982
|
+
* approval) it applies under the pull request's approval; when it does not,
|
|
1983
|
+
* it waits at `<gate>-wave-<k>` under the pull request's op for an approval
|
|
1984
|
+
* of its new plan, and exits 3.
|
|
1637
1985
|
*
|
|
1638
1986
|
* With `--wave <k>` the job runs wave k and no other, reading the approved
|
|
1639
1987
|
* set and the progress from the `--resume` record the job before it left.
|
|
@@ -1747,7 +2095,6 @@ async function prApplyWaves(ctx, p, at) {
|
|
|
1747
2095
|
`Nothing was applied. Run wave ${left}'s job first, with the same --resume record.`,
|
|
1748
2096
|
}), 1);
|
|
1749
2097
|
}
|
|
1750
|
-
let planned;
|
|
1751
2098
|
let judged = { held: false };
|
|
1752
2099
|
if (carry) {
|
|
1753
2100
|
// What the earlier waves applied settles first (#4007), each in its own wave, as a resumed apply's does.
|
|
@@ -1764,6 +2111,8 @@ async function prApplyWaves(ctx, p, at) {
|
|
|
1764
2111
|
const set = await planAll(p, events?.emit);
|
|
1765
2112
|
approved = set;
|
|
1766
2113
|
if (set.failed) {
|
|
2114
|
+
if (set.policyDenied)
|
|
2115
|
+
return stop(report({ status: "plan-failed", message: "The policy denied a member's plan, so nothing was applied." }), CHANT_EXIT.denied);
|
|
1767
2116
|
return stop(report({ status: "plan-failed", message: "A member failed to plan, so there is no plan to compare with the approved one. Nothing was applied." }), 1);
|
|
1768
2117
|
}
|
|
1769
2118
|
await storeChangeSetForGate(ctx, p, set.doc);
|
|
@@ -1778,9 +2127,8 @@ async function prApplyWaves(ctx, p, at) {
|
|
|
1778
2127
|
if (afterGate && decided.satisfied)
|
|
1779
2128
|
return stop(report({ status: "failed", message: afterGate }), 1);
|
|
1780
2129
|
if (!decided.satisfied)
|
|
1781
|
-
return stop(report({ status: "refused", refusal: decided.refusal, message: decided.message }),
|
|
2130
|
+
return stop(report({ status: "refused", refusal: decided.refusal, message: decided.message }), decided.refusal === "plan-changed" ? CHANT_EXIT.moved : CHANT_EXIT.waiting);
|
|
1782
2131
|
via = decided.via;
|
|
1783
|
-
planned = set;
|
|
1784
2132
|
}
|
|
1785
2133
|
const approvedSet = approved;
|
|
1786
2134
|
const review = reviewFor(args, p, pr, green);
|
|
@@ -1826,6 +2174,9 @@ async function prApplyWaves(ctx, p, at) {
|
|
|
1826
2174
|
/** The last apply in this job that failed (#4291): its results give the exit code once every wave ran. */
|
|
1827
2175
|
let lastFailure;
|
|
1828
2176
|
let planFailedIn;
|
|
2177
|
+
// #4588: the outputs file the waves' plan-wave and apply-wave steps hand outputs on in.
|
|
2178
|
+
const { componentWaveOutputsFile } = await import("../../components/product-pipeline.js");
|
|
2179
|
+
const outputsFile = componentWaveOutputsFile(op);
|
|
1829
2180
|
for (let k = from; k <= to; k++) {
|
|
1830
2181
|
// #4291: a component of this wave whose upstream failed, or was blocked by a failure, is blocked; the rest of the wave runs.
|
|
1831
2182
|
const before = new Set(p.plan.waves.slice(0, k - 1).flat());
|
|
@@ -1848,137 +2199,63 @@ async function prApplyWaves(ctx, p, at) {
|
|
|
1848
2199
|
recordAttempt();
|
|
1849
2200
|
continue;
|
|
1850
2201
|
}
|
|
1851
|
-
|
|
1852
|
-
//
|
|
1853
|
-
|
|
1854
|
-
// the outputs the waves before it left.
|
|
1855
|
-
let set;
|
|
1856
|
-
let entry;
|
|
1857
|
-
if (planned && k === 1) {
|
|
1858
|
-
set = {
|
|
1859
|
-
...planned,
|
|
1860
|
-
members: planned.members.filter((m) => inThisWave.has(m.component)),
|
|
1861
|
-
plans: Object.fromEntries(Object.entries(planned.plans).filter(([name]) => inThisWave.has(name))),
|
|
1862
|
-
};
|
|
1863
|
-
entry = { wave: k, components: wavePlan.order, status: "applied", approval: "pull-request", gate: p.gate, digest: approvedSet.doc.digest, ...(approval.approvedBy ? { approvedBy: approval.approvedBy } : {}) };
|
|
1864
|
-
}
|
|
1865
|
-
else {
|
|
1866
|
-
const notApplied = Object.fromEntries(Object.entries(approvedSet.outputs).filter(([name]) => !completed.has(name)));
|
|
1867
|
-
const fresh = await hookedPlan(p, wavePlan.order, () => planPrSet({
|
|
1868
|
-
components: p.components,
|
|
1869
|
-
plan: wavePlan,
|
|
1870
|
-
registry: p.registry,
|
|
1871
|
-
env: p.env,
|
|
1872
|
-
seededOutputs: { ...p.seededOutputs, ...notApplied, ...outputsSoFar },
|
|
1873
|
-
...(events ? { onRunEvent: (body) => events.emit(body) } : {}),
|
|
1874
|
-
}));
|
|
1875
|
-
if (fresh.failed) {
|
|
1876
|
-
for (const m of fresh.members) {
|
|
1877
|
-
after.set(m.member, m);
|
|
1878
|
-
if (m.status === "plan-failed")
|
|
1879
|
-
failedSoFar.add(m.component);
|
|
1880
|
-
}
|
|
1881
|
-
setWave({ wave: k, components: wavePlan.order, status: "plan-failed", approval: "pull-request", gate: p.gate, digest: approvedSet.doc.digest });
|
|
1882
|
-
// #4291: the later waves still run what does not depend on this wave.
|
|
1883
|
-
console.error(formatWarning({ message: `A member of wave ${k} failed to plan, so nothing in wave ${k} was applied.`, hint: "The waves after it apply what does not depend on wave " + k + "." }));
|
|
1884
|
-
planFailedIn ?? (planFailedIn = k);
|
|
1885
|
-
continue;
|
|
1886
|
-
}
|
|
1887
|
-
const moved = waveNotCovered(approvedSet.doc, fresh.doc, approvedSet.members, { approved: approvedSet.shapes, fresh: fresh.shapes });
|
|
1888
|
-
set = fresh;
|
|
1889
|
-
if (moved.length === 0) {
|
|
1890
|
-
console.error(formatInfo(`wave ${k}: the approved plan covers what it plans now, so it applies under the pull request's approval`));
|
|
1891
|
-
entry = { wave: k, components: wavePlan.order, status: "applied", approval: "pull-request", gate: p.gate, digest: approvedSet.doc.digest, ...(approval.approvedBy ? { approvedBy: approval.approvedBy } : {}) };
|
|
1892
|
-
}
|
|
1893
|
-
else {
|
|
1894
|
-
const gate = waveGateName(waveGate, k);
|
|
1895
|
-
const digest = fresh.doc.digest;
|
|
1896
|
-
console.error(formatInfo(`wave ${k}: its plan moved since the pull request's (${moved.join("; ")}), so it needs an approval of ${gate}`));
|
|
1897
|
-
await storeChangeSetForGate(ctx, p, fresh.doc);
|
|
1898
|
-
writeWaveChangeSet(ctx, k, fresh.doc, upload);
|
|
1899
|
-
const approveLine = prApproveCommand({ op, gate, digest });
|
|
1900
|
-
const check = await emitGateStep(events?.emit, { op, gate }, () => decidePrGate(gitGateLedgerPort(), { op, gate, digest, description: `${changeLabel(pr, green)}, wave ${k} of ${total}: ${wavePlan.order.join(", ")}` }), (unapproved) => unapproved.mismatch
|
|
1901
|
-
? `wave ${k}'s plan changed after its approval. Approve the plan now: ${approveLine}`
|
|
1902
|
-
: `wave ${k}'s plan is not the one the pull request approved. Approve it: ${approveLine}`);
|
|
1903
|
-
const waveApproval = approvalOf(check);
|
|
1904
|
-
const waiting = {
|
|
1905
|
-
wave: k,
|
|
1906
|
-
components: wavePlan.order,
|
|
1907
|
-
status: "waiting",
|
|
1908
|
-
approval: "wave",
|
|
1909
|
-
gate,
|
|
1910
|
-
digest,
|
|
1911
|
-
moved,
|
|
1912
|
-
...(waveApproval.approved ? { approved: waveApproval.approved } : {}),
|
|
1913
|
-
};
|
|
1914
|
-
if (!check.satisfied) {
|
|
1915
|
-
setWave(waiting);
|
|
1916
|
-
const message = waveApproval.status === "changed"
|
|
1917
|
-
? `Wave ${k}'s plan changed after its approval, so nothing in it was applied. approved: ${waveApproval.approved ?? "(none)"}; planned now: ${digest}. ` +
|
|
1918
|
-
`Read the new plan, and if it is right, approve it: ${approveLine}; then run the wave's apply again.`
|
|
1919
|
-
: `Wave ${k} was planned after the waves before it applied, and the pull request's approved plan does not cover it: ${moved.join("; ")}. ` +
|
|
1920
|
-
`Nothing in wave ${k} was applied. Read its plan, and if it is right, approve it: ${approveLine}; then run the wave's apply again.`;
|
|
1921
|
-
return stop(report({ status: "refused", refusal: waveApproval.status === "changed" ? "wave-plan-changed" : "wave-not-approved", message }), GATED_EXIT_CODE);
|
|
1922
|
-
}
|
|
1923
|
-
const waveReview = await review(waveApproval.approvedBy ?? [], `Wave ${k}'s plan`);
|
|
1924
|
-
if (waveReview && "error" in waveReview)
|
|
1925
|
-
return fail(waveReview.error);
|
|
1926
|
-
if (waveReview) {
|
|
1927
|
-
setWave(waiting);
|
|
1928
|
-
emitReviewStop(events, waveReview.message);
|
|
1929
|
-
return stop(report({ status: "refused", refusal: waveReview.refusal, message: waveReview.message }), GATED_EXIT_CODE);
|
|
1930
|
-
}
|
|
1931
|
-
entry = { wave: k, components: wavePlan.order, status: "applied", approval: "wave", gate, digest, moved, ...(waveApproval.approvedBy ? { approvedBy: waveApproval.approvedBy } : {}) };
|
|
1932
|
-
}
|
|
1933
|
-
}
|
|
2202
|
+
// #4588: the wave plans, waits or passes its gate, and applies on op waves: the component waves spec,
|
|
2203
|
+
// each run a component, through the component plan-wave and apply-wave steps.
|
|
2204
|
+
const pending = { wave: k, components: wavePlan.order, status: "applied", approval: "pull-request", gate: p.gate, digest: approvedSet.doc.digest };
|
|
1934
2205
|
// #4288: the wave's apply-side hooks, around its apply.
|
|
1935
2206
|
const waveBefore = await runStageHook(p, "before-apply", wavePlan.order, undefined, `nothing in wave ${k} was applied`);
|
|
1936
2207
|
if (waveBefore) {
|
|
1937
|
-
setWave({ ...
|
|
2208
|
+
setWave({ ...pending, status: "failed" });
|
|
1938
2209
|
return stop(report({ status: "failed", message: waveBefore }), 1);
|
|
1939
2210
|
}
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
if (settled.status === "ok") {
|
|
1955
|
-
completed.add(settled.component);
|
|
1956
|
-
failedSoFar.delete(settled.component);
|
|
1957
|
-
if (inputsNow[settled.component] !== undefined)
|
|
1958
|
-
inputsSoFar[settled.component] = inputsNow[settled.component];
|
|
1959
|
-
if (outputs)
|
|
1960
|
-
outputsSoFar[settled.component] = outputs;
|
|
1961
|
-
}
|
|
1962
|
-
else if (settled.status === "fail") {
|
|
1963
|
-
failedSoFar.add(settled.component);
|
|
1964
|
-
}
|
|
1965
|
-
recordAttempt();
|
|
1966
|
-
},
|
|
1967
|
-
});
|
|
1968
|
-
for (const m of applied.members)
|
|
1969
|
-
after.set(m.member, m);
|
|
1970
|
-
for (const name of applied.run.completed) {
|
|
2211
|
+
// The outputs the waves before this one left, and the approved set's for what has not applied yet, seed its plans.
|
|
2212
|
+
const notApplied = Object.fromEntries(Object.entries(approvedSet.outputs).filter(([name]) => !completed.has(name)));
|
|
2213
|
+
mkdirSync(dirname(resolve(outputsFile)), { recursive: true });
|
|
2214
|
+
writeFileSync(resolve(outputsFile), JSON.stringify({ ...p.seededOutputs, ...notApplied, ...outputsSoFar }, null, 2) + "\n");
|
|
2215
|
+
const ran = await runComponentWave(p, { op, waveGate, k, runs: wavePlan.order, approved: approvedSet.doc, approvedBy: approval.approvedBy ?? [], outputsFile, ...(args.noReleaseRecord ? { noReleaseRecord: true } : {}), review, ...(events ? { events } : {}), log });
|
|
2216
|
+
const entry = ran.entry;
|
|
2217
|
+
if (ran.review && "error" in ran.review)
|
|
2218
|
+
return fail(ran.review.error);
|
|
2219
|
+
if (ran.review && ran.exitCode === CHANT_EXIT.waiting) {
|
|
2220
|
+
setWave(entry);
|
|
2221
|
+
emitReviewStop(events, ran.review.message);
|
|
2222
|
+
return stop(report({ status: "refused", refusal: ran.review.refusal, message: ran.review.message }), GATED_EXIT_CODE);
|
|
2223
|
+
}
|
|
2224
|
+
for (const name of ran.applied) {
|
|
1971
2225
|
completed.add(name);
|
|
1972
|
-
|
|
1973
|
-
if (
|
|
1974
|
-
|
|
2226
|
+
failedSoFar.delete(name);
|
|
2227
|
+
if (inputsNow[name] !== undefined)
|
|
2228
|
+
inputsSoFar[name] = inputsNow[name];
|
|
2229
|
+
if (ran.outputs[name])
|
|
2230
|
+
outputsSoFar[name] = ran.outputs[name];
|
|
2231
|
+
}
|
|
2232
|
+
for (const name of ran.failed)
|
|
2233
|
+
failedSoFar.add(name);
|
|
2234
|
+
if (ran.exitCode === CHANT_EXIT.waiting || ran.exitCode === CHANT_EXIT.moved) {
|
|
2235
|
+
setWave(entry);
|
|
2236
|
+
// #4003: the wave's new plan beside the report, for whoever approves its gate.
|
|
2237
|
+
if (ran.changeSet)
|
|
2238
|
+
writeWaveChangeSet(ctx, k, ran.changeSet, upload);
|
|
2239
|
+
const approveLine = prApproveCommand({ op, gate: entry.gate, digest: entry.digest });
|
|
2240
|
+
const message = ran.exitCode === CHANT_EXIT.moved
|
|
2241
|
+
? `Wave ${k}'s plan changed after its approval, so nothing in it was applied.${entry.approved ? ` approved: ${entry.approved}; planned now: ${entry.digest}.` : ""} Read the new plan, and if it is right, approve it: ${approveLine}; then run the wave's apply again.`
|
|
2242
|
+
: `Wave ${k} was planned after the waves before it applied, and the pull request's approved plan does not cover it${entry.moved?.length ? `: ${entry.moved.join("; ")}` : ""}. ` +
|
|
2243
|
+
`Nothing in wave ${k} was applied. Read its plan, and if it is right, approve it: ${approveLine}; then run the wave's apply again.`;
|
|
2244
|
+
return stop(report({ status: "refused", refusal: ran.exitCode === CHANT_EXIT.moved ? "wave-plan-changed" : "wave-not-approved", message }), ran.exitCode);
|
|
1975
2245
|
}
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
2246
|
+
if (ran.exitCode === CHANT_EXIT.held) {
|
|
2247
|
+
setWave({ ...entry, status: "waiting" });
|
|
2248
|
+
return stop(report({ status: "refused", refusal: "locked", message: `Wave ${k}: another run holds what it changes, so nothing in it was applied.` }), CHANT_EXIT.held);
|
|
2249
|
+
}
|
|
2250
|
+
if (ran.exitCode === CHANT_EXIT.denied || ran.exitCode === CHANT_EXIT.declined || ran.exitCode === CHANT_EXIT.superseded) {
|
|
2251
|
+
setWave({ ...entry, status: "failed" });
|
|
2252
|
+
return stop(report({ status: "failed", message: `Wave ${k} stopped on op waves with exit ${ran.exitCode}; nothing more was applied.` }), ran.exitCode);
|
|
2253
|
+
}
|
|
2254
|
+
const waveAfter = await runStageHook(p, "after-apply", wavePlan.order.filter((name) => ran.applied.includes(name)), undefined, `wave ${k} counts as failed though its components applied`);
|
|
2255
|
+
setWave({ ...entry, status: ran.exitCode === CHANT_EXIT.done && !waveAfter ? "applied" : "failed" });
|
|
2256
|
+
if (ran.exitCode !== CHANT_EXIT.done) {
|
|
1980
2257
|
// #4291: a failed member blocks only its dependents, so the later waves still run.
|
|
1981
|
-
lastFailure = {
|
|
2258
|
+
lastFailure = { exitCode: ran.exitCode };
|
|
1982
2259
|
recordAttempt();
|
|
1983
2260
|
continue;
|
|
1984
2261
|
}
|
|
@@ -1993,13 +2270,342 @@ async function prApplyWaves(ctx, p, at) {
|
|
|
1993
2270
|
const message = planFailedIn !== undefined && !lastFailure
|
|
1994
2271
|
? `A member of wave ${planFailedIn} failed to plan, so nothing in wave ${planFailedIn} was applied.${blockedLine}`
|
|
1995
2272
|
: blockedLine ? blockedLine.trim() : undefined;
|
|
1996
|
-
return stop(report({ status: "failed", ...(message ? { message } : {}) }), lastFailure ?
|
|
2273
|
+
return stop(report({ status: "failed", ...(message ? { message } : {}) }), lastFailure ? lastFailure.exitCode : 1);
|
|
1997
2274
|
}
|
|
1998
2275
|
const done = p.plan.order.every((name) => completed.has(name));
|
|
1999
2276
|
if (green && done)
|
|
2000
2277
|
await recordGreenApplied(p, green, approvedSet.doc.digest, approval, via);
|
|
2001
2278
|
return stop(report({ status: done ? "applied" : "wave-applied" }), 0);
|
|
2002
2279
|
}
|
|
2280
|
+
// ── The component plan-wave and apply-wave steps (#4588) ─────────────────────
|
|
2281
|
+
/** The outputs earlier waves' components left, from `--wave-outputs`; empty when the file is not there yet. */
|
|
2282
|
+
function readWaveOutputs(file) {
|
|
2283
|
+
if (!file || !existsSync(resolve(file)))
|
|
2284
|
+
return { outputs: {} };
|
|
2285
|
+
try {
|
|
2286
|
+
const parsed = JSON.parse(readFileSync(resolve(file), "utf8"));
|
|
2287
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
2288
|
+
return { error: `--wave-outputs ${file} must hold { "<component>": { ...outputs } }` };
|
|
2289
|
+
return { outputs: parsed };
|
|
2290
|
+
}
|
|
2291
|
+
catch (err) {
|
|
2292
|
+
return { error: `--wave-outputs: could not read "${file}": ${err instanceof Error ? err.message : String(err)}` };
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
/** The runs `chant run wave` wrote to `{runs}`: their targets, each a component, and on apply-wave the digest each was approved at. */
|
|
2296
|
+
function readWaveRuns(file) {
|
|
2297
|
+
if (!file)
|
|
2298
|
+
return { error: "the step needs --runs <file>, which chant run wave fills in as {runs}" };
|
|
2299
|
+
try {
|
|
2300
|
+
const parsed = JSON.parse(readFileSync(resolve(file), "utf8"));
|
|
2301
|
+
if (!Array.isArray(parsed?.runs))
|
|
2302
|
+
return { error: `--runs ${file} has no runs` };
|
|
2303
|
+
return parsed.runs.flatMap((r) => typeof r?.target === "string" ? [{ target: r.target, ...(typeof r.planDigest === "string" ? { planDigest: r.planDigest } : {}) }] : []);
|
|
2304
|
+
}
|
|
2305
|
+
catch (err) {
|
|
2306
|
+
return { error: `--runs: could not read "${file}": ${err instanceof Error ? err.message : String(err)}` };
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
/** The fan-out plan of `names`, one wave of the derivation, with the rest of that wave counted as done. */
|
|
2310
|
+
function namedWavePlan(p, names) {
|
|
2311
|
+
const unknown = names.filter((n) => !p.plan.order.includes(n));
|
|
2312
|
+
if (unknown.length > 0)
|
|
2313
|
+
return { error: `${unknown.join(", ")} ${unknown.length === 1 ? "is" : "are"} not in the change between ${p.base.slice(0, 12)} and ${p.head.slice(0, 12)}, so the wave cannot plan ${unknown.length === 1 ? "it" : "them"}` };
|
|
2314
|
+
const k = p.plan.waves.findIndex((w) => w.includes(names[0])) + 1;
|
|
2315
|
+
const wave = p.plan.waves[k - 1] ?? [];
|
|
2316
|
+
const across = names.filter((n) => !wave.includes(n));
|
|
2317
|
+
if (across.length > 0)
|
|
2318
|
+
return { error: `${names[0]} and ${across.join(", ")} are in different waves of the derivation, so one wave step cannot plan them together` };
|
|
2319
|
+
return prWavePlan(p.plan, p.components, k, wave.filter((n) => !names.includes(n)));
|
|
2320
|
+
}
|
|
2321
|
+
/** One component's entry in the op-waves plans file: the digest over its members' plans, and whether it changes or destroys anything. */
|
|
2322
|
+
function componentPlanEntry(set, component) {
|
|
2323
|
+
const members = set.members.filter((m) => m.component === component).sort((a, b) => a.member.localeCompare(b.member));
|
|
2324
|
+
const names = new Set(members.map((m) => m.member));
|
|
2325
|
+
const entries = set.doc.entries.filter((e) => names.has(e.member));
|
|
2326
|
+
const changes = entries.filter((e) => e.action !== "no-op" && e.action !== "read");
|
|
2327
|
+
const destructive = changes.some((e) => e.action === "delete" || e.action === "replace");
|
|
2328
|
+
return {
|
|
2329
|
+
target: component,
|
|
2330
|
+
planDigest: computePlanDigest("component-wave", members.map((m) => ({ member: m.member, planDigest: m.planDigest }))),
|
|
2331
|
+
...(changes.length === 0 ? { empty: true } : {}),
|
|
2332
|
+
...(destructive ? { destructive: true } : {}),
|
|
2333
|
+
};
|
|
2334
|
+
}
|
|
2335
|
+
/** Read the step's runs and outputs files from its flags. */
|
|
2336
|
+
function waveStepFiles(args) {
|
|
2337
|
+
const runs = readWaveRuns(args.runsFile);
|
|
2338
|
+
if ("error" in runs)
|
|
2339
|
+
return runs;
|
|
2340
|
+
if (!args.plansFile)
|
|
2341
|
+
return { error: "the step needs --plans <file>, which chant run wave fills in as {plans}" };
|
|
2342
|
+
const read = readWaveOutputs(args.waveOutputs);
|
|
2343
|
+
if ("error" in read)
|
|
2344
|
+
return read;
|
|
2345
|
+
return { runs, plansFile: args.plansFile, ...(args.waveOutputs ? { outputsFile: args.waveOutputs } : {}), outputs: read.outputs };
|
|
2346
|
+
}
|
|
2347
|
+
/** Plan the step's runs, each a component, against the outputs the earlier waves left. */
|
|
2348
|
+
async function planComponentRuns(p, files) {
|
|
2349
|
+
const names = files.runs.map((r) => r.target);
|
|
2350
|
+
const plan = names.length > 0 ? namedWavePlan(p, names) : { ...p.plan, order: [], waves: [] };
|
|
2351
|
+
if ("error" in plan)
|
|
2352
|
+
return plan;
|
|
2353
|
+
const lockGrain = await declaredLockGrainOf(p);
|
|
2354
|
+
const set = await planPrSet({ components: p.components, plan, registry: p.registry, env: p.env, seededOutputs: { ...p.seededOutputs, ...files.outputs }, ...(lockGrain ? { lockGrain } : {}), policyBase: p.base });
|
|
2355
|
+
return { set, plan };
|
|
2356
|
+
}
|
|
2357
|
+
/** The plan step over `p`: write `{plans}`, one digest per component and the wave's change set. */
|
|
2358
|
+
async function planComponentWave(p, files) {
|
|
2359
|
+
const planned = await planComponentRuns(p, files);
|
|
2360
|
+
if ("error" in planned)
|
|
2361
|
+
return fail(planned.error);
|
|
2362
|
+
const { set } = planned;
|
|
2363
|
+
if (set.failed) {
|
|
2364
|
+
for (const m of set.members.filter((x) => x.status === "plan-failed"))
|
|
2365
|
+
console.error(formatError({ message: `${m.member} (${m.component}) failed to plan${m.error ? `: ${m.error}` : ""}` }));
|
|
2366
|
+
return set.policyDenied ? CHANT_EXIT.denied : 1;
|
|
2367
|
+
}
|
|
2368
|
+
const file = { runs: files.runs.map((r) => componentPlanEntry(set, r.target)), changeSet: set.doc };
|
|
2369
|
+
mkdirSync(dirname(resolve(files.plansFile)), { recursive: true });
|
|
2370
|
+
writeFileSync(resolve(files.plansFile), JSON.stringify(file, null, 2) + "\n");
|
|
2371
|
+
console.error(formatInfo(`planned ${files.runs.length} component${files.runs.length === 1 ? "" : "s"}: ${files.runs.map((r) => r.target).join(", ") || "(none)"}; change set ${set.doc.digest}`));
|
|
2372
|
+
return 0;
|
|
2373
|
+
}
|
|
2374
|
+
/** The apply step over `p`: plan the approved runs again, refuse a moved one with 4, else lease, apply, record, and hand the outputs on. */
|
|
2375
|
+
async function applyComponentWave(p, files, opts = {}) {
|
|
2376
|
+
if (files.runs.length === 0)
|
|
2377
|
+
return 0;
|
|
2378
|
+
const planned = await planComponentRuns(p, files);
|
|
2379
|
+
if ("error" in planned)
|
|
2380
|
+
return fail(planned.error);
|
|
2381
|
+
const { set, plan } = planned;
|
|
2382
|
+
if (set.failed)
|
|
2383
|
+
return fail("A component of the wave failed to plan again, so nothing in it was applied.");
|
|
2384
|
+
const moved = files.runs.filter((r) => r.planDigest !== undefined && !samePlanDigest(componentPlanEntry(set, r.target).planDigest, r.planDigest));
|
|
2385
|
+
if (moved.length > 0) {
|
|
2386
|
+
console.error(formatError({ message: `${moved.map((r) => r.target).join(", ")} now plan${moved.length === 1 ? "s" : ""} something other than the approved plan, so nothing in the wave was applied.`, hint: "Run the wave's job again to plan it afresh and decide its gate." }));
|
|
2387
|
+
return CHANT_EXIT.moved;
|
|
2388
|
+
}
|
|
2389
|
+
const lease = await leaseSetRows(p, set);
|
|
2390
|
+
if (typeof lease === "number")
|
|
2391
|
+
return lease;
|
|
2392
|
+
if ("held" in lease) {
|
|
2393
|
+
console.error(formatError({ message: lease.held }));
|
|
2394
|
+
return CHANT_EXIT.held;
|
|
2395
|
+
}
|
|
2396
|
+
const lockGrain = await declaredLockGrainOf(p);
|
|
2397
|
+
const release = autoReleaseRun(`wave-${Date.now()}`);
|
|
2398
|
+
let applied;
|
|
2399
|
+
try {
|
|
2400
|
+
applied = await applyPrSet({ components: p.components, plan, registry: p.registry, env: p.env, set, gate: p.gate, ...(lockGrain ? { lockGrain } : {}), policyBase: p.base, ...(opts.onRunEvent ? { onRunEvent: opts.onRunEvent } : {}) });
|
|
2401
|
+
}
|
|
2402
|
+
finally {
|
|
2403
|
+
await lease.release();
|
|
2404
|
+
}
|
|
2405
|
+
await recordAutoReleasesForRun(applied.run.results, p.env, release.runId, resolveAutoReleaseDisabled(p.config, opts.noReleaseRecord), release.runOrigin, undefined, undefined, prAppliedDigests(p, applied.members));
|
|
2406
|
+
if (files.outputsFile) {
|
|
2407
|
+
const next = { ...files.outputs };
|
|
2408
|
+
for (const name of applied.run.completed)
|
|
2409
|
+
next[name] = applied.run.componentOutputs[name] ?? {};
|
|
2410
|
+
mkdirSync(dirname(resolve(files.outputsFile)), { recursive: true });
|
|
2411
|
+
writeFileSync(resolve(files.outputsFile), JSON.stringify(next, null, 2) + "\n");
|
|
2412
|
+
}
|
|
2413
|
+
for (const m of applied.members)
|
|
2414
|
+
console.error(m.status === "applied" ? formatSuccess(`applied ${m.member} (${m.component})`) : formatWarning({ message: `${m.member} (${m.component}): ${m.status}${m.error ? `, ${m.error}` : ""}` }));
|
|
2415
|
+
// #4291: the components that applied, so op waves fails only the others and blocks only what depends on them.
|
|
2416
|
+
const runsResult = opts.runsResult ?? (process.env.CHANT_APPLY_RUNS_RESULT ? resolve(process.env.CHANT_APPLY_RUNS_RESULT) : undefined);
|
|
2417
|
+
if (runsResult && applied.status !== "applied") {
|
|
2418
|
+
mkdirSync(dirname(runsResult), { recursive: true });
|
|
2419
|
+
writeFileSync(runsResult, JSON.stringify({ applied: [...applied.run.completed].sort() }, null, 2) + "\n");
|
|
2420
|
+
}
|
|
2421
|
+
return applied.status === "applied" ? 0 : applied.status === "waiting" ? CHANT_EXIT.waiting : 1;
|
|
2422
|
+
}
|
|
2423
|
+
/**
|
|
2424
|
+
* `chant components plan-wave --runs <file> --plans <file> --base <ref>
|
|
2425
|
+
* --env <env> [--member <m>] [--wave-outputs <file>]` (#4588): the
|
|
2426
|
+
* component plan step of a component waves spec. Plans each run, a
|
|
2427
|
+
* component, through the project's capabilities against the outputs the
|
|
2428
|
+
* waves before it left, and writes `{plans}`: one digest per component over
|
|
2429
|
+
* its members' plans, and the wave's change set, which a `pull-request`
|
|
2430
|
+
* wave checks the pull request's approval against.
|
|
2431
|
+
*/
|
|
2432
|
+
export async function runComponentsPlanWave(ctx) {
|
|
2433
|
+
const files = waveStepFiles(ctx.args);
|
|
2434
|
+
if ("error" in files)
|
|
2435
|
+
return fail(files.error);
|
|
2436
|
+
const p = await prepare(ctx, "apply");
|
|
2437
|
+
if (typeof p === "number")
|
|
2438
|
+
return p;
|
|
2439
|
+
return planComponentWave(p, files);
|
|
2440
|
+
}
|
|
2441
|
+
/**
|
|
2442
|
+
* `chant components apply-wave --runs <file> --plans <file> --base <ref>
|
|
2443
|
+
* --env <env> [--member <m>] [--wave-outputs <file>]` (#4588): the
|
|
2444
|
+
* component apply step. Plans the approved runs again and exits 4 when a
|
|
2445
|
+
* component's plan is not the one approved; else leases its rows on the
|
|
2446
|
+
* resource grain, applies, records the releases, and adds each applied
|
|
2447
|
+
* component's outputs to `--wave-outputs` for the next wave.
|
|
2448
|
+
*/
|
|
2449
|
+
export async function runComponentsApplyWave(ctx) {
|
|
2450
|
+
const files = waveStepFiles(ctx.args);
|
|
2451
|
+
if ("error" in files)
|
|
2452
|
+
return fail(files.error);
|
|
2453
|
+
const p = await prepare(ctx, "apply");
|
|
2454
|
+
if (typeof p === "number")
|
|
2455
|
+
return p;
|
|
2456
|
+
return applyComponentWave(p, files, { noReleaseRecord: ctx.args.noReleaseRecord });
|
|
2457
|
+
}
|
|
2458
|
+
/**
|
|
2459
|
+
* The component steps in this process (#4588): `pr-apply --wave-gate`
|
|
2460
|
+
* already holds the prepared project, so the plan-wave and apply-wave lines
|
|
2461
|
+
* of its spec run here against it, rather than in a process that would
|
|
2462
|
+
* derive the change again.
|
|
2463
|
+
*/
|
|
2464
|
+
function componentWaveExec(p, noReleaseRecord, onRunEvent) {
|
|
2465
|
+
return async (argv, cwd, env) => {
|
|
2466
|
+
const at = argv.findIndex((a, i) => a === "components" && (argv[i + 1] === "plan-wave" || argv[i + 1] === "apply-wave"));
|
|
2467
|
+
if (at < 0)
|
|
2468
|
+
return fail(`not a component wave step: ${argv.join(" ")}`);
|
|
2469
|
+
let args;
|
|
2470
|
+
try {
|
|
2471
|
+
args = parseArgs(argv.slice(at));
|
|
2472
|
+
}
|
|
2473
|
+
catch (err) {
|
|
2474
|
+
return fail(err instanceof Error ? err.message : String(err));
|
|
2475
|
+
}
|
|
2476
|
+
const files = waveStepFiles(args);
|
|
2477
|
+
if ("error" in files)
|
|
2478
|
+
return fail(files.error);
|
|
2479
|
+
const runsResult = env?.CHANT_APPLY_RUNS_RESULT ? resolve(cwd, env.CHANT_APPLY_RUNS_RESULT) : undefined;
|
|
2480
|
+
return argv[at + 1] === "plan-wave" ? planComponentWave(p, files) : applyComponentWave(p, files, { noReleaseRecord, ...(onRunEvent ? { onRunEvent } : {}), ...(runsResult ? { runsResult } : {}) });
|
|
2481
|
+
};
|
|
2482
|
+
}
|
|
2483
|
+
/**
|
|
2484
|
+
* A gate ledger that holds the approval `pr-apply` already decided (#4588):
|
|
2485
|
+
* an approval of the pull request's gate under its op, for the approved
|
|
2486
|
+
* change set, so an op wave of the component waves spec finds the approval
|
|
2487
|
+
* a pull request (or a green commit's merges) gave and checks its own plan
|
|
2488
|
+
* against it. Everything else is the real ledger's.
|
|
2489
|
+
*/
|
|
2490
|
+
function withDecidedApproval(port, at) {
|
|
2491
|
+
return {
|
|
2492
|
+
...port,
|
|
2493
|
+
appendPending: (input) => port.appendPending(input),
|
|
2494
|
+
async read(op) {
|
|
2495
|
+
const got = await port.read(op);
|
|
2496
|
+
if (op !== at.op)
|
|
2497
|
+
return got;
|
|
2498
|
+
const decided = { version: 1, kind: "resolution", op: at.op, gate: at.gate, resolvedBy: at.approvedBy.join(", ") || "pr-apply", timestamp: at.timestamp, planDigest: at.digest, changeSet: at.digest };
|
|
2499
|
+
return { ...got, resolutions: [...got.resolutions, decided] };
|
|
2500
|
+
},
|
|
2501
|
+
};
|
|
2502
|
+
}
|
|
2503
|
+
/**
|
|
2504
|
+
* The review rule on a wave's own gate (#4000, #4588): `--require-review`
|
|
2505
|
+
* judges an approval of the wave's gate as it judges the pull request's, so
|
|
2506
|
+
* an approval it refuses never reaches the op wave, which then waits. The
|
|
2507
|
+
* refusal is kept in `refused` for pr-apply's report. The pull request's gate
|
|
2508
|
+
* was judged before the waves ran, so its approvals pass as they are.
|
|
2509
|
+
*/
|
|
2510
|
+
function withWaveReview(port, at) {
|
|
2511
|
+
return {
|
|
2512
|
+
...port,
|
|
2513
|
+
async read(op) {
|
|
2514
|
+
var _a;
|
|
2515
|
+
const got = await port.read(op);
|
|
2516
|
+
const resolutions = [];
|
|
2517
|
+
for (const r of got.resolutions) {
|
|
2518
|
+
const stop = r.gate === at.prGate ? undefined : await at.review([r.resolvedBy], at.what);
|
|
2519
|
+
if (stop)
|
|
2520
|
+
(_a = at.refused).stop ?? (_a.stop = stop);
|
|
2521
|
+
else
|
|
2522
|
+
resolutions.push(r);
|
|
2523
|
+
}
|
|
2524
|
+
return { ...got, resolutions };
|
|
2525
|
+
},
|
|
2526
|
+
};
|
|
2527
|
+
}
|
|
2528
|
+
/**
|
|
2529
|
+
* Run wave `k` of `pr-apply --wave-gate` on op waves (#4588): the component
|
|
2530
|
+
* waves spec with the wave's runs left to apply, read at base as chant
|
|
2531
|
+
* wrote it (the spec is chant's, never the change's), decided under the
|
|
2532
|
+
* approval pr-apply holds, planned and applied through the component
|
|
2533
|
+
* plan-wave and apply-wave steps.
|
|
2534
|
+
*/
|
|
2535
|
+
async function runComponentWave(p, at) {
|
|
2536
|
+
const { componentWavesSpec, componentWaveSteps, PRODUCT_WAVES_SPEC_DIR: PRODUCT_WAVES_DIR } = await import("../../components/product-pipeline.js");
|
|
2537
|
+
const { runOpWave, opWavePlansPath } = await import("../../op/op-waves-run.js");
|
|
2538
|
+
const words = activeProductWords();
|
|
2539
|
+
const cwd = resolve(".");
|
|
2540
|
+
const steps = componentWaveSteps({ ...(words.bin ? { bin: words.bin } : {}), env: p.env, base: p.base, head: p.head, ...(p.member ? { member: p.member } : {}), op: at.op, gate: p.gate, outputs: at.outputsFile });
|
|
2541
|
+
const waves = p.plan.waves.map((w, i) => (i === at.k - 1 ? at.runs : w));
|
|
2542
|
+
const spec = componentWavesSpec(p.components, words, steps, { op: at.op, gate: at.waveGate, prGate: p.gate, waves });
|
|
2543
|
+
const specFile = `${PRODUCT_WAVES_DIR}/${at.op}.spec.json`;
|
|
2544
|
+
const refused = {};
|
|
2545
|
+
const result = await runOpWave({
|
|
2546
|
+
spec,
|
|
2547
|
+
specFile,
|
|
2548
|
+
wave: at.k,
|
|
2549
|
+
base: p.base,
|
|
2550
|
+
head: p.head,
|
|
2551
|
+
cwd,
|
|
2552
|
+
show: () => ({ sha: p.base, text: JSON.stringify(spec) }),
|
|
2553
|
+
gates: withWaveReview(withDecidedApproval(gitGateLedgerPort(), { op: at.op, gate: p.gate, digest: at.approved.digest, approvedBy: at.approvedBy, timestamp: new Date().toISOString() }), {
|
|
2554
|
+
prGate: p.gate,
|
|
2555
|
+
what: `Wave ${at.k}'s plan`,
|
|
2556
|
+
review: at.review,
|
|
2557
|
+
refused,
|
|
2558
|
+
}),
|
|
2559
|
+
// pr-apply's report and the `chant ci run` record stand for the job, so the wave writes no op-wave run record beside them.
|
|
2560
|
+
runs: { append: async () => { } },
|
|
2561
|
+
changeSets: async (digest) => {
|
|
2562
|
+
if (samePlanDigest(digest, at.approved.digest))
|
|
2563
|
+
return at.approved;
|
|
2564
|
+
const { readStoredChangeSet } = await import("../../lifecycle/change-set-store.js");
|
|
2565
|
+
const got = await readStoredChangeSet(digest, { cwd });
|
|
2566
|
+
return got.status === "found" ? got.document : undefined;
|
|
2567
|
+
},
|
|
2568
|
+
lockGate: p.gate,
|
|
2569
|
+
// The apply's run events nest in pr-apply's stream with the derivation's wave number, as its log does.
|
|
2570
|
+
waveExec: componentWaveExec(p, at.noReleaseRecord, (body) => {
|
|
2571
|
+
const numbered = inWave(body, at.k);
|
|
2572
|
+
at.events?.nested(numbered);
|
|
2573
|
+
if (numbered.type !== "run-start")
|
|
2574
|
+
at.log(numbered);
|
|
2575
|
+
}),
|
|
2576
|
+
// The outcome files of this commit's waves alone, so a run of another commit on the same checkout blocks nothing here.
|
|
2577
|
+
outcomeDir: `${PRODUCT_WAVES_DIR}/${at.op}/outcomes-${p.head.slice(0, 12)}`,
|
|
2578
|
+
});
|
|
2579
|
+
const d = result.decision;
|
|
2580
|
+
const byPullRequest = d?.via === "pull-request";
|
|
2581
|
+
// #4553: an approval of the wave's own gate stands, but for another plan: the plan moved after its approval.
|
|
2582
|
+
const exitCode = result.exitCode === CHANT_EXIT.waiting && !byPullRequest && d?.mismatch && !refused.stop ? CHANT_EXIT.moved : result.exitCode;
|
|
2583
|
+
const entry = {
|
|
2584
|
+
wave: at.k,
|
|
2585
|
+
components: at.runs,
|
|
2586
|
+
status: exitCode === CHANT_EXIT.done ? "applied" : exitCode === CHANT_EXIT.waiting || exitCode === CHANT_EXIT.moved ? "waiting" : "failed",
|
|
2587
|
+
approval: byPullRequest || !d ? "pull-request" : "wave",
|
|
2588
|
+
gate: byPullRequest || !d ? p.gate : d.gate,
|
|
2589
|
+
digest: byPullRequest || !d ? at.approved.digest : d.digest,
|
|
2590
|
+
...(byPullRequest ? (at.approvedBy.length > 0 ? { approvedBy: at.approvedBy } : {}) : d?.approvedBy ? { approvedBy: [d.approvedBy] } : {}),
|
|
2591
|
+
...(!byPullRequest && d?.coveredBy?.reason ? { moved: [d.coveredBy.reason] } : {}),
|
|
2592
|
+
...(!byPullRequest && d?.mismatch?.approved ? { approved: d.mismatch.approved } : {}),
|
|
2593
|
+
};
|
|
2594
|
+
// A wave that waits at its own gate is the stream's gate step there, as before op waves (#4003).
|
|
2595
|
+
if (d && !byPullRequest && (exitCode === CHANT_EXIT.waiting || exitCode === CHANT_EXIT.moved)) {
|
|
2596
|
+
const waiting = { satisfied: false, pending: { op: at.op }, ...(d.mismatch ? { mismatch: d.mismatch } : {}) };
|
|
2597
|
+
await emitGateStep(at.events?.emit, { op: at.op, gate: d.gate }, async () => waiting, () => d.mismatch ? `wave ${at.k}'s plan changed after its approval. Approve the plan now: ${prApproveCommand({ op: at.op, gate: d.gate, digest: d.digest })}` : `wave ${at.k}'s plan is not the one the pull request approved. Approve it: ${prApproveCommand({ op: at.op, gate: d.gate, digest: d.digest })}`);
|
|
2598
|
+
}
|
|
2599
|
+
const read = readWaveOutputs(at.outputsFile);
|
|
2600
|
+
let changeSet;
|
|
2601
|
+
try {
|
|
2602
|
+
changeSet = JSON.parse(readFileSync(join(cwd, opWavePlansPath(spec, at.k)), "utf8")).changeSet;
|
|
2603
|
+
}
|
|
2604
|
+
catch {
|
|
2605
|
+
// The wave stopped before it planned.
|
|
2606
|
+
}
|
|
2607
|
+
return { exitCode, applied: result.applied, failed: result.failed, entry, outputs: "error" in read ? {} : read.outputs, ...(changeSet ? { changeSet } : {}), ...(refused.stop ? { review: refused.stop } : {}) };
|
|
2608
|
+
}
|
|
2003
2609
|
/** A wave's new plan (#4003), beside the report as `change-set-wave-<k>.json`, for whoever approves its gate. */
|
|
2004
2610
|
function writeWaveChangeSet(ctx, wave, doc, upload) {
|
|
2005
2611
|
const dir = resolve(ctx.args.output ?? PR_REPORT_DIR);
|
|
@@ -2022,6 +2628,8 @@ function writeWaveChangeSet(ctx, wave, doc, upload) {
|
|
|
2022
2628
|
*/
|
|
2023
2629
|
export async function runComponentsPrPost(ctx) {
|
|
2024
2630
|
const { args } = ctx;
|
|
2631
|
+
if (args.stale)
|
|
2632
|
+
return runComponentsPrPostStale(ctx);
|
|
2025
2633
|
if (args.open)
|
|
2026
2634
|
return runComponentsPrPostOpen(ctx);
|
|
2027
2635
|
if (args.pr === undefined)
|
|
@@ -2043,6 +2651,9 @@ export async function runComponentsPrPost(ctx) {
|
|
|
2043
2651
|
}
|
|
2044
2652
|
const { postPlanReport } = await import("../../pr-post.js");
|
|
2045
2653
|
const member = args.members?.[0];
|
|
2654
|
+
const description = await descriptionCheckOf(ctx, forge);
|
|
2655
|
+
if (typeof description === "number")
|
|
2656
|
+
return description;
|
|
2046
2657
|
const posted = await postPlanReport({
|
|
2047
2658
|
forge,
|
|
2048
2659
|
dir: resolve(args.output ?? PR_REPORT_DIR),
|
|
@@ -2053,6 +2664,10 @@ export async function runComponentsPrPost(ctx) {
|
|
|
2053
2664
|
...(args.planResult ? { result: args.planResult } : {}),
|
|
2054
2665
|
// #4289: the plan job could not ask the forge, so the note job does, from the Ops at the commit it checked out.
|
|
2055
2666
|
overdue: () => overdueOps(forge, member),
|
|
2667
|
+
...(description ? { description } : {}),
|
|
2668
|
+
// #4628: the target branch's commit for the note's tip line, and the job summary where the forge keeps one.
|
|
2669
|
+
...(args.tip ? { baseTip: args.tip } : {}),
|
|
2670
|
+
...(args.forge !== "gitlab" && process.env.GITHUB_STEP_SUMMARY ? { summaryFile: process.env.GITHUB_STEP_SUMMARY } : {}),
|
|
2056
2671
|
});
|
|
2057
2672
|
for (const message of posted.warnings)
|
|
2058
2673
|
console.error(formatWarning({ message }));
|
|
@@ -2061,6 +2676,88 @@ export async function runComponentsPrPost(ctx) {
|
|
|
2061
2676
|
console.error(formatInfo(`pr-post: ${prStatusContext("plan", member)} ${posted.state}: ${posted.description}${posted.noted ? "; note posted" : ""}`));
|
|
2062
2677
|
return 0;
|
|
2063
2678
|
}
|
|
2679
|
+
/**
|
|
2680
|
+
* The description check pr-post runs after the note (#4629), when the
|
|
2681
|
+
* responses turn it on (`--respond description=check`, or `CHANT_RESPOND`):
|
|
2682
|
+
* the `decide.backends` entry `--decide-backend` names, from chant.config
|
|
2683
|
+
* at the commit this job checked out (the target branch's, never the pull
|
|
2684
|
+
* request's), and the model `--decide-model` pins. On with no backend is
|
|
2685
|
+
* refused, so a pipeline that asks for the check learns it never ran.
|
|
2686
|
+
*/
|
|
2687
|
+
async function descriptionCheckOf(ctx, forge) {
|
|
2688
|
+
const { parseRespondList, resolveResponses } = await import("../../ci-respond.js");
|
|
2689
|
+
const given = ctx.args.respond ? parseRespondList(ctx.args.respond) : {};
|
|
2690
|
+
if ("error" in given)
|
|
2691
|
+
return fail(given.error);
|
|
2692
|
+
if (resolveResponses(given, process.env, (m) => console.error(formatWarning({ message: m }))).description !== "check")
|
|
2693
|
+
return undefined;
|
|
2694
|
+
const name = ctx.args.decideBackend;
|
|
2695
|
+
if (!name || !ctx.args.decideModel)
|
|
2696
|
+
return fail("the description check asks a decide service, so it needs --decide-backend <name> and --decide-model <id>", "Name a decide.backends entry of chant.config, or turn the check off: --respond description=off");
|
|
2697
|
+
const { loadChantConfig } = await import("../../config.js");
|
|
2698
|
+
let backend;
|
|
2699
|
+
try {
|
|
2700
|
+
const loaded = await loadChantConfig(process.cwd());
|
|
2701
|
+
backend = loaded.config.decide?.backends?.[name];
|
|
2702
|
+
}
|
|
2703
|
+
catch (err) {
|
|
2704
|
+
return fail(`could not read decide.backends from chant.config: ${err instanceof Error ? err.message : String(err)}`);
|
|
2705
|
+
}
|
|
2706
|
+
if (!backend)
|
|
2707
|
+
return fail(`the description check names the backend ${name}, and chant.config has no decide.backends.${name}`);
|
|
2708
|
+
const { backendDescriptionAsk, respondDescription } = await import("../../ci-respond-run.js");
|
|
2709
|
+
const ask = backendDescriptionAsk(backend, { name, model: ctx.args.decideModel, cwd: process.cwd() });
|
|
2710
|
+
return async (report) => {
|
|
2711
|
+
await respondDescription(forge, report, { ask });
|
|
2712
|
+
};
|
|
2713
|
+
}
|
|
2714
|
+
/**
|
|
2715
|
+
* `pr-post --stale --tip <sha> --env <env> --forge <kind> [--branch <branch>]
|
|
2716
|
+
* [--member <name>] [--preview-comment]` (#4628): after a push to the target
|
|
2717
|
+
* branch, mark each open pull request's note that was posted against
|
|
2718
|
+
* another commit stale, naming the comment that previews again with
|
|
2719
|
+
* `--preview-comment`, and set its plan status back to pending
|
|
2720
|
+
* (`markStaleNotes`, ../../pr-post.ts). The branch is `--branch`, else the
|
|
2721
|
+
* job's (`GITHUB_REF_NAME`, `CI_COMMIT_BRANCH`). It exits 0 once it has
|
|
2722
|
+
* marked, as `pr-post` does.
|
|
2723
|
+
*/
|
|
2724
|
+
async function runComponentsPrPostStale(ctx) {
|
|
2725
|
+
const { args } = ctx;
|
|
2726
|
+
if (args.pr !== undefined || args.head)
|
|
2727
|
+
return fail("pr-post --stale finds each open pull request and its head itself, so it takes no --pr or --head");
|
|
2728
|
+
if (!args.tip)
|
|
2729
|
+
return fail("pr-post --stale needs the target branch's commit now: --tip <sha>");
|
|
2730
|
+
if (!args.env)
|
|
2731
|
+
return fail("pr-post needs the environment the plan was for: --env <env>");
|
|
2732
|
+
if (!args.forge || !FORGE_KINDS.includes(args.forge))
|
|
2733
|
+
return fail(`pr-post posts to a forge: --forge ${FORGE_KINDS.join("|")}`);
|
|
2734
|
+
if (args.members && args.members.length > 1)
|
|
2735
|
+
return fail(`pr-post takes one --member, not ${args.members.join(", ")}`);
|
|
2736
|
+
const branch = args.branch ?? process.env.CI_COMMIT_BRANCH ?? process.env.GITHUB_REF_NAME;
|
|
2737
|
+
if (!branch)
|
|
2738
|
+
return fail("pr-post --stale marks the notes of the pull requests into a branch: run it in a job of a push, or pass --branch <branch>");
|
|
2739
|
+
let forge;
|
|
2740
|
+
try {
|
|
2741
|
+
forge = forgeFromEnv(args.forge);
|
|
2742
|
+
}
|
|
2743
|
+
catch (err) {
|
|
2744
|
+
return fail(err instanceof Error ? err.message : String(err));
|
|
2745
|
+
}
|
|
2746
|
+
const member = args.members?.[0];
|
|
2747
|
+
const { markStaleNotes } = await import("../../pr-post.js");
|
|
2748
|
+
let done;
|
|
2749
|
+
try {
|
|
2750
|
+
done = await markStaleNotes({ forge, branch, tip: args.tip, env: args.env, ...(member ? { member } : {}), ...(args.previewComment ? { previewComment: true } : {}) });
|
|
2751
|
+
}
|
|
2752
|
+
catch (err) {
|
|
2753
|
+
return fail(err instanceof Error ? err.message : String(err));
|
|
2754
|
+
}
|
|
2755
|
+
for (const message of done.warnings)
|
|
2756
|
+
console.error(formatWarning({ message }));
|
|
2757
|
+
const marked = done.marks.filter((m) => m.marked).map((m) => `#${m.pr}`);
|
|
2758
|
+
console.error(formatInfo(`pr-post --stale: ${marked.length > 0 ? `marked ${marked.join(", ")} stale` : "no note to mark"} after ${branch} moved to ${args.tip.slice(0, 12)}`));
|
|
2759
|
+
return 0;
|
|
2760
|
+
}
|
|
2064
2761
|
/**
|
|
2065
2762
|
* `pr-post --open` (#4328): in a pipeline of the target branch on GitLab,
|
|
2066
2763
|
* post the plan note and status of every open merge request into it whose
|
|
@@ -2095,6 +2792,9 @@ async function runComponentsPrPostOpen(ctx) {
|
|
|
2095
2792
|
if (top.status !== 0)
|
|
2096
2793
|
return fail("pr-post --open reads the plan report's path from the repository root, and this directory is not in a git repository");
|
|
2097
2794
|
const member = args.members?.[0];
|
|
2795
|
+
const description = await descriptionCheckOf(ctx, forge);
|
|
2796
|
+
if (typeof description === "number")
|
|
2797
|
+
return description;
|
|
2098
2798
|
const artifactDir = relative(realpathSync(top.stdout.trim()), resolve(args.output ?? PR_REPORT_DIR)).split(sep).join("/");
|
|
2099
2799
|
const { postOpenPlanReports } = await import("../../pr-post.js");
|
|
2100
2800
|
const { gitlabPlanJobName } = await import("../../components/pr-pipeline.js");
|
|
@@ -2109,6 +2809,9 @@ async function runComponentsPrPostOpen(ctx) {
|
|
|
2109
2809
|
...(member ? { member } : {}),
|
|
2110
2810
|
// #4289: the Ops at the commit this pipeline checked out, the target branch's.
|
|
2111
2811
|
overdue: () => overdueOps(forge, member),
|
|
2812
|
+
...(description ? { description } : {}),
|
|
2813
|
+
// #4628: the target branch's commit this pipeline runs at, which each note's tip line names.
|
|
2814
|
+
...(args.tip ? { baseTip: args.tip } : {}),
|
|
2112
2815
|
});
|
|
2113
2816
|
}
|
|
2114
2817
|
catch (err) {
|