@intentius/chant 0.124.77 → 0.124.79

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 (228) hide show
  1. package/dist/__fixtures__/notify-messages/events.d.ts +9 -0
  2. package/dist/__fixtures__/notify-messages/events.d.ts.map +1 -0
  3. package/dist/__fixtures__/notify-messages/events.js +21 -0
  4. package/dist/__fixtures__/product-words.d.ts +14 -0
  5. package/dist/__fixtures__/product-words.d.ts.map +1 -1
  6. package/dist/__fixtures__/product-words.js +11 -0
  7. package/dist/__fixtures__/terragucci-notify.d.ts +66 -0
  8. package/dist/__fixtures__/terragucci-notify.d.ts.map +1 -0
  9. package/dist/__fixtures__/terragucci-notify.js +133 -0
  10. package/dist/action-pins.d.ts +8 -0
  11. package/dist/action-pins.d.ts.map +1 -1
  12. package/dist/action-pins.js +8 -0
  13. package/dist/agent-guard.d.ts.map +1 -1
  14. package/dist/agent-guard.js +1 -2
  15. package/dist/change-set.d.ts +10 -1
  16. package/dist/change-set.d.ts.map +1 -1
  17. package/dist/change-set.js +4 -1
  18. package/dist/ci-agent.d.ts +16 -2
  19. package/dist/ci-agent.d.ts.map +1 -1
  20. package/dist/ci-agent.js +6 -1
  21. package/dist/ci-commit.d.ts +66 -2
  22. package/dist/ci-commit.d.ts.map +1 -1
  23. package/dist/ci-commit.js +147 -19
  24. package/dist/ci-own-jobs.d.ts.map +1 -1
  25. package/dist/ci-own-jobs.js +1 -2
  26. package/dist/ci-product-words.d.ts +18 -4
  27. package/dist/ci-product-words.d.ts.map +1 -1
  28. package/dist/ci-product-words.js +26 -6
  29. package/dist/ci-product.d.ts +7 -3
  30. package/dist/ci-product.d.ts.map +1 -1
  31. package/dist/ci-product.js +8 -5
  32. package/dist/cli/handlers/release.d.ts +8 -0
  33. package/dist/cli/handlers/release.d.ts.map +1 -1
  34. package/dist/cli/handlers/release.js +68 -6
  35. package/dist/cli/handlers/run-wave.js +1 -0
  36. package/dist/cli/main.d.ts.map +1 -1
  37. package/dist/cli/main.js +7 -0
  38. package/dist/cli/mcp/product-tools.d.ts +6 -0
  39. package/dist/cli/mcp/product-tools.d.ts.map +1 -1
  40. package/dist/cli/mcp/product-tools.js +7 -0
  41. package/dist/cli/mcp/read-only.d.ts +12 -0
  42. package/dist/cli/mcp/read-only.d.ts.map +1 -1
  43. package/dist/cli/mcp/read-only.js +16 -0
  44. package/dist/cli/mcp/server.d.ts +11 -0
  45. package/dist/cli/mcp/server.d.ts.map +1 -1
  46. package/dist/cli/mcp/server.js +26 -5
  47. package/dist/cli/mcp/types.d.ts +5 -1
  48. package/dist/cli/mcp/types.d.ts.map +1 -1
  49. package/dist/components/capability.d.ts +42 -0
  50. package/dist/components/capability.d.ts.map +1 -1
  51. package/dist/components/group-digest.d.ts +17 -0
  52. package/dist/components/group-digest.d.ts.map +1 -0
  53. package/dist/components/group-digest.js +18 -0
  54. package/dist/components/groups.d.ts +2 -11
  55. package/dist/components/groups.d.ts.map +1 -1
  56. package/dist/components/groups.js +2 -12
  57. package/dist/components/index.d.ts +1 -1
  58. package/dist/components/index.d.ts.map +1 -1
  59. package/dist/components/pr-env-components.d.ts.map +1 -1
  60. package/dist/components/pr-env-components.js +1 -2
  61. package/dist/config.d.ts +28 -8
  62. package/dist/config.d.ts.map +1 -1
  63. package/dist/config.js +21 -1
  64. package/dist/lexicon.d.ts +8 -0
  65. package/dist/lexicon.d.ts.map +1 -1
  66. package/dist/lexicon.js +8 -0
  67. package/dist/lifecycle/release-cut.d.ts +7 -1
  68. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  69. package/dist/lifecycle/release-cut.js +1 -0
  70. package/dist/lifecycle/release-images.d.ts +86 -3
  71. package/dist/lifecycle/release-images.d.ts.map +1 -1
  72. package/dist/lifecycle/release-images.js +131 -6
  73. package/dist/lifecycle/release-publish.d.ts +8 -1
  74. package/dist/lifecycle/release-publish.d.ts.map +1 -1
  75. package/dist/lifecycle/release-publish.js +30 -3
  76. package/dist/lifecycle/release-version.d.ts +86 -0
  77. package/dist/lifecycle/release-version.d.ts.map +1 -0
  78. package/dist/lifecycle/release-version.js +209 -0
  79. package/dist/mcp/types.d.ts +26 -0
  80. package/dist/mcp/types.d.ts.map +1 -1
  81. package/dist/notify-product.d.ts +11 -2
  82. package/dist/notify-product.d.ts.map +1 -1
  83. package/dist/notify-product.js +15 -4
  84. package/dist/notify-relay.d.ts.map +1 -1
  85. package/dist/notify-relay.js +1 -2
  86. package/dist/notify.d.ts +36 -4
  87. package/dist/notify.d.ts.map +1 -1
  88. package/dist/notify.js +31 -21
  89. package/dist/notify.schema.json +1 -0
  90. package/dist/op/activities/review-product.d.ts +111 -0
  91. package/dist/op/activities/review-product.d.ts.map +1 -0
  92. package/dist/op/activities/review-product.js +115 -0
  93. package/dist/op/gate.d.ts +17 -0
  94. package/dist/op/gate.d.ts.map +1 -1
  95. package/dist/op/gate.js +36 -0
  96. package/dist/op/index.d.ts +8 -6
  97. package/dist/op/index.d.ts.map +1 -1
  98. package/dist/op/index.js +5 -4
  99. package/dist/op/op-waves-after-plan.d.ts +76 -1
  100. package/dist/op/op-waves-after-plan.d.ts.map +1 -1
  101. package/dist/op/op-waves-after-plan.js +142 -3
  102. package/dist/op/op-waves-capability-spec.js +1 -2
  103. package/dist/op/op-waves-capability.d.ts +89 -2
  104. package/dist/op/op-waves-capability.d.ts.map +1 -1
  105. package/dist/op/op-waves-capability.js +215 -7
  106. package/dist/op/op-waves-run-hooks.d.ts +104 -0
  107. package/dist/op/op-waves-run-hooks.d.ts.map +1 -0
  108. package/dist/op/op-waves-run-hooks.js +146 -0
  109. package/dist/op/op-waves-run.d.ts +21 -0
  110. package/dist/op/op-waves-run.d.ts.map +1 -1
  111. package/dist/op/op-waves-run.js +233 -13
  112. package/dist/op/op-waves.d.ts +11 -1
  113. package/dist/op/op-waves.d.ts.map +1 -1
  114. package/dist/op/op-waves.js +7 -1
  115. package/dist/op/runtime.d.ts +2 -0
  116. package/dist/op/runtime.d.ts.map +1 -1
  117. package/dist/policy-engine.d.ts.map +1 -1
  118. package/dist/policy-engine.js +1 -2
  119. package/dist/pr-forge-reads.d.ts +124 -0
  120. package/dist/pr-forge-reads.d.ts.map +1 -0
  121. package/dist/pr-forge-reads.js +322 -0
  122. package/dist/pr-forge.d.ts +14 -0
  123. package/dist/pr-forge.d.ts.map +1 -1
  124. package/dist/pr-forge.js +21 -13
  125. package/dist/pr-plan-note.d.ts +293 -0
  126. package/dist/pr-plan-note.d.ts.map +1 -0
  127. package/dist/pr-plan-note.js +361 -0
  128. package/dist/release-floors.d.ts +13 -1
  129. package/dist/release-floors.d.ts.map +1 -1
  130. package/dist/release-floors.js +13 -1
  131. package/dist/state-export.d.ts.map +1 -1
  132. package/dist/state-export.js +1 -2
  133. package/dist/state-migration.d.ts.map +1 -1
  134. package/dist/state-migration.js +1 -2
  135. package/dist/state-unlock.d.ts.map +1 -1
  136. package/dist/state-unlock.js +1 -2
  137. package/dist/wave-runtime.mjs +314 -314
  138. package/dist/workspace/change-set.schema.json +7 -0
  139. package/dist/workspace/release-workflow.d.ts +7 -0
  140. package/dist/workspace/release-workflow.d.ts.map +1 -1
  141. package/dist/workspace/release-workflow.js +13 -2
  142. package/package.json +1 -1
  143. package/src/__fixtures__/notify-messages/events.ts +23 -0
  144. package/src/__fixtures__/notify-messages/messages.json +50 -0
  145. package/src/__fixtures__/pr-loop/terragucci-plan.note.golden.md +53 -0
  146. package/src/__fixtures__/pr-loop/terragucci-plan.note.json +83 -0
  147. package/src/__fixtures__/product-words.ts +12 -0
  148. package/src/__fixtures__/review-agent/terragucci-review.json +94 -0
  149. package/src/__fixtures__/terragucci-notify.ts +170 -0
  150. package/src/action-pins.test.ts +11 -1
  151. package/src/action-pins.ts +9 -0
  152. package/src/agent-guard.test.ts +1 -2
  153. package/src/agent-guard.ts +1 -2
  154. package/src/change-set.test.ts +20 -0
  155. package/src/change-set.ts +11 -1
  156. package/src/ci-agent.test.ts +9 -0
  157. package/src/ci-agent.ts +15 -2
  158. package/src/ci-commit.test.ts +162 -0
  159. package/src/ci-commit.ts +167 -21
  160. package/src/ci-own-jobs.test.ts +1 -2
  161. package/src/ci-own-jobs.ts +1 -2
  162. package/src/ci-product-words.ts +35 -7
  163. package/src/ci-product.ts +9 -6
  164. package/src/cli/handlers/build-pr-loop-control.test.ts +1 -2
  165. package/src/cli/handlers/build-run-group.test.ts +1 -2
  166. package/src/cli/handlers/release.ts +60 -7
  167. package/src/cli/handlers/run-wave.ts +1 -0
  168. package/src/cli/main.ts +7 -0
  169. package/src/cli/mcp/product-tools.test.ts +50 -0
  170. package/src/cli/mcp/product-tools.ts +8 -0
  171. package/src/cli/mcp/read-only.ts +19 -0
  172. package/src/cli/mcp/server.test.ts +30 -0
  173. package/src/cli/mcp/server.ts +28 -5
  174. package/src/cli/mcp/types.ts +6 -1
  175. package/src/components/capability.ts +41 -0
  176. package/src/components/group-digest.ts +20 -0
  177. package/src/components/groups.ts +3 -13
  178. package/src/components/index.ts +2 -0
  179. package/src/components/pr-env-components.test.ts +1 -2
  180. package/src/components/pr-env-components.ts +1 -2
  181. package/src/config.ts +38 -3
  182. package/src/gate-policy-bundle.test.ts +1 -1
  183. package/src/lexicon.ts +9 -0
  184. package/src/lifecycle/release-cut.ts +11 -0
  185. package/src/lifecycle/release-images-dockerfile.test.ts +229 -0
  186. package/src/lifecycle/release-images.ts +171 -8
  187. package/src/lifecycle/release-publish.ts +34 -3
  188. package/src/lifecycle/release-version.test.ts +155 -0
  189. package/src/lifecycle/release-version.ts +227 -0
  190. package/src/mcp/types.ts +27 -0
  191. package/src/notify-message-words.test.ts +185 -0
  192. package/src/notify-product.ts +16 -4
  193. package/src/notify-relay.ts +1 -2
  194. package/src/notify.schema.json +1 -0
  195. package/src/notify.ts +59 -19
  196. package/src/op/activities/review-product.test.ts +116 -0
  197. package/src/op/activities/review-product.ts +199 -0
  198. package/src/op/gate.ts +46 -0
  199. package/src/op/index.ts +10 -4
  200. package/src/op/op-waves-after-plan-wave.test.ts +226 -0
  201. package/src/op/op-waves-after-plan.ts +170 -5
  202. package/src/op/op-waves-capability-spec.ts +1 -1
  203. package/src/op/op-waves-capability.test.ts +6 -0
  204. package/src/op/op-waves-capability.ts +243 -10
  205. package/src/op/op-waves-run-hooks.test.ts +184 -0
  206. package/src/op/op-waves-run-hooks.ts +195 -0
  207. package/src/op/op-waves-run.ts +240 -16
  208. package/src/op/op-waves-step-wave.test.ts +277 -0
  209. package/src/op/op-waves.ts +15 -2
  210. package/src/op/runtime.ts +2 -0
  211. package/src/op/schedule-overdue.test.ts +26 -0
  212. package/src/policy-engine.test.ts +1 -2
  213. package/src/policy-engine.ts +1 -2
  214. package/src/pr-forge-reads.test.ts +285 -0
  215. package/src/pr-forge-reads.ts +424 -0
  216. package/src/pr-forge.ts +30 -16
  217. package/src/pr-plan-note.test.ts +105 -0
  218. package/src/pr-plan-note.ts +520 -0
  219. package/src/release-floors.ts +19 -1
  220. package/src/state-export.test.ts +1 -2
  221. package/src/state-export.ts +1 -2
  222. package/src/state-migration.test.ts +1 -2
  223. package/src/state-migration.ts +1 -2
  224. package/src/state-unlock.test.ts +1 -2
  225. package/src/state-unlock.ts +1 -2
  226. package/src/workspace/change-set.schema.json +7 -0
  227. package/src/workspace/release-workflow.test.ts +18 -0
  228. package/src/workspace/release-workflow.ts +23 -2
