@intentius/chant 0.124.109 → 0.124.110
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/__golden__/wave-loop/fan-out-applied.json +12 -6
- package/dist/__golden__/wave-loop/fan-out-apply-fails.json +8 -4
- package/dist/__golden__/wave-loop/fan-out-gated.json +4 -2
- package/dist/__golden__/wave-loop/fan-out-no-members.json +16 -8
- package/dist/__golden__/wave-loop/fan-out-plan-fails.json +8 -4
- package/dist/__golden__/wave-loop/fan-out-same-root.json +4 -2
- package/dist/agent-facts.d.ts +130 -0
- package/dist/agent-facts.js +196 -0
- package/dist/change-risk.d.ts +216 -0
- package/dist/change-risk.js +304 -0
- package/dist/change-set.d.ts +8 -0
- package/dist/ci-agent-alert.d.ts +139 -0
- package/dist/ci-agent-alert.js +342 -0
- package/dist/ci-agent-triggers.d.ts +152 -0
- package/dist/ci-agent-triggers.js +232 -0
- package/dist/ci-agent-verify-failed.d.ts +149 -0
- package/dist/ci-agent-verify-failed.js +191 -0
- package/dist/ci-agent.d.ts +136 -8
- package/dist/ci-agent.js +353 -26
- package/dist/ci-comment-commands.d.ts +8 -0
- package/dist/ci-comment-commands.js +17 -1
- package/dist/ci-comment-reject.d.ts +70 -0
- package/dist/ci-comment-reject.js +135 -0
- package/dist/ci-comment-replies.d.ts +3 -1
- package/dist/ci-comment-replies.js +6 -0
- package/dist/ci-estate/delivery.d.ts +25 -3
- package/dist/ci-estate/delivery.js +28 -9
- package/dist/ci-estate/page.d.ts +7 -3
- package/dist/ci-estate/page.js +19 -4
- package/dist/ci-estate/rows.d.ts +14 -2
- package/dist/ci-estate/rows.js +9 -1
- package/dist/ci-estate.d.ts +5 -2
- package/dist/ci-estate.js +3 -2
- package/dist/ci-handover.d.ts +2 -7
- package/dist/ci-handover.js +3 -20
- package/dist/ci-jobs.d.ts +6 -0
- package/dist/ci-jobs.js +17 -0
- package/dist/ci-note-commands.d.ts +2 -0
- package/dist/ci-note-commands.js +12 -1
- package/dist/ci-product-words.d.ts +151 -1
- package/dist/ci-product-words.js +1390 -3
- package/dist/ci-product.d.ts +100 -4
- package/dist/ci-product.js +99 -3
- package/dist/ci-respond-run.d.ts +9 -0
- package/dist/ci-respond-run.js +35 -4
- package/dist/ci-respond-summary-env.d.ts +56 -0
- package/dist/ci-respond-summary-env.js +81 -0
- package/dist/ci-respond-summary.d.ts +103 -0
- package/dist/ci-respond-summary.js +243 -0
- package/dist/ci-respond.d.ts +4 -2
- package/dist/ci-respond.js +4 -2
- package/dist/cli/command-group.js +1 -1
- package/dist/cli/commands/lint.js +21 -3
- package/dist/cli/handlers/agent.js +49 -4
- package/dist/cli/handlers/approve.js +3 -1
- package/dist/cli/handlers/build.d.ts +97 -1
- package/dist/cli/handlers/build.js +251 -3
- package/dist/cli/handlers/fan-out.js +55 -0
- package/dist/cli/handlers/graph.d.ts +14 -0
- package/dist/cli/handlers/graph.js +58 -3
- package/dist/cli/handlers/lifecycle-health.d.ts +7 -0
- package/dist/cli/handlers/lifecycle-health.js +47 -9
- package/dist/cli/handlers/lifecycle.js +4 -1
- package/dist/cli/handlers/notify-relay.d.ts +2 -2
- package/dist/cli/handlers/notify-relay.js +67 -7
- package/dist/cli/handlers/pipeline-agent.d.ts +30 -0
- package/dist/cli/handlers/pipeline-agent.js +255 -0
- package/dist/cli/handlers/pipeline-artifacts.d.ts +39 -0
- package/dist/cli/handlers/pipeline-artifacts.js +203 -0
- package/dist/cli/handlers/pipeline.d.ts +16 -0
- package/dist/cli/handlers/pipeline.js +112 -0
- package/dist/cli/handlers/pr-comment.js +4 -0
- package/dist/cli/handlers/pr-notes.js +4 -1
- package/dist/cli/handlers/pr.d.ts +20 -0
- package/dist/cli/handlers/pr.js +114 -11
- package/dist/cli/handlers/promote.js +792 -47
- package/dist/cli/handlers/reject.d.ts +84 -0
- package/dist/cli/handlers/reject.js +216 -0
- package/dist/cli/handlers/replan.d.ts +54 -0
- package/dist/cli/handlers/replan.js +177 -0
- package/dist/cli/handlers/run-generate.d.ts +5 -0
- package/dist/cli/handlers/run-generate.js +31 -4
- package/dist/cli/handlers/run-wave.js +15 -2
- package/dist/cli/handlers/run.js +4 -2
- package/dist/cli/handlers/stage.d.ts +35 -0
- package/dist/cli/handlers/stage.js +90 -0
- package/dist/cli/lsp/server.js +4 -0
- package/dist/cli/main.js +88 -8
- package/dist/cli/parse-args.js +35 -2
- package/dist/cli/registry.d.ts +12 -0
- package/dist/components/auto-release.d.ts +2 -0
- package/dist/components/auto-release.js +1 -0
- package/dist/components/capability.d.ts +40 -0
- package/dist/components/cli-support.d.ts +21 -1
- package/dist/components/cli-support.js +28 -6
- package/dist/components/component.d.ts +23 -4
- package/dist/components/component.schema.json +28 -0
- package/dist/components/declared-reads.d.ts +44 -4
- package/dist/components/declared-reads.js +80 -3
- package/dist/components/discover.d.ts +8 -0
- package/dist/components/discover.js +1 -1
- package/dist/components/driver.d.ts +13 -0
- package/dist/components/driver.js +23 -2
- package/dist/components/environment-sets.d.ts +229 -0
- package/dist/components/environment-sets.js +338 -0
- package/dist/components/fan-out-canary.d.ts +47 -0
- package/dist/components/fan-out-canary.js +58 -0
- package/dist/components/fan-out-run.d.ts +17 -0
- package/dist/components/fan-out-run.js +14 -1
- package/dist/components/fan-out-support.d.ts +7 -0
- package/dist/components/fan-out-support.js +1 -1
- package/dist/components/groups.d.ts +8 -1
- package/dist/components/groups.js +19 -1
- package/dist/components/index.d.ts +5 -2
- package/dist/components/index.js +4 -1
- package/dist/components/pr-cost.d.ts +28 -0
- package/dist/components/pr-cost.js +53 -0
- package/dist/components/pr-pipeline.d.ts +33 -0
- package/dist/components/pr-pipeline.js +32 -5
- package/dist/components/pr-policy.d.ts +33 -2
- package/dist/components/pr-policy.js +5 -2
- package/dist/components/pr-risk.d.ts +42 -0
- package/dist/components/pr-risk.js +74 -0
- package/dist/components/product-pipeline.d.ts +43 -0
- package/dist/components/product-pipeline.js +67 -1
- package/dist/components/promote.d.ts +6 -0
- package/dist/components/promote.js +13 -0
- package/dist/components/release-compile.js +3 -1
- package/dist/components/release-gate.d.ts +6 -1
- package/dist/components/release-gate.js +10 -2
- package/dist/components/step-environments.d.ts +236 -0
- package/dist/components/step-environments.js +392 -0
- package/dist/components/upstream-replan.d.ts +201 -0
- package/dist/components/upstream-replan.js +249 -0
- package/dist/components/verify-step.d.ts +30 -0
- package/dist/components/verify-step.js +27 -0
- package/dist/components/wave-plan.js +6 -2
- package/dist/config-environments.d.ts +4 -2
- package/dist/control/dispatch.d.ts +15 -0
- package/dist/control/dispatch.js +28 -4
- package/dist/cost-estimate.d.ts +188 -0
- package/dist/cost-estimate.js +363 -0
- package/dist/drift-record.d.ts +36 -0
- package/dist/drift-record.js +44 -0
- package/dist/engine-facts.d.ts +105 -0
- package/dist/engine-facts.js +111 -0
- package/dist/exit-codes.d.ts +4 -3
- package/dist/exit-codes.js +4 -3
- package/dist/flag-params.d.ts +2 -2
- package/dist/flag-params.js +9 -4
- package/dist/floor-table.data.js +53 -0
- package/dist/forge-token-vars.d.ts +12 -0
- package/dist/forge-token-vars.js +25 -0
- package/dist/gate-decision.d.ts +3 -1
- package/dist/gate-decision.js +3 -1
- package/dist/gated-waves.d.ts +2 -0
- package/dist/gated-waves.js +1 -0
- package/dist/graph-ir.d.ts +30 -0
- package/dist/graph-ir.js +33 -1
- package/dist/graph-refs.d.ts +26 -0
- package/dist/graph-refs.js +34 -3
- package/dist/graph-schema/graph.schema.json +136 -0
- package/dist/health.d.ts +65 -0
- package/dist/health.js +62 -0
- package/dist/lexicon.d.ts +188 -1
- package/dist/lifecycle/disruption.d.ts +14 -1
- package/dist/lifecycle/disruption.js +5 -1
- package/dist/lifecycle/gate-change-set.d.ts +8 -0
- package/dist/lifecycle/gate-change-set.js +2 -1
- package/dist/lifecycle/gate-ledger.d.ts +26 -0
- package/dist/lifecycle/gate-rejection.d.ts +82 -0
- package/dist/lifecycle/gate-rejection.js +93 -0
- package/dist/lifecycle/gate-seal.d.ts +3 -3
- package/dist/lifecycle/gate-seal.js +5 -5
- package/dist/lifecycle/observe.d.ts +17 -0
- package/dist/lifecycle/observe.js +10 -1
- package/dist/lifecycle/release-cut.js +4 -0
- package/dist/lifecycle/release-ledger.d.ts +8 -0
- package/dist/lifecycle/release-risk.d.ts +137 -0
- package/dist/lifecycle/release-risk.js +214 -0
- package/dist/lifecycle/release-store.d.ts +9 -0
- package/dist/lifecycle/release-store.js +4 -0
- package/dist/lifecycle/stage-log.d.ts +85 -0
- package/dist/lifecycle/stage-log.js +141 -0
- package/dist/lint/canary-checks.d.ts +31 -0
- package/dist/lint/canary-checks.js +45 -0
- package/dist/lint/rule.d.ts +1 -0
- package/dist/lint/rules/evl012-pipeline-fold.d.ts +14 -0
- package/dist/lint/rules/evl012-pipeline-fold.js +30 -0
- package/dist/lint/rules/index.d.ts +1 -0
- package/dist/lint/rules/index.js +3 -0
- package/dist/notify-relay-repo.d.ts +54 -0
- package/dist/notify-relay-repo.js +84 -0
- package/dist/notify-relay.d.ts +53 -3
- package/dist/notify-relay.js +96 -3
- package/dist/notify.d.ts +57 -1
- package/dist/notify.js +7 -1
- package/dist/notify.schema.json +61 -3
- package/dist/observation.d.ts +34 -0
- package/dist/observation.js +14 -1
- package/dist/op/activities/review-agent.d.ts +39 -2
- package/dist/op/activities/review-agent.js +88 -5
- package/dist/op/agent-permit.d.ts +88 -0
- package/dist/op/agent-permit.js +97 -0
- package/dist/op/gate-approval-base.d.ts +8 -0
- package/dist/op/gate-approval-base.js +9 -0
- package/dist/op/gate-approval.d.ts +30 -1
- package/dist/op/gate-approval.js +23 -2
- package/dist/op/gate-quorum.d.ts +114 -8
- package/dist/op/gate-quorum.js +198 -21
- package/dist/op/gate-reject.d.ts +79 -0
- package/dist/op/gate-reject.js +96 -0
- package/dist/op/gate-summary.js +1 -1
- package/dist/op/gate.d.ts +28 -3
- package/dist/op/gate.js +55 -13
- package/dist/op/generate-pipeline.d.ts +15 -1
- package/dist/op/generate-pipeline.js +32 -5
- package/dist/op/index.d.ts +11 -6
- package/dist/op/index.js +10 -5
- package/dist/op/local-executor.d.ts +2 -0
- package/dist/op/local-executor.js +23 -4
- package/dist/op/op-waves-after-plan.d.ts +23 -0
- package/dist/op/op-waves-after-plan.js +12 -1
- package/dist/op/op-waves-capability-spec.d.ts +14 -0
- package/dist/op/op-waves-capability-spec.js +46 -6
- package/dist/op/op-waves-capability.d.ts +21 -13
- package/dist/op/op-waves-capability.js +22 -59
- package/dist/op/op-waves-environment-sets.d.ts +41 -0
- package/dist/op/op-waves-environment-sets.js +82 -0
- package/dist/op/op-waves-quorum-warnings.d.ts +53 -0
- package/dist/op/op-waves-quorum-warnings.js +90 -0
- package/dist/op/op-waves-release-port.d.ts +7 -0
- package/dist/op/op-waves-release-port.js +15 -3
- package/dist/op/op-waves-release.d.ts +15 -0
- package/dist/op/op-waves-release.js +15 -0
- package/dist/op/op-waves-run.d.ts +37 -3
- package/dist/op/op-waves-run.js +141 -18
- package/dist/op/op-waves-soak.d.ts +57 -0
- package/dist/op/op-waves-soak.js +111 -0
- package/dist/op/op-waves-split.d.ts +4 -0
- package/dist/op/op-waves-split.js +4 -0
- package/dist/op/op-waves.d.ts +67 -4
- package/dist/op/op-waves.js +71 -3
- package/dist/pipeline/agent-ajv.d.ts +4 -0
- package/dist/pipeline/agent-ajv.js +14 -0
- package/dist/pipeline/agent-steps.d.ts +329 -0
- package/dist/pipeline/agent-steps.js +602 -0
- package/dist/pipeline/artifacts.d.ts +264 -0
- package/dist/pipeline/artifacts.js +425 -0
- package/dist/pipeline/diff.d.ts +45 -0
- package/dist/pipeline/diff.js +177 -0
- package/dist/pipeline/fold.d.ts +43 -0
- package/dist/pipeline/fold.js +140 -0
- package/dist/pipeline/generate.d.ts +52 -0
- package/dist/pipeline/generate.js +120 -0
- package/dist/pipeline/product.d.ts +225 -0
- package/dist/pipeline/product.js +257 -0
- package/dist/pipeline/promote.d.ts +404 -0
- package/dist/pipeline/promote.js +694 -0
- package/dist/pipeline/read.d.ts +37 -0
- package/dist/pipeline/read.js +58 -0
- package/dist/pipeline/rendered.d.ts +25 -0
- package/dist/pipeline/rendered.js +53 -0
- package/dist/pipeline/soak-checks.d.ts +80 -0
- package/dist/pipeline/soak-checks.js +254 -0
- package/dist/pipeline/soak-gate.d.ts +97 -0
- package/dist/pipeline/soak-gate.js +176 -0
- package/dist/pipeline/soak-sources.d.ts +17 -0
- package/dist/pipeline/soak-sources.js +42 -0
- package/dist/pipeline/soak.d.ts +260 -0
- package/dist/pipeline/soak.js +378 -0
- package/dist/pipeline/spec.d.ts +724 -0
- package/dist/pipeline/spec.js +567 -0
- package/dist/pipeline/stage-ledger.d.ts +187 -0
- package/dist/pipeline/stage-ledger.js +185 -0
- package/dist/pipeline/stage-waves.d.ts +114 -0
- package/dist/pipeline/stage-waves.js +161 -0
- package/dist/pipeline/stages.d.ts +64 -0
- package/dist/pipeline/stages.js +174 -0
- package/dist/pipeline/verify-rollback.d.ts +277 -0
- package/dist/pipeline/verify-rollback.js +393 -0
- package/dist/pipeline.d.ts +142 -0
- package/dist/pipeline.js +143 -0
- package/dist/pr-loop.d.ts +22 -0
- package/dist/pr-loop.js +8 -0
- package/dist/pr-plan-note.d.ts +15 -1
- package/dist/pr-plan-note.js +8 -0
- package/dist/pr-post.d.ts +31 -0
- package/dist/pr-post.js +89 -0
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/report-store/audit.schema.json +50 -0
- package/dist/report-store/dora.schema.json +331 -0
- package/dist/report-store/estate.schema.json +96 -0
- package/dist/report-store/run.schema.json +14 -0
- package/dist/report-store.d.ts +151 -0
- package/dist/report-store.js +344 -0
- package/dist/run-event.d.ts +7 -2
- package/dist/wave-runtime.mjs +458 -404
- package/dist/workspace/catalog-edges.js +3 -3
- package/dist/workspace/change-set.schema.json +4 -0
- package/dist/workspace/ci-cloud-identity.d.ts +4 -0
- package/dist/workspace/ci-cloud-identity.js +30 -0
- package/dist/workspace/ci-run.js +17 -2
- package/dist/workspace/ci-secrets.d.ts +3 -1
- package/dist/workspace/ci-secrets.js +7 -1
- package/dist/workspace/compose-graph.d.ts +1 -1
- package/dist/workspace/compose-graph.js +3 -1
- package/dist/workspace/declaration.d.ts +27 -0
- package/dist/workspace/declaration.js +35 -0
- package/dist/workspace/declaration.schema.json +56 -0
- package/dist/workspace/graph-cli.js +26 -0
- package/dist/workspace/graph.schema.json +5 -1
- package/dist/workspace/identity-gate-rule.d.ts +4 -0
- package/dist/workspace/identity-gate-rule.js +2 -2
- package/dist/workspace/identity-reject-rule.d.ts +14 -0
- package/dist/workspace/identity-reject-rule.js +24 -0
- package/dist/workspace/identity.d.ts +3 -0
- package/dist/workspace/identity.js +2 -1
- package/dist/workspace/nested-graph.js +2 -0
- package/dist/workspace/pr-report.schema.json +65 -0
- package/dist/workspace/promotion-order.d.ts +19 -4
- package/dist/workspace/promotion-order.js +26 -4
- package/dist/workspace/release-train.d.ts +14 -0
- package/dist/workspace/release-train.js +32 -0
- package/dist/workspace/run-event.schema.json +2 -2
- package/dist/workspace/stack-read-edges.d.ts +19 -0
- package/dist/workspace/stack-read-edges.js +54 -0
- package/dist/workspace/status-gates.d.ts +51 -1
- package/dist/workspace/status-gates.js +60 -0
- package/dist/workspace/status-stages.d.ts +223 -0
- package/dist/workspace/status-stages.js +279 -0
- package/dist/workspace/status.d.ts +45 -1
- package/dist/workspace/status.js +109 -5
- package/dist/workspace/status.schema.json +283 -2
- package/dist/workspace/trust/seal.d.ts +7 -0
- package/dist/workspace/trust/seal.js +9 -0
- package/package.json +5 -1
package/dist/op/op-waves-run.js
CHANGED
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
* question is answered, `chant run resume --op <name>` starts the job again
|
|
49
49
|
* (`pointGateResumable`, #3835).
|
|
50
50
|
*/
|
|
51
|
+
import { opWaveSoakStop } from "./op-waves-soak.js";
|
|
51
52
|
import { execFileSync } from "node:child_process";
|
|
52
53
|
import { createHash } from "node:crypto";
|
|
53
54
|
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -75,13 +76,14 @@ import { foldPolicyRows, opWaveAfterPlanProblems, runOpWaveAfterPlanHooks } from
|
|
|
75
76
|
import { activeOtlp, RunEventTrace } from "../otlp.js";
|
|
76
77
|
import { joinRunEventSinks, resolveRunEventRun } from "../run-event-stream.js";
|
|
77
78
|
import { OpWaveRunEvents } from "./op-waves-events.js";
|
|
79
|
+
import { changeRiskQuorum, scoreChangeRisk } from "../change-risk.js";
|
|
78
80
|
import { opWaveReleaseNames } from "./op-waves-release.js";
|
|
79
81
|
import { gitOpWaveReleasePort } from "./op-waves-release-port.js";
|
|
80
82
|
import { gitOpWaveNewerCommit, opWaveDefaultBranch, opWaveStandDownReason, tipAppliesTargets } from "./op-waves-stand-down.js";
|
|
81
83
|
import { keyedSerial, mapLimited } from "../parallelism.js";
|
|
82
|
-
import { applyOpWaveStep, opWaveCosts, opWaveCostVerdict, opWaveHoldsAt, opWaveHoldsProblems, opWavePolicyVerdicts, opWaveRegistry, opWaveStepChangeSet, planJsonOf, planOpWaveStep, planOpWaveStepGroup, discoverOpWaveStepRuns, applyOpWaveStepGroup, OP_WAVE_TOGETHER_MEMBER, } from "./op-waves-capability.js";
|
|
83
|
-
import { changeInvolvement, quorumProblems, quorumRuleLine, quorumRulesFor, quorumWaiting, recordedReviewApprovals, recordedReviewOf, ruleNeedsProof, samePrincipal, trustQuorumJudge, } from "./gate-quorum.js";
|
|
84
|
-
import { OP_WAVE_DEFAULT_APPLY, OP_WAVE_GATE_POLICIES, OP_WAVE_HOOK_MOMENTS, GATE_APPROVAL_SOURCES, assertOpWaveHooks, assertOpWavesSpec, opWaveApplyHooksRunBy, opWaveAt, opWaveGateName, opWaveHooksAt, opWaveChecksDir, opWaveOutcomeDir, opWavePointAt, opWavePointProblems, opWaveRecordPath, opWaveGroupRuns, opWaveGroupsProblem, opWaveShare, OP_LEDGER_NAME, opWavesInvolvedProblems, waveApproveTarget, } from "./op-waves.js";
|
|
84
|
+
import { applyOpWaveStep, opWaveCostEstimate, opWaveCosts, opWaveCostVerdict, opWaveHoldsAt, opWaveHoldsProblems, opWavePolicyVerdicts, opWaveRegistry, opWaveStepChangeSet, planJsonOf, planOpWaveStep, planOpWaveStepGroup, discoverOpWaveStepRuns, applyOpWaveStepGroup, OP_WAVE_TOGETHER_MEMBER, } from "./op-waves-capability.js";
|
|
85
|
+
import { changeInvolvement, quorumGroupLines, quorumProblems, quorumRuleLine, quorumRules, quorumRulesFor, quorumWaiting, recordedReviewApprovals, recordedReviewOf, ruleNeedsProof, samePrincipal, trustQuorumJudge, } from "./gate-quorum.js";
|
|
86
|
+
import { OP_WAVE_DEFAULT_APPLY, OP_WAVE_GATE_POLICIES, OP_WAVE_HOOK_MOMENTS, GATE_APPROVAL_SOURCES, assertOpWaveHooks, assertOpWavesSpec, opWaveFailureToleranceReads, opWaveToleratedFailures, opWaveApplyHooksRunBy, opWaveAt, opWaveGateName, opWaveHooksAt, opWaveChecksDir, opWaveOutcomeDir, opWavePointAt, opWavePointProblems, opWaveRecordPath, opWaveGroupRuns, opWaveGroupsProblem, opWaveShare, opWaveRunMatches, OP_LEDGER_NAME, opWavesInvolvedProblems, waveApproveTarget, } from "./op-waves.js";
|
|
85
87
|
import { OP_WAVE_PENDING_RESERVED, opWaveArgv, pendingFields, holdFinishedPath, readHoldFinished, readHoldRequest, inProcessHookOf, runHookList, runHookListAsync, runStageHooks, runStageHooksAsync, spawnExec, spawnExecAsync, } from "./stage-hooks.js";
|
|
86
88
|
export { OP_WAVE_PENDING_RESERVED, opWaveArgv, runStageHooks, runStageHooksAsync, spawnExecAsync };
|
|
87
89
|
export const OP_WAVE_APPLY_OUTCOMES = ["stood-down", "held", "replan"];
|
|
@@ -165,6 +167,12 @@ export function readOpWavePolicy(specFile, name, base, cwd, show = gitShowAtBase
|
|
|
165
167
|
// An approval mode this chant does not know reads as sealed: the strictest, so an unknown rule never loosens a gate.
|
|
166
168
|
const approval = wave.approval === undefined ? "ledger" : GATE_APPROVAL_SOURCES.includes(wave.approval) ? wave.approval : "sealed";
|
|
167
169
|
const rules = { policy: OP_WAVE_GATE_POLICIES.includes(policy) ? policy : "always", approval, source: "base", base: sha, hooks: noHooks(), spend, ...spendRules, applyHooksRunBy: "chant", neverOverMcp, ...asks };
|
|
170
|
+
// #5324: a tolerance lets failed runs through, so only the one at base counts.
|
|
171
|
+
if (wave.failureTolerance !== undefined && opWaveFailureToleranceReads(wave.failureTolerance))
|
|
172
|
+
rules.failureTolerance = wave.failureTolerance;
|
|
173
|
+
// #5345: the opt-in that plans dependents again after the apply, as the base has it.
|
|
174
|
+
if (Array.isArray(spec.replanDependents) && spec.replanDependents.length > 0 && spec.replanDependents.every((m) => typeof m === "string" && m !== ""))
|
|
175
|
+
rules.replanDependents = [...spec.replanDependents];
|
|
168
176
|
try {
|
|
169
177
|
assertOpWaveHooks(`${specFile} at ${sha.slice(0, 12)}`, spec.hooks);
|
|
170
178
|
assertOpWaveHooks(`${specFile} at ${sha.slice(0, 12)}, wave "${name}"`, wave.hooks);
|
|
@@ -202,7 +210,7 @@ function quorumAtBase(spec, where) {
|
|
|
202
210
|
// terragucci issue 1303: the review ledger and the involved count without rules too.
|
|
203
211
|
if (raw === undefined)
|
|
204
212
|
return extra;
|
|
205
|
-
const problems = Array.isArray(raw) ? quorumProblems(raw, "approvals.quorum", { notAuthor: true }) : ["`approvals.quorum` must be a list of rules"];
|
|
213
|
+
const problems = Array.isArray(raw) ? quorumProblems(raw, "approvals.quorum", { notAuthor: true, proven: true, combine: true }) : ["`approvals.quorum` must be a list of rules"];
|
|
206
214
|
if (problems.length > 0)
|
|
207
215
|
return { quorumRefused: `the approval rules in ${where} cannot be read (${problems.join("; ")})` };
|
|
208
216
|
return raw.length > 0 ? { quorum: raw, ...extra } : extra;
|
|
@@ -227,6 +235,14 @@ function pointAtBase(spec, name, where) {
|
|
|
227
235
|
return { pointRefused: `the decision point at base cannot be asked (${where}: ${problems.join("; ")})` };
|
|
228
236
|
return { point: opWavePointAt(spec, name) };
|
|
229
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* The first chant whose approval rules take `proven` (#5349), a rule's
|
|
240
|
+
* `count` met by proven approvers only, and whose generator warns about a
|
|
241
|
+
* count above 1 that plain `chant approve` lines can meet and about a rule
|
|
242
|
+
* that needs proof where the signers file names nobody and no review mode
|
|
243
|
+
* applies (`opWavesQuorumFindings`, `UNPROVABLE_QUORUM_REFUSED`).
|
|
244
|
+
*/
|
|
245
|
+
export const PROVEN_APPROVERS_FLOOR = "0.124.110";
|
|
230
246
|
/** The first chant whose Op waves spec takes `approvals.preview`: a merged wave applies the plans its pull request previewed, or exits 4. */
|
|
231
247
|
export const OP_WAVES_PREVIEW_FLOOR = "0.124.59";
|
|
232
248
|
/** The first chant whose op entry exports {@link opWavePlanPath} (terragucci#1304). */
|
|
@@ -704,9 +720,36 @@ function inGitWorkTree(cwd) {
|
|
|
704
720
|
}
|
|
705
721
|
}
|
|
706
722
|
/** A wave's cost hold over its plans (#4545): each changing run priced, the sum against `approveAbove`. */
|
|
707
|
-
function costVerdictOf(hold, spec, k, members, steps, cwd, exec) {
|
|
708
|
-
|
|
709
|
-
|
|
723
|
+
function costVerdictOf(hold, spec, k, members, steps, cwd, exec, runEnv) {
|
|
724
|
+
return opWaveCostVerdict(hold, waveCostsOf(hold, spec, k, members, steps, cwd, exec, runEnv));
|
|
725
|
+
}
|
|
726
|
+
/** Each run's estimate under a wave's cost hold (#4545), with the environment its run hooks gave it (#5433). */
|
|
727
|
+
function waveCostsOf(hold, spec, k, members, steps, cwd, exec, runEnv) {
|
|
728
|
+
const runs = members.map((m) => {
|
|
729
|
+
const env = runEnv?.get(m.member);
|
|
730
|
+
return { target: m.member, plan: opWavePlanPath(spec, k, m.member), artifact: steps?.get(m.member)?.artifact, empty: m.empty === true, ...(env ? { env } : {}) };
|
|
731
|
+
});
|
|
732
|
+
return opWaveCosts(hold, runs, cwd, exec);
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* The change risk of a wave's plans (#5325, `../change-risk.ts`): the runs'
|
|
736
|
+
* change-set parts, the engine's destructive classes and the stage's
|
|
737
|
+
* environment. Over its threshold, or with a run whose change set it cannot
|
|
738
|
+
* read, the wave waits: the hold lines say why. It never lets a wave through.
|
|
739
|
+
*/
|
|
740
|
+
function waveRiskOf(ctx, settings, members, parts) {
|
|
741
|
+
const { spec, wave } = ctx;
|
|
742
|
+
const read = members.map((m) => parts?.get(m.member) ?? ctx.steps?.get(m.member)?.part).filter((p) => p !== undefined);
|
|
743
|
+
const unread = members.filter((m) => m.empty !== true && !parts?.has(m.member) && !ctx.steps?.get(m.member)?.part).map((m) => m.member);
|
|
744
|
+
const destructive = [...new Set(members.flatMap((m) => ctx.steps?.get(m.member)?.destructiveClasses ?? []))].sort();
|
|
745
|
+
const env = spec.labels?.Env;
|
|
746
|
+
const record = scoreChangeRisk({ changeSet: { members: read.map((p) => p.member), entries: read.flatMap((p) => p.entries) }, ...(destructive.length ? { destructive } : {}), ...(env ? { environments: [env] } : {}) }, settings);
|
|
747
|
+
const holds = [];
|
|
748
|
+
if (record.over)
|
|
749
|
+
holds.push(`risk ${record.score.toFixed(2)} (${record.level}): ${record.overBy.join("; ")}`);
|
|
750
|
+
if (unread.length > 0)
|
|
751
|
+
holds.push(`risk: the plans of ${unread.join(", ")} gave no change set to score`);
|
|
752
|
+
return { record, holds };
|
|
710
753
|
}
|
|
711
754
|
/**
|
|
712
755
|
* Run a wave's holds over its plans (#4545): the policy marks each run it
|
|
@@ -720,6 +763,16 @@ async function runWaveHolds(ctx, holds, members, parts, base) {
|
|
|
720
763
|
const out = { holds: [], extras: [], rows: new Map() };
|
|
721
764
|
if (!holds)
|
|
722
765
|
return out;
|
|
766
|
+
// #5325: the wave's change set is scored once, before the policy, so each run's policy reads it as input.risk.
|
|
767
|
+
const risk = holds.risk ? waveRiskOf(ctx, holds.risk, members, parts) : undefined;
|
|
768
|
+
if (risk) {
|
|
769
|
+
ctx.risk = risk.record;
|
|
770
|
+
log(`wave ${k} (${wave.name}): risk ${risk.record.score.toFixed(2)} (${risk.record.level})${risk.record.over ? `, ${risk.record.overBy.join("; ")}` : ""}`);
|
|
771
|
+
out.holds.push(...risk.holds);
|
|
772
|
+
ctx.riskQuorum = changeRiskQuorum(risk.record, holds.risk);
|
|
773
|
+
}
|
|
774
|
+
// #5334: the wave is priced once, before the policy, so each run's policy reads the estimate as input.cost.
|
|
775
|
+
const costs = holds.cost ? waveCostsOf(holds.cost, spec, k, members, ctx.steps, cwd, options.holdExec, ctx.runEnv) : undefined;
|
|
723
776
|
if (holds.policy) {
|
|
724
777
|
const missing = members.filter((m) => !parts?.has(m.member)).map((m) => m.member);
|
|
725
778
|
if (missing.length > 0)
|
|
@@ -735,7 +788,7 @@ async function runWaveHolds(ctx, holds, members, parts, base) {
|
|
|
735
788
|
}
|
|
736
789
|
let got;
|
|
737
790
|
try {
|
|
738
|
-
got = await opWavePolicyVerdicts({ spec, gate: opWaveGateName(spec, k), env: spec.labels?.Env ?? wave.name, base, head, cwd, ...(options.holdExec ? { exec: options.holdExec } : {}) }, parts);
|
|
791
|
+
got = await opWavePolicyVerdicts({ spec, gate: opWaveGateName(spec, k), env: spec.labels?.Env ?? wave.name, base, head, cwd, ...(options.holdExec ? { exec: options.holdExec } : {}) }, parts, holds.cost && costs ? opWaveCostEstimate(holds.cost, costs) : undefined, risk?.record);
|
|
739
792
|
}
|
|
740
793
|
catch (err) {
|
|
741
794
|
return { failed: `wave ${k} (${wave.name}): ${err instanceof Error ? err.message : String(err)}, so nothing in it was applied` };
|
|
@@ -765,7 +818,7 @@ async function runWaveHolds(ctx, holds, members, parts, base) {
|
|
|
765
818
|
}
|
|
766
819
|
}
|
|
767
820
|
if (holds.cost) {
|
|
768
|
-
const verdict =
|
|
821
|
+
const verdict = opWaveCostVerdict(holds.cost, costs ?? []);
|
|
769
822
|
out.extras.push(verdict.member);
|
|
770
823
|
log(`wave ${k} (${wave.name}): cost ${verdict.monthlyDelta >= 0 ? "+" : ""}${verdict.monthlyDelta.toFixed(2)} ${verdict.currency} a month${verdict.unestimated.length ? `, ${verdict.unestimated.length} run${verdict.unestimated.length === 1 ? "" : "s"} not priced` : ""}`);
|
|
771
824
|
if (verdict.hold)
|
|
@@ -812,6 +865,8 @@ async function runAfterPlan(ctx, members, parts, policyRows) {
|
|
|
812
865
|
empty: m.empty === true,
|
|
813
866
|
destructive: m.destructive === true,
|
|
814
867
|
policy: row ? [row] : [],
|
|
868
|
+
// #5422: the wave's change risk, a copy per run so a hook cannot change the record the decision keeps.
|
|
869
|
+
...(ctx.risk ? { risk: structuredClone(ctx.risk) } : {}),
|
|
815
870
|
cwd,
|
|
816
871
|
};
|
|
817
872
|
});
|
|
@@ -1830,6 +1885,17 @@ async function runOpWaveJob(options) {
|
|
|
1830
1885
|
saveOpWavePlan(options, { end: stopped });
|
|
1831
1886
|
return stopped;
|
|
1832
1887
|
}
|
|
1888
|
+
// #5326: the wave before this one soaks first; while it holds, this job plans nothing and exits 3.
|
|
1889
|
+
if (options.share === undefined && options.group === undefined && options.phase !== "apply") {
|
|
1890
|
+
const soaking = await opWaveSoakStop({ spec, k: options.wave, cwd, ...(options.gates ? { gates: options.gates } : {}), ...(options.soak ? { soak: options.soak } : {}), log });
|
|
1891
|
+
if (soaking && !soaking.passed) {
|
|
1892
|
+
const held = { exitCode: soaking.exitCode, applied: [], failed: [], moved: [], hooks: [] };
|
|
1893
|
+
writeOpWaveOutcome(options, dir, held);
|
|
1894
|
+
if (options.phase === "plan")
|
|
1895
|
+
saveOpWavePlan(options, { end: held });
|
|
1896
|
+
return held;
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1833
1899
|
if (blocked.size > 0)
|
|
1834
1900
|
log(`wave ${options.wave}: ${blockedWords(blocked)}, so not planned or applied`);
|
|
1835
1901
|
const mine = jobRuns(options);
|
|
@@ -2268,6 +2334,8 @@ async function writeOpWaveRecords(options, at) {
|
|
|
2268
2334
|
if (missed.length > 0)
|
|
2269
2335
|
lost = true;
|
|
2270
2336
|
}
|
|
2337
|
+
// #5345: the dependents of what the applying jobs applied, planned again under the gate job's rule at base.
|
|
2338
|
+
await replanAfterWave(options, { cwd, log, env: options.spec.labels?.Env ?? decision?.name ?? options.spec.waves[k - 1]?.name ?? "local", k }, decision?.replanDependents, result.applied);
|
|
2271
2339
|
// #4992: a hold on another gate an applying job's hook found waiting, recorded under the gate job's rules.
|
|
2272
2340
|
for (const held of holds) {
|
|
2273
2341
|
const rule = { approval: decision?.approval ?? "ledger", base: decision?.base ?? options.base ?? "HEAD", neverOverMcp: decision?.neverOverMcp === true || options.spec.neverOverMcp === true };
|
|
@@ -2514,6 +2582,8 @@ async function openWaveDecision(options, ctx, opts) {
|
|
|
2514
2582
|
...(spec.digest?.over === "changing" ? { digestOver: "changing" } : {}),
|
|
2515
2583
|
...(neverOverMcp ? { neverOverMcp: true } : {}),
|
|
2516
2584
|
...(rules.point ? { point: { ...rules.point } } : {}),
|
|
2585
|
+
...(rules.failureTolerance !== undefined ? { failureTolerance: rules.failureTolerance } : {}),
|
|
2586
|
+
...(rules.replanDependents ? { replanDependents: [...rules.replanDependents] } : {}),
|
|
2517
2587
|
};
|
|
2518
2588
|
return { go: { rules, holds, decision } };
|
|
2519
2589
|
}
|
|
@@ -2773,6 +2843,11 @@ async function decideOpWave(options, { prior }, planned, digest) {
|
|
|
2773
2843
|
decision.members = members;
|
|
2774
2844
|
// #4290: the rules at base whose targets glob matches one of the wave's runs.
|
|
2775
2845
|
const takes = planned.rules.quorum ? quorumRulesFor(planned.rules.quorum, members.map((m) => m.member)) : [];
|
|
2846
|
+
// #5325: an over risk adds its rules on top of the wave's own, and records the score.
|
|
2847
|
+
if (ctx.risk)
|
|
2848
|
+
decision.risk = ctx.risk;
|
|
2849
|
+
if (ctx.riskQuorum?.length)
|
|
2850
|
+
takes.push(...quorumRulesFor(ctx.riskQuorum, members.map((m) => m.member)));
|
|
2776
2851
|
if (takes.length > 0)
|
|
2777
2852
|
decision.quorum = takes;
|
|
2778
2853
|
// terragucci issue 1303: a wave no rule covers still leaves the involved out, and counts a review the product recorded.
|
|
@@ -3415,8 +3490,10 @@ const gitCommitsBetween = (cwd) => (base, head) => {
|
|
|
3415
3490
|
* the same pull request; with none, no approver can show they are someone
|
|
3416
3491
|
* else and the rule waits.
|
|
3417
3492
|
*/
|
|
3418
|
-
async function settleQuorumGate(options, ctx, decision,
|
|
3493
|
+
async function settleQuorumGate(options, ctx, decision, nodes, oneApprover = false) {
|
|
3419
3494
|
const { spec, k, wave, cwd, log } = ctx;
|
|
3495
|
+
// #5354: every rule, inside `all` and `any` groups too, for what any of them needs.
|
|
3496
|
+
const rules = quorumRules(nodes);
|
|
3420
3497
|
const { gate, digest, approval, base, policy, members } = decision;
|
|
3421
3498
|
const { ledger, port } = await gatePort(options, cwd, gate, approval, base);
|
|
3422
3499
|
const now = options.now ?? new Date().toISOString();
|
|
@@ -3538,7 +3615,7 @@ async function settleQuorumGate(options, ctx, decision, rules, oneApprover = fal
|
|
|
3538
3615
|
...(spent ? { spent } : {}),
|
|
3539
3616
|
fields: { ...decision.pending, ...(decision.changeSet ? { changeSet: decision.changeSet } : {}), approvalMode: approval },
|
|
3540
3617
|
...(decision.neverOverMcp ? { neverOverMcp: true } : {}),
|
|
3541
|
-
approval: { quorum:
|
|
3618
|
+
approval: { quorum: nodes, mode: "log-only" },
|
|
3542
3619
|
judge,
|
|
3543
3620
|
});
|
|
3544
3621
|
if (check.satisfied) {
|
|
@@ -3562,6 +3639,8 @@ async function settleQuorumGate(options, ctx, decision, rules, oneApprover = fal
|
|
|
3562
3639
|
decision.quorumProgress = check.quorum.rules;
|
|
3563
3640
|
for (const p of check.quorum.rules)
|
|
3564
3641
|
log(`${label}: approval rule ${quorumRuleLine(p)}`);
|
|
3642
|
+
for (const line of quorumGroupLines(check.quorum.groups))
|
|
3643
|
+
log(`${label}: approval group ${line}`);
|
|
3565
3644
|
log(`${label}: the approval rules at ${base.slice(0, 12)} are not met (${quorumWaiting(check.quorum.rules)}), so it waits for more approvals of ${digest}`);
|
|
3566
3645
|
}
|
|
3567
3646
|
decision.status = "waiting";
|
|
@@ -4027,6 +4106,9 @@ async function applyLeased(options, ctx, decision, runs, planned, byApply, recor
|
|
|
4027
4106
|
}
|
|
4028
4107
|
if (spec.step)
|
|
4029
4108
|
await recordStepReleases(options, ctx, decision, runs);
|
|
4109
|
+
// #5345: a split wave's applying job holds no write token; its record job plans the dependents.
|
|
4110
|
+
if (options.phase !== "apply")
|
|
4111
|
+
await replanAfterWave(options, { cwd: ctx.cwd, log: ctx.log, env: spec.labels?.Env ?? wave.name, k }, decision.replanDependents, ctx.result.applied);
|
|
4030
4112
|
if (recordPath && byApply)
|
|
4031
4113
|
writeRecord(recordPath, decision, result);
|
|
4032
4114
|
if (nothing) {
|
|
@@ -4046,8 +4128,13 @@ async function applyLeased(options, ctx, decision, runs, planned, byApply, recor
|
|
|
4046
4128
|
return;
|
|
4047
4129
|
}
|
|
4048
4130
|
if (result.failed.length > 0) {
|
|
4049
|
-
|
|
4050
|
-
|
|
4131
|
+
// #5324: within the tolerance read at base, the failed runs stay failed and the wave counts as applied.
|
|
4132
|
+
const tolerated = opWaveToleratedFailures(decision.failureTolerance, runs.length);
|
|
4133
|
+
if (result.failed.length > tolerated) {
|
|
4134
|
+
result.exitCode = 1;
|
|
4135
|
+
return;
|
|
4136
|
+
}
|
|
4137
|
+
log(`wave ${k} (${wave.name}): ${result.failed.length} run${result.failed.length === 1 ? "" : "s"} failed (${result.failed.join(", ")}), within its failure tolerance of ${tolerated}, so the wave goes on`);
|
|
4051
4138
|
}
|
|
4052
4139
|
// #4545: a run its step refused as moved applied nothing, so the wave exits moved and its after-apply hooks do not run.
|
|
4053
4140
|
if (spec.step && result.moved.length > 0) {
|
|
@@ -4192,6 +4279,28 @@ async function applyStepRunsAtOnce(options, ctx, runs, limit) {
|
|
|
4192
4279
|
result.blocked = { ...result.blocked, [target]: got.blockedBy };
|
|
4193
4280
|
}
|
|
4194
4281
|
}
|
|
4282
|
+
/**
|
|
4283
|
+
* The replan step (#5345): once a wave applied, when `replanDependents` at
|
|
4284
|
+
* base names one of the runs it applied, `chant components replan` runs in
|
|
4285
|
+
* the job for the applied runs (`../components/upstream-replan.ts`). It only
|
|
4286
|
+
* plans, and the plan waits at its gate. Whatever it finds is a line in the
|
|
4287
|
+
* log: it never changes the wave's exit code, since the wave applied.
|
|
4288
|
+
* Without `replanDependents` at base nothing runs.
|
|
4289
|
+
*/
|
|
4290
|
+
async function replanAfterWave(options, at, replanDependents, applied) {
|
|
4291
|
+
if (!replanDependents || replanDependents.length === 0 || applied.length === 0)
|
|
4292
|
+
return;
|
|
4293
|
+
if (!applied.some((target) => replanDependents.some((p) => opWaveRunMatches(p, target))))
|
|
4294
|
+
return;
|
|
4295
|
+
const step = options.replan ?? (async (input) => (await import("../cli/handlers/replan.js")).replanStep(input));
|
|
4296
|
+
try {
|
|
4297
|
+
const line = await step({ cwd: at.cwd, env: at.env, components: [...applied].sort(), replanDependents: [...replanDependents] });
|
|
4298
|
+
at.log(`wave ${at.k}: ${line}`);
|
|
4299
|
+
}
|
|
4300
|
+
catch (err) {
|
|
4301
|
+
at.log(`wave ${at.k}: the dependents of the applied runs were not planned again: ${err instanceof Error ? err.message : String(err)}`);
|
|
4302
|
+
}
|
|
4303
|
+
}
|
|
4195
4304
|
/**
|
|
4196
4305
|
* The release records of the runs this wave applied through its step
|
|
4197
4306
|
* (#4615), one per run, on the environment ledger each names. A record that
|
|
@@ -4235,7 +4344,9 @@ function stepReleaseRequests(options, ctx, decision, runs) {
|
|
|
4235
4344
|
gitSha = "";
|
|
4236
4345
|
}
|
|
4237
4346
|
}
|
|
4238
|
-
|
|
4347
|
+
// #5387: the wave's change risk rides with its release records, for the cut to bind.
|
|
4348
|
+
const risk = decision.risk ? { risk: { op: spec.name, wave: ctx.k, name: wave.name, digest: decision.digest, risk: decision.risk } } : {};
|
|
4349
|
+
requests.push({ ...names, target: run.target, planDigest: plan.planDigest, ...(gitSha ? { gitSha } : {}), ...(decision.approvedBy ? { approver: decision.approvedBy } : {}), ...risk });
|
|
4239
4350
|
}
|
|
4240
4351
|
return requests;
|
|
4241
4352
|
}
|
|
@@ -4252,15 +4363,25 @@ async function writeStepReleases(port, ctx, requests) {
|
|
|
4252
4363
|
async function submitStepReleases(port, requests, label, log) {
|
|
4253
4364
|
if (requests.length === 0)
|
|
4254
4365
|
return [];
|
|
4366
|
+
// #5387: the change risk first, so the release records' push carries it. One that is not written fails the wave:
|
|
4367
|
+
// a later stage would read the release as carrying no score and ask for fewer approvals than the score would.
|
|
4368
|
+
const lost = [];
|
|
4369
|
+
if (port.recordRisk && requests.some((r) => r.risk)) {
|
|
4370
|
+
try {
|
|
4371
|
+
await port.recordRisk([...requests]);
|
|
4372
|
+
}
|
|
4373
|
+
catch (err) {
|
|
4374
|
+
lost.push(`${label}: applied, and the change risk was not written beside its release records, so the wave fails rather than leave a release that carries no score: ${err instanceof Error ? err.message : String(err)}`);
|
|
4375
|
+
}
|
|
4376
|
+
}
|
|
4255
4377
|
let outcomes;
|
|
4256
4378
|
try {
|
|
4257
4379
|
outcomes = await port.record([...requests]);
|
|
4258
4380
|
}
|
|
4259
4381
|
catch (err) {
|
|
4260
4382
|
log(`${label}: applied, and no release record was written: ${err instanceof Error ? err.message : String(err)}`);
|
|
4261
|
-
return
|
|
4383
|
+
return lost;
|
|
4262
4384
|
}
|
|
4263
|
-
const lost = [];
|
|
4264
4385
|
for (const [i, req] of requests.entries()) {
|
|
4265
4386
|
const got = outcomes[i];
|
|
4266
4387
|
if (got?.recorded)
|
|
@@ -4544,9 +4665,11 @@ export async function recordOpWaveHeadPlans(options) {
|
|
|
4544
4665
|
for (let k = 1;; k++) {
|
|
4545
4666
|
const wave = spec.waves[k - 1] ?? last;
|
|
4546
4667
|
const steps = new Map();
|
|
4547
|
-
|
|
4668
|
+
// #5433: each run's environment from the run hooks, which the cost hold redacts as the wave job's does.
|
|
4669
|
+
const runEnv = new Map();
|
|
4670
|
+
const { members, extras: planExtras, waves: found, changeSet } = await planWaveRuns({ spec, k, wave, cwd, exec, options, steps, runEnv }, wave.runs, wave.discover === true);
|
|
4548
4671
|
// #4545: a cost hold's member is in the digest the merged wave decides, so the head's digest carries it too.
|
|
4549
|
-
const cost = spec.holds?.cost ? costVerdictOf(spec.holds.cost, spec, k, members, steps, cwd, options.holdExec).member : undefined;
|
|
4672
|
+
const cost = spec.holds?.cost ? costVerdictOf(spec.holds.cost, spec, k, members, steps, cwd, options.holdExec, runEnv).member : undefined;
|
|
4550
4673
|
const extras = cost ? [...(planExtras ?? []), cost] : planExtras;
|
|
4551
4674
|
// #4630: the facts a gate policy reads, so the approval status before merge says which waves will wait.
|
|
4552
4675
|
plans.waves.push({
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A wave's soak in front of the next wave (#5326).
|
|
3
|
+
*
|
|
4
|
+
* Wave `k`'s job reads the soak wave `k - 1` declares, before it plans. The
|
|
5
|
+
* clock starts at that wave's newest apply on the run ledger (the run
|
|
6
|
+
* records `chant run wave` appends under the spec's name): each target it
|
|
7
|
+
* applied is a member that applied at the record's end. While the soak
|
|
8
|
+
* holds, the job records the pending fact of gate `<gate>-wave-<k-1>-soak`
|
|
9
|
+
* under the spec's name and exits 3 with the time left, so the waves after
|
|
10
|
+
* it wait as they do for a gate. Running the job again reads the clock and
|
|
11
|
+
* the checks again; approving that gate ends the soak early. The wave's own
|
|
12
|
+
* gate still decides after it.
|
|
13
|
+
*
|
|
14
|
+
* A canary wave (#5327, `OpWave.canary`, the first wave) holds every wave
|
|
15
|
+
* after it, not only the next: each later wave's job reads the canary's
|
|
16
|
+
* soak through the same gate, `<gate>-wave-1-soak`, before the soak of the
|
|
17
|
+
* wave just before it. It is one soak with one clock and one early end.
|
|
18
|
+
*/
|
|
19
|
+
import { type GateLedgerPort } from "./gate.js";
|
|
20
|
+
import { type OpWavesSpec } from "./op-waves.js";
|
|
21
|
+
import type { OpRunRecord } from "./runtime.js";
|
|
22
|
+
import { type SoakGateOutcome } from "../pipeline/soak-gate.js";
|
|
23
|
+
import type { SoakCheckReader, SoakSubject } from "../pipeline/soak.js";
|
|
24
|
+
/** What the wave that soaks applied: the members and when, and the digest an early end binds; null when the ledger has no run of it. */
|
|
25
|
+
export interface WaveSoakApplied {
|
|
26
|
+
subjects: SoakSubject[];
|
|
27
|
+
digest: string;
|
|
28
|
+
}
|
|
29
|
+
/** The test seams of a wave's soak. */
|
|
30
|
+
export interface OpWaveSoakOptions {
|
|
31
|
+
read?: SoakCheckReader;
|
|
32
|
+
applied?: (wave: number) => Promise<WaveSoakApplied | null>;
|
|
33
|
+
now?: Date;
|
|
34
|
+
}
|
|
35
|
+
/** The newest run of wave `k` of `spec` on the run records: its applied targets at the record's end, and the set digest it applied under. */
|
|
36
|
+
export declare function waveSoakAppliedFrom(records: readonly OpRunRecord[], spec: Pick<OpWavesSpec, "name">, k: number): WaveSoakApplied | null;
|
|
37
|
+
/**
|
|
38
|
+
* The waves whose soak wave `k`'s job reads before it plans, 1-based, in
|
|
39
|
+
* order: the canary wave (#5327) when wave `k` comes after it, and the wave
|
|
40
|
+
* just before `k` when it declares a soak (#5326). One wave is read once,
|
|
41
|
+
* through its one gate, so the canary's soak right before wave 2 is the
|
|
42
|
+
* same hold wave 3 reads.
|
|
43
|
+
*/
|
|
44
|
+
export declare function opWaveSoaksBefore(spec: Pick<OpWavesSpec, "waves">, k: number): number[];
|
|
45
|
+
/**
|
|
46
|
+
* The soaks in front of wave `k` ({@link opWaveSoaksBefore}): undefined when
|
|
47
|
+
* there is none or each passed, else the result the job ends with (exit 3)
|
|
48
|
+
* for the first that holds. `log` gets each line.
|
|
49
|
+
*/
|
|
50
|
+
export declare function opWaveSoakStop(input: {
|
|
51
|
+
spec: OpWavesSpec;
|
|
52
|
+
k: number;
|
|
53
|
+
cwd: string;
|
|
54
|
+
gates?: GateLedgerPort;
|
|
55
|
+
soak?: OpWaveSoakOptions;
|
|
56
|
+
log: (line: string) => void;
|
|
57
|
+
}): Promise<SoakGateOutcome | undefined>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A wave's soak in front of the next wave (#5326).
|
|
3
|
+
*
|
|
4
|
+
* Wave `k`'s job reads the soak wave `k - 1` declares, before it plans. The
|
|
5
|
+
* clock starts at that wave's newest apply on the run ledger (the run
|
|
6
|
+
* records `chant run wave` appends under the spec's name): each target it
|
|
7
|
+
* applied is a member that applied at the record's end. While the soak
|
|
8
|
+
* holds, the job records the pending fact of gate `<gate>-wave-<k-1>-soak`
|
|
9
|
+
* under the spec's name and exits 3 with the time left, so the waves after
|
|
10
|
+
* it wait as they do for a gate. Running the job again reads the clock and
|
|
11
|
+
* the checks again; approving that gate ends the soak early. The wave's own
|
|
12
|
+
* gate still decides after it.
|
|
13
|
+
*
|
|
14
|
+
* A canary wave (#5327, `OpWave.canary`, the first wave) holds every wave
|
|
15
|
+
* after it, not only the next: each later wave's job reads the canary's
|
|
16
|
+
* soak through the same gate, `<gate>-wave-1-soak`, before the soak of the
|
|
17
|
+
* wave just before it. It is one soak with one clock and one early end.
|
|
18
|
+
*/
|
|
19
|
+
import { createHash } from "node:crypto";
|
|
20
|
+
import { fetchLifecycle } from "../lifecycle/git.js";
|
|
21
|
+
import { DEFAULT_RUN_ENV, readRunLedger } from "../lifecycle/run-ledger.js";
|
|
22
|
+
import { activeProductWords } from "../ci-product-words.js";
|
|
23
|
+
import { gitGateLedgerPort } from "./gate.js";
|
|
24
|
+
import { opWaveGateName } from "./op-waves.js";
|
|
25
|
+
import { soakAtGate, waveSoakGate } from "../pipeline/soak-gate.js";
|
|
26
|
+
import { soakCheckReader } from "../pipeline/soak-checks.js";
|
|
27
|
+
import { jobSoakSources } from "../pipeline/soak-sources.js";
|
|
28
|
+
/** The newest run of wave `k` of `spec` on the run records: its applied targets at the record's end, and the set digest it applied under. */
|
|
29
|
+
export function waveSoakAppliedFrom(records, spec, k) {
|
|
30
|
+
const runs = records
|
|
31
|
+
.filter((r) => r.wave?.spec === spec.name && r.wave.number === k && (r.wave.applied.length > 0 || r.wave.failed.length > 0 || r.wave.exitCode === 0))
|
|
32
|
+
.sort((a, b) => Date.parse(a.ended) - Date.parse(b.ended));
|
|
33
|
+
const newest = runs.at(-1);
|
|
34
|
+
if (!newest?.wave)
|
|
35
|
+
return null;
|
|
36
|
+
const w = newest.wave;
|
|
37
|
+
const subjects = w.applied.map((t) => ({ member: t, targets: [t], appliedAt: newest.ended }));
|
|
38
|
+
const digest = w.digest ?? `sha256:${createHash("sha256").update(JSON.stringify([spec.name, k, newest.ended, [...w.applied].sort()])).digest("hex")}`;
|
|
39
|
+
return { subjects, digest };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The waves whose soak wave `k`'s job reads before it plans, 1-based, in
|
|
43
|
+
* order: the canary wave (#5327) when wave `k` comes after it, and the wave
|
|
44
|
+
* just before `k` when it declares a soak (#5326). One wave is read once,
|
|
45
|
+
* through its one gate, so the canary's soak right before wave 2 is the
|
|
46
|
+
* same hold wave 3 reads.
|
|
47
|
+
*/
|
|
48
|
+
export function opWaveSoaksBefore(spec, k) {
|
|
49
|
+
const out = [];
|
|
50
|
+
const canary = spec.waves[0]?.canary === true && spec.waves[0].soak !== undefined ? 1 : undefined;
|
|
51
|
+
if (canary !== undefined && k > canary)
|
|
52
|
+
out.push(canary);
|
|
53
|
+
if (k > 1 && spec.waves[k - 2]?.soak !== undefined && !out.includes(k - 1))
|
|
54
|
+
out.push(k - 1);
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The soaks in front of wave `k` ({@link opWaveSoaksBefore}): undefined when
|
|
59
|
+
* there is none or each passed, else the result the job ends with (exit 3)
|
|
60
|
+
* for the first that holds. `log` gets each line.
|
|
61
|
+
*/
|
|
62
|
+
export async function opWaveSoakStop(input) {
|
|
63
|
+
for (const j of opWaveSoaksBefore(input.spec, input.k)) {
|
|
64
|
+
const held = await waveSoakStop(input, j);
|
|
65
|
+
if (held)
|
|
66
|
+
return held;
|
|
67
|
+
}
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
/** The soak of wave `j` in front of wave `k`. */
|
|
71
|
+
async function waveSoakStop(input, j) {
|
|
72
|
+
const { spec, k, cwd, log } = input;
|
|
73
|
+
const before = spec.waves[j - 1];
|
|
74
|
+
if (!before?.soak)
|
|
75
|
+
return undefined;
|
|
76
|
+
const what = `wave ${j} (${before.name})${before.canary ? ", the canary," : ""}`;
|
|
77
|
+
const env = spec.labels?.Env ?? DEFAULT_RUN_ENV;
|
|
78
|
+
const applied = input.soak?.applied
|
|
79
|
+
? await input.soak.applied(j)
|
|
80
|
+
: await (async () => {
|
|
81
|
+
await fetchLifecycle({ cwd }).catch(() => false);
|
|
82
|
+
return waveSoakAppliedFrom((await readRunLedger(env, spec.name, { cwd })).records, spec, j);
|
|
83
|
+
})();
|
|
84
|
+
if (applied && applied.subjects.length === 0) {
|
|
85
|
+
log(`${what} applied nothing on its last run, so it has nothing to soak`);
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
const words = activeProductWords();
|
|
89
|
+
const outcome = await soakAtGate({
|
|
90
|
+
op: spec.name,
|
|
91
|
+
gate: waveSoakGate(opWaveGateName(spec, j)),
|
|
92
|
+
soak: before.soak,
|
|
93
|
+
stage: env,
|
|
94
|
+
holds: `wave ${k} (${spec.waves[k - 1]?.name ?? k})`,
|
|
95
|
+
wave: j,
|
|
96
|
+
digest: applied?.digest ?? `sha256:${createHash("sha256").update(JSON.stringify([spec.name, j, "no-run"])).digest("hex")}`,
|
|
97
|
+
subjects: applied?.subjects ?? [],
|
|
98
|
+
port: input.gates ?? gitGateLedgerPort({ cwd }),
|
|
99
|
+
read: input.soak?.read ?? soakCheckReader(jobSoakSources({ op: spec.name, cwd })),
|
|
100
|
+
now: input.soak?.now ?? new Date(),
|
|
101
|
+
...(spec.notify ? { notify: { config: spec.notify, source: words.notify.source, project: spec.name } } : {}),
|
|
102
|
+
});
|
|
103
|
+
if (outcome.passed) {
|
|
104
|
+
for (const line of outcome.lines)
|
|
105
|
+
log(`wave ${k}: ${line}`);
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
log(`wave ${k}: ${outcome.message}`);
|
|
109
|
+
log(`wave ${k}: ${outcome.hint}`);
|
|
110
|
+
return outcome;
|
|
111
|
+
}
|
|
@@ -119,3 +119,7 @@ export declare function opWaveSplitLastJobs(spec: Pick<OpWavesSpec, "waves">): s
|
|
|
119
119
|
export declare function opWaveSplitJobLabel(spec: string, job: Pick<OpWaveSplitJob, "phase" | "wave" | "waveName" | "share" | "group">): string;
|
|
120
120
|
/** The split jobs of wave `k`, by name, for a job after it (an apply status). */
|
|
121
121
|
export declare function opWaveSplitWaveJobs(jobs: readonly OpWaveSplitJob[], k: number): string[];
|
|
122
|
+
/**
|
|
123
|
+
* The first chant whose before-merge split jobs carry `agentFacts` (#5406): the gate and record jobs, which respond for a wave, hold `CHANT_AGENT_FACTS` and the relay key on their command step, so a failed apply records its fact for the failed-apply agent as a wave job does.
|
|
124
|
+
*/
|
|
125
|
+
export declare const OP_WAVES_SPLIT_AGENT_FACTS_FLOOR = "0.124.110";
|
|
@@ -164,3 +164,7 @@ export function opWaveSplitJobLabel(spec, job) {
|
|
|
164
164
|
export function opWaveSplitWaveJobs(jobs, k) {
|
|
165
165
|
return jobs.filter((j) => j.wave === k).map((j) => j.jobName);
|
|
166
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* The first chant whose before-merge split jobs carry `agentFacts` (#5406): the gate and record jobs, which respond for a wave, hold `CHANT_AGENT_FACTS` and the relay key on their command step, so a failed apply records its fact for the failed-apply agent as a wave job does.
|
|
169
|
+
*/
|
|
170
|
+
export const OP_WAVES_SPLIT_AGENT_FACTS_FLOOR = "0.124.110";
|
package/dist/op/op-waves.d.ts
CHANGED
|
@@ -88,13 +88,15 @@
|
|
|
88
88
|
* resolution that cites it and the wave goes on, and any other answer refuses
|
|
89
89
|
* the wave (exit 8). See `./op-waves-run.ts`.
|
|
90
90
|
*/
|
|
91
|
+
import { type Soak } from "../pipeline/soak.js";
|
|
91
92
|
import type { OpEnvironment, OpSetupStep, OpWaveJobInputs } from "../lexicon.js";
|
|
92
93
|
import type { CiRunner } from "../ci-jobs.js";
|
|
93
94
|
import type { CloudTradeSpec } from "../ci-identity.js";
|
|
94
95
|
import { type GatePoint } from "./gate-point.js";
|
|
95
|
-
import { type
|
|
96
|
+
import { type GateQuorumNode } from "./gate-quorum.js";
|
|
96
97
|
import { type NotifyConfig } from "../notify.js";
|
|
97
98
|
import type { CiResponses } from "../ci-respond.js";
|
|
99
|
+
import { type WaveSummarySpec } from "../ci-respond-summary-env.js";
|
|
98
100
|
import { type OpWavesEvidence } from "./op-waves-evidence-spec.js";
|
|
99
101
|
import { type OpWaveHolds, type OpWaveStep } from "./op-waves-capability-spec.js";
|
|
100
102
|
import { type OpWaveReleaseNames } from "./op-waves-release.js";
|
|
@@ -108,6 +110,13 @@ export type { OpWaveCostFormat, OpWaveCostHold, OpWaveHolds, OpWaveStep } from "
|
|
|
108
110
|
* `dist/notify.js` (#3803), which only a packed release carries.
|
|
109
111
|
*/
|
|
110
112
|
export { notifyVariables } from "../notify.js";
|
|
113
|
+
/**
|
|
114
|
+
* The variables a wave job carries for `wave-refused: summary` (#5335): the
|
|
115
|
+
* spec's `waveSummary` as `CHANT_WAVE_SUMMARY_*` and, on GitHub and Forgejo,
|
|
116
|
+
* the model's key from the secret of its name. Empty unless the spec's
|
|
117
|
+
* `respond` sets `"wave-refused": "summary"`, so other specs render as before.
|
|
118
|
+
*/
|
|
119
|
+
export declare function opWavesSummaryEnv(spec: Pick<OpWavesSpec, "respond" | "waveSummary">, forge: "github" | "gitlab" | "forgejo"): Record<string, string>;
|
|
111
120
|
/** When a wave waits for an approval. */
|
|
112
121
|
export type OpWaveGatePolicy =
|
|
113
122
|
/** Whenever the wave changes something. */
|
|
@@ -409,6 +418,32 @@ export interface OpWave {
|
|
|
409
418
|
* with the wave's own `shares` (a group has its own) or `rest`.
|
|
410
419
|
*/
|
|
411
420
|
jobs?: OpWaveJobGroup[];
|
|
421
|
+
/**
|
|
422
|
+
* Failed runs the wave tolerates (#5324): a whole number of runs, or a
|
|
423
|
+
* share of its runs as `"<n>%"`. Read at the base commit with the gate.
|
|
424
|
+
* A wave whose failed runs are within it exits as applied, so the waves
|
|
425
|
+
* after it go on; each failed run is still recorded as failed, and blocks
|
|
426
|
+
* the runs that depend on it. Default 0: any failed run fails the wave.
|
|
427
|
+
*/
|
|
428
|
+
failureTolerance?: number | `${number}%`;
|
|
429
|
+
/**
|
|
430
|
+
* The wave's soak (#5326): checks that must keep passing for a duration
|
|
431
|
+
* after this wave applied, before the next wave's job plans. That job
|
|
432
|
+
* exits 3 while the soak holds, with the time left, and records the
|
|
433
|
+
* pending fact of gate `<gate>-wave-<k>-soak` (`k` this wave), through
|
|
434
|
+
* which a person ends the soak early. Read at base. The last wave has
|
|
435
|
+
* none: the stage's soak holds what comes after it.
|
|
436
|
+
*/
|
|
437
|
+
soak?: Soak;
|
|
438
|
+
/**
|
|
439
|
+
* The canary wave (#5327): the members that apply first, in a wave of
|
|
440
|
+
* their own, as a product's `waves.canary` puts them. Only the first wave
|
|
441
|
+
* takes it. Its soak holds every wave after it: each later wave's job
|
|
442
|
+
* reads that soak before it plans, through the same gate
|
|
443
|
+
* `<gate>-wave-1-soak`, so a job run out of order waits too. A canary
|
|
444
|
+
* wave with no soak checks holds nothing, and the generator warns.
|
|
445
|
+
*/
|
|
446
|
+
canary?: boolean;
|
|
412
447
|
}
|
|
413
448
|
/**
|
|
414
449
|
* An ordered list of waves of Op runs, as a pipeline and as the file its jobs
|
|
@@ -582,12 +617,27 @@ export interface OpWavesSpec {
|
|
|
582
617
|
notify?: NotifyConfig;
|
|
583
618
|
/**
|
|
584
619
|
* The responses a wave job posts (#4629, `../ci-respond.ts`): a refused
|
|
585
|
-
* wave's diff (`wave-refused: diff`, on by default
|
|
620
|
+
* wave's diff (`wave-refused: diff`, on by default, or `summary` with a
|
|
621
|
+
* model's summary above it, #5335) and a failed apply's
|
|
586
622
|
* triage (`apply-failed: triage`, on by default), on the pull request the
|
|
587
623
|
* wave applies or a tracking issue. `off` turns one off. A job's
|
|
588
624
|
* `CHANT_RESPOND` sits under these.
|
|
589
625
|
*/
|
|
590
626
|
respond?: CiResponses;
|
|
627
|
+
/**
|
|
628
|
+
* The members whose dependents are planned again when one of their
|
|
629
|
+
* outputs changes after an apply (#5345): member names, or patterns where
|
|
630
|
+
* `*` matches within one path segment and `**` across. Read by `chant
|
|
631
|
+
* components replan` (`../components/upstream-replan.ts`), which only
|
|
632
|
+
* plans: the plan waits at its gate. Absent: none.
|
|
633
|
+
*/
|
|
634
|
+
replanDependents?: string[];
|
|
635
|
+
/**
|
|
636
|
+
* The model run of `wave-refused: summary` (#5335, `../ci-respond-summary.ts`):
|
|
637
|
+
* its command, key variable, timeout and daily limits. Read only with that
|
|
638
|
+
* mode; the generated wave jobs carry it ({@link opWavesSummaryEnv}).
|
|
639
|
+
*/
|
|
640
|
+
waveSummary?: WaveSummarySpec;
|
|
591
641
|
/**
|
|
592
642
|
* The control repo (#4617, `@intentius/chant/ci-control`): once the last
|
|
593
643
|
* wave ran, a `control-dispatch` job tells the control repo how the waves
|
|
@@ -726,9 +776,11 @@ export interface OpWavesApprovals {
|
|
|
726
776
|
* wave is judged by. A role, or `notAuthor`, counts only a proven
|
|
727
777
|
* approver: a seal that verifies against the signers at base, or under
|
|
728
778
|
* `pr-review` the merged pull request's review. `notAuthor` reads the
|
|
729
|
-
* author from that pull request.
|
|
779
|
+
* author from that pull request. A rule with `proven` (#5349) counts only
|
|
780
|
+
* proven approvers toward its `count`. Rules combine in `all` and `any`
|
|
781
|
+
* groups and take a `name` (#5354). See `./gate-quorum.ts`.
|
|
730
782
|
*/
|
|
731
|
-
quorum?:
|
|
783
|
+
quorum?: GateQuorumNode[];
|
|
732
784
|
/**
|
|
733
785
|
* The op whose ledger (`_gates/<op>.jsonl` on `chant/lifecycle`) holds the
|
|
734
786
|
* reviews a product records itself (#4333): lines with `via: "pr-review"`,
|
|
@@ -861,6 +913,17 @@ export declare function opWaveOutcomePath(spec: Pick<OpWavesSpec, "name">, wave:
|
|
|
861
913
|
share?: number;
|
|
862
914
|
apply?: boolean;
|
|
863
915
|
}): string;
|
|
916
|
+
/** Whether a wave's `failureTolerance` reads (#5324): a whole number, or `"<n>%"` from 0 to 100. */
|
|
917
|
+
export declare function opWaveFailureToleranceReads(value: unknown): boolean;
|
|
918
|
+
/** How many failed runs of a wave of `runs` its `failureTolerance` lets through (#5324). */
|
|
919
|
+
export declare function opWaveToleratedFailures(tolerance: number | string | undefined, runs: number): number;
|
|
920
|
+
/**
|
|
921
|
+
* Warnings for a spec's canary wave (#5327), one line each: a canary wave
|
|
922
|
+
* with no soak checks, which holds nothing once it applies, and a canary
|
|
923
|
+
* that is the only wave, which has nothing after it to hold. The spec is
|
|
924
|
+
* not refused: a product's `waves.canary` orders the waves as it did.
|
|
925
|
+
*/
|
|
926
|
+
export declare function opWavesCanaryWarnings(spec: Pick<OpWavesSpec, "waves">): string[];
|
|
864
927
|
/** Refuse a spec no job could run, naming what is wrong. */
|
|
865
928
|
export declare function assertOpWavesSpec(spec: OpWavesSpec): void;
|
|
866
929
|
/** 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). */
|