@intentius/chant 0.124.55 → 0.124.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +12 -0
- package/dist/ci-audit/unrecorded.d.ts +74 -0
- package/dist/ci-audit/unrecorded.d.ts.map +1 -0
- package/dist/ci-audit/unrecorded.js +95 -0
- package/dist/ci-audit.d.ts +3 -0
- package/dist/ci-audit.d.ts.map +1 -0
- package/dist/ci-audit.js +2 -0
- package/dist/ci-control.d.ts.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 -3
- 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/pr.d.ts +5 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +259 -4
- 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/capability.d.ts +37 -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/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 +129 -3
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +153 -17
- 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/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 +48 -0
- package/dist/e2e-harness/jobs.d.ts +8 -0
- package/dist/e2e-harness/jobs.d.ts.map +1 -0
- package/dist/e2e-harness/jobs.js +34 -0
- package/dist/e2e-harness/pins.d.ts +45 -0
- package/dist/e2e-harness/pins.d.ts.map +1 -0
- package/dist/e2e-harness/pins.js +44 -0
- package/dist/e2e-harness/ports.d.ts +113 -0
- package/dist/e2e-harness/ports.d.ts.map +1 -0
- package/dist/e2e-harness/ports.js +4 -0
- package/dist/e2e-harness/reports.d.ts +45 -0
- package/dist/e2e-harness/reports.d.ts.map +1 -0
- package/dist/e2e-harness/reports.js +57 -0
- package/dist/e2e-harness/safe-run-cli.d.ts +17 -0
- package/dist/e2e-harness/safe-run-cli.d.ts.map +1 -0
- package/dist/e2e-harness/safe-run-cli.js +43 -0
- package/dist/e2e-harness/safe-run.d.ts +61 -0
- package/dist/e2e-harness/safe-run.d.ts.map +1 -0
- package/dist/e2e-harness/safe-run.js +172 -0
- package/dist/e2e-harness/scenario.d.ts +11 -0
- package/dist/e2e-harness/scenario.d.ts.map +1 -0
- package/dist/e2e-harness/scenario.js +89 -0
- package/dist/e2e-harness/schemas/demo-cycle.schema.json +282 -0
- package/dist/e2e-harness/schemas/demo-step.schema.json +245 -0
- package/dist/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
- package/dist/e2e-harness/schemas/e2e-claims.schema.json +18 -0
- package/dist/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
- package/dist/e2e-harness/schemas/index.d.ts +191 -0
- package/dist/e2e-harness/schemas/index.d.ts.map +1 -0
- package/dist/e2e-harness/schemas/index.js +62 -0
- package/dist/e2e-harness/stack.d.ts +124 -0
- package/dist/e2e-harness/stack.d.ts.map +1 -0
- package/dist/e2e-harness/stack.js +207 -0
- package/dist/e2e-harness/steps.d.ts +11 -0
- package/dist/e2e-harness/steps.d.ts.map +1 -0
- package/dist/e2e-harness/steps.js +22 -0
- package/dist/e2e-harness.d.ts +3 -0
- package/dist/e2e-harness.d.ts.map +1 -0
- package/dist/e2e-harness.js +2 -0
- package/dist/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 +46 -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/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/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/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.d.ts.map +1 -1
- package/dist/op/op-waves-release.js +1 -2
- package/dist/op/op-waves-run.d.ts +7 -2
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +96 -4
- 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 +35 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +46 -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 -3
- 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 +340 -327
- 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 +15 -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 -3
- 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/pr-plan-comment-targets.test.ts +166 -0
- package/src/cli/handlers/pr-plan-flags.test.ts +161 -0
- package/src/cli/handlers/pr.ts +228 -4
- 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/capability.ts +50 -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/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 +232 -17
- 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/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 +50 -0
- package/src/e2e-harness/jobs.ts +35 -0
- package/src/e2e-harness/pins.ts +52 -0
- package/src/e2e-harness/ports.ts +130 -0
- package/src/e2e-harness/reports.ts +79 -0
- package/src/e2e-harness/safe-run-cli.test.ts +102 -0
- package/src/e2e-harness/safe-run-cli.ts +54 -0
- package/src/e2e-harness/safe-run.ts +198 -0
- package/src/e2e-harness/scenario.ts +89 -0
- package/src/e2e-harness/schemas/README.md +62 -0
- package/src/e2e-harness/schemas/demo-cycle.schema.json +282 -0
- package/src/e2e-harness/schemas/demo-step.schema.json +245 -0
- package/src/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
- package/src/e2e-harness/schemas/e2e-claims.schema.json +18 -0
- package/src/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
- package/src/e2e-harness/schemas/index.ts +220 -0
- package/src/e2e-harness/schemas.test.ts +145 -0
- package/src/e2e-harness/stack.test.ts +124 -0
- package/src/e2e-harness/stack.ts +306 -0
- package/src/e2e-harness/steps.ts +30 -0
- package/src/e2e-harness.ts +2 -0
- package/src/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 +48 -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/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/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/index.ts +2 -0
- package/src/op/op-waves-after-plan.test.ts +12 -0
- package/src/op/op-waves-capability-spec.ts +20 -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.ts +1 -2
- package/src/op/op-waves-run.ts +94 -4
- package/src/op/op-waves-stand-down.ts +1 -2
- package/src/op/op-waves.ts +63 -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 +1 -1
- package/src/pr-loop-narrowed.test.ts +63 -0
- package/src/pr-loop.ts +30 -3
- 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
|
@@ -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
|
+
});
|
|
@@ -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 {
|
package/src/op/op-waves-run.ts
CHANGED
|
@@ -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,
|
|
@@ -118,6 +119,7 @@ import {
|
|
|
118
119
|
type OpWaveHolds,
|
|
119
120
|
type OpWaveStepPlan,
|
|
120
121
|
} from "./op-waves-capability";
|
|
122
|
+
import { NEXT_RELEASE } from "../release-floors";
|
|
121
123
|
import {
|
|
122
124
|
changeInvolvement, quorumProblems, quorumRuleLine, quorumRulesFor, quorumWaiting, recordedReviewApprovals, ruleNeedsProof, samePrincipal, trustQuorumJudge,
|
|
123
125
|
type GateQuorumJudge, type GateQuorumRule, type GateQuorumRuleProgress, type QuorumJudgement,
|
|
@@ -679,7 +681,10 @@ function pointAtBase(spec: OpWavesSpec, name: string, where: string): Pick<OpWav
|
|
|
679
681
|
return { point: opWavePointAt(spec, name)! };
|
|
680
682
|
}
|
|
681
683
|
|
|
682
|
-
/**
|
|
684
|
+
/** The first chant whose op entry exports {@link opWavePlanPath} (terragucci#1304). */
|
|
685
|
+
export const OP_WAVE_PLAN_PATH_FLOOR = NEXT_RELEASE;
|
|
686
|
+
|
|
687
|
+
/** Where a run's plan file goes: one target's plan, as opposed to {@link opWavePlansPath}, the wave's `plans.json`. */
|
|
683
688
|
export function opWavePlanPath(spec: Pick<OpWavesSpec, "name">, wave: number, target: string): string {
|
|
684
689
|
return `.chant/op-waves/${spec.name}/wave-${wave}/${target.replace(/[^A-Za-z0-9._-]/g, "_")}.plan.json`;
|
|
685
690
|
}
|
|
@@ -1832,6 +1837,11 @@ function targetSettled(options: RunOpWaveOptions, result: RunOpWaveResult, k: nu
|
|
|
1832
1837
|
durationMs,
|
|
1833
1838
|
...(opts.facts?.attributes ? { attributes: opts.facts.attributes } : {}),
|
|
1834
1839
|
...(opts.facts?.spans?.length ? { spans: opts.facts.spans } : {}),
|
|
1840
|
+
// #4629: what the failed-apply triage reads back from the run record.
|
|
1841
|
+
...(status === "failed" && opts.error ? { error: opts.error } : {}),
|
|
1842
|
+
...(status === "failed" && opts.facts?.resources?.some((r) => r.status === "failed")
|
|
1843
|
+
? { failedResources: opts.facts.resources.filter((r) => r.status === "failed").map((r) => r.name ?? r.resource) }
|
|
1844
|
+
: {}),
|
|
1835
1845
|
},
|
|
1836
1846
|
};
|
|
1837
1847
|
jobEvents.get(options)?.stepSettle(k, target, status, durationMs, opts);
|
|
@@ -3398,6 +3408,9 @@ async function applyLeased(
|
|
|
3398
3408
|
log(`wave ${k} (${wave.name}): apply failed, so none of ${runs.map((r) => r.target).join(", ")} counts as applied`);
|
|
3399
3409
|
result.failed.push(...runs.map((r) => r.target));
|
|
3400
3410
|
}
|
|
3411
|
+
} else if (spec.step && (wave.parallelism ?? spec.parallelism ?? 1) > 1) {
|
|
3412
|
+
// #4625: the step's runs apply several at once.
|
|
3413
|
+
await applyStepRunsAtOnce(options, ctx, runs, wave.parallelism ?? spec.parallelism!);
|
|
3401
3414
|
} else {
|
|
3402
3415
|
const order = new Map(runs.map((r, i) => [r.target, i]));
|
|
3403
3416
|
for (const [i, run] of runs.entries()) {
|
|
@@ -3496,6 +3509,60 @@ async function applyLeased(
|
|
|
3496
3509
|
if (recordPath && result.hooks.length > 0) writeRecord(recordPath, decision, result);
|
|
3497
3510
|
}
|
|
3498
3511
|
|
|
3512
|
+
/**
|
|
3513
|
+
* A wave's step runs applied at most `limit` at once (#4625). A run waits
|
|
3514
|
+
* for each run the wave lists before it that it depends on, and is blocked,
|
|
3515
|
+
* as one at a time, when that one failed or was blocked. The outcomes land
|
|
3516
|
+
* in the result in the wave's order.
|
|
3517
|
+
*/
|
|
3518
|
+
async function applyStepRunsAtOnce(options: RunOpWaveOptions, ctx: WaveContext, runs: readonly OpWaveRun[], limit: number): Promise<void> {
|
|
3519
|
+
const { spec, k, wave, log, result } = ctx;
|
|
3520
|
+
type Outcome = { applied: true } | { failed: true } | { moved: true } | { blockedBy: string };
|
|
3521
|
+
const order = new Map(runs.map((r, i) => [r.target, i]));
|
|
3522
|
+
const registry = await opWaveRegistry(options, ctx.cwd, options.capabilities);
|
|
3523
|
+
const settled = new Map<string, Promise<Outcome>>();
|
|
3524
|
+
const outcomes = await mapLimited(runs, limit, (run, i) => {
|
|
3525
|
+
const going = (async (): Promise<Outcome> => {
|
|
3526
|
+
const earlier = (run.dependsOn ?? []).filter((d) => (order.get(d) ?? Infinity) < i).sort();
|
|
3527
|
+
for (const dep of earlier) {
|
|
3528
|
+
const got = await settled.get(dep)!;
|
|
3529
|
+
if ("failed" in got || "blockedBy" in got) {
|
|
3530
|
+
const by = "blockedBy" in got ? got.blockedBy : dep;
|
|
3531
|
+
log(`${run.target}: blocked by ${by}, so not applied`);
|
|
3532
|
+
return { blockedBy: by };
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
const plan = ctx.steps?.get(run.target);
|
|
3536
|
+
if (!plan) {
|
|
3537
|
+
log(`${run.target}: this job holds no plan of it to apply`);
|
|
3538
|
+
return { failed: true };
|
|
3539
|
+
}
|
|
3540
|
+
const startedMs = targetStarted(options, k, run.target);
|
|
3541
|
+
const got = await applyOpWaveStep({ spec, wave, registry }, run, plan);
|
|
3542
|
+
targetSettled(options, result, k, run.target, startedMs, got.outcome === "applied" ? "ok" : got.outcome === "moved" ? "skipped" : "failed", {
|
|
3543
|
+
...(got.outcome !== "applied" ? { error: got.reason } : {}),
|
|
3544
|
+
...(got.facts ? { facts: got.facts } : {}),
|
|
3545
|
+
});
|
|
3546
|
+
if (got.outcome === "applied") return { applied: true };
|
|
3547
|
+
if (got.outcome === "moved") {
|
|
3548
|
+
log(`${run.target}: its plan moved since wave ${k} was decided, so it was not applied: ${got.reason}`);
|
|
3549
|
+
return { moved: true };
|
|
3550
|
+
}
|
|
3551
|
+
log(`${run.target}: apply failed: ${got.reason}`);
|
|
3552
|
+
return { failed: true };
|
|
3553
|
+
})();
|
|
3554
|
+
settled.set(run.target, going);
|
|
3555
|
+
return going;
|
|
3556
|
+
});
|
|
3557
|
+
for (const [i, got] of outcomes.entries()) {
|
|
3558
|
+
const target = runs[i]!.target;
|
|
3559
|
+
if ("applied" in got) result.applied.push(target);
|
|
3560
|
+
else if ("moved" in got) result.moved.push(target);
|
|
3561
|
+
else if ("failed" in got) result.failed.push(target);
|
|
3562
|
+
else result.blocked = { ...result.blocked, [target]: got.blockedBy };
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
|
|
3499
3566
|
/**
|
|
3500
3567
|
* The release records of the runs this wave applied through its step
|
|
3501
3568
|
* (#4615), one per run, on the environment ledger each names. A record that
|
|
@@ -3647,6 +3714,8 @@ export interface RecordHeadPlansOptions {
|
|
|
3647
3714
|
now?: string;
|
|
3648
3715
|
/** Write the record. Default: append to `chant/lifecycle` and push. */
|
|
3649
3716
|
write?: (plans: HeadPlans) => Promise<void>;
|
|
3717
|
+
/** Store a wave's change set at the head (#4630). Default: `_change-sets/` on `chant/lifecycle`, pushed with the record. */
|
|
3718
|
+
storeChangeSet?: (doc: ChangeSetDocument) => Promise<void>;
|
|
3650
3719
|
/** The capabilities a spec's `step` plans through (#4545). Default: the project's at `cwd`. */
|
|
3651
3720
|
capabilities?: CapabilityRegistry;
|
|
3652
3721
|
/** How a cost hold's estimator runs (#4545). */
|
|
@@ -3658,7 +3727,8 @@ export interface RecordHeadPlansOptions {
|
|
|
3658
3727
|
* pull request's head and record each wave's digest on `chant/lifecycle`,
|
|
3659
3728
|
* `_wave-plans/<name>/<head>.json`. A `pr-review` wave reads it after the
|
|
3660
3729
|
* merge: the review of that head approves the digests it planned, and only
|
|
3661
|
-
* those.
|
|
3730
|
+
* those. A wave whose plans file gives a change set records its digest and
|
|
3731
|
+
* stores it (#4630), for the approval status of a `pull-request` wave.
|
|
3662
3732
|
*/
|
|
3663
3733
|
export async function recordOpWaveHeadPlans(options: RecordHeadPlansOptions): Promise<HeadPlans> {
|
|
3664
3734
|
const { spec } = options;
|
|
@@ -3674,22 +3744,42 @@ export async function recordOpWaveHeadPlans(options: RecordHeadPlansOptions): Pr
|
|
|
3674
3744
|
timestamp: options.now ?? new Date().toISOString(),
|
|
3675
3745
|
waves: [],
|
|
3676
3746
|
};
|
|
3747
|
+
const changeSets: ChangeSetDocument[] = [];
|
|
3677
3748
|
// A `rest` wave (#3821) goes on through the waves the plan command found.
|
|
3678
3749
|
const last = spec.waves[spec.waves.length - 1]!;
|
|
3679
3750
|
for (let k = 1; ; k++) {
|
|
3680
3751
|
const wave = spec.waves[k - 1] ?? last;
|
|
3681
3752
|
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);
|
|
3753
|
+
const { members, extras: planExtras, waves: found, changeSet } = await planWaveRuns({ spec, k, wave, cwd, exec, options, steps }, wave.runs, wave.discover === true);
|
|
3683
3754
|
// #4545: a cost hold's member is in the digest the merged wave decides, so the head's digest carries it too.
|
|
3684
3755
|
const cost = spec.holds?.cost ? costVerdictOf(spec.holds.cost, spec, k, members, steps, cwd, options.holdExec).member : undefined;
|
|
3685
3756
|
const extras = cost ? [...(planExtras ?? []), cost] : planExtras;
|
|
3686
|
-
|
|
3757
|
+
// #4630: the facts a gate policy reads, so the approval status before merge says which waves will wait.
|
|
3758
|
+
plans.waves.push({
|
|
3759
|
+
wave: k,
|
|
3760
|
+
name: wave.name,
|
|
3761
|
+
digest: opWaveSetDigest(spec, members, extras),
|
|
3762
|
+
changes: !members.every((m) => m.empty === true),
|
|
3763
|
+
destructive: members.some((m) => m.destructive === true),
|
|
3764
|
+
// #4630: a pull-request wave's change set, which the pull request's own approval must cover.
|
|
3765
|
+
...(changeSet ? { changeSet: changeSet.digest } : {}),
|
|
3766
|
+
});
|
|
3767
|
+
if (changeSet) changeSets.push(changeSet);
|
|
3687
3768
|
if (k >= spec.waves.length && !(last.rest && found !== undefined && k < found)) break;
|
|
3688
3769
|
}
|
|
3770
|
+
// The change sets go on the ledger first, so the record's push carries them.
|
|
3771
|
+
for (const doc of changeSets) await (options.storeChangeSet ?? ((d) => storeHeadChangeSet(d, cwd)))(doc);
|
|
3689
3772
|
await (options.write ?? ((p) => writeHeadPlans(p, cwd)))(plans);
|
|
3690
3773
|
return plans;
|
|
3691
3774
|
}
|
|
3692
3775
|
|
|
3776
|
+
async function storeHeadChangeSet(doc: ChangeSetDocument, cwd: string): Promise<void> {
|
|
3777
|
+
const { requireLifecycleLedger } = await import("../lifecycle/git");
|
|
3778
|
+
const { persistChangeSet } = await import("../lifecycle/change-set-store");
|
|
3779
|
+
await requireLifecycleLedger({ cwd });
|
|
3780
|
+
await persistChangeSet(doc, { cwd });
|
|
3781
|
+
}
|
|
3782
|
+
|
|
3693
3783
|
async function writeHeadPlans(plans: HeadPlans, cwd: string): Promise<void> {
|
|
3694
3784
|
const { pushLifecycle, requireLifecycleLedger, writeBlobToPath } = await import("../lifecycle/git");
|
|
3695
3785
|
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 {
|
package/src/op/op-waves.ts
CHANGED
|
@@ -95,10 +95,11 @@ import type { CloudTradeSpec } from "../ci-identity";
|
|
|
95
95
|
import { gatePointProblems, type GatePoint } from "./gate-point";
|
|
96
96
|
import { quorumProblems, type GateQuorumRule } from "./gate-quorum";
|
|
97
97
|
import { notifyConfigProblem, type NotifyConfig } from "../notify";
|
|
98
|
+
// Types only: the small bundles that carry this module stay without ../ci-respond.ts (#4629).
|
|
99
|
+
import type { CiResponses } from "../ci-respond";
|
|
98
100
|
import { WAVE_GATE_NAME_PATTERN, waveGateNameFrom, waveShare } from "../wave-layout";
|
|
99
101
|
import { waveOutcomeFileName } from "../wave-blocked";
|
|
100
|
-
import {
|
|
101
|
-
import { opWaveHoldsProblems, opWaveStepProblems, type OpWaveHolds, type OpWaveStep } from "./op-waves-capability-spec";
|
|
102
|
+
import { opWaveHoldsProblems, opWaveParallelismProblems, opWaveStepProblems, type OpWaveHolds, type OpWaveStep } from "./op-waves-capability-spec";
|
|
102
103
|
import { opWaveReleaseProblems, type OpWaveReleaseNames } from "./op-waves-release";
|
|
103
104
|
import { CONTROL_DISPATCH_JOB, CONTROL_NAME, controlSettingsProblems, resolveControlTarget, type ControlSettingsInput, type ControlTarget } from "../control/dispatch";
|
|
104
105
|
|
|
@@ -234,7 +235,7 @@ export const CHECK_HOOK_MOMENT = "check";
|
|
|
234
235
|
export type CiHookMoment = OpWaveHookMoment | typeof CHECK_HOOK_MOMENT;
|
|
235
236
|
|
|
236
237
|
/** The first chant that reads and runs `ci.hooks.check` (#4556). A declaration that uses it sets `minReader` to it. */
|
|
237
|
-
export const CI_CHECK_HOOK_FLOOR =
|
|
238
|
+
export const CI_CHECK_HOOK_FLOOR = "0.124.55";
|
|
238
239
|
|
|
239
240
|
/**
|
|
240
241
|
* Who runs the `before.apply` and `after.apply` hooks (#3804). `chant`: the
|
|
@@ -389,6 +390,8 @@ export interface OpWave {
|
|
|
389
390
|
hooks?: OpWaveHooks;
|
|
390
391
|
/** Where this wave's jobs run (#3914). Default: the spec's `runner`. */
|
|
391
392
|
runner?: OpWaveRunner;
|
|
393
|
+
/** How many of the wave's runs apply at once (#4625), over the spec's `parallelism`. */
|
|
394
|
+
parallelism?: number;
|
|
392
395
|
/**
|
|
393
396
|
* The OIDC tokens this wave's jobs get (#3914), as `{ <variable>: <audience> }`;
|
|
394
397
|
* see {@link OpWaveJobGroup.idTokens}. With `jobs`, these are the deciding
|
|
@@ -487,6 +490,13 @@ export interface OpWavesSpec {
|
|
|
487
490
|
* moved exits 4. See `./op-waves-capability.ts`.
|
|
488
491
|
*/
|
|
489
492
|
step?: OpWaveStep;
|
|
493
|
+
/**
|
|
494
|
+
* How many runs of a wave apply at once (#4625), a wave's own
|
|
495
|
+
* `parallelism` winning. Default 1, one at a time. Over 1 it needs `step`:
|
|
496
|
+
* a run whose wave lists one of its `dependsOn` before it waits for that
|
|
497
|
+
* one, and is blocked when it failed, as one at a time.
|
|
498
|
+
*/
|
|
499
|
+
parallelism?: number;
|
|
490
500
|
/**
|
|
491
501
|
* Holds the wave runs over its plans (#4545), read at the base commit
|
|
492
502
|
* with the policy: `policy` runs the workspace's `ci.policy` over each
|
|
@@ -554,6 +564,14 @@ export interface OpWavesSpec {
|
|
|
554
564
|
* `../notify.ts`.
|
|
555
565
|
*/
|
|
556
566
|
notify?: NotifyConfig;
|
|
567
|
+
/**
|
|
568
|
+
* The responses a wave job posts (#4629, `../ci-respond.ts`): a refused
|
|
569
|
+
* wave's diff (`wave-refused: diff`, on by default) and a failed apply's
|
|
570
|
+
* triage (`apply-failed: triage`, on by default), on the pull request the
|
|
571
|
+
* wave applies or a tracking issue. `off` turns one off. A job's
|
|
572
|
+
* `CHANT_RESPOND` sits under these.
|
|
573
|
+
*/
|
|
574
|
+
respond?: CiResponses;
|
|
557
575
|
/**
|
|
558
576
|
* The control repo (#4617, `@intentius/chant/ci-control`): once the last
|
|
559
577
|
* wave ran, a `control-dispatch` job tells the control repo how the waves
|
|
@@ -582,7 +600,7 @@ export interface OpWavesControl extends ControlSettingsInput {
|
|
|
582
600
|
}
|
|
583
601
|
|
|
584
602
|
/** The first chant whose Op waves specs take `control` (#4617). A product feature-detects this name. */
|
|
585
|
-
export const OP_WAVES_CONTROL_FLOOR =
|
|
603
|
+
export const OP_WAVES_CONTROL_FLOOR = "0.124.55";
|
|
586
604
|
|
|
587
605
|
/** The control dispatch job's name in an Op waves pipeline (#4617). */
|
|
588
606
|
export const OP_WAVES_CONTROL_JOB = CONTROL_DISPATCH_JOB;
|
|
@@ -757,6 +775,29 @@ export function opWavesRecordPlansCommand(specFile: string, bin?: string): strin
|
|
|
757
775
|
return [...opWaveBinArgv(bin), "run", "wave", "--spec", specFile, "--record-plans"];
|
|
758
776
|
}
|
|
759
777
|
|
|
778
|
+
/** The GitLab variable a pipeline schedule sets to `1` to post every open merge request's approval status (#4630). */
|
|
779
|
+
export const OP_WAVES_APPROVAL_STATUS_VAR = "CHANT_APPROVAL_STATUS";
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* Whether a spec's pipeline records each head's plans and posts
|
|
783
|
+
* `<product>/approval` before merge (#4630): some wave takes its approval
|
|
784
|
+
* from the pull request, by its review (`pr-review`) or by its own approval
|
|
785
|
+
* (`pull-request`, under the 2026-10-28 ruling).
|
|
786
|
+
*/
|
|
787
|
+
export function opWavesPostsApprovalStatus(spec: Pick<OpWavesSpec, "waves">): boolean {
|
|
788
|
+
return spec.waves.some((w) => w.approval === "pr-review" || w.approval === "pull-request");
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* The command the approval status job runs (#4630), through the product's
|
|
793
|
+
* bin: `--pr`, `--head` and `--base` from the pull request event on GitHub
|
|
794
|
+
* and Forgejo, `--open` on GitLab.
|
|
795
|
+
*/
|
|
796
|
+
export function opWavesApprovalStatusCommand(specFile: string, forge: "github" | "gitlab" | "forgejo", bin?: string): string[] {
|
|
797
|
+
const at = forge === "gitlab" ? ["--open"] : ["--pr", '"$PR_NUMBER"', "--head", '"$HEAD_SHA"', "--base", '"$BASE_SHA"'];
|
|
798
|
+
return [...opWaveBinArgv(bin), "run", "wave", "--spec", specFile, "--approval-status", ...at, "--forge", forge];
|
|
799
|
+
}
|
|
800
|
+
|
|
760
801
|
/** The default apply command. */
|
|
761
802
|
export const OP_WAVE_DEFAULT_APPLY = ["chant", "run", "{op}", "--env", "{target}"];
|
|
762
803
|
|
|
@@ -935,10 +976,26 @@ export function assertOpWavesSpec(spec: OpWavesSpec): void {
|
|
|
935
976
|
}
|
|
936
977
|
if (spec.neverOverMcp !== undefined && typeof spec.neverOverMcp !== "boolean") throw new Error(`${where}: neverOverMcp must be true or false.`);
|
|
937
978
|
if (spec.runner !== undefined) assertOpWaveRunner(where, "runner", spec.runner);
|
|
979
|
+
{
|
|
980
|
+
const problems = opWaveParallelismProblems(spec);
|
|
981
|
+
if (problems.length > 0) throw new Error(`${where}: ${problems[0]}.`);
|
|
982
|
+
}
|
|
938
983
|
if (spec.notify !== undefined) {
|
|
939
984
|
const problem = notifyConfigProblem(spec.notify, "notify");
|
|
940
985
|
if (problem) throw new Error(`${where}: ${problem}`);
|
|
941
986
|
}
|
|
987
|
+
if (spec.respond !== undefined) {
|
|
988
|
+
const respond = spec.respond as unknown;
|
|
989
|
+
if (respond === null || typeof respond !== "object" || Array.isArray(respond)) throw new Error(`${where}: respond must be an object of event to mode, such as { "wave-refused": "off" }.`);
|
|
990
|
+
// The wave events and their modes, as ../ci-respond.ts's CI_RESPONSES has them.
|
|
991
|
+
const modes: Record<string, readonly string[]> = { "wave-refused": ["diff", "off"], "apply-failed": ["triage", "off"] };
|
|
992
|
+
for (const [event, mode] of Object.entries(respond as Record<string, unknown>)) {
|
|
993
|
+
if (event === "description") throw new Error(`${where}: respond: the description check runs in the plan-note job, so an op waves spec takes only wave-refused and apply-failed.`);
|
|
994
|
+
const allowed = modes[event];
|
|
995
|
+
if (!allowed) throw new Error(`${where}: respond names no event ${JSON.stringify(event)}; the events are wave-refused and apply-failed.`);
|
|
996
|
+
if (typeof mode !== "string" || !allowed.includes(mode)) throw new Error(`${where}: respond: ${event} takes ${allowed.join(" or ")}, not ${JSON.stringify(mode)}.`);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
942
999
|
const names = new Set<string>();
|
|
943
1000
|
for (const wave of spec.waves) {
|
|
944
1001
|
if (!NAME.test(wave.name)) {
|
|
@@ -1038,8 +1095,8 @@ const ENV_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
|
1038
1095
|
/** The key each cloud of a `cloud` trade names its identity under (`IDENTITY_KEY` in ../ci-identity.ts, kept here so this module imports none of it). */
|
|
1039
1096
|
const CLOUD_IDENTITY_KEY: Record<string, string> = { aws: "role", gcp: "serviceAccount", azure: "clientId", pulumi: "token" };
|
|
1040
1097
|
|
|
1041
|
-
/** Refuse a `cloud` (#4332) the trade could not run: an unknown cloud, one that names no identity, or no audience. */
|
|
1042
|
-
function assertOpWaveCloud(where: string, field: string, cloud: unknown): void {
|
|
1098
|
+
/** Refuse a `cloud` (#4332) the trade could not run: an unknown cloud, one that names no identity, or no audience. Scheduled Ops check theirs with it too (#4631). */
|
|
1099
|
+
export function assertOpWaveCloud(where: string, field: string, cloud: unknown): void {
|
|
1043
1100
|
if (cloud === null || typeof cloud !== "object" || Array.isArray(cloud) || Object.keys(cloud).length === 0) throw new Error(`${where}: ${field} must name one or more of aws, gcp, azure and pulumi.`);
|
|
1044
1101
|
for (const [name, c] of Object.entries(cloud as Record<string, unknown>)) {
|
|
1045
1102
|
const key = CLOUD_IDENTITY_KEY[name];
|
package/src/op/runtime.ts
CHANGED
|
@@ -21,7 +21,6 @@ import type { StepRecord, OpRunResult } from "./local-executor";
|
|
|
21
21
|
import type { WaitingPoint } from "./steward-points";
|
|
22
22
|
import type { GateResolutionRecord } from "../lifecycle/gate-ledger";
|
|
23
23
|
import type { RunOrigin } from "../lifecycle/release-ledger";
|
|
24
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
25
24
|
import type { CapabilityTraceSpan } from "../otlp";
|
|
26
25
|
import type { RunComponentsOptions, RunComponentsResult } from "../components/cli-support";
|
|
27
26
|
|
|
@@ -284,7 +283,7 @@ export interface OpRunWavePlan {
|
|
|
284
283
|
}
|
|
285
284
|
|
|
286
285
|
/** The first chant that runs an after-plan hook in the wave job's process and writes {@link OpRunWave.plans} (#4614). */
|
|
287
|
-
export const OP_WAVE_AFTER_PLAN_FLOOR =
|
|
286
|
+
export const OP_WAVE_AFTER_PLAN_FLOOR = "0.124.55";
|
|
288
287
|
|
|
289
288
|
/** One run target's apply in an op wave job (#4555). */
|
|
290
289
|
export interface OpRunWaveTarget {
|
|
@@ -295,10 +294,14 @@ export interface OpRunWaveTarget {
|
|
|
295
294
|
attributes?: Record<string, string | number | boolean>;
|
|
296
295
|
/** The pieces the engine timed. */
|
|
297
296
|
spans?: CapabilityTraceSpan[];
|
|
297
|
+
/** The engine's error, when the apply failed (#4629): what the failed-apply triage posts. */
|
|
298
|
+
error?: string;
|
|
299
|
+
/** The resources the engine reported failed (#4629), by name or id. */
|
|
300
|
+
failedResources?: string[];
|
|
298
301
|
}
|
|
299
302
|
|
|
300
303
|
/** The first chant that writes {@link OpRunRecord.wave}, a run record per op wave job (#4551). */
|
|
301
|
-
export const OP_WAVE_RUN_RECORD_FLOOR =
|
|
304
|
+
export const OP_WAVE_RUN_RECORD_FLOOR = "0.124.55";
|
|
302
305
|
|
|
303
306
|
/** `value` as an {@link OpRunWave}, or undefined when it is not one, so a reader drops a malformed field and keeps the record. */
|
|
304
307
|
export function opRunWaveOf(value: unknown): OpRunWave | undefined {
|
package/src/otlp.ts
CHANGED
|
@@ -36,11 +36,10 @@
|
|
|
36
36
|
import { randomBytes } from "node:crypto";
|
|
37
37
|
import { activeProductWords } from "./ci-product-words";
|
|
38
38
|
import { CHANT_VERSION } from "./chant-version";
|
|
39
|
-
import { NEXT_RELEASE } from "./release-floors";
|
|
40
39
|
import type { RunEventBody, RunEventRun } from "./run-event";
|
|
41
40
|
|
|
42
41
|
/** The first chant with the OTLP exporter, op-wave run events and the product tool hook (#4555). */
|
|
43
|
-
export const OTLP_EXPORTER_FLOOR =
|
|
42
|
+
export const OTLP_EXPORTER_FLOOR = "0.124.55";
|
|
44
43
|
|
|
45
44
|
export type OtlpAttrValue = string | number | boolean;
|
|
46
45
|
export type OtlpAttrs = Record<string, OtlpAttrValue | undefined>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** The parallelism limit (#4625). Written for the ci-products post-merge pass. */
|
|
2
|
+
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
|
+
import { mapLimited, parallelismProblem } from "./parallelism";
|
|
5
|
+
|
|
6
|
+
describe("mapLimited", () => {
|
|
7
|
+
test("never runs more than the limit at once, and keeps the order", async () => {
|
|
8
|
+
let running = 0;
|
|
9
|
+
let most = 0;
|
|
10
|
+
const out = await mapLimited([5, 1, 4, 2, 3], 2, async (n) => {
|
|
11
|
+
running++;
|
|
12
|
+
most = Math.max(most, running);
|
|
13
|
+
await new Promise((r) => setTimeout(r, n));
|
|
14
|
+
running--;
|
|
15
|
+
return n * 10;
|
|
16
|
+
});
|
|
17
|
+
expect(out).toEqual([50, 10, 40, 20, 30]);
|
|
18
|
+
expect(most).toBe(2);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("no limit runs them all at once", async () => {
|
|
22
|
+
let most = 0;
|
|
23
|
+
let running = 0;
|
|
24
|
+
await mapLimited([1, 2, 3], undefined, async () => {
|
|
25
|
+
running++;
|
|
26
|
+
most = Math.max(most, running);
|
|
27
|
+
await Promise.resolve();
|
|
28
|
+
running--;
|
|
29
|
+
});
|
|
30
|
+
expect(most).toBe(3);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("parallelismProblem", () => {
|
|
35
|
+
expect(parallelismProblem("parallelism", 4)).toBeUndefined();
|
|
36
|
+
expect(parallelismProblem("parallelism", 0)).toMatch(/whole number of 1 or more/);
|
|
37
|
+
expect(parallelismProblem("parallelism", 1.5)).toMatch(/whole number/);
|
|
38
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A limit on how many things run at once (#4625): members a pull request
|
|
3
|
+
* plans at once (`pr-plan --parallelism`), and runs an op wave applies at
|
|
4
|
+
* once (`parallelism` on the spec or a wave). A product's `parallelism`
|
|
5
|
+
* maps onto both.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** Why `value` is not a parallelism, or undefined when it is one: a whole number of 1 or more. */
|
|
9
|
+
export function parallelismProblem(field: string, value: unknown): string | undefined {
|
|
10
|
+
if (typeof value === "number" && Number.isInteger(value) && value >= 1) return undefined;
|
|
11
|
+
return `${field} is ${JSON.stringify(value)}; give a whole number of 1 or more, the most that run at once`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Run `fn` over `items` with at most `limit` in flight, results in the
|
|
16
|
+
* items' order. Items start in order, and `fn` is called synchronously when
|
|
17
|
+
* an item starts, so an item that awaits an earlier one's promise never
|
|
18
|
+
* waits on one that has not started. No limit, or one at least the number
|
|
19
|
+
* of items: all at once.
|
|
20
|
+
*/
|
|
21
|
+
export async function mapLimited<T, R>(items: readonly T[], limit: number | undefined, fn: (item: T, index: number) => Promise<R>): Promise<R[]> {
|
|
22
|
+
if (limit === undefined || limit >= items.length) return Promise.all(items.map((item, i) => fn(item, i)));
|
|
23
|
+
const out: R[] = new Array(items.length);
|
|
24
|
+
let next = 0;
|
|
25
|
+
const worker = async (): Promise<void> => {
|
|
26
|
+
while (next < items.length) {
|
|
27
|
+
const i = next++;
|
|
28
|
+
out[i] = await fn(items[i]!, i);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
await Promise.all(Array.from({ length: Math.max(1, limit) }, worker));
|
|
32
|
+
return out;
|
|
33
|
+
}
|
package/src/policy-source.ts
CHANGED
|
@@ -21,7 +21,6 @@ import { spawnSync } from "node:child_process";
|
|
|
21
21
|
import { mkdtempSync, rmSync } from "node:fs";
|
|
22
22
|
import { tmpdir } from "node:os";
|
|
23
23
|
import { join } from "node:path";
|
|
24
|
-
import { NEXT_RELEASE } from "./release-floors";
|
|
25
24
|
import { gitTree, type WorkspaceTree } from "./workspace/tree";
|
|
26
25
|
import type { GatePolicySource, ResolvedGatePolicySource } from "./gate-policy";
|
|
27
26
|
|
|
@@ -30,7 +29,7 @@ import type { GatePolicySource, ResolvedGatePolicySource } from "./gate-policy";
|
|
|
30
29
|
export { assertGatePolicySource, type GatePolicySource, type ResolvedGatePolicySource } from "./gate-policy";
|
|
31
30
|
|
|
32
31
|
/** The first chant that reads `ci.policy.source` and `ci.policy.packs`; a declaration that sets either needs this `minReader`. */
|
|
33
|
-
export const CI_POLICY_SOURCE_FLOOR =
|
|
32
|
+
export const CI_POLICY_SOURCE_FLOOR = "0.124.55";
|
|
34
33
|
|
|
35
34
|
/** A fetched source: its record, and its tree at the commit, rooted at the repository's top. */
|
|
36
35
|
export interface FetchedGatePolicySource {
|
|
@@ -34,7 +34,7 @@ describe("the pr-forge bundle", () => {
|
|
|
34
34
|
expect(inputs.filter((i) => pattern.test(i)), String(pattern)).toEqual([]);
|
|
35
35
|
}
|
|
36
36
|
expect(inputs.map((i) => i.replace(/^.*?packages\//, "packages/")).sort()).toEqual(["packages/core/src/pr-forge.ts"]);
|
|
37
|
-
// About
|
|
37
|
+
// About 55.9 KB today, after the pull request authors (#4000), pullRequestOpen for target locks (#4293), the four requires checks of an apply before merge (#4301) the approver filter (#4337) the approved fields (#4287) the plan job's GitLab note (#4328) and GitLab's open merge requests for stale notes (#4628).
|
|
38
38
|
expect(result.outputFiles.reduce((n, f) => n + f.contents.byteLength, 0)).toBeLessThan(56 * 1024);
|
|
39
39
|
});
|
|
40
40
|
});
|