@intentius/chant 0.124.78 → 0.124.80

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 (184) hide show
  1. package/dist/action-pins.d.ts.map +1 -1
  2. package/dist/action-pins.js +1 -2
  3. package/dist/change-set.d.ts +10 -1
  4. package/dist/change-set.d.ts.map +1 -1
  5. package/dist/change-set.js +4 -1
  6. package/dist/ci-agent.d.ts +16 -2
  7. package/dist/ci-agent.d.ts.map +1 -1
  8. package/dist/ci-agent.js +6 -1
  9. package/dist/ci-commit.d.ts.map +1 -1
  10. package/dist/ci-commit.js +2 -3
  11. package/dist/ci-note-commands.d.ts +199 -0
  12. package/dist/ci-note-commands.d.ts.map +1 -0
  13. package/dist/ci-note-commands.js +372 -0
  14. package/dist/ci-product.d.ts +6 -2
  15. package/dist/ci-product.d.ts.map +1 -1
  16. package/dist/ci-product.js +5 -1
  17. package/dist/cli/handlers/build.d.ts.map +1 -1
  18. package/dist/cli/handlers/build.js +7 -1
  19. package/dist/cli/handlers/pr-notes.d.ts +13 -0
  20. package/dist/cli/handlers/pr-notes.d.ts.map +1 -0
  21. package/dist/cli/handlers/pr-notes.js +73 -0
  22. package/dist/cli/handlers/release.d.ts +8 -0
  23. package/dist/cli/handlers/release.d.ts.map +1 -1
  24. package/dist/cli/handlers/release.js +64 -2
  25. package/dist/cli/handlers/run-wave.js +1 -0
  26. package/dist/cli/main.d.ts.map +1 -1
  27. package/dist/cli/main.js +17 -1
  28. package/dist/cli/mcp/product-tools.d.ts +6 -0
  29. package/dist/cli/mcp/product-tools.d.ts.map +1 -1
  30. package/dist/cli/mcp/product-tools.js +6 -0
  31. package/dist/cli/mcp/read-only.d.ts +12 -0
  32. package/dist/cli/mcp/read-only.d.ts.map +1 -1
  33. package/dist/cli/mcp/read-only.js +16 -0
  34. package/dist/cli/mcp/server.d.ts +11 -0
  35. package/dist/cli/mcp/server.d.ts.map +1 -1
  36. package/dist/cli/mcp/server.js +26 -5
  37. package/dist/cli/mcp/types.d.ts +5 -1
  38. package/dist/cli/mcp/types.d.ts.map +1 -1
  39. package/dist/cli/parse-args.d.ts.map +1 -1
  40. package/dist/cli/parse-args.js +10 -0
  41. package/dist/cli/registry.d.ts +4 -0
  42. package/dist/cli/registry.d.ts.map +1 -1
  43. package/dist/components/capability.d.ts +53 -0
  44. package/dist/components/capability.d.ts.map +1 -1
  45. package/dist/components/group-digest.d.ts +17 -0
  46. package/dist/components/group-digest.d.ts.map +1 -0
  47. package/dist/components/group-digest.js +18 -0
  48. package/dist/components/groups.d.ts +2 -11
  49. package/dist/components/groups.d.ts.map +1 -1
  50. package/dist/components/groups.js +2 -12
  51. package/dist/components/index.d.ts +1 -1
  52. package/dist/components/index.d.ts.map +1 -1
  53. package/dist/components/pr-pipeline.d.ts +22 -0
  54. package/dist/components/pr-pipeline.d.ts.map +1 -1
  55. package/dist/components/pr-pipeline.js +26 -0
  56. package/dist/components/product-pipeline.d.ts +12 -0
  57. package/dist/components/product-pipeline.d.ts.map +1 -1
  58. package/dist/components/product-pipeline.js +5 -1
  59. package/dist/config.d.ts +14 -0
  60. package/dist/config.d.ts.map +1 -1
  61. package/dist/config.js +5 -0
  62. package/dist/lexicon.d.ts.map +1 -1
  63. package/dist/lexicon.js +1 -2
  64. package/dist/lifecycle/release-cut.d.ts +7 -1
  65. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  66. package/dist/lifecycle/release-cut.js +1 -0
  67. package/dist/lifecycle/release-images.d.ts +12 -3
  68. package/dist/lifecycle/release-images.d.ts.map +1 -1
  69. package/dist/lifecycle/release-images.js +6 -7
  70. package/dist/lifecycle/release-publish.d.ts +8 -1
  71. package/dist/lifecycle/release-publish.d.ts.map +1 -1
  72. package/dist/lifecycle/release-publish.js +30 -3
  73. package/dist/lifecycle/release-version.d.ts +86 -0
  74. package/dist/lifecycle/release-version.d.ts.map +1 -0
  75. package/dist/lifecycle/release-version.js +208 -0
  76. package/dist/mcp/types.d.ts +26 -0
  77. package/dist/mcp/types.d.ts.map +1 -1
  78. package/dist/notify-product.d.ts.map +1 -1
  79. package/dist/notify-product.js +1 -2
  80. package/dist/op/activities/review-product.d.ts.map +1 -1
  81. package/dist/op/activities/review-product.js +1 -2
  82. package/dist/op/gate.d.ts +17 -0
  83. package/dist/op/gate.d.ts.map +1 -1
  84. package/dist/op/gate.js +36 -0
  85. package/dist/op/index.d.ts +8 -6
  86. package/dist/op/index.d.ts.map +1 -1
  87. package/dist/op/index.js +5 -4
  88. package/dist/op/op-waves-after-plan.d.ts +109 -1
  89. package/dist/op/op-waves-after-plan.d.ts.map +1 -1
  90. package/dist/op/op-waves-after-plan.js +180 -3
  91. package/dist/op/op-waves-capability-spec.js +1 -2
  92. package/dist/op/op-waves-capability.d.ts +93 -3
  93. package/dist/op/op-waves-capability.d.ts.map +1 -1
  94. package/dist/op/op-waves-capability.js +218 -10
  95. package/dist/op/op-waves-run-hooks.d.ts +104 -0
  96. package/dist/op/op-waves-run-hooks.d.ts.map +1 -0
  97. package/dist/op/op-waves-run-hooks.js +145 -0
  98. package/dist/op/op-waves-run.d.ts +21 -0
  99. package/dist/op/op-waves-run.d.ts.map +1 -1
  100. package/dist/op/op-waves-run.js +307 -21
  101. package/dist/op/op-waves.d.ts +11 -1
  102. package/dist/op/op-waves.d.ts.map +1 -1
  103. package/dist/op/op-waves.js +7 -1
  104. package/dist/op/runtime.d.ts +2 -0
  105. package/dist/op/runtime.d.ts.map +1 -1
  106. package/dist/pr-forge-reads.d.ts +151 -1
  107. package/dist/pr-forge-reads.d.ts.map +1 -1
  108. package/dist/pr-forge-reads.js +265 -1
  109. package/dist/pr-plan-note.d.ts.map +1 -1
  110. package/dist/pr-plan-note.js +1 -2
  111. package/dist/release-floors.d.ts +19 -1
  112. package/dist/release-floors.d.ts.map +1 -1
  113. package/dist/release-floors.js +23 -5
  114. package/dist/wave-runtime.mjs +312 -312
  115. package/dist/workspace/change-set.schema.json +7 -0
  116. package/dist/workspace/release-workflow.d.ts +7 -0
  117. package/dist/workspace/release-workflow.d.ts.map +1 -1
  118. package/dist/workspace/release-workflow.js +11 -1
  119. package/package.json +1 -1
  120. package/src/action-pins.test.ts +1 -2
  121. package/src/action-pins.ts +1 -3
  122. package/src/change-set.test.ts +20 -0
  123. package/src/change-set.ts +11 -1
  124. package/src/ci-agent.test.ts +9 -0
  125. package/src/ci-agent.ts +15 -2
  126. package/src/ci-commit.test.ts +2 -3
  127. package/src/ci-commit.ts +2 -3
  128. package/src/ci-note-commands.test.ts +377 -0
  129. package/src/ci-note-commands.ts +479 -0
  130. package/src/ci-product.ts +6 -2
  131. package/src/cli/handlers/build.ts +7 -1
  132. package/src/cli/handlers/pr-notes.ts +70 -0
  133. package/src/cli/handlers/release.ts +55 -2
  134. package/src/cli/handlers/run-wave.ts +1 -0
  135. package/src/cli/main.ts +17 -1
  136. package/src/cli/mcp/product-tools.test.ts +49 -0
  137. package/src/cli/mcp/product-tools.ts +7 -0
  138. package/src/cli/mcp/read-only.ts +19 -0
  139. package/src/cli/mcp/server.test.ts +30 -0
  140. package/src/cli/mcp/server.ts +28 -5
  141. package/src/cli/mcp/types.ts +6 -1
  142. package/src/cli/parse-args.ts +8 -0
  143. package/src/cli/registry.ts +4 -0
  144. package/src/components/capability.ts +52 -0
  145. package/src/components/group-digest.ts +20 -0
  146. package/src/components/groups.ts +3 -13
  147. package/src/components/index.ts +2 -0
  148. package/src/components/pr-pipeline.ts +35 -0
  149. package/src/components/product-pipeline.test.ts +14 -0
  150. package/src/components/product-pipeline.ts +13 -1
  151. package/src/config.ts +15 -0
  152. package/src/lexicon.ts +1 -2
  153. package/src/lifecycle/release-cut.ts +11 -0
  154. package/src/lifecycle/release-images-dockerfile.test.ts +10 -2
  155. package/src/lifecycle/release-images.ts +12 -8
  156. package/src/lifecycle/release-publish.ts +34 -3
  157. package/src/lifecycle/release-version.test.ts +155 -0
  158. package/src/lifecycle/release-version.ts +226 -0
  159. package/src/mcp/types.ts +27 -0
  160. package/src/notify-message-words.test.ts +1 -2
  161. package/src/notify-product.ts +1 -2
  162. package/src/op/activities/review-product.ts +1 -2
  163. package/src/op/gate.ts +46 -0
  164. package/src/op/index.ts +10 -4
  165. package/src/op/op-waves-after-plan-wave.test.ts +225 -0
  166. package/src/op/op-waves-after-plan.ts +228 -5
  167. package/src/op/op-waves-capability-spec.ts +1 -1
  168. package/src/op/op-waves-capability.test.ts +9 -1
  169. package/src/op/op-waves-capability.ts +246 -13
  170. package/src/op/op-waves-gate-port.test.ts +232 -0
  171. package/src/op/op-waves-run-hooks.test.ts +183 -0
  172. package/src/op/op-waves-run-hooks.ts +194 -0
  173. package/src/op/op-waves-run.ts +313 -25
  174. package/src/op/op-waves-step-wave.test.ts +276 -0
  175. package/src/op/op-waves.ts +15 -2
  176. package/src/op/runtime.ts +2 -0
  177. package/src/pr-forge-reads-compare.test.ts +145 -0
  178. package/src/pr-forge-reads.test.ts +203 -0
  179. package/src/pr-forge-reads.ts +398 -1
  180. package/src/pr-plan-note.ts +1 -2
  181. package/src/release-floors.ts +32 -5
  182. package/src/workspace/change-set.schema.json +7 -0
  183. package/src/workspace/release-workflow.test.ts +18 -0
  184. package/src/workspace/release-workflow.ts +21 -1