@@ -0,0 +1,170 @@
1
+ /**
2
+ * terragucci's own Slack and Teams bodies, copied unchanged from
3
+ * packages/terragucci/src/notify.ts at terragucci commit c87473035270
4
+ * (origin/main, 2026-11-08), for #4818. chant's messages under terragucci's
5
+ * words must come out byte for byte as these do; once terragucci renders
6
+ * through chant's, it deletes the originals.
7
+ *
8
+ * Written here: the imports, `NOTIFY_SOURCE`, the notice types without the
9
+ * fields the renderers do not read, and `export` on `summary`. Every function
10
+ * body is terragucci's.
11
+ */
12
+ import { slackRelayActions, teamsRelayReply, type RelayButtons } from "../notify";
13
+
14
+ const NOTIFY_SOURCE = "terragucci";
15
+ export const REPLAN_ACTION = "terragucci-replan";
16
+ type WaveEvent = "waiting" | "refused" | "failed";
17
+
18
+ export interface WaveNotice {
19
+ event: WaveEvent;
20
+ wave: number;
21
+ project: string;
22
+ roots: string[];
23
+ approve: string;
24
+ digest?: string;
25
+ review?: { pr: number; url: string };
26
+ outcome?: string;
27
+ run?: string;
28
+ report?: string;
29
+ relay?: string;
30
+ }
31
+
32
+ export interface DriftNotice {
33
+ project: string;
34
+ roots: string[];
35
+ failed: string[];
36
+ run?: string;
37
+ report?: string;
38
+ replan?: string;
39
+ }
40
+
41
+ const HEADLINE: Record<WaveEvent, string> = {
42
+ waiting: "waits for an approval",
43
+ refused: "was refused: its plans changed after approval, so nothing in it was applied",
44
+ failed: "failed",
45
+ };
46
+
47
+ /** What happened to the wave: the first line, after `terragucci: `. */
48
+ export const summary = (n: WaveNotice): string => `wave ${n.wave} of ${n.project} ${HEADLINE[n.event]}`;
49
+
50
+ /** The first line of every message. */
51
+ export function headline(n: WaveNotice): string {
52
+ return `${NOTIFY_SOURCE}: ${summary(n)}`;
53
+ }
54
+
55
+ const rootsText = (n: WaveNotice): string => (n.roots.length > 0 ? n.roots.join(", ") : "see the run");
56
+
57
+ /** A Slack button. `url` makes it a link that opens a page. */
58
+ function slackButton(text: string, action: string, o: { value?: string; url?: string; style?: "primary" | "danger" }): Record<string, unknown> {
59
+ return { type: "button", action_id: action, text: { type: "plain_text", text }, ...(o.value ? { value: o.value } : {}), ...(o.url ? { url: o.url } : {}), ...(o.style ? { style: o.style } : {}) };
60
+ }
61
+
62
+ /**
63
+ * A Slack incoming webhook's body: one mrkdwn text. With the relay's signed
64
+ * button value (`relay`, which chant's sendNotify passes for a waiting wave
65
+ * when the relay key is set), the text as a block and chant's Approve and
66
+ * Decline buttons.
67
+ */
68
+ export function slackMessage(n: WaveNotice, relay?: RelayButtons): { text: string; blocks?: Record<string, unknown>[] } {
69
+ const text = slackText(n);
70
+ if (!n.relay || !relay || n.event !== "waiting") return { text };
71
+ return { text, blocks: [{ type: "section", text: { type: "mrkdwn", text } }, slackRelayActions(relay)] };
72
+ }
73
+
74
+ function slackText(n: WaveNotice): string {
75
+ return [
76
+ `*${headline(n)}*`,
77
+ ...(n.review ? [`Review and approve: <${n.review.url}|pull request ${n.review.pr}>, then run the wave again`] : []),
78
+ `Roots: ${rootsText(n)}`,
79
+ ...(n.digest ? [`Digest: \`${n.digest}\``] : []),
80
+ `${n.review ? "Or approve" : "Approve"}: \`${n.approve}\``,
81
+ ...(n.outcome ? [`Outcome: ${n.outcome}`] : []),
82
+ ...(n.run ? [`Run: <${n.run}>`] : []),
83
+ ...(n.report ? [`Report: <${n.report}>`] : []),
84
+ ].join("\n");
85
+ }
86
+
87
+ /** The Teams reply that approves or declines a waiting wave through the relay's outgoing webhook: a mention of the relay, then chant's reply. */
88
+ export const teamsReply = (n: Pick<WaveNotice, "relay">, relay: RelayButtons, action: "approve" | "decline"): string => `@${n.relay} ${teamsRelayReply(relay, action)}`;
89
+
90
+ /** A Teams incoming webhook's body (a Workflows webhook): one Adaptive Card. Its actions open the pull request's review page, under pr-review, and the run. */
91
+ export function teamsMessage(n: WaveNotice, relay?: RelayButtons): Record<string, unknown> {
92
+ const facts = [
93
+ { title: "Wave", value: String(n.wave) },
94
+ ...(n.review ? [{ title: "Review and approve", value: `pull request ${n.review.pr}, then run the wave again: ${n.review.url}` }] : []),
95
+ { title: "Roots", value: rootsText(n) },
96
+ ...(n.digest ? [{ title: "Digest", value: n.digest }] : []),
97
+ { title: n.review ? "Or approve" : "Approve", value: n.approve },
98
+ ...(n.outcome ? [{ title: "Outcome", value: n.outcome }] : []),
99
+ ...(n.run ? [{ title: "Run", value: n.run }] : []),
100
+ ];
101
+ return {
102
+ type: "message",
103
+ attachments: [
104
+ {
105
+ contentType: "application/vnd.microsoft.card.adaptive",
106
+ contentUrl: null,
107
+ content: {
108
+ $schema: "http://adaptivecards.io/schemas/adaptive-card.json",
109
+ type: "AdaptiveCard",
110
+ version: "1.4",
111
+ body: [
112
+ { type: "TextBlock", text: headline(n), weight: "Bolder", wrap: true },
113
+ { type: "FactSet", facts },
114
+ // Teams has no button that reaches a relay without a registered bot, so the card gives the reply its outgoing webhook reads.
115
+ ...(n.relay && relay && n.event === "waiting"
116
+ ? [{ type: "TextBlock", wrap: true, text: `Approve here: reply ${teamsReply(n, relay, "approve")}. Decline: reply ${teamsReply(n, relay, "decline")}.` }]
117
+ : []),
118
+ ],
119
+ ...(n.review || n.run ? { actions: [...(n.review ? [{ type: "Action.OpenUrl", title: "Review and approve", url: n.review.url }] : []), ...(n.run ? [{ type: "Action.OpenUrl", title: "Open the run", url: n.run }] : [])] } : {}),
120
+ },
121
+ },
122
+ ],
123
+ };
124
+ }
125
+
126
+ export const driftHeadline = (n: DriftNotice): string =>
127
+ `terragucci: drift in ${n.project}: ${n.roots.length > 0 ? `${n.roots.length} root${n.roots.length === 1 ? "" : "s"} changed outside Terraform` : "no drift found"}${n.failed.length > 0 ? `, ${n.failed.length} could not be refreshed` : ""}`;
128
+
129
+ /** The drift notice for Slack: the text, and a Re-plan button that opens the page where the check runs again. */
130
+ export function slackDrift(n: DriftNotice): { text: string; blocks?: Record<string, unknown>[] } {
131
+ const text = [
132
+ `*${driftHeadline(n)}*`,
133
+ ...(n.roots.length > 0 ? [`Drifted: ${n.roots.join(", ")}`] : []),
134
+ ...(n.failed.length > 0 ? [`Not refreshed: ${n.failed.join(", ")}`] : []),
135
+ ...(n.run ? [`Run: <${n.run}>`] : []),
136
+ ...(n.report ? [`Report: <${n.report}>`] : []),
137
+ ].join("\n");
138
+ if (!n.replan) return { text };
139
+ return { text, blocks: [{ type: "section", text: { type: "mrkdwn", text } }, { type: "actions", block_id: "terragucci-drift", elements: [slackButton("Re-plan", REPLAN_ACTION, { url: n.replan })] }] };
140
+ }
141
+
142
+ /** The drift notice for Teams: an Adaptive Card whose Re-plan button opens the page where the check runs again. */
143
+ export function teamsDrift(n: DriftNotice): Record<string, unknown> {
144
+ const facts = [
145
+ ...(n.roots.length > 0 ? [{ title: "Drifted", value: n.roots.join(", ") }] : []),
146
+ ...(n.failed.length > 0 ? [{ title: "Not refreshed", value: n.failed.join(", ") }] : []),
147
+ ...(n.run ? [{ title: "Run", value: n.run }] : []),
148
+ ];
149
+ const actions = [...(n.replan ? [{ type: "Action.OpenUrl", title: "Re-plan", url: n.replan }] : []), ...(n.run ? [{ type: "Action.OpenUrl", title: "Open the run", url: n.run }] : [])];
150
+ return {
151
+ type: "message",
152
+ attachments: [
153
+ {
154
+ contentType: "application/vnd.microsoft.card.adaptive",
155
+ contentUrl: null,
156
+ content: {
157
+ $schema: "http://adaptivecards.io/schemas/adaptive-card.json",
158
+ type: "AdaptiveCard",
159
+ version: "1.4",
160
+ body: [
161
+ { type: "TextBlock", text: driftHeadline(n), weight: "Bolder", wrap: true },
162
+ { type: "FactSet", facts },
163
+ ],
164
+ ...(actions.length > 0 ? { actions } : {}),
165
+ },
166
+ },
167
+ ],
168
+ };
169
+ }
170
+
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, it } from "vitest";
2
2
  import { readdirSync, readFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
- import { ACTION_PINS, pinAtMajor, pinMajor, tagComments, unpinnedActions, usesRef } from "./action-pins";
4
+ import { ACTION_PINS, CACHE4_PIN_FLOOR, pinAtMajor, pinMajor, tagComments, unpinnedActions, usesRef } from "./action-pins";
5
5
 
6
6
  describe("the action pin table", () => {
7
7
  it("holds a full commit SHA and a release of the row's major for every action", () => {
@@ -37,6 +37,16 @@ describe("the action pin table", () => {
37
37
  expect(pinAtMajor("0".repeat(40), "v3")).toBeUndefined();
38
38
  expect(pinMajor(ACTION_PINS.downloadArtifact4.sha)).toBe(4);
39
39
  });
40
+
41
+ it("pins actions/cache itself at v4, the commit its restore and save rows pin (#4816)", () => {
42
+ expect(ACTION_PINS.cache4).toEqual({ slug: "actions/cache", major: "v4", sha: "0057852bfaa89a56745cba8c7296529d2fc39830", tag: "v4.3.0" });
43
+ expect(usesRef(ACTION_PINS.cache4)).toBe("actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830");
44
+ expect(pinAtMajor(ACTION_PINS.cache6.sha, "v4")).toBe(ACTION_PINS.cache4);
45
+ // The restore row shares the commit; moving it keeps its own subpath.
46
+ expect(pinAtMajor(ACTION_PINS.cacheRestore4.sha, "v4")).toBe(ACTION_PINS.cacheRestore4);
47
+ expect(tagComments(` uses: ${usesRef(ACTION_PINS.cache4)}`)).toBe(` uses: ${usesRef(ACTION_PINS.cache4)} # v4.3.0`);
48
+ expect(CACHE4_PIN_FLOOR).toBe("0.124.78");
49
+ });
40
50
  });
41
51
 
42
52
  // #4410: the places that are not generators pin too.
@@ -9,11 +9,19 @@
9
9
  * forgejo lexicon moves `upload-artifact` and `download-artifact` to v3, whose
10
10
  * rows are here too: v4 and later refuse to run on a Forgejo runner (#4008).
11
11
  *
12
+ * actions/cache has a v4 row beside v6 (#4816): terragucci's Terragrunt cache
13
+ * step uses the action itself at the commit the restore and save rows pin.
14
+ * It follows them in the table, so `pinAtMajor` on that shared commit still
15
+ * starts from the restore row.
16
+ *
12
17
  * Refresh a row by resolving the major tag to its commit:
13
18
  *
14
19
  * gh api repos/actions/checkout/commits/v6 --jq .sha
15
20
  */
16
21
 
22
+ /** The first chant whose table has the `cache4` row (#4816). */
23
+ export const CACHE4_PIN_FLOOR = "0.124.78";
24
+
17
25
  export interface ActionPin {
18
26
  /** The action, with its subpath: `actions/cache/restore`. */
19
27
  readonly slug: string;
@@ -47,6 +55,7 @@ export const ACTION_PINS = {
47
55
  createGithubAppToken2: pin("actions/create-github-app-token", "v2", "fee1f7d63c2ff003460e3d139729b119787bc349", "v2.2.2"),
48
56
  cacheRestore4: pin("actions/cache/restore", "v4", "0057852bfaa89a56745cba8c7296529d2fc39830", "v4.3.0"),
49
57
  cacheSave4: pin("actions/cache/save", "v4", "0057852bfaa89a56745cba8c7296529d2fc39830", "v4.3.0"),
58
+ cache4: pin("actions/cache", "v4", "0057852bfaa89a56745cba8c7296529d2fc39830", "v4.3.0"),
50
59
  uploadArtifact4: pin("actions/upload-artifact", "v4", "ea165f8d65b6e75b540449e92b4886f43607fa02", "v4.6.2"),
51
60
  uploadArtifact3: pin("actions/upload-artifact", "v3", "ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5", "v3.2.1"),
52
61
  downloadArtifact4: pin("actions/download-artifact", "v4", "d3f86a106a0bac45b974a628896c90dbdf5c8093", "v4.3.0"),
@@ -10,7 +10,6 @@ import { tmpdir } from "node:os";
10
10
  import { join } from "node:path";
11
11
  import { describe, expect, it, onTestFinished } from "vitest";
12
12
  import { AGENT_GUARD_FLOOR, agentGuard, CLAUDE_SETTINGS_LOCAL, CLAUDE_SETTINGS_SHARED, installAgentGuard, withAgentGuardHook } from "./agent-guard";
13
- import { NEXT_RELEASE } from "./release-floors";
14
13
  import { PLYWOOD_GUARD } from "./__fixtures__/agent-guard/plywood";
15
14
  import { TERRAGUCCI_GUARD } from "./__fixtures__/agent-guard/terragucci";
16
15
 
@@ -60,7 +59,7 @@ function terragucci() {
60
59
  }
61
60
 
62
61
  describe("AGENT_GUARD_FLOOR", () => {
63
- it("names the next release", () => expect(AGENT_GUARD_FLOOR).toBe(NEXT_RELEASE));
62
+ it("names the next release", () => expect(AGENT_GUARD_FLOOR).toBe("0.124.77"));
64
63
  });
65
64
 
66
65
  describe("terragucci's guard: the wrappers", () => {
@@ -33,10 +33,9 @@
33
33
  import { spawnSync } from "node:child_process";
34
34
  import { chmodSync, existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
35
35
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
36
- import { NEXT_RELEASE } from "./release-floors";
37
36
 
38
37
  /** The first chant with the shared agent guard (#4770). Products feature-detect on it, or on `installAgentGuard`. */
39
- export const AGENT_GUARD_FLOOR = NEXT_RELEASE;
38
+ export const AGENT_GUARD_FLOOR = "0.124.77";
40
39
 
41
40
  /** What the guard refuses of one engine binary (tofu, pulumi, terragrunt). Flag names are written with their dashes. */
42
41
  export interface AgentGuardEngine {
@@ -315,3 +315,23 @@ describe("a grouped member (ws-107, #4440)", () => {
315
315
  expect(isEmptyChangeSet(composeChangeSet([part("a", { digest, reads: [] }), part("b", { digest, reads: ["a.id"] })]))).toBe(false);
316
316
  });
317
317
  });
318
+
319
+ describe("a member whose plan changes outputs (#4849)", () => {
320
+ const part = (member: string, outputs?: string[]): ChangeSetPart => ({
321
+ member: { member, lexicon: "terraform", planner: "tofu", status: "planned", planDigest: computePlanDigest("p", member), holes: [], ...(outputs ? { outputs } : {}) },
322
+ entries: [{ member, lexicon: "terraform", planner: "tofu", address: "aws_s3_bucket.a", type: "aws_s3_bucket", name: "a", action: "no-op", attributes: [] }],
323
+ });
324
+
325
+ test("a change set whose only change is an output is not empty", () => {
326
+ expect(isEmptyChangeSet(composeChangeSet([part("a"), part("b")]))).toBe(true);
327
+ expect(isEmptyChangeSet(composeChangeSet([part("a"), part("b", ["url"])]))).toBe(false);
328
+ });
329
+
330
+ test("the outputs are not hashed again, since the member's plan digest covers them, and the schema reads them", () => {
331
+ const plain = composeChangeSet([part("a"), part("b")]);
332
+ const outputs = composeChangeSet([part("a"), part("b", ["url"])]);
333
+ expect(outputs.digest).toBe(plain.digest);
334
+ expect(verifyChangeSetDigest(outputs)).toBe(true);
335
+ expectValid(outputs);
336
+ });
337
+ });
package/src/change-set.ts CHANGED
@@ -200,6 +200,14 @@ export interface ChangeSetMember {
200
200
  placeholders?: string[];
201
201
  /** The planner's own digest of the same plan, when it prints one (choudoufu's per-root digest). */
202
202
  nativeDigest?: string;
203
+ /**
204
+ * The outputs the member's plan changes, by name, sorted (#4849). Absent
205
+ * when it changes none. A member with any is a change, even when every
206
+ * entry is a no-op ({@link isEmptyChangeSet}). Not hashed again: the
207
+ * member's `planDigest` already covers them. Added within contract 1 by
208
+ * chant `CHANGE_SET_OUTPUTS_FLOOR` (release-floors).
209
+ */
210
+ outputs?: string[];
203
211
  holes: ChangeSetHole[];
204
212
  /**
205
213
  * Set on a member a capability planned with others as one group (ws-107,
@@ -475,12 +483,14 @@ export function verifyChangeSetDigest(
475
483
  * planner marked `mayAppear`. A release gate over such a document passes
476
484
  * without an approval. A member that reads a value its group computes in its
477
485
  * apply (`group.reads`, ws-107 ruling 4) makes it not empty: what the plan
478
- * shows may not be all the apply does.
486
+ * shows may not be all the apply does. A member whose plan changes an
487
+ * output (`outputs`, #4849) makes it not empty too.
479
488
  */
480
489
  export function isEmptyChangeSet(doc: Pick<ChangeSetDocument, "members" | "entries">): boolean {
481
490
  if (doc.members.length === 0) return false;
482
491
  for (const m of doc.members) {
483
492
  if (m.status !== "planned" || m.provisional === true || m.holes.length > 0) return false;
493
+ if (m.outputs && m.outputs.length > 0) return false;
484
494
  if (m.group && m.group.reads.length > 0) return false;
485
495
  }
486
496
  return doc.entries.every((e) => (e.action === "no-op" || e.action === "read") && e.mayAppear !== true);
@@ -345,4 +345,13 @@ describe("the run record", () => {
345
345
  expect(r).toMatchObject({ op: "plywood-drift-app", env: "local", status: "ok", labels: { Agent: "drift" }, outcomes: { agent: { trigger: "drift", result: "opened", usage: { usd: 0.4 } } } });
346
346
  expect(r.phases[0]!.steps[0]).toMatchObject({ fn: "agent:drift", status: "ok", durationMs: 300_000 });
347
347
  });
348
+
349
+ test("takes a product's own trigger word and records it as given (#4817)", () => {
350
+ const settings = { name: "terragucci-review", on: "review", env: "local" };
351
+ const r = agentRunRecordInput({ settings, started: "2026-10-27T11:00:00Z", ended: "2026-10-27T11:01:00Z", result: "updated", reason: "noted" });
352
+ expect(r).toMatchObject({ op: "terragucci-review", labels: { Agent: "review" }, outcomes: { agent: { trigger: "review", result: "updated" } } });
353
+ expect(r.phases[0]!.steps[0]).toMatchObject({ fn: "agent:review", status: "ok" });
354
+ const refused = agentRunRecordInput({ settings: { ...settings, name: "terragucci-refused-wave", on: "refused-wave" }, started: "2026-10-27T11:00:00Z", ended: "2026-10-27T11:00:00Z", result: "refused", reason: "refused" });
355
+ expect(refused).toMatchObject({ status: "ok", labels: { Agent: "refused-wave" }, outcomes: { agent: { trigger: "refused-wave" } } });
356
+ });
348
357
  });
package/src/ci-agent.ts CHANGED
@@ -51,6 +51,14 @@ export const CI_AGENT_FLOOR = "0.124.55";
51
51
  export type AgentTrigger = "comment" | "drift";
52
52
  export const AGENT_TRIGGERS: readonly AgentTrigger[] = ["comment", "drift"];
53
53
 
54
+ /**
55
+ * The trigger a run record names (#4817): one of chant's {@link AgentTrigger}s,
56
+ * or a product's own word for a model run it records on the same ledger, such
57
+ * as terragucci's `review` and `refused-wave`. A record's `trigger` was always
58
+ * a plain string, so a record written with chant's two words reads the same.
59
+ */
60
+ export type AgentRunTrigger = AgentTrigger | (string & {});
61
+
54
62
  /**
55
63
  * A scheduled Op spec's `agent` (#4616): the agent jobs the Op generator
56
64
  * writes. With `on: "comment"` the spec is the agent's own workflow,
@@ -763,9 +771,14 @@ export interface LandInput {
763
771
  runUrl?: string;
764
772
  }
765
773
 
766
- /** The run record of one agent run (#4551): op `<name>`, one phase with one step, the outcome in `outcomes`. */
774
+ /**
775
+ * The run record of one agent run (#4551): op `<name>`, one phase with one
776
+ * step, the outcome in `outcomes`. `settings.on` is the outcome's `trigger`,
777
+ * the `Agent` label and the step's `agent:<on>`. A trigger outside
778
+ * {@link AGENT_TRIGGERS}, a product's own word (#4817), is recorded as given.
779
+ */
767
780
  export function agentRunRecordInput(o: {
768
- settings: Pick<AgentSettings, "name" | "on" | "env">;
781
+ settings: Pick<AgentSettings, "name" | "env"> & { on: AgentRunTrigger };
769
782
  started: string;
770
783
  ended: string;
771
784
  result: AgentResult;
@@ -22,6 +22,13 @@ import {
22
22
  resolveCommitSpec,
23
23
  runCommit,
24
24
  COMMIT_PR_ENV,
25
+ CI_COMMIT_ARG_FLOOR,
26
+ CI_COMMIT_HARNESS_BREAK_FLOOR,
27
+ COMMIT_HARNESS_BREAK_ENV,
28
+ COMMIT_HARNESS_FORGE,
29
+ commitHarnessBreaks,
30
+ commitArgv,
31
+ GITLAB_COMMIT_ARG_VAR,
25
32
  type CommitRefusalReply,
26
33
  type CommitRunCommand,
27
34
  type CommitSettings,
@@ -482,3 +489,158 @@ describe("the command's variables and its refusal reply (#4724)", () => {
482
489
  expect(w.replies[0]).toContain("stopped with exit code 3");
483
490
  });
484
491
  });
492
+
493
+ describe("the comment's argument (#4820)", () => {
494
+ const NAME_PATTERN = "^[a-z0-9]+(?:[-_][a-z0-9]+)*$";
495
+ const named = (extra: Partial<OpCommitSpec> = {}) => settings({ commentArg: { pattern: NAME_PATTERN, position: 1 }, ...extra });
496
+ const seeing = (into: (readonly string[])[]): CommitRunCommand => async (argv, o) => {
497
+ into.push(argv);
498
+ return formatter()(argv, o);
499
+ };
500
+
501
+ test("the parse reads one argument only for a word that declares it, against its pattern and chant's own", () => {
502
+ const args = { fmt: new RegExp(NAME_PATTERN) };
503
+ expect(parseProductComment(words, "/plywood fmt", {}, args)).toEqual({ kind: "commit", word: "fmt" });
504
+ expect(parseProductComment(words, "/plywood fmt add-note", {}, args)).toEqual({ kind: "commit", word: "fmt", arg: "add-note" });
505
+ expect(parseProductComment(words, "/plywood fmt Add-Note", {}, args)).toMatchObject({ kind: "refused", reason: expect.stringMatching(/`\/plywood fmt` takes nothing, or one name after it/) });
506
+ expect(parseProductComment(words, "/plywood fmt a b", {}, args)).toMatchObject({ kind: "refused" });
507
+ expect(parseProductComment(words, "/plywood fmt --force", {}, args)).toMatchObject({ kind: "refused" });
508
+ // chant's own check holds whatever the product's pattern lets through.
509
+ expect(parseProductComment(words, "/plywood fmt ../x", {}, { fmt: /^.*$/ })).toMatchObject({ kind: "refused" });
510
+ expect(parseProductComment(words, "/plywood fmt $(id)", {}, { fmt: /^.*$/ })).toMatchObject({ kind: "refused" });
511
+ expect(parseProductComment(words, "/plywood fmt add-note")).toEqual({ kind: "refused", reason: "`/plywood fmt` takes nothing after it" });
512
+ });
513
+
514
+ test("commentArg round-trips through the job's variables and refuses a loose pattern, a bad position or the check trigger", () => {
515
+ const s = named();
516
+ expect(s.commentArg).toEqual({ pattern: NAME_PATTERN, position: 1 });
517
+ expect(commitSettingsFromEnv(commitSettingsEnv(s), "plywood")).toEqual(s);
518
+ expect(settings().commentArg).toBeUndefined();
519
+ expect(() => named({ commentArg: { pattern: "[a-z]+", position: 1 } })).toThrow(/anchored/);
520
+ expect(() => named({ commentArg: { pattern: "^(?:$", position: 1 } })).toThrow(/pattern/);
521
+ expect(() => named({ commentArg: { pattern: NAME_PATTERN, position: 0 } })).toThrow(/position/);
522
+ expect(() => named({ commentArg: { pattern: NAME_PATTERN, position: 4 } })).toThrow(/position/);
523
+ expect(() => resolveCommitSpec("plywood-fmt", { on: "check", command: ["terraform", "fmt"], allowed: ["main.tf"], commentArg: { pattern: NAME_PATTERN, position: 1 } }, "plywood")).toThrow(/comment trigger/);
524
+ });
525
+
526
+ test("commitArgv puts the argument at its position and refuses one the settings do not take", () => {
527
+ expect(commitArgv(named(), "add-note")).toEqual(["terraform", "add-note", "fmt", "-recursive"]);
528
+ expect(commitArgv(named(), undefined)).toEqual(["terraform", "fmt", "-recursive"]);
529
+ expect(() => commitArgv(settings(), "add-note")).toThrow(/takes no argument/);
530
+ expect(() => commitArgv(named(), "Bad")).toThrow(/not a name/);
531
+ });
532
+
533
+ test("the comment's argument reaches the command's argv, the commit and the reply", async () => {
534
+ const w = world();
535
+ const argvs: (readonly string[])[] = [];
536
+ const { decision, out } = await cycle(w, named(), { event: comment("/plywood fmt add-note"), command: seeing(argvs) });
537
+ expect(decision.arg).toBe("add-note");
538
+ expect(argvs).toEqual([["terraform", "add-note", "fmt", "-recursive"]]);
539
+ expect(out.result).toBe("pushed");
540
+ expect(featureLog(w)).toContain("/plywood fmt add-note asked for by ana");
541
+ expect(featureLog(w)).toContain("Ran terraform add-note fmt -recursive on ");
542
+ expect(w.replies[0]).toContain("from `terraform add-note fmt -recursive`");
543
+ });
544
+
545
+ test("without an argument the argv is the spec's", async () => {
546
+ const w = world();
547
+ const argvs: (readonly string[])[] = [];
548
+ const { decision } = await cycle(w, named(), { command: seeing(argvs) });
549
+ expect(decision.arg).toBeUndefined();
550
+ expect(argvs).toEqual([["terraform", "fmt", "-recursive"]]);
551
+ });
552
+
553
+ test("an argument off the pattern is refused before anything runs", async () => {
554
+ const w = world();
555
+ const argvs: (readonly string[])[] = [];
556
+ const { out } = await cycle(w, named(), { event: comment("/plywood fmt Not_ok!"), command: seeing(argvs) });
557
+ expect(argvs).toEqual([]);
558
+ expect(out.result).toBe("refused");
559
+ expect(out.reason).toMatch(/takes nothing, or one name after it/);
560
+ expect(sh(["rev-parse", "refs/heads/feature"], w.r.origin).trim()).toBe(w.r.head);
561
+ });
562
+
563
+ test("GitLab takes the argument from its own pipeline variable", async () => {
564
+ const w = world();
565
+ const argvs: (readonly string[])[] = [];
566
+ const env = { GITLAB_CI: "true", CHANT_COMMIT_PR: "7", CHANT_COMMIT: "fmt", [GITLAB_COMMIT_ARG_VAR]: "add-note", GITLAB_USER_LOGIN: "ana" };
567
+ const { out } = await cycle(w, named(), { event: {}, env, command: seeing(argvs) });
568
+ expect(out.result).toBe("pushed");
569
+ expect(argvs).toEqual([["terraform", "add-note", "fmt", "-recursive"]]);
570
+ const bad = world();
571
+ const { out: refused } = await cycle(bad, named(), { event: {}, env: { ...env, [GITLAB_COMMIT_ARG_VAR]: "a b" }, command: seeing([]) });
572
+ expect(refused.result).toBe("refused");
573
+ });
574
+
575
+ test("the floor is the next release until it ships", () => {
576
+ expect(CI_COMMIT_ARG_FLOOR).toBe("0.124.78");
577
+ });
578
+ });
579
+
580
+ describe("the harness's BREAK switch for land (#4836)", () => {
581
+ const harness = (checks: string) => ({ [COMMIT_HARNESS_BREAK_ENV]: checks, BREAK: "1", GITHUB_SERVER_URL: COMMIT_HARNESS_FORGE });
582
+
583
+ test("is read only in a BREAK arm on the harness's Forgejo, and refused anywhere else", () => {
584
+ expect(commitHarnessBreaks({})).toEqual({ checks: [] });
585
+ expect(commitHarnessBreaks(harness("paths"))).toEqual({ checks: ["paths"] });
586
+ expect(commitHarnessBreaks({ ...harness("paths, moved-base"), GITHUB_SERVER_URL: `${COMMIT_HARNESS_FORGE}/` })).toEqual({ checks: ["paths", "moved-base"] });
587
+ expect(commitHarnessBreaks({ ...harness("paths"), BREAK: undefined })).toMatchObject({ refused: expect.stringMatching(/only in a BREAK arm of chant's e2e harness/) });
588
+ expect(commitHarnessBreaks({ ...harness("paths"), GITHUB_SERVER_URL: "https://github.com" })).toMatchObject({ refused: expect.stringMatching(/only in a BREAK arm/) });
589
+ expect(commitHarnessBreaks({ ...harness("paths"), GITHUB_SERVER_URL: undefined })).toMatchObject({ refused: expect.any(String) });
590
+ expect(commitHarnessBreaks({ ...harness("paths"), GITLAB_CI: "true" })).toMatchObject({ refused: expect.any(String) });
591
+ expect(commitHarnessBreaks(harness("guarded"))).toMatchObject({ refused: expect.stringMatching(/paths and moved-base/) });
592
+ expect(commitHarnessBreaks(harness(""))).toEqual({ checks: [] });
593
+ });
594
+
595
+ test("the harness's Forgejo is the one chant's e2e stack runs", async () => {
596
+ const { HARNESS_HOSTS } = await import("./e2e-harness/stack");
597
+ expect(COMMIT_HARNESS_FORGE).toBe(HARNESS_HOSTS.forgejo);
598
+ });
599
+
600
+ test("outside a harness the switch fails the land and pushes nothing", async () => {
601
+ const w = world();
602
+ const { out } = await cycle(w, settings(), { env: { [COMMIT_HARNESS_BREAK_ENV]: "paths" } });
603
+ expect(out).toMatchObject({ result: "failed", code: 1 });
604
+ expect(out.reason).toMatch(new RegExp(COMMIT_HARNESS_BREAK_ENV));
605
+ expect(sh(["rev-parse", "refs/heads/feature"], w.r.origin).trim()).toBe(w.r.head);
606
+ expect(w.replies[0]).toMatch(/only in a BREAK arm.*nothing was pushed/);
607
+ });
608
+
609
+ test("paths: a change outside allowed lands, and says the check was off", async () => {
610
+ const w = world();
611
+ const { out } = await cycle(w, settings(), { command: formatter({ "other.tf": "z\n" }), env: harness("paths") });
612
+ expect(out.result).toBe("pushed");
613
+ expect(out.paths).toEqual(["main.tf", "other.tf"]);
614
+ expect(out.reason).toContain("BREAK: the path check was off");
615
+ expect(w.replies[0]).toContain("BREAK: the path check was off");
616
+ });
617
+
618
+ test("paths: a guarded path is still refused", async () => {
619
+ const w = world();
620
+ const { out } = await cycle(w, settings(), { command: formatter({ ".github/workflows/x.yml": "on: push\n" }), env: harness("paths") });
621
+ expect(out.result).toBe("refused");
622
+ expect(out.reason).toBe("the change touches .github/workflows/x.yml");
623
+ expect(sh(["rev-parse", "refs/heads/feature"], w.r.origin).trim()).toBe(w.r.head);
624
+ });
625
+
626
+ test("moved-base: a base that moved while the command ran lands the merge of the tip the command ran on", async () => {
627
+ const w = world();
628
+ const ran = onMain(w, { "migrations/002.sql": "x\n" });
629
+ const { out } = await cycle(w, settings({ mergeBase: true }), { env: harness("moved-base"), between: () => void onMain(w, { "migrations/003.sql": "y\n" }, "moved") });
630
+ expect(out.result).toBe("pushed");
631
+ expect(out.reason).toContain("BREAK: the moved-base check was off");
632
+ const parents = sh(["log", "-1", "--format=%P", "refs/heads/feature"], w.r.origin).trim().split(" ");
633
+ expect(parents).toEqual([w.r.head, ran]);
634
+ });
635
+
636
+ test("one check off leaves the other on", async () => {
637
+ const w = world();
638
+ onMain(w, { "migrations/002.sql": "x\n" });
639
+ const { out } = await cycle(w, settings({ mergeBase: true }), { env: harness("paths"), between: () => void onMain(w, { "migrations/003.sql": "y\n" }, "moved") });
640
+ expect(out).toMatchObject({ result: "refused", reason: "the base moved" });
641
+ });
642
+
643
+ test("the floor is the next release until it ships", () => {
644
+ expect(CI_COMMIT_HARNESS_BREAK_FLOOR).toBe("0.124.78");
645
+ });
646
+ });