@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
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs a wave applies at once (#4625): `parallelism` on the spec or a wave,
|
|
3
|
+
* with a capability step, at most that many applies in flight, a run
|
|
4
|
+
* waiting for an earlier run it depends on and blocked when that failed.
|
|
5
|
+
* Written for the ci-products post-merge pass.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { describe, expect, test } from "vitest";
|
|
9
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import { tmpdir } from "node:os";
|
|
12
|
+
import { assertOpWavesSpec, type OpWavesSpec } from "./op-waves";
|
|
13
|
+
import { runOpWave, type OpWaveShowAtBase } from "./op-waves-run";
|
|
14
|
+
import { memoryGateLedgerPort } from "./gate";
|
|
15
|
+
import { CapabilityRegistry, type Capability } from "../components/capability";
|
|
16
|
+
|
|
17
|
+
const digest = (n: string) => `sha256:${n.repeat(64)}`;
|
|
18
|
+
|
|
19
|
+
function capability(opts: { fail?: string[]; delayMs?: number } = {}) {
|
|
20
|
+
const seen = { running: 0, most: 0, order: [] as string[] };
|
|
21
|
+
const cap: Capability<Record<string, unknown>, unknown> = {
|
|
22
|
+
kind: "fake-apply",
|
|
23
|
+
async plan(_ctx, input) {
|
|
24
|
+
const root = String(input.root);
|
|
25
|
+
return { member: root, planDigest: digest("1"), artifact: {}, changeSet: { member: { member: root, lexicon: "terraform", planner: "chant", status: "planned", planDigest: digest("1"), holes: [] }, entries: [] } };
|
|
26
|
+
},
|
|
27
|
+
async run(_ctx, input) {
|
|
28
|
+
const root = String(input.root);
|
|
29
|
+
seen.running++;
|
|
30
|
+
seen.most = Math.max(seen.most, seen.running);
|
|
31
|
+
await new Promise((r) => setTimeout(r, opts.delayMs ?? 5));
|
|
32
|
+
seen.running--;
|
|
33
|
+
seen.order.push(root);
|
|
34
|
+
if (opts.fail?.includes(root)) throw new Error(`${root} broke`);
|
|
35
|
+
return { applied: root };
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
return { registry: new CapabilityRegistry().register(cap), seen };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const spec = (parallelism: number, runs: OpWavesSpec["waves"][number]["runs"]): OpWavesSpec => ({
|
|
42
|
+
name: "roots",
|
|
43
|
+
op: "tf-apply",
|
|
44
|
+
parallelism,
|
|
45
|
+
step: { kind: "fake-apply", root: "{target}" },
|
|
46
|
+
waves: [{ name: "dev", runs, gate: "never" }],
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
async function run(s: OpWavesSpec, registry: CapabilityRegistry) {
|
|
50
|
+
const cwd = mkdtempSync(join(tmpdir(), "op-waves-par-"));
|
|
51
|
+
const show: OpWaveShowAtBase = () => ({ sha: "b".repeat(40), text: JSON.stringify(s) });
|
|
52
|
+
try {
|
|
53
|
+
return await runOpWave({ spec: s, specFile: "waves.json", wave: 1, cwd, show, gates: memoryGateLedgerPort(), capabilities: registry });
|
|
54
|
+
} finally {
|
|
55
|
+
rmSync(cwd, { recursive: true, force: true });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
describe("runs applied at once (#4625)", () => {
|
|
60
|
+
test("at most parallelism applies in flight, and the result keeps the wave's order", async () => {
|
|
61
|
+
const { registry, seen } = capability();
|
|
62
|
+
const result = await run(spec(2, [{ target: "a" }, { target: "b" }, { target: "c" }, { target: "d" }]), registry);
|
|
63
|
+
expect(result).toMatchObject({ exitCode: 0, applied: ["a", "b", "c", "d"] });
|
|
64
|
+
expect(seen.most).toBe(2);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test("a run waits for an earlier run it depends on, and is blocked when that one failed", async () => {
|
|
68
|
+
const { registry, seen } = capability({ fail: ["a"] });
|
|
69
|
+
const result = await run(spec(3, [{ target: "a" }, { target: "b", dependsOn: ["a"] }, { target: "c" }, { target: "d", dependsOn: ["b"] }]), registry);
|
|
70
|
+
expect(result.exitCode).toBe(1);
|
|
71
|
+
expect(result.failed).toEqual(["a"]);
|
|
72
|
+
expect(result.applied).toEqual(["c"]);
|
|
73
|
+
expect(result.blocked).toEqual({ b: "a", d: "a" });
|
|
74
|
+
expect(seen.order).not.toContain("b");
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test("one at a time when the spec says nothing", async () => {
|
|
78
|
+
const { registry, seen } = capability();
|
|
79
|
+
const { parallelism: _p, ...plain } = spec(1, [{ target: "a" }, { target: "b" }]);
|
|
80
|
+
await run(plain, registry);
|
|
81
|
+
expect(seen.most).toBe(1);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test("the spec refuses a parallelism over 1 without a step, and one that is not a whole number", () => {
|
|
85
|
+
const { step: _s, ...noStep } = spec(2, [{ target: "a" }]);
|
|
86
|
+
expect(() => assertOpWavesSpec({ ...noStep, apply: ["./apply", "{target}"], plan: ["./plan", "{target}", "{plan}"] })).toThrow(/apply at once only through `step`/);
|
|
87
|
+
expect(() => assertOpWavesSpec(spec(0, [{ target: "a" }]))).toThrow(/whole number of 1 or more/);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -3,7 +3,9 @@ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
import { assertOpWavesSpec, type OpWavesSpec } from "./op-waves";
|
|
6
|
-
import { runOpWave, type OpWaveExec, type OpWaveShowAtBase } from "./op-waves-run";
|
|
6
|
+
import { recordOpWaveHeadPlans, runOpWave, type OpWaveExec, type OpWaveShowAtBase } from "./op-waves-run";
|
|
7
|
+
import { approvalStatusOf } from "./approval-status";
|
|
8
|
+
import type { HeadPlans } from "../lifecycle/wave-plans";
|
|
7
9
|
import { memoryGateLedgerPort, type GateLedgerPort } from "./gate";
|
|
8
10
|
import { composeChangeSet, type ChangeSetDocument, type ChangeSetMember } from "../change-set";
|
|
9
11
|
import type { GateResolutionRecord } from "../lifecycle/gate-ledger";
|
|
@@ -140,3 +142,78 @@ describe("planWave and applyWave run by the caller (#4588)", () => {
|
|
|
140
142
|
}
|
|
141
143
|
});
|
|
142
144
|
});
|
|
145
|
+
|
|
146
|
+
describe("the approval status of a pull-request wave before merge (#4630, 2026-10-28 ruling)", () => {
|
|
147
|
+
const HEAD = "c".repeat(40);
|
|
148
|
+
const forge = { kind: "github" as const, async prApproved() { throw new Error("a pull-request wave reads no review"); } };
|
|
149
|
+
|
|
150
|
+
async function recorded(waveDoc: ChangeSetDocument): Promise<{ plans: HeadPlans; stored: ChangeSetDocument[] }> {
|
|
151
|
+
const h = harness(waveDoc);
|
|
152
|
+
const stored: ChangeSetDocument[] = [];
|
|
153
|
+
try {
|
|
154
|
+
const plans = await recordOpWaveHeadPlans({ spec, cwd: h.cwd, exec: h.exec, head: HEAD, now: "t", write: async () => {}, storeChangeSet: async (d) => void stored.push(d) });
|
|
155
|
+
return { plans, stored };
|
|
156
|
+
} finally {
|
|
157
|
+
h.done();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const statusOf = (plans: HeadPlans, stored: ChangeSetDocument[], resolutions: Record<string, GateResolutionRecord[]>) =>
|
|
162
|
+
approvalStatusOf({
|
|
163
|
+
spec,
|
|
164
|
+
specFile: ".chant/op-waves/pulumi-up.spec.json",
|
|
165
|
+
forge,
|
|
166
|
+
pr: 7,
|
|
167
|
+
head: HEAD,
|
|
168
|
+
base: "b".repeat(40),
|
|
169
|
+
show: () => ({ sha: "b".repeat(40), text: JSON.stringify(spec) }),
|
|
170
|
+
readPlans: async () => plans,
|
|
171
|
+
readResolutions: async (op) => resolutions[op] ?? [],
|
|
172
|
+
changeSets: async (d) => stored.find((x) => x.digest === d),
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test("--record-plans keeps the wave's change set and stores it", async () => {
|
|
176
|
+
const waveDoc = doc(digest("a"));
|
|
177
|
+
const { plans, stored } = await recorded(waveDoc);
|
|
178
|
+
expect(plans.waves[0]).toMatchObject({ wave: 1, changeSet: waveDoc.digest });
|
|
179
|
+
expect(stored.map((d) => d.digest)).toEqual([waveDoc.digest]);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
test("pending with no approval at the pull request's gate, success once the pull request's approval covers the wave", async () => {
|
|
183
|
+
const approved = doc(digest("a"));
|
|
184
|
+
const { plans, stored } = await recorded(approved);
|
|
185
|
+
expect(await statusOf(plans, stored, {})).toMatchObject({ state: "pending", waits: [1], description: expect.stringContaining("gate up has no approval") });
|
|
186
|
+
// The product's approve line records on the pull request's op.
|
|
187
|
+
const onPr = { ...approval(approved), op: "pr-7" } as GateResolutionRecord;
|
|
188
|
+
expect(await statusOf(plans, stored, { "pr-7": [onPr] })).toMatchObject({ state: "success", waits: [1], approvers: ["github:alice"] });
|
|
189
|
+
// The spec's op, which the merged wave reads, counts as well.
|
|
190
|
+
expect(await statusOf(plans, stored, { "pulumi-up": [approval(approved)] })).toMatchObject({ state: "success" });
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
test("an approval of another plan does not cover the head's, and a record with no change set is pending", async () => {
|
|
194
|
+
const other = doc(digest("d"));
|
|
195
|
+
const { plans, stored } = await recorded(movedDoc(digest("c")));
|
|
196
|
+
const status = await statusOf(plans, [...stored, other], { "pr-7": [approval(other)] });
|
|
197
|
+
expect(status.state).toBe("pending");
|
|
198
|
+
const bare: HeadPlans = { ...plans, waves: plans.waves.map(({ changeSet: _c, ...w }) => w) };
|
|
199
|
+
expect(await statusOf(bare, stored, {})).toMatchObject({ state: "pending", description: expect.stringContaining("carry no change set") });
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
test("a wave whose gate does not hold the head's plan is success without an approval", async () => {
|
|
203
|
+
const never = { ...spec, waves: spec.waves.map((w) => ({ ...w, gate: "never" as const })) };
|
|
204
|
+
const { plans, stored } = await recorded(doc(digest("a")));
|
|
205
|
+
const status = await approvalStatusOf({
|
|
206
|
+
spec: never,
|
|
207
|
+
specFile: ".chant/op-waves/pulumi-up.spec.json",
|
|
208
|
+
forge,
|
|
209
|
+
pr: 7,
|
|
210
|
+
head: HEAD,
|
|
211
|
+
base: "b".repeat(40),
|
|
212
|
+
show: () => ({ sha: "b".repeat(40), text: JSON.stringify(never) }),
|
|
213
|
+
readPlans: async () => plans,
|
|
214
|
+
readResolutions: async () => [],
|
|
215
|
+
changeSets: async (d) => stored.find((x) => x.digest === d),
|
|
216
|
+
});
|
|
217
|
+
expect(status).toMatchObject({ state: "success", waits: [] });
|
|
218
|
+
});
|
|
219
|
+
});
|
|
@@ -55,7 +55,7 @@ export function gitOpWaveReleasePort(opts: { cwd?: string; actor?: string } = {}
|
|
|
55
55
|
if (got.recorded) {
|
|
56
56
|
out.push({ recorded: true, env: req.env, component: req.component, digest: got.record.digest, ...(got.record.releaseDigest ? { releaseDigest: got.record.releaseDigest } : {}) });
|
|
57
57
|
} else {
|
|
58
|
-
out.push({ recorded: false, reason: got.reason === "error" ? got.error : got.detail ?? got.reason });
|
|
58
|
+
out.push({ recorded: false, reason: got.reason === "error" ? got.error : got.detail ?? got.reason, ...(got.reason === "error" && got.lost ? { lost: true as const } : {}) });
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
return out;
|
|
@@ -31,10 +31,9 @@
|
|
|
31
31
|
|
|
32
32
|
import type { OpWave, OpWaveRun, OpWavesSpec } from "./op-waves";
|
|
33
33
|
import type { Release, ReleaseCut } from "../lifecycle/release-store";
|
|
34
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
35
34
|
|
|
36
35
|
/** The first chant whose op-wave applies write release records (#4615). */
|
|
37
|
-
export const OP_WAVE_RELEASE_RECORD_FLOOR =
|
|
36
|
+
export const OP_WAVE_RELEASE_RECORD_FLOOR = "0.124.55";
|
|
38
37
|
|
|
39
38
|
/** Where an op-wave apply's release record goes (#4615), and under which names. */
|
|
40
39
|
export interface OpWaveReleaseNames {
|
|
@@ -60,7 +59,7 @@ export interface OpWaveReleaseRequest {
|
|
|
60
59
|
/** How one record came out. */
|
|
61
60
|
export type OpWaveReleaseOutcome =
|
|
62
61
|
| { recorded: true; env: string; component: string; digest: string; releaseDigest?: string }
|
|
63
|
-
| { recorded: false; reason: string };
|
|
62
|
+
| { recorded: false; reason: string; /** The record was written and its push never landed (plywood#22 finding 9). */ lost?: true };
|
|
64
63
|
|
|
65
64
|
/** Where an op wave job's release records go (#4615). */
|
|
66
65
|
export interface OpWaveReleasePort {
|
package/src/op/op-waves-run.ts
CHANGED
|
@@ -88,7 +88,7 @@ import type { TrustPolicy } from "../workspace/trust/policy";
|
|
|
88
88
|
import type { GateSigners } from "../lifecycle/gate-seal";
|
|
89
89
|
import { ciRunIdFromEnv } from "./gate-run-locator";
|
|
90
90
|
import { appendRunRecord, DEFAULT_RUN_ENV } from "../lifecycle/run-ledger";
|
|
91
|
-
import {
|
|
91
|
+
import { LifecyclePushLostError, pushLifecycleRebasing } from "../lifecycle/git";
|
|
92
92
|
import { resolveCiJob } from "../lifecycle/release-ledger";
|
|
93
93
|
import type { OpRunPolicyRow, OpRunRecordInput, OpRunStepRecord, OpRunWave, OpRunWavePlan, OpRunWaveTarget } from "./runtime";
|
|
94
94
|
import { foldPolicyRows, opWaveAfterPlanProblems, runOpWaveAfterPlanHooks, type OpWaveAfterPlanHook, type OpWaveAfterPlanRun } from "./op-waves-after-plan";
|
|
@@ -104,6 +104,7 @@ import type { LockGrain } from "../lifecycle/lock-rows";
|
|
|
104
104
|
import type { LockLiveness } from "../lifecycle/resource-lock";
|
|
105
105
|
import type { GatePolicyExec } from "../gate-policy";
|
|
106
106
|
import { gitOpWaveNewerCommit, opWaveStandDownReason, tipAppliesTargets, type OpWaveNewerCommitPort } from "./op-waves-stand-down";
|
|
107
|
+
import { mapLimited } from "../parallelism";
|
|
107
108
|
import {
|
|
108
109
|
applyOpWaveStep,
|
|
109
110
|
opWaveCosts,
|
|
@@ -679,7 +680,10 @@ function pointAtBase(spec: OpWavesSpec, name: string, where: string): Pick<OpWav
|
|
|
679
680
|
return { point: opWavePointAt(spec, name)! };
|
|
680
681
|
}
|
|
681
682
|
|
|
682
|
-
/**
|
|
683
|
+
/** The first chant whose op entry exports {@link opWavePlanPath} (terragucci#1304). */
|
|
684
|
+
export const OP_WAVE_PLAN_PATH_FLOOR = "0.124.56";
|
|
685
|
+
|
|
686
|
+
/** Where a run's plan file goes: one target's plan, as opposed to {@link opWavePlansPath}, the wave's `plans.json`. */
|
|
683
687
|
export function opWavePlanPath(spec: Pick<OpWavesSpec, "name">, wave: number, target: string): string {
|
|
684
688
|
return `.chant/op-waves/${spec.name}/wave-${wave}/${target.replace(/[^A-Za-z0-9._-]/g, "_")}.plan.json`;
|
|
685
689
|
}
|
|
@@ -785,6 +789,14 @@ export interface RunOpWaveOptions {
|
|
|
785
789
|
lockGate?: string;
|
|
786
790
|
/** Whether a run holding rows still runs (#4552). Default: the forge's answer, with the lease's age. */
|
|
787
791
|
lockLiveness?: LockLiveness;
|
|
792
|
+
/**
|
|
793
|
+
* How long a wave on the `target` or `repo` grain waits for its rows, in
|
|
794
|
+
* seconds (ruling for ci-products 2026-10-28). Default `CHANT_LOCK_WAIT`,
|
|
795
|
+
* which the waves pipelines set from the job's timeout.
|
|
796
|
+
*/
|
|
797
|
+
lockWaitSeconds?: number;
|
|
798
|
+
/** How often a waiting wave reads the rows file again, in ms. Default `CHANT_LOCK_POLL` seconds, else 10 s. */
|
|
799
|
+
lockPollMs?: number;
|
|
788
800
|
/** Overrides the spec's `standDown` (#4581). */
|
|
789
801
|
standDown?: boolean;
|
|
790
802
|
/** How the job finds a newer commit on its branch (#4581). Default: fetch the branch from `origin` ({@link gitOpWaveNewerCommit}). */
|
|
@@ -828,7 +840,8 @@ export function gitOpWaveRunPort(opts?: { cwd?: string }): OpWaveRunPort {
|
|
|
828
840
|
return {
|
|
829
841
|
async append(record) {
|
|
830
842
|
await appendRunRecord(record, opts);
|
|
831
|
-
|
|
843
|
+
// plywood#22 finding 9: a push another writer beat replays on its tip and pushes again; one that never lands throws LifecyclePushLostError.
|
|
844
|
+
const { pushWarning } = await pushLifecycleRebasing(opts);
|
|
832
845
|
return pushWarning ? { pushWarning } : {};
|
|
833
846
|
},
|
|
834
847
|
};
|
|
@@ -1095,36 +1108,88 @@ async function declaredLockGrain(cwd: string, base: string | undefined): Promise
|
|
|
1095
1108
|
}
|
|
1096
1109
|
|
|
1097
1110
|
/**
|
|
1098
|
-
* Lease the rows of a wave's runs
|
|
1099
|
-
*
|
|
1100
|
-
*
|
|
1111
|
+
* Lease the rows of a wave's runs (#4552), before anything of the wave
|
|
1112
|
+
* applies. First the rows its runs on the `target` and `repo` grains wait
|
|
1113
|
+
* for (ruling for ci-products 2026-10-28, "Ledger lock"): a stock Pulumi
|
|
1114
|
+
* stack's `stack` row, a Terraform root's `root` row, the `repo` row. The
|
|
1115
|
+
* wave waits for them in the ledger's queue, oldest commit first, up to
|
|
1116
|
+
* `lockWaitSeconds` (`CHANT_LOCK_WAIT`, set from the job's timeout), and at
|
|
1117
|
+
* the deadline applies nothing with the `held` outcome, exit 5. Then the rows
|
|
1118
|
+
* of its runs on the resource grain, all in one take with no wait: a held row
|
|
1119
|
+
* makes the wave apply nothing with the `held` outcome, exit 5, naming the
|
|
1120
|
+
* run that holds it. A run whose plan changes nothing takes no row, and
|
|
1121
|
+
* outside a git work tree the waiting grains take none.
|
|
1101
1122
|
*/
|
|
1102
1123
|
async function leaseWaveRows(
|
|
1103
1124
|
options: RunOpWaveOptions,
|
|
1104
1125
|
ctx: WaveContext,
|
|
1105
1126
|
runs: readonly OpWaveRun[],
|
|
1106
1127
|
): Promise<{ release(): Promise<boolean> } | OpWaveApplyOutcome | { failed: string } | undefined> {
|
|
1107
|
-
const
|
|
1108
|
-
const
|
|
1109
|
-
return lock
|
|
1128
|
+
const locks = runs.flatMap((r) => {
|
|
1129
|
+
const plan = ctx.steps?.get(r.target);
|
|
1130
|
+
return plan?.lock && !plan.empty ? [plan.lock] : [];
|
|
1110
1131
|
});
|
|
1111
|
-
|
|
1112
|
-
|
|
1132
|
+
const rows = locks.flatMap((l) => (l.grain === "resource" ? l.rows : []));
|
|
1133
|
+
// Outside a git work tree no ledger holds a queue, so a waiting grain takes no row there, as `chant run --components` takes none.
|
|
1134
|
+
const queued = locks.flatMap((l) => (l.grain !== "resource" ? (l.queue ?? []) : []));
|
|
1135
|
+
const queue = queued.length > 0 && inGitWorkTree(ctx.cwd) ? queued : [];
|
|
1136
|
+
if (rows.length === 0 && queue.length === 0) return undefined;
|
|
1137
|
+
const { commitTimeOf, leaseLockRows, lockPollMs, lockWaitSeconds } = await import("../lifecycle/resource-lock");
|
|
1113
1138
|
const { PR_APPLY_GATE } = await import("../pr-loop");
|
|
1114
1139
|
const gate = options.lockGate ?? PR_APPLY_GATE;
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1140
|
+
const label = `wave ${ctx.k} (${ctx.wave.name})`;
|
|
1141
|
+
const alive = options.lockLiveness ? { alive: options.lockLiveness } : {};
|
|
1142
|
+
const held: Array<{ release(): Promise<boolean> }> = [];
|
|
1143
|
+
const releaseAll = async () => {
|
|
1144
|
+
let ok = true;
|
|
1145
|
+
for (const l of held.reverse()) ok = (await l.release()) && ok;
|
|
1146
|
+
return ok;
|
|
1147
|
+
};
|
|
1148
|
+
const take = async (wanted: typeof rows, wait: boolean): Promise<OpWaveApplyOutcome | { failed: string } | undefined> => {
|
|
1149
|
+
if (wanted.length === 0) return undefined;
|
|
1150
|
+
let leased: Awaited<ReturnType<typeof leaseLockRows>>;
|
|
1151
|
+
try {
|
|
1152
|
+
const waitFor = wait
|
|
1153
|
+
? {
|
|
1154
|
+
wait: {
|
|
1155
|
+
deadline: Date.now() + (options.lockWaitSeconds ?? lockWaitSeconds(process.env)) * 1000,
|
|
1156
|
+
pollMs: options.lockPollMs ?? lockPollMs(process.env),
|
|
1157
|
+
log: (line: string) => ctx.log(`${label}: ${line}`),
|
|
1158
|
+
...(await commitTimeOf(options.head ?? "HEAD", ctx.cwd).then((t) => (t ? { commitAt: t } : {}))),
|
|
1159
|
+
},
|
|
1160
|
+
}
|
|
1161
|
+
: {};
|
|
1162
|
+
leased = await leaseLockRows(gate, wanted, { cwd: ctx.cwd, ...alive, ...waitFor });
|
|
1163
|
+
} catch (err) {
|
|
1164
|
+
return { failed: `${label}: could not hold the rows its runs change in ${gate}, so nothing was applied: ${err instanceof Error ? err.message : String(err)}` };
|
|
1165
|
+
}
|
|
1166
|
+
if (!leased.ok) {
|
|
1167
|
+
const first = leased.held[0]?.holder;
|
|
1168
|
+
const reason = leased.timedOut ? `LockWaitTimeoutError: ${leased.message}` : leased.message;
|
|
1169
|
+
return { outcome: "held", reason, ...(first ? { holder: { run: first.run, ...(first.url ? { url: first.url } : {}) } } : {}) };
|
|
1170
|
+
}
|
|
1171
|
+
for (const h of leased.tookOver) ctx.log(`${label}: took over the rows of run ${h.run}, which is gone`);
|
|
1172
|
+
const waited = leased.waited ? ` after waiting ${leased.waitedSeconds ?? 0}s` : "";
|
|
1173
|
+
ctx.log(`${label}: holds ${leased.lease.keys.length} row${leased.lease.keys.length === 1 ? "" : "s"} of ${gate}${waited} while it applies`);
|
|
1174
|
+
held.push(leased.lease);
|
|
1175
|
+
return undefined;
|
|
1176
|
+
};
|
|
1177
|
+
for (const [wanted, wait] of [[queue, true], [rows, false]] as const) {
|
|
1178
|
+
const stop = await take(wanted, wait);
|
|
1179
|
+
if (stop) {
|
|
1180
|
+
if (!(await releaseAll())) ctx.log(`${label}: could not let go of the rows it held; the next apply takes them over once this run is gone`);
|
|
1181
|
+
return stop;
|
|
1182
|
+
}
|
|
1120
1183
|
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1184
|
+
return { release: releaseAll };
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
function inGitWorkTree(cwd: string): boolean {
|
|
1188
|
+
try {
|
|
1189
|
+
return execFileSync("git", ["rev-parse", "--is-inside-work-tree"], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim() === "true";
|
|
1190
|
+
} catch {
|
|
1191
|
+
return false;
|
|
1124
1192
|
}
|
|
1125
|
-
for (const h of leased.tookOver) ctx.log(`wave ${ctx.k} (${ctx.wave.name}): took over the rows of run ${h.run}, which is gone`);
|
|
1126
|
-
ctx.log(`wave ${ctx.k} (${ctx.wave.name}): holds ${leased.lease.keys.length} row${leased.lease.keys.length === 1 ? "" : "s"} of ${gate} while it applies`);
|
|
1127
|
-
return leased.lease;
|
|
1128
1193
|
}
|
|
1129
1194
|
|
|
1130
1195
|
/** A wave's cost hold over its plans (#4545): each changing run priced, the sum against `approveAbove`. */
|
|
@@ -1777,12 +1842,14 @@ export async function runOpWave(options: RunOpWaveOptions): Promise<RunOpWaveRes
|
|
|
1777
1842
|
try {
|
|
1778
1843
|
result = await runOpWaveJob(options);
|
|
1779
1844
|
} catch (err) {
|
|
1780
|
-
const record = await recordOpWaveRun(options, started, { error: err });
|
|
1845
|
+
const { lost: _lost, ...record } = await recordOpWaveRun(options, started, { error: err });
|
|
1781
1846
|
await closeOpWaveEvents(options, events, record);
|
|
1782
1847
|
throw err;
|
|
1783
1848
|
}
|
|
1784
|
-
const record = await recordOpWaveRun(options, started, { result });
|
|
1849
|
+
const { lost, ...record } = await recordOpWaveRun(options, started, { result });
|
|
1785
1850
|
await closeOpWaveEvents(options, events, record, result);
|
|
1851
|
+
// plywood#22 finding 9: a run record that never reached the remote fails a job that would have passed.
|
|
1852
|
+
if (lost !== undefined && result.exitCode === CHANT_EXIT.done) result.exitCode = CHANT_EXIT.failed;
|
|
1786
1853
|
return result;
|
|
1787
1854
|
}
|
|
1788
1855
|
|
|
@@ -1832,6 +1899,11 @@ function targetSettled(options: RunOpWaveOptions, result: RunOpWaveResult, k: nu
|
|
|
1832
1899
|
durationMs,
|
|
1833
1900
|
...(opts.facts?.attributes ? { attributes: opts.facts.attributes } : {}),
|
|
1834
1901
|
...(opts.facts?.spans?.length ? { spans: opts.facts.spans } : {}),
|
|
1902
|
+
// #4629: what the failed-apply triage reads back from the run record.
|
|
1903
|
+
...(status === "failed" && opts.error ? { error: opts.error } : {}),
|
|
1904
|
+
...(status === "failed" && opts.facts?.resources?.some((r) => r.status === "failed")
|
|
1905
|
+
? { failedResources: opts.facts.resources.filter((r) => r.status === "failed").map((r) => r.name ?? r.resource) }
|
|
1906
|
+
: {}),
|
|
1835
1907
|
},
|
|
1836
1908
|
};
|
|
1837
1909
|
jobEvents.get(options)?.stepSettle(k, target, status, durationMs, opts);
|
|
@@ -1940,8 +2012,13 @@ export function opWaveRunRecord(
|
|
|
1940
2012
|
};
|
|
1941
2013
|
}
|
|
1942
2014
|
|
|
1943
|
-
/**
|
|
1944
|
-
|
|
2015
|
+
/**
|
|
2016
|
+
* Append the job's run record (#4551). A failed write warns and never
|
|
2017
|
+
* changes the job's exit code, except a record whose push never landed
|
|
2018
|
+
* after its replays (`LifecyclePushLostError`, plywood#22 finding 9): that
|
|
2019
|
+
* fails the job by name, through `lost`.
|
|
2020
|
+
*/
|
|
2021
|
+
async function recordOpWaveRun(options: RunOpWaveOptions, started: string, outcome: { result: RunOpWaveResult } | { error: unknown }): Promise<OpRunRecordInput & { lost?: string }> {
|
|
1945
2022
|
const cwd = options.cwd ?? process.cwd();
|
|
1946
2023
|
const port = options.runs ?? (options.gates ? undefined : gitOpWaveRunPort({ cwd }));
|
|
1947
2024
|
const log = options.log ?? ((line: string) => console.error(line));
|
|
@@ -1961,7 +2038,12 @@ async function recordOpWaveRun(options: RunOpWaveOptions, started: string, outco
|
|
|
1961
2038
|
const wrote = await port.append(record);
|
|
1962
2039
|
if (wrote && wrote.pushWarning) log(`wave ${options.wave}: the run record was written and not pushed: ${wrote.pushWarning}`);
|
|
1963
2040
|
} catch (err) {
|
|
1964
|
-
|
|
2041
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2042
|
+
if (err instanceof LifecyclePushLostError) {
|
|
2043
|
+
log(`wave ${options.wave}: LifecyclePushLostError: the run record was written and never reached the remote, so the job fails: ${message}`);
|
|
2044
|
+
return Object.assign(record, { lost: message });
|
|
2045
|
+
}
|
|
2046
|
+
log(`wave ${options.wave}: could not record the run on the run ledger: ${message}`);
|
|
1965
2047
|
}
|
|
1966
2048
|
return record;
|
|
1967
2049
|
}
|
|
@@ -3398,6 +3480,9 @@ async function applyLeased(
|
|
|
3398
3480
|
log(`wave ${k} (${wave.name}): apply failed, so none of ${runs.map((r) => r.target).join(", ")} counts as applied`);
|
|
3399
3481
|
result.failed.push(...runs.map((r) => r.target));
|
|
3400
3482
|
}
|
|
3483
|
+
} else if (spec.step && (wave.parallelism ?? spec.parallelism ?? 1) > 1) {
|
|
3484
|
+
// #4625: the step's runs apply several at once.
|
|
3485
|
+
await applyStepRunsAtOnce(options, ctx, runs, wave.parallelism ?? spec.parallelism!);
|
|
3401
3486
|
} else {
|
|
3402
3487
|
const order = new Map(runs.map((r, i) => [r.target, i]));
|
|
3403
3488
|
for (const [i, run] of runs.entries()) {
|
|
@@ -3496,10 +3581,66 @@ async function applyLeased(
|
|
|
3496
3581
|
if (recordPath && result.hooks.length > 0) writeRecord(recordPath, decision, result);
|
|
3497
3582
|
}
|
|
3498
3583
|
|
|
3584
|
+
/**
|
|
3585
|
+
* A wave's step runs applied at most `limit` at once (#4625). A run waits
|
|
3586
|
+
* for each run the wave lists before it that it depends on, and is blocked,
|
|
3587
|
+
* as one at a time, when that one failed or was blocked. The outcomes land
|
|
3588
|
+
* in the result in the wave's order.
|
|
3589
|
+
*/
|
|
3590
|
+
async function applyStepRunsAtOnce(options: RunOpWaveOptions, ctx: WaveContext, runs: readonly OpWaveRun[], limit: number): Promise<void> {
|
|
3591
|
+
const { spec, k, wave, log, result } = ctx;
|
|
3592
|
+
type Outcome = { applied: true } | { failed: true } | { moved: true } | { blockedBy: string };
|
|
3593
|
+
const order = new Map(runs.map((r, i) => [r.target, i]));
|
|
3594
|
+
const registry = await opWaveRegistry(options, ctx.cwd, options.capabilities);
|
|
3595
|
+
const settled = new Map<string, Promise<Outcome>>();
|
|
3596
|
+
const outcomes = await mapLimited(runs, limit, (run, i) => {
|
|
3597
|
+
const going = (async (): Promise<Outcome> => {
|
|
3598
|
+
const earlier = (run.dependsOn ?? []).filter((d) => (order.get(d) ?? Infinity) < i).sort();
|
|
3599
|
+
for (const dep of earlier) {
|
|
3600
|
+
const got = await settled.get(dep)!;
|
|
3601
|
+
if ("failed" in got || "blockedBy" in got) {
|
|
3602
|
+
const by = "blockedBy" in got ? got.blockedBy : dep;
|
|
3603
|
+
log(`${run.target}: blocked by ${by}, so not applied`);
|
|
3604
|
+
return { blockedBy: by };
|
|
3605
|
+
}
|
|
3606
|
+
}
|
|
3607
|
+
const plan = ctx.steps?.get(run.target);
|
|
3608
|
+
if (!plan) {
|
|
3609
|
+
log(`${run.target}: this job holds no plan of it to apply`);
|
|
3610
|
+
return { failed: true };
|
|
3611
|
+
}
|
|
3612
|
+
const startedMs = targetStarted(options, k, run.target);
|
|
3613
|
+
const got = await applyOpWaveStep({ spec, wave, registry }, run, plan);
|
|
3614
|
+
targetSettled(options, result, k, run.target, startedMs, got.outcome === "applied" ? "ok" : got.outcome === "moved" ? "skipped" : "failed", {
|
|
3615
|
+
...(got.outcome !== "applied" ? { error: got.reason } : {}),
|
|
3616
|
+
...(got.facts ? { facts: got.facts } : {}),
|
|
3617
|
+
});
|
|
3618
|
+
if (got.outcome === "applied") return { applied: true };
|
|
3619
|
+
if (got.outcome === "moved") {
|
|
3620
|
+
log(`${run.target}: its plan moved since wave ${k} was decided, so it was not applied: ${got.reason}`);
|
|
3621
|
+
return { moved: true };
|
|
3622
|
+
}
|
|
3623
|
+
log(`${run.target}: apply failed: ${got.reason}`);
|
|
3624
|
+
return { failed: true };
|
|
3625
|
+
})();
|
|
3626
|
+
settled.set(run.target, going);
|
|
3627
|
+
return going;
|
|
3628
|
+
});
|
|
3629
|
+
for (const [i, got] of outcomes.entries()) {
|
|
3630
|
+
const target = runs[i]!.target;
|
|
3631
|
+
if ("applied" in got) result.applied.push(target);
|
|
3632
|
+
else if ("moved" in got) result.moved.push(target);
|
|
3633
|
+
else if ("failed" in got) result.failed.push(target);
|
|
3634
|
+
else result.blocked = { ...result.blocked, [target]: got.blockedBy };
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3637
|
+
|
|
3499
3638
|
/**
|
|
3500
3639
|
* The release records of the runs this wave applied through its step
|
|
3501
3640
|
* (#4615), one per run, on the environment ledger each names. A record that
|
|
3502
|
-
* is not written is a line in the log
|
|
3641
|
+
* is not written is a line in the log and the job's exit code stays, except
|
|
3642
|
+
* one written whose push never landed after its replays (plywood#22 finding
|
|
3643
|
+
* 9), which fails the wave by name.
|
|
3503
3644
|
*/
|
|
3504
3645
|
async function recordStepReleases(options: RunOpWaveOptions, ctx: WaveContext, decision: OpWaveDecision, runs: readonly OpWaveRun[]): Promise<void> {
|
|
3505
3646
|
const { spec, k, wave, log, result } = ctx;
|
|
@@ -3534,6 +3675,7 @@ async function recordStepReleases(options: RunOpWaveOptions, ctx: WaveContext, d
|
|
|
3534
3675
|
for (const [i, req] of requests.entries()) {
|
|
3535
3676
|
const got = outcomes[i];
|
|
3536
3677
|
if (got?.recorded) log(`${req.target}: recorded on the "${got.env}" release ledger as ${got.component} ${got.digest}${got.releaseDigest ? ` under release ${got.releaseDigest}` : ""}`);
|
|
3678
|
+
else if (got && !got.recorded && got.lost) failed(ctx, `${req.target}: applied, and LifecyclePushLostError: the release record for ${req.component} in "${req.env}" was written and never reached the remote, so the wave fails: ${got.reason}`);
|
|
3537
3679
|
else log(`${req.target}: applied, and no release record was written for ${req.component} in "${req.env}": ${got?.reason ?? "the port gave no answer"}`);
|
|
3538
3680
|
}
|
|
3539
3681
|
}
|
|
@@ -3647,6 +3789,8 @@ export interface RecordHeadPlansOptions {
|
|
|
3647
3789
|
now?: string;
|
|
3648
3790
|
/** Write the record. Default: append to `chant/lifecycle` and push. */
|
|
3649
3791
|
write?: (plans: HeadPlans) => Promise<void>;
|
|
3792
|
+
/** Store a wave's change set at the head (#4630). Default: `_change-sets/` on `chant/lifecycle`, pushed with the record. */
|
|
3793
|
+
storeChangeSet?: (doc: ChangeSetDocument) => Promise<void>;
|
|
3650
3794
|
/** The capabilities a spec's `step` plans through (#4545). Default: the project's at `cwd`. */
|
|
3651
3795
|
capabilities?: CapabilityRegistry;
|
|
3652
3796
|
/** How a cost hold's estimator runs (#4545). */
|
|
@@ -3658,7 +3802,8 @@ export interface RecordHeadPlansOptions {
|
|
|
3658
3802
|
* pull request's head and record each wave's digest on `chant/lifecycle`,
|
|
3659
3803
|
* `_wave-plans/<name>/<head>.json`. A `pr-review` wave reads it after the
|
|
3660
3804
|
* merge: the review of that head approves the digests it planned, and only
|
|
3661
|
-
* those.
|
|
3805
|
+
* those. A wave whose plans file gives a change set records its digest and
|
|
3806
|
+
* stores it (#4630), for the approval status of a `pull-request` wave.
|
|
3662
3807
|
*/
|
|
3663
3808
|
export async function recordOpWaveHeadPlans(options: RecordHeadPlansOptions): Promise<HeadPlans> {
|
|
3664
3809
|
const { spec } = options;
|
|
@@ -3674,22 +3819,42 @@ export async function recordOpWaveHeadPlans(options: RecordHeadPlansOptions): Pr
|
|
|
3674
3819
|
timestamp: options.now ?? new Date().toISOString(),
|
|
3675
3820
|
waves: [],
|
|
3676
3821
|
};
|
|
3822
|
+
const changeSets: ChangeSetDocument[] = [];
|
|
3677
3823
|
// A `rest` wave (#3821) goes on through the waves the plan command found.
|
|
3678
3824
|
const last = spec.waves[spec.waves.length - 1]!;
|
|
3679
3825
|
for (let k = 1; ; k++) {
|
|
3680
3826
|
const wave = spec.waves[k - 1] ?? last;
|
|
3681
3827
|
const steps = new Map<string, OpWaveStepPlan>();
|
|
3682
|
-
const { members, extras: planExtras, waves: found } = await planWaveRuns({ spec, k, wave, cwd, exec, options, steps }, wave.runs, wave.discover === true);
|
|
3828
|
+
const { members, extras: planExtras, waves: found, changeSet } = await planWaveRuns({ spec, k, wave, cwd, exec, options, steps }, wave.runs, wave.discover === true);
|
|
3683
3829
|
// #4545: a cost hold's member is in the digest the merged wave decides, so the head's digest carries it too.
|
|
3684
3830
|
const cost = spec.holds?.cost ? costVerdictOf(spec.holds.cost, spec, k, members, steps, cwd, options.holdExec).member : undefined;
|
|
3685
3831
|
const extras = cost ? [...(planExtras ?? []), cost] : planExtras;
|
|
3686
|
-
|
|
3832
|
+
// #4630: the facts a gate policy reads, so the approval status before merge says which waves will wait.
|
|
3833
|
+
plans.waves.push({
|
|
3834
|
+
wave: k,
|
|
3835
|
+
name: wave.name,
|
|
3836
|
+
digest: opWaveSetDigest(spec, members, extras),
|
|
3837
|
+
changes: !members.every((m) => m.empty === true),
|
|
3838
|
+
destructive: members.some((m) => m.destructive === true),
|
|
3839
|
+
// #4630: a pull-request wave's change set, which the pull request's own approval must cover.
|
|
3840
|
+
...(changeSet ? { changeSet: changeSet.digest } : {}),
|
|
3841
|
+
});
|
|
3842
|
+
if (changeSet) changeSets.push(changeSet);
|
|
3687
3843
|
if (k >= spec.waves.length && !(last.rest && found !== undefined && k < found)) break;
|
|
3688
3844
|
}
|
|
3845
|
+
// The change sets go on the ledger first, so the record's push carries them.
|
|
3846
|
+
for (const doc of changeSets) await (options.storeChangeSet ?? ((d) => storeHeadChangeSet(d, cwd)))(doc);
|
|
3689
3847
|
await (options.write ?? ((p) => writeHeadPlans(p, cwd)))(plans);
|
|
3690
3848
|
return plans;
|
|
3691
3849
|
}
|
|
3692
3850
|
|
|
3851
|
+
async function storeHeadChangeSet(doc: ChangeSetDocument, cwd: string): Promise<void> {
|
|
3852
|
+
const { requireLifecycleLedger } = await import("../lifecycle/git");
|
|
3853
|
+
const { persistChangeSet } = await import("../lifecycle/change-set-store");
|
|
3854
|
+
await requireLifecycleLedger({ cwd });
|
|
3855
|
+
await persistChangeSet(doc, { cwd });
|
|
3856
|
+
}
|
|
3857
|
+
|
|
3693
3858
|
async function writeHeadPlans(plans: HeadPlans, cwd: string): Promise<void> {
|
|
3694
3859
|
const { pushLifecycle, requireLifecycleLedger, writeBlobToPath } = await import("../lifecycle/git");
|
|
3695
3860
|
const { headPlansPath } = await import("./gate-review");
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
import { execFile } from "node:child_process";
|
|
28
28
|
import { promisify } from "node:util";
|
|
29
29
|
import type { OpWavesSpec } from "./op-waves";
|
|
30
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
31
30
|
|
|
32
31
|
const exec = promisify(execFile);
|
|
33
32
|
|
|
@@ -37,7 +36,7 @@ const exec = promisify(execFile);
|
|
|
37
36
|
* export of {@link newerCommitOnBranch} from `@intentius/chant/op`, before
|
|
38
37
|
* it drops its copy.
|
|
39
38
|
*/
|
|
40
|
-
export const OP_WAVE_STAND_DOWN_FLOOR =
|
|
39
|
+
export const OP_WAVE_STAND_DOWN_FLOOR = "0.124.55";
|
|
41
40
|
|
|
42
41
|
/** A newer commit on the run's branch. */
|
|
43
42
|
export interface OpWaveNewerCommit {
|