@@ -20,11 +20,68 @@
20
20
  * The spec's command hooks at `hooks.after.plan` keep running where they
21
21
  * ran: after the set digest, before the gate settles. A `perRun` one gets
22
22
  * `{planJson}`, `CHANT_PLAN_DIGEST` and `CHANT_PLAN_JSON` the same way.
23
+ *
24
+ * ## The wave answer (#4842)
25
+ *
26
+ * A hook's `wave`, when it has one, is called once per job after its `run`
27
+ * was called for each of its runs, with all of them. It answers for the wave
28
+ * as a whole, as a plans file does for a wave-level plan command:
29
+ *
30
+ * - `pending`: fields for the pending fact (a `description`, the commit it
31
+ * planned), under the plans file's rules (`pendingFields`).
32
+ * - `members`: digest members that are no run, such as the wave's monthly
33
+ * cost from the product's own estimator.
34
+ * - `holds`: reasons the wave waits for a person whatever its gate, one line
35
+ * each, as a held hook's.
36
+ * - `overriders` and `overridersSource`: who may override a denial, in place
37
+ * of the overriders file at base. A run's own answer can name its own
38
+ * `overriders`, which count for that run in place of the wave's.
39
+ * - `report`: the product's report of these plans. When the wave waits,
40
+ * chant stores it beside the pending fact, at
41
+ * `_gates/<op>/<gate>/<digest>.json`, once. When the plans moved after an
42
+ * approval, chant writes it and the report stored for the approved plans
43
+ * to `.chant/op-waves/<name>/wave-<k>/report/` (`current.json`,
44
+ * `approved.json`) and names them on the decision, for the job that
45
+ * explains the refusal.
46
+ *
47
+ * A `wave` that throws follows the hook's `onFailure`, as `run` does.
23
48
  */
