@intentius/chant 0.124.55 → 0.124.57
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/ci-agent.d.ts.map +1 -1
- package/dist/ci-agent.js +1 -2
- 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 +11 -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.map +1 -1
- package/dist/ci-control.js +3 -4
- package/dist/ci-estate.d.ts +24 -0
- package/dist/ci-estate.d.ts.map +1 -1
- package/dist/ci-estate.js +1 -2
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +2 -3
- 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 +7 -1
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +38 -4
- package/dist/ci-product.d.ts +35 -0
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +38 -4
- 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/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 +81 -0
- 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.map +1 -1
- package/dist/cli/handlers/ci-check.js +38 -9
- 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/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.js +14 -0
- package/dist/cli/handlers/pr.d.ts +5 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +346 -36
- package/dist/cli/handlers/run-wave.js +89 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +56 -2
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +107 -0
- package/dist/cli/registry.d.ts +38 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/adoption.d.ts.map +1 -1
- package/dist/components/adoption.js +1 -2
- package/dist/components/auto-release.d.ts +5 -2
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/auto-release.js +9 -4
- package/dist/components/capability.d.ts +47 -0
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/capability.js +25 -0
- package/dist/components/check-hooks.d.ts +4 -1
- package/dist/components/check-hooks.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/components/ci-services.js +1 -2
- package/dist/components/deploy-units.d.ts +12 -0
- package/dist/components/deploy-units.d.ts.map +1 -1
- package/dist/components/deploy-units.js +20 -1
- package/dist/components/driver.d.ts +12 -0
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +35 -1
- package/dist/components/groups.d.ts.map +1 -1
- package/dist/components/groups.js +4 -3
- package/dist/components/pr-env-ledger.d.ts.map +1 -1
- package/dist/components/pr-env-ledger.js +1 -2
- package/dist/components/pr-environment.d.ts +1 -1
- package/dist/components/pr-environment.d.ts.map +1 -1
- package/dist/components/pr-environment.js +1 -1
- package/dist/components/pr-pipeline.d.ts +137 -5
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +164 -20
- package/dist/components/pr-run.d.ts +8 -0
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +9 -4
- package/dist/components/product-pipeline.d.ts +35 -2
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +24 -5
- package/dist/components/row-lease.d.ts +22 -1
- package/dist/components/row-lease.d.ts.map +1 -1
- package/dist/components/row-lease.js +32 -6
- package/dist/components/wave-plan.d.ts +8 -0
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +18 -2
- 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 +47 -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/exit-codes.d.ts +7 -1
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +7 -1
- package/dist/lexicon.d.ts +55 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.js +2 -3
- package/dist/lifecycle/gated-request.d.ts.map +1 -1
- package/dist/lifecycle/gated-request.js +1 -2
- package/dist/lifecycle/git.d.ts +39 -3
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +223 -15
- package/dist/lifecycle/lock-rows.d.ts +23 -0
- package/dist/lifecycle/lock-rows.d.ts.map +1 -1
- package/dist/lifecycle/lock-rows.js +47 -8
- package/dist/lifecycle/query.d.ts.map +1 -1
- package/dist/lifecycle/query.js +4 -5
- package/dist/lifecycle/release-catalog.d.ts.map +1 -1
- package/dist/lifecycle/release-catalog.js +1 -1
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +1 -2
- package/dist/lifecycle/release-status.d.ts +20 -0
- package/dist/lifecycle/release-status.d.ts.map +1 -1
- package/dist/lifecycle/release-status.js +1 -22
- package/dist/lifecycle/resource-lock.d.ts +70 -0
- package/dist/lifecycle/resource-lock.d.ts.map +1 -1
- package/dist/lifecycle/resource-lock.js +241 -5
- 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/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.js +21 -4
- package/dist/op/index.d.ts +1 -1
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -1
- package/dist/op/op-waves-capability-spec.d.ts +8 -0
- package/dist/op/op-waves-capability-spec.d.ts.map +1 -1
- package/dist/op/op-waves-capability-spec.js +21 -0
- package/dist/op/op-waves-release-port.js +1 -1
- package/dist/op/op-waves-release.d.ts +2 -1
- package/dist/op/op-waves-release.d.ts.map +1 -1
- package/dist/op/op-waves-release.js +1 -2
- package/dist/op/op-waves-run.d.ts +15 -2
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +195 -31
- package/dist/op/op-waves-stand-down.d.ts.map +1 -1
- package/dist/op/op-waves-stand-down.js +1 -2
- package/dist/op/op-waves.d.ts +53 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +62 -6
- package/dist/op/runtime.d.ts +4 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/op/runtime.js +2 -3
- package/dist/otlp.d.ts.map +1 -1
- package/dist/otlp.js +1 -2
- package/dist/parallelism.d.ts +17 -0
- package/dist/parallelism.d.ts.map +1 -0
- package/dist/parallelism.js +33 -0
- package/dist/policy-source.d.ts.map +1 -1
- package/dist/policy-source.js +1 -2
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +56 -39
- package/dist/pr-loop.d.ts +9 -0
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +22 -4
- 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 +70 -1
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +116 -5
- package/dist/pr-report-url.d.ts.map +1 -1
- package/dist/pr-report-url.js +1 -2
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/run-event.d.ts.map +1 -1
- package/dist/run-event.js +1 -2
- 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/wave-runtime.mjs +351 -328
- package/dist/workspace/ci-lock-grain.d.ts +5 -0
- package/dist/workspace/ci-lock-grain.d.ts.map +1 -1
- package/dist/workspace/ci-lock-grain.js +1 -7
- package/dist/workspace/ci-run.d.ts.map +1 -1
- package/dist/workspace/ci-run.js +5 -1
- package/dist/workspace/pr-report.schema.json +5 -0
- package/package.json +1 -1
- package/src/ci-agent.ts +1 -2
- 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 +14 -0
- package/src/ci-audit/unrecorded.ts +140 -0
- package/src/ci-audit.ts +2 -0
- package/src/ci-control.ts +3 -4
- package/src/ci-estate.ts +1 -2
- package/src/ci-identity-database.test.ts +2 -3
- package/src/ci-identity-targets.test.ts +1 -3
- package/src/ci-identity.ts +2 -3
- 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.ts +35 -6
- package/src/ci-product.ts +55 -4
- 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/cli/handlers/audit-log.ts +74 -0
- package/src/cli/handlers/build-pr-loop-flags.test.ts +98 -0
- package/src/cli/handlers/build.ts +69 -0
- 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 +38 -8
- package/src/cli/handlers/e2e-safe-run.ts +27 -0
- package/src/cli/handlers/lifecycle.ts +13 -0
- package/src/cli/handlers/pr-before-merge.test.ts +1 -1
- package/src/cli/handlers/pr-deploy-inputs.test.ts +1 -1
- package/src/cli/handlers/pr-endpoint.test.ts +1 -1
- package/src/cli/handlers/pr-green.test.ts +1 -1
- 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 +1 -1
- package/src/cli/handlers/pr-record.test.ts +34 -2
- package/src/cli/handlers/pr-waves-blocked.test.ts +1 -1
- package/src/cli/handlers/pr-waves.test.ts +1 -1
- package/src/cli/handlers/pr.test.ts +1 -1
- package/src/cli/handlers/pr.ts +311 -32
- package/src/cli/handlers/run-wave.ts +79 -1
- package/src/cli/main.test.ts +1 -1
- package/src/cli/main.ts +56 -2
- package/src/cli/parse-args.ts +77 -0
- package/src/cli/registry.ts +38 -0
- package/src/components/adoption.ts +1 -2
- package/src/components/auto-release.test.ts +4 -2
- package/src/components/auto-release.ts +9 -5
- package/src/components/capability.ts +60 -0
- package/src/components/check-hooks.ts +4 -1
- package/src/components/check-steps.test.ts +70 -0
- package/src/components/check-steps.ts +158 -0
- package/src/components/ci-services.ts +1 -2
- package/src/components/deploy-units.test.ts +18 -1
- package/src/components/deploy-units.ts +26 -1
- package/src/components/driver.ts +35 -1
- package/src/components/groups.ts +4 -2
- package/src/components/plan-flags.test.ts +46 -0
- package/src/components/pr-comment-preview-targets.test.ts +34 -0
- package/src/components/pr-env-ledger.ts +1 -2
- package/src/components/pr-env-run-bundle.test.ts +0 -20
- package/src/components/pr-environment.ts +1 -1
- package/src/components/pr-pipeline-runners.test.ts +80 -0
- package/src/components/pr-pipeline.ts +244 -20
- package/src/components/pr-run.ts +17 -6
- package/src/components/pr-stale-job.test.ts +34 -0
- package/src/components/product-pipeline.ts +50 -8
- package/src/components/row-lease.test.ts +61 -1
- package/src/components/row-lease.ts +48 -7
- package/src/components/wave-plan.ts +18 -2
- 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 +49 -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/exit-codes.test.ts +3 -2
- package/src/exit-codes.ts +7 -1
- package/src/gate-decision-bundle.test.ts +0 -2
- package/src/lexicon.ts +57 -0
- package/src/lifecycle/control-entries-ledger.test.ts +2 -3
- package/src/lifecycle/gate-ledger.ts +2 -3
- package/src/lifecycle/gated-request.ts +1 -2
- package/src/lifecycle/git.test.ts +155 -0
- package/src/lifecycle/git.ts +213 -17
- package/src/lifecycle/lock-rows.test.ts +6 -1
- package/src/lifecycle/lock-rows.ts +58 -7
- package/src/lifecycle/query.ts +4 -5
- package/src/lifecycle/release-catalog.test.ts +3 -4
- package/src/lifecycle/release-catalog.ts +1 -1
- package/src/lifecycle/release-ledger.ts +1 -2
- package/src/lifecycle/release-status.test.ts +3 -4
- package/src/lifecycle/release-status.ts +1 -2
- package/src/lifecycle/resource-lock-wait.test.ts +292 -0
- package/src/lifecycle/resource-lock.ts +261 -7
- package/src/lifecycle/wave-plans.ts +33 -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.test.ts +7 -5
- package/src/op/gate.ts +20 -4
- package/src/op/index.ts +2 -0
- package/src/op/op-waves-after-plan.test.ts +11 -0
- package/src/op/op-waves-capability-spec.ts +20 -0
- package/src/op/op-waves-ledger-lock.test.ts +208 -0
- package/src/op/op-waves-parallelism.test.ts +89 -0
- package/src/op/op-waves-pull-request.test.ts +78 -1
- package/src/op/op-waves-release-port.ts +1 -1
- package/src/op/op-waves-release.ts +2 -3
- package/src/op/op-waves-run.ts +196 -31
- package/src/op/op-waves-stand-down.ts +1 -2
- package/src/op/op-waves.ts +81 -6
- package/src/op/runtime.ts +6 -3
- package/src/otlp.ts +1 -2
- package/src/parallelism.test.ts +38 -0
- package/src/parallelism.ts +33 -0
- package/src/policy-source.ts +1 -2
- package/src/pr-forge-bundle.test.ts +1 -1
- package/src/pr-forge.ts +54 -35
- package/src/pr-loop-bundle.test.ts +0 -2
- package/src/pr-loop-narrowed.test.ts +63 -0
- package/src/pr-loop.ts +30 -4
- 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 +159 -5
- package/src/pr-report-url.ts +1 -2
- package/src/product-subpaths-plain-node.e2e.test.ts +1 -0
- package/src/release-floors.ts +1 -1
- package/src/run-event.ts +1 -2
- package/src/scheduled-op-cloud.ts +68 -0
- package/src/stage-hooks-bundle.test.ts +0 -2
- package/src/workspace/ci-lock-grain.ts +1 -2
- package/src/workspace/ci-run.ts +5 -1
- package/src/workspace/pr-report.schema.json +5 -0
package/dist/cli/handlers/pr.js
CHANGED
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
*/
|
|
66
66
|
import { spawnSync } from "node:child_process";
|
|
67
67
|
import { CHANT_EXIT } from "../../exit-codes.js";
|
|
68
|
-
import { anyResourceGrain, leaseRowsOf as leaseRowsOfLocks, lockTargetsOf } from "../../lifecycle/lock-rows.js";
|
|
68
|
+
import { anyResourceGrain, leaseRowsOf as leaseRowsOfLocks, lockTargetsOf, queueRowsOfLocks } from "../../lifecycle/lock-rows.js";
|
|
69
69
|
import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
70
70
|
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
71
71
|
import { loadChantConfig, resolveAutoReleaseDisabled } from "../../config.js";
|
|
@@ -86,7 +86,7 @@ import { describePlanChanged, PR_APPLY_GATE, prApproveCommand, prApproveCommands
|
|
|
86
86
|
import { FORGE_KINDS, forgeFromEnv, forgePrincipalOf } from "../../pr-forge.js";
|
|
87
87
|
import { GITHUB_COMMENT_LIMIT, GITLAB_NOTE_LIMIT } from "../../plan-summary.js";
|
|
88
88
|
import { upsertPlanNote } from "../../pr-post.js";
|
|
89
|
-
import { activeProductWords, productContext } from "../../ci-product-words.js";
|
|
89
|
+
import { activeProductWords, commandWord, parseProductComment, productContext } from "../../ci-product-words.js";
|
|
90
90
|
import { resolveCliBuildParams, parseParamFlags } from "../build-params-cli.js";
|
|
91
91
|
import { formatError, formatInfo, formatSuccess, formatWarning } from "../format.js";
|
|
92
92
|
import { reportUninstalledDependencies } from "../dependencies.js";
|
|
@@ -97,9 +97,10 @@ import { GATED_EXIT_CODE, autoReleaseRun, recordAutoReleasesForRun } from "./run
|
|
|
97
97
|
import { appliedDigestOf } from "../../components/auto-release.js";
|
|
98
98
|
import { parseArgs } from "../parse-args.js";
|
|
99
99
|
import { withComponentEndpoint } from "../component-endpoint.js";
|
|
100
|
-
import { assertTargetsAccepted, failedRunExitCode } from "../../components/driver.js";
|
|
101
|
-
import { TargetsRefusedError } from "../../components/capability.js";
|
|
100
|
+
import { assertPlanFlagsAccepted, assertTargetsAccepted, failedRunExitCode } from "../../components/driver.js";
|
|
101
|
+
import { PLAN_FLAG_ARGS, PlanFlagRefusedError, TargetsRefusedError } from "../../components/capability.js";
|
|
102
102
|
import { prPlanTargets } from "../../components/pr-targets.js";
|
|
103
|
+
import { PREVIEW_COMMENT_ENV } from "../../components/pr-pipeline.js";
|
|
103
104
|
import { prLoopHooksAt, runPrHooks } from "../../components/pr-hooks.js";
|
|
104
105
|
import { decidePrPolicyOverride, policyReviewOf, prLoopPolicyAt, prPolicyReport, runPrPolicy, spendPrPolicyOverride } from "../../components/pr-policy.js";
|
|
105
106
|
import { lexiconNames } from "../../lexicon-module.js";
|
|
@@ -133,6 +134,10 @@ export async function prepare(ctx, stage) {
|
|
|
133
134
|
if (stage !== "plan" && args.targets && args.targets.length > 0) {
|
|
134
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.");
|
|
135
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
|
+
}
|
|
136
141
|
let member;
|
|
137
142
|
if (args.members?.length) {
|
|
138
143
|
const checked = await checkMember(projectPath, args.members);
|
|
@@ -419,8 +424,66 @@ export async function planBare(p, onRunEvent) {
|
|
|
419
424
|
policyBase: p.base,
|
|
420
425
|
...(onRunEvent ? { onRunEvent } : {}),
|
|
421
426
|
...(p.targets ? { targets: p.targets } : {}),
|
|
427
|
+
...(p.parallelism !== undefined ? { parallelism: p.parallelism } : {}),
|
|
428
|
+
...(p.refresh ? { refresh: true } : {}),
|
|
429
|
+
...(p.targetDependents ? { targetDependents: true } : {}),
|
|
422
430
|
});
|
|
423
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
|
+
}
|
|
424
487
|
/**
|
|
425
488
|
* `pr-plan --target` (#4620): the addresses by member, set on `p`, or the
|
|
426
489
|
* exit code when a value is refused or a targeted member has a capability
|
|
@@ -475,22 +538,44 @@ async function leaseSetRows(p, set) {
|
|
|
475
538
|
*/
|
|
476
539
|
export async function leaseRowsOf(p, set, label = "this apply") {
|
|
477
540
|
const rows = leaseRowsOfLocks(set.locks);
|
|
478
|
-
|
|
541
|
+
// The ruling for ci-products (2026-10-28): the target and repo grains wait for their rows first, oldest commit first.
|
|
542
|
+
const queue = queueRowsOfLocks(set.locks);
|
|
543
|
+
if (rows.length === 0 && queue.length === 0)
|
|
479
544
|
return { release: () => Promise.resolve(true) };
|
|
480
|
-
const { leaseLockRows } = await import("../../lifecycle/resource-lock.js");
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
return
|
|
545
|
+
const { commitTimeOf, leaseLockRows, lockPollMs, lockWaitSeconds } = await import("../../lifecycle/resource-lock.js");
|
|
546
|
+
const held = [];
|
|
547
|
+
const releaseAll = async () => {
|
|
548
|
+
let ok = true;
|
|
549
|
+
for (const l of held.reverse())
|
|
550
|
+
ok = (await l.release()) && ok;
|
|
551
|
+
return ok;
|
|
552
|
+
};
|
|
553
|
+
for (const [wanted, wait] of [[queue, true], [rows, false]]) {
|
|
554
|
+
if (wanted.length === 0)
|
|
555
|
+
continue;
|
|
556
|
+
let leased;
|
|
557
|
+
try {
|
|
558
|
+
const commitAt = wait ? await commitTimeOf(process.env.GITHUB_SHA || process.env.CI_COMMIT_SHA || "HEAD") : undefined;
|
|
559
|
+
leased = await leaseLockRows(p.gate, wanted, wait
|
|
560
|
+
? { wait: { deadline: Date.now() + lockWaitSeconds(process.env) * 1000, pollMs: lockPollMs(process.env), log: (line) => console.error(formatInfo(`${label} ${line}`)), ...(commitAt ? { commitAt } : {}) } }
|
|
561
|
+
: {});
|
|
562
|
+
}
|
|
563
|
+
catch (err) {
|
|
564
|
+
await releaseAll();
|
|
565
|
+
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)}` };
|
|
566
|
+
}
|
|
567
|
+
if (!leased.ok) {
|
|
568
|
+
await releaseAll();
|
|
569
|
+
if (leased.timedOut)
|
|
570
|
+
return { held: `LockWaitTimeoutError: ${leased.message}, so nothing of ${label} was applied.` };
|
|
571
|
+
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.` };
|
|
572
|
+
}
|
|
573
|
+
for (const h of leased.tookOver)
|
|
574
|
+
console.error(formatInfo(`took over the rows of run ${h.run}, which is gone`));
|
|
575
|
+
console.error(formatInfo(`${label} holds ${leased.lease.keys.length} row${leased.lease.keys.length === 1 ? "" : "s"} of ${p.gate}${leased.waited ? ` after waiting ${leased.waitedSeconds ?? 0}s` : ""} while it applies`));
|
|
576
|
+
held.push(leased.lease);
|
|
487
577
|
}
|
|
488
|
-
|
|
489
|
-
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.` };
|
|
490
|
-
for (const h of leased.tookOver)
|
|
491
|
-
console.error(formatInfo(`took over the rows of run ${h.run}, which is gone`));
|
|
492
|
-
console.error(formatInfo(`${label} holds ${leased.lease.keys.length} row${leased.lease.keys.length === 1 ? "" : "s"} of ${p.gate} while it applies`));
|
|
493
|
-
return leased.lease;
|
|
578
|
+
return { release: releaseAll };
|
|
494
579
|
}
|
|
495
580
|
/** `applyPrSet`'s `leaseRound` (#4594): a round after the first leases the rows its own plan locks. */
|
|
496
581
|
export function leaseRoundRows(p) {
|
|
@@ -730,9 +815,18 @@ async function prPlan(ctx, stage) {
|
|
|
730
815
|
const p = await prepare(ctx, "plan");
|
|
731
816
|
if (typeof p === "number")
|
|
732
817
|
return p;
|
|
733
|
-
|
|
818
|
+
// #4626: the preview comment's --target addresses, read from the comment the job carries in a variable.
|
|
819
|
+
const fromComment = ctx.args.commentTargets ? commentTargets() : { targets: [] };
|
|
820
|
+
if (typeof fromComment === "number")
|
|
821
|
+
return fromComment;
|
|
822
|
+
const narrowed = narrowToTargets(p, [...(ctx.args.targets ?? []), ...fromComment.targets]);
|
|
734
823
|
if (narrowed !== undefined)
|
|
735
824
|
return narrowed;
|
|
825
|
+
const flagged = planWithFlags(p, { refresh: ctx.args.refresh === true || fromComment.refresh === true, targetDependents: ctx.args.targetDependents === true || fromComment.targetDependents === true });
|
|
826
|
+
if (flagged !== undefined)
|
|
827
|
+
return flagged;
|
|
828
|
+
if (ctx.args.parallelism !== undefined)
|
|
829
|
+
p.parallelism = ctx.args.parallelism;
|
|
736
830
|
const op = prOp(ctx.args.pr, p.member);
|
|
737
831
|
placeHooks(ctx, p, "plan", op);
|
|
738
832
|
const upload = openUpload(stage, "plan", ctx.args.pr, p);
|
|
@@ -879,6 +973,10 @@ export function runComponentsPrApply(ctx) {
|
|
|
879
973
|
let beforeMerge;
|
|
880
974
|
if (ctx.args.requires && !ctx.args.beforeMerge)
|
|
881
975
|
return fail("--requires names the checks of an apply before merge, so it needs --before-merge --pr <n>");
|
|
976
|
+
// #4636: the merge after the update, checked before anything applies.
|
|
977
|
+
const mergeProblem = await mergeArgsProblem(ctx.args);
|
|
978
|
+
if (mergeProblem)
|
|
979
|
+
return fail(mergeProblem);
|
|
882
980
|
if (ctx.args.beforeMerge) {
|
|
883
981
|
const checked = await beforeMergeChecks(ctx);
|
|
884
982
|
if (typeof checked === "number")
|
|
@@ -1193,13 +1291,87 @@ async function prApply(ctx, stage, beforeMerge) {
|
|
|
1193
1291
|
: applied.leaseFailed
|
|
1194
1292
|
? 1
|
|
1195
1293
|
: failedRunExitCode(applied.run.results);
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
const code = await stop(report, exit, applied.run.status === "gated" ? "gated" : undefined);
|
|
1294
|
+
const lost = green && applied.status === "applied" ? await recordGreenApplied(p, green, set.doc.digest, approval, via) : false;
|
|
1295
|
+
const code = await stop(report, lost && exit === 0 ? 1 : exit, applied.run.status === "gated" ? "gated" : undefined);
|
|
1199
1296
|
if (applied.status === "applied" && !afterFailed)
|
|
1200
1297
|
console.error(formatSuccess(`applied the plan ${report.digest} approved by ${(approval.approvedBy ?? []).join(", ")}`));
|
|
1298
|
+
// #4636: an update before merge that applied every member merges the pull request, never the other way round.
|
|
1299
|
+
if (code === 0 && beforeMerge && pr !== null && args.merge === "auto" && applied.status === "applied" && !afterFailed)
|
|
1300
|
+
return mergeAfterUpdate(ctx, p, pr);
|
|
1201
1301
|
return code;
|
|
1202
1302
|
}
|
|
1303
|
+
/** `--merge`, `--merge-token-env` and `--merge-method` as one problem, or undefined when they hold together. */
|
|
1304
|
+
async function mergeArgsProblem(args) {
|
|
1305
|
+
const { PR_APPLY_MERGES, PR_MERGE_METHODS } = await import("../../pr-merge.js");
|
|
1306
|
+
if (args.merge === undefined) {
|
|
1307
|
+
if (args.mergeTokenEnv || args.mergeMethod)
|
|
1308
|
+
return "--merge-token-env and --merge-method go with --merge auto";
|
|
1309
|
+
return undefined;
|
|
1310
|
+
}
|
|
1311
|
+
if (!PR_APPLY_MERGES.includes(args.merge))
|
|
1312
|
+
return `--merge takes ${PR_APPLY_MERGES.join(" or ")}, not ${args.merge}`;
|
|
1313
|
+
if (args.merge === "manual")
|
|
1314
|
+
return args.mergeTokenEnv || args.mergeMethod ? "--merge manual leaves the merge to a person, so it takes no --merge-token-env or --merge-method" : undefined;
|
|
1315
|
+
if (!args.beforeMerge)
|
|
1316
|
+
return "--merge auto merges a pull request once its update before merge applied, so it needs --before-merge --pr <n>";
|
|
1317
|
+
if (!args.mergeTokenEnv)
|
|
1318
|
+
return "--merge auto merges with a token of its own, never the job's: --merge-token-env <VAR> (on GitLab a protected variable)";
|
|
1319
|
+
if (args.mergeMethod && !PR_MERGE_METHODS.includes(args.mergeMethod))
|
|
1320
|
+
return `--merge-method takes ${PR_MERGE_METHODS.join(", ")}, not ${args.mergeMethod}`;
|
|
1321
|
+
return undefined;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* The merge after an update before merge applied (#4636): the apply's
|
|
1325
|
+
* records pushed to the ledger, the head checked again, then the forge's
|
|
1326
|
+
* merge with the token `--merge-token-env` names alone. A refusal is posted
|
|
1327
|
+
* on the pull request and exits as waiting (3); the update stays applied.
|
|
1328
|
+
*/
|
|
1329
|
+
async function mergeAfterUpdate(ctx, p, pr) {
|
|
1330
|
+
const { mergeAfterApply, mergeTokenEnv } = await import("../../pr-merge.js");
|
|
1331
|
+
const { pushLifecycleRebasing, LifecyclePushLostError } = await import("../../lifecycle/git.js");
|
|
1332
|
+
const kind = p.forge?.kind ?? ctx.args.forge;
|
|
1333
|
+
if (!kind)
|
|
1334
|
+
return fail("--merge auto needs --forge <kind> to merge on");
|
|
1335
|
+
const env = mergeTokenEnv(ctx.args.mergeTokenEnv);
|
|
1336
|
+
if ("error" in env) {
|
|
1337
|
+
console.error(formatWarning({ message: `the pull request was not merged: ${env.error}` }));
|
|
1338
|
+
return CHANT_EXIT.waiting;
|
|
1339
|
+
}
|
|
1340
|
+
let forge;
|
|
1341
|
+
try {
|
|
1342
|
+
forge = forgeFromEnv(kind, env);
|
|
1343
|
+
}
|
|
1344
|
+
catch (err) {
|
|
1345
|
+
console.error(formatWarning({ message: `the pull request was not merged: ${err instanceof Error ? err.message : String(err)}` }));
|
|
1346
|
+
return CHANT_EXIT.waiting;
|
|
1347
|
+
}
|
|
1348
|
+
// A refused push fetches, replays the apply's records on the remote's tip and pushes again (#4551).
|
|
1349
|
+
let pushed;
|
|
1350
|
+
let lost = false;
|
|
1351
|
+
try {
|
|
1352
|
+
pushed = await pushLifecycleRebasing();
|
|
1353
|
+
}
|
|
1354
|
+
catch (err) {
|
|
1355
|
+
if (!(err instanceof LifecyclePushLostError))
|
|
1356
|
+
throw err;
|
|
1357
|
+
console.error(formatError({ message: err.message }));
|
|
1358
|
+
pushed = { pushed: false, pushWarning: err.message };
|
|
1359
|
+
lost = true;
|
|
1360
|
+
}
|
|
1361
|
+
const merged = await mergeAfterApply({
|
|
1362
|
+
forge,
|
|
1363
|
+
pr,
|
|
1364
|
+
head: p.head,
|
|
1365
|
+
...(ctx.args.mergeMethod ? { method: ctx.args.mergeMethod } : {}),
|
|
1366
|
+
recorded: { pushed: pushed.pushed, ...(pushed.pushWarning ? { warning: pushed.pushWarning } : {}) },
|
|
1367
|
+
});
|
|
1368
|
+
if (merged.merged) {
|
|
1369
|
+
console.error(formatSuccess(`merged ${kind === "gitlab" ? `!${pr}` : `#${pr}`} at ${p.head.slice(0, 12)}${merged.sha ? ` as ${merged.sha.slice(0, 12)}` : ""}`));
|
|
1370
|
+
return 0;
|
|
1371
|
+
}
|
|
1372
|
+
console.error(formatWarning({ message: `the pull request was not merged: ${merged.reason}${merged.posted ? "; the reason is posted on it" : ""}` }));
|
|
1373
|
+
return lost ? 1 : CHANT_EXIT.waiting;
|
|
1374
|
+
}
|
|
1203
1375
|
/**
|
|
1204
1376
|
* Under `ci.locks` (#4293): the refusal when another open pull request holds
|
|
1205
1377
|
* a lock on a component this apply reaches, else null. The targets are the
|
|
@@ -1405,7 +1577,10 @@ async function prRecord(ctx, stage) {
|
|
|
1405
1577
|
: {}),
|
|
1406
1578
|
});
|
|
1407
1579
|
const { mergeSourceOf, writeMergeRecord, MERGE_RECORD_SCHEMA_ID, MERGE_RECORD_CONTRACT } = await import("../../lifecycle/merge-record.js");
|
|
1408
|
-
const {
|
|
1580
|
+
const { pushLifecycleRebasing, LifecyclePushLostError } = await import("../../lifecycle/git.js");
|
|
1581
|
+
// Set when the merge record never reached the remote: the job fails rather than warns, since a record kept only
|
|
1582
|
+
// in this job's checkout is lost with it (#4551).
|
|
1583
|
+
let lost = false;
|
|
1409
1584
|
// #4292: a member another branch applies has no merge on this one, so no record says it planned nothing here.
|
|
1410
1585
|
if (!p.routedAway) {
|
|
1411
1586
|
try {
|
|
@@ -1428,17 +1603,23 @@ async function prRecord(ctx, stage) {
|
|
|
1428
1603
|
recordedAt: new Date().toISOString(),
|
|
1429
1604
|
});
|
|
1430
1605
|
if (written.written) {
|
|
1431
|
-
const pushed = await
|
|
1606
|
+
const pushed = await pushLifecycleRebasing();
|
|
1432
1607
|
if (pushed.pushWarning)
|
|
1433
1608
|
console.error(formatWarning({ message: pushed.pushWarning }));
|
|
1434
1609
|
}
|
|
1435
1610
|
}
|
|
1436
1611
|
catch (err) {
|
|
1437
|
-
|
|
1612
|
+
if (err instanceof LifecyclePushLostError) {
|
|
1613
|
+
console.error(formatError({ message: `the merge record for ${p.head} was written but not pushed: ${err.message}` }));
|
|
1614
|
+
lost = true;
|
|
1615
|
+
}
|
|
1616
|
+
else {
|
|
1617
|
+
console.error(formatWarning({ message: `could not write the merge record for ${p.head}: ${err instanceof Error ? err.message : String(err)}` }));
|
|
1618
|
+
}
|
|
1438
1619
|
}
|
|
1439
1620
|
}
|
|
1440
1621
|
const stop = stopper(ctx, p, events, upload);
|
|
1441
|
-
return stop(report, status === "plan-failed" ? 1 : 0);
|
|
1622
|
+
return stop(report, status === "plan-failed" || lost ? 1 : 0);
|
|
1442
1623
|
}
|
|
1443
1624
|
/** What a gate's description and messages call the change: the pull request, or the green commit (#4168 step 9). */
|
|
1444
1625
|
function changeLabel(pr, green) {
|
|
@@ -1529,10 +1710,15 @@ function reviewFor(args, p, pr, green) {
|
|
|
1529
1710
|
return undefined;
|
|
1530
1711
|
};
|
|
1531
1712
|
}
|
|
1532
|
-
/**
|
|
1713
|
+
/**
|
|
1714
|
+
* Record the green commit as applied to the environment (#4168 step 9), and
|
|
1715
|
+
* push `chant/lifecycle`, fetching and replaying on a refused push. A record
|
|
1716
|
+
* that never reaches the remote is an error and returns true, so the stage
|
|
1717
|
+
* fails; any other failure warns.
|
|
1718
|
+
*/
|
|
1533
1719
|
async function recordGreenApplied(p, green, digest, approval, via) {
|
|
1534
1720
|
const { writeGreenApply, GREEN_APPLY_CONTRACT } = await import("../../lifecycle/green-apply.js");
|
|
1535
|
-
const {
|
|
1721
|
+
const { pushLifecycleRebasing, LifecyclePushLostError } = await import("../../lifecycle/git.js");
|
|
1536
1722
|
try {
|
|
1537
1723
|
await writeGreenApply({
|
|
1538
1724
|
contract: GREEN_APPLY_CONTRACT,
|
|
@@ -1546,19 +1732,27 @@ async function recordGreenApplied(p, green, digest, approval, via) {
|
|
|
1546
1732
|
merges: green.merges,
|
|
1547
1733
|
appliedAt: new Date().toISOString(),
|
|
1548
1734
|
});
|
|
1549
|
-
const pushed = await
|
|
1735
|
+
const pushed = await pushLifecycleRebasing();
|
|
1550
1736
|
if (pushed.pushWarning)
|
|
1551
1737
|
console.error(formatWarning({ message: pushed.pushWarning }));
|
|
1552
1738
|
}
|
|
1553
1739
|
catch (err) {
|
|
1740
|
+
if (err instanceof LifecyclePushLostError) {
|
|
1741
|
+
console.error(formatError({ message: `the record of ${green.commit.slice(0, 12)} as applied to ${p.env} was written but not pushed: ${err.message}` }));
|
|
1742
|
+
return true;
|
|
1743
|
+
}
|
|
1554
1744
|
console.error(formatWarning({ message: `could not record ${green.commit.slice(0, 12)} as applied to ${p.env}: ${err instanceof Error ? err.message : String(err)}` }));
|
|
1555
1745
|
}
|
|
1746
|
+
return false;
|
|
1556
1747
|
}
|
|
1557
1748
|
/** How a stage stops: settle its events, write and publish the report, say how it ended, and return `code`. */
|
|
1558
1749
|
function stopper(ctx, p, events, upload) {
|
|
1559
1750
|
return async (report, code, settle) => {
|
|
1560
1751
|
events?.settle(settle ?? settleOf(report.status), report.status === "plan-failed" || report.status === "failed" ? report.message ?? `pr-${report.stage} ${report.status}` : undefined);
|
|
1561
1752
|
await finish(ctx, p, report, upload);
|
|
1753
|
+
// #4629: a failed apply's triage and a refused apply's diff, on the pull request.
|
|
1754
|
+
if (report.stage === "apply" && (report.status === "failed" || report.status === "refused") && !ctx.args.noStatus)
|
|
1755
|
+
await respondApply(ctx, p, report);
|
|
1562
1756
|
console.error((code === 0 ? formatInfo : (m) => formatWarning({ message: m }))(`pr-${report.stage}: ${report.status}${report.refusal ? ` (${report.refusal})` : ""}`));
|
|
1563
1757
|
if (report.message)
|
|
1564
1758
|
console.error(report.message);
|
|
@@ -1566,6 +1760,22 @@ function stopper(ctx, p, events, upload) {
|
|
|
1566
1760
|
return code;
|
|
1567
1761
|
};
|
|
1568
1762
|
}
|
|
1763
|
+
/** The responses an apply's report calls for (#4629), from `--respond` over `CHANT_RESPOND`. Never throws. */
|
|
1764
|
+
async function respondApply(ctx, p, report) {
|
|
1765
|
+
try {
|
|
1766
|
+
const { parseRespondList } = await import("../../ci-respond.js");
|
|
1767
|
+
const given = ctx.args.respond ? parseRespondList(ctx.args.respond) : {};
|
|
1768
|
+
if ("error" in given) {
|
|
1769
|
+
console.error(formatWarning({ message: `no response was posted: ${given.error}` }));
|
|
1770
|
+
return;
|
|
1771
|
+
}
|
|
1772
|
+
const { respondPrApply } = await import("../../ci-respond-run.js");
|
|
1773
|
+
await respondPrApply(p.forge, report, given);
|
|
1774
|
+
}
|
|
1775
|
+
catch (err) {
|
|
1776
|
+
console.error(formatWarning({ message: `the apply's responses were not posted: ${err instanceof Error ? err.message : String(err)}` }));
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1569
1779
|
/**
|
|
1570
1780
|
* The `--require-review` check (#3183, #4000) of an approval's approvers,
|
|
1571
1781
|
* `what` naming the plan they approved. The pull request's reviews and
|
|
@@ -1680,12 +1890,14 @@ function emitReviewStop(events, message) {
|
|
|
1680
1890
|
}
|
|
1681
1891
|
/**
|
|
1682
1892
|
* Store `doc` under its digest with its entries mapped onto the member's
|
|
1683
|
-
* graph (`storeGateChangeSet`), and push
|
|
1684
|
-
* decides the same either
|
|
1893
|
+
* graph (`storeGateChangeSet`), and push, fetching and replaying on a refused
|
|
1894
|
+
* push. A failure to store is a warning: the gate decides the same either
|
|
1895
|
+
* way. A change set that never reaches the remote throws
|
|
1896
|
+
* `LifecyclePushLostError`, which stops the stage.
|
|
1685
1897
|
*/
|
|
1686
1898
|
async function storeChangeSetForGate(ctx, p, doc) {
|
|
1687
1899
|
const { storeGateChangeSet, gateGraphReader } = await import("../../lifecycle/gate-change-set.js");
|
|
1688
|
-
const {
|
|
1900
|
+
const { pushLifecycleRebasing, LifecyclePushLostError } = await import("../../lifecycle/git.js");
|
|
1689
1901
|
const graphArgs = [
|
|
1690
1902
|
...(ctx.args.param ?? []).flatMap((kv) => ["--param", kv]),
|
|
1691
1903
|
...(ctx.args.paramsFile ? ["--params-file", ctx.args.paramsFile] : []),
|
|
@@ -1697,9 +1909,11 @@ async function storeChangeSetForGate(ctx, p, doc) {
|
|
|
1697
1909
|
// The push's own outcome is said by the gate's pending fact, or by the
|
|
1698
1910
|
// release records the apply writes, which push the same branch.
|
|
1699
1911
|
if (stored.written)
|
|
1700
|
-
await
|
|
1912
|
+
await pushLifecycleRebasing();
|
|
1701
1913
|
}
|
|
1702
1914
|
catch (err) {
|
|
1915
|
+
if (err instanceof LifecyclePushLostError)
|
|
1916
|
+
throw err;
|
|
1703
1917
|
console.error(formatWarning({ message: `could not store the change set ${doc.digest}: ${err instanceof Error ? err.message : String(err)}` }));
|
|
1704
1918
|
}
|
|
1705
1919
|
}
|
|
@@ -2115,9 +2329,8 @@ async function prApplyWaves(ctx, p, at) {
|
|
|
2115
2329
|
return stop(report({ status: "failed", ...(message ? { message } : {}) }), lastFailure ? lastFailure.exitCode : 1);
|
|
2116
2330
|
}
|
|
2117
2331
|
const done = p.plan.order.every((name) => completed.has(name));
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
return stop(report({ status: done ? "applied" : "wave-applied" }), 0);
|
|
2332
|
+
const lost = green && done ? await recordGreenApplied(p, green, approvedSet.doc.digest, approval, via) : false;
|
|
2333
|
+
return stop(report({ status: done ? "applied" : "wave-applied" }), lost ? 1 : 0);
|
|
2121
2334
|
}
|
|
2122
2335
|
// ── The component plan-wave and apply-wave steps (#4588) ─────────────────────
|
|
2123
2336
|
/** The outputs earlier waves' components left, from `--wave-outputs`; empty when the file is not there yet. */
|
|
@@ -2470,6 +2683,8 @@ function writeWaveChangeSet(ctx, wave, doc, upload) {
|
|
|
2470
2683
|
*/
|
|
2471
2684
|
export async function runComponentsPrPost(ctx) {
|
|
2472
2685
|
const { args } = ctx;
|
|
2686
|
+
if (args.stale)
|
|
2687
|
+
return runComponentsPrPostStale(ctx);
|
|
2473
2688
|
if (args.open)
|
|
2474
2689
|
return runComponentsPrPostOpen(ctx);
|
|
2475
2690
|
if (args.pr === undefined)
|
|
@@ -2491,6 +2706,9 @@ export async function runComponentsPrPost(ctx) {
|
|
|
2491
2706
|
}
|
|
2492
2707
|
const { postPlanReport } = await import("../../pr-post.js");
|
|
2493
2708
|
const member = args.members?.[0];
|
|
2709
|
+
const description = await descriptionCheckOf(ctx, forge);
|
|
2710
|
+
if (typeof description === "number")
|
|
2711
|
+
return description;
|
|
2494
2712
|
const posted = await postPlanReport({
|
|
2495
2713
|
forge,
|
|
2496
2714
|
dir: resolve(args.output ?? PR_REPORT_DIR),
|
|
@@ -2501,6 +2719,10 @@ export async function runComponentsPrPost(ctx) {
|
|
|
2501
2719
|
...(args.planResult ? { result: args.planResult } : {}),
|
|
2502
2720
|
// #4289: the plan job could not ask the forge, so the note job does, from the Ops at the commit it checked out.
|
|
2503
2721
|
overdue: () => overdueOps(forge, member),
|
|
2722
|
+
...(description ? { description } : {}),
|
|
2723
|
+
// #4628: the target branch's commit for the note's tip line, and the job summary where the forge keeps one.
|
|
2724
|
+
...(args.tip ? { baseTip: args.tip } : {}),
|
|
2725
|
+
...(args.forge !== "gitlab" && process.env.GITHUB_STEP_SUMMARY ? { summaryFile: process.env.GITHUB_STEP_SUMMARY } : {}),
|
|
2504
2726
|
});
|
|
2505
2727
|
for (const message of posted.warnings)
|
|
2506
2728
|
console.error(formatWarning({ message }));
|
|
@@ -2509,6 +2731,88 @@ export async function runComponentsPrPost(ctx) {
|
|
|
2509
2731
|
console.error(formatInfo(`pr-post: ${prStatusContext("plan", member)} ${posted.state}: ${posted.description}${posted.noted ? "; note posted" : ""}`));
|
|
2510
2732
|
return 0;
|
|
2511
2733
|
}
|
|
2734
|
+
/**
|
|
2735
|
+
* The description check pr-post runs after the note (#4629), when the
|
|
2736
|
+
* responses turn it on (`--respond description=check`, or `CHANT_RESPOND`):
|
|
2737
|
+
* the `decide.backends` entry `--decide-backend` names, from chant.config
|
|
2738
|
+
* at the commit this job checked out (the target branch's, never the pull
|
|
2739
|
+
* request's), and the model `--decide-model` pins. On with no backend is
|
|
2740
|
+
* refused, so a pipeline that asks for the check learns it never ran.
|
|
2741
|
+
*/
|
|
2742
|
+
async function descriptionCheckOf(ctx, forge) {
|
|
2743
|
+
const { parseRespondList, resolveResponses } = await import("../../ci-respond.js");
|
|
2744
|
+
const given = ctx.args.respond ? parseRespondList(ctx.args.respond) : {};
|
|
2745
|
+
if ("error" in given)
|
|
2746
|
+
return fail(given.error);
|
|
2747
|
+
if (resolveResponses(given, process.env, (m) => console.error(formatWarning({ message: m }))).description !== "check")
|
|
2748
|
+
return undefined;
|
|
2749
|
+
const name = ctx.args.decideBackend;
|
|
2750
|
+
if (!name || !ctx.args.decideModel)
|
|
2751
|
+
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");
|
|
2752
|
+
const { loadChantConfig } = await import("../../config.js");
|
|
2753
|
+
let backend;
|
|
2754
|
+
try {
|
|
2755
|
+
const loaded = await loadChantConfig(process.cwd());
|
|
2756
|
+
backend = loaded.config.decide?.backends?.[name];
|
|
2757
|
+
}
|
|
2758
|
+
catch (err) {
|
|
2759
|
+
return fail(`could not read decide.backends from chant.config: ${err instanceof Error ? err.message : String(err)}`);
|
|
2760
|
+
}
|
|
2761
|
+
if (!backend)
|
|
2762
|
+
return fail(`the description check names the backend ${name}, and chant.config has no decide.backends.${name}`);
|
|
2763
|
+
const { backendDescriptionAsk, respondDescription } = await import("../../ci-respond-run.js");
|
|
2764
|
+
const ask = backendDescriptionAsk(backend, { name, model: ctx.args.decideModel, cwd: process.cwd() });
|
|
2765
|
+
return async (report) => {
|
|
2766
|
+
await respondDescription(forge, report, { ask });
|
|
2767
|
+
};
|
|
2768
|
+
}
|
|
2769
|
+
/**
|
|
2770
|
+
* `pr-post --stale --tip <sha> --env <env> --forge <kind> [--branch <branch>]
|
|
2771
|
+
* [--member <name>] [--preview-comment]` (#4628): after a push to the target
|
|
2772
|
+
* branch, mark each open pull request's note that was posted against
|
|
2773
|
+
* another commit stale, naming the comment that previews again with
|
|
2774
|
+
* `--preview-comment`, and set its plan status back to pending
|
|
2775
|
+
* (`markStaleNotes`, ../../pr-post.ts). The branch is `--branch`, else the
|
|
2776
|
+
* job's (`GITHUB_REF_NAME`, `CI_COMMIT_BRANCH`). It exits 0 once it has
|
|
2777
|
+
* marked, as `pr-post` does.
|
|
2778
|
+
*/
|
|
2779
|
+
async function runComponentsPrPostStale(ctx) {
|
|
2780
|
+
const { args } = ctx;
|
|
2781
|
+
if (args.pr !== undefined || args.head)
|
|
2782
|
+
return fail("pr-post --stale finds each open pull request and its head itself, so it takes no --pr or --head");
|
|
2783
|
+
if (!args.tip)
|
|
2784
|
+
return fail("pr-post --stale needs the target branch's commit now: --tip <sha>");
|
|
2785
|
+
if (!args.env)
|
|
2786
|
+
return fail("pr-post needs the environment the plan was for: --env <env>");
|
|
2787
|
+
if (!args.forge || !FORGE_KINDS.includes(args.forge))
|
|
2788
|
+
return fail(`pr-post posts to a forge: --forge ${FORGE_KINDS.join("|")}`);
|
|
2789
|
+
if (args.members && args.members.length > 1)
|
|
2790
|
+
return fail(`pr-post takes one --member, not ${args.members.join(", ")}`);
|
|
2791
|
+
const branch = args.branch ?? process.env.CI_COMMIT_BRANCH ?? process.env.GITHUB_REF_NAME;
|
|
2792
|
+
if (!branch)
|
|
2793
|
+
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>");
|
|
2794
|
+
let forge;
|
|
2795
|
+
try {
|
|
2796
|
+
forge = forgeFromEnv(args.forge);
|
|
2797
|
+
}
|
|
2798
|
+
catch (err) {
|
|
2799
|
+
return fail(err instanceof Error ? err.message : String(err));
|
|
2800
|
+
}
|
|
2801
|
+
const member = args.members?.[0];
|
|
2802
|
+
const { markStaleNotes } = await import("../../pr-post.js");
|
|
2803
|
+
let done;
|
|
2804
|
+
try {
|
|
2805
|
+
done = await markStaleNotes({ forge, branch, tip: args.tip, env: args.env, ...(member ? { member } : {}), ...(args.previewComment ? { previewComment: true } : {}) });
|
|
2806
|
+
}
|
|
2807
|
+
catch (err) {
|
|
2808
|
+
return fail(err instanceof Error ? err.message : String(err));
|
|
2809
|
+
}
|
|
2810
|
+
for (const message of done.warnings)
|
|
2811
|
+
console.error(formatWarning({ message }));
|
|
2812
|
+
const marked = done.marks.filter((m) => m.marked).map((m) => `#${m.pr}`);
|
|
2813
|
+
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)}`));
|
|
2814
|
+
return 0;
|
|
2815
|
+
}
|
|
2512
2816
|
/**
|
|
2513
2817
|
* `pr-post --open` (#4328): in a pipeline of the target branch on GitLab,
|
|
2514
2818
|
* post the plan note and status of every open merge request into it whose
|
|
@@ -2543,6 +2847,9 @@ async function runComponentsPrPostOpen(ctx) {
|
|
|
2543
2847
|
if (top.status !== 0)
|
|
2544
2848
|
return fail("pr-post --open reads the plan report's path from the repository root, and this directory is not in a git repository");
|
|
2545
2849
|
const member = args.members?.[0];
|
|
2850
|
+
const description = await descriptionCheckOf(ctx, forge);
|
|
2851
|
+
if (typeof description === "number")
|
|
2852
|
+
return description;
|
|
2546
2853
|
const artifactDir = relative(realpathSync(top.stdout.trim()), resolve(args.output ?? PR_REPORT_DIR)).split(sep).join("/");
|
|
2547
2854
|
const { postOpenPlanReports } = await import("../../pr-post.js");
|
|
2548
2855
|
const { gitlabPlanJobName } = await import("../../components/pr-pipeline.js");
|
|
@@ -2557,6 +2864,9 @@ async function runComponentsPrPostOpen(ctx) {
|
|
|
2557
2864
|
...(member ? { member } : {}),
|
|
2558
2865
|
// #4289: the Ops at the commit this pipeline checked out, the target branch's.
|
|
2559
2866
|
overdue: () => overdueOps(forge, member),
|
|
2867
|
+
...(description ? { description } : {}),
|
|
2868
|
+
// #4628: the target branch's commit this pipeline runs at, which each note's tip line names.
|
|
2869
|
+
...(args.tip ? { baseTip: args.tip } : {}),
|
|
2560
2870
|
});
|
|
2561
2871
|
}
|
|
2562
2872
|
catch (err) {
|