@intentius/chant 0.124.60 → 0.124.61

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 (52) hide show
  1. package/dist/cli/main.d.ts.map +1 -1
  2. package/dist/cli/main.js +16 -2
  3. package/dist/cli/parse-args.d.ts.map +1 -1
  4. package/dist/cli/parse-args.js +12 -0
  5. package/dist/cli/registry.d.ts +6 -0
  6. package/dist/cli/registry.d.ts.map +1 -1
  7. package/dist/notify.d.ts +24 -2
  8. package/dist/notify.d.ts.map +1 -1
  9. package/dist/notify.js +16 -2
  10. package/dist/notify.schema.json +17 -1
  11. package/dist/release-floors.d.ts +1 -1
  12. package/dist/release-floors.js +1 -1
  13. package/dist/wave-runtime.mjs +310 -309
  14. package/dist/workspace/ci-builds.d.ts +16 -4
  15. package/dist/workspace/ci-builds.d.ts.map +1 -1
  16. package/dist/workspace/ci-builds.js +10 -7
  17. package/dist/workspace/ci-green-cli.d.ts +12 -0
  18. package/dist/workspace/ci-green-cli.d.ts.map +1 -1
  19. package/dist/workspace/ci-green-cli.js +80 -6
  20. package/dist/workspace/ci-green-workflow.d.ts +11 -0
  21. package/dist/workspace/ci-green-workflow.d.ts.map +1 -1
  22. package/dist/workspace/ci-green-workflow.js +63 -1
  23. package/dist/workspace/ci-green.d.ts +130 -6
  24. package/dist/workspace/ci-green.d.ts.map +1 -1
  25. package/dist/workspace/ci-green.js +251 -24
  26. package/dist/workspace/declaration.d.ts +37 -0
  27. package/dist/workspace/declaration.d.ts.map +1 -1
  28. package/dist/workspace/declaration.js +29 -1
  29. package/dist/workspace/declaration.schema.json +44 -0
  30. package/dist/workspace/trust/ci-tag-statement.d.ts +1 -0
  31. package/dist/workspace/trust/ci-tag-statement.d.ts.map +1 -1
  32. package/dist/workspace/trust/ci-tag-statement.js +5 -1
  33. package/package.json +1 -1
  34. package/src/cli/main.ts +16 -2
  35. package/src/cli/parse-args.ts +9 -0
  36. package/src/cli/registry.ts +6 -0
  37. package/src/notify.schema.json +17 -1
  38. package/src/notify.ts +30 -2
  39. package/src/release-floors.ts +1 -1
  40. package/src/workspace/ci-builds.ts +16 -7
  41. package/src/workspace/ci-green-builds.test.ts +83 -1
  42. package/src/workspace/ci-green-cli.ts +80 -6
  43. package/src/workspace/ci-green-lanes.test.ts +121 -0
  44. package/src/workspace/ci-green-merge-queue.test.ts +66 -0
  45. package/src/workspace/ci-green-notify.test.ts +166 -0
  46. package/src/workspace/ci-green-signed.test.ts +20 -0
  47. package/src/workspace/ci-green-workflow.test.ts +47 -1
  48. package/src/workspace/ci-green-workflow.ts +62 -1
  49. package/src/workspace/ci-green.ts +290 -26
  50. package/src/workspace/declaration.schema.json +44 -0
  51. package/src/workspace/declaration.ts +64 -2
  52. package/src/workspace/trust/ci-tag-statement.ts +5 -2
@@ -44,6 +44,8 @@ import { type PhaseReason, type TickCommit, type Verdict } from "./ci-green.js";
44
44
  export declare const CI_BUILD_TAG_PREFIX = "ci/build/";
45
45
  /** The directory on `chant/lifecycle` holding one record per commit. */
46
46
  export declare const CI_RECORDS_DIR = "_ci";
47
+ /** The local branch the records are read from, for readers that fall back to its remote-tracking branch. */
48
+ export declare const CI_LEDGER_REF = "refs/heads/chant/lifecycle";
47
49
  /** How long a build request may wait for a runner before its phases count as unbuilt. */
48
50
  export declare const BUILD_REQUEST_TTL_MS: number;
49
51
  /** How long an `every` phase may have no run on a commit before the tick asks for one (#4216). */
@@ -99,6 +101,16 @@ export interface CiRecord {
99
101
  phases: string[];
100
102
  at: string;
101
103
  };
104
+ /**
105
+ * What the tick told people about this commit through `ci.green.notify`
106
+ * (#4645), so it tells them once: when it sent `ci.red`, the culprit it
107
+ * sent `ci.culprit` for, and the green commit whose `ci.green` answered it.
108
+ */
109
+ notified?: {
110
+ red?: string;
111
+ culprit?: string;
112
+ green?: string;
113
+ };
102
114
  }
