@intentius/chant 0.124.89 → 0.124.91

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 (185) hide show
  1. package/dist/actor.d.ts +5 -3
  2. package/dist/actor.d.ts.map +1 -1
  3. package/dist/actor.js +7 -5
  4. package/dist/audit/core.d.ts.map +1 -1
  5. package/dist/audit/core.js +11 -1
  6. package/dist/ci-comment-commands.d.ts +18 -2
  7. package/dist/ci-comment-commands.d.ts.map +1 -1
  8. package/dist/ci-comment-commands.js +30 -2
  9. package/dist/ci-job-guard.d.ts +42 -45
  10. package/dist/ci-job-guard.d.ts.map +1 -1
  11. package/dist/ci-job-guard.js +206 -3
  12. package/dist/ci-note-commands.d.ts +41 -1
  13. package/dist/ci-note-commands.d.ts.map +1 -1
  14. package/dist/ci-note-commands.js +64 -5
  15. package/dist/ci-product.d.ts +50 -1
  16. package/dist/ci-product.d.ts.map +1 -1
  17. package/dist/ci-product.js +52 -6
  18. package/dist/cli/handlers/pr-comment.d.ts +13 -1
  19. package/dist/cli/handlers/pr-comment.d.ts.map +1 -1
  20. package/dist/cli/handlers/pr-comment.js +90 -1
  21. package/dist/cli/handlers/pr-notes.d.ts.map +1 -1
  22. package/dist/cli/handlers/pr-notes.js +23 -1
  23. package/dist/cli/handlers/pr.d.ts +2 -2
  24. package/dist/cli/handlers/pr.d.ts.map +1 -1
  25. package/dist/cli/handlers/pr.js +41 -20
  26. package/dist/cli/handlers/run-wave.d.ts.map +1 -1
  27. package/dist/cli/handlers/run-wave.js +154 -4
  28. package/dist/cli/main.d.ts.map +1 -1
  29. package/dist/cli/main.js +17 -0
  30. package/dist/cli/parse-args.d.ts.map +1 -1
  31. package/dist/cli/parse-args.js +28 -0
  32. package/dist/cli/registry.d.ts +12 -1
  33. package/dist/cli/registry.d.ts.map +1 -1
  34. package/dist/components/pr-checks.d.ts +39 -1
  35. package/dist/components/pr-checks.d.ts.map +1 -1
  36. package/dist/components/pr-checks.js +45 -2
  37. package/dist/components/pr-pipeline.d.ts +11 -3
  38. package/dist/components/pr-pipeline.d.ts.map +1 -1
  39. package/dist/components/pr-pipeline.js +20 -7
  40. package/dist/components/product-pipeline.d.ts +54 -2
  41. package/dist/components/product-pipeline.d.ts.map +1 -1
  42. package/dist/components/product-pipeline.js +63 -6
  43. package/dist/components/product-plan.d.ts +92 -2
  44. package/dist/components/product-plan.d.ts.map +1 -1
  45. package/dist/components/product-plan.js +172 -22
  46. package/dist/floor-table.data.d.ts.map +1 -1
  47. package/dist/floor-table.data.js +37 -23
  48. package/dist/lexicon-module.d.ts +2 -0
  49. package/dist/lexicon-module.d.ts.map +1 -1
  50. package/dist/lexicon-module.js +6 -2
  51. package/dist/lexicon.d.ts +82 -4
  52. package/dist/lexicon.d.ts.map +1 -1
  53. package/dist/lifecycle/gate-applied.d.ts +9 -0
  54. package/dist/lifecycle/gate-applied.d.ts.map +1 -1
  55. package/dist/op/apply-status.d.ts +84 -0
  56. package/dist/op/apply-status.d.ts.map +1 -0
  57. package/dist/op/apply-status.js +106 -0
  58. package/dist/op/before-merge-decide.d.ts +102 -0
  59. package/dist/op/before-merge-decide.d.ts.map +1 -0
  60. package/dist/op/before-merge-decide.js +142 -0
  61. package/dist/op/before-merge-done.d.ts +56 -0
  62. package/dist/op/before-merge-done.d.ts.map +1 -0
  63. package/dist/op/before-merge-done.js +69 -0
  64. package/dist/op/before-merge-store.d.ts +20 -0
  65. package/dist/op/before-merge-store.d.ts.map +1 -0
  66. package/dist/op/before-merge-store.js +48 -0
  67. package/dist/op/before-merge.d.ts +150 -0
  68. package/dist/op/before-merge.d.ts.map +1 -0
  69. package/dist/op/before-merge.js +207 -0
  70. package/dist/op/follow-on-run.d.ts +117 -0
  71. package/dist/op/follow-on-run.d.ts.map +1 -0
  72. package/dist/op/follow-on-run.js +154 -0
  73. package/dist/op/follow-on-store.d.ts +17 -0
  74. package/dist/op/follow-on-store.d.ts.map +1 -0
  75. package/dist/op/follow-on-store.js +54 -0
  76. package/dist/op/gate.d.ts +6 -0
  77. package/dist/op/gate.d.ts.map +1 -1
  78. package/dist/op/gate.js +10 -1
  79. package/dist/op/index.d.ts +3 -1
  80. package/dist/op/index.d.ts.map +1 -1
  81. package/dist/op/index.js +1 -0
  82. package/dist/op/op-waves-after-plan.d.ts +13 -0
  83. package/dist/op/op-waves-after-plan.d.ts.map +1 -1
  84. package/dist/op/op-waves-evidence-jobs.d.ts +4 -1
  85. package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -1
  86. package/dist/op/op-waves-evidence-jobs.js +10 -2
  87. package/dist/op/op-waves-follow-on.d.ts +162 -0
  88. package/dist/op/op-waves-follow-on.d.ts.map +1 -0
  89. package/dist/op/op-waves-follow-on.js +355 -0
  90. package/dist/op/op-waves-run.d.ts +146 -6
  91. package/dist/op/op-waves-run.d.ts.map +1 -1
  92. package/dist/op/op-waves-run.js +871 -99
  93. package/dist/op/op-waves-split.d.ts +122 -0
  94. package/dist/op/op-waves-split.d.ts.map +1 -0
  95. package/dist/op/op-waves-split.js +166 -0
  96. package/dist/op/op-waves.d.ts +20 -0
  97. package/dist/op/op-waves.d.ts.map +1 -1
  98. package/dist/op/op-waves.js +15 -1
  99. package/dist/op/schedule-overdue.d.ts +15 -1
  100. package/dist/op/schedule-overdue.d.ts.map +1 -1
  101. package/dist/op/schedule-overdue.js +18 -2
  102. package/dist/op/stage-hooks.d.ts +36 -1
  103. package/dist/op/stage-hooks.d.ts.map +1 -1
  104. package/dist/op/stage-hooks.js +17 -3
  105. package/dist/op/wave-stop.d.ts +4 -1
  106. package/dist/op/wave-stop.d.ts.map +1 -1
  107. package/dist/op/wave-stop.js +4 -2
  108. package/dist/planned-files.d.ts +16 -8
  109. package/dist/planned-files.d.ts.map +1 -1
  110. package/dist/planned-files.js +12 -8
  111. package/dist/pr-post.d.ts +6 -0
  112. package/dist/pr-post.d.ts.map +1 -1
  113. package/dist/pr-post.js +7 -5
  114. package/dist/release-floors.d.ts +9 -1
  115. package/dist/release-floors.d.ts.map +1 -1
  116. package/dist/release-floors.js +27 -19
  117. package/dist/wave-blocked.d.ts +7 -1
  118. package/dist/wave-blocked.d.ts.map +1 -1
  119. package/dist/wave-blocked.js +7 -2
  120. package/dist/wave-runtime.mjs +364 -351
  121. package/package.json +1 -1
  122. package/src/actor.test.ts +14 -1
  123. package/src/actor.ts +8 -6
  124. package/src/audit/core.ts +13 -1
  125. package/src/audit/first-load.test.ts +101 -0
  126. package/src/ci-comment-commands.test.ts +63 -0
  127. package/src/ci-comment-commands.ts +43 -4
  128. package/src/ci-image.test.ts +1 -2
  129. package/src/ci-job-guard.before-merge.test.ts +148 -0
  130. package/src/ci-job-guard.follow-on-record.test.ts +137 -0
  131. package/src/ci-job-guard.follow-on.test.ts +144 -0
  132. package/src/ci-job-guard.ts +221 -3
  133. package/src/ci-note-commands.test.ts +76 -1
  134. package/src/ci-note-commands.ts +96 -7
  135. package/src/ci-product.ts +65 -6
  136. package/src/cli/handlers/pr-comment.ts +85 -2
  137. package/src/cli/handlers/pr-notes.ts +30 -6
  138. package/src/cli/handlers/pr.ts +34 -17
  139. package/src/cli/handlers/run-wave.ts +144 -4
  140. package/src/cli/main.ts +17 -0
  141. package/src/cli/parse-args.ts +20 -0
  142. package/src/cli/registry.ts +12 -1
  143. package/src/components/pr-checks.ts +66 -2
  144. package/src/components/pr-pipeline.ts +21 -9
  145. package/src/components/product-pipeline.apply-status.test.ts +50 -0
  146. package/src/components/product-pipeline.ts +117 -9
  147. package/src/components/product-plan-names.test.ts +135 -0
  148. package/src/components/product-plan.test.ts +23 -5
  149. package/src/components/product-plan.ts +248 -25
  150. package/src/floor-table.data.ts +37 -23
  151. package/src/lexicon-module.ts +6 -2
  152. package/src/lexicon.ts +78 -1
  153. package/src/lifecycle/gate-applied.ts +7 -0
  154. package/src/op/apply-status.test.ts +83 -0
  155. package/src/op/apply-status.ts +132 -0
  156. package/src/op/before-merge-decide.ts +190 -0
  157. package/src/op/before-merge-done.ts +99 -0
  158. package/src/op/before-merge-store.ts +44 -0
  159. package/src/op/before-merge.test.ts +201 -0
  160. package/src/op/before-merge.ts +266 -0
  161. package/src/op/follow-on-run.ts +206 -0
  162. package/src/op/follow-on-store.ts +54 -0
  163. package/src/op/gate.ts +16 -1
  164. package/src/op/index.ts +5 -0
  165. package/src/op/op-waves-after-plan.ts +13 -0
  166. package/src/op/op-waves-evidence-jobs.ts +11 -3
  167. package/src/op/op-waves-follow-on-record.test.ts +152 -0
  168. package/src/op/op-waves-follow-on.test.ts +247 -0
  169. package/src/op/op-waves-follow-on.ts +385 -0
  170. package/src/op/op-waves-render-spec.test.ts +1 -2
  171. package/src/op/op-waves-run.ts +971 -93
  172. package/src/op/op-waves-split-product.test.ts +288 -0
  173. package/src/op/op-waves-split-step.test.ts +298 -0
  174. package/src/op/op-waves-split.test.ts +196 -0
  175. package/src/op/op-waves-split.ts +189 -0
  176. package/src/op/op-waves.ts +28 -3
  177. package/src/op/schedule-overdue.test.ts +29 -1
  178. package/src/op/schedule-overdue.ts +27 -3
  179. package/src/op/stage-hooks.ts +52 -4
  180. package/src/op/wave-stop.ts +5 -3
  181. package/src/planned-files.test.ts +33 -0
  182. package/src/planned-files.ts +26 -10
  183. package/src/pr-post.ts +13 -5
  184. package/src/release-floors.ts +31 -19
  185. package/src/wave-blocked.ts +9 -4
