@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
|
@@ -397,6 +397,71 @@
|
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
},
|
|
400
|
+
"cost": {
|
|
401
|
+
"type": "object",
|
|
402
|
+
"description": "Added within contract version 1 by #5334, written by the chant that carries COST_ESTIMATE_FLOOR. The plan's cost estimate under ci.cost at base: the command run over each member's plan document, the sum, and with approveAbove whether the plan needs an approval of its own digest. The policy reads the same record as input.cost. Absent when the base sets no ci.cost, or the stage reached no plan to price.",
|
|
403
|
+
"required": ["estimator", "format", "currency", "monthlyDelta", "members", "unestimated", "approveAbove", "over"],
|
|
404
|
+
"additionalProperties": false,
|
|
405
|
+
"properties": {
|
|
406
|
+
"estimator": { "type": "string", "description": "The command's first word." },
|
|
407
|
+
"format": { "enum": ["infracost", "chant"] },
|
|
408
|
+
"currency": { "type": "string" },
|
|
409
|
+
"monthlyDelta": { "type": "number", "description": "The monthly change summed over the members priced." },
|
|
410
|
+
"monthlyTotal": { "type": "number", "description": "The monthly cost once the plan applies, when every member priced gave one." },
|
|
411
|
+
"pastMonthlyTotal": { "type": "number", "description": "The monthly cost before it, when every member priced gave one." },
|
|
412
|
+
"members": {
|
|
413
|
+
"type": "array",
|
|
414
|
+
"items": {
|
|
415
|
+
"type": "object",
|
|
416
|
+
"required": ["member"],
|
|
417
|
+
"additionalProperties": false,
|
|
418
|
+
"properties": {
|
|
419
|
+
"member": { "type": "string" },
|
|
420
|
+
"monthlyDelta": { "type": "number" },
|
|
421
|
+
"monthlyTotal": { "type": "number" },
|
|
422
|
+
"pastMonthlyTotal": { "type": "number" },
|
|
423
|
+
"currency": { "type": "string" },
|
|
424
|
+
"error": { "type": "string", "description": "Why the member has no estimate." }
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
"unestimated": { "type": "array", "items": { "type": "string" }, "description": "The members with no estimate, sorted." },
|
|
429
|
+
"approveAbove": { "type": ["number", "null"], "description": "ci.cost.approveAbove at base, or null." },
|
|
430
|
+
"over": { "type": "boolean", "description": "With approveAbove: the change is over it, or a member has no estimate." }
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
"risk": {
|
|
434
|
+
"type": "object",
|
|
435
|
+
"description": "Added within contract version 1 by #5325, written by the chant that carries CHANGE_RISK_FLOOR. The change risk under ci.risk at base: the score from 0 to 1, its level, each reason with its weight, value and contribution, and whether a threshold is crossed. The policy reads the same record as input.risk, and the stored change set keeps it. Absent when the base sets no ci.risk, or the stage reached no plan to score.",
|
|
436
|
+
"required": ["version", "score", "level", "reasons", "approveAbove", "over", "overBy"],
|
|
437
|
+
"additionalProperties": false,
|
|
438
|
+
"properties": {
|
|
439
|
+
"version": { "const": 1 },
|
|
440
|
+
"score": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
441
|
+
"level": { "enum": ["low", "medium", "high"] },
|
|
442
|
+
"reasons": {
|
|
443
|
+
"type": "array",
|
|
444
|
+
"items": {
|
|
445
|
+
"type": "object",
|
|
446
|
+
"required": ["id", "weight", "value", "contribution", "detail"],
|
|
447
|
+
"additionalProperties": false,
|
|
448
|
+
"properties": {
|
|
449
|
+
"id": { "type": "string", "description": "destroys, replacements, disruption.destroy, disruption.rolling, disruption.unknown, sql.destructive, members, environments, dependents, review, or question.<id>." },
|
|
450
|
+
"weight": { "type": "number" },
|
|
451
|
+
"count": { "type": "integer", "minimum": 0 },
|
|
452
|
+
"value": { "type": "number" },
|
|
453
|
+
"contribution": { "type": "number" },
|
|
454
|
+
"detail": { "type": "string" },
|
|
455
|
+
"answer": { "oneOf": [{ "type": "number" }, { "const": "unknown" }] },
|
|
456
|
+
"approveAbove": { "type": "number" }
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
"approveAbove": { "type": ["number", "null"] },
|
|
461
|
+
"over": { "type": "boolean" },
|
|
462
|
+
"overBy": { "type": "array", "items": { "type": "string" } }
|
|
463
|
+
}
|
|
464
|
+
},
|
|
400
465
|
"policy": {
|
|
401
466
|
"type": "object",
|
|
402
467
|
"description": "Added within contract version 1 by #4294, written by chant 0.124.41 and newer. What ci.policy in the workspace declaration at base said about the change set. Absent when the base sets no policy, or the stage reached no plan to judge.",
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
* A component's own `environments` (`component.schema.json`) say where its
|
|
10
10
|
* release is hosted in each environment and never set the order.
|
|
11
11
|
*
|
|
12
|
-
* `canary` marks a step as the canary step.
|
|
13
|
-
*
|
|
12
|
+
* `canary` marks a step as the canary step. An `environments` entry has no
|
|
13
|
+
* soak to hold the steps after it, so `chant lint` warns on one (COR027).
|
|
14
|
+
* In a pipeline (`../pipeline/stages.ts`), the canary stage's soak holds
|
|
15
|
+
* every stage after it (#5327), and the step carries that stage's mark.
|
|
14
16
|
*/
|
|
15
17
|
import { type EnvironmentDeclaration } from "../config.js";
|
|
16
18
|
/** One step of a member's promotion order. */
|
|
@@ -18,6 +20,17 @@ export interface PromotionStep {
|
|
|
18
20
|
name: string;
|
|
19
21
|
/** True when the entry sets `canary: true`. */
|
|
20
22
|
canary: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* A pipeline stage's hold or freeze window now (#5354): until when (null
|
|
25
|
+
* when only a change to the pipeline lifts it), why, and what the person
|
|
26
|
+
* who lifts it reads first. Absent when the stage is open.
|
|
27
|
+
*/
|
|
28
|
+
held?: {
|
|
29
|
+
kind: "hold" | "freeze";
|
|
30
|
+
until: string | null;
|
|
31
|
+
reason?: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
};
|
|
21
34
|
}
|
|
22
35
|
/** The member's promotion order from its config's `environments`; `[]` when it declares none. A repeated name keeps its first place. */
|
|
23
36
|
export declare function promotionOrder(declared: readonly EnvironmentDeclaration[] | null | undefined): PromotionStep[];
|
|
@@ -32,8 +45,10 @@ export declare function promotionOrder(declared: readonly EnvironmentDeclaration
|
|
|
32
45
|
*/
|
|
33
46
|
export declare function staticPromotionOrder(source: string): PromotionStep[] | undefined;
|
|
34
47
|
/**
|
|
35
|
-
* One member's promotion order
|
|
36
|
-
*
|
|
48
|
+
* One member's promotion order: the stages of its `.chant/pipeline.ts` when
|
|
49
|
+
* it has one (#5324), else its config's `environments`. `[]` when it has
|
|
50
|
+
* none or declares no environments, and null when the config can't be read
|
|
51
|
+
* or the pipeline does not fold.
|
|
37
52
|
* A TypeScript config is read as text when it is plain ({@link staticPromotionOrder}),
|
|
38
53
|
* and loaded otherwise.
|
|
39
54
|
*/
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
* A component's own `environments` (`component.schema.json`) say where its
|
|
10
10
|
* release is hosted in each environment and never set the order.
|
|
11
11
|
*
|
|
12
|
-
* `canary` marks a step as the canary step.
|
|
13
|
-
*
|
|
12
|
+
* `canary` marks a step as the canary step. An `environments` entry has no
|
|
13
|
+
* soak to hold the steps after it, so `chant lint` warns on one (COR027).
|
|
14
|
+
* In a pipeline (`../pipeline/stages.ts`), the canary stage's soak holds
|
|
15
|
+
* every stage after it (#5327), and the step carries that stage's mark.
|
|
14
16
|
*/
|
|
15
17
|
import { existsSync, readFileSync } from "node:fs";
|
|
16
18
|
import { join } from "node:path";
|
|
@@ -72,13 +74,33 @@ export function staticPromotionOrder(source) {
|
|
|
72
74
|
return promotionOrder(entries);
|
|
73
75
|
}
|
|
74
76
|
/**
|
|
75
|
-
* One member's promotion order
|
|
76
|
-
*
|
|
77
|
+
* One member's promotion order: the stages of its `.chant/pipeline.ts` when
|
|
78
|
+
* it has one (#5324), else its config's `environments`. `[]` when it has
|
|
79
|
+
* none or declares no environments, and null when the config can't be read
|
|
80
|
+
* or the pipeline does not fold.
|
|
77
81
|
* A TypeScript config is read as text when it is plain ({@link staticPromotionOrder}),
|
|
78
82
|
* and loaded otherwise.
|
|
79
83
|
*/
|
|
80
84
|
export async function readMemberPromotionOrder(dir) {
|
|
81
85
|
try {
|
|
86
|
+
// #5324: a member with a pipeline takes its order from the folded stages; one that does not fold has none to read.
|
|
87
|
+
// The fold loads the TypeScript compiler, so it is imported only for a member that has the file.
|
|
88
|
+
if (existsSync(join(dir, ".chant", "pipeline.ts"))) {
|
|
89
|
+
const { readMemberPipeline } = await import("../pipeline/read.js");
|
|
90
|
+
const pipeline = readMemberPipeline(dir);
|
|
91
|
+
if (pipeline.status === "folded") {
|
|
92
|
+
// #5354: a held stage says so, with what the person who lifts the hold reads first.
|
|
93
|
+
const { stageHeldAt } = await import("../pipeline/stages.js");
|
|
94
|
+
const now = new Date();
|
|
95
|
+
return pipeline.spec.stages.map((s) => {
|
|
96
|
+
const held = stageHeldAt(s, now);
|
|
97
|
+
const { stage: _stage, ...rest } = held ?? { stage: "" };
|
|
98
|
+
return { name: s.name, canary: s.canary === true, ...(held ? { held: rest } : {}) };
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (pipeline.status === "refused")
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
82
104
|
const ts = join(dir, "chant.config.ts");
|
|
83
105
|
if (existsSync(ts)) {
|
|
84
106
|
const plain = staticPromotionOrder(readFileSync(ts, "utf-8"));
|
|
@@ -187,7 +187,16 @@ export interface TrainPromoteQuery {
|
|
|
187
187
|
readAnswers?: (cwd: string) => Promise<ControlAppliedRecord[]>;
|
|
188
188
|
/** The member links a train across repositories orders by (#5119), from the declaration unless a test passes its own. */
|
|
189
189
|
readLinks?: (cwd: string) => Promise<WorkspaceGraph["links"]>;
|
|
190
|
+
/** The hold on `env` in a member's pipeline (#5324), read at its default branch; {@link memberStageHeld} unless a test passes its own. */
|
|
191
|
+
readHeld?: (dir: string, env: string) => string | undefined;
|
|
190
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* The line saying why a member's pipeline refuses promotion into `env` now
|
|
195
|
+
* (#5324): its stage is held or in a freeze window. Read at the member's
|
|
196
|
+
* default branch, as `components promote` reads it. Undefined when the
|
|
197
|
+
* member has no pipeline, no such stage, or the stage is open.
|
|
198
|
+
*/
|
|
199
|
+
export declare function memberStageHeld(dir: string, env: string, now?: Date): string | undefined;
|
|
191
200
|
/** Sends one dispatch into a member repository: the member, its repository's URL, and what the dispatch carries. Throws when it was not taken. */
|
|
192
201
|
export type TrainDispatcher = (member: {
|
|
193
202
|
name: string;
|
|
@@ -196,6 +205,11 @@ export type TrainDispatcher = (member: {
|
|
|
196
205
|
export type TrainPromoteOutcome = {
|
|
197
206
|
kind: "refused";
|
|
198
207
|
message: string;
|
|
208
|
+
}
|
|
209
|
+
/** #5324: a member's pipeline holds or freezes the stage, so nothing was promoted. */
|
|
210
|
+
| {
|
|
211
|
+
kind: "held";
|
|
212
|
+
message: string;
|
|
199
213
|
} | {
|
|
200
214
|
kind: "planned";
|
|
201
215
|
train: ReadTrain;
|
|
@@ -36,6 +36,8 @@ import { randomUUID } from "node:crypto";
|
|
|
36
36
|
import { resolve } from "node:path";
|
|
37
37
|
import { formatError } from "../cli/format.js";
|
|
38
38
|
import { CHANT_EXIT } from "../exit-codes.js";
|
|
39
|
+
import { promoteBase, readPipelineAt } from "../pipeline/read.js";
|
|
40
|
+
import { stageHeldAt, stageHeldLine } from "../pipeline/stages.js";
|
|
39
41
|
import { computePlanDigest } from "../lifecycle/plan-digest.js";
|
|
40
42
|
import { readAllReleases, readCuts } from "../lifecycle/release-store.js";
|
|
41
43
|
import { WORKSPACE_GATE_ENV, WORKSPACE_RUN_ENV } from "../op/workspace-run-env.js";
|
|
@@ -216,6 +218,23 @@ export function releaseCovers(member, env, plan) {
|
|
|
216
218
|
return [];
|
|
217
219
|
return plan.gates.map((gate) => ({ member, op: plan.op, gate, planDigest: plan.changeSet, environment: env, releaseDigest: plan.releaseDigest }));
|
|
218
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* The line saying why a member's pipeline refuses promotion into `env` now
|
|
223
|
+
* (#5324): its stage is held or in a freeze window. Read at the member's
|
|
224
|
+
* default branch, as `components promote` reads it. Undefined when the
|
|
225
|
+
* member has no pipeline, no such stage, or the stage is open.
|
|
226
|
+
*/
|
|
227
|
+
export function memberStageHeld(dir, env, now = new Date()) {
|
|
228
|
+
const base = promoteBase(dir);
|
|
229
|
+
if (!base)
|
|
230
|
+
return undefined;
|
|
231
|
+
const read = readPipelineAt(base, dir);
|
|
232
|
+
if (read.status !== "folded")
|
|
233
|
+
return undefined;
|
|
234
|
+
const stage = read.spec.stages.find((s) => s.name === env);
|
|
235
|
+
const held = stage ? stageHeldAt(stage, now) : undefined;
|
|
236
|
+
return held ? stageHeldLine(held) : undefined;
|
|
237
|
+
}
|
|
219
238
|
const promoteArgv = (env, m, extra = []) => ["components", "promote", "--to", env, "--release", m.releaseDigest, ...extra, "--json"];
|
|
220
239
|
/** The JSON a member's promote printed, or null. */
|
|
221
240
|
function parseJson(stdout) {
|
|
@@ -284,6 +303,13 @@ export async function promoteTrain(query) {
|
|
|
284
303
|
if (missing.length > 0)
|
|
285
304
|
return { kind: "refused", message: `release train ${train.id} pins ${missing.map((m) => m.member).join(", ")}, which the workspace graph does not compose` };
|
|
286
305
|
const order = orderTargets(train.members.map((m) => ({ member: m.member, op: TRAIN_STEP_OP })), graph.links).map((t) => train.members.find((m) => m.member === t.member));
|
|
306
|
+
// #5324: a member whose pipeline holds the stage stops the train before any member deploys.
|
|
307
|
+
const readHeld = query.readHeld ?? ((dir, e) => memberStageHeld(resolve(query.cwd, dir), e));
|
|
308
|
+
for (const m of order) {
|
|
309
|
+
const held = readHeld(graph.members.find((g) => g.name === m.member).dir, query.env);
|
|
310
|
+
if (held)
|
|
311
|
+
return { kind: "held", message: `release train ${train.id}: ${m.member}'s ${held}` };
|
|
312
|
+
}
|
|
287
313
|
if (query.dryRun)
|
|
288
314
|
return { kind: "planned", train, order: order.map((m) => m.member) };
|
|
289
315
|
const id = `ws-${randomUUID()}`;
|
|
@@ -637,6 +663,12 @@ async function runTrainPromote(ctx, words) {
|
|
|
637
663
|
console.error(formatError({ message: outcome.message, hint: USAGE }));
|
|
638
664
|
return 1;
|
|
639
665
|
}
|
|
666
|
+
if (outcome.kind === "held") {
|
|
667
|
+
if (args.json)
|
|
668
|
+
console.log(JSON.stringify({ status: "held", message: outcome.message }, null, 2));
|
|
669
|
+
console.error(formatError({ message: outcome.message }));
|
|
670
|
+
return CHANT_EXIT.waiting;
|
|
671
|
+
}
|
|
640
672
|
if (outcome.kind === "idle") {
|
|
641
673
|
if (args.json)
|
|
642
674
|
console.log(JSON.stringify({ status: "idle", train: outcome.train.id, message: outcome.message }, null, 2));
|
|
@@ -247,8 +247,8 @@
|
|
|
247
247
|
"description": "ok: it ran and succeeded. failed: it ran and failed. skipped: it did not run, and skip says why. cached: a cache hit stood in for running it (#4015). gated: it stopped the run at a gate nobody has approved. waiting: it stopped the run at a decision point nobody has answered."
|
|
248
248
|
},
|
|
249
249
|
"skip": {
|
|
250
|
-
"enum": ["receipt", "resumed", "refused", "not-run", null],
|
|
251
|
-
"description": "With status skipped. receipt: the effect's receipt matched, so it had already applied. resumed: the run resumed at a later gate and carried this step's output from an earlier run. refused: it declined to go on, and message says why. not-run: an earlier step failed or stopped the run. Null when the writer does not know."
|
|
250
|
+
"enum": ["receipt", "resumed", "refused", "not-run", "environment", null],
|
|
251
|
+
"description": "With status skipped. receipt: the effect's receipt matched, so it had already applied. resumed: the run resumed at a later gate and carried this step's output from an earlier run. refused: it declined to go on, and message says why. not-run: an earlier step failed or stopped the run. environment: a gate step whose environments name others than the run's, added within contract 1 by #5401 and written by chant 0.124.110 and newer. Null when the writer does not know."
|
|
252
252
|
},
|
|
253
253
|
"durationMs": { "type": ["integer", "null"], "minimum": 0, "description": "How long it ran, or null when the writer did not time it." },
|
|
254
254
|
"error": { "type": "string", "description": "With status failed, what failed." },
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads between workspace members, on the composed graph (#5331).
|
|
3
|
+
*
|
|
4
|
+
* A member read sees one member's files, so a Pulumi program's
|
|
5
|
+
* `StackReference` to the stack another member applies cannot be resolved
|
|
6
|
+
* there. The composition can: a lexicon's `workspaceStackReads` is asked with
|
|
7
|
+
* every declared member and answers the reads it finds, and
|
|
8
|
+
* {@link placeStackReads} draws each as an edge from the reader's stack node
|
|
9
|
+
* to the upstream member's stack node, `viaAttr` naming the output read. A
|
|
10
|
+
* stack no member applies is a node with `attrs.external: true`, in the
|
|
11
|
+
* reader's member, and the edge goes to it. The edges have no `grain`,
|
|
12
|
+
* `kind: "ref"` and `origin: "declared"`. Pure.
|
|
13
|
+
*/
|
|
14
|
+
import type { LexiconStackReads } from "../lexicon.js";
|
|
15
|
+
import type { WorkspaceGraph } from "./compose-graph.js";
|
|
16
|
+
/** The id of the node a stack no member applies is drawn as. */
|
|
17
|
+
export declare const externalStackId: (name: string) => string;
|
|
18
|
+
/** Put `answer`'s stack nodes, external nodes and read edges on `graph`. */
|
|
19
|
+
export declare function placeStackReads(graph: WorkspaceGraph, answer: LexiconStackReads): void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const byString = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
2
|
+
/** The id of the node a stack no member applies is drawn as. */
|
|
3
|
+
export const externalStackId = (name) => `external:${name}`;
|
|
4
|
+
/** Put `answer`'s stack nodes, external nodes and read edges on `graph`. */
|
|
5
|
+
export function placeStackReads(graph, answer) {
|
|
6
|
+
var _a, _b, _c, _d, _e;
|
|
7
|
+
if (answer.reads.length === 0)
|
|
8
|
+
return;
|
|
9
|
+
const nodes = new Map(graph.nodes.map((n) => [n.id, n]));
|
|
10
|
+
const added = [];
|
|
11
|
+
const add = (n) => {
|
|
12
|
+
if (nodes.has(n.id))
|
|
13
|
+
return;
|
|
14
|
+
nodes.set(n.id, n);
|
|
15
|
+
added.push(n);
|
|
16
|
+
};
|
|
17
|
+
const stackOf = new Map(answer.stacks.map((s) => [s.member, s]));
|
|
18
|
+
const stackId = (member) => {
|
|
19
|
+
const s = stackOf.get(member);
|
|
20
|
+
if (!s)
|
|
21
|
+
return undefined;
|
|
22
|
+
add({ id: `${member}/${s.id}`, kind: s.kind, lexicon: answer.lexicon, attrs: s.attrs, member });
|
|
23
|
+
return `${member}/${s.id}`;
|
|
24
|
+
};
|
|
25
|
+
const edges = new Map();
|
|
26
|
+
for (const r of answer.reads) {
|
|
27
|
+
const from = stackId(r.reader);
|
|
28
|
+
if (from === undefined)
|
|
29
|
+
continue;
|
|
30
|
+
let to;
|
|
31
|
+
if (r.upstream !== undefined)
|
|
32
|
+
to = r.upstream === r.reader ? undefined : stackId(r.upstream);
|
|
33
|
+
else if (r.external !== undefined) {
|
|
34
|
+
to = externalStackId(r.external);
|
|
35
|
+
add({ id: to, kind: stackOf.get(r.reader).kind, lexicon: answer.lexicon, attrs: { external: true, stack: r.external }, member: r.reader });
|
|
36
|
+
}
|
|
37
|
+
if (to === undefined)
|
|
38
|
+
continue;
|
|
39
|
+
edges.set(`${from}\u0000${to}\u0000${r.output ?? ""}`, { from, to, kind: "ref", ...(r.output !== undefined ? { viaAttr: r.output } : {}), origin: "declared", member: r.reader });
|
|
40
|
+
}
|
|
41
|
+
if (edges.size === 0 && added.length === 0)
|
|
42
|
+
return;
|
|
43
|
+
graph.nodes = [...graph.nodes, ...added].sort((a, b) => byString(a.id, b.id));
|
|
44
|
+
for (const n of added) {
|
|
45
|
+
const m = ((_a = graph.groups.byMember)[_b = n.member] ?? (_a[_b] = []));
|
|
46
|
+
m.push(n.id);
|
|
47
|
+
m.sort(byString);
|
|
48
|
+
const l = ((_d = ((_c = graph.groups).byLexicon ?? (_c.byLexicon = {})))[_e = n.lexicon] ?? (_d[_e] = []));
|
|
49
|
+
l.push(n.id);
|
|
50
|
+
l.sort(byString);
|
|
51
|
+
}
|
|
52
|
+
const have = new Set(graph.edges.map((e) => `${e.from}\u0000${e.to}\u0000${e.viaAttr ?? ""}`));
|
|
53
|
+
graph.edges = [...graph.edges, ...[...edges].filter(([k]) => !have.has(k)).map(([, e]) => e)].sort((a, b) => byString(`${a.from}\u0000${a.to}\u0000${a.viaAttr ?? ""}`, `${b.from}\u0000${b.to}\u0000${b.viaAttr ?? ""}`));
|
|
54
|
+
}
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
* `tallyGateApprovals`, as `describeApprovalProgress` does after an approve.
|
|
19
19
|
* Its human quorum reaches back to `humanQuorumSince` (#3206), as a run's does.
|
|
20
20
|
*/
|
|
21
|
+
import type { PendingGateSoak } from "../lifecycle/gate-ledger.js";
|
|
21
22
|
import { type GateApprovalRule } from "../op/gate.js";
|
|
22
|
-
import type
|
|
23
|
+
import { type GateQuorumJudge } from "../op/gate-quorum.js";
|
|
23
24
|
import type { ReleaseRevocation } from "../lifecycle/release-revocation.js";
|
|
24
25
|
/** Why a member's gates can't be listed. Closed: a new code is a contract change. */
|
|
25
26
|
export declare const GATE_REASON_CODES: readonly ["gates-no-ledger", "gates-no-gate-ledger", "gates-ledger-unreadable"];
|
|
@@ -85,6 +86,12 @@ export interface StatusGate {
|
|
|
85
86
|
approvals: StatusGateApproval[];
|
|
86
87
|
/** How many human approvals the gate needs: its quorum's count, 1 without one. */
|
|
87
88
|
needed: number;
|
|
89
|
+
/**
|
|
90
|
+
* Where each approval rule of the gate stands, one line each (#5354),
|
|
91
|
+
* named rules by their name, then each `all`/`any` group's line. Present
|
|
92
|
+
* when the gate's rules are named or grouped.
|
|
93
|
+
*/
|
|
94
|
+
rules?: string[];
|
|
88
95
|
/**
|
|
89
96
|
* The declaration's rule for the gate (#3163, ws-080): set when
|
|
90
97
|
* `identity.gates` names it, so only an approval sealed by a signer at
|
|
@@ -110,6 +117,12 @@ export interface StatusGate {
|
|
|
110
117
|
id: string;
|
|
111
118
|
path: string;
|
|
112
119
|
};
|
|
120
|
+
/**
|
|
121
|
+
* The soak's state on the pending fact (#5326, #5342), on a soak's gate
|
|
122
|
+
* (`<stage>-soak`, `<gate>-wave-<k>-soak`): the clock, when it is up,
|
|
123
|
+
* why the run held, and the checks that failed. Absent on every other gate.
|
|
124
|
+
*/
|
|
125
|
+
soak?: PendingGateSoak;
|
|
113
126
|
}
|
|
114
127
|
/** The rule for a gate, by name, as `identity.gates` at base sets it (#3163). Null when it sets none. */
|
|
115
128
|
export type GateRuleLookup = (gate: string) => GateApprovalRule | null;
|
|
@@ -164,3 +177,40 @@ export declare function readMemberGates(dir: string, layout: "members" | "flat",
|
|
|
164
177
|
gates: StatusGate[];
|
|
165
178
|
ledger: StatusGateLedger;
|
|
166
179
|
}>;
|
|
180
|
+
/** One release as a stage's log names it (#5353). */
|
|
181
|
+
export interface StatusStageRelease {
|
|
182
|
+
/** The digest the stage gate binds: the release's, or the promoted digests'. */
|
|
183
|
+
digest: string;
|
|
184
|
+
label: string | null;
|
|
185
|
+
/** When the line was written: the release reached, entered, or was replaced at the stage. */
|
|
186
|
+
at: string;
|
|
187
|
+
}
|
|
188
|
+
/** One stage of a pipeline that keeps a stage log (#5353): the release in it, the one waiting, and those replaced. */
|
|
189
|
+
export interface StatusStageQueue {
|
|
190
|
+
/** The pipeline, the op its stage gates are recorded under. */
|
|
191
|
+
pipeline: string;
|
|
192
|
+
stage: string;
|
|
193
|
+
/** The release whose deploy into the stage started and has not finished, or null. */
|
|
194
|
+
inStage: StatusStageRelease | null;
|
|
195
|
+
/** The releases waiting for the stage, oldest first. */
|
|
196
|
+
waiting: StatusStageRelease[];
|
|
197
|
+
/** The waiting releases a newer one replaced, oldest first, each with the release that replaced it. */
|
|
198
|
+
replaced: (StatusStageRelease & {
|
|
199
|
+
by: string;
|
|
200
|
+
byLabel: string | null;
|
|
201
|
+
})[];
|
|
202
|
+
}
|
|
203
|
+
/** Reads each pipeline's `stages.jsonl` under a gate ledger directory at `commit`: pipeline name to contents. */
|
|
204
|
+
export type StageLogReader = (gatesDir: string, commit: string, cwd: string) => Promise<Map<string, string>>;
|
|
205
|
+
export declare const defaultStageLogReader: StageLogReader;
|
|
206
|
+
/**
|
|
207
|
+
* Every stage the logs under `gatesDir` name, by pipeline then in the order first logged. Empty when none is kept.
|
|
208
|
+
*
|
|
209
|
+
* With `own` (the member's pipeline, #5419), only that pipeline's log is read, so a ledger several members share
|
|
210
|
+
* gives each its own queues, and each of the pipeline's stages is listed in pipeline order, an empty queue for a
|
|
211
|
+
* stage the log has not met. A pipeline with no log lists nothing.
|
|
212
|
+
*/
|
|
213
|
+
export declare function readMemberStageQueues(gatesDir: string, commit: string | null, cwd: string, read?: StageLogReader, own?: {
|
|
214
|
+
name: string;
|
|
215
|
+
stages: readonly string[];
|
|
216
|
+
}): Promise<StatusStageQueue[]>;
|
|
@@ -22,6 +22,7 @@ import { execFileSync } from "node:child_process";
|
|
|
22
22
|
import { samePlanDigest } from "../lifecycle/plan-digest.js";
|
|
23
23
|
import { isPendingGateExpired, latestPendingGate, latestResolutionForPlan, parseGateLedger } from "../lifecycle/gate-ledger.js";
|
|
24
24
|
import { humanQuorumSince, tallyGateApprovals } from "../op/gate.js";
|
|
25
|
+
import { quorumGroupLines, quorumRuleLine } from "../op/gate-quorum.js";
|
|
25
26
|
import { CHANGE_SETS_DIR, changeSetFile } from "../lifecycle/change-set-store.js";
|
|
26
27
|
/** The stored change-set directory beside a gate ledger directory: `<prefix>_change-sets`. */
|
|
27
28
|
function changeSetDirFor(gatesDir) {
|
|
@@ -90,6 +91,7 @@ function decide(component, standing, facts, all, now, rule, judge) {
|
|
|
90
91
|
let approved;
|
|
91
92
|
let approvals;
|
|
92
93
|
let needed = 1;
|
|
94
|
+
let rules;
|
|
93
95
|
let mismatched;
|
|
94
96
|
if (standing.approval) {
|
|
95
97
|
// #3206: a human approval from before a fact re-recorded for a mode or context change still counts.
|
|
@@ -99,6 +101,9 @@ function decide(component, standing, facts, all, now, rule, judge) {
|
|
|
99
101
|
approvals = tally.permit && !tally.counted.includes(tally.permit) ? [...tally.counted, tally.permit] : tally.counted;
|
|
100
102
|
needed = tally.need;
|
|
101
103
|
mismatched = tally.mismatched;
|
|
104
|
+
// #5354: a gate whose rules are named or grouped lists where each stands.
|
|
105
|
+
if (tally.groups || tally.rules?.some((r) => r.name !== undefined))
|
|
106
|
+
rules = [...(tally.rules ?? []).map(quorumRuleLine), ...quorumGroupLines(tally.groups)];
|
|
102
107
|
}
|
|
103
108
|
else {
|
|
104
109
|
const at = (r) => new Date(r.timestamp).getTime();
|
|
@@ -122,9 +127,11 @@ function decide(component, standing, facts, all, now, rule, judge) {
|
|
|
122
127
|
expiresAt: standing.expiresAt,
|
|
123
128
|
approvals: approvals.map(approvalOf),
|
|
124
129
|
needed,
|
|
130
|
+
...(rules ? { rules } : {}),
|
|
125
131
|
signed: rule === null ? null : { class: rule.requirement.class },
|
|
126
132
|
approve: standing.answer ? `chant workspace points answer ${standing.answer.id} --answer <value> --by <name>` : approveCommand(component, gate, env, planDigest, rule !== null),
|
|
127
133
|
...(standing.answer ? { answer: { point: standing.answer.point, id: standing.answer.id, path: standing.answer.path } } : {}),
|
|
134
|
+
...(standing.soak ? { soak: standing.soak } : {}),
|
|
128
135
|
};
|
|
129
136
|
}
|
|
130
137
|
/**
|
|
@@ -190,3 +197,56 @@ export async function readMemberGates(dir, layout, commit, envs, cwd, now, read
|
|
|
190
197
|
}
|
|
191
198
|
return { gates, ledger };
|
|
192
199
|
}
|
|
200
|
+
export const defaultStageLogReader = async (gatesDir, commit, cwd) => {
|
|
201
|
+
const out = new Map();
|
|
202
|
+
let names;
|
|
203
|
+
try {
|
|
204
|
+
names = git(cwd, ["ls-tree", "--name-only", "-r", `${commit}:${gatesDir}`]).split("\n");
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
return out;
|
|
208
|
+
}
|
|
209
|
+
for (const name of names) {
|
|
210
|
+
const m = /^([^/]+)\/stages\.jsonl$/.exec(name);
|
|
211
|
+
if (!m)
|
|
212
|
+
continue;
|
|
213
|
+
try {
|
|
214
|
+
out.set(m[1], git(cwd, ["cat-file", "blob", `${commit}:${gatesDir}/${name}`]));
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
// A log that can't be read is left out, as an unreadable change set is.
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return out;
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Every stage the logs under `gatesDir` name, by pipeline then in the order first logged. Empty when none is kept.
|
|
224
|
+
*
|
|
225
|
+
* With `own` (the member's pipeline, #5419), only that pipeline's log is read, so a ledger several members share
|
|
226
|
+
* gives each its own queues, and each of the pipeline's stages is listed in pipeline order, an empty queue for a
|
|
227
|
+
* stage the log has not met. A pipeline with no log lists nothing.
|
|
228
|
+
*/
|
|
229
|
+
export async function readMemberStageQueues(gatesDir, commit, cwd, read = defaultStageLogReader, own) {
|
|
230
|
+
if (commit === null)
|
|
231
|
+
return [];
|
|
232
|
+
const { parseStageLines, stageQueueOf, stagesInLog } = await import("../lifecycle/stage-log.js");
|
|
233
|
+
const files = await read(gatesDir, commit, cwd).catch(() => new Map());
|
|
234
|
+
const out = [];
|
|
235
|
+
for (const pipeline of [...files.keys()].sort()) {
|
|
236
|
+
if (own && pipeline !== own.name)
|
|
237
|
+
continue;
|
|
238
|
+
const lines = parseStageLines(files.get(pipeline));
|
|
239
|
+
for (const stage of own ? own.stages : stagesInLog(lines)) {
|
|
240
|
+
const q = stageQueueOf(lines, stage);
|
|
241
|
+
const view = (l) => ({ digest: l.digest, label: l.label ?? null, at: l.timestamp });
|
|
242
|
+
out.push({
|
|
243
|
+
pipeline,
|
|
244
|
+
stage,
|
|
245
|
+
inStage: q.inStage ? view(q.inStage) : null,
|
|
246
|
+
waiting: q.waiting.map(view),
|
|
247
|
+
replaced: q.replaced.map((l) => ({ ...view(l), by: l.by, byLabel: l.byLabel ?? null })),
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return out;
|
|
252
|
+
}
|