103
115
  export interface CiRecordRun {
104
116
  name: string;
@@ -161,10 +173,10 @@ export declare function agedOut(record: CiRecord, now: Date): CiRecord;
161
173
  /** Whether two records say the same thing, the time each was written aside. */
162
174
  export declare function sameRecord(a: CiRecord | undefined, b: CiRecord): boolean;
163
175
  export declare const recordPath: (sha: string) => string;
164
- /** One commit's record, from the local `chant/lifecycle`. */
165
- export declare function readCiRecord(top: string, sha: string): CiRecord | undefined;
166
- /** Every record on the local `chant/lifecycle`, by commit. Empty when the branch or the directory is missing. */
167
- export declare function readCiRecords(top: string): Map<string, CiRecord>;
176
+ /** One commit's record, from the local `chant/lifecycle` (or `ref`, such as its remote-tracking branch). */
177
+ export declare function readCiRecord(top: string, sha: string, ref?: string): CiRecord | undefined;
178
+ /** Every record on the local `chant/lifecycle` (or `ref`), by commit. Empty when the branch or the directory is missing. */
179
+ export declare function readCiRecords(top: string, ref?: string): Map<string, CiRecord>;
168
180
  /** Every `ci/build/<sha>` tag with a record this reads, from local refs, by commit. */
169
181
  export declare function readBuildRequests(top: string): Map<string, BuildRequest>;
170
182
  /** The annotation of a request tag: a subject line, then the record. */
@@ -1 +1 @@
1
- {"version":3,"file":"ci-builds.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-builds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAmC,KAAK,WAAW,EAAqB,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAEjI,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C,wEAAwE;AACxE,eAAO,MAAM,cAAc,QAAQ,CAAC;AAGpC,yFAAyF;AACzF,eAAO,MAAM,oBAAoB,QAAgB,CAAC;AAClD,kGAAkG;AAClG,eAAO,MAAM,oBAAoB,QAAc,CAAC;AAChD,2EAA2E;AAC3E,eAAO,MAAM,YAAY,UAAY,CAA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= "_ci";
46
46
  const LEDGER_REF = "refs/heads/chant/lifecycle";
47
+ /** The local branch the records are read from, for readers that fall back to its remote-tracking branch. */
48
+ export const CI_LEDGER_REF = LEDGER_REF;
47
49
  /** How long a build request may wait for a runner before its phases count as unbuilt. */
48
50
  export const BUILD_REQUEST_TTL_MS = 6 * 3600000;
49
51
  /** How long an `every` phase may have no run on a commit before the tick asks for one (#4216). */
@@ -223,6 +225,7 @@ export function recordOf(input) {
223
225
  const missing = req?.reason === "missing" ? { phases: req.phases, at: req.at } : previous?.missing;
224
226
  const extras = {
225
227
  ...(Object.keys(retried).length > 0 ? { retried } : {}),
228
+ ...(previous?.notified ? { notified: previous.notified } : {}),
226
229
  ...(req ? { request: { tag: req.tag, reason: req.reason, phases: req.phases, at: req.at } } : {}),
227
230
  ...(missing ? { missing } : {}),
228
231
  };
@@ -288,21 +291,21 @@ function parseRecord(text) {
288
291
  return undefined;
289
292
  }
290
293
  }
291
- /** One commit's record, from the local `chant/lifecycle`. */
292
- export function readCiRecord(top, sha) {
293
- return parseRecord(tryGit(top, ["show", `${LEDGER_REF}:${recordPath(sha)}`]));
294
+ /** One commit's record, from the local `chant/lifecycle` (or `ref`, such as its remote-tracking branch). */
295
+ export function readCiRecord(top, sha, ref = LEDGER_REF) {
296
+ return parseRecord(tryGit(top, ["show", `${ref}:${recordPath(sha)}`]));
294
297
  }
295
- /** Every record on the local `chant/lifecycle`, by commit. Empty when the branch or the directory is missing. */
296
- export function readCiRecords(top) {
298
+ /** Every record on the local `chant/lifecycle` (or `ref`), by commit. Empty when the branch or the directory is missing. */
299
+ export function readCiRecords(top, ref = LEDGER_REF) {
297
300
  const out = new Map();
298
- const names = tryGit(top, ["ls-tree", "--name-only", `${LEDGER_REF}:${CI_RECORDS_DIR}`]);
301
+ const names = tryGit(top, ["ls-tree", "--name-only", `${ref}:${CI_RECORDS_DIR}`]);
299
302
  if (!names)
300
303
  return out;
301
304
  for (const name of names.split("\n")) {
302
305
  const m = /^([0-9a-f]{40,64})\.json$/.exec(name);
303
306
  if (!m)
304
307
  continue;
305
- const r = readCiRecord(top, m[1]);
308
+ const r = readCiRecord(top, m[1], ref);
306
309
  if (r)
307
310
  out.set(m[1], r);
308
311
  }
@@ -27,6 +27,18 @@ import type { CommandContext } from "../cli/registry.js";
27
27
  import { RUNNER_KEY_ENV } from "./ci-green.js";
28
28
  export { RUNNER_KEY_ENV };
29
29
  export declare function runCiLastGreen(ctx: CommandContext): Promise<number>;
30
+ /**
31
+ * `chant ci base` (#4643): prints the commit a path filter should diff
32
+ * against, or exits 1 with a message when none qualifies, so the caller can
33
+ * run everything.
34
+ */
35
+ export declare function runCiBase(ctx: CommandContext): Promise<number>;
36
+ /**
37
+ * `chant ci verdict [--commit <sha>] [--wait]` (#4644): exits 0 when every
38
+ * required phase passed on the commit (GITHUB_SHA, else HEAD), 1 when one
39
+ * failed or wasn't built, and 3 when one is still pending without --wait.
40
+ */
41
+ export declare function runCiVerdict(ctx: CommandContext): Promise<number>;
30
42
  export declare function runCiList(ctx: CommandContext): Promise<number>;
31
43
  export declare function runCiTick(ctx: CommandContext): Promise<number>;
32
44
  export declare function runCiWorkflow(ctx: CommandContext): Promise<number>;
@@ -1 +1 @@
1
- {"version":3,"file":"ci-green-cli.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-green-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAmE,cAAc,EAAE,MAAM,YAAY,CAAC;AAW7G,OAAO,EAAE,cAAc,EAAE,CAAC;AAe1B,wBAAsB,cAAc,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBzE;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBpE;AAID,wBAAsB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBpE;AAeD,wBAAsB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAiExE"}
1
+ {"version":3,"file":"ci-green-cli.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-green-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAOH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAsF,cAAc,EAAE,MAAM,YAAY,CAAC;AAWhI,OAAO,EAAE,cAAc,EAAE,CAAC;AAe1B,wBAAsB,cAAc,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAkBzE;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBpE;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BvE;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBpE;AAID,wBAAsB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBpE;AAeD,wBAAsB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAwExE"}
@@ -23,17 +23,19 @@
23
23
  * `ci-list.schema.json`. The tick and the
24
24
  * workflow print text.
25
25
  */
26
+ import { execFileSync } from "node:child_process";
26
27
  import { existsSync, readFileSync, realpathSync } from "node:fs";
28
+ import { CHANT_EXIT } from "../exit-codes.js";
27
29
  import { join, relative, resolve, sep } from "node:path";
28
30
  import { formatError } from "../cli/format.js";
29
31
  import { findWorkspaceRoot } from "../project-root.js";
30
- import { ciList, ciTick, CiGreenError, formatList, formatTick, lastGreen, RUNNER_KEY_ENV } from "./ci-green.js";
32
+ import { ciBase, ciList, ciTick, ciVerdict, CiGreenError, formatList, formatTick, lastGreen, RUNNER_KEY_ENV } from "./ci-green.js";
31
33
  import { ciForgeFromEnv } from "./ci-green-forge.js";
32
- import { ACTIONS_NAME, buildTriggerEdits, CI_GREEN_WORKFLOW_FILE, ciGreenHeader, readWorkflowSources, renderCiGreenWorkflow, workflowsHolding, writeWorkflowFile } from "./ci-green-workflow.js";
34
+ import { ACTIONS_NAME, buildTriggerEdits, CI_GREEN_WORKFLOW_FILE, ciGreenHeader, MERGE_QUEUE_VERDICT_JOB, MERGE_QUEUE_WORKFLOW_FILE, readWorkflowSources, renderCiGreenWorkflow, renderMergeQueueWorkflow, workflowsHolding, writeWorkflowFile } from "./ci-green-workflow.js";
33
35
  import { greenBranches, readDeclaration, readerVersion, WorkspaceReadError } from "./declaration.js";
34
36
  import { recordGeneratedFiles, resolveMemberContext, shellArg } from "./member-pipeline.js";
35
37
  import { gitTop, workingTree } from "./tree.js";
36
- const USAGE = "chant ci last-green [--json] [--from <rev>] [--branch <branch>] | ci list [--json] [--branch <branch>] [--limit <n>] [--since <rev>] [--forge github] [--source checks|runs] | ci tick [--dry-run] [--forge github] [--source checks|runs] [--key <runner key.pem>] | " +
38
+ const USAGE = "chant ci last-green [--json] [--lane <name>] [--from <rev>] [--branch <branch>] | ci base [--json] [--phase <name> | --lane <name>] [--from <rev>] [--branch <branch>] | ci verdict [--commit <sha>] [--wait] | ci list [--json] [--branch <branch>] [--limit <n>] [--since <rev>] [--forge github] [--source checks|runs] | ci tick [--dry-run] [--forge github] [--source checks|runs] [--key <runner key.pem>] | " +
37
39
  "ci workflow [--workflow <name>]... [--output <file>] [--chant <command>] [--install <command>] [--token-secret <NAME> | --app-id-var <VAR> --app-key-secret <NAME>] [--runner-key-secret <NAME>]";
38
40
  export { RUNNER_KEY_ENV };
39
41
  /** `--source`, checked (#4044): `checks` or `runs`, or undefined to follow `ci.green.source`. */
@@ -51,7 +53,7 @@ function warnIgnored(ignored) {
51
53
  console.error(`warning: ignored ${t.tag} (${t.status}): ${t.reason}`);
52
54
  }
53
55
  export async function runCiLastGreen(ctx) {
54
- const doc = lastGreen({ cwd: process.cwd(), ...(ctx.args.branch !== undefined ? { branch: ctx.args.branch } : {}), ...(ctx.args.migrateFrom !== undefined ? { from: ctx.args.migrateFrom } : {}) });
56
+ const doc = lastGreen({ cwd: process.cwd(), ...(ctx.args.lane !== undefined ? { lane: ctx.args.lane } : {}), ...(ctx.args.branch !== undefined ? { branch: ctx.args.branch } : {}), ...(ctx.args.migrateFrom !== undefined ? { from: ctx.args.migrateFrom } : {}) });
55
57
  if (ctx.args.json) {
56
58
  console.log(JSON.stringify(doc, null, 2));
57
59
  return "error" in doc ? 1 : 0;
@@ -62,12 +64,77 @@ export async function runCiLastGreen(ctx) {
62
64
  }
63
65
  warnIgnored(doc.ignored);
64
66
  if (!doc.commit) {
65
- console.error(`No first-parent commit of ${doc.ref} has a ci/green tag without a ci/revoked one. Fetch the tags first: git fetch origin --tags`);
67
+ const lane = ctx.args.lane !== undefined ? `-${ctx.args.lane}` : "";
68
+ console.error(`No first-parent commit of ${doc.ref} has a ci/green${lane} tag without a ci/revoked${lane} one. Fetch the tags first: git fetch origin --tags`);
66
69
  return 1;
67
70
  }
68
71
  console.log(doc.commit.sha);
69
72
  return 0;
70
73
  }
74
+ /**
75
+ * `chant ci base` (#4643): prints the commit a path filter should diff
76
+ * against, or exits 1 with a message when none qualifies, so the caller can
77
+ * run everything.
78
+ */
79
+ export async function runCiBase(ctx) {
80
+ try {
81
+ const doc = ciBase({ cwd: process.cwd(), ...(ctx.args.phase !== undefined ? { phase: ctx.args.phase } : {}), ...(ctx.args.lane !== undefined ? { lane: ctx.args.lane } : {}), ...(ctx.args.branch !== undefined ? { branch: ctx.args.branch } : {}), ...(ctx.args.migrateFrom !== undefined ? { from: ctx.args.migrateFrom } : {}) });
82
+ if (ctx.args.json) {
83
+ console.log(JSON.stringify(doc, null, 2));
84
+ return "error" in doc ? 1 : 0;
85
+ }
86
+ if ("error" in doc) {
87
+ console.error(formatError({ message: doc.error.message, hint: USAGE }));
88
+ return 1;
89
+ }
90
+ warnIgnored(doc.ignored);
91
+ if (!doc.commit) {
92
+ console.error(`No first-parent ancestor of ${doc.ref} ${doc.phase ? `built and passed phase ${doc.phase}` : "built and passed every required phase"}, and none has a ci/green tag. Fetch the tags and the records first: git fetch origin --tags chant/lifecycle`);
93
+ return 1;
94
+ }
95
+ console.log(doc.commit.sha);
96
+ return 0;
97
+ }
98
+ catch (err) {
99
+ console.error(formatError({ message: `chant ci base: ${describe(err)}`, hint: USAGE }));
100
+ return 1;
101
+ }
102
+ }
103
+ /**
104
+ * `chant ci verdict [--commit <sha>] [--wait]` (#4644): exits 0 when every
105
+ * required phase passed on the commit (GITHUB_SHA, else HEAD), 1 when one
106
+ * failed or wasn't built, and 3 when one is still pending without --wait.
107
+ */
108
+ export async function runCiVerdict(ctx) {
109
+ try {
110
+ const sha = ctx.args.commit ?? process.env.GITHUB_SHA ?? execFileSync("git", ["rev-parse", "HEAD"], { encoding: "utf-8" }).trim();
111
+ const forge = ciForgeFromEnv("github");
112
+ const { verdict } = await ciVerdict({
113
+ cwd: process.cwd(),
114
+ sha,
115
+ forge,
116
+ ...(ctx.args.ciWait ? { wait: true } : {}),
117
+ ...(ctx.args.branch !== undefined ? { branch: ctx.args.branch } : {}),
118
+ onPending: (v) => console.error(`waiting on ${v.phases.filter((p) => p.verdict === "pending").map((p) => p.phase).join(", ")}`),
119
+ });
120
+ const short = sha.slice(0, 12);
121
+ if (verdict.verdict === "pass") {
122
+ console.log(`${short}: every required phase passed (${verdict.phases.map((p) => p.phase).join(", ")})`);
123
+ return 0;
124
+ }
125
+ if (verdict.verdict === "fail") {
126
+ console.error(`${short}: phase ${verdict.failure.phase} failed in ${verdict.failure.run.name} (${verdict.failure.run.conclusion})`);
127
+ return 1;
128
+ }
129
+ const open = verdict.phases.filter((p) => p.verdict === verdict.verdict).map((p) => p.phase);
130
+ console.error(`${short}: ${verdict.verdict === "pending" ? "still waiting on" : "never built"} ${open.join(", ")}`);
131
+ return verdict.verdict === "pending" ? CHANT_EXIT.waiting : 1;
132
+ }
133
+ catch (err) {
134
+ console.error(formatError({ message: `chant ci verdict: ${describe(err)}`, hint: USAGE }));
135
+ return 1;
136
+ }
137
+ }
71
138
  export async function runCiList(ctx) {
72
139
  try {
73
140
  const limit = ctx.args.limit;
@@ -150,7 +217,8 @@ export async function runCiWorkflow(ctx) {
150
217
  const member = resolveMemberContext(cwd, found);
151
218
  const target = ctx.args.output ? resolve(realpathSync(cwd), ctx.args.output) : join(repoRoot, CI_GREEN_WORKFLOW_FILE);
152
219
  const fromRepo = relative(repoRoot, target).split(sep).join("/");
153
- const sources = readWorkflowSources(repoRoot, fromRepo);
220
+ // The merge queue's verdict (#4644) is ours too, and holds no phase.
221
+ const sources = readWorkflowSources(repoRoot, fromRepo).filter((s) => s.path !== MERGE_QUEUE_WORKFLOW_FILE);
154
222
  const scan = workflowsHolding(green, sources);
155
223
  // #4169: the triggers and concurrency of the workflows holding a phase that sets build. Refused before anything is written.
156
224
  // #4220: under a ci.workflow, composed releases' branches run the phases and tick too.
@@ -193,6 +261,12 @@ export async function runCiWorkflow(ctx) {
193
261
  if (member)
194
262
  recordGeneratedFiles(member.memberRoot, [{ path: fromRepo, command }]);
195
263
  console.log(`Wrote ${written}: ticks when ${workflows.join(", ")} complete${workflows.length === 1 ? "s" : ""} on ${greenBranches(green).join(", ")}${compose ? " or a chant/compose/ branch" : ""}, and every 15 minutes.`);
264
+ // #4644: the merge queue's verdict, beside the tick and from the same command.
265
+ if (green.mergeQueue && !member) {
266
+ const queue = renderMergeQueueWorkflow({ green, chantVersion: readerVersion(), workspaceRoot, chant: ctx.args.ciChant, install: ctx.args.ciInstall, npmLock });
267
+ const at = writeWorkflowFile(join(repoRoot, MERGE_QUEUE_WORKFLOW_FILE), ciGreenHeader(command, "root") + queue);
268
+ console.log(`Wrote ${at}: on each merge group, ${MERGE_QUEUE_VERDICT_JOB} passes when every required phase passed on the group's commit. Require ${MERGE_QUEUE_VERDICT_JOB} in the branch's ruleset.`);
269
+ }
196
270
  for (const e of edits) {
197
271
  if (!e.changed)
198
272
  continue;
@@ -48,6 +48,10 @@ import { type CiBuild, type CiGreen } from "./declaration.js";
48
48
  /** Where the workflow goes, relative to the repository root. */
49
49
  export declare const CI_GREEN_WORKFLOW_FILE = ".github/workflows/chant-ci-green.yml";
50
50
  export declare const CI_GREEN_WORKFLOW_NAME = "chant-ci-green";
51
+ /** The merge queue's verdict workflow (#4644), and the job its ruleset requires. */
52
+ export declare const MERGE_QUEUE_WORKFLOW_FILE = ".github/workflows/chant-merge-queue.yml";
53
+ export declare const MERGE_QUEUE_WORKFLOW_NAME = "chant-merge-queue";
54
+ export declare const MERGE_QUEUE_VERDICT_JOB = "chant-verdict";
51
55
  /** One workflow file as the scan reads it. */
52
56
  export interface WorkflowSource {
53
57
  /** Relative to the repository root, such as `.github/workflows/ci.yml`. */
@@ -130,6 +134,13 @@ export type PushToken = {
130
134
  export declare const ACTIONS_NAME: RegExp;
131
135
  /** The workflow's YAML, without the generated-file header. Deterministic: the same input writes the same bytes. */
132
136
  export declare function renderCiGreenWorkflow(input: WorkflowInput): string;
137
+ /**
138
+ * The merge queue's verdict workflow (#4644): on each group, `chant ci
139
+ * verdict --wait` judges the group's commit by `ci.green`'s required phases
140
+ * as the tick would, and its job, `chant-verdict`, is the one check the
141
+ * queue's ruleset requires. It reads check runs and writes nothing.
142
+ */
143
+ export declare function renderMergeQueueWorkflow(input: Omit<WorkflowInput, "workflows" | "push" | "runnerKeySecret" | "compose">): string;
133
144
  /** Whether any phase sets `build` (#4169): then the tick may re-run jobs and start workflows. */
134
145
  export declare const declaresBuild: (green: CiGreen) => boolean;
135
146
  /** Whether a required phase builds only the newest commit (#4169). */
@@ -1 +1 @@
1
- {"version":3,"file":"ci-green-workflow.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-green-workflow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AAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAe1G;AAED,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAE/E;AAED,kGAAkG;AAClG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAItE"}
@@ -56,6 +56,10 @@ import { COMPOSE_BRANCH_PREFIX } from "../lifecycle/compose-refs.js";
56
56
  /** Where the workflow goes, relative to the repository root. */
57
57
  export const CI_GREEN_WORKFLOW_FILE = ".github/workflows/chant-ci-green.yml";
58
58
  export const CI_GREEN_WORKFLOW_NAME = "chant-ci-green";
59
+ /** The merge queue's verdict workflow (#4644), and the job its ruleset requires. */
60
+ export const MERGE_QUEUE_WORKFLOW_FILE = ".github/workflows/chant-merge-queue.yml";
61
+ export const MERGE_QUEUE_WORKFLOW_NAME = "chant-merge-queue";
62
+ export const MERGE_QUEUE_VERDICT_JOB = "chant-verdict";
59
63
  const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
60
64
  const EXPRESSION = /\$\{\{[^}]*\}\}/g;
61
65
  /** The check-run names a workflow's jobs report, as patterns: `*` stands for what an expression or a matrix fills in. */
@@ -233,6 +237,50 @@ export function renderCiGreenWorkflow(input) {
233
237
  ];
234
238
  return tagComments(lines.join("\n") + "\n");
235
239
  }
240
+ /**
241
+ * The merge queue's verdict workflow (#4644): on each group, `chant ci
242
+ * verdict --wait` judges the group's commit by `ci.green`'s required phases
243
+ * as the tick would, and its job, `chant-verdict`, is the one check the
244
+ * queue's ruleset requires. It reads check runs and writes nothing.
245
+ */
246
+ export function renderMergeQueueWorkflow(input) {
247
+ const where = input.workspaceRoot === "." ? [] : [` working-directory: ${q(input.workspaceRoot)}`];
248
+ const cache = input.install && input.npmLock ? [" cache: npm", ...(input.npmLock === "package-lock.json" ? [] : [` cache-dependency-path: ${q(input.npmLock)}`])] : [];
249
+ const verdict = input.chant ? q(`${input.chant} ci verdict --wait`) : `npx --yes @intentius/chant@${input.chantVersion} ci verdict --wait`;
250
+ const lines = [
251
+ `name: ${MERGE_QUEUE_WORKFLOW_NAME}`,
252
+ "",
253
+ "# The merge queue's verdict: passes when every phase ci.green requires passed",
254
+ "# on the group's commit, judged as chant ci tick judges. Require its job,",
255
+ `# ${MERGE_QUEUE_VERDICT_JOB}, in the branch's ruleset.`,
256
+ "on:",
257
+ " merge_group:",
258
+ " types:",
259
+ " - checks_requested",
260
+ "",
261
+ "permissions:",
262
+ " contents: read",
263
+ " checks: read",
264
+ "",
265
+ "jobs:",
266
+ ` ${MERGE_QUEUE_VERDICT_JOB}:`,
267
+ " runs-on: ubuntu-latest",
268
+ " timeout-minutes: 120",
269
+ " steps:",
270
+ ` - uses: ${usesRef(ACTION_PINS.checkout6)}`,
271
+ ` - uses: ${usesRef(ACTION_PINS.setupNode6)}`,
272
+ " with:",
273
+ " node-version: \"24\"",
274
+ ...cache,
275
+ ...(input.install ? [" - name: Install what the verdict runs", ...where, ` run: ${q(input.install)}`] : []),
276
+ " - name: Wait for the required phases on the group's commit",
277
+ ...where,
278
+ " env:",
279
+ " GITHUB_TOKEN: ${{ github.token }}",
280
+ ` run: ${verdict}`,
281
+ ];
282
+ return tagComments(lines.join("\n") + "\n");
283
+ }
236
284
  /** Whether any phase sets `build` (#4169): then the tick may re-run jobs and start workflows. */
237
285
  export const declaresBuild = (green) => green.phases.some((p) => p.build !== undefined);
238
286
  /** Whether a required phase builds only the newest commit (#4169). */
@@ -299,8 +347,19 @@ export function buildTriggerEdits(green, sources, options = {}) {
299
347
  const withBranch = [...branches, ...greenBranches(green).filter((b) => !branches.includes(b))];
300
348
  push.branches = compose && !withBranch.includes(COMPOSE_BRANCHES) ? [...withBranch, COMPOSE_BRANCHES] : withBranch;
301
349
  const { push: _push, workflow_dispatch: dispatch, ...rest } = on;
350
+ // #4644: a merge queue's groups run the phases too.
351
+ if (green.mergeQueue && !("merge_group" in rest))
352
+ rest.merge_group = { types: ["checks_requested"] };
302
353
  text = writeTopLevel(text, "on", { push, workflow_dispatch: dispatch ?? {}, ...rest });
303
- text = writeTopLevel(text, "concurrency", { group: `chant-build-${tag}-\${{ github.ref }}`, "cancel-in-progress": false });
354
+ // #4643: a phase whose skipped jobs pass is one a path filter skips, and under newest the push's
355
+ // previous commit may never have been built, so the block says where such a filter gets its base.
356
+ const filtered = held.filter((p) => p.skipped === "pass").map((p) => p.name);
357
+ text = writeTopLevel(text, "concurrency", [
358
+ "concurrency:",
359
+ ...(filtered.length > 0 ? [` # A job skipped by changed paths diffs against \`chant ci base --phase ${filtered[0]}\`, not github.event.before, which a newer push may have kept from being built (#4643).`] : []),
360
+ ` group: chant-build-${tag}-\${{ github.ref }}`,
361
+ " cancel-in-progress: false",
362
+ ]);
304
363
  }
305
364
  else {
306
365
  const main = `refs/heads/${green.branch}`;
@@ -314,6 +373,9 @@ export function buildTriggerEdits(green, sources, options = {}) {
314
373
  // #4216: the tick starts the workflow by hand at a ci/build/<sha> tag when the forge ran nothing on a commit.
315
374
  if (!("workflow_dispatch" in next))
316
375
  next = { ...next, workflow_dispatch: {} };
376
+ // #4644: a merge queue's groups run the phases too.
377
+ if (green.mergeQueue && !("merge_group" in next))
378
+ next = { ...next, merge_group: { types: ["checks_requested"] } };
317
379
  if (next !== on)
318
380
  text = writeTopLevel(text, "on", next);
319
381
  // #4220: a compose branch's commits each get a verdict, so its runs are keyed by commit, as the trunk branch's are.
@@ -54,14 +54,21 @@
54
54
  */
55
55
  import { type CommitLink } from "./commit-links.js";
56
56
  import { type CiGreen, type CiPhase, type CiSource } from "./declaration.js";
57
+ import { sendNotify, type NotifyFields } from "../notify.js";
57
58
  import type { CheckRun, CiForge, OpRunRef } from "./ci-green-forge.js";
58
59
  import type { OpRunRecord } from "../op/runtime.js";
59
- import { type BuildRequest, type CiRecord } from "./ci-builds.js";
60
+ import { planBuilds, type BuildRequest, type CiRecord } from "./ci-builds.js";
60
61
  import { type CiTagFailure, type CiTagSigner } from "./trust/ci-tag-statement.js";
61
62
  /** The environment variable a tick (#4031) and `chant run` (#4044) read a runner key from, as PEM, when `--key` is not given. */
62
63
  export declare const RUNNER_KEY_ENV = "CHANT_RUNNER_KEY";
63
64
  export declare const CI_GREEN_TAG_PREFIX = "ci/green/";
64
65
  export declare const CI_REVOKED_TAG_PREFIX = "ci/revoked/";
66
+ /** The first chant that reads and writes green lanes, `ci.green.lanes` (#4662). */
67
+ export declare const CI_GREEN_LANES_FLOOR = "0.124.61";
68
+ /** The first chant whose tick sends `ci.red`, `ci.culprit` and `ci.green` through `ci.green.notify` (#4645). */
69
+ export declare const CI_TICK_NOTIFY_FLOOR = "0.124.61";
70
+ /** The first chant that writes a merge queue's trigger and verdict job, and reads `chant ci verdict` (#4644). */
71
+ export declare const CI_MERGE_QUEUE_FLOOR = "0.124.61";
65
72
  export declare const CI_LAST_GREEN_CONTRACT_VERSION = 1;
66
73
  export declare const CI_LAST_GREEN_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/ci-last-green/v1/ci-last-green.schema.json";
67
74
  /** Why `ci last-green` or `ci tick` could not start. Closed. */
@@ -79,7 +86,13 @@ export declare class CiGreenError extends Error {
79
86
  export type Verdict = "pass" | "fail" | "pending" | "unbuilt";
80
87
  /** Whether a check run's name matches a pattern: the whole name, `*` standing for any run of characters. */
81
88
  export declare function matchesCheckRun(pattern: string, name: string): boolean;
82
- /** Each check run's latest attempt, by name: the run with the largest id. */
89
+ /**
90
+ * Each check run's latest attempt, by name: the run with the largest id,
91
+ * except that a skipped or cancelled attempt never replaces a decided one
92
+ * (#4644). Under a merge queue the commit a group tested lands as it is, and
93
+ * the branch's push run on it reports the same jobs again, skipped by their
94
+ * path filters or cancelled by a newer push; the group's run still decides.
95
+ */
83
96
  export declare function latestAttempts(runs: readonly CheckRun[]): CheckRun[];
84
97
  export interface RunVerdict {
85
98
  name: string;
@@ -185,13 +198,15 @@ export interface TickPlanInput {
185
198
  now: Date;
186
199
  /** Signs each tag's record (#4031). Without it the tags carry no statement. */
187
200
  signer?: CiTagSigner;
201
+ /** A lane (#4662): its tags, `ci/green-<lane>/` and `ci/revoked-<lane>/`, with the lane in each record. `green.require` is then the lane's. */
202
+ lane?: string;
188
203
  }
189
204
  /** `window` (`90m`, `24h`, `7d`) in milliseconds. */
190
205
  export declare function windowMs(window: string): number;
191
206
  /** The annotation of a green tag: a subject line, then the record as JSON, signed when `signer` is given (#4031). */
192
- export declare function greenAnnotation(green: CiGreen, sha: string, verdict: CommitVerdict, at: Date, signer?: CiTagSigner): string;
207
+ export declare function greenAnnotation(green: CiGreen, sha: string, verdict: CommitVerdict, at: Date, signer?: CiTagSigner, lane?: string): string;
193
208
  /** The annotation of a revoked tag: the phase and the run that failed, and the time, signed when `signer` is given (#4031). */
194
- export declare function revokedAnnotation(green: CiGreen, sha: string, failure: NonNullable<CommitVerdict["failure"]>, at: Date, signer?: CiTagSigner): string;
209
+ export declare function revokedAnnotation(green: CiGreen, sha: string, failure: NonNullable<CommitVerdict["failure"]>, at: Date, signer?: CiTagSigner, lane?: string): string;
195
210
  /**
196
211
  * Decide what a tick does, without touching git: a commit with no green tag
197
212
  * whose required phases all passed gets one, and a green commit with no
@@ -239,7 +254,12 @@ export declare function unsignedHistory(top: string, signedSince: string): Set<s
239
254
  * `base`, the commit the caller reads the branch at. Throws
240
255
  * `declaration-invalid` when `signedSince` names no commit here.
241
256
  */
242
- export declare function readCiTags(top: string, green?: CiGreen | null, base?: string | null): CiTags;
257
+ /**
258
+ * The ci tags that count, by commit, and those that exist and don't. With
259
+ * `lane` (#4662), a lane's tags: `ci/green-<lane>/` and `ci/revoked-<lane>/`,
260
+ * whose signed statements must name that lane.
261
+ */
262
+ export declare function readCiTags(top: string, green?: CiGreen | null, base?: string | null, lane?: string): CiTags;
243
263
  /**
244
264
  * Whether the workspace at `cwd` requires signed runs (#4156): its
245
265
  * `ci.green.signedSince`, or null when it sets none, declares no
@@ -289,6 +309,10 @@ export interface TickRequest {
289
309
  * `ci.green.signedSince` is set the tick needs one.
290
310
  */
291
311
  runnerKey?: string;
312
+ /** The environment `ci.green.notify`'s variables are read from (#4645). Default `process.env`. */
313
+ env?: NodeJS.ProcessEnv;
314
+ /** Delivers a `ci.` event (#4645). Default notify's own `sendNotify`; tests give a fake. */
315
+ sendNotify?: typeof sendNotify;
292
316
  }
293
317
  /** One compose branch a tick walked (#4168 4.3): its composed commits within the window. */
294
318
  export interface ComposedBranchTick {
@@ -306,8 +330,22 @@ export interface TickResult {
306
330
  commits: TickCommit[];
307
331
  /** The compose branches walked (#4168 4.3), each with its composed commits judged. Their tags are in `made`. */
308
332
  composed: ComposedBranchTick[];
309
- /** The tags made and pushed, or that would be under `dryRun`. */
333
+ /** The tags made and pushed, or that would be under `dryRun`, lanes' included. */
310
334
  made: string[];
335
+ /** Each lane's commits, judged from the same runs (#4662). Absent when `ci.green` declares no lanes. */
336
+ lanes?: {
337
+ lane: string;
338
+ commits: TickCommit[];
339
+ }[];
340
+ /**
341
+ * The `ci.` events told (#4645), or that would be under `dryRun` (`sent` false). `sent` is false too when
342
+ * `ci.green.notify` names no variable that is set, or filters the event out. Absent without `ci.green.notify`.
343
+ */
344
+ notified?: {
345
+ event: string;
346
+ commit: string;
347
+ sent: boolean;
348
+ }[];
311
349
  /** The builds asked for (#4169), as `ci/build/<sha>` tags made and pushed, or that would be under `dryRun`. */
312
350
  requested: BuildRequest[];
313
351
  /** The failed runs asked to run again through the forge (#4169). */
@@ -336,6 +374,29 @@ export declare function ciTagSigner(top: string, base: string, pem: string, what
336
374
  * window, make the tags that are due and push them, never forced.
337
375
  */
338
376
  export declare function ciTick(req: TickRequest): Promise<TickResult>;
377
+ /**
378
+ * The `ci.` events a tick tells (#4645), from the records it is about to
379
+ * write: `ci.red` once for the branch's newest decided commit when it is
380
+ * red (a phase that is being retried is pending, not red, so this is red
381
+ * after the retry), `ci.culprit` once per culprit a bisect names below that
382
+ * commit, and `ci.green` when the newest decided commit is green and an
383
+ * older one in the window was told red and not yet answered. Each carries
384
+ * the record mark that keeps the next tick from telling it again.
385
+ */
386
+ export declare function tickEvents(input: {
387
+ green: CiGreen;
388
+ planned: readonly TickCommit[];
389
+ records: ReadonlyMap<string, CiRecord>;
390
+ builds: ReturnType<typeof planBuilds>;
391
+ requests: ReadonlyMap<string, BuildRequest>;
392
+ now: Date;
393
+ }): {
394
+ fields: NotifyFields;
395
+ mark: {
396
+ sha: string;
397
+ notified: NonNullable<CiRecord["notified"]>;
398
+ };
399
+ }[];
339
400
  export interface RequestBuildResult {
340
401
  request: BuildRequest;
341
402
  /** Whether a request tag for the commit was already there, in which case nothing was made. */
@@ -460,7 +521,70 @@ export declare function lastGreen(req: {
460
521
  remote?: string;
461
522
  from?: string;
462
523
  branch?: string;
524
+ lane?: string;
463
525
  }): LastGreenDocument;
526
+ /** How long `ci verdict --wait` waits between reads of the check runs. */
527
+ export declare const CI_VERDICT_INTERVAL_MS = 30000;
528
+ /**
529
+ * `chant ci verdict` (#4644): judge one commit by ci.green's required phases
530
+ * from its check runs, as the tick judges a commit, leaving out the
531
+ * verdict's own check run (`chant-verdict`). With `wait`, read again until no
532
+ * phase is pending. A merge queue's verdict job runs it on the group's commit.
533
+ */
534
+ export declare function ciVerdict(req: {
535
+ cwd: string;
536
+ sha: string;
537
+ forge: CiForge;
538
+ wait?: boolean;
539
+ branch?: string;
540
+ sleep?: (ms: number) => Promise<void>;
541
+ onPending?: (v: CommitVerdict) => void;
542
+ }): Promise<{
543
+ sha: string;
544
+ verdict: CommitVerdict;
545
+ }>;
546
+ /**
547
+ * `ci base`'s document (#4643): `ci last-green`'s, with the phase asked about
548
+ * and how the commit was found. `via` is `record` when the commit's record
549
+ * shows the phase built and passed on it, `tag` when the commit has no record
550
+ * and counts by its green tag alone.
551
+ */
552
+ export type CiBaseDocument = (Omit<Extract<LastGreenDocument, {
553
+ branch: string;
554
+ }>, "commit"> & {
555
+ phase: string | null;
556
+ /** `tag` is null for a commit whose record passed the phase asked about but which has no green tag. */
557
+ commit: {
558
+ sha: string;
559
+ tag: string | null;
560
+ tagged: string | null;
561
+ committed: string;
562
+ via: "record" | "tag";
563
+ } | null;
564
+ }) | Extract<LastGreenDocument, {
565
+ error: unknown;
566
+ }>;
567
+ /**
568
+ * `chant ci base` (#4643): the commit a path filter should diff against
569
+ * under `build: newest`. Walks the first-parent ancestors of `from` (HEAD by
570
+ * default), leaving `from` itself out, and returns the newest one where
571
+ * `phase` (or, without one, every required phase) ran on that very commit
572
+ * and passed. A superseded commit is passed over: it was never built, and
573
+ * a newer build that covers it is not the base of a commit above it. A red
574
+ * one is passed over too, so a change on top of a failure doesn't skip the
575
+ * job that failed. A commit with no record (outside the tick's window)
576
+ * counts when it has a green tag and no revoked one, as `ci last-green`
577
+ * reads them. Reads local refs only: the records on `chant/lifecycle`, or
578
+ * on `origin/chant/lifecycle` when there is no local branch, and the tags.
579
+ */
580
+ export declare function ciBase(req: {
581
+ cwd: string;
582
+ from?: string;
583
+ branch?: string;
584
+ phase?: string;
585
+ lane?: string;
586
+ remote?: string;
587
+ }): CiBaseDocument;
464
588
  export declare const CI_LIST_CONTRACT_VERSION = 1;
465
589
  export declare const CI_LIST_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/ci-list/v1/ci-list.schema.json";
466
590
  /** A commit's state from its tags: `green`, `revoked` (a revoked tag wins), or `undecided` (no ci tag). */