@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
@@ -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
@@ -55,12 +72,13 @@
55
72
 
56
73
  import { spawnSync } from "node:child_process";
57
74
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
58
- import { dirname, join } from "node:path";
59
- import type { Capability, CapabilityPlan, CapabilityRegistry, DeployContext } from "../components/capability";
75
+ import { dirname, join, resolve } from "node:path";
76
+ import type { Capability, CapabilityPlan, CapabilityRegistry, DeployContext, GroupContext, GroupMember } from "../components/capability";
60
77
  import { isPlanMovedError } from "../components/capability";
61
78
  import type { CapabilityTraceFacts } from "../otlp";
62
79
  import { composeChangeSet, type ChangeSetDocument, type ChangeSetPart } from "../change-set";
63
80
  import { computePlanDigest } from "../lifecycle/plan-digest";
81
+ import { groupDigest } from "../components/group-digest";
64
82
  import type { GatePolicyExec, GatePolicyRun } from "../gate-policy";
65
83
  import type { ResolvedGatePolicySource } from "../policy-source";
66
84
  import type { WaveMember } from "../wave-engine";
@@ -88,9 +106,17 @@ export function opWaveStepInput(spec: Pick<OpWavesSpec, "op" | "step">, wave: Pi
88
106
  return { ...(fill(rest, vars) as Record<string, unknown>), ...((run.input ? fill(run.input, vars) : {}) as Record<string, unknown>) };
89
107
  }
90
108
 
109
+ /** The input `discoverRuns` gets (#4842): the spec's step with `{op}` and `{wave}` filled and `{target}` left as written. */
110
+ export function opWaveDiscoverInput(spec: Pick<OpWavesSpec, "op" | "step">, wave: Pick<OpWave, "name">): Record<string, unknown> {
111
+ if (!spec.step) throw new Error("the spec names no step");
112
+ const { kind: _kind, ...rest } = spec.step;
113
+ return fill(rest, { target: "{target}", op: spec.op, wave: wave.name }) as Record<string, unknown>;
114
+ }
115
+
91
116
  /** 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. */