24
49
  import type { ChangeSetPart } from "../change-set.js";
25
50
  import type { OpRunPolicyRow } from "./runtime.js";
51
+ import type { WaveMember } from "../wave-engine.js";
26
52
  import { type OpWaveHookFailure } from "./op-waves.js";
27
- import type { OpWaveHookOutcome } from "./stage-hooks.js";
53
+ import { type OpWaveHookOutcome } from "./stage-hooks.js";
54
+ /** The first chant whose after-plan hooks answer for the wave as a whole (`wave`), take a run's own `overriders`, and whose wave keeps the hook's report beside its pending fact (#4842). */
55
+ export declare const OP_WAVE_AFTER_PLAN_WAVE_FLOOR = "0.124.79";
56
+ /** The first chant whose wave answer takes `approvals`, recorded at the wave's gate before chant decides it (terragucci issue 1303). */
57
+ export declare const OP_WAVE_ANSWER_APPROVALS_FLOOR = "0.124.80";
58
+ /**
59
+ * An approval a product settled before the gate (terragucci issue 1303),
60
+ * which chant records at the wave's gate for the digest it decides: a
61
+ * covered round's (the approval of the plans these are covered by), the
62
+ * rest of a stopped apply's (the approval the stopped apply ran under), or
63
+ * a review the product read itself. It counts as any approval does, under
64
+ * the wave's approval mode, `approvals.involved` and `approvals.quorum`.
65
+ */
66
+ export interface OpWaveAnswerApproval {
67
+ /** Who approved, as the ledger names an approver. */
68
+ resolvedBy: string;
69
+ /** Why this approval stands for these plans, for the ledger and the log. */
70
+ note: string;
71
+ /** Where it was approved, an http or https URL. */
72
+ url?: string;
73
+ /**
74
+ * A review the product read (`approvals.reviewLedger` names the spec's op):
75
+ * written as the product's own review line, `via: "pr-review"` with the
76
+ * pull request, its head and its reviewers, which proves each reviewer
77
+ * under `pr-review`.
78
+ */
79
+ review?: {
80
+ pr: number;
81
+ head: string;
82
+ reviewers: string[];
83
+ };
84
+ }
28
85
  /** One planned run, as an after-plan hook in the job's process sees it (#4614). */