@@ -0,0 +1,142 @@
1
+ /**
2
+ * The decision behind `/<product> apply [wave-<n>]` on an open pull request
3
+ * whose waves run before merge (#4984), moved from terragucci's
4
+ * `decideOpen` and `openChecks` (comment-apply.ts) and `decideGitLabApply`
5
+ * (comment-apply-gitlab.ts). The comment job runs it on GitHub and Forgejo
6
+ * (../ci-comment-commands.ts), the note poll on GitLab
7
+ * (../ci-note-commands.ts), each at the default branch's commit with the
8
+ * job's token, so none of the change's code runs here.
9
+ *
10
+ * In order, each refused with a reply that says why:
11
+ *
12
+ * - the pull request is from this repository, into the default branch, and
13
+ * the wave it names is one the waves have;
14
+ * - its head, fetched from the forge's pull request ref, is still the head
15
+ * the forge named while the comment was read;
16
+ * - the requires the product lists (`apply.requires`, chant's requires
17
+ * checks: approved, mergeable, undiverged, checks) pass at that head;
18
+ * - every plan status of the product plan (`<product>/plan`, or one per
19
+ * target) passed on that head: a policy denial fails it, and nothing
20
+ * waives one;
21
+ * - the change touches none of the pipeline's files (the forge's workflow
22
+ * directory and the waves spec by default): the run is the default
23
+ * branch's pipeline, so a change to it applies after it merges;
24
+ * - with the product's reach line, it takes the locks of what it reaches at
25
+ * stage `apply`, and no other open pull request holds one of them.
26
+ *
27
+ * Then it records the decision on `chant/lifecycle` (./before-merge.ts),
28
+ * writes a wave stop for the head when the comment named a wave, or clears
29
+ * one (./wave-stop.ts), and starts the waves for that head: GitHub and
30
+ * Forgejo dispatch the waves workflow on the default branch with the
31
+ * inputs `pr`, `head` and `digest`; GitLab starts a pipeline of the default
32
+ * branch with the same three as variables.
33
+ */
34
+ import { commentTerms, forkReply } from "../ci-comment-replies.js";
35
+ import { pullRequestHeadRef } from "../lifecycle/reach-locks.js";
36
+ /** The pipeline files a before-merge change may not touch by default, by forge: the workflows and the waves specs. */
37
+ export function defaultPipelineFiles(forge) {
38
+ const workflows = forge === "gitlab" ? [".gitlab-ci.yml", ".gitlab/"] : forge === "forgejo" ? [".forgejo/workflows/"] : [".github/workflows/"];
39
+ return [...workflows, ".chant/op-waves/"];
40
+ }
41
+ const SHA = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
42
+ const BRANCH = /^[A-Za-z0-9][A-Za-z0-9._/-]{0,254}$/;
43
+ const short = (sha) => sha.slice(0, 8);
44
+ const message = (e) => (e instanceof Error ? e.message : String(e)).split("\n")[0];
45
+ /** Whether `file` is one of `paths`: equal to one, or under one that ends in `/`. */
46
+ export function touchesPipeline(file, paths) {
47
+ return paths.some((p) => (p.endsWith("/") ? file.startsWith(p) : file === p));
48
+ }
49
+ /** Decide the apply, record it and start the waves (#4984). */
50
+ export async function decideWavesBeforeMerge(i) {
51
+ const t = commentTerms(i.forge);
52
+ const at = t.at(i.pr.number);
53
+ const verb = i.words.verbs.apply;
54
+ const typed = `/${i.words.product} ${Object.entries(i.words.commands).find(([, c]) => c === "apply")?.[0] ?? "apply"}`;
55
+ const reply = (text) => ({ kind: "reply", text });
56
+ const fail = (reason) => ({ kind: "fail", reason });
57
+ const run = (args) => i.git(["git", ...args], { ...(i.cwd ? { cwd: i.cwd } : {}) });
58
+ if (!i.pr.sameRepo)
59
+ return reply(forkReply(i.words, i.forge));
60
+ if (i.pr.base !== undefined && i.pr.base !== i.base)
61
+ return reply(`${at} targets ${i.pr.base}, not the default branch ${i.base}, so it is not ${verb[1]} before merge`);
62
+ if (i.wave !== undefined && i.wave > i.count)
63
+ return reply(`the ${verb[0]} of this ${t.place} runs in ${i.count} wave${i.count === 1 ? "" : "s"}, so there is no \`wave-${i.wave}\``);
64
+ const head = i.pr.headSha;
65
+ if (!head || !SHA.test(head))
66
+ return fail(`${at} names no head commit`);
67
+ if (!BRANCH.test(i.base) || i.base.split("/").some((s) => s === ".." || s === ""))
68
+ return fail(`the default branch ${JSON.stringify(i.base)} is not a branch name this job passes on`);
69
+ // The head as the forge's pull request ref has it now, and the default branch's commit the change is measured from.
70
+ const headRef = "refs/remotes/chant/before-merge-head";
71
+ const baseRef = `refs/remotes/origin/${i.base}`;
72
+ const fetched = run(["fetch", "-q", "--no-tags", "origin", `+refs/heads/${i.base}:${baseRef}`, `+${pullRequestHeadRef(i.forge, i.pr.number)}:${headRef}`]);
73
+ if (fetched.status !== 0)
74
+ return fail(`could not fetch ${i.base} and the head of ${at} (${fetched.stderr.trim() || `git exited ${fetched.status}`})`);
75
+ const now = run(["rev-parse", headRef]).stdout.trim();
76
+ if (now !== head)
77
+ return reply(`${at} moved while this comment was read (its head is now ${short(now) || "unknown"}); comment again once its checks pass`);
78
+ const baseSha = run(["rev-parse", baseRef]).stdout.trim();
79
+ if (!SHA.test(baseSha))
80
+ return fail(`could not read the commit of ${i.base}`);
81
+ let unmet;
82
+ try {
83
+ unmet = await i.requires(i.pr.number, head);
84
+ }
85
+ catch (e) {
86
+ return fail(`could not ask whether ${at} is ready (${message(e)})`);
87
+ }
88
+ if (unmet)
89
+ return reply(`${at} is not ready at ${short(head)}, so nothing is ${verb[1]}: ${unmet}. Comment again once that is fixed and its plan passes`);
90
+ let statuses;
91
+ try {
92
+ statuses = await i.statuses(head);
93
+ }
94
+ catch (e) {
95
+ return fail(`could not read the statuses of ${short(head)} (${message(e)})`);
96
+ }
97
+ const unplanned = i.jobs.plan.filter((c) => statuses.find((s) => s.context === c)?.state !== "success");
98
+ if (unplanned.length > 0) {
99
+ return reply(`the plan of ${at} has not passed on its head ${short(head)} (${unplanned.map((c) => `\`${c}\``).join(", ")}), so nothing is ${verb[1]}; push to it or comment the plan again, then comment \`${typed}\` again`);
100
+ }
101
+ const diff = run(["diff", "--name-only", "--no-renames", `${baseSha}...${head}`]);
102
+ if (diff.status !== 0)
103
+ return fail(`could not list the files ${at} changes (${diff.stderr.trim()})`);
104
+ const touched = diff.stdout.split("\n").map((l) => l.trim()).filter((f) => f && touchesPipeline(f, i.jobs.pipelineFiles));
105
+ if (touched.length > 0) {
106
+ return reply(`${at} changes \`${touched[0]}\`, and the ${verb[0]} runs the pipeline of ${i.base}, so it is not ${verb[1]} before merge. Merge it, then comment \`${typed}\` on it to ${verb[0]} from the merge commit`);
107
+ }
108
+ let locked = [];
109
+ if (i.lock) {
110
+ let l;
111
+ try {
112
+ l = await i.lock(i.pr.number, head, baseSha, i.user);
113
+ }
114
+ catch (e) {
115
+ return fail(`could not take the locks of ${at} (${message(e)})`);
116
+ }
117
+ if (!l.ok)
118
+ return reply(l.text);
119
+ locked = l.targets;
120
+ }
121
+ const decision = { pr: i.pr.number, head, base: baseSha, ...(i.wave !== undefined ? { through: i.wave } : {}), at: (i.now ?? (() => new Date().toISOString()))(), by: i.user };
122
+ let record;
123
+ try {
124
+ record = await i.record(decision);
125
+ // A wave-<n> stops the waves after it at this head; an apply without one clears an earlier stop.
126
+ await i.stop(head, i.wave !== undefined && i.wave < i.count ? i.wave : null);
127
+ }
128
+ catch (e) {
129
+ return fail(`could not record the decision for ${short(head)}, so nothing was started (${message(e)})`);
130
+ }
131
+ let started;
132
+ try {
133
+ started = await i.start(record);
134
+ }
135
+ catch (e) {
136
+ return fail(`recorded the decision for ${short(head)}, and could not start the waves (${message(e)})`);
137
+ }
138
+ const through = i.wave !== undefined && i.wave < i.count ? ` through wave ${i.wave}` : "";
139
+ const locks = locked.length > 0 ? `, holding ${locked.map((x) => `\`${x}\``).join(", ")}` : "";
140
+ const link = started.url ? ` (${started.url})` : "";
141
+ return { kind: "ran", text: `started the waves of ${i.op}${link} on ${at}'s head ${short(head)}${through} for ${i.user}${locks}; each wave's gate decides, and the run says when the head applied`, ...(started.url ? { url: started.url } : {}) };
142
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The job after a before-merge run's last wave (#4984): `chant run wave --op
3
+ * <op> --wave <last> --merge auto|manual --forge <kind>`, at the default
4
+ * branch's commit, with every wave job's outcome file.
5
+ *
6
+ * It reads the decision the run names again (./before-merge.ts) and checks
7
+ * every wave applied: the outcomes add up to `applied` or `unchanged`, and
8
+ * the decision ran every wave. Then, with `auto`, it asks the forge whether
9
+ * the pull request is still approved at the decided head, merges it only
10
+ * at that head (`mergeAfterApply`, ../pr-merge.ts: open, head unmoved),
11
+ * releases the change's locks and replies. With `manual` it replies that
12
+ * the head applied, and the locks hold until the pull request merges or
13
+ * closes, when the unlock job releases them. A refusal is posted on the
14
+ * pull request and the job exits `waiting` (3), so the run shows it.
15
+ *
16
+ * A run whose `rest` wave started a follow-on run for the next wave the
17
+ * plan found (#4992, ./op-waves-follow-on.ts) is not the last: the job says
18
+ * so and does nothing more, and the follow-on's done job merges.
19
+ */
20
+ import type { CiProductWords } from "../ci-product-words.js";
21
+ import type { ApplyOutcomeSummary } from "../control/applied.js";
22
+ import type { PrForge } from "../pr-forge.js";
23
+ import { type BeforeMergeRecord, type BeforeMergeRun } from "./before-merge.js";
24
+ /** What {@link beforeMergeDone} takes. */
25
+ export interface BeforeMergeDoneInput {
26
+ op: string;
27
+ /** How many waves the spec has. */
28
+ waves: number;
29
+ run: BeforeMergeRun;
30
+ record: BeforeMergeRecord | undefined;
31
+ /** The waves' outcome, from every job's outcome file. */
32
+ outcome: ApplyOutcomeSummary;
33
+ /** The rest wave of this run started a follow-on run for wave `next` (#4992): that run merges, so this one does nothing more. */
34
+ followOn?: {
35
+ wave: number;
36
+ next: number;
37
+ found: number;
38
+ };
39
+ merge: "auto" | "manual";
40
+ /** The job's client: it replies and reads the approval. */
41
+ forge: Pick<PrForge, "kind" | "addComment"> & Partial<Pick<PrForge, "prApproved">>;
42
+ /** The client holding the merge token (`auto`); default `forge`. */
43
+ merger?: Pick<PrForge, "kind" | "mergePullRequest" | "pullRequestHead" | "upsertComment">;
44
+ /** Release every lock the pull request holds; the targets released. */
45
+ release(pr: number): Promise<string[]>;
46
+ words: CiProductWords;
47
+ }
48
+ /** What the job did: its exit and its line. */
49
+ export interface BeforeMergeDone {
50
+ code: number;
51
+ text: string;
52
+ merged?: boolean;
53
+ }
54
+ /** Check the run and its waves, then merge or say it is ready (#4984). Throws only when the reply cannot be posted. */
55
+ export declare function beforeMergeDone(i: BeforeMergeDoneInput): Promise<BeforeMergeDone>;
56
+ //# sourceMappingURL=before-merge-done.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"before-merge-done.d.ts","sourceRoot":"","sources":["../../src/op/before-merge-done.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAuB,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAElG,0CAA0C;AAC1C,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACtC,yDAAyD;IACzD,OAAO,EAAE,mBAAmB,CAAC;IAC7B,iIAAiI;IACjI,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC;IACzB,2DAA2D;IAC3D,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;IACnF,oEAAoE;IACpE,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,eAAe,CAAC,CAAC;IAC1F,uEAAuE;IACvE,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACvC,KAAK,EAAE,cAAc,CAAC;CACvB;AAED,+CAA+C;AAC/C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAID,uHAAuH;AACvH,wBAAsB,eAAe,CAAC,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC,CAwCvF"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * The job after a before-merge run's last wave (#4984): `chant run wave --op
3
+ * <op> --wave <last> --merge auto|manual --forge <kind>`, at the default
4
+ * branch's commit, with every wave job's outcome file.
5
+ *
6
+ * It reads the decision the run names again (./before-merge.ts) and checks
7
+ * every wave applied: the outcomes add up to `applied` or `unchanged`, and
8
+ * the decision ran every wave. Then, with `auto`, it asks the forge whether
9
+ * the pull request is still approved at the decided head, merges it only
10
+ * at that head (`mergeAfterApply`, ../pr-merge.ts: open, head unmoved),
11
+ * releases the change's locks and replies. With `manual` it replies that
12
+ * the head applied, and the locks hold until the pull request merges or
13
+ * closes, when the unlock job releases them. A refusal is posted on the
14
+ * pull request and the job exits `waiting` (3), so the run shows it.
15
+ *
16
+ * A run whose `rest` wave started a follow-on run for the next wave the
17
+ * plan found (#4992, ./op-waves-follow-on.ts) is not the last: the job says
18
+ * so and does nothing more, and the follow-on's done job merges.
19
+ */
20
+ import { CHANT_EXIT } from "../exit-codes.js";
21
+ import { mergeAfterApply } from "../pr-merge.js";
22
+ import { beforeMergeProblems } from "./before-merge.js";
23
+ const short = (sha) => sha.slice(0, 12);
24
+ /** Check the run and its waves, then merge or say it is ready (#4984). Throws only when the reply cannot be posted. */
25
+ export async function beforeMergeDone(i) {
26
+ const problems = beforeMergeProblems(i.op, i.run, i.record);
27
+ if (problems.length > 0)
28
+ return { code: CHANT_EXIT.misplaced, text: problems.join("; ") };
29
+ const r = i.record;
30
+ const at = i.forge.kind === "gitlab" ? `!${r.pr}` : `pull request ${r.pr}`;
31
+ const verb = i.words.verbs.apply;
32
+ const say = async (text, code, merged) => {
33
+ await i.forge.addComment(r.pr, `${i.words.product}: ${text}`);
34
+ return { code, text, ...(merged !== undefined ? { merged } : {}) };
35
+ };
36
+ // #4992: not the last run of the head's waves; the follow-on's done job merges and replies.
37
+ if (i.followOn) {
38
+ return { code: CHANT_EXIT.done, text: `wave ${i.followOn.wave} of ${i.followOn.found} ${verb[1]} ${at}'s head ${short(r.head)}, and a follow-on run goes on with wave ${i.followOn.next}; its done job merges, so nothing is merged here` };
39
+ }
40
+ if (r.through !== undefined && r.through < i.waves) {
41
+ return say(`${verb[1]} ${i.op} through wave ${r.through} of ${i.waves} at ${at}'s head ${short(r.head)}; the waves after it wait until the ${verb[0]} is asked for again without a wave, so nothing is merged`, CHANT_EXIT.done);
42
+ }
43
+ if (i.outcome.outcome !== "applied" && i.outcome.outcome !== "unchanged") {
44
+ return say(`the waves of ${i.op} at ${at}'s head ${short(r.head)} ended ${i.outcome.outcome}, so nothing is merged; each wave's job says why`, CHANT_EXIT.waiting);
45
+ }
46
+ if (i.merge === "manual") {
47
+ return say(`every wave of ${i.op} ${verb[1]} ${at}'s head ${short(r.head)}. Merge it when you are ready; its locks hold until it merges or closes`, CHANT_EXIT.done);
48
+ }
49
+ // The approval is read again for the head that applied: one taken back since does not merge.
50
+ if (i.forge.prApproved) {
51
+ const approval = await i.forge.prApproved(r.pr, r.head);
52
+ if (!approval.passed)
53
+ return say(`every wave of ${i.op} ${verb[1]} ${at}'s head ${short(r.head)}, and it was not merged: it is not approved at that head (${approval.reason}). Merge it by hand once it is`, CHANT_EXIT.waiting, false);
54
+ }
55
+ const merger = i.merger ?? i.forge;
56
+ const merged = await mergeAfterApply({ forge: merger, pr: r.pr, head: r.head, recorded: { pushed: true }, words: i.words });
57
+ if (!merged.merged)
58
+ return { code: CHANT_EXIT.waiting, text: `${at} was not merged: ${merged.reason ?? "the forge refused"}${merged.posted ? "; the reason is posted on it" : ""}`, merged: false };
59
+ let released = [];
60
+ let kept = "";
61
+ try {
62
+ released = await i.release(r.pr);
63
+ }
64
+ catch (e) {
65
+ kept = `; its locks could not be released (${e instanceof Error ? e.message : String(e)}), and the unlock job releases them on close`;
66
+ }
67
+ const locks = released.length > 0 ? ` and released its locks on ${released.join(", ")}` : "";
68
+ return say(`every wave of ${i.op} ${verb[1]} ${at}'s head ${short(r.head)}: merged it${merged.sha ? ` as ${short(merged.sha)}` : ""}${locks}${kept}`, CHANT_EXIT.done, true);
69
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The before-merge decisions on `chant/lifecycle` (#4984): read and written
3
+ * through the ledger's git, at `_waves/<op>.before-merge.json` from the top
4
+ * of the branch (./before-merge.ts says what a decision is). Kept apart from
5
+ * ./before-merge.ts so the generators and the guard load no git code.
6
+ */
7
+ import { type BeforeMergeDecision, type BeforeMergeRecord } from "./before-merge.js";
8
+ /** The decision of op `op` for `head`, from `chant/lifecycle` as the remote has it. Undefined when there is none. */
9
+ export declare function beforeMergeRecordAt(op: string, head: string, opts?: {
10
+ cwd?: string;
11
+ }): Promise<BeforeMergeRecord | undefined>;
12
+ /**
13
+ * Write a decision for op `op` and push `chant/lifecycle`: the record the
14
+ * run's guard reads. Read, written and pushed again when another writer
15
+ * pushed first, up to three times. Returns the record, digest included.
16
+ */
17
+ export declare function recordBeforeMerge(op: string, decision: BeforeMergeDecision, opts?: {
18
+ cwd?: string;
19
+ }): Promise<BeforeMergeRecord>;
20
+ //# sourceMappingURL=before-merge-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"before-merge-store.d.ts","sourceRoot":"","sources":["../../src/op/before-merge-store.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAoH,KAAK,mBAAmB,EAAwB,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAE1N,qHAAqH;AACrH,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAOvI;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,EAAE,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAkB1I"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The before-merge decisions on `chant/lifecycle` (#4984): read and written
3
+ * through the ledger's git, at `_waves/<op>.before-merge.json` from the top
4
+ * of the branch (./before-merge.ts says what a decision is). Kept apart from
5
+ * ./before-merge.ts so the generators and the guard load no git code.
6
+ */
7
+ import { fetchLifecycleStatus, pushLifecycleStatus, readBlobBySha, readPathSha, writeBlobToPath } from "../lifecycle/git.js";
8
+ import { BEFORE_MERGE_DIR, beforeMergeDigest, beforeMergeFile, beforeMergeKeyProblem, parseBeforeMerge, renderBeforeMerge } from "./before-merge.js";
9
+ /** The decision of op `op` for `head`, from `chant/lifecycle` as the remote has it. Undefined when there is none. */
10
+ export async function beforeMergeRecordAt(op, head, opts = {}) {
11
+ if (beforeMergeKeyProblem(op, head))
12
+ return undefined;
13
+ const fetched = await fetchLifecycleStatus(opts);
14
+ if (fetched.status === "unreachable")
15
+ throw new Error("chant/lifecycle could not be fetched, so the decision cannot be read");
16
+ const blob = await readPathSha(BEFORE_MERGE_DIR, beforeMergeFile(op), { ...opts, ledgerPrefix: "" });
17
+ if (!blob)
18
+ return undefined;
19
+ return parseBeforeMerge(await readBlobBySha(blob, opts)).heads[head];
20
+ }
21
+ /**
22
+ * Write a decision for op `op` and push `chant/lifecycle`: the record the
23
+ * run's guard reads. Read, written and pushed again when another writer
24
+ * pushed first, up to three times. Returns the record, digest included.
25
+ */
26
+ export async function recordBeforeMerge(op, decision, opts = {}) {
27
+ const problem = beforeMergeKeyProblem(op, decision.head) ?? beforeMergeKeyProblem(op, decision.base);
28
+ if (problem)
29
+ throw new Error(problem);
30
+ const record = { ...decision, digest: beforeMergeDigest(op, decision) };
31
+ const where = { ...opts, ledgerPrefix: "" };
32
+ for (let attempt = 1; attempt <= 3; attempt++) {
33
+ const fetched = await fetchLifecycleStatus(opts);
34
+ if (fetched.status === "unreachable")
35
+ throw new Error("chant/lifecycle could not be fetched, so the decision was not written");
36
+ const blob = await readPathSha(BEFORE_MERGE_DIR, beforeMergeFile(op), where);
37
+ const file = parseBeforeMerge(blob ? await readBlobBySha(blob, opts) : null);
38
+ const next = { version: 1, heads: { ...file.heads, [decision.head]: record } };
39
+ await writeBlobToPath(BEFORE_MERGE_DIR, beforeMergeFile(op), renderBeforeMerge(next), `Decide ${op} before merge: pull request ${decision.pr} at ${decision.head.slice(0, 12)}`, { ...where, expectPriorPathSha: blob });
40
+ const pushed = await pushLifecycleStatus(opts);
41
+ if (pushed.status === "stale")
42
+ continue;
43
+ if (pushed.status === "failed")
44
+ throw new Error(`could not push the decision to chant/lifecycle (${pushed.stderr.trim()})`);
45
+ return record;
46
+ }
47
+ throw new Error("chant/lifecycle kept moving, so the decision was not written; comment again");
48
+ }
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Op waves before merge (#4984): the record that lets an open pull
3
+ * request's head run the waves.
4
+ *
5
+ * Maintainer decision (2026-11-10): waves before merge. The Op waves
6
+ * workflow gets a before-merge mode. The comment job (GitHub, Forgejo) or
7
+ * the note poll (GitLab) decides `/<product> apply` on an open pull
8
+ * request (./before-merge-decide.ts), writes the decided head here, and
9
+ * starts the waves workflow on the default branch for that head. Each wave
10
+ * job's guard (../ci-job-guard.ts) admits the run only when the head, the
11
+ * pull request and the digest it was started with are the ones recorded
12
+ * here. Per-wave runners, cloud identities and evidence stay as they are.
13
+ *
14
+ * The record is `_waves/<op>.before-merge.json` on `chant/lifecycle`, at the
15
+ * top of the branch whatever the member, so the guard reads it at one path.
16
+ * It keeps one decision per head, the newest {@link BEFORE_MERGE_KEPT}.
17
+ * Each decision's digest is sha256 over its fields in a fixed order
18
+ * ({@link beforeMergeDigest}); the run carries it, and the guard computes
19
+ * it again, so a decision edited by hand after it was made reads as no
20
+ * decision.
21
+ *
22
+ * A run carries the decision in three variables: GitHub and Forgejo map
23
+ * them from the `workflow_dispatch` inputs `pr`, `head` and `digest`; on
24
+ * GitLab they are the variables of the pipeline the poll starts.
25
+ */
26
+ /** The variable a before-merge run carries the pull request in. */
27
+ export declare const BEFORE_MERGE_PR_ENV = "CHANT_BEFORE_MERGE_PR";
28
+ /** The variable a before-merge run carries the decided head in. */
29
+ export declare const BEFORE_MERGE_HEAD_ENV = "CHANT_BEFORE_MERGE_HEAD";
30
+ /** The variable a before-merge run carries the decision's digest in. */
31
+ export declare const BEFORE_MERGE_DIGEST_ENV = "CHANT_BEFORE_MERGE_DIGEST";
32
+ /**
33
+ * The variable a wave job's command reads its base from (#4984): set by the
34
+ * step that checks out the decided head, to the default branch's commit the
35
+ * run started at, so the gate policy, holds and spec render come from the
36
+ * default branch and never from the pull request.
37
+ */
38
+ export declare const WAVES_BASE_ENV = "CHANT_WAVES_BASE";
39
+ /** The `workflow_dispatch` inputs of a waves workflow with a before-merge mode, and the variables they map to. */
40
+ export declare const BEFORE_MERGE_INPUTS: Readonly<Record<"pr" | "head" | "digest", string>>;
41
+ /** The directory of the decisions on `chant/lifecycle`, beside the wave stops. */
42
+ export declare const BEFORE_MERGE_DIR = "_waves";
43
+ /** How many heads' decisions the file keeps. */
44
+ export declare const BEFORE_MERGE_KEPT = 50;
45
+ /** The decisions file of op `op`. */
46
+ export declare function beforeMergeFile(op: string): string;
47
+ /** Its path from the top of `chant/lifecycle`, as the guard reads it. */
48
+ export declare function beforeMergePath(op: string): string;
49
+ /** One decision: the pull request, the head it decided, the default branch's commit it was measured from, the last wave, who asked and when. */
50
+ export interface BeforeMergeDecision {
51
+ pr: number;
52
+ head: string;
53
+ base: string;
54
+ /** The last wave that runs, when the comment named one (`wave-<n>`). */
55
+ through?: number;
56
+ at: string;
57
+ by: string;
58
+ }
59
+ /** A decision with its digest, as the file keeps it. */
60
+ export interface BeforeMergeRecord extends BeforeMergeDecision {
61
+ digest: string;
62
+ }
63
+ /** The decisions file. */
64
+ export interface BeforeMergeFile {
65
+ version: 1;
66
+ heads: Record<string, BeforeMergeRecord>;
67
+ }
68
+ /** What a run says it was started for. Unset or empty: a push run. */
69
+ export interface BeforeMergeRun {
70
+ pr?: string;
71
+ head?: string;
72
+ digest?: string;
73
+ }
74
+ /** The words the digest is taken over, in order. The guard's `node -e` program builds the same array. */
75
+ export declare function beforeMergeDigestInput(op: string, d: BeforeMergeDecision): string;
76
+ /** sha256 over {@link beforeMergeDigestInput}, as `sha256:<hex>`. */
77
+ export declare function beforeMergeDigest(op: string, d: BeforeMergeDecision): string;
78
+ /** Read a decisions file; anything that is not one reads as no decisions, and a malformed entry is dropped. */
79
+ export declare function parseBeforeMerge(text: string | null): BeforeMergeFile;
80
+ /** The file's text: the newest {@link BEFORE_MERGE_KEPT} decisions, by head. */
81
+ export declare function renderBeforeMerge(file: BeforeMergeFile): string;
82
+ /** The run's decision variables from the environment. */
83
+ export declare function beforeMergeRunFromEnv(env?: Record<string, string | undefined>): BeforeMergeRun;
84
+ /** Whether a run names a decision at all: any of the three variables set. */
85
+ export declare function isBeforeMergeRun(run: BeforeMergeRun): boolean;
86
+ /**
87
+ * What stops a run that names a decision, one line each: a variable that is
88
+ * not what it should be, no decision for the head, a decision for another
89
+ * pull request, another digest, or a decision whose fields no longer give
90
+ * its digest. Empty: the run is the one decided. The guard's `node -e`
91
+ * program gives the same lines.
92
+ */
93
+ export declare function beforeMergeProblems(op: string, run: BeforeMergeRun, record: BeforeMergeRecord | undefined): string[];
94
+ /**
95
+ * The before-merge mode of an Op waves pipeline (#4984),
96
+ * `OpWavesPipelineOptions.beforeMerge`.
97
+ */
98
+ export interface OpWavesBeforeMerge {
99
+ /**
100
+ * What the job after the last wave does once every wave applied the
101
+ * decided head. `auto`: it merges the pull request at that head (only
102
+ * while it is still the head, open and approved) and releases the locks
103
+ * the change holds. `manual` (the default): it replies that the head
104
+ * applied, and the locks hold until the pull request merges or closes.
105
+ */
106
+ merge?: "auto" | "manual";
107
+ /**
108
+ * The secret (GitHub, Forgejo) or CI/CD variable (GitLab) the merge takes
109
+ * its token from, with `merge: "auto"`. GitHub merges with the job's own
110
+ * token when it is absent. Forgejo refuses a merge made with the job's
111
+ * own token, and GitLab's job token cannot merge, so both need it.
112
+ */
113
+ mergeTokenSecret?: string;
114
+ /** The lock file the change's locks are in, `_locks/<gate>.json`, which `merge: "auto"` releases. Default the pull request loop's. */
115
+ gate?: string;
116
+ }
117
+ /** The job after the last wave of a before-merge run (#4984). */
118
+ export declare const BEFORE_MERGE_DONE_JOB = "before-merge-done";
119
+ /** The variable the done job hands the merge token to `--merge-token-env` in. */
120
+ export declare const BEFORE_MERGE_TOKEN_ENV = "CHANT_MERGE_TOKEN";
121
+ /** Check the mode's options for `forge`; throws with the reason. */
122
+ export declare function assertOpWavesBeforeMerge(forge: "github" | "forgejo" | "gitlab", bm: OpWavesBeforeMerge): void;
123
+ /**
124
+ * The done job's command, through the product's bin: `chant run wave --op
125
+ * <op> --wave <last wave> --merge auto|manual --forge <forge>`. It names the
126
+ * op and the wave count rather than the spec file, which a spec rendered at
127
+ * run time (#4982) leaves uncommitted.
128
+ */
129
+ export declare function beforeMergeDoneCommand(spec: {
130
+ name: string;
131
+ waves: readonly unknown[];
132
+ }, forge: "github" | "forgejo" | "gitlab", bm: OpWavesBeforeMerge, bin?: string): string;
133
+ /**
134
+ * The lines that check out the decided head (#4984), right after the
135
+ * default branch's checkout and before any of the change's code: nothing
136
+ * on a push run; else fetch the pull request's head ref, stop (exit 9,
137
+ * chant's `misplaced`) unless it is still the decided head, keep the
138
+ * default branch's commit as {@link WAVES_BASE_ENV} for the command, and
139
+ * check the head out. One shell block, so on GitLab it sits among the
140
+ * script's lines. With `checkout: false` (#4987) it fetches and checks the
141
+ * head and keeps the base, and leaves the default branch checked out: the
142
+ * gate and record jobs of a split wave read the head's commit and notes
143
+ * and run none of its code.
144
+ */
145
+ export declare function beforeMergeCheckoutScript(forge: "github" | "forgejo" | "gitlab", product: string, opts?: {
146
+ checkout?: boolean;
147
+ }): string;
148
+ /** Whether `op` names a decisions file and `sha` a commit. */
149
+ export declare function beforeMergeKeyProblem(op: string, sha: string): string | undefined;
150
+ //# sourceMappingURL=before-merge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"before-merge.d.ts","sourceRoot":"","sources":["../../src/op/before-merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,mEAAmE;AACnE,eAAO,MAAM,m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