@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
@@ -92,7 +92,7 @@
92
92
  *
93
93
  * Pure.
94
94
  */
95
- import { containmentGroups, memberRegion, reconstructIndexedEdges, readPath, refRuleId, } from "../graph-refs.js";
95
+ import { catalogsByLexicon, containmentGroups, memberRegion, reconstructIndexedEdges, readPath, refRuleId, } from "../graph-refs.js";
96
96
  import { nodeAttrsAt } from "../graph-detail.js";
97
97
  import { composedId, danglingKey } from "./compose-graph.js";
98
98
  /** The scope every node of a declared workspace graph sits in. */
@@ -136,7 +136,7 @@ export function catalogRules(catalogs) {
136
136
  * it no such file is read.
137
137
  */
138
138
  export function runCatalogPass(nodes, catalogs, members, lookPath, readFile) {
139
- const byLexicon = new Map(catalogs.map((c) => [c.lexicon, c.catalog]));
139
+ const byLexicon = catalogsByLexicon(catalogs);
140
140
  const nonLiteral = {};
141
141
  const byId = new Map(nodes.map((n) => [n.id, n]));
142
142
  const read = nodes.map((n) => {
@@ -456,7 +456,7 @@ function addGenerated(graph, pass, at, level) {
456
456
  */
457
457
  export function runsOnEdges(nodes, runsOn, catalogs) {
458
458
  const out = { edges: [], joined: new Set(), problems: [] };
459
- const registers = new Map(catalogs.map((c) => [c.lexicon, c.catalog.registersCluster]));
459
+ const registers = new Map([...catalogsByLexicon(catalogs)].map(([l, c]) => [l, c.registersCluster]));
460
460
  for (const [member, target] of [...runsOn].sort((a, b) => byString(a[0], b[0]))) {
461
461
  const slash = target.indexOf("/");
462
462
  const targetMember = target.slice(0, slash);
@@ -33,6 +33,10 @@
33
33
  "pattern": "^(?:jcs1-)?sha256:[0-9a-f]{64}$",
34
34
  "description": "Added in contract 1 by #4045, written by chant 0.124.28 and newer. The release a release gate's change set was planned for: the releaseDigest of the release chant components promote --release deploys. Set with environment, and absent on every other change set. Part of digest, so a stored change set names the one release its gate bound."
35
35
  },
36
+ "risk": {
37
+ "type": "object",
38
+ "description": "Added in contract 1 by #5325, written by the chant that carries CHANGE_RISK_FLOOR on a stored change set when ci.risk was set at base. The change risk: version, score (0 to 1), level (low, medium, high), reasons (each id, weight, value, contribution and detail, with count, answer and approveAbove where they apply), approveAbove (a number or null), over and overBy. Not part of digest."
39
+ },
36
40
  "environment": {
37
41
  "type": "string",
38
42
  "description": "Added in contract 1 by #4045, written by chant 0.124.28 and newer. The environment a release gate's change set was planned for, set with releaseDigest. Part of digest."
@@ -22,3 +22,7 @@ export type TargetCloudIdentityLookup = (target: TargetNames) => PipelineCloudId
22
22
  * such as `terraform-apply`'s group (#4447), compares them with it.
23
23
  */
24
24
  export declare function declaredTargetCloudIdentity(cwd: string, env: string): Promise<TargetCloudIdentityLookup | undefined>;
25
+ /** The workspace declaration's `ci.environmentSets` (#5348), or undefined outside a workspace or when unset. */
26
+ export declare function declaredEnvironmentSets(cwd: string): Promise<import("../components/environment-sets.js").EnvironmentSets | undefined>;
27
+ /** The workspace declaration's `ci.identity.cloud` (#4296), or undefined outside a workspace or when unset. */
28
+ export declare function declaredCloudIdentityDeclaration(cwd: string): Promise<import("../ci-identity.js").CloudIdentityDeclaration | undefined>;
@@ -66,3 +66,33 @@ export async function declaredTargetCloudIdentity(cwd, env) {
66
66
  throw Object.assign(new Error(`${err.describe()} [${err.code}]`), { code: err.code });
67
67
  }
68
68
  }
69
+ /** The workspace declaration's `ci.environmentSets` (#5348), or undefined outside a workspace or when unset. */
70
+ export async function declaredEnvironmentSets(cwd) {
71
+ const found = findWorkspaceRoot(cwd);
72
+ if (!found)
73
+ return undefined;
74
+ const [{ readDeclaration, WorkspaceReadError }, { workingTree }] = await Promise.all([import("./declaration.js"), import("./tree.js")]);
75
+ try {
76
+ return readDeclaration(workingTree(found.dir)).ci?.environmentSets;
77
+ }
78
+ catch (err) {
79
+ if (!(err instanceof WorkspaceReadError))
80
+ throw err;
81
+ throw Object.assign(new Error(`${err.describe()} [${err.code}]`), { code: err.code });
82
+ }
83
+ }
84
+ /** The workspace declaration's `ci.identity.cloud` (#4296), or undefined outside a workspace or when unset. */
85
+ export async function declaredCloudIdentityDeclaration(cwd) {
86
+ const found = findWorkspaceRoot(cwd);
87
+ if (!found)
88
+ return undefined;
89
+ const [{ readDeclaration, WorkspaceReadError }, { workingTree }] = await Promise.all([import("./declaration.js"), import("./tree.js")]);
90
+ try {
91
+ return readDeclaration(workingTree(found.dir)).ci?.identity?.cloud;
92
+ }
93
+ catch (err) {
94
+ if (!(err instanceof WorkspaceReadError))
95
+ throw err;
96
+ throw Object.assign(new Error(`${err.describe()} [${err.code}]`), { code: err.code });
97
+ }
98
+ }
@@ -99,7 +99,8 @@ import { fetchLifecycleStatus, pushLifecycleReport } from "../lifecycle/git.js";
99
99
  import { ACTIVITY_PROFILES } from "../op/activity-profiles.js";
100
100
  import { shellCmd } from "../op/activities/shell.js";
101
101
  import { OpRunFailure, runOpLocally } from "../op/local-executor.js";
102
- import { redactText } from "../op/redact.js";
102
+ import { redactorOf, redactText } from "../op/redact.js";
103
+ import { ENV_SET_ENV, environmentSetSecretNames } from "../components/environment-sets.js";
103
104
  import { findWorkspaceRoot } from "../project-root.js";
104
105
  import { parseReportUrl, reportKey } from "../pr-report-url.js";
105
106
  import { reportUrlOf } from "./ci-report-url.js";
@@ -541,7 +542,8 @@ export async function ciRun(req) {
541
542
  const poster = req.job === "plan" ? planPoster(req, hostEnv) : undefined;
542
543
  // #4096: the secrets and the job's secret-looking variables, redacted from everything the run writes and returns.
543
544
  // In place the forge's own variables come too; one whose value is short, such as a flag, is left out, so it can't blank common words.
544
- const redact = ciRedactor(req.inPlace ? { ...longValues(jobEnv), ...own } : jobEnv, req.secrets);
545
+ // #5348: a secret of the environment's set is redacted whatever its length or name.
546
+ const redact = ciRedactor(req.inPlace ? { ...longValues(jobEnv), ...setSecretEnv(jobEnv), ...own } : jobEnv, req.secrets);
545
547
  try {
546
548
  const ran = await runCiJob(req, { cwd, top, commit, place, job, jobEnv, ...(redact ? { redact } : {}) });
547
549
  const posted = poster ? await postFromReport(req, poster, ran, { top, dir: place.dir, commit, ...(place.member ? { member: place.member } : {}) }) : [];
@@ -716,6 +718,13 @@ function localLoop(loop) {
716
718
  function longValues(env) {
717
719
  return Object.fromEntries(Object.entries(env).filter(([, value]) => value.length >= 8));
718
720
  }
721
+ /** The environment set's record and each secret it names (#5348), from `env`. */
722
+ function setSecretEnv(env) {
723
+ const names = environmentSetSecretNames(env);
724
+ if (names.length === 0)
725
+ return {};
726
+ return Object.fromEntries([ENV_SET_ENV, ...names].flatMap((n) => (env[n] !== undefined ? [[n, env[n]]] : [])));
727
+ }
719
728
  /** The variables of `env` that have a value. */
720
729
  function definedEnv(env) {
721
730
  const out = {};
@@ -878,6 +887,12 @@ async function runCiJob(req, at) {
878
887
  if (redact)
879
888
  redactTree(report, redact);
880
889
  }
890
+ else {
891
+ // #5348: the secrets of the environment's set leave it even in place, since the note jobs post from it.
892
+ const setRedact = redactorOf(environmentSetSecretNames(jobEnv).flatMap((n) => (jobEnv[n] !== undefined ? [jobEnv[n]] : [])));
893
+ if (setRedact)
894
+ redactTree(report, setRedact);
895
+ }
881
896
  }
882
897
  const failed = result.records.find((r) => r.status === "fail");
883
898
  const exitCode = failed?.phase === req.job ? exitCodeOf(failed.error) : undefined;
@@ -59,6 +59,8 @@ export declare function ciSecretsFor(secrets: CiSecrets | undefined, job: CiJobN
59
59
  * The redactor for a job: every value in the secrets file, whether the job
60
60
  * gets it or not, and the value of each variable in the job's environment
61
61
  * whose name looks secret, such as `GITHUB_TOKEN` or a `--pass-env
62
- * AWS_SECRET_ACCESS_KEY`. Undefined when there is nothing to redact.
62
+ * AWS_SECRET_ACCESS_KEY`, and of each secret the environment's config and
63
+ * secret set names in `CHANT_ENV_SET` (#5348), whatever its name.
64
+ * Undefined when there is nothing to redact.
63
65
  */
64
66
  export declare function ciRedactor(jobEnv: Record<string, string>, secrets?: CiSecrets): Redact | undefined;
@@ -26,6 +26,7 @@
26
26
  import { readFileSync, statSync } from "node:fs";
27
27
  import { redactorOf } from "../op/redact.js";
28
28
  import { RUNNER_KEY_ENV } from "./ci-green.js";
29
+ import { environmentSetSecretNames } from "../components/environment-sets.js";
29
30
  /** The variable that names the secrets file when `--secrets` is not given. */
30
31
  export const CI_SECRETS_ENV = "CHANT_CI_SECRETS";
31
32
  /** A variable whose name matches this is taken as secret, and its value redacted. */
@@ -201,12 +202,17 @@ export function ciSecretsFor(secrets, job) {
201
202
  * The redactor for a job: every value in the secrets file, whether the job
202
203
  * gets it or not, and the value of each variable in the job's environment
203
204
  * whose name looks secret, such as `GITHUB_TOKEN` or a `--pass-env
204
- * AWS_SECRET_ACCESS_KEY`. Undefined when there is nothing to redact.
205
+ * AWS_SECRET_ACCESS_KEY`, and of each secret the environment's config and
206
+ * secret set names in `CHANT_ENV_SET` (#5348), whatever its name.
207
+ * Undefined when there is nothing to redact.
205
208
  */
206
209
  export function ciRedactor(jobEnv, secrets) {
207
210
  const values = Object.values(secrets?.values ?? {});
208
211
  for (const [name, value] of Object.entries(jobEnv))
209
212
  if (SECRET_NAME.test(name))
210
213
  values.push(value);
214
+ for (const name of environmentSetSecretNames(jobEnv))
215
+ if (jobEnv[name] !== undefined)
216
+ values.push(jobEnv[name]);
211
217
  return redactorOf(values);
212
218
  }
@@ -8,7 +8,7 @@
8
8
  * - Every node id becomes `<member>/<id>`. Member names can't hold `/`, and
9
9
  * `::` keeps its meaning for stacks inside a member (`app/web::Bucket`).
10
10
  * Edge ends, `$ref` values in attributes, `compositeInstance`,
11
- * `runtimeOwner`, `instanceOf` (#4454) and export and import nodes are
11
+ * `runtimeOwner`, `instanceOf` (#4454), `component` (#5403) and export and import nodes are
12
12
  * rewritten the same way.
13
13
  * - `groups.byMember` maps each member to its node ids. `byLexicon` and
14
14
  * `byComposite` keep their keys (a lexicon or composite type is the same
@@ -8,7 +8,7 @@
8
8
  * - Every node id becomes `<member>/<id>`. Member names can't hold `/`, and
9
9
  * `::` keeps its meaning for stacks inside a member (`app/web::Bucket`).
10
10
  * Edge ends, `$ref` values in attributes, `compositeInstance`,
11
- * `runtimeOwner`, `instanceOf` (#4454) and export and import nodes are
11
+ * `runtimeOwner`, `instanceOf` (#4454), `component` (#5403) and export and import nodes are
12
12
  * rewritten the same way.
13
13
  * - `groups.byMember` maps each member to its node ids. `byLexicon` and
14
14
  * `byComposite` keep their keys (a lexicon or composite type is the same
@@ -183,6 +183,8 @@ export function composeWorkspaceGraph(workspace, inputs, links) {
183
183
  composed.runtimeOwner = prefix(m, node.runtimeOwner);
184
184
  if (node.instanceOf)
185
185
  composed.instanceOf = prefix(m, node.instanceOf);
186
+ if (node.component)
187
+ composed.component = prefix(m, node.component);
186
188
  nodes.push(composed);
187
189
  ids.push(composed.id);
188
190
  }
@@ -19,6 +19,7 @@ import { type RetentionOverride } from "../lifecycle/retention-policy.js";
19
19
  import { type ForgeCi } from "../ci-system.js";
20
20
  import { type NotifyConfig } from "../notify.js";
21
21
  import { type CloudIdentityDeclaration } from "../ci-identity.js";
22
+ import { type EnvironmentSets } from "../components/environment-sets.js";
22
23
  import { EXAMPLES_KIND } from "./kinds.js";
23
24
  import { type TextLocation } from "./jsonc.js";
24
25
  import type { SecurityGroup } from "./security.js";
@@ -27,6 +28,8 @@ import { type CiHooks } from "../op/op-waves.js";
27
28
  import { type GateQuorumSpec } from "../op/gate-quorum.js";
28
29
  import { type GateApprovalMode, type GatePolicyRef } from "../op/gate-approval.js";
29
30
  import { type GatePolicySettings } from "../gate-policy.js";
31
+ import { type CostEstimateSettings } from "../cost-estimate.js";
32
+ import { type ChangeRiskSettings } from "../change-risk.js";
30
33
  export declare const DECLARATION_SCHEMA_ID: string;
31
34
  export declare const DECLARATION_FILES: readonly ["chant.workspace.json", "chant.workspace.jsonc"];
32
35
  export declare const DECLARATION_SCHEMA_VERSION = 1;
@@ -121,6 +124,8 @@ export interface SignedGate {
121
124
  mode: GateApprovalMode | null;
122
125
  /** The context an Op gate of this name hands its policy, in place of its own `approval.context` (#4404). Null when the entry sets none. */
123
126
  context: Record<string, string | number | boolean | string[]> | null;
127
+ /** `agentPassesAlone` (#5388): an agent's permit passes an Op gate of this name in `enforce` with no person approving. Null when the entry sets none. */
128
+ agentPassesAlone: boolean | null;
124
129
  pointer: string;
125
130
  }
126
131
  /** The declaration's `identity` block (#3163, ws-080), read at base. */
@@ -379,6 +384,21 @@ export interface CiDeclaration {
379
384
  * Absent when the declaration sets none.
380
385
  */
381
386
  policy?: GatePolicySettings;
387
+ /**
388
+ * `ci.cost` (#5334): the cost estimate the pull-request jobs run over
389
+ * each member's plan document, read from the declaration at base, which
390
+ * the plan note shows and the policy reads as `input.cost`. Absent when
391
+ * the declaration sets none.
392
+ */
393
+ cost?: CostEstimateSettings;
394
+ /**
395
+ * `ci.risk` (#5325): the change risk the pull-request jobs score, read
396
+ * from the declaration at base, which the plan note shows, the stored
397
+ * change set keeps, and the policy reads as `input.risk`. Over
398
+ * `approveAbove`, the plan needs an approval of its own digest. Absent
399
+ * when the declaration sets none.
400
+ */
401
+ risk?: Omit<ChangeRiskSettings, "quorum">;
382
402
  /**
383
403
  * `ci.identity` (#4296): `cloud` gives each cloud's plan and apply
384
404
  * identities by environment and member globs (../ci-identity.ts), and
@@ -394,6 +414,13 @@ export interface CiDeclaration {
394
414
  * (../components/pr-environment.ts). Absent when unset.
395
415
  */
396
416
  prEnvironment?: CiPrEnvironment;
417
+ /**
418
+ * `ci.environmentSets` (#5348): the config and secret set of each
419
+ * environment (../components/environment-sets.ts), which `chant build
420
+ * --pr-loop` and `chant pipeline generate` hand that environment's jobs.
421
+ * Absent when unset.
422
+ */
423
+ environmentSets?: EnvironmentSets;
397
424
  }
398
425
  /** The `ci.prEnvironment` block (#4298), with its default TTL. */
399
426
  export interface CiPrEnvironment {
@@ -22,6 +22,7 @@ import { notifyConfigProblem } from "../notify.js";
22
22
  import schema from "./declaration.schema.json" with { type: "json" };
23
23
  import { routeConflicts } from "./ci-branches.js";
24
24
  import { cloudIdentityProblems, IDENTITY_CLOUDS } from "../ci-identity.js";
25
+ import { environmentSetsProblems } from "../components/environment-sets.js";
25
26
  import { expandGlob } from "./glob.js";
26
27
  import { EXAMPLES_KIND, holdsChantProject, REPO_KIND } from "./kinds.js";
27
28
  import { parseJsonText, pointerToken } from "./jsonc.js";
@@ -32,6 +33,8 @@ import { assertPrLoopHooks } from "../op/op-waves.js";
32
33
  import { quorumProblems } from "../op/gate-quorum.js";
33
34
  import { gateBaseApprovalProblems } from "../op/gate-approval.js";
34
35
  import { assertGatePolicySettings } from "../gate-policy.js";
36
+ import { costEstimateProblems } from "../cost-estimate.js";
37
+ import { changeRiskProblems } from "../change-risk.js";
35
38
  export const DECLARATION_SCHEMA_ID = schema.$id;
36
39
  export const DECLARATION_FILES = ["chant.workspace.json", "chant.workspace.jsonc"];
37
40
  export const DECLARATION_SCHEMA_VERSION = 1;
@@ -546,6 +549,7 @@ function identityOf(raw, at) {
546
549
  policy: entry.policy !== undefined ? structuredClone(entry.policy) : null,
547
550
  mode: entry.mode ?? null,
548
551
  context: entry.context !== undefined ? structuredClone(entry.context) : null,
552
+ agentPassesAlone: entry.agentPassesAlone ?? null,
549
553
  pointer,
550
554
  };
551
555
  }
@@ -606,6 +610,24 @@ function ciPolicyOf(raw, at) {
606
610
  }
607
611
  return structuredClone(raw);
608
612
  }
613
+ /** A `ci.cost` block (#5334), refused when the pull-request jobs could not run it. Null when absent. */
614
+ function ciCostOf(raw, at) {
615
+ if (raw === undefined)
616
+ return null;
617
+ const problems = costEstimateProblems("ci.cost", raw);
618
+ if (problems.length > 0)
619
+ throw new WorkspaceReadError("declaration-invalid", problems.join("; ").replaceAll("`", ""), at("/ci/cost"));
620
+ return structuredClone(raw);
621
+ }
622
+ /** A `ci.risk` block (#5325), refused when it sets anything the pull-request jobs do not read. Null when absent. */
623
+ function ciRiskOf(raw, at) {
624
+ if (raw === undefined)
625
+ return null;
626
+ const problems = changeRiskProblems("ci.risk", raw, { quorum: false, questions: true });
627
+ if (problems.length > 0)
628
+ throw new WorkspaceReadError("declaration-invalid", problems.join("; ").replaceAll("`", ""), at("/ci/risk"));
629
+ return structuredClone(raw);
630
+ }
609
631
  /**
610
632
  * `ci.identity.cloud` (#4296), copied without its `x-` keys. A rule that
611
633
  * plans as an identity some rule applies as is refused: the plan runs the
@@ -627,12 +649,22 @@ function cloudIdentityOf(raw, at) {
627
649
  throw new WorkspaceReadError("declaration-invalid", problem.message, at(problem.pointer));
628
650
  return out;
629
651
  }
652
+ /** `ci.environmentSets` (#5348), without its `x-` keys, refused with its first problem. */
653
+ function environmentSetsOf(raw, at) {
654
+ const block = Object.fromEntries(Object.entries(raw).filter(([k]) => !k.startsWith("x-")));
655
+ const [problem] = environmentSetsProblems(block);
656
+ if (problem)
657
+ throw new WorkspaceReadError("declaration-invalid", `ci.environmentSets: ${problem}`, at("/ci/environmentSets"));
658
+ return block;
659
+ }
630
660
  function ciOf(raw, at) {
631
661
  if (raw === undefined)
632
662
  return null;
633
663
  const block = raw;
634
664
  const hooks = ciHooksOf(block.hooks, "/ci/hooks", at);
635
665
  const policy = ciPolicyOf(block.policy, at);
666
+ const cost = ciCostOf(block.cost, at);
667
+ const risk = ciRiskOf(block.risk, at);
636
668
  // #5170: the forge and its CI system, each defaulting from the other.
637
669
  let forgeCi;
638
670
  if (block.forge !== undefined || block.system !== undefined) {
@@ -652,7 +684,10 @@ function ciOf(raw, at) {
652
684
  ...(block.locks !== undefined ? { locks: block.locks } : {}),
653
685
  ...(block.lockGrain !== undefined ? { lockGrain: block.lockGrain } : {}),
654
686
  ...(policy ? { policy } : {}),
687
+ ...(cost ? { cost } : {}),
688
+ ...(risk ? { risk } : {}),
655
689
  ...(block.identity?.cloud !== undefined ? { identity: { cloud: cloudIdentityOf(block.identity.cloud, at) } } : {}),
690
+ ...(block.environmentSets !== undefined ? { environmentSets: environmentSetsOf(block.environmentSets, at) } : {}),
656
691
  ...(block.prEnvironment !== undefined
657
692
  ? {
658
693
  prEnvironment: {
@@ -184,6 +184,10 @@
184
184
  "enum": ["log-only", "enforce"],
185
185
  "description": "Whether the policy's decision binds the gate (#4404), in place of the Op's own approval.mode: log-only records it next to the approval, enforce passes the gate only on a permit. Read at base, so a change can't switch its own gate to a mode that passes it. Added in schema 1 by chant 0.124.49, so a declaration that uses it sets minReader to 0.124.49 or newer."
186
186
  },
187
+ "agentPassesAlone": {
188
+ "type": "boolean",
189
+ "description": "true lets an agent's policy permit pass an Op gate of this name in enforce mode with no person approving (#5388). Unset or false, an agent's permit passes the gate only beside a person's approval of the same plan. Read at base only. chant build warns while it is set, and refuses it on a gate a pipeline stage passes through: a stage's promote, skip, urgent, rollback or soak gate. A permit that reads the change risk still counts only from a proven person."
190
+ },
187
191
  "context": {
188
192
  "type": "object",
189
193
  "description": "Plan attributes handed to the policy (#4404), over the Op's own approval.context, key by key: a change can't edit a key declared here, and a key only the Op declares still reaches the policy. A value is a plain one, since a step output reference is resolved at run time and a declaration can't hold one. plan is reserved. Added in schema 1 by chant 0.124.49, so a declaration that uses it sets minReader to 0.124.49 or newer.",
@@ -236,6 +240,12 @@
236
240
  "policy": {
237
241
  "$ref": "#/$defs/ciPolicy"
238
242
  },
243
+ "cost": {
244
+ "$ref": "#/$defs/ciCost"
245
+ },
246
+ "risk": {
247
+ "$ref": "#/$defs/ciRisk"
248
+ },
239
249
  "reportUrl": {
240
250
  "type": "string",
241
251
  "minLength": 1,
@@ -330,6 +340,17 @@
330
340
  }
331
341
  }
332
342
  },
343
+ "environmentSets": {
344
+ "type": "object",
345
+ "description": "Config and secret sets per environment (#5348): environments maps an environment name to its set (imports, config, secrets), and configSets maps a shared set's name to a set the environments import. A secret names where it is kept: a forge secret's name, or { forgeSecret }, { awsSecretsManager, jsonKey?, region? }, { gcpSecretManager } or { azureKeyVault }. chant build --pr-loop and chant pipeline generate hand each environment's jobs its set. Read at base. Added in schema 1 by chant 0.124.103, so a declaration that uses it sets minReader to 0.124.103 or newer.",
346
+ "required": ["environments"],
347
+ "additionalProperties": false,
348
+ "patternProperties": { "^x-": true },
349
+ "properties": {
350
+ "environments": { "type": "object" },
351
+ "configSets": { "type": "object" }
352
+ }
353
+ },
333
354
  "prEnvironment": {
334
355
  "type": "object",
335
356
  "description": "An environment per open pull request (#4298): chant components pr-env up applies the pull request's components to pr-<number>, which takes the template environment's declared endpoint, and pr-env down tears down only what carries that environment's ownership marker. A pull request's environment is never a release target. Read from the declaration at base, so a pull request cannot change its own template or TTL. Added in schema 1 by chant 0.124.42, so a declaration that uses it sets minReader to 0.124.42 or newer.",
@@ -2051,6 +2072,41 @@
2051
2072
  "type": "object",
2052
2073
  "description": "Gate-time policy on the pull-request jobs (#4294): a policy engine run over the change set, with the policy read at base. engine names the result shape the command prints, conftest (the default) or opa. path is the policy directory, relative to the declaration (default policy). namespace is the package to read. command replaces the engine's own argv, with {policy} for the policy directory exported from base and {input} for the input file. deny rules refuse the apply unless an override counts; hold rules make the plan wait for a person's approval; warn rules are advice. There is no unattended outcome. source (#4613) is { repo, ref, path? }: a shared repository whose ref the job fetches, read in place of path, with the commit read recorded on the report and the wave's decision; path inside it defaults to policy, and path beside source is refused. packs (#4613) is a list of { dir, config? }: CrossGuard packs every pulumi-up preview runs, copied from the declaration's directory at base, or from the top of source when it is set. Added in schema 1 by chant 0.124.41, so a declaration that uses it sets minReader to 0.124.41 or newer; source and packs were added in schema 1 by chant 0.124.55, so a declaration that sets either sets minReader to 0.124.55 or newer. install (#4774) is true to fetch conftest or opa at the release chant pins, checked against its recorded sha256, when the engine is not on PATH; it is refused beside command. Read by chant 0.124.77 and newer, so a declaration that sets install sets minReader to 0.124.77 or newer."
2053
2074
  },
2075
+ "ciCost": {
2076
+ "type": "object",
2077
+ "additionalProperties": false,
2078
+ "required": ["command"],
2079
+ "properties": {
2080
+ "command": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 }, "description": "The estimator's argv, run once per member whose plan changes something. {planJson} is the plan document the member's capability wrote (terraform-apply's show -json, pulumi-up's preview JSON), {target} the member and {plan} its plan file." },
2081
+ "format": { "enum": ["infracost", "chant"], "description": "What the command prints: infracost's JSON (the default), or { monthlyDelta, monthlyTotal?, pastMonthlyTotal?, currency? }." },
2082
+ "currency": { "type": "string", "pattern": "^[A-Z]{3}$", "description": "The currency the amounts are in. Default the estimate's, else USD." },
2083
+ "approveAbove": { "type": "number", "minimum": 0, "description": "The monthly change above which the plan needs an approval of its own digest. A member with no estimate counts as over. Absent: the estimate only informs." }
2084
+ },
2085
+ "description": "The cost estimate of a pull request's plan (#5334), read from the declaration at base: chant components pr-plan and pr-apply run command over each member's plan document and put the estimate in the report and the note, and the policy reads it as input.cost. With approveAbove, a plan over it needs an approval of its own digest, so a green commit's plan does not apply under the approvals of the merges it carries. The estimate adds approvals and never removes one, and a failed estimate never fails the plan. The terraform lexicon's terraformCostHold and the pulumi lexicon's pulumiCostHold build the same object. Read by the chant release that carries COST_ESTIMATE_FLOOR (@intentius/chant/ci-product)."
2086
+ },
2087
+ "ciRisk": {
2088
+ "type": "object",
2089
+ "additionalProperties": false,
2090
+ "properties": {
2091
+ "approveAbove": { "type": "number", "minimum": 0, "maximum": 1, "description": "The score above which the plan needs an approval of its own digest. Absent: the score only informs." },
2092
+ "questions": {
2093
+ "type": "array",
2094
+ "description": "Questions the review agent answers from 0 to 1, each a reason in the score with its weight. An answer over the question's approveAbove makes the plan need an approval of its own digest; an unknown answer, given when the plan is larger than the review's context or no review was found, is over every threshold.",
2095
+ "items": {
2096
+ "type": "object",
2097
+ "required": ["id", "text", "weight"],
2098
+ "additionalProperties": false,
2099
+ "properties": {
2100
+ "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$" },
2101
+ "text": { "type": "string", "minLength": 1 },
2102
+ "weight": { "type": "number", "minimum": 0, "maximum": 1 },
2103
+ "approveAbove": { "type": "number", "minimum": 0, "maximum": 1 }
2104
+ }
2105
+ }
2106
+ }
2107
+ },
2108
+ "description": "The change risk of a pull request's plan (#5325), read from the declaration at base: chant components pr-plan and pr-apply score the change set from its deletes, replacements, disruption classes, destructive migration classes, members and environments reached, graph dependents, the review's level and the answers to questions, put the record in the report, the note and the stored change set, and the policy reads it as input.risk. The score only adds approvals: with approveAbove, a plan over it needs an approval of its own digest, and no setting lets a low score pass a gate. Read by the chant release that carries CHANGE_RISK_FLOOR (@intentius/chant/ci-product)."
2109
+ },
2054
2110
  "ciPhaseName": {
2055
2111
  "type": "string",
2056
2112
  "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$"
@@ -281,6 +281,9 @@ export async function workspaceGraph(query) {
281
281
  // The reference catalogs over the composed graph (#5097), on full attributes whatever --detail asks for.
282
282
  if (query.catalog && !args.live)
283
283
  await addCatalogEdges(graph, query, args, { workspace: graph.workspace, inputs, located, runsOn: runsOnOf(declaration.members) });
284
+ // Reads between members that sit in the members' files (#5331), such as a StackReference.
285
+ if (!args.live)
286
+ await addStackReadEdges(graph, declaration.members, located.rootOnDisk, args.env);
284
287
  // The box's factory and listing (#3146), from the declaration read, so --at gives them at that revision.
285
288
  for (const member of graph.members)
286
289
  member.box = graphBox(declaration.members.find((m) => m.name === member.name)?.box ?? null, located.tree, declaration.members);
@@ -318,6 +321,29 @@ export async function workspaceGraph(query) {
318
321
  return { doc: { ...head, error: { code: err.code, message: err.message, location: err.location ?? null } }, failed: true };
319
322
  }
320
323
  }
324
+ /**
325
+ * The reads between members the lexicons of the graph's nodes find in the
326
+ * members' files (#5331), drawn as edges (`./stack-read-edges.ts`). A lexicon
327
+ * that does not load, or throws, reports none.
328
+ */
329
+ async function addStackReadEdges(graph, members, root, env) {
330
+ const { loadPlugin } = await import("../cli/plugins.js");
331
+ const { placeStackReads } = await import("./stack-read-edges.js");
332
+ const ctx = { root, ...(env ? { env } : {}), members: members.map((m) => ({ name: m.name, dir: m.dir, kind: m.kind })) };
333
+ for (const lexicon of [...new Set(graph.nodes.map((n) => n.lexicon))].sort()) {
334
+ try {
335
+ const plugin = await loadPlugin(lexicon);
336
+ if (typeof plugin.workspaceStackReads !== "function")
337
+ continue;
338
+ const answer = await plugin.workspaceStackReads(ctx);
339
+ if (answer)
340
+ placeStackReads(graph, answer);
341
+ }
342
+ catch {
343
+ // Not installed where this chant can load it, or it could not read: no reads.
344
+ }
345
+ }
346
+ }
321
347
  /** The reference catalog of each lexicon that has one, best effort: a lexicon that does not load has none. */
322
348
  async function loadCatalogs(lexicons) {
323
349
  const { loadPlugin } = await import("../cli/plugins.js");
@@ -614,6 +614,10 @@
614
614
  "type": "string",
615
615
  "description": "Added in contract 1 by #4486. With instanceOf, under an expanded module call: the module path as the engine prints it, module.app[0]. The id then carries the key on the call's segment, <member>/<root>/module.app[0]/aws_eip.pool[1]."
616
616
  },
617
+ "component": {
618
+ "type": "string",
619
+ "description": "Added in contract 1 by #5403. The node of the component resource that registered this one, prefixed like the ids: a Pulumi resource whose parent is another resource of the stack. A component's own component is the one above it, so nested components nest. Absent when the parent is the stack."
620
+ },
617
621
  "instanceRollup": {
618
622
  "type": "object",
619
623
  "description": "Added in contract 1 by #4489, written by chant 0.124.54 and newer. On a block node whose count or for_each the declared graph cannot count: why it stays one node, with no instance nodes under it. Absent on a block that is not expanded and on one whose instances are listed. The read contract lists every form that is rolled up and its code.",
@@ -661,7 +665,7 @@
661
665
  },
662
666
  "facts": {
663
667
  "type": "object",
664
- "description": "Added in contract 1 by #4529, written by chant 0.124.54 and newer. What an ownership engine observed about the node: ownership, markers, ownedBy, cloudIds, recordVersions and observedAt, each optional, in the shape of EngineFacts (packages/core/src/graph-schema/graph.schema.json). Set on a Pulumi member on plunge from its checked-in engine-graph.json. Never read for a decision."
668
+ "description": "Added in contract 1 by #4529, written by chant 0.124.54 and newer. What an ownership engine observed about the node: ownership, markers, ownedBy, cloudIds, recordVersions, observedAt and (chant#5402) ownershipRows, the rows behind the ownership word for this node, each optional, in the shape of EngineFacts (packages/core/src/graph-schema/graph.schema.json). Set on a Pulumi member on plunge from its checked-in engine-graph.json. Never read for a decision."
665
669
  },
666
670
  "nested": {
667
671
  "type": "string",
@@ -63,6 +63,10 @@ export declare function grantedClasses(classes: readonly ClassGrant[], roles: Re
63
63
  * know lets nothing through.
64
64
  */
65
65
  export declare function admitApprover(rule: GateAdmissionRule, a: SealedGateApproval): string | null;
66
+ /** Why no signature can show a principal is in the rule's class: the class is one the rule does not know. Null otherwise. */
67
+ export declare function unknownClassRefusal(rule: GateAdmissionRule, what: string): string | null;
68
+ /** Why `principal` is not in the rule's class, or null when it is or the rule names none. */
69
+ export declare function classRefusal(rule: GateAdmissionRule, principal: string): string | null;
66
70
  /** The gate whose `identity.gates` entry says who may cut a release (#4031). */
67
71
  export declare const RELEASE_GATE = "release";
68
72
  /** The ssh signature namespace of a release cut's signature (#4031), so no other signature can stand in for one. */
@@ -50,14 +50,14 @@ export function admitApprover(rule, a) {
50
50
  return classRefusal(rule, a.resolvedBy);
51
51
  }
52
52
  /** Why no signature can show a principal is in the rule's class: the class is one the rule does not know. Null otherwise. */
53
- function unknownClassRefusal(rule, what) {
53
+ export function unknownClassRefusal(rule, what) {
54
54
  const want = rule.class;
55
55
  if (want === null || rule.classes.some((c) => c.name === want))
56
56
  return null;
57
57
  return `identity.gates.${rule.gate} names the class ${want}, which ${rule.unknownClass ?? "no pinned package supplies"}, so no ${what} can show it is in that class (known classes: ${rule.classes.map((c) => c.name).join(", ")})`;
58
58
  }
59
59
  /** Why `principal` is not in the rule's class, or null when it is or the rule names none. */
60
- function classRefusal(rule, principal) {
60
+ export function classRefusal(rule, principal) {
61
61
  const want = rule.class;
62
62
  if (want === null)
63
63
  return null;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The `identity.gates` rule for a rejection (#5354), apart from
3
+ * `./identity-gate-rule.ts` so the gate-decision bundle, which judges
4
+ * approvals only, stays small.
5
+ */
6
+ import { type GateRejectionRecord } from "../lifecycle/gate-rejection.js";
7
+ import { type GateAdmissionRule } from "./identity-gate-rule.js";
8
+ /**
9
+ * Why a rejection (#5354) does not count at the gate, or null when it does:
10
+ * the rule {@link admitApprover} applies to an approval, with the seal
11
+ * checked over the rejection's own bytes. A gate that counts only sealed
12
+ * approvals from a class counts only sealed rejections from it.
13
+ */
14
+ export declare function admitRejecter(rule: GateAdmissionRule, r: GateRejectionRecord): string | null;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The `identity.gates` rule for a rejection (#5354), apart from
3
+ * `./identity-gate-rule.ts` so the gate-decision bundle, which judges
4
+ * approvals only, stays small.
5
+ */
6
+ import { rejectionSealRefusal } from "../lifecycle/gate-rejection.js";
7
+ import { classRefusal, unknownClassRefusal } from "./identity-gate-rule.js";
8
+ /**
9
+ * Why a rejection (#5354) does not count at the gate, or null when it does:
10
+ * the rule {@link admitApprover} applies to an approval, with the seal
11
+ * checked over the rejection's own bytes. A gate that counts only sealed
12
+ * approvals from a class counts only sealed rejections from it.
13
+ */
14
+ export function admitRejecter(rule, r) {
15
+ const unknown = unknownClassRefusal(rule, "rejection");
16
+ if (unknown !== null)
17
+ return unknown;
18
+ if (!rule.signers.active)
19
+ return `gate ${rule.gate} needs a signed rejection, and there is no signers file (${rule.signers.signersPath}) at base to check one against`;
20
+ const seal = rejectionSealRefusal(rule.signers, r);
21
+ if (seal !== null)
22
+ return seal;
23
+ return classRefusal(rule, r.rejectedBy);
24
+ }
@@ -27,6 +27,7 @@
27
27
  */
28
28
  import type { Declaration, SignedGate } from "./declaration.js";
29
29
  import { type GateAdmissionRule } from "./identity-gate-rule.js";
30
+ import type { GateRejectionRecord } from "../lifecycle/gate-rejection.js";
30
31
  import { type ClassRegistry } from "./principal-classes.js";
31
32
  import type { TrustPolicy } from "./trust/policy.js";
32
33
  import type { SealedGateApproval } from "../lifecycle/gate-seal.js";
@@ -90,6 +91,8 @@ export interface GateAdmission {
90
91
  requirement: SignedGate;
91
92
  /** Why `approval` doesn't count toward the gate, or null when it does. */
92
93
  refuses(approval: GateApprovalLike): string | null;
94
+ /** Why a rejection (#5354) doesn't count at the gate, or null when it does: the same rule, over the rejection's seal. */
95
+ refusesRejection(rejection: GateRejectionRecord): string | null;
93
96
  }
94
97
  /** What {@link gateAdmissionFrom} reads: the declaration, policy and classes at base, as `scopeSource` gives them. */
95
98
  export interface GateRuleSource extends IdentitySource {
@@ -26,6 +26,7 @@
26
26
  * sealed by a signer, from a class when it names one.
27
27
  */
28
28
  import { admitApprover, RELEASE_GATE } from "./identity-gate-rule.js";
29
+ import { admitRejecter } from "./identity-reject-rule.js";
29
30
  import { classesOf, coreClassRegistry, roleGrants } from "./principal-classes.js";
30
31
  import { normalisePrincipal } from "./records.js";
31
32
  import { scopeSource } from "./write-scope.js";
@@ -115,7 +116,7 @@ export function gateAdmissionFrom(source, gate) {
115
116
  return null;
116
117
  const { policy, classes } = source;
117
118
  const rule = { gate, class: requirement.class, signers: policy, roles: roleGrants(policy), classes: classes.all() };
118
- return { requirement, refuses: (a) => admitApprover(rule, a) };
119
+ return { requirement, refuses: (a) => admitApprover(rule, a), refusesRejection: (r) => admitRejecter(rule, r) };
119
120
  }
120
121
  /**
121
122
  * The rule a release cut is judged by (#4031): the declaration's
@@ -127,6 +127,8 @@ export function foldNested(graph, member, inner) {
127
127
  n.runtimeOwner = prefixed(outer, node.runtimeOwner);
128
128
  if (node.instanceOf)
129
129
  n.instanceOf = prefixed(outer, node.instanceOf);
130
+ if (node.component)
131
+ n.component = prefixed(outer, node.component);
130
132
  if (node.compositeParent)
131
133
  n.compositeParent = node.compositeParent;
132
134
  // sourceLoc is relative to the member's directory: the outer member's is the nested root.