29
86
  export interface OpWaveAfterPlanRun {
30
87
  /** The spec's name and `op`. */
@@ -60,6 +117,36 @@ export interface OpWaveAfterPlanResult {
60
117
  policy?: OpRunPolicyRow[];
61
118
  /** Files the hook wrote for the run, relative to the job's directory. */
62
119
  files?: string[];
120
+ /** Who may override this run's denial (#4842), in place of the wave's overriders. */
121
+ overriders?: string[];
122
+ }
123
+ /** A job's planned runs, as a hook's wave answer sees them (#4842). */
124
+ export interface OpWaveAfterPlanWave {
125
+ spec: string;
126
+ op: string;
127
+ wave: number;
128
+ waveName: string;
129
+ job: OpWaveAfterPlanRun["job"];
130
+ /** The runs the hook is for, in the wave's order, as its `run` saw each. */
131
+ runs: OpWaveAfterPlanRun[];
132
+ cwd: string;
133
+ }
134
+ /** What a hook adds to the wave as a whole (#4842). */
135
+ export interface OpWaveAfterPlanWaveResult {
136
+ /** Fields for the wave's pending fact, as a plans file's `pending`. */
137
+ pending?: Record<string, unknown>;
138
+ /** Digest members that are no run, such as the wave's cost. */
139
+ members?: WaveMember[];
140
+ /** Why the wave waits for a person whatever its gate, a line each. */
141
+ holds?: string[];
142
+ /** Who may override a denial, in place of the overriders file at base. */
143
+ overriders?: string[];
144
+ /** Where those overriders come from, for a refusal: "policy.override in terragucci.yml". */
145
+ overridersSource?: string;
146
+ /** The product's report of these plans: stored beside the pending fact, and written for the respond job after the plans moved. */
147
+ report?: string;
148
+ /** Approvals the product settled before the gate (terragucci issue 1303), recorded at the gate for the wave's digest before it is decided. */
149
+ approvals?: OpWaveAnswerApproval[];
63
150
  }
64
151
  /** An after-plan hook in the wave job's process (#4614). */
65
152
  export interface OpWaveAfterPlanHook {
@@ -70,16 +157,33 @@ export interface OpWaveAfterPlanHook {
70
157
  /** The runs it is for, as a command hook's `targets`. Default: every run. */
71
158
  targets?: string[];
72
159
  run(planned: OpWaveAfterPlanRun): OpWaveAfterPlanResult | void | Promise<OpWaveAfterPlanResult | void>;
160
+ /** Called once per job after `run` for each of its runs (#4842): what the hook adds to the wave. */
161
+ wave?(planned: OpWaveAfterPlanWave): OpWaveAfterPlanWaveResult | void | Promise<OpWaveAfterPlanWaveResult | void>;
73
162
  }
74
163
  /** What is wrong with `afterPlan`, empty when nothing is. */
75
164
  export declare function opWaveAfterPlanProblems(hooks: unknown): string[];
76
165
  /** What is wrong with one answer of a hook, empty when nothing is. */
77
166
  export declare function opWaveAfterPlanResultProblems(value: unknown): string[];
167
+ /** What is wrong with one wave answer (#4842), empty when nothing is. `targets` are the wave's runs, which no digest member may be named. */
168
+ export declare function opWaveAfterPlanWaveResultProblems(value: unknown, targets: readonly string[]): string[];
78
169
  /** What one run's hooks came to. */
79
170
  export interface OpWaveAfterPlanRunOutcome {
80
171
  /** The hooks' rows, in order. */
81
172
  policy: OpRunPolicyRow[];
82
173
  files: string[];
174
+ /** Who may override its denial (#4842), when a hook named anyone: the last hook's list. */
175
+ overriders?: string[];
176
+ }
177
+ /** What the hooks' wave answers came to (#4842), each hook's in order. */
178
+ export interface OpWaveAfterPlanWaveOutcome {
179
+ pending?: Record<string, unknown>;
180
+ members: WaveMember[];
181
+ holds: string[];
182
+ overriders?: string[];
183
+ overridersSource?: string;
184
+ report?: string;
185
+ /** Each hook's `approvals`, in order (terragucci issue 1303). */
186
+ approvals: OpWaveAnswerApproval[];
83
187
  }
84
188
  /** What the after-plan hooks in the job's process came to (#4614). */
85
189
  export interface OpWaveAfterPlanOutcome {
@@ -90,6 +194,8 @@ export interface OpWaveAfterPlanOutcome {
90
194
  outcomes: OpWaveHookOutcome[];
91
195
  /** Each run's rows and files, by target, for the runs a hook answered. */
92
196
  runs: Map<string, OpWaveAfterPlanRunOutcome>;
197
+ /** The wave answers (#4842). */
198
+ wave: OpWaveAfterPlanWaveOutcome;
93
199
  }
94
200
  /**
95
201
  * Call each hook once per run it is for, hook by hook, each over the runs
@@ -129,6 +235,8 @@ export interface ProductWaveHook {
129
235
  capabilities?: import("../components/capability.js").CapabilityRegistry;
130
236
  /** How the spec's command hooks run, when they call back into the product's process (`RunOpWaveOptions.hookExec`). */
131
237
  hookExec?: import("./stage-hooks.js").OpWaveAsyncExec;
238
+ /** Hooks around each run of a wave with a `step` (#4842, `RunOpWaveOptions.runHooks`). */
239
+ runHooks?: import("./op-waves-run-hooks.js").OpWaveRunHooks | readonly import("./op-waves-run-hooks.js").OpWaveRunHooks[];
132
240
  }
133
241
  /** The product's wave hook while a command it runs in process runs, else undefined. */
134
242
  export declare function activeProductWaveHook(): ProductWaveHook | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"op-waves-after-plan.d.ts","sourceRoot":"","sources":["../../src/op/op-waves-after-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAyC,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC3F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,mFAAmF;AACnF,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,oIAAoI;IACpI,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,M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CAAE,GAClG;IAAE,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAWhG;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,mBAAmB,GAAG,SAAS,mBAAmB,EAAE,CAAC;IACjE,YAAY,CAAC,EAAE,OAAO,0BAA0B,EAAE,kBAAkB,CAAC;IACrE,sHAAsH;IACtH,QAAQ,CAAC,EAAE,OAAO,eAAe,EAAE,eAAe,CAAC;IACnD,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,OAAO,sBAAsB,EAAE,cAAc,GAAG,SAAS,OAAO,sBAAsB,EAAE,cAAc,EAAE,CAAC;CACrH;AAID,uFAAuF;AACvF,wBAAgB,qBAAqB,IAAI,eAAe,GAAG,SAAS,CAEnE;AAED,kFAAkF;AAClF,wBAAsB,mBAAmB,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAShH"}
@@ -20,9 +20,40 @@
20
20
  * The spec's command hooks at `hooks.after.plan` keep running where they
21
21
  * ran: after the set digest, before the gate settles. A `perRun` one gets
22
22
  * `{planJson}`, `CHANT_PLAN_DIGEST` and `CHANT_PLAN_JSON` the same way.
23
+ *
24
+ * ## The wave answer (#4842)
25
+ *
26
+ * A hook's `wave`, when it has one, is called once per job after its `run`
27
+ * was called for each of its runs, with all of them. It answers for the wave
28
+ * as a whole, as a plans file does for a wave-level plan command:
29
+ *
30
+ * - `pending`: fields for the pending fact (a `description`, the commit it
31
+ * planned), under the plans file's rules (`pendingFields`).
32
+ * - `members`: digest members that are no run, such as the wave's monthly
33
+ * cost from the product's own estimator.
34
+ * - `holds`: reasons the wave waits for a person whatever its gate, one line
35
+ * each, as a held hook's.
36
+ * - `overriders` and `overridersSource`: who may override a denial, in place
37
+ * of the overriders file at base. A run's own answer can name its own
38
+ * `overriders`, which count for that run in place of the wave's.
39
+ * - `report`: the product's report of these plans. When the wave waits,
40
+ * chant stores it beside the pending fact, at
41
+ * `_gates/<op>/<gate>/<digest>.json`, once. When the plans moved after an
42
+ * approval, chant writes it and the report stored for the approved plans
43
+ * to `.chant/op-waves/<name>/wave-<k>/report/` (`current.json`,
44
+ * `approved.json`) and names them on the decision, for the job that
45
+ * explains the refusal.
46
+ *
47
+ * A `wave` that throws follows the hook's `onFailure`, as `run` does.
23
48
  */
24
49
  import { isAbsolute } from "node:path";
50
+ import { NEXT_RELEASE } from "../release-floors.js";
25
51
  import { OP_WAVE_HOOK_FAILURES, opWaveHookRuns } from "./op-waves.js";
52
+ import { OP_WAVE_PENDING_RESERVED } from "./stage-hooks.js";
53
+ /** The first chant whose after-plan hooks answer for the wave as a whole (`wave`), take a run's own `overriders`, and whose wave keeps the hook's report beside its pending fact (#4842). */
54
+ export const OP_WAVE_AFTER_PLAN_WAVE_FLOOR = "0.124.79";
55
+ /** The first chant whose wave answer takes `approvals`, recorded at the wave's gate before chant decides it (terragucci issue 1303). */
56
+ export const OP_WAVE_ANSWER_APPROVALS_FLOOR = NEXT_RELEASE;
26
57
  const ROW_RESULTS = ["passed", "warned", "denied", "held"];
27
58
  /** What is wrong with `afterPlan`, empty when nothing is. */
28
59
  export function opWaveAfterPlanProblems(hooks) {
@@ -39,6 +70,8 @@ export function opWaveAfterPlanProblems(hooks) {
39
70
  problems.push(`${at} needs a name`);
40
71
  if (typeof hook.run !== "function")
41
72
  problems.push(`${at} needs a run function`);
73
+ if (hook.wave !== undefined && typeof hook.wave !== "function")
74
+ problems.push(`${at}.wave must be a function`);
42
75
  if (hook.onFailure !== undefined && !OP_WAVE_HOOK_FAILURES.includes(hook.onFailure))
43
76
  problems.push(`${at} has onFailure "${String(hook.onFailure)}"; use ${OP_WAVE_HOOK_FAILURES.join(" or ")}`);
44
77
  if (hook.targets !== undefined && (!Array.isArray(hook.targets) || hook.targets.length === 0 || !hook.targets.every((t) => typeof t === "string" && t !== "")))
@@ -51,7 +84,7 @@ export function opWaveAfterPlanResultProblems(value) {
51
84
  if (value === undefined || value === null)
52
85
  return [];
53
86
  if (typeof value !== "object" || Array.isArray(value))
54
- return ["the answer must be { policy?, files? }"];
87
+ return ["the answer must be { policy?, files?, overriders? }"];
55
88
  const r = value;
56
89
  const problems = [];
57
90
  if (r.policy !== undefined) {
@@ -77,6 +110,90 @@ export function opWaveAfterPlanResultProblems(value) {
77
110
  if (r.files !== undefined && (!Array.isArray(r.files) || !r.files.every((f) => typeof f === "string" && f !== "" && !isAbsolute(f) && !f.split("/").includes("..")))) {
78
111
  problems.push("`files` must be paths inside the job's directory, relative to it");
79
112
  }
113
+ if (r.overriders !== undefined && !principals(r.overriders))
114
+ problems.push("`overriders` must be a list of principals");
115
+ return problems;
116
+ }
117
+ const principals = (v) => Array.isArray(v) && v.every((p) => typeof p === "string" && p.trim() !== "");
118
+ /** What is wrong with one wave answer (#4842), empty when nothing is. `targets` are the wave's runs, which no digest member may be named. */
119
+ export function opWaveAfterPlanWaveResultProblems(value, targets) {
120
+ if (value === undefined || value === null)
121
+ return [];
122
+ if (typeof value !== "object" || Array.isArray(value))
123
+ return ["the wave answer must be { pending?, members?, holds?, overriders?, overridersSource?, report?, approvals? }"];
124
+ const r = value;
125
+ const problems = [];
126
+ if (r.pending !== undefined) {
127
+ const p = r.pending;
128
+ if (p === null || typeof p !== "object" || Array.isArray(p))
129
+ problems.push("`pending` must be an object of fields for the pending fact");
130
+ else {
131
+ const reserved = Object.keys(p).filter((key) => OP_WAVE_PENDING_RESERVED.includes(key));
132
+ if (reserved.length > 0)
133
+ problems.push(`\`pending\` cannot set ${reserved.join(", ")}, which chant writes`);
134
+ if ("description" in p && typeof p.description !== "string")
135
+ problems.push("`pending.description` must be a string");
136
+ }
137
+ }
138
+ if (r.overriders !== undefined && !principals(r.overriders))
139
+ problems.push("`overriders` must be a list of principals");
140
+ if (r.overridersSource !== undefined && (typeof r.overridersSource !== "string" || r.overridersSource.trim() === ""))
141
+ problems.push("`overridersSource` must say where the overriders come from");
142
+ if (r.members !== undefined) {
143
+ if (!Array.isArray(r.members))
144
+ problems.push("`members` must be a list of { member, planDigest }");
145
+ else {
146
+ const seen = new Set();
147
+ for (const m of r.members) {
148
+ if (!m || typeof m.member !== "string" || m.member === "" || typeof m.planDigest !== "string" || m.planDigest === "") {
149
+ problems.push("each of `members` needs a member and a planDigest");
150
+ continue;
151
+ }
152
+ if (targets.includes(m.member))
153
+ problems.push(`member ${m.member} is also a run's target; a digest member that is no run needs a name of its own`);
154
+ else if (seen.has(m.member))
155
+ problems.push(`\`members\` names ${m.member} twice`);
156
+ seen.add(m.member);
157
+ }
158
+ }
159
+ }
160
+ if (r.holds !== undefined && !(Array.isArray(r.holds) && r.holds.every((h) => typeof h === "string" && h.trim() !== "")))
161
+ problems.push("`holds` must be a list of reasons, each a line saying why the wave waits for a person");
162
+ if (r.report !== undefined && typeof r.report !== "string")
163
+ problems.push("`report` must be the report's text");
164
+ if (r.approvals !== undefined) {
165
+ if (!Array.isArray(r.approvals))
166
+ problems.push("`approvals` must be a list of { resolvedBy, note, url?, review? }");
167
+ else
168
+ r.approvals.forEach((x, i) => problems.push(...answerApprovalProblems(x, `approvals[${i}]`)));
169
+ }
170
+ return problems;
171
+ }
172
+ /** What is wrong with one of a wave answer's `approvals` (terragucci issue 1303). */
173
+ function answerApprovalProblems(value, at) {
174
+ const a = value;
175
+ if (!a || typeof a !== "object" || Array.isArray(a))
176
+ return [`${at} must be { resolvedBy, note, url?, review? }`];
177
+ const problems = [];
178
+ if (typeof a.resolvedBy !== "string" || a.resolvedBy.trim() === "")
179
+ problems.push(`${at}.resolvedBy must name the approver`);
180
+ if (typeof a.note !== "string" || a.note.trim() === "")
181
+ problems.push(`${at}.note must say why the approval stands for these plans`);
182
+ if (a.url !== undefined && (typeof a.url !== "string" || !/^https?:\/\/\S+$/.test(a.url)))
183
+ problems.push(`${at}.url must be an http or https URL`);
184
+ if (a.review !== undefined) {
185
+ const r = a.review;
186
+ if (!r || typeof r !== "object")
187
+ problems.push(`${at}.review must be { pr, head, reviewers }`);
188
+ else {
189
+ if (typeof r.pr !== "number" || !Number.isInteger(r.pr) || r.pr < 1)
190
+ problems.push(`${at}.review.pr must be the pull request's number`);
191
+ if (typeof r.head !== "string" || r.head.trim() === "")
192
+ problems.push(`${at}.review.head must be the commit the review approved`);
193
+ if (!principals(r.reviewers) || r.reviewers.length === 0)
194
+ problems.push(`${at}.review.reviewers must list the reviewers`);
195
+ }
196
+ }
80
197
  return problems;
81
198
  }
82
199
  /**
@@ -86,9 +203,11 @@ export function opWaveAfterPlanResultProblems(value) {
86
203
  * `approve` it holds the wave and the rest go on.
87
204
  */
88
205
  export async function runOpWaveAfterPlanHooks(hooks, runs, log) {
89
- const out = { holds: [], outcomes: [], runs: new Map() };
206
+ const out = { holds: [], outcomes: [], runs: new Map(), wave: { members: [], holds: [], approvals: [] } };
207
+ const targets = runs.map((r) => r.target);
90
208
  for (const hook of hooks) {
91
- for (const run of opWaveHookRuns(hook, runs)) {
209
+ const mine = opWaveHookRuns(hook, runs);
210
+ for (const run of mine) {
92
211
  const label = `after-plan hook ${hook.name} (${run.target})`;
93
212
  let problem;
94
213
  let answer = undefined;
@@ -113,6 +232,11 @@ export async function runOpWaveAfterPlanHooks(hooks, runs, log) {
113
232
  got.files.push(f);
114
233
  out.runs.set(run.target, got);
115
234
  }
235
+ if (answer?.overriders) {
236
+ const got = out.runs.get(run.target) ?? { policy: [], files: [] };
237
+ got.overriders = [...new Set(answer.overriders)].sort();
238
+ out.runs.set(run.target, got);
239
+ }
116
240
  continue;
117
241
  }
118
242
  if (hook.onFailure === "approve") {
@@ -126,9 +250,62 @@ export async function runOpWaveAfterPlanHooks(hooks, runs, log) {
126
250
  log(problem);
127
251
  return out;
128
252
  }
253
+ if (!hook.wave || mine.length === 0)
254
+ continue;
255
+ // #4842: the hook's answer for the wave, once its runs were each answered.
256
+ const first = mine[0];
257
+ const label = `after-plan hook ${hook.name} (wave ${first.wave})`;
258
+ let problem;
259
+ let answer = undefined;
260
+ try {
261
+ answer = await hook.wave({ spec: first.spec, op: first.op, wave: first.wave, waveName: first.waveName, job: first.job, runs: [...mine], cwd: first.cwd });
262
+ const wrong = opWaveAfterPlanWaveResultProblems(answer, targets);
263
+ if (wrong.length > 0)
264
+ problem = `${label} answered with ${wrong.join("; ")}`;
265
+ }
266
+ catch (err) {
267
+ problem = `${label} failed: ${err instanceof Error ? err.message : String(err)}`;
268
+ }
269
+ const base = { moment: "after-plan", name: hook.name };
270
+ if (problem === undefined) {
271
+ out.outcomes.push({ ...base, exit: 0, outcome: "passed" });
272
+ if (answer)
273
+ foldWaveAnswer(out.wave, answer);
274
+ continue;
275
+ }
276
+ if (hook.onFailure === "approve") {
277
+ out.outcomes.push({ ...base, exit: 1, outcome: "held" });
278
+ out.holds.push(label);
279
+ log(`${problem}, so wave ${first.wave} (${first.waveName}) waits for an approval of its set digest`);
280
+ continue;
281
+ }
282
+ out.outcomes.push({ ...base, exit: 1, outcome: "failed" });
283
+ out.failed = problem;
284
+ log(problem);
285
+ return out;
129
286
  }
130
287
  return out;
131
288
  }
289
+ /** Fold one hook's wave answer into what the answers so far came to: fields and lists add up, a later list of overriders or report wins. */
290
+ function foldWaveAnswer(into, answer) {
291
+ if (answer.pending && Object.keys(answer.pending).length > 0)
292
+ into.pending = { ...into.pending, ...answer.pending };
293
+ for (const m of answer.members ?? [])
294
+ if (!into.members.some((x) => x.member === m.member))
295
+ into.members.push({ member: m.member, planDigest: m.planDigest });
296
+ for (const h of answer.holds ?? [])
297
+ if (!into.holds.includes(h))
298
+ into.holds.push(h);
299
+ if (answer.overriders)
300
+ into.overriders = [...new Set(answer.overriders)].sort();
301
+ if (answer.overridersSource)
302
+ into.overridersSource = answer.overridersSource;
303
+ if (answer.report !== undefined)
304
+ into.report = answer.report;
305
+ for (const a of answer.approvals ?? []) {
306
+ into.approvals.push({ resolvedBy: a.resolvedBy, note: a.note, ...(a.url ? { url: a.url } : {}), ...(a.review ? { review: { pr: a.review.pr, head: a.review.head, reviewers: [...a.review.reviewers] } } : {}) });
307
+ }
308
+ }
132
309
  /** Fold policy rows into a run's denial and hold: the rules of every `denied` row, and of every `held` row. */
133
310
  export function foldPolicyRows(rows, now) {
134
311
  const fold = (kind, was) => {
@@ -28,8 +28,7 @@ export function opWaveStepProblems(spec) {
28
28
  if (spec.hooks?.apply?.runBy === "apply")
29
29
  problems.push("`hooks.apply.runBy: \"apply\"` hands the apply-stage hooks to an apply command, and a `step` has none; leave runBy as chant");
30
30
  for (const wave of spec.waves) {
31
- if (wave.discover)
32
- problems.push(`wave "${wave.name}" discovers its runs, which only \`planWave\` can report; a \`step\` plans the runs the spec lists`);
31
+ // #4842: a step's capability finds a discovering wave's runs (`discoverRuns`), checked when the wave plans.
33
32
  if (wave.hooks?.apply?.runBy === "apply")
34
33
  problems.push(`wave "${wave.name}" hands its apply-stage hooks to an apply command, and a \`step\` has none`);
35
34
  for (const run of wave.runs ?? []) {
@@ -31,6 +31,23 @@
31
31
  * capability refuses as moved (`isPlanMovedError`) applied nothing and the
32
32
  * job exits 4, the table's moved code (#4553); any other error fails it.
33
33
  *
34
+ * ## A wave planned as one (#4842)
35
+ *
36
+ * Some tools plan a wave as a whole. A `discover` wave asks the step's
37
+ * capability for its runs (`discoverRuns`), such as one layer of a
38
+ * Terragrunt repo's units from `terragrunt find`, and plans each run found
39
+ * with `{target}` filled. A wave marked `together` plans its runs in one
40
+ * `planGroup` call and applies them in one `runGroup` call, as a fan-out
41
+ * applies a group (ws-107): Terragrunt's `run --all` over the layer, or a
42
+ * composed run of roots that read each other. Each run keeps its own member
43
+ * digest (its share of the plan), and the group digest (the capability's
44
+ * digest of the whole with each run's, `groupDigest`) is one more digest
45
+ * member, `(wave plan)`, so an approval of one composition does not apply
46
+ * another. The group's artifact goes back to `runGroup`; a run's own
47
+ * artifact stays on its plan file for `{planJson}`. The run hooks run per
48
+ * run around the one call, each run's `processEnv` and `afterInit` on its
49
+ * member's context.
50
+ *
34
51
  * The registry is the project's (`fanOutRegistry`, the one `chant run
35
52
  * --components` builds), loaded once per job behind a dynamic import, so the
36
53
  * wave-job runtime bundle stays without the config loader. A product that
@@ -52,7 +69,7 @@
52
69
  * not apply at another. A run the estimator cannot price holds the wave
53
70
  * too. The terraform lexicon's preset is `terraformCostHold` (infracost).
54
71
  */
55
- import type { Capability, CapabilityRegistry, DeployContext } from "../components/capability.js";
72
+ import type { Capability, CapabilityPlan, CapabilityRegistry, DeployContext } from "../components/capability.js";
56
73
  import type { CapabilityTraceFacts } from "../otlp.js";
57
74
  import { type ChangeSetDocument, type ChangeSetPart } from "../change-set.js";
58
75
  import type { GatePolicyExec } from "../gate-policy.js";
@@ -65,8 +82,10 @@ export { OP_WAVE_COST_FORMATS, OP_WAVE_COST_MEMBER, opWaveHoldsAt, opWaveHoldsPr
65
82
  export type { OpWaveCostFormat, OpWaveCostHold, OpWaveHolds, OpWaveStep } from "./op-waves-capability-spec.js";
66
83
  /** The input a run's step gets (#4545): the spec's step with the run's values filled in, and the run's own `input` over it. */
67
84
  export declare function opWaveStepInput(spec: Pick<OpWavesSpec, "op" | "step">, wave: Pick<OpWave, "name">, run: OpWaveRun): Record<string, unknown>;
85
+ /** The input `discoverRuns` gets (#4842): the spec's step with `{op}` and `{wave}` filled and `{target}` left as written. */
86
+ export declare function opWaveDiscoverInput(spec: Pick<OpWavesSpec, "op" | "step">, wave: Pick<OpWave, "name">): Record<string, unknown>;
68
87
  /** The context a run's step plans and applies with: the spec's `labels.Env`, else the wave's name, and the run's target as the component. */
69
- export declare function opWaveStepContext(spec: Pick<OpWavesSpec, "labels">, wave: Pick<OpWave, "name">, run: OpWaveRun): DeployContext;
88
+ export declare function opWaveStepContext(spec: Pick<OpWavesSpec, "labels">, wave: Pick<OpWave, "name">, run: OpWaveRun, cwd?: string): DeployContext;
70
89
  /**
71
90
  * The registry a job plans and applies through: `given`, else the project's
72
91
  * at `cwd`, loaded once per `key` (the job's options) behind a dynamic
@@ -87,8 +106,23 @@ export interface OpWaveStepPlan {
87
106
  destructive: boolean;
88
107
  /** The run's lock grain and rows (#4552), which the apply leases on the resource grain. */
89
108
  lock?: PlannedLock;
109
+ /** Set when the wave planned `together` (#4842): the one plan every run of it shares. */
110
+ group?: OpWaveStepGroup;
111
+ }
112
+ /** A wave's plan in one `planGroup` call (#4842), shared by each of its runs' plans. */
113
+ export interface OpWaveStepGroup {
114
+ /** The group digest (`groupDigest`): the capability's digest of the whole, with each run's member and plan digest. */
115
+ digest: string;
116
+ /** What `planGroup` gave for `runGroup`. */
117
+ artifact?: unknown;
118
+ /** Each run's plan as the capability gave it, by target. */
119
+ plans: Record<string, CapabilityPlan>;
90
120
  }
91
- /** Whether a part changes nothing, and whether it destroys or replaces something. */
121
+ /** The digest member a wave planned `together` adds (#4842): no run has this name. */
122
+ export declare const OP_WAVE_TOGETHER_MEMBER = "(wave plan)";
123
+ /** The release that has `discover` with a `step`, and `together` waves (#4842). */
124
+ export declare const OP_WAVE_STEP_WAVE_FLOOR = "0.124.79";
125
+ /** Whether a part changes nothing, and whether it destroys or replaces something. A plan that changes only outputs changes something (#4849). */
92
126
  export declare function partEffects(part: ChangeSetPart | undefined): {
93
127
  empty: boolean;
94
128
  destructive: boolean;
@@ -102,7 +136,61 @@ export declare function planOpWaveStep(at: {
102
136
  planPath: string;
103
137
  lockGrain?: LockGrain | null;
104
138
  policyBase?: string;
139
+ processEnv?: Record<string, string>;
140
+ afterInit?: () => Promise<void>;
105
141
  }, run: OpWaveRun): Promise<OpWaveStepPlan>;
142
+ /**
143
+ * The runs of a `discover` wave through the spec's step (#4842): what the
144
+ * capability's `discoverRuns` finds for wave `k`, each a run of the spec's
145
+ * op, and how many waves it found.
146
+ */
147
+ export declare function discoverOpWaveStepRuns(at: {
148
+ spec: OpWavesSpec;
149
+ wave: OpWave;
150
+ k: number;
151
+ registry: CapabilityRegistry;
152
+ cwd?: string;
153
+ }): Promise<{
154
+ runs: OpWaveRun[];
155
+ waves?: number;
156
+ }>;
157
+ /**
158
+ * Plan a `together` wave's runs in one `planGroup` call (#4842), writing
159
+ * each run's plan file at `planPath(target)` (relative to `cwd`). Each run's
160
+ * plan carries the group. Throws when the call does or leaves a run out, and
161
+ * on a run's plan as {@link planOpWaveStep} does.
162
+ */
163
+ export declare function planOpWaveStepGroup(at: {
164
+ spec: OpWavesSpec;
165
+ wave: OpWave;
166
+ cwd: string;
167
+ registry: CapabilityRegistry;
168
+ planPath: (target: string) => string;
169
+ lockGrain?: LockGrain | null;
170
+ policyBase?: string;
171
+ /** Each run's environment and check after init, from the run hooks. */
172
+ runCtx?: (target: string) => {
173
+ processEnv?: Record<string, string>;
174
+ afterInit?: () => Promise<void>;
175
+ };
176
+ }, runs: readonly OpWaveRun[]): Promise<OpWaveStepPlan[]>;
177
+ /**
178
+ * Apply a `together` wave's runs in one `runGroup` call (#4842), with the
179
+ * plan the gate decided. Each run's outcome, in the order given: `applied`
180
+ * and `no-changes` applied, with the member's outputs; `partial`, `failed`
181
+ * and `not-started` failed. A throw fails every run, or moves every run
182
+ * when it is a moved plan (`isPlanMovedError`).
183
+ */
184
+ export declare function applyOpWaveStepGroup(at: {
185
+ spec: OpWavesSpec;
186
+ wave: OpWave;
187
+ registry: CapabilityRegistry;
188
+ runEnv?: (target: string) => Record<string, string> | undefined;
189
+ cwd?: string;
190
+ }, runs: ReadonlyArray<{
191
+ run: OpWaveRun;
192
+ plan: OpWaveStepPlan;
193
+ }>): Promise<OpWaveStepApply[]>;
106
194
  /** How one run's apply through its step came out, with what the capability knew about it (#4555). */
107
195
  export type OpWaveStepApply = ({
108
196
  outcome: "applied";
@@ -132,6 +220,8 @@ export declare function applyOpWaveStep(at: {
132
220
  spec: OpWavesSpec;
133
221
  wave: OpWave;
134
222
  registry: CapabilityRegistry;
223
+ processEnv?: Record<string, string>;
224
+ cwd?: string;
135
225
  }, run: OpWaveRun, plan: OpWaveStepPlan): Promise<OpWaveStepApply>;
136
226
  /** The wave's change-set document (#4551) from its runs' parts, or undefined when no run gave one. */
137
227
  export declare function opWaveStepChangeSet(plans: readonly OpWaveStepPlan[]): ChangeSetDocument | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"op-waves-capability.d.ts","sourceRoot":"","sources":["../../src/op/op-waves-capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAkB,kBAAkB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAoB,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAE7F,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAsB,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE9F,OAAO,EAA6C,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAmB,MAAM,4BAA4B,CAAC;AAEpJ,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC/I,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,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