92
- export function opWaveStepContext(spec: Pick<OpWavesSpec, "labels">, wave: Pick<OpWave, "name">, run: OpWaveRun): DeployContext {
93
- return { env: spec.labels?.Env ?? wave.name, component: run.target };
117
+ export function opWaveStepContext(spec: Pick<OpWavesSpec, "labels">, wave: Pick<OpWave, "name">, run: OpWaveRun, cwd?: string): DeployContext {
118
+ // #4854: the wave's directory, where a capability looks for its project's config.
119
+ return { env: spec.labels?.Env ?? wave.name, component: run.target, ...(cwd !== undefined ? { cwd: resolve(cwd) } : {}) };
94
120
  }
95
121
 
96
122
  const registries = new WeakMap<object, Promise<CapabilityRegistry>>();
@@ -124,13 +150,31 @@ export interface OpWaveStepPlan {
124
150
  destructive: boolean;
125
151
  /** The run's lock grain and rows (#4552), which the apply leases on the resource grain. */
126
152
  lock?: PlannedLock;
153
+ /** Set when the wave planned `together` (#4842): the one plan every run of it shares. */
154
+ group?: OpWaveStepGroup;
155
+ }
156
+
157
+ /** A wave's plan in one `planGroup` call (#4842), shared by each of its runs' plans. */
158
+ export interface OpWaveStepGroup {
159
+ /** The group digest (`groupDigest`): the capability's digest of the whole, with each run's member and plan digest. */
160
+ digest: string;
161
+ /** What `planGroup` gave for `runGroup`. */
162
+ artifact?: unknown;
163
+ /** Each run's plan as the capability gave it, by target. */
164
+ plans: Record<string, CapabilityPlan>;
127
165
  }
128
166
 
129
- /** Whether a part changes nothing, and whether it destroys or replaces something. */
167
+ /** The digest member a wave planned `together` adds (#4842): no run has this name. */
168
+ export const OP_WAVE_TOGETHER_MEMBER = "(wave plan)";
169
+
170
+ /** The release that has `discover` with a `step`, and `together` waves (#4842). */
171
+ export const OP_WAVE_STEP_WAVE_FLOOR = "0.124.79";
172
+
173
+ /** Whether a part changes nothing, and whether it destroys or replaces something. A plan that changes only outputs changes something (#4849). */
130
174
  export function partEffects(part: ChangeSetPart | undefined): { empty: boolean; destructive: boolean } {
131
175
  if (!part) return { empty: false, destructive: false };
132
176
  const changing = part.entries.filter((e) => e.action !== "no-op" && e.action !== "read");
133
- return { empty: changing.length === 0, destructive: changing.some((e) => e.action === "delete" || e.action === "replace") };
177
+ return { empty: changing.length === 0 && (part.member.outputs?.length ?? 0) === 0, destructive: changing.some((e) => e.action === "delete" || e.action === "replace") };
134
178
  }
135
179
 
136
180
  function resolveCapability(registry: CapabilityRegistry, kind: string): Capability<never, unknown> {
@@ -140,7 +184,7 @@ function resolveCapability(registry: CapabilityRegistry, kind: string): Capabili
140
184
 
141
185
  /** Plan one run through the spec's step (#4545), writing its plan file at `planPath` (relative to `cwd`) as a per-run `plan` command would. */
142
186
  export async function planOpWaveStep(
143
- at: { spec: OpWavesSpec; wave: OpWave; cwd: string; registry: CapabilityRegistry; planPath: string; lockGrain?: LockGrain | null; policyBase?: string },
187
+ at: { spec: OpWavesSpec; wave: OpWave; cwd: string; registry: CapabilityRegistry; planPath: string; lockGrain?: LockGrain | null; policyBase?: string; processEnv?: Record<string, string>; afterInit?: () => Promise<void> },
144
188
  run: OpWaveRun,
145
189
  ): Promise<OpWaveStepPlan> {
146
190
  const { spec, wave, cwd, registry } = at;
@@ -150,7 +194,8 @@ export async function planOpWaveStep(
150
194
  let planned: CapabilityPlan;
151
195
  let lock: PlannedLock;
152
196
  try {
153
- planned = await capability.plan({ ...opWaveStepContext(spec, wave, run), ...(at.lockGrain ? { lockGrain: at.lockGrain } : {}), ...(at.policyBase ? { policyBase: at.policyBase } : {}) }, input as never);
197
+ // #4842: the run hooks' environment and check after init.
198
+ planned = await capability.plan({ ...opWaveStepContext(spec, wave, run, cwd), ...(at.lockGrain ? { lockGrain: at.lockGrain } : {}), ...(at.policyBase ? { policyBase: at.policyBase } : {}), ...(at.processEnv ? { processEnv: at.processEnv } : {}), ...(at.afterInit ? { afterInit: at.afterInit } : {}) }, input as never);
154
199
  // #4552: the run's grain (declared at base, else its lexicon's) and, on the resource grain, the rows its apply leases.
155
200
  lock = await resolvePlannedLock(capability, input, planned, at.lockGrain);
156
201
  } catch (err) {
@@ -174,11 +219,16 @@ export async function planOpWaveStep(
174
219
  ...effects,
175
220
  lock,
176
221
  };
177
- const file = join(cwd, at.planPath);
222
+ writeStepPlanFile(join(cwd, at.planPath), plan);
223
+ return plan;
224
+ }
225
+
226
+ /** A run's plan file, as a per-run `plan` command writes it: its digest, effects, member, artifact (when it is JSON) and part. */
227
+ function writeStepPlanFile(file: string, plan: OpWaveStepPlan): void {
178
228
  mkdirSync(dirname(file), { recursive: true });
179
229
  let artifact: unknown;
180
230
  try {
181
- artifact = planned.artifact === undefined ? undefined : JSON.parse(JSON.stringify(planned.artifact));
231
+ artifact = plan.artifact === undefined ? undefined : JSON.parse(JSON.stringify(plan.artifact));
182
232
  } catch {
183
233
  artifact = undefined;
184
234
  }
@@ -193,7 +243,190 @@ export async function planOpWaveStep(
193
243
  ...(plan.part ? { changeSet: plan.part } : {}),
194
244
  }) + "\n",
195
245
  );
196
- return plan;
246
+ }
247
+
248
+ /**
249
+ * The runs of a `discover` wave through the spec's step (#4842): what the
250
+ * capability's `discoverRuns` finds for wave `k`, each a run of the spec's
251
+ * op, and how many waves it found.
252
+ */
253
+ export async function discoverOpWaveStepRuns(at: { spec: OpWavesSpec; wave: OpWave; k: number; registry: CapabilityRegistry; cwd?: string }): Promise<{ runs: OpWaveRun[]; waves?: number }> {
254
+ const { spec, wave, k } = at;
255
+ const kind = spec.step!.kind;
256
+ const capability = resolveCapability(at.registry, kind);
257
+ if (!capability.discoverRuns) throw new Error(`wave ${k} (${wave.name}) discovers its runs, and the capability "${kind}" cannot find them (it has no discoverRuns)`);
258
+ let found: { targets?: unknown; waves?: unknown };
259
+ try {
260
+ found = await capability.discoverRuns({ env: spec.labels?.Env ?? wave.name, wave: { name: wave.name, number: k }, ...(at.cwd !== undefined ? { cwd: resolve(at.cwd) } : {}) }, opWaveDiscoverInput(spec, wave) as never);
261
+ } catch (err) {
262
+ throw new Error(`finding the runs of wave ${k} (${wave.name}) through ${kind} failed: ${err instanceof Error ? err.message : String(err)}`);
263
+ }
264
+ const targets = found?.targets;
265
+ if (!Array.isArray(targets) || !targets.every((t) => typeof t === "string" && t !== "")) throw new Error(`${kind} found the runs of wave ${k} (${wave.name}) as ${JSON.stringify(targets)}; give a list of targets`);
266
+ const dup = targets.find((t, i) => targets.indexOf(t) !== i);
267
+ if (dup !== undefined) throw new Error(`${kind} found ${dup} twice in wave ${k} (${wave.name})`);
268
+ const waves = found.waves;
269
+ if (waves !== undefined && (typeof waves !== "number" || !Number.isInteger(waves) || waves < 0)) throw new Error(`${kind} found ${JSON.stringify(waves)} waves for wave ${k} (${wave.name}); give a whole number`);
270
+ return { runs: (targets as string[]).map((target) => ({ target })), ...(waves !== undefined ? { waves: waves as number } : {}) };
271
+ }
272
+
273
+ /** The group members of a wave's runs (#4842): each run's filled input, its `dependsOn` within the wave, and its own context. */
274
+ function waveGroupMembers(spec: OpWavesSpec, wave: OpWave, runs: readonly OpWaveRun[], ctxOf: (run: OpWaveRun) => DeployContext): GroupMember<Record<string, unknown>>[] {
275
+ const inWave = new Set(runs.map((r) => r.target));
276
+ return runs.map((run) => {
277
+ const input = opWaveStepInput(spec, wave, run);
278
+ const dependsOn = (run.dependsOn ?? []).filter((d) => inWave.has(d));
279
+ return { component: run.target, step: input, input, reads: [], ...(dependsOn.length > 0 ? { dependsOn } : {}), ctx: ctxOf(run) };
280
+ });
281
+ }
282
+
283
+ function waveGroupContext(spec: OpWavesSpec, wave: OpWave, runs: readonly OpWaveRun[], cwd?: string): GroupContext {
284
+ return { env: spec.labels?.Env ?? wave.name, ...(cwd !== undefined ? { cwd: resolve(cwd) } : {}), components: runs.map((r) => r.target) };
285
+ }
286
+
287
+ function requireGroup(capability: Capability<never, unknown>, kind: string, wave: OpWave): void {
288
+ if (!capability.planGroup || !capability.runGroup) throw new Error(`wave "${wave.name}" plans its runs together, and the capability "${kind}" cannot (it needs planGroup and runGroup)`);
289
+ }
290
+
291
+ /**
292
+ * Plan a `together` wave's runs in one `planGroup` call (#4842), writing
293
+ * each run's plan file at `planPath(target)` (relative to `cwd`). Each run's
294
+ * plan carries the group. Throws when the call does or leaves a run out, and
295
+ * on a run's plan as {@link planOpWaveStep} does.
296
+ */
297
+ export async function planOpWaveStepGroup(
298
+ at: {
299
+ spec: OpWavesSpec;
300
+ wave: OpWave;
301
+ cwd: string;
302
+ registry: CapabilityRegistry;
303
+ planPath: (target: string) => string;
304
+ lockGrain?: LockGrain | null;
305
+ policyBase?: string;
306
+ /** Each run's environment and check after init, from the run hooks. */
307
+ runCtx?: (target: string) => { processEnv?: Record<string, string>; afterInit?: () => Promise<void> };
308
+ },
309
+ runs: readonly OpWaveRun[],
310
+ ): Promise<OpWaveStepPlan[]> {
311
+ const { spec, wave } = at;
312
+ const kind = spec.step!.kind;
313
+ const capability = resolveCapability(at.registry, kind);
314
+ requireGroup(capability, kind, wave);
315
+ const members = waveGroupMembers(spec, wave, runs, (run) => {
316
+ const own = at.runCtx?.(run.target) ?? {};
317
+ return {
318
+ ...opWaveStepContext(spec, wave, run, at.cwd),
319
+ ...(at.lockGrain ? { lockGrain: at.lockGrain } : {}),
320
+ ...(at.policyBase ? { policyBase: at.policyBase } : {}),
321
+ ...(own.processEnv ? { processEnv: own.processEnv } : {}),
322
+ ...(own.afterInit ? { afterInit: own.afterInit } : {}),
323
+ };
324
+ });
325
+ let planned: { members?: Record<string, CapabilityPlan>; digest?: unknown; artifact?: unknown };
326
+ try {
327
+ planned = await capability.planGroup!(waveGroupContext(spec, wave, runs, at.cwd), members as never);
328
+ } catch (err) {
329
+ throw new Error(`planning wave "${wave.name}" together through ${kind} failed: ${err instanceof Error ? err.message : String(err)}`);
330
+ }
331
+ if (typeof planned?.digest !== "string" || planned.digest === "") throw new Error(`${kind} planned wave "${wave.name}" together with no digest of the whole`);
332
+ const own = new Map<string, CapabilityPlan>();
333
+ for (const run of runs) {
334
+ const p = planned.members?.[run.target];
335
+ if (!p) throw new Error(`${kind} planned wave "${wave.name}" together without a plan for ${run.target}`);
336
+ own.set(run.target, p);
337
+ }
338
+ const digest = groupDigest(kind, runs.map((r) => ({ component: r.target, member: own.get(r.target)!.member, planDigest: own.get(r.target)!.planDigest })), planned.digest);
339
+ const group: OpWaveStepGroup = { digest, ...(planned.artifact !== undefined ? { artifact: planned.artifact } : {}), plans: Object.fromEntries(own) };
340
+ const out: OpWaveStepPlan[] = [];
341
+ for (const [i, run] of runs.entries()) {
342
+ const p = own.get(run.target)!;
343
+ if (typeof p.planDigest !== "string" || p.planDigest === "") throw new Error(`${kind} planned ${run.target} with no plan digest`);
344
+ const holes = p.changeSet?.member.holes ?? [];
345
+ if (holes.length > 0 && p.artifact === undefined && planned.artifact === undefined) throw new Error(`${run.target} was not planned: ${holes.map((h) => h.reason).join("; ")}`);
346
+ const effects = partEffects(p.changeSet);
347
+ if ((p.destructive?.length ?? 0) > 0) effects.destructive = true;
348
+ let lock: PlannedLock;
349
+ try {
350
+ lock = await resolvePlannedLock(capability, members[i]!.input, p, at.lockGrain);
351
+ } catch (err) {
352
+ throw new Error(`planning ${run.target} through ${kind} failed: ${err instanceof Error ? err.message : String(err)}`);
353
+ }
354
+ const plan: OpWaveStepPlan = {
355
+ target: run.target,
356
+ member: p.member,
357
+ planDigest: p.planDigest,
358
+ ...(p.resourceDigests ? { resources: p.resourceDigests } : {}),
359
+ ...(p.artifact !== undefined ? { artifact: p.artifact } : {}),
360
+ ...(p.changeSet ? { part: p.changeSet } : {}),
361
+ ...effects,
362
+ lock,
363
+ group,
364
+ };
365
+ writeStepPlanFile(join(at.cwd, at.planPath(run.target)), plan);
366
+ out.push(plan);
367
+ }
368
+ return out;
369
+ }
370
+
371
+ /**
372
+ * Apply a `together` wave's runs in one `runGroup` call (#4842), with the
373
+ * plan the gate decided. Each run's outcome, in the order given: `applied`
374
+ * and `no-changes` applied, with the member's outputs; `partial`, `failed`
375
+ * and `not-started` failed. A throw fails every run, or moves every run
376
+ * when it is a moved plan (`isPlanMovedError`).
377
+ */
378
+ export async function applyOpWaveStepGroup(
379
+ at: { spec: OpWavesSpec; wave: OpWave; registry: CapabilityRegistry; runEnv?: (target: string) => Record<string, string> | undefined; cwd?: string },
380
+ runs: ReadonlyArray<{ run: OpWaveRun; plan: OpWaveStepPlan }>,
381
+ ): Promise<OpWaveStepApply[]> {
382
+ const { spec, wave } = at;
383
+ const kind = spec.step!.kind;
384
+ let capability: Capability<never, unknown>;
385
+ try {
386
+ capability = resolveCapability(at.registry, kind);
387
+ requireGroup(capability, kind, wave);
388
+ } catch (err) {
389
+ const reason = err instanceof Error ? err.message : String(err);
390
+ return runs.map(() => ({ outcome: "failed", reason }));
391
+ }
392
+ const group = runs[0]?.plan.group;
393
+ if (!group || runs.some((r) => r.plan.group !== group)) return runs.map(() => ({ outcome: "failed", reason: `the runs of wave "${wave.name}" were not planned together, so they cannot apply together` }));
394
+ const byTarget = new Map(runs.map((r) => [r.run.target, r.plan]));
395
+ const members = waveGroupMembers(spec, wave, runs.map((r) => r.run), (run) => {
396
+ const plan = byTarget.get(run.target)!;
397
+ const env = at.runEnv?.(run.target);
398
+ return { ...opWaveStepContext(spec, wave, run, at.cwd), ...(plan.artifact !== undefined ? { plans: { [plan.member]: plan.artifact } } : {}), ...(env ? { processEnv: env } : {}) };
399
+ });
400
+ const plans = Object.fromEntries(runs.flatMap((r) => (group.plans[r.run.target] ? [[r.run.target, group.plans[r.run.target]!] as const] : [])));
401
+ let got: { members?: Record<string, { status: string; outputs?: Record<string, unknown>; error?: string }>; error?: string };
402
+ try {
403
+ got = await capability.runGroup!(waveGroupContext(spec, wave, runs.map((r) => r.run), at.cwd), { ...(group.artifact !== undefined ? { artifact: group.artifact } : {}), digest: group.digest, plans }, members as never);
404
+ } catch (err) {
405
+ const reason = err instanceof Error ? err.message : String(err);
406
+ const moved = isPlanMovedError(err);
407
+ return Promise.all(
408
+ runs.map(async (r, i): Promise<OpWaveStepApply> => {
409
+ const facts = await opWaveStepFacts(capability, members[i]!.input, r.plan, { error: err });
410
+ return { ...(moved ? { outcome: "moved" as const, reason } : { outcome: "failed" as const, reason }), ...(facts ? { facts } : {}) };
411
+ }),
412
+ );
413
+ }
414
+ return Promise.all(
415
+ runs.map(async (r, i): Promise<OpWaveStepApply> => {
416
+ const o = got?.members?.[r.run.target];
417
+ const input = members[i]!.input;
418
+ if (o && (o.status === "applied" || o.status === "no-changes")) {
419
+ const output = { status: o.status, ...(o.outputs ? { outputs: o.outputs } : {}) };
420
+ const facts = await opWaveStepFacts(capability, input, r.plan, { output });
421
+ return { outcome: "applied", output, ...(facts ? { facts } : {}) };
422
+ }
423
+ const what = o?.status === "not-started" ? "its part of the wave's apply never started" : o?.status === "partial" ? "part of its plan applied, and the rest did not" : o ? "its part of the wave's apply failed" : `${kind} said nothing of it`;
424
+ const why = o?.error ?? got?.error;
425
+ const reason = `${what}${why ? `: ${why}` : ""}`;
426
+ const facts = await opWaveStepFacts(capability, input, r.plan, { error: new Error(reason) });
427
+ return { outcome: "failed", reason, ...(facts ? { facts } : {}) };
428
+ }),
429
+ );
197
430
  }
198
431
 
199
432
  /** How one run's apply through its step came out, with what the capability knew about it (#4555). */
@@ -225,7 +458,7 @@ export async function opWaveStepFacts(
225
458
  }
226
459
 
227
460
  /** Apply one run through the spec's step (#4545), with the plan the gate decided. */
228
- export async function applyOpWaveStep(at: { spec: OpWavesSpec; wave: OpWave; registry: CapabilityRegistry }, run: OpWaveRun, plan: OpWaveStepPlan): Promise<OpWaveStepApply> {
461
+ export async function applyOpWaveStep(at: { spec: OpWavesSpec; wave: OpWave; registry: CapabilityRegistry; processEnv?: Record<string, string>; cwd?: string }, run: OpWaveRun, plan: OpWaveStepPlan): Promise<OpWaveStepApply> {
229
462
  const { spec, wave, registry } = at;
230
463
  let capability: Capability<never, unknown>;
231
464
  try {
@@ -233,7 +466,7 @@ export async function applyOpWaveStep(at: { spec: OpWavesSpec; wave: OpWave; reg
233
466
  } catch (err) {
234
467
  return { outcome: "failed", reason: err instanceof Error ? err.message : String(err) };
235
468
  }
236
- const ctx: DeployContext = { ...opWaveStepContext(spec, wave, run), ...(plan.artifact !== undefined ? { plans: { [plan.member]: plan.artifact } } : {}) };
469
+ const ctx: DeployContext = { ...opWaveStepContext(spec, wave, run, at.cwd), ...(plan.artifact !== undefined ? { plans: { [plan.member]: plan.artifact } } : {}), ...(at.processEnv ? { processEnv: at.processEnv } : {}) };
237
470
  const input = opWaveStepInput(spec, wave, run);
238
471
  try {
239
472
  const output = await capability.run(ctx, input as never);
@@ -0,0 +1,232 @@
1
+ /**
2
+ * The pieces of terragucci's gate that move onto chant's (terragucci issue
3
+ * 1303): `approvals.involved` and `approvals.reviewLedger` on a wave that no
4
+ * `approvals.quorum` rule covers, and the after-plan wave answer's
5
+ * `approvals`, which chant records at the gate before it decides it (a
6
+ * covered round, the rest of a stopped apply, a review the product read).
7
+ */
8
+
9
+ import { describe, expect, test } from "vitest";
10
+ import { mkdtempSync, rmSync } from "node:fs";
11
+ import { join } from "node:path";
12
+ import { tmpdir } from "node:os";
13
+ import type { OpWavesSpec } from "./op-waves";
14
+ import { runOpWave, type OpWaveShowAtBase } from "./op-waves-run";
15
+ import { memoryGateLedgerPort, type GateLedgerPort } from "./gate";
16
+ import { CapabilityRegistry, type Capability } from "../components/capability";
17
+ import type { ChangeSetPart } from "../change-set";
18
+ import type { GateResolutionRecord } from "../lifecycle/gate-ledger";
19
+ import type { TrustPolicy } from "../workspace/trust/policy";
20
+ import type { MergedReview, ReviewSource } from "./gate-review";
21
+ import { opWaveAfterPlanWaveResultProblems, type OpWaveAfterPlanHook, type OpWaveAnswerApproval } from "./op-waves-after-plan";
22
+
23
+ const digest = (n: string) => `sha256:${n.repeat(64)}`;
24
+ const NOW = "2026-11-08T00:00:00.000Z";
25
+
26
+ const part = (member: string): ChangeSetPart => ({
27
+ member: { member, lexicon: "terraform", planner: "chant", status: "planned", planDigest: digest("9"), holes: [] },
28
+ entries: [{ member, address: `aws_s3_bucket.${member}`, type: "aws_s3_bucket", action: "create" } as ChangeSetPart["entries"][number]],
29
+ });
30
+
31
+ const registry = (): { registry: CapabilityRegistry; ran: string[] } => {
32
+ const ran: string[] = [];
33
+ const cap: Capability<Record<string, unknown>, unknown> = {
34
+ kind: "fake-apply",
35
+ async plan(_ctx, input) {
36
+ const root = String(input.root);
37
+ return { member: root, planDigest: digest(root === "network" ? "1" : "2"), artifact: { planFile: `${root}.tfplan` }, changeSet: part(root) };
38
+ },
39
+ async run(_ctx, input) {
40
+ ran.push(String(input.root));
41
+ return {};
42
+ },
43
+ };
44
+ return { registry: new CapabilityRegistry().register(cap), ran };
45
+ };
46
+
47
+ /** terragucci's spec on the step: `tf-apply`, gate `wave-1`, no approval rules. */
48
+ const spec = (approvals: OpWavesSpec["approvals"], approval: "ledger" | "pr-review" = "ledger"): OpWavesSpec =>
49
+ ({
50
+ name: "tf-apply",
51
+ op: "tf-apply",
52
+ gateName: "wave-{k}",
53
+ step: { kind: "fake-apply", root: "{target}" },
54
+ ...(approvals ? { approvals } : {}),
55
+ waves: [{ name: "wave-1", runs: [{ target: "network" }, { target: "app" }], gate: "always", approval }],
56
+ }) as OpWavesSpec;
57
+
58
+ const trust = (): TrustPolicy =>
59
+ ({ base: "b".repeat(40), signersPath: ".chant/allowed_signers", active: false, signers: [], excluded: [], roles: {}, adopted: [], runners: [], excludedRunners: [], admitted: {}, problems: [] }) as TrustPolicy;
60
+
61
+ const merged: MergedReview = { pr: 7, head: "r".repeat(40), author: "github:dana", approvers: [], refused: [] };
62
+ const reviews: ReviewSource = { kind: "github", mergedReview: async () => merged };
63
+
64
+ function harness(s: OpWavesSpec) {
65
+ const cwd = mkdtempSync(join(tmpdir(), "op-waves-gate-port-"));
66
+ const show: OpWaveShowAtBase = () => ({ sha: "b".repeat(40), text: JSON.stringify(s) });
67
+ return { cwd, show, done: () => rmSync(cwd, { recursive: true, force: true }) };
68
+ }
69
+
70
+ /** A memory port whose `read(op)` returns that op's lines only, as the lifecycle branch's `_gates/<op>.jsonl` does. */
71
+ function ledger(): GateLedgerPort {
72
+ const inner = memoryGateLedgerPort();
73
+ return { ...inner, async read(op) { const r = await inner.read(op); return { ...r, resolutions: r.resolutions.filter((x) => x.op === op), pending: r.pending.filter((x) => x.op === op) }; } };
74
+ }
75
+
76
+ const run = (h: ReturnType<typeof harness>, s: OpWavesSpec, gates: GateLedgerPort, o: Partial<Parameters<typeof runOpWave>[0]> = {}) => {
77
+ const { registry: capabilities, ran } = registry();
78
+ const logs: string[] = [];
79
+ return runOpWave({
80
+ spec: s, specFile: "waves.json", wave: 1, cwd: h.cwd, show: h.show, gates, capabilities, now: NOW, head: "m".repeat(40), reviews, trust, commits: () => [], log: (l) => logs.push(l), ...o,
81
+ }).then((result) => ({ result, ran, logs }));
82
+ };
83
+
84
+ const approve = (gates: GateLedgerPort, by: string, planDigest: string, extra: Partial<GateResolutionRecord> = {}) =>
85
+ gates.appendResolution!({ op: "tf-apply", gate: "wave-1", resolvedBy: by, timestamp: "2026-11-08T01:00:00.000Z", planDigest, approver: { kind: "human" }, ...extra } as never);
86
+
87
+ describe("approvals.involved and approvals.reviewLedger without approval rules (terragucci issue 1303)", () => {
88
+ test("an approval by the agent's account does not count, and one by someone else does", async () => {
89
+ const s = spec({ involved: { agents: ["tg-bot"], exclude: true } });
90
+ const h = harness(s);
91
+ const gates = ledger();
92
+ const waiting = await run(h, s, gates);
93
+ expect(waiting.result.exitCode).toBe(3);
94
+ const set = waiting.result.decision!.digest;
95
+ await approve(gates, "github:tg-bot", set);
96
+ const agent = await run(h, s, gates);
97
+ expect(agent.result.exitCode).toBe(3);
98
+ expect(agent.ran).toEqual([]);
99
+ expect(agent.logs.some((l) => /github:tg-bot is an account an agent acts as, so github:tg-bot's approval does not count/.test(l))).toBe(true);
100
+ // The decision record names who counts as involved, and claims no approval rules.
101
+ expect(agent.result.decision?.involved).toEqual({ agents: ["tg-bot"], exclude: true });
102
+ expect(agent.result.decision?.quorum).toBeUndefined();
103
+ expect(agent.result.decision?.quorumProgress).toBeUndefined();
104
+ await approve(gates, "github:alice", set, { timestamp: "2026-11-08T02:00:00.000Z" });
105
+ const alice = await run(h, s, gates);
106
+ expect(alice.result.exitCode).toBe(0);
107
+ expect(alice.result.decision?.approvedBy).toBe("github:alice");
108
+ expect(alice.ran).toEqual(["network", "app"]);
109
+ h.done();
110
+ });
111
+
112
+ test("the pull request's author's approval does not count", async () => {
113
+ const s = spec({ involved: { exclude: true } });
114
+ const h = harness(s);
115
+ const gates = ledger();
116
+ const set = (await run(h, s, gates)).result.decision!.digest;
117
+ await approve(gates, "github:dana", set);
118
+ const r = await run(h, s, gates);
119
+ expect(r.result.exitCode).toBe(3);
120
+ expect(r.logs.some((l) => /github:dana wrote the change, so github:dana.s approval does not count/.test(l))).toBe(true);
121
+ h.done();
122
+ });
123
+
124
+ test("under pr-review, a review the product recorded on its review ledger approves the wave", async () => {
125
+ const s = spec({ reviewLedger: "tf-reviews", involved: { agents: ["tg-bot"], exclude: true } }, "pr-review");
126
+ const h = harness(s);
127
+ const gates = ledger();
128
+ const set = (await run(h, s, gates)).result.decision!.digest;
129
+ await gates.appendResolution!({ op: "tf-reviews", gate: "wave-1", resolvedBy: "alice,tg-bot", timestamp: "2026-11-08T01:00:00.000Z", planDigest: set, via: "pr-review", pr: 7, head: "r".repeat(40), reviewers: ["alice", "tg-bot"] } as never);
130
+ const r = await run(h, s, gates);
131
+ expect(r.result.exitCode).toBe(0);
132
+ expect(r.result.decision?.approvedBy).toBe("github:alice");
133
+ h.done();
134
+ });
135
+
136
+ test("a spec at base with neither waits for any approval as before, and an agent's approval counts", async () => {
137
+ const s = spec(undefined);
138
+ const h = harness(s);
139
+ const gates = ledger();
140
+ const set = (await run(h, s, gates)).result.decision!.digest;
141
+ await approve(gates, "github:tg-bot", set);
142
+ const r = await run(h, s, gates);
143
+ expect(r.result.exitCode).toBe(0);
144
+ expect(r.result.decision?.approvedBy).toBe("github:tg-bot");
145
+ expect(r.result.decision?.involved).toBeUndefined();
146
+ h.done();
147
+ });
148
+ });
149
+
150
+ describe("approvals a product settled before the gate, in the wave answer (terragucci issue 1303)", () => {
151
+ const covered: OpWaveAnswerApproval = { resolvedBy: "github:alice", note: "covered by the approval of sha256:aaaa by github:alice: only network.vpc_id differs" };
152
+ const hook = (approvals: OpWaveAnswerApproval[]): OpWaveAfterPlanHook => ({ name: "terragucci", run: () => {}, wave: () => ({ approvals }) });
153
+
154
+ test("chant records each at the gate for the digest it decides, and the wave applies under it", async () => {
155
+ const s = spec(undefined);
156
+ const h = harness(s);
157
+ const gates = ledger();
158
+ const r = await run(h, s, gates, { afterPlan: hook([covered]) });
159
+ expect(r.result.exitCode).toBe(0);
160
+ expect(r.result.decision?.approvedBy).toBe("github:alice");
161
+ const lines = (await gates.read("tf-apply")).resolutions;
162
+ expect(lines).toHaveLength(1);
163
+ expect(lines[0]).toMatchObject({ op: "tf-apply", gate: "wave-1", resolvedBy: "github:alice", planDigest: r.result.decision!.digest, note: covered.note, timestamp: NOW });
164
+ expect(r.logs).toContain(`wave 1 (wave-1): github:alice's approval recorded for ${r.result.decision!.digest}: ${covered.note}`);
165
+ h.done();
166
+ });
167
+
168
+ test("an approval already recorded for the digest is not written again", async () => {
169
+ const s = spec(undefined);
170
+ const h = harness(s);
171
+ const gates = ledger();
172
+ const set = (await run(h, s, gates)).result.decision!.digest;
173
+ await approve(gates, "github:alice", set, { note: covered.note });
174
+ await run(h, s, gates, { afterPlan: hook([covered]) });
175
+ expect((await gates.read("tf-apply")).resolutions).toHaveLength(1);
176
+ h.done();
177
+ });
178
+
179
+ test("an approval the hook gives by someone involved is recorded and still left out", async () => {
180
+ const s = spec({ involved: { agents: ["tg-bot"], exclude: true } });
181
+ const h = harness(s);
182
+ const gates = ledger();
183
+ const r = await run(h, s, gates, { afterPlan: hook([{ resolvedBy: "github:tg-bot", note: "the rest of the apply of sha256:bbbb, which github:tg-bot approved" }]) });
184
+ expect(r.result.exitCode).toBe(3);
185
+ expect((await gates.read("tf-apply")).resolutions.map((x) => x.resolvedBy)).toEqual(["github:tg-bot"]);
186
+ h.done();
187
+ });
188
+
189
+ test("a review the hook read is written as the product's review line, which a review ledger counts under pr-review", async () => {
190
+ const s = spec({ reviewLedger: "tf-apply" }, "pr-review");
191
+ const h = harness(s);
192
+ const gates = ledger();
193
+ const review: OpWaveAnswerApproval = { resolvedBy: "alice,carol", note: "approved by the review of pull request 7", url: "https://github.com/acme/infra/pull/7", review: { pr: 7, head: "r".repeat(40), reviewers: ["alice", "carol"] } };
194
+ const r = await run(h, s, gates, { afterPlan: hook([review]) });
195
+ expect(r.result.exitCode).toBe(0);
196
+ expect(r.result.decision?.approvedBy).toBe("github:alice, github:carol");
197
+ const line = (await gates.read("tf-apply")).resolutions.find((x) => x.resolvedBy === "alice,carol");
198
+ expect(line).toMatchObject({ via: "pr-review", pr: 7, head: "r".repeat(40), reviewers: ["alice", "carol"], url: review.url });
199
+ h.done();
200
+ });
201
+
202
+ test("a gate that passes without an approval records none", async () => {
203
+ const s = { ...spec(undefined), waves: [{ name: "wave-1", runs: [{ target: "network" }], gate: "never" }] } as OpWavesSpec;
204
+ const h = harness(s);
205
+ const gates = ledger();
206
+ const r = await run(h, s, gates, { afterPlan: hook([covered]) });
207
+ expect(r.result.exitCode).toBe(0);
208
+ expect((await gates.read("tf-apply")).resolutions).toEqual([]);
209
+ h.done();
210
+ });
211
+
212
+ test("the answer's approvals are checked", () => {
213
+ expect(opWaveAfterPlanWaveResultProblems({ approvals: [covered] }, [])).toEqual([]);
214
+ expect(opWaveAfterPlanWaveResultProblems({ approvals: "alice" }, [])).toEqual(["`approvals` must be a list of { resolvedBy, note, url?, review? }"]);
215
+ expect(opWaveAfterPlanWaveResultProblems({ approvals: [{ resolvedBy: " ", note: "" }] }, [])).toEqual([
216
+ "approvals[0].resolvedBy must name the approver",
217
+ "approvals[0].note must say why the approval stands for these plans",
218
+ ]);
219
+ expect(opWaveAfterPlanWaveResultProblems({ approvals: [{ ...covered, url: "ftp://x", review: { pr: 0, head: "", reviewers: [] } }] }, [])).toEqual([
220
+ "approvals[0].url must be an http or https URL",
221
+ "approvals[0].review.pr must be the pull request's number",
222
+ "approvals[0].review.head must be the commit the review approved",
223
+ "approvals[0].review.reviewers must list the reviewers",
224
+ ]);
225
+ });
226
+
227
+ test("the floor is the next release", async () => {
228
+ const entry = await import("./index");
229
+ const { NEXT_RELEASE } = await import("../release-floors");
230
+ expect(entry.OP_WAVE_ANSWER_APPROVALS_FLOOR).toBe(NEXT_RELEASE);
231
+ });
232
+ });