@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.
Files changed (338) hide show
  1. package/dist/__golden__/wave-loop/fan-out-applied.json +12 -6
  2. package/dist/__golden__/wave-loop/fan-out-apply-fails.json +8 -4
  3. package/dist/__golden__/wave-loop/fan-out-gated.json +4 -2
  4. package/dist/__golden__/wave-loop/fan-out-no-members.json +16 -8
  5. package/dist/__golden__/wave-loop/fan-out-plan-fails.json +8 -4
  6. package/dist/__golden__/wave-loop/fan-out-same-root.json +4 -2
  7. package/dist/agent-facts.d.ts +130 -0
  8. package/dist/agent-facts.js +196 -0
  9. package/dist/change-risk.d.ts +216 -0
  10. package/dist/change-risk.js +304 -0
  11. package/dist/change-set.d.ts +8 -0
  12. package/dist/ci-agent-alert.d.ts +139 -0
  13. package/dist/ci-agent-alert.js +342 -0
  14. package/dist/ci-agent-triggers.d.ts +152 -0
  15. package/dist/ci-agent-triggers.js +232 -0
  16. package/dist/ci-agent-verify-failed.d.ts +149 -0
  17. package/dist/ci-agent-verify-failed.js +191 -0
  18. package/dist/ci-agent.d.ts +136 -8
  19. package/dist/ci-agent.js +353 -26
  20. package/dist/ci-comment-commands.d.ts +8 -0
  21. package/dist/ci-comment-commands.js +17 -1
  22. package/dist/ci-comment-reject.d.ts +70 -0
  23. package/dist/ci-comment-reject.js +135 -0
  24. package/dist/ci-comment-replies.d.ts +3 -1
  25. package/dist/ci-comment-replies.js +6 -0
  26. package/dist/ci-estate/delivery.d.ts +25 -3
  27. package/dist/ci-estate/delivery.js +28 -9
  28. package/dist/ci-estate/page.d.ts +7 -3
  29. package/dist/ci-estate/page.js +19 -4
  30. package/dist/ci-estate/rows.d.ts +14 -2
  31. package/dist/ci-estate/rows.js +9 -1
  32. package/dist/ci-estate.d.ts +5 -2
  33. package/dist/ci-estate.js +3 -2
  34. package/dist/ci-handover.d.ts +2 -7
  35. package/dist/ci-handover.js +3 -20
  36. package/dist/ci-jobs.d.ts +6 -0
  37. package/dist/ci-jobs.js +17 -0
  38. package/dist/ci-note-commands.d.ts +2 -0
  39. package/dist/ci-note-commands.js +12 -1
  40. package/dist/ci-product-words.d.ts +151 -1
  41. package/dist/ci-product-words.js +1390 -3
  42. package/dist/ci-product.d.ts +100 -4
  43. package/dist/ci-product.js +99 -3
  44. package/dist/ci-respond-run.d.ts +9 -0
  45. package/dist/ci-respond-run.js +35 -4
  46. package/dist/ci-respond-summary-env.d.ts +56 -0
  47. package/dist/ci-respond-summary-env.js +81 -0
  48. package/dist/ci-respond-summary.d.ts +103 -0
  49. package/dist/ci-respond-summary.js +243 -0
  50. package/dist/ci-respond.d.ts +4 -2
  51. package/dist/ci-respond.js +4 -2
  52. package/dist/cli/command-group.js +1 -1
  53. package/dist/cli/commands/lint.js +21 -3
  54. package/dist/cli/handlers/agent.js +49 -4
  55. package/dist/cli/handlers/approve.js +3 -1
  56. package/dist/cli/handlers/build.d.ts +97 -1
  57. package/dist/cli/handlers/build.js +251 -3
  58. package/dist/cli/handlers/fan-out.js +55 -0
  59. package/dist/cli/handlers/graph.d.ts +14 -0
  60. package/dist/cli/handlers/graph.js +58 -3
  61. package/dist/cli/handlers/lifecycle-health.d.ts +7 -0
  62. package/dist/cli/handlers/lifecycle-health.js +47 -9
  63. package/dist/cli/handlers/lifecycle.js +4 -1
  64. package/dist/cli/handlers/notify-relay.d.ts +2 -2
  65. package/dist/cli/handlers/notify-relay.js +67 -7
  66. package/dist/cli/handlers/pipeline-agent.d.ts +30 -0
  67. package/dist/cli/handlers/pipeline-agent.js +255 -0
  68. package/dist/cli/handlers/pipeline-artifacts.d.ts +39 -0
  69. package/dist/cli/handlers/pipeline-artifacts.js +203 -0
  70. package/dist/cli/handlers/pipeline.d.ts +16 -0
  71. package/dist/cli/handlers/pipeline.js +112 -0
  72. package/dist/cli/handlers/pr-comment.js +4 -0
  73. package/dist/cli/handlers/pr-notes.js +4 -1
  74. package/dist/cli/handlers/pr.d.ts +20 -0
  75. package/dist/cli/handlers/pr.js +114 -11
  76. package/dist/cli/handlers/promote.js +792 -47
  77. package/dist/cli/handlers/reject.d.ts +84 -0
  78. package/dist/cli/handlers/reject.js +216 -0
  79. package/dist/cli/handlers/replan.d.ts +54 -0
  80. package/dist/cli/handlers/replan.js +177 -0
  81. package/dist/cli/handlers/run-generate.d.ts +5 -0
  82. package/dist/cli/handlers/run-generate.js +31 -4
  83. package/dist/cli/handlers/run-wave.js +15 -2
  84. package/dist/cli/handlers/run.js +4 -2
  85. package/dist/cli/handlers/stage.d.ts +35 -0
  86. package/dist/cli/handlers/stage.js +90 -0
  87. package/dist/cli/lsp/server.js +4 -0
  88. package/dist/cli/main.js +88 -8
  89. package/dist/cli/parse-args.js +35 -2
  90. package/dist/cli/registry.d.ts +12 -0
  91. package/dist/components/auto-release.d.ts +2 -0
  92. package/dist/components/auto-release.js +1 -0
  93. package/dist/components/capability.d.ts +40 -0
  94. package/dist/components/cli-support.d.ts +21 -1
  95. package/dist/components/cli-support.js +28 -6
  96. package/dist/components/component.d.ts +23 -4
  97. package/dist/components/component.schema.json +28 -0
  98. package/dist/components/declared-reads.d.ts +44 -4
  99. package/dist/components/declared-reads.js +80 -3
  100. package/dist/components/discover.d.ts +8 -0
  101. package/dist/components/discover.js +1 -1
  102. package/dist/components/driver.d.ts +13 -0
  103. package/dist/components/driver.js +23 -2
  104. package/dist/components/environment-sets.d.ts +229 -0
  105. package/dist/components/environment-sets.js +338 -0
  106. package/dist/components/fan-out-canary.d.ts +47 -0
  107. package/dist/components/fan-out-canary.js +58 -0
  108. package/dist/components/fan-out-run.d.ts +17 -0
  109. package/dist/components/fan-out-run.js +14 -1
  110. package/dist/components/fan-out-support.d.ts +7 -0
  111. package/dist/components/fan-out-support.js +1 -1
  112. package/dist/components/groups.d.ts +8 -1
  113. package/dist/components/groups.js +19 -1
  114. package/dist/components/index.d.ts +5 -2
  115. package/dist/components/index.js +4 -1
  116. package/dist/components/pr-cost.d.ts +28 -0
  117. package/dist/components/pr-cost.js +53 -0
  118. package/dist/components/pr-pipeline.d.ts +33 -0
  119. package/dist/components/pr-pipeline.js +32 -5
  120. package/dist/components/pr-policy.d.ts +33 -2
  121. package/dist/components/pr-policy.js +5 -2
  122. package/dist/components/pr-risk.d.ts +42 -0
  123. package/dist/components/pr-risk.js +74 -0
  124. package/dist/components/product-pipeline.d.ts +43 -0
  125. package/dist/components/product-pipeline.js +67 -1
  126. package/dist/components/promote.d.ts +6 -0
  127. package/dist/components/promote.js +13 -0
  128. package/dist/components/release-compile.js +3 -1
  129. package/dist/components/release-gate.d.ts +6 -1
  130. package/dist/components/release-gate.js +10 -2
  131. package/dist/components/step-environments.d.ts +236 -0
  132. package/dist/components/step-environments.js +392 -0
  133. package/dist/components/upstream-replan.d.ts +201 -0
  134. package/dist/components/upstream-replan.js +249 -0
  135. package/dist/components/verify-step.d.ts +30 -0
  136. package/dist/components/verify-step.js +27 -0
  137. package/dist/components/wave-plan.js +6 -2
  138. package/dist/config-environments.d.ts +4 -2
  139. package/dist/control/dispatch.d.ts +15 -0
  140. package/dist/control/dispatch.js +28 -4
  141. package/dist/cost-estimate.d.ts +188 -0
  142. package/dist/cost-estimate.js +363 -0
  143. package/dist/drift-record.d.ts +36 -0
  144. package/dist/drift-record.js +44 -0
  145. package/dist/engine-facts.d.ts +105 -0
  146. package/dist/engine-facts.js +111 -0
  147. package/dist/exit-codes.d.ts +4 -3
  148. package/dist/exit-codes.js +4 -3
  149. package/dist/flag-params.d.ts +2 -2
  150. package/dist/flag-params.js +9 -4
  151. package/dist/floor-table.data.js +53 -0
  152. package/dist/forge-token-vars.d.ts +12 -0
  153. package/dist/forge-token-vars.js +25 -0
  154. package/dist/gate-decision.d.ts +3 -1
  155. package/dist/gate-decision.js +3 -1
  156. package/dist/gated-waves.d.ts +2 -0
  157. package/dist/gated-waves.js +1 -0
  158. package/dist/graph-ir.d.ts +30 -0
  159. package/dist/graph-ir.js +33 -1
  160. package/dist/graph-refs.d.ts +26 -0
  161. package/dist/graph-refs.js +34 -3
  162. package/dist/graph-schema/graph.schema.json +136 -0
  163. package/dist/health.d.ts +65 -0
  164. package/dist/health.js +62 -0
  165. package/dist/lexicon.d.ts +188 -1
  166. package/dist/lifecycle/disruption.d.ts +14 -1
  167. package/dist/lifecycle/disruption.js +5 -1
  168. package/dist/lifecycle/gate-change-set.d.ts +8 -0
  169. package/dist/lifecycle/gate-change-set.js +2 -1
  170. package/dist/lifecycle/gate-ledger.d.ts +26 -0
  171. package/dist/lifecycle/gate-rejection.d.ts +82 -0
  172. package/dist/lifecycle/gate-rejection.js +93 -0
  173. package/dist/lifecycle/gate-seal.d.ts +3 -3
  174. package/dist/lifecycle/gate-seal.js +5 -5
  175. package/dist/lifecycle/observe.d.ts +17 -0
  176. package/dist/lifecycle/observe.js +10 -1
  177. package/dist/lifecycle/release-cut.js +4 -0
  178. package/dist/lifecycle/release-ledger.d.ts +8 -0
  179. package/dist/lifecycle/release-risk.d.ts +137 -0
  180. package/dist/lifecycle/release-risk.js +214 -0
  181. package/dist/lifecycle/release-store.d.ts +9 -0
  182. package/dist/lifecycle/release-store.js +4 -0
  183. package/dist/lifecycle/stage-log.d.ts +85 -0
  184. package/dist/lifecycle/stage-log.js +141 -0
  185. package/dist/lint/canary-checks.d.ts +31 -0
  186. package/dist/lint/canary-checks.js +45 -0
  187. package/dist/lint/rule.d.ts +1 -0
  188. package/dist/lint/rules/evl012-pipeline-fold.d.ts +14 -0
  189. package/dist/lint/rules/evl012-pipeline-fold.js +30 -0
  190. package/dist/lint/rules/index.d.ts +1 -0
  191. package/dist/lint/rules/index.js +3 -0
  192. package/dist/notify-relay-repo.d.ts +54 -0
  193. package/dist/notify-relay-repo.js +84 -0
  194. package/dist/notify-relay.d.ts +53 -3
  195. package/dist/notify-relay.js +96 -3
  196. package/dist/notify.d.ts +57 -1
  197. package/dist/notify.js +7 -1
  198. package/dist/notify.schema.json +61 -3
  199. package/dist/observation.d.ts +34 -0
  200. package/dist/observation.js +14 -1
  201. package/dist/op/activities/review-agent.d.ts +39 -2
  202. package/dist/op/activities/review-agent.js +88 -5
  203. package/dist/op/agent-permit.d.ts +88 -0
  204. package/dist/op/agent-permit.js +97 -0
  205. package/dist/op/gate-approval-base.d.ts +8 -0
  206. package/dist/op/gate-approval-base.js +9 -0
  207. package/dist/op/gate-approval.d.ts +30 -1
  208. package/dist/op/gate-approval.js +23 -2
  209. package/dist/op/gate-quorum.d.ts +114 -8
  210. package/dist/op/gate-quorum.js +198 -21
  211. package/dist/op/gate-reject.d.ts +79 -0
  212. package/dist/op/gate-reject.js +96 -0
  213. package/dist/op/gate-summary.js +1 -1
  214. package/dist/op/gate.d.ts +28 -3
  215. package/dist/op/gate.js +55 -13
  216. package/dist/op/generate-pipeline.d.ts +15 -1
  217. package/dist/op/generate-pipeline.js +32 -5
  218. package/dist/op/index.d.ts +11 -6
  219. package/dist/op/index.js +10 -5
  220. package/dist/op/local-executor.d.ts +2 -0
  221. package/dist/op/local-executor.js +23 -4
  222. package/dist/op/op-waves-after-plan.d.ts +23 -0
  223. package/dist/op/op-waves-after-plan.js +12 -1
  224. package/dist/op/op-waves-capability-spec.d.ts +14 -0
  225. package/dist/op/op-waves-capability-spec.js +46 -6
  226. package/dist/op/op-waves-capability.d.ts +21 -13
  227. package/dist/op/op-waves-capability.js +22 -59
  228. package/dist/op/op-waves-environment-sets.d.ts +41 -0
  229. package/dist/op/op-waves-environment-sets.js +82 -0
  230. package/dist/op/op-waves-quorum-warnings.d.ts +53 -0
  231. package/dist/op/op-waves-quorum-warnings.js +90 -0
  232. package/dist/op/op-waves-release-port.d.ts +7 -0
  233. package/dist/op/op-waves-release-port.js +15 -3
  234. package/dist/op/op-waves-release.d.ts +15 -0
  235. package/dist/op/op-waves-release.js +15 -0
  236. package/dist/op/op-waves-run.d.ts +37 -3
  237. package/dist/op/op-waves-run.js +141 -18
  238. package/dist/op/op-waves-soak.d.ts +57 -0
  239. package/dist/op/op-waves-soak.js +111 -0
  240. package/dist/op/op-waves-split.d.ts +4 -0
  241. package/dist/op/op-waves-split.js +4 -0
  242. package/dist/op/op-waves.d.ts +67 -4
  243. package/dist/op/op-waves.js +71 -3
  244. package/dist/pipeline/agent-ajv.d.ts +4 -0
  245. package/dist/pipeline/agent-ajv.js +14 -0
  246. package/dist/pipeline/agent-steps.d.ts +329 -0
  247. package/dist/pipeline/agent-steps.js +602 -0
  248. package/dist/pipeline/artifacts.d.ts +264 -0
  249. package/dist/pipeline/artifacts.js +425 -0
  250. package/dist/pipeline/diff.d.ts +45 -0
  251. package/dist/pipeline/diff.js +177 -0
  252. package/dist/pipeline/fold.d.ts +43 -0
  253. package/dist/pipeline/fold.js +140 -0
  254. package/dist/pipeline/generate.d.ts +52 -0
  255. package/dist/pipeline/generate.js +120 -0
  256. package/dist/pipeline/product.d.ts +225 -0
  257. package/dist/pipeline/product.js +257 -0
  258. package/dist/pipeline/promote.d.ts +404 -0
  259. package/dist/pipeline/promote.js +694 -0
  260. package/dist/pipeline/read.d.ts +37 -0
  261. package/dist/pipeline/read.js +58 -0
  262. package/dist/pipeline/rendered.d.ts +25 -0
  263. package/dist/pipeline/rendered.js +53 -0
  264. package/dist/pipeline/soak-checks.d.ts +80 -0
  265. package/dist/pipeline/soak-checks.js +254 -0
  266. package/dist/pipeline/soak-gate.d.ts +97 -0
  267. package/dist/pipeline/soak-gate.js +176 -0
  268. package/dist/pipeline/soak-sources.d.ts +17 -0
  269. package/dist/pipeline/soak-sources.js +42 -0
  270. package/dist/pipeline/soak.d.ts +260 -0
  271. package/dist/pipeline/soak.js +378 -0
  272. package/dist/pipeline/spec.d.ts +724 -0
  273. package/dist/pipeline/spec.js +567 -0
  274. package/dist/pipeline/stage-ledger.d.ts +187 -0
  275. package/dist/pipeline/stage-ledger.js +185 -0
  276. package/dist/pipeline/stage-waves.d.ts +114 -0
  277. package/dist/pipeline/stage-waves.js +161 -0
  278. package/dist/pipeline/stages.d.ts +64 -0
  279. package/dist/pipeline/stages.js +174 -0
  280. package/dist/pipeline/verify-rollback.d.ts +277 -0
  281. package/dist/pipeline/verify-rollback.js +393 -0
  282. package/dist/pipeline.d.ts +142 -0
  283. package/dist/pipeline.js +143 -0
  284. package/dist/pr-loop.d.ts +22 -0
  285. package/dist/pr-loop.js +8 -0
  286. package/dist/pr-plan-note.d.ts +15 -1
  287. package/dist/pr-plan-note.js +8 -0
  288. package/dist/pr-post.d.ts +31 -0
  289. package/dist/pr-post.js +89 -0
  290. package/dist/release-floors.d.ts +1 -1
  291. package/dist/release-floors.js +1 -1
  292. package/dist/report-store/audit.schema.json +50 -0
  293. package/dist/report-store/dora.schema.json +331 -0
  294. package/dist/report-store/estate.schema.json +96 -0
  295. package/dist/report-store/run.schema.json +14 -0
  296. package/dist/report-store.d.ts +151 -0
  297. package/dist/report-store.js +344 -0
  298. package/dist/run-event.d.ts +7 -2
  299. package/dist/wave-runtime.mjs +458 -404
  300. package/dist/workspace/catalog-edges.js +3 -3
  301. package/dist/workspace/change-set.schema.json +4 -0
  302. package/dist/workspace/ci-cloud-identity.d.ts +4 -0
  303. package/dist/workspace/ci-cloud-identity.js +30 -0
  304. package/dist/workspace/ci-run.js +17 -2
  305. package/dist/workspace/ci-secrets.d.ts +3 -1
  306. package/dist/workspace/ci-secrets.js +7 -1
  307. package/dist/workspace/compose-graph.d.ts +1 -1
  308. package/dist/workspace/compose-graph.js +3 -1
  309. package/dist/workspace/declaration.d.ts +27 -0
  310. package/dist/workspace/declaration.js +35 -0
  311. package/dist/workspace/declaration.schema.json +56 -0
  312. package/dist/workspace/graph-cli.js +26 -0
  313. package/dist/workspace/graph.schema.json +5 -1
  314. package/dist/workspace/identity-gate-rule.d.ts +4 -0
  315. package/dist/workspace/identity-gate-rule.js +2 -2
  316. package/dist/workspace/identity-reject-rule.d.ts +14 -0
  317. package/dist/workspace/identity-reject-rule.js +24 -0
  318. package/dist/workspace/identity.d.ts +3 -0
  319. package/dist/workspace/identity.js +2 -1
  320. package/dist/workspace/nested-graph.js +2 -0
  321. package/dist/workspace/pr-report.schema.json +65 -0
  322. package/dist/workspace/promotion-order.d.ts +19 -4
  323. package/dist/workspace/promotion-order.js +26 -4
  324. package/dist/workspace/release-train.d.ts +14 -0
  325. package/dist/workspace/release-train.js +32 -0
  326. package/dist/workspace/run-event.schema.json +2 -2
  327. package/dist/workspace/stack-read-edges.d.ts +19 -0
  328. package/dist/workspace/stack-read-edges.js +54 -0
  329. package/dist/workspace/status-gates.d.ts +51 -1
  330. package/dist/workspace/status-gates.js +60 -0
  331. package/dist/workspace/status-stages.d.ts +223 -0
  332. package/dist/workspace/status-stages.js +279 -0
  333. package/dist/workspace/status.d.ts +45 -1
  334. package/dist/workspace/status.js +109 -5
  335. package/dist/workspace/status.schema.json +283 -2
  336. package/dist/workspace/trust/seal.d.ts +7 -0
  337. package/dist/workspace/trust/seal.js +9 -0
  338. package/package.json +5 -1
@@ -0,0 +1,393 @@
1
+ /**
2
+ * A rollback a stage requests when its verify or its soak fails (#5328).
3
+ *
4
+ * A stage sets `onVerifyFail: "rollback"` in `.chant/pipeline.ts` to opt in.
5
+ * The default, `"hold"`, is what every stage did before: the stage stays as
6
+ * applied, or mixed, and `workspace status` prints the rollback line for a
7
+ * person to run.
8
+ *
9
+ * Two failures count:
10
+ *
11
+ * - verify: a promote into the stage failed at a verify step, as
12
+ * `isVerifyStep` (`../components/verify-step.ts`) names one: a step in a
13
+ * phase named `Verify`, or of a wait-and-verify kind. The agent trigger of
14
+ * #5339 reads a failed verify by the same function. A failed apply is not
15
+ * one, so the stage holds as before;
16
+ * - soak: a check of the stage's soak failed while a promote out of it read
17
+ * the soak (`./soak-gate.ts`).
18
+ *
19
+ * On either, {@link requestStageRollback} writes three things on the stage's
20
+ * ledger (`./stage-ledger.ts`): a `failed` line, with each member's state
21
+ * ({@link memberStateOf}); then a `rollback-requested` line bound to the
22
+ * stage's previous release, naming the members the rollback restores and
23
+ * linking the failure; and the pending fact of gate `<stage>-rollback`
24
+ * under the pipeline's op, bound to that release's digest. It sends a
25
+ * `rollback-requested` notify event, and the command exits 3.
26
+ *
27
+ * The request applies nothing. `chant components rollback <stage>
28
+ * --requested` reads it, passes it through {@link requestedRollbackGate}
29
+ * and only then runs `components rollback --release` for the members it
30
+ * names. That gate always waits for a person: a stage gate policy of `never`
31
+ * lets a promote through, and never a requested rollback. It counts the
32
+ * stage gate's approval rules and approval mode, only approvals given since
33
+ * the request, and the run spends the approval it used. The `rolled-back`
34
+ * line links the rollback to its request and its failure.
35
+ *
36
+ * No rollback is requested, and the line `rollback-held` says why, when the
37
+ * stage ran no earlier release, when the newest earlier one is revoked or
38
+ * no longer kept, or when no member left applied ran that release.
39
+ *
40
+ * The `failed` line names no rollback, so a separate reader of failures, such
41
+ * as an agent trigger, reads it on its own; whatever that reader opens, the
42
+ * request stays on the ledger until the rollback runs.
43
+ */
44
+ import { createHash } from "node:crypto";
45
+ import { gateSealRefusal } from "../lifecycle/gate-seal.js";
46
+ import { approveCommand, evaluateGate } from "../op/gate.js";
47
+ import { makeNotifyEvent, sendNotify } from "../notify.js";
48
+ /** How long a rollback request's pending fact stands. The request itself stays on the stage's ledger until the rollback runs. */
49
+ export const ROLLBACK_REQUEST_EXPIRY = "30d";
50
+ /** What a stage does when its verify or soak fails: its `onVerifyFail`, else `"hold"`. */
51
+ export function stageOnVerifyFail(stage) {
52
+ return stage?.onVerifyFail ?? "hold";
53
+ }
54
+ /** The gate a stage's requested rollback passes, under the pipeline's op. */
55
+ export function stageRollbackGate(stage) {
56
+ return `${stage}-rollback`;
57
+ }
58
+ /** The command that carries out a stage's requested rollback once its gate passes. */
59
+ export function requestedRollbackCommand(stage) {
60
+ return `chant components rollback ${stage} --requested`;
61
+ }
62
+ /**
63
+ * The state a run left one member in, from its result: `applied` when it
64
+ * deployed; for a failed or gated one, `left-applied` when a step's change
65
+ * stays (a `rollback-opted-out` record, an undo that failed, or a step that
66
+ * ran before a gate stopped it), `rolled-back` when each step that ran was
67
+ * undone, and `not-applied` when nothing of it ran.
68
+ */
69
+ export function memberStateOf(result) {
70
+ if (!result)
71
+ return "not-applied";
72
+ if (result.status === "ok")
73
+ return "applied";
74
+ const records = result.records;
75
+ if (records.some((r) => r.status === "rollback-opted-out"))
76
+ return "left-applied";
77
+ // The forward failure is one `fail` record; another is an undo that failed.
78
+ if (records.filter((r) => r.status === "fail").length > 1)
79
+ return "left-applied";
80
+ if (records.some((r) => r.status === "rolled-back"))
81
+ return "rolled-back";
82
+ if (result.status === "gated" && records.some((r) => r.status === "ok" && !r.kind.startsWith("gate:")))
83
+ return "left-applied";
84
+ return "not-applied";
85
+ }
86
+ /** Each planned member's state after a run, in plan order. */
87
+ export function memberStatesOf(members, results) {
88
+ return members.map((member) => ({ member, state: memberStateOf(results.find((r) => r.component === member)) }));
89
+ }
90
+ /**
91
+ * The stage a held promotion's soak failure rolls back, and its members, or
92
+ * undefined when the soak held for its clock or for a check that could not
93
+ * be read (#5328). The stage is the one whose soak held (`heldBy`), which on
94
+ * a later promote can be a canary upstream rather than the stage promoted
95
+ * from or into.
96
+ */
97
+ export function soakFailureOf(outcome) {
98
+ if (outcome.passed || !outcome.heldBy)
99
+ return undefined;
100
+ return outcome.decision.holds.some((h) => h.reason === "check" && h.status === "failed") ? outcome.heldBy : undefined;
101
+ }
102
+ /** The lines a failed run's records give, one per failed step: `<member> <phase>/<kind>: <error>`. */
103
+ export function failureDetail(results) {
104
+ const out = [];
105
+ for (const result of results) {
106
+ if (result.status !== "fail")
107
+ continue;
108
+ const failed = result.records.find((r) => r.status === "fail");
109
+ if (failed)
110
+ out.push(`${result.component} ${failed.phase}/${failed.kind}: ${failed.error ?? "failed"}`);
111
+ }
112
+ return out;
113
+ }
114
+ /**
115
+ * The release the stage ran before the one that failed: the newest release
116
+ * its ledger names outside `exclude`. Unlike `rollbackTarget`, a revoked or
117
+ * no longer kept release is not passed over for an older one; it is the
118
+ * answer, so the hold can say which release it is.
119
+ */
120
+ export async function previousRelease(input) {
121
+ const newest = input.records
122
+ .map((r, i) => ({ r, i }))
123
+ .filter(({ r }) => r.releaseDigest !== undefined && !input.exclude.has(r.releaseDigest))
124
+ .sort((a, b) => (a.r.timestamp === b.r.timestamp ? b.i - a.i : a.r.timestamp < b.r.timestamp ? 1 : -1))[0];
125
+ if (!newest)
126
+ return { status: "none" };
127
+ const digest = newest.r.releaseDigest;
128
+ const release = { digest, label: input.label?.(digest) ?? null };
129
+ const check = await input.check(digest);
130
+ if (!check.kept)
131
+ return { status: "not-kept", release };
132
+ if (check.revoked !== null)
133
+ return { status: "revoked", release, reason: check.revoked };
134
+ return { status: "found", release };
135
+ }
136
+ /** Why no rollback is requested, as the `rollback-held` line and the promote say it. */
137
+ export function heldReason(stage, previous) {
138
+ const name = (r) => r.label ?? r.digest;
139
+ if (previous.status === "none")
140
+ return `stage ${stage} ran no earlier release, so there is nothing to roll back to`;
141
+ if (previous.status === "revoked")
142
+ return `stage ${stage}'s earlier release ${name(previous.release)} is revoked (${previous.reason}), so it is not restored`;
143
+ return `stage ${stage}'s earlier release ${name(previous.release)} is no longer kept, so it cannot be restored`;
144
+ }
145
+ /**
146
+ * Which members a rollback to `to` restores: each member left `applied` or
147
+ * `left-applied` that ran release `to` in the stage. Every other member is
148
+ * listed with why it is not restored.
149
+ */
150
+ export function rollbackMembers(states, records, to) {
151
+ return states.map((s) => {
152
+ if (s.state === "rolled-back")
153
+ return { ...s, rollback: "its own steps were undone when it failed" };
154
+ if (s.state === "not-applied")
155
+ return { ...s, rollback: "nothing of it applied" };
156
+ // As `planReleaseRollback` reads it (`isApplyRecord`): a record that only says the component applied restores nothing.
157
+ const ran = records.some((r) => r.component === s.member && r.releaseDigest === to.digest && r.digestKind !== "plan" && r.digestKind !== "deploy-input");
158
+ return ran ? { ...s, rollback: "requested" } : { ...s, rollback: `it never ran release ${to.label ?? to.digest} in this stage` };
159
+ });
160
+ }
161
+ /** The `failed` lines of a stage's ledger, oldest first: what a separate trigger reads. */
162
+ export function stageFailures(lines) {
163
+ return lines.filter((l) => l.kind === "failed");
164
+ }
165
+ /**
166
+ * The newest rollback request no `rolled-back` line has answered, or
167
+ * undefined. With `failed`, only a request for that failed release counts.
168
+ */
169
+ export function standingRollbackRequest(lines, failed) {
170
+ const done = new Set(lines.filter((l) => l.kind === "rolled-back" && l.requestId).map((l) => l.requestId));
171
+ return [...lines].reverse().find((l) => l.kind === "rollback-requested" && l.id !== undefined && !done.has(l.id) && (failed === undefined || l.failed?.digest === failed));
172
+ }
173
+ /** A line's id: a digest of what it says and when. */
174
+ function lineId(parts) {
175
+ return createHash("sha256").update(JSON.stringify(parts)).digest("hex").slice(0, 16);
176
+ }
177
+ /** One line in the words a person reads: each member and what the rollback does with it. */
178
+ export function memberLines(members) {
179
+ return members.map((m) => `${m.member}: ${m.state}${m.rollback === undefined ? "" : m.rollback === "requested" ? ", rolled back by the request" : `, not rolled back: ${m.rollback}`}`);
180
+ }
181
+ /** Write a stage's failure and its rollback request. See the module comment. */
182
+ export async function requestStageRollback(input) {
183
+ const stage = input.spec.stages.find((s) => s.name === input.stage);
184
+ if (stageOnVerifyFail(stage) !== "rollback")
185
+ return { status: "hold" };
186
+ const { spec, stages, now } = input;
187
+ const at = now.toISOString();
188
+ const gate = stageRollbackGate(input.stage);
189
+ const lines = await stages.read(spec.name, input.stage);
190
+ const standing = standingRollbackRequest(lines, input.failed.digest);
191
+ if (standing) {
192
+ return {
193
+ status: "standing",
194
+ request: standing,
195
+ exitCode: 3,
196
+ lines: [`the rollback of stage ${input.stage} to ${standing.release?.label ?? standing.release?.digest} requested at ${standing.timestamp} still waits at ${spec.name} ${gate}`, ...memberLines(standing.members ?? [])],
197
+ hint: requestHint(spec.name, input.stage, standing.release, stage),
198
+ };
199
+ }
200
+ const base = { version: 1, pipeline: spec.name, stage: input.stage, by: input.by, timestamp: at };
201
+ const failureId = lineId([spec.name, input.stage, input.failure, input.failed.digest, at]);
202
+ const failure = { ...base, kind: "failed", id: failureId, failure: input.failure, failed: input.failed, members: [...input.members], ...(input.detail.length > 0 ? { detail: [...input.detail] } : {}) };
203
+ await stages.append(failure);
204
+ const previous = await previousRelease({ records: input.records, exclude: input.exclude, check: input.check, ...(input.label ? { label: input.label } : {}) });
205
+ const failedLine = `${input.failure === "verify" ? "a verify" : "a soak check"} failed in stage ${input.stage} on ${input.failed.label ?? input.failed.digest}`;
206
+ const held = async (reason, members) => {
207
+ await stages.append({ ...base, kind: "rollback-held", failureId, held: reason });
208
+ return { status: "held", failure, reason, lines: [failedLine, ...memberLines(members)] };
209
+ };
210
+ if (previous.status !== "found")
211
+ return held(heldReason(input.stage, previous), input.members);
212
+ const members = rollbackMembers(input.members, input.records, previous.release);
213
+ if (!members.some((m) => m.rollback === "requested")) {
214
+ return held(`no member of stage ${input.stage} that the failure left applied ran release ${previous.release.label ?? previous.release.digest}, so none is rolled back`, members);
215
+ }
216
+ const requestId = lineId([spec.name, input.stage, "rollback", previous.release.digest, failureId]);
217
+ const request = { ...base, kind: "rollback-requested", id: requestId, failureId, failed: input.failed, release: previous.release, members, gate };
218
+ await stages.append(request);
219
+ // The gate's pending fact, so the approval waits where every other approval waits.
220
+ const what = previous.release.label ?? previous.release.digest;
221
+ await evaluateGate(input.gates, {
222
+ op: spec.name,
223
+ gate,
224
+ planDigest: previous.release.digest,
225
+ releaseDigest: previous.release.digest,
226
+ environment: input.stage,
227
+ now: at,
228
+ timeout: ROLLBACK_REQUEST_EXPIRY,
229
+ description: `roll stage ${input.stage} back to release ${what} after ${input.failure === "verify" ? "a failed verify" : "a failed soak check"}: ${members.filter((m) => m.rollback === "requested").map((m) => m.member).join(", ")}`,
230
+ ...(input.gitSha ? { gitSha: input.gitSha } : {}),
231
+ ...(stage?.gate?.quorum && stage.gate.quorum.length > 0 ? { approval: { quorum: stage.gate.quorum, mode: "enforce" } } : {}),
232
+ });
233
+ const hint = requestHint(spec.name, input.stage, previous.release, stage);
234
+ if (input.notify) {
235
+ const event = makeNotifyEvent({
236
+ source: input.notify.source,
237
+ event: "rollback-requested",
238
+ project: spec.name,
239
+ environment: input.stage,
240
+ summary: `${failedLine}; a rollback to release ${what} waits for an approval at ${spec.name} ${gate}`,
241
+ targets: members.filter((m) => m.rollback === "requested").map((m) => m.member),
242
+ digest: previous.release.digest,
243
+ approve: { command: approveCommand(spec.name, gate, input.stage, previous.release.digest, stage?.gate?.approval === "sealed") },
244
+ rollback: {
245
+ stage: input.stage,
246
+ failure: input.failure,
247
+ failed: input.failed,
248
+ to: previous.release,
249
+ gate,
250
+ members: members.map((m) => ({ member: m.member, state: m.state, ...(m.rollback !== undefined ? { rollback: m.rollback } : {}) })),
251
+ ...(input.detail.length > 0 ? { detail: [...input.detail] } : {}),
252
+ },
253
+ reason: failedLine,
254
+ exitCode: 3,
255
+ // One request is one event, so a receiver drops a repeat send of it.
256
+ id: requestId,
257
+ }, { now });
258
+ try {
259
+ await (input.notify.send ?? sendNotify)(input.notify.config, event);
260
+ }
261
+ catch {
262
+ // A notice never changes the outcome.
263
+ }
264
+ }
265
+ return {
266
+ status: "requested",
267
+ request,
268
+ failure,
269
+ exitCode: 3,
270
+ lines: [failedLine, `requested the rollback of stage ${input.stage} to release ${what}; it waits at ${spec.name} ${gate}`, ...memberLines(members)],
271
+ hint,
272
+ };
273
+ }
274
+ function requestHint(pipeline, stage, to, spec) {
275
+ return `Approve it with: ${approveCommand(pipeline, stageRollbackGate(stage), stage, to.digest, spec?.gate?.approval === "sealed")}, then run: ${requestedRollbackCommand(stage)}`;
276
+ }
277
+ /**
278
+ * The gate a requested rollback passes before it applies: gate
279
+ * `<stage>-rollback` under the pipeline's op, bound to the release it goes
280
+ * back to, with the stage gate's approval rules and mode. It always waits
281
+ * for a person, whatever the stage's gate policy, and counts only an
282
+ * approval given since the request and not spent by an earlier rollback.
283
+ */
284
+ export async function requestedRollbackGate(input) {
285
+ const { spec, port, request } = input;
286
+ const stage = spec.stages.find((s) => s.name === input.stage);
287
+ const gate = stageRollbackGate(input.stage);
288
+ const to = request.release;
289
+ const sealed = stage?.gate?.approval === "sealed";
290
+ const own = (await port.approvalRule?.(gate)) ?? null;
291
+ // #5354: under `sealed`, only an approval whose seal verifies at base counts, as at the stage's own gate.
292
+ let rule = own;
293
+ if (sealed) {
294
+ const signers = input.proof?.signers;
295
+ const refuses = (a) => (signers ? gateSealRefusal(signers, a) : "no signers at base prove a seal");
296
+ rule = own ? { requirement: own.requirement, refuses: (a) => own.refuses(a) ?? refuses(a) } : { requirement: { gate, class: null }, refuses };
297
+ }
298
+ const approval = stage?.gate?.quorum && stage.gate.quorum.length > 0 ? { quorum: stage.gate.quorum, mode: "enforce" } : undefined;
299
+ const spent = (await port.readApplied?.(spec.name)) ?? [];
300
+ const waiting = {
301
+ passed: false,
302
+ exitCode: 3,
303
+ code: "pipeline-rollback-waiting",
304
+ message: `the rollback of stage ${input.stage} to release ${to.label ?? to.digest} waits for an approval at ${spec.name} ${gate}`,
305
+ hint: `Approve it with: ${approveCommand(spec.name, gate, input.stage, to.digest, sealed)}, then run this again`,
306
+ };
307
+ const got = await evaluateGate(port, {
308
+ rule,
309
+ op: spec.name,
310
+ gate,
311
+ planDigest: to.digest,
312
+ releaseDigest: to.digest,
313
+ environment: input.stage,
314
+ now: input.now.toISOString(),
315
+ timeout: ROLLBACK_REQUEST_EXPIRY,
316
+ spent,
317
+ description: `roll stage ${input.stage} back to release ${to.label ?? to.digest}`,
318
+ ...(input.gitSha ? { gitSha: input.gitSha } : {}),
319
+ ...(approval ? { approval } : {}),
320
+ });
321
+ if (!got.satisfied)
322
+ return waiting;
323
+ // Only a person's approval given since the request counts: an approval the gate kept from before, or a policy's permit, does not.
324
+ if (Date.parse(got.resolution.timestamp) < Date.parse(request.timestamp) || got.via === "policy" || got.via === "empty")
325
+ return waiting;
326
+ return { passed: true, approval: got.resolution, lines: [`${spec.name} ${gate}: approved by ${got.resolution.resolvedBy}`] };
327
+ }
328
+ /** The step kind whose change no earlier release takes back. */
329
+ export const MIGRATION_STEP_KIND = "sql-migrate";
330
+ /**
331
+ * Why `chant build` refuses `onVerifyFail: "rollback"` on a stage (#5328),
332
+ * one line per step; empty when nothing refuses. A requested rollback is
333
+ * `components rollback --release`, which applies the files an earlier
334
+ * release recorded, so each step the stage applies has to be one that
335
+ * applying an earlier release restores:
336
+ *
337
+ * - a `sql-migrate` step is refused: a migration that ran stays run;
338
+ * - a step whose kind no registered capability has is refused, since
339
+ * nothing says what it does;
340
+ * - a step whose capability changes nothing (`none-by-design`) passes;
341
+ * - any other step passes only when its capability answers `releaseInputs`,
342
+ * as `terraform-apply` and `pulumi-up` do. Without it, the release records
343
+ * none of its files and the rollback has nothing of it to apply.
344
+ *
345
+ * A step's `noRollback` decides nothing here: it says the capability does not
346
+ * undo a failed apply, and the rollback is a forward apply of the earlier
347
+ * release, not an undo.
348
+ */
349
+ export function verifyRollbackProblems(input) {
350
+ const stages = input.spec.stages.filter((s) => stageOnVerifyFail(s) === "rollback");
351
+ if (stages.length === 0)
352
+ return [];
353
+ const why = (step) => {
354
+ if (step.kind === MIGRATION_STEP_KIND)
355
+ return "it runs migrations, and applying an earlier release does not take back a migration that ran";
356
+ const capability = input.capability(step.kind);
357
+ if (!capability)
358
+ return `no capability of kind "${step.kind}" is registered, so nothing says whether an earlier release restores it`;
359
+ if (capability.rollbackPolicy === "none-by-design")
360
+ return undefined;
361
+ if (!capability.releaseInputs)
362
+ return `its kind "${step.kind}" answers no releaseInputs, so a release records none of its files and components rollback --release has nothing of it to apply`;
363
+ return undefined;
364
+ };
365
+ const out = [];
366
+ for (const step of input.steps) {
367
+ const reason = why(step);
368
+ if (!reason)
369
+ continue;
370
+ for (const stage of stages)
371
+ out.push(`stage "${stage.name}" sets onVerifyFail: "rollback", and ${step.where} cannot be rolled back that way: ${reason}; set onVerifyFail to "hold" on it`);
372
+ }
373
+ return out;
374
+ }
375
+ /** The line a requested rollback that ran writes: the members it restored, linked to its request and failure. */
376
+ export function rolledBackLine(input) {
377
+ const { request } = input;
378
+ return {
379
+ version: 1,
380
+ kind: "rolled-back",
381
+ pipeline: request.pipeline,
382
+ stage: request.stage,
383
+ by: input.by,
384
+ timestamp: input.now.toISOString(),
385
+ ...(request.id ? { requestId: request.id } : {}),
386
+ ...(request.failureId ? { failureId: request.failureId } : {}),
387
+ ...(request.release ? { release: request.release } : {}),
388
+ ...(request.failed ? { failed: request.failed } : {}),
389
+ members: (request.members ?? []).filter((m) => m.rollback === "requested"),
390
+ gate: stageRollbackGate(request.stage),
391
+ approval: { by: input.approval.resolvedBy, at: input.approval.timestamp, ...(input.approval.note ? { note: input.approval.note } : {}) },
392
+ };
393
+ }
@@ -0,0 +1,142 @@
1
+ /**
2
+ * `@intentius/chant/pipeline` (#5324): one TypeScript declaration of a
3
+ * member's delivery pipeline, its stages in promotion order and the waves
4
+ * inside each, folded to a spec before anything runs.
5
+ *
6
+ * A member's `.chant/pipeline.ts` holds the declaration:
7
+ *
8
+ * ```ts
9
+ * import { pipeline } from "@intentius/chant/pipeline";
10
+ *
11
+ * export default pipeline({
12
+ * name: "shop",
13
+ * defaults: { op: "shop", step: { kind: "pulumi-up", stack: "{target}" } },
14
+ * stages: [
15
+ * { name: "dev", waves: [{ name: "dev", runs: [{ target: "dev" }] }], gate: { policy: "never" } },
16
+ * { name: "prod", waves: [{ name: "prod", runs: [{ target: "prod" }] }], gate: { quorum: [{ count: 2 }] } },
17
+ * ],
18
+ * });
19
+ * ```
20
+ *
21
+ * `chant build` folds it (`./pipeline/fold.ts`) and writes the spec to
22
+ * `.chant/pipeline.json`; a file outside the TypeScript-as-data subset is
23
+ * refused with the evaluability rule's id. See the pipeline guide.
24
+ */
25
+ import type { PipelineDeclaration } from "./pipeline/spec.js";
26
+ /**
27
+ * The first chant with the pipeline declaration (#5324): `.chant/pipeline.ts`
28
+ * folded by `chant build`, `chant pipeline spec` and `chant pipeline
29
+ * generate`, stage gates, holds and freeze windows on `components promote`,
30
+ * a wave's `failureTolerance`, and the product helpers here. A product
31
+ * feature-detects the pipeline on this name.
32
+ */
33
+ export declare const PIPELINE_FLOOR = "0.124.110";
34
+ /**
35
+ * The first chant whose pipeline helpers carry a product's job image and
36
+ * install lines and its stage risk and replan keys (#5425): `pipelineFromConfig`
37
+ * maps `environments.<name>.risk` and `replan_dependents`, and the pipeline
38
+ * generator gives the promote, recheck and agent jobs the `image` and
39
+ * `beforeScript` the wave jobs already take, on GitHub, GitLab and Forgejo.
40
+ */
41
+ export declare const PIPELINE_PRODUCT_JOBS_FLOOR = "0.124.110";
42
+ /**
43
+ * The first chant with stages that follow several stages and stages that
44
+ * take one release at a time (#5353): a stage's `after` and `queue` in
45
+ * `.chant/pipeline.ts`, a cycle among stages refused at build, the stage
46
+ * log `components promote` writes at `_gates/<pipeline>/stages.jsonl`, and
47
+ * `stageQueues` in `chant workspace status --json`. A product
48
+ * feature-detects the keys on this name before it writes them.
49
+ */
50
+ export declare const STAGE_GRAPH_FLOOR = "0.124.110";
51
+ /**
52
+ * The first chant whose `workspace status --json` lists `stageQueues` for every stage of each member's pipeline in one read (#5419), each queue on the member whose pipeline it belongs to, also when members share a ledger. A product reads every stage's queue from one status call on this name.
53
+ */
54
+ export declare const STATUS_STAGE_QUEUES_FLOOR = "0.124.110";
55
+ /**
56
+ * The first chant that pauses and resumes a pipeline stage and has its urgent path (#5355): `chant stage pause` and `resume` on the stage's ledger, a paused stage refusing promotion with exit 3, a stage's `pauseAfterRollback`, and a gate's `urgent` rule that `chant components promote --urgent` passes on one proven approval from its role, with the `urgent` notify event.
57
+ */
58
+ export declare const STAGE_PAUSE_URGENT_FLOOR = "0.124.110";
59
+ /**
60
+ * The first chant whose release carries its change risk (#5387): a wave
61
+ * that scores its change set under `holds.risk` writes the record beside its
62
+ * release records, `chant release cut` binds the commit's records to the
63
+ * release on its cut line, and `components promote --release` reads it at
64
+ * each stage gate whose `holds.risk` is set, adding the risk's approval rules
65
+ * over the threshold. The plan note shows how each later stage reads the
66
+ * plan's score, and `workspace status` each cut's. A product feature-detects
67
+ * a later stage's `holds.risk` on this name.
68
+ */
69
+ export declare const RELEASE_RISK_FLOOR = "0.124.110";
70
+ /**
71
+ * The first chant with soaks (#5326): a stage's and a wave's `soak` in
72
+ * `.chant/pipeline.ts` (a duration, checks of the kinds `http`,
73
+ * `prometheus`, `cloudwatch-alarm`, `command`, `health`, `drift`, `apply`
74
+ * and `policy`, each `restart` or `hold` on failure, and overrides by member
75
+ * glob), the `<stage>-soak` gate a person ends one early through, the `soak`
76
+ * notify event, the pipeline's `recheck` schedule with `components promote
77
+ * --pending`, and `decideSoak` for a product that decides a soak itself. A
78
+ * product feature-detects soaks on this name before it writes the keys.
79
+ */
80
+ export declare const SOAK_FLOOR = "0.124.110";
81
+ /**
82
+ * The first chant that enforces the canary (#5327): a stage's `canary` in
83
+ * `.chant/pipeline.ts` holds every stage after it through its soak
84
+ * (`canaryStagesBefore`, `pipelinePromoteSoaks`), and a canary stage takes
85
+ * a soak with checks; an op wave's `canary` marker (`OpWave.canary`, the
86
+ * first wave) holds every later wave's job through its soak, takes its
87
+ * stage's soak when it declares none, and warns with no checks
88
+ * (`opWavesCanaryWarnings`); `components fan-out --canary --wave-gate`
89
+ * holds the waves after the canary through the soak of the pipeline stage
90
+ * it runs in; and lint warns (COR027) on a canary in `environments`. A
91
+ * product feature-detects the marker on this name before it sets it from
92
+ * its `waves.canary`.
93
+ */
94
+ export declare const CANARY_FLOOR = "0.124.110";
95
+ /**
96
+ * The first chant whose stage can request its rollback when its verify or
97
+ * soak fails (#5328): a stage's `onVerifyFail: "hold" | "rollback"` in
98
+ * `.chant/pipeline.ts`, the build's refusal of `rollback` on a stage with a
99
+ * `sql-migrate` step or a step whose kind answers no `releaseInputs`, the
100
+ * `failed`, `rollback-requested`, `rollback-held` and `rolled-back` lines
101
+ * on the stage's ledger, gate `<stage>-rollback`, the `rollback-requested`
102
+ * notify event, and `chant components rollback <stage> --requested`. A
103
+ * product feature-detects the key on this name before it writes it.
104
+ */
105
+ export declare const VERIFY_ROLLBACK_FLOOR = "0.124.110";
106
+ /**
107
+ * The first chant whose `workspace status` shows each pipeline stage
108
+ * (#5342): `members[].pipeline` in `--json`, one entry per stage with the
109
+ * release it runs, its gate, the change risk the gate reads, its soak and
110
+ * the time left, the canary soaks that hold it, a pause and a rollback
111
+ * request, and `soak` on a soak gate's entry in `gates`; the text view adds
112
+ * one line per stage. A product or a dashboard feature-detects the fields
113
+ * on this name.
114
+ */
115
+ export declare const STAGE_STATUS_FLOOR = "0.124.110";
116
+ /**
117
+ * The declaration, typed. It returns its argument: the fold reads the
118
+ * argument's text, and a run that imports the file gets the same object.
119
+ */
120
+ export declare function pipeline(declaration: PipelineDeclaration): PipelineDeclaration;
121
+ export * from "./pipeline/spec.js";
122
+ export { foldPipelineSource, pipelineFindingLine, PIPELINE_FOLD_RULE, PIPELINE_MODULE, type PipelineFinding, type PipelineFold } from "./pipeline/fold.js";
123
+ export { artifactsPublishHook, promotionOrderOf, pipelineStage, releaseCutHook, stageHeldAt, stageHeldLine, stageWavesName, stageWavesSpec, type StageHeld } from "./pipeline/stages.js";
124
+ export { gitShowPipeline, promoteBase, readMemberPipeline, readPipelineAt, type PipelineRead, type PipelineShow } from "./pipeline/read.js";
125
+ export { pipelineStageSpecFile } from "./pipeline/generate.js";
126
+ export { pipelineStageShow, PROMOTE_STAGE_WAVES_FLOOR, runStageWaves, stageReleaseItems, stageRunSpec, stageRunsWaves, type StageWaveRan, type StageWavesRun } from "./pipeline/stage-waves.js";
127
+ export { isReleaseRisk, laterStageRisk, laterStageRiskLines, readReleaseRisk, releaseRiskAt, releaseRiskOf, riskAtThreshold, stageRiskRead, stageRiskSettings, RELEASE_RISK_DIR, type ReleaseRisk, type StageRiskRead, type StageRiskSettings, type StageRiskView, type WaveRisk, type WaveRiskLine, } from "./lifecycle/release-risk.js";
128
+ export { lineDiff, pipelineChange, pipelineChangeSection, pipelineSoakSection, pipelineSpecLines, type PipelineChange } from "./pipeline/diff.js";
129
+ export { decideSoak, soakCheckCount, soakCheckName, soakDurationMs, soakGlobMatch, soakHoldLines, soakOnFail, soakProblems, soakRuleFor, soakSpan, soakSummary, SOAK_CHECK_KINDS, SOAK_MEMBER_KINDS, type DecideSoakInput, type Soak, type SoakCheck, type SoakCheckContext, type SoakCheckKind, type SoakCheckReader, type SoakCheckResult, type SoakClockState, type SoakDecision, type SoakHold, type SoakOnFail, type SoakOverride, type SoakRule, type SoakSubject, } from "./pipeline/soak.js";
130
+ export { driftNamedTargets, healthVerdict, runRecordSoakSources, soakCheckReader, type SoakApplyState, type SoakDenial, type SoakExecResult, type SoakSources } from "./pipeline/soak-checks.js";
131
+ export { soakAtGate, stageSoakGate, waveSoakGate, SOAK_FACT_EXPIRY, type SoakGateInput, type SoakGateOutcome } from "./pipeline/soak-gate.js";
132
+ export { pipelinePromoteSoak, pipelinePromoteSoaks, type SoakHeldBy } from "./pipeline/promote.js";
133
+ export { opWavesCanaryWarnings } from "./op/op-waves.js";
134
+ export { gitStageArtifactPort, parseStageArtifactRecords, publishStageArtifacts, readStageArtifacts, releaseCutFrom, resolveStageReads, stageArtifactsNote, stageArtifactsSpecProblems, stageArtifactText, stagePublishProblems, stageReadsProblems, withStageReadVariables, STAGE_ARTIFACT_MAX_BYTES, STAGE_ARTIFACTS_FILE, STAGE_ARTIFACTS_FLOOR, STAGE_ARTIFACTS_KIND, STAGE_ARTIFACTS_RELEASE_ENV, type MemberOutputs, type PublishStageArtifactsInput, type PublishStageArtifactsResult, type ResolvedStageRead, type StageArtifactEntry, type StageArtifactPort, type StageArtifactRead, type StageArtifactRecord, type StageArtifactSource, type StageArtifactValue, type StageReadsResult, } from "./pipeline/artifacts.js";
135
+ export { pipelinePromoteAgentSteps, pipelinePromoteGates, pipelinePromoteSource, pipelineStageEntry, pipelineStageFinished, promotedDigest, type AgentPolicyVerdict, type PipelineAgentStepsOutcome, type PipelineEntryOutcome, type PipelineEntryRelease, type PipelineGatesOutcome, type PipelinePromoteStop, } from "./pipeline/promote.js";
136
+ export { gitStageLogPort, memoryStageLogPort, parseStageLines, replacedIn, stageLogPath, stageQueueOf, stagesInLog, succeededIn, type StageLine, type StageLogPort, type StageQueue, } from "./lifecycle/stage-log.js";
137
+ export { pipelineUrgentGate, pipelineUrgentUpstream, urgentGateName, urgentUpstreamStages, urgentUpstreamStop, type PipelineUrgentOutcome, } from "./pipeline/promote.js";
138
+ export { gitStageLedgerPort, memoryStageLedgerPort, parseStagePauseLines, pauseLine, releaseMissingIn, resumeLine, stagePaused, stagePausedLine, supersededBy, waitingLine, waitingReleases, STAGE_LEDGER_FILE, STAGE_LINE_KINDS, type StageLedgerPort, type StageLineKind, type StageMemberState, type StageMemberStateName, type StagePauseLine, type StageRelease, } from "./pipeline/stage-ledger.js";
139
+ export { agentAnswerProblems, agentStepGateRule, agentStepRiskLevels, agentStepSchemaDigest, agentStepSettings, checkedAgentAnswer, gitStageAgentAnswerPort, parseStageAgentAnswerRecords, readStageAgentAnswers, runStageAgentSteps, stageAgentKeyEnvs, stageAgentPolicyInput, stageAgentSteps, stageAgentStepsHold, stageAgentStepsProblems, stageAgentStepsSpecProblems, AGENT_STEP_KEY_ENV, AGENT_STEP_TIMEOUT_MINUTES, AGENT_STEP_TRIGGER, STAGE_AGENT_ANSWER_KIND, STAGE_AGENT_ANSWERS_FILE, STAGE_AGENT_STEPS_FLOOR, type AgentStepModel, type AgentStepRead, type AgentStepSettings, type PipelineAgentStep, type PolicyAgentAnswer, type RunStageAgentStepsInput, type StageAgentAnswerPort, type StageAgentAnswerRecord, } from "./pipeline/agent-steps.js";
140
+ export { failureDetail, heldReason, memberLines, memberStateOf, memberStatesOf, previousRelease, requestedRollbackCommand, requestedRollbackGate, requestStageRollback, rollbackMembers, soakFailureOf, rolledBackLine, stageFailures, stageOnVerifyFail, stageRollbackGate, standingRollbackRequest, verifyRollbackProblems, MIGRATION_STEP_KIND, ROLLBACK_REQUEST_EXPIRY, type PreviousRelease, type ReleaseCheck, type RequestedRollbackGate, type RollbackCapabilityView, type RollbackStepView, type StageRollbackInput, type StageRollbackOutcome, } from "./pipeline/verify-rollback.js";
141
+ export { failedVerify, isVerifyStep, VERIFY_STEP_KINDS } from "./components/verify-step.js";
142
+ export { checkPipelineFile, pipelineFromConfig, pipelineSource, STAGE_HOOKS_KEY_FLOOR, writePipelineFile, type AgentStepConfig, type ApprovalRuleConfig, type ApprovalRulesConfig, type PipelineConfigInput, type PipelineEnvironmentConfig, type PipelineFileCheck, type PipelineSourceOptions, type StageHookConfig, } from "./pipeline/product.js";