@intentius/chant 0.124.63 → 0.124.64

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 (123) hide show
  1. package/dist/cli/handlers/approve.d.ts +8 -0
  2. package/dist/cli/handlers/approve.d.ts.map +1 -1
  3. package/dist/cli/handlers/approve.js +27 -4
  4. package/dist/cli/handlers/pr.d.ts.map +1 -1
  5. package/dist/cli/handlers/pr.js +2 -1
  6. package/dist/cli/handlers/release.d.ts +6 -4
  7. package/dist/cli/handlers/release.d.ts.map +1 -1
  8. package/dist/cli/handlers/release.js +83 -16
  9. package/dist/cli/main.d.ts.map +1 -1
  10. package/dist/cli/main.js +18 -6
  11. package/dist/cli/parse-args.d.ts.map +1 -1
  12. package/dist/cli/parse-args.js +12 -0
  13. package/dist/cli/registry.d.ts +5 -1
  14. package/dist/cli/registry.d.ts.map +1 -1
  15. package/dist/config.d.ts +18 -0
  16. package/dist/config.d.ts.map +1 -1
  17. package/dist/config.js +1 -0
  18. package/dist/gate-statement.schema.json +4 -2
  19. package/dist/lifecycle/gate-ledger.d.ts +11 -2
  20. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  21. package/dist/lifecycle/gate-ledger.js +6 -0
  22. package/dist/lifecycle/gate-seal.d.ts +20 -4
  23. package/dist/lifecycle/gate-seal.d.ts.map +1 -1
  24. package/dist/lifecycle/gate-seal.js +18 -5
  25. package/dist/lifecycle/gate-statement.d.ts +27 -2
  26. package/dist/lifecycle/gate-statement.d.ts.map +1 -1
  27. package/dist/lifecycle/gate-statement.js +37 -1
  28. package/dist/lifecycle/plan-stale.d.ts.map +1 -1
  29. package/dist/lifecycle/plan-stale.js +1 -2
  30. package/dist/lifecycle/publish-declaration.d.ts +20 -0
  31. package/dist/lifecycle/publish-declaration.d.ts.map +1 -1
  32. package/dist/lifecycle/publish-declaration.js +24 -1
  33. package/dist/lifecycle/publish-forge.d.ts.map +1 -1
  34. package/dist/lifecycle/publish-forge.js +1 -2
  35. package/dist/lifecycle/publish-git-ssh.d.ts +82 -0
  36. package/dist/lifecycle/publish-git-ssh.d.ts.map +1 -0
  37. package/dist/lifecycle/publish-git-ssh.js +180 -0
  38. package/dist/lifecycle/publish-homebrew.d.ts +11 -0
  39. package/dist/lifecycle/publish-homebrew.d.ts.map +1 -1
  40. package/dist/lifecycle/publish-homebrew.js +96 -4
  41. package/dist/lifecycle/publish-marketplace.d.ts +36 -2
  42. package/dist/lifecycle/publish-marketplace.d.ts.map +1 -1
  43. package/dist/lifecycle/publish-marketplace.js +173 -29
  44. package/dist/lifecycle/publish-tauri.d.ts.map +1 -1
  45. package/dist/lifecycle/publish-tauri.js +1 -2
  46. package/dist/lifecycle/release-cut.d.ts +51 -5
  47. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  48. package/dist/lifecycle/release-cut.js +165 -16
  49. package/dist/lifecycle/release-publish.d.ts +13 -0
  50. package/dist/lifecycle/release-publish.d.ts.map +1 -1
  51. package/dist/lifecycle/release-publish.js +5 -0
  52. package/dist/lifecycle/release-revocation.d.ts +4 -3
  53. package/dist/lifecycle/release-revocation.d.ts.map +1 -1
  54. package/dist/lifecycle/release-revocation.js +5 -4
  55. package/dist/lifecycle/release-store.d.ts +32 -0
  56. package/dist/lifecycle/release-store.d.ts.map +1 -1
  57. package/dist/lifecycle/release-store.js +11 -0
  58. package/dist/op/activities/activity-contracts.d.ts +4 -4
  59. package/dist/op/gate.d.ts +1 -1
  60. package/dist/op/gate.d.ts.map +1 -1
  61. package/dist/op/gate.js +2 -1
  62. package/dist/pr-forge.d.ts.map +1 -1
  63. package/dist/pr-forge.js +26 -6
  64. package/dist/release-floors.d.ts +1 -1
  65. package/dist/release-floors.js +1 -1
  66. package/dist/wave-runtime.mjs +284 -283
  67. package/dist/workspace/ci-green.d.ts.map +1 -1
  68. package/dist/workspace/ci-green.js +1 -2
  69. package/dist/workspace/ci-quarantine-report.d.ts.map +1 -1
  70. package/dist/workspace/ci-quarantine-report.js +1 -2
  71. package/dist/workspace/ci-quarantine.d.ts.map +1 -1
  72. package/dist/workspace/ci-quarantine.js +1 -2
  73. package/dist/workspace/intent.d.ts.map +1 -1
  74. package/dist/workspace/intent.js +1 -2
  75. package/dist/workspace/release-candidates.d.ts +9 -1
  76. package/dist/workspace/release-candidates.d.ts.map +1 -1
  77. package/dist/workspace/release-candidates.js +16 -4
  78. package/dist/workspace/release-candidates.schema.json +7 -0
  79. package/dist/workspace/releases.schema.json +47 -0
  80. package/package.json +1 -1
  81. package/src/cli/handlers/approve-external-signature.test.ts +105 -3
  82. package/src/cli/handlers/approve.ts +34 -4
  83. package/src/cli/handlers/pr.ts +2 -1
  84. package/src/cli/handlers/release.ts +75 -16
  85. package/src/cli/main.ts +18 -6
  86. package/src/cli/parse-args.ts +9 -0
  87. package/src/cli/registry.ts +5 -1
  88. package/src/config.ts +8 -0
  89. package/src/gate-statement.schema.json +4 -2
  90. package/src/lifecycle/gate-ledger.ts +17 -2
  91. package/src/lifecycle/gate-seal.ts +24 -6
  92. package/src/lifecycle/gate-statement.ts +40 -3
  93. package/src/lifecycle/plan-stale.test.ts +3 -4
  94. package/src/lifecycle/plan-stale.ts +1 -2
  95. package/src/lifecycle/publish-declaration.ts +24 -1
  96. package/src/lifecycle/publish-forge.ts +1 -2
  97. package/src/lifecycle/publish-git-ssh.ts +202 -0
  98. package/src/lifecycle/publish-homebrew.test.ts +181 -2
  99. package/src/lifecycle/publish-homebrew.ts +101 -5
  100. package/src/lifecycle/publish-marketplace.test.ts +158 -6
  101. package/src/lifecycle/publish-marketplace.ts +192 -30
  102. package/src/lifecycle/publish-resume.test.ts +40 -0
  103. package/src/lifecycle/publish-tauri.ts +1 -2
  104. package/src/lifecycle/release-cut-lane.test.ts +177 -0
  105. package/src/lifecycle/release-cut-override.test.ts +213 -0
  106. package/src/lifecycle/release-cut.ts +198 -17
  107. package/src/lifecycle/release-publish.ts +18 -0
  108. package/src/lifecycle/release-revocation.ts +5 -4
  109. package/src/lifecycle/release-store.ts +44 -0
  110. package/src/op/gate.ts +2 -1
  111. package/src/pr-forge.ts +25 -6
  112. package/src/pr-requires.test.ts +9 -0
  113. package/src/release-floors.ts +1 -1
  114. package/src/workspace/ci-green.ts +1 -2
  115. package/src/workspace/ci-quarantine-report.test.ts +2 -3
  116. package/src/workspace/ci-quarantine-report.ts +1 -2
  117. package/src/workspace/ci-quarantine.test.ts +2 -3
  118. package/src/workspace/ci-quarantine.ts +1 -2
  119. package/src/workspace/intent.ts +1 -2
  120. package/src/workspace/release-candidates.schema.json +7 -0
  121. package/src/workspace/release-candidates.ts +19 -4
  122. package/src/workspace/releases.schema.json +47 -0
  123. package/src/workspace/trust/gate-seal.test.ts +44 -0
@@ -160,6 +160,46 @@ export interface ReleaseCut {
160
160
  * image tag a publish moves in place of `latest`. Absent for `latest`.
161
161
  */
162
162
  channel?: string;
163
+ /**
164
+ * The green lane the cut checked (#4692): the commit carried
165
+ * `ci/green-<lane>/<sha>` and no `ci/revoked-<lane>/<sha>`, in place of
166
+ * `ci/green/<sha>`. Absent on a cut that checked the full green tag.
167
+ */
168
+ lane?: string;
169
+ /**
170
+ * The commit was not green, and a person's override let the cut through
171
+ * (#4693). Absent on a cut of a green commit.
172
+ */
173
+ override?: ReleaseCutOverride;
174
+ }
175
+
176
+ /**
177
+ * The override a cut of a commit that was not green ran under (#4693): an
178
+ * override on `_gates/policy-override.jsonl`, written by a person the
179
+ * overriders file at base lists, which the cut spent.
180
+ */
181
+ export interface ReleaseCutOverride {
182
+ /** Always false: the commit had no green tag that counts. */
183
+ green: false;
184
+ /** The tag it lacked, `ci/green/<sha>` or `ci/green-<lane>/<sha>`. */
185
+ tag: string;
186
+ /** Who wrote the override. */
187
+ by: string;
188
+ /** When they wrote it. */
189
+ at: string;
190
+ /** Why, in their words. */
191
+ reason: string;
192
+ /** The override digest, binding the subject, the commit and the rule. */
193
+ digest: string;
194
+ /** Whether the override was sealed, as a release gate in identity.gates requires. */
195
+ sealed: boolean;
196
+ }
197
+
198
+ /** Whether `v` reads as a {@link ReleaseCutOverride}. */
199
+ function isCutOverride(v: unknown): v is ReleaseCutOverride {
200
+ if (!v || typeof v !== "object") return false;
201
+ const o = v as Record<string, unknown>;
202
+ return o.green === false && typeof o.tag === "string" && typeof o.by === "string" && typeof o.at === "string" && typeof o.reason === "string" && typeof o.digest === "string" && typeof o.sealed === "boolean";
163
203
  }
164
204
 
165
205
  /** The parts of a release a digest is computed from. */
@@ -377,6 +417,8 @@ export function parseCuts(text: string | null): { cuts: ReleaseCut[]; malformed:
377
417
  (c.signature === null || c.signature === undefined || typeof c.signature === "string") &&
378
418
  (c.runId === null || c.runId === undefined || typeof c.runId === "string") &&
379
419
  (c.channel === undefined || typeof c.channel === "string") &&
420
+ (c.lane === undefined || typeof c.lane === "string") &&
421
+ (c.override === undefined || isCutOverride(c.override)) &&
380
422
  (c.composed === undefined || (typeof c.composed === "object" && c.composed !== null && typeof c.composed.base === "string" && Array.isArray(c.composed.sources)));
381
423
  if (!ok) {
382
424
  malformed++;
@@ -459,6 +501,8 @@ export async function appendCut(
459
501
  signature: input.signature ?? null,
460
502
  ...(input.composed ? { composed: input.composed } : {}),
461
503
  ...(input.channel ? { channel: input.channel } : {}),
504
+ ...(input.lane ? { lane: input.lane } : {}),
505
+ ...(input.override ? { override: input.override } : {}),
462
506
  };
463
507
  const content = `${existing ? `${existing.replace(/\n$/, "")}\n` : ""}${JSON.stringify(cut, sortedJsonReplacer)}\n`;
464
508
  try {
package/src/op/gate.ts CHANGED
@@ -736,7 +736,7 @@ export function approvalsAnswering(
736
736
  /**
737
737
  * The line a run writes for an approval it carries from an alias (#3949):
738
738
  * the approval under `op`/`gate` at `now`, citing the line it came from.
739
- * The approver, plan, environment, relay and seal are the original's. A
739
+ * The approver, plan, environment, relay, binding (#4697) and seal are the original's. A
740
740
  * policy decision is left behind, since it was evaluated against another
741
741
  * gate, and so is a checkpoint digest, which moves onto `carriedFrom`: the
742
742
  * approver saw that checkpoint, not one this gate stores, so a carried
@@ -757,6 +757,7 @@ export function carriedApproval(r: GateResolutionRecord, op: string, gate: strin
757
757
  ...(r.origin ? { origin: r.origin } : {}),
758
758
  ...(r.sameOriginOverride ? { sameOriginOverride: true } : {}),
759
759
  approver: approverOf(r),
760
+ ...(r.binding !== undefined ? { binding: r.binding } : {}),
760
761
  ...(r.seal ? { seal: r.seal } : {}),
761
762
  carriedFrom: {
762
763
  op: r.op,
package/src/pr-forge.ts CHANGED
@@ -303,6 +303,13 @@ export interface MergeResult {
303
303
  /** Statuses a forge answers a refused merge with: not allowed, head moved, conflict, invalid. */
304
304
  const MERGE_REFUSED = new Set([405, 406, 409, 422]);
305
305
 
306
+ /** A status to leave out of `prChecksPassed`: an exact name, or every name under an entry that ends in `/`. */
307
+ function ignoredStatus(ignore: readonly string[]): (name: string) => boolean {
308
+ const exact = new Set(ignore);
309
+ const under = ignore.filter((i) => i.endsWith("/"));
310
+ return (name) => exact.has(name) || under.some((i) => name.startsWith(i));
311
+ }
312
+
306
313
  /** A refused merge as a result, any other failure rethrown. */
307
314
  function refusedMerge(err: unknown): MergeResult {
308
315
  if (err instanceof ForgeApiError && MERGE_REFUSED.has(err.status)) {
@@ -1098,7 +1105,7 @@ function githubShaped(kind: "github" | "forgejo", opts: GithubForgeOptions): Git
1098
1105
  return base === tip ? pass(`${short(head)} contains ${into} at ${short(tip)}`) : refuse(`${short(head)} does not contain ${into} at ${short(tip)}`);
1099
1106
  },
1100
1107
  async prChecksPassed(_pr, head, ignore = []) {
1101
- const skip = new Set(ignore);
1108
+ const skip = ignoredStatus(ignore);
1102
1109
  const failing: string[] = [];
1103
1110
  const waiting: string[] = [];
1104
1111
  let count = 0;
@@ -1106,8 +1113,13 @@ function githubShaped(kind: "github" | "forgejo", opts: GithubForgeOptions): Git
1106
1113
  const combined = await api.call("GET", `${repo}/commits/${head}/status`);
1107
1114
  for (const st of isObject(combined) && Array.isArray(combined.statuses) ? combined.statuses : []) {
1108
1115
  const context = isObject(st) ? str(st.context) : undefined;
1109
- if (!context || skip.has(context)) continue;
1116
+ if (!context) continue;
1110
1117
  const state = str(st.state) ?? str(st.status) ?? "";
1118
+ // A status left out still shows the checks reported, unless it is what held them back.
1119
+ if (skip(context)) {
1120
+ if (state === "success") count++;
1121
+ continue;
1122
+ }
1111
1123
  count++;
1112
1124
  if (state === "failure" || state === "error" || state === "failed") failing.push(context);
1113
1125
  else if (state === "pending" || state === "running" || state === "") waiting.push(context);
@@ -1116,7 +1128,7 @@ function githubShaped(kind: "github" | "forgejo", opts: GithubForgeOptions): Git
1116
1128
  const runs = await api.call("GET", `${repo}/commits/${head}/check-runs?per_page=100`);
1117
1129
  for (const run of isObject(runs) && Array.isArray(runs.check_runs) ? runs.check_runs : []) {
1118
1130
  const name = (isObject(run) ? str(run.name) : undefined) ?? "a check";
1119
- if (skip.has(name) || !isObject(run)) continue;
1131
+ if (skip(name) || !isObject(run)) continue;
1120
1132
  count++;
1121
1133
  if (run.status !== "completed") waiting.push(name);
1122
1134
  else if (!["success", "neutral", "skipped"].includes(String(run.conclusion))) failing.push(name);
@@ -1541,23 +1553,30 @@ export function gitlabForge(opts: GitlabForgeOptions): PrForge {
1541
1553
  return behind === 0 ? pass(`${short(head)} contains ${into}`) : refuse(`${short(head)} is ${behind} commit${behind === 1 ? "" : "s"} behind ${into}`);
1542
1554
  },
1543
1555
  async prChecksPassed(mr, head, ignore = []) {
1544
- const skip = new Set(ignore);
1556
+ const skip = ignoredStatus(ignore);
1545
1557
  // Each name's newest status; a job allowed to fail holds nothing back.
1546
1558
  const newest = new Map<string, Record<string, unknown>>();
1547
1559
  for (const st of await api.list(`${project}/repository/commits/${head}/statuses?all=true`, pageParams, 100)) {
1548
1560
  const name = isObject(st) ? str(st.name) : undefined;
1549
- if (!name || skip.has(name) || !isObject(st)) continue;
1561
+ if (!name || !isObject(st)) continue;
1550
1562
  const had = newest.get(name);
1551
1563
  if (!had || (num(st.id) ?? 0) > (num(had.id) ?? 0)) newest.set(name, st);
1552
1564
  }
1553
1565
  const failing: string[] = [];
1554
1566
  const waiting: string[] = [];
1567
+ let count = 0;
1555
1568
  for (const [name, st] of newest) {
1556
1569
  const state = str(st.status) ?? "";
1570
+ // A status left out still shows the checks reported, unless it is what held them back.
1571
+ if (skip(name)) {
1572
+ if (state === "success") count++;
1573
+ continue;
1574
+ }
1575
+ count++;
1557
1576
  if ((state === "failed" || state === "canceled") && st.allow_failure !== true) failing.push(name);
1558
1577
  else if (GITLAB_RUNNING.has(state)) waiting.push(name);
1559
1578
  }
1560
- return checksVerdict(`merge request !${mr}`, head, failing, waiting, newest.size);
1579
+ return checksVerdict(`merge request !${mr}`, head, failing, waiting, count);
1561
1580
  },
1562
1581
  async pullRequestOpen(mr) {
1563
1582
  try {
@@ -106,6 +106,15 @@ describe("github", () => {
106
106
  expect((await f("success", runs("failure")).prChecksPassed!(7, HEAD, ["chant/apply"])).reason).toBe("lint failed on aaaaaaaa");
107
107
  });
108
108
 
109
+ test("checks: an entry ending in / leaves out every status under it", async () => {
110
+ const f = forge({
111
+ [`GET ${repo}/commits/${HEAD}/status`]: { statuses: [{ context: "plywood/preview/shop/dev", state: "failure" }, { context: "ci/test", state: "success" }] },
112
+ [`GET ${repo}/commits/${HEAD}/check-runs`]: { check_runs: [] },
113
+ });
114
+ expect((await f.prChecksPassed!(7, HEAD, ["plywood/preview/"])).passed).toBe(true);
115
+ expect((await f.prChecksPassed!(7, HEAD, ["plywood/preview"])).passed).toBe(false);
116
+ });
117
+
109
118
  test("checks: nothing reported is pending", async () => {
110
119
  const f = forge({ [`GET ${repo}/commits/${HEAD}/status`]: { statuses: [] }, [`GET ${repo}/commits/${HEAD}/check-runs`]: { check_runs: [] } });
111
120
  expect(await f.prChecksPassed!(7, HEAD)).toMatchObject({ passed: false, pending: true });
@@ -19,4 +19,4 @@
19
19
  * this constant to the next patch (#4501). The check fails while a floor
20
20
  * still names this constant after its version shipped.
21
21
  */
22
- export const NEXT_RELEASE = "0.124.63";
22
+ export const NEXT_RELEASE = "0.124.64";
@@ -63,7 +63,6 @@ import type { OpRunRecord } from "../op/runtime";
63
63
  import { readRunLedger } from "../lifecycle/run-ledger";
64
64
  import { fetchLifecycleStatus, listFilesInDir, listLedgerTrees, pushLifecycleStatus, writeLedgerFiles } from "../lifecycle/git";
65
65
  import { ledgerRecordingOff } from "../lifecycle/no-record";
66
- import { NEXT_RELEASE } from "../release-floors";
67
66
  import { agedOut, branchRecordPath, buildRequestAnnotation, CI_BUILD_TAG_PREFIX, CI_LEDGER_REF, planBuilds, readBuildRequests, readCiBranchRecord, readCiRecords, recordOf, recordPath, requestedBuild, sameRecord, type BuildRequest, type CiBranchRecord, type CiRecord } from "./ci-builds";
68
67
  import { dispatchableWorkflows, MERGE_QUEUE_VERDICT_JOB, readWorkflowSources } from "./ci-green-workflow";
69
68
  import { signOpRunRecord, verifyOpRunStatement } from "./trust/op-run-statement";
@@ -86,7 +85,7 @@ export const CI_GREEN_LANES_FLOOR = "0.124.61";
86
85
  /** The first chant whose tick sends `ci.red`, `ci.culprit` and `ci.green` through `ci.green.notify` (#4645). */
87
86
  export const CI_TICK_NOTIFY_FLOOR = "0.124.61";
88
87
  /** The first chant whose tick sends `ci.stale` after `ci.green.notify.staleAfter` hours without a green commit (#4678). */
89
- export const CI_STALE_NOTIFY_FLOOR = NEXT_RELEASE;
88
+ export const CI_STALE_NOTIFY_FLOOR = "0.124.63";
90
89
  /** How many first-parent commits the tick reads back looking for the newest green one, for `ci.stale` (#4678). */
91
90
  export const CI_STALE_WALK = 200;
92
91
  /** The first chant that writes a merge queue's trigger and verdict job, and reads `chant ci verdict` (#4644). */
@@ -7,7 +7,6 @@ import { describe, expect, test, vi } from "vitest";
7
7
  import Ajv2020 from "ajv/dist/2020";
8
8
  import notifySchema from "../notify.schema.json" with { type: "json" };
9
9
  import { notifyHeadline, type NotifyEvent } from "../notify";
10
- import { NEXT_RELEASE } from "../release-floors";
11
10
  import { CI_QUARANTINE_NOTIFY_FLOOR, formatQuarantineReport, parseJUnit, quarantineReport } from "./ci-quarantine-report";
12
11
  import { parseDeclaration, type CiGreen } from "./declaration";
13
12
 
@@ -74,8 +73,8 @@ function greenOf(notify?: unknown): CiGreen {
74
73
  const NOTIFY = { webhook: "HOOK", key: "HOOK_KEY" };
75
74
 
76
75
  describe("ci quarantine report (#4677)", () => {
77
- test("its floor is the next release", () => {
78
- expect(CI_QUARANTINE_NOTIFY_FLOOR).toBe(NEXT_RELEASE);
76
+ test("its floor is the release it shipped in", () => {
77
+ expect(CI_QUARANTINE_NOTIFY_FLOOR).toBe("0.124.63");
79
78
  });
80
79
 
81
80
  test("reads nextest's and Playwright's JUnit, CDATA and entities included", () => {
@@ -23,13 +23,12 @@ import { resolve } from "node:path";
23
23
  import { formatError } from "../cli/format";
24
24
  import type { CommandContext } from "../cli/registry";
25
25
  import { makeNotifyEvent, sendNotify as realSendNotify, type NotifyDelivery, type NotifyEvent } from "../notify";
26
- import { NEXT_RELEASE } from "../release-floors";
27
26
  import { quarantineName } from "./ci-quarantine";
28
27
  import { locateWorkspace } from "./which-chant";
29
28
  import { readDeclaration, WorkspaceReadError, type CiGreen, type CiQuarantineEntry } from "./declaration";
30
29
 
31
30
  /** The first chant that sends `ci.quarantine-passed` (#4677). */
32
- export const CI_QUARANTINE_NOTIFY_FLOOR = NEXT_RELEASE;
31
+ export const CI_QUARANTINE_NOTIFY_FLOOR = "0.124.63";
33
32
 
34
33
  /** One `<testcase>`: its suite's name, its classname and name, and how it ended. */
35
34
  export interface JUnitCase {
@@ -9,7 +9,6 @@ import { tmpdir } from "node:os";
9
9
  import { join } from "node:path";
10
10
  import { afterAll, afterEach, describe, expect, test, vi } from "vitest";
11
11
  import { parseArgs } from "../cli/parse-args";
12
- import { NEXT_RELEASE } from "../release-floors";
13
12
  import { CI_QUARANTINE_FLOOR, PLAYWRIGHT_NOTHING, quarantineFilter, quarantineProblems, runCiQuarantine, utcToday } from "./ci-quarantine";
14
13
  import { parseDeclaration, WorkspaceReadError, type CiGreen } from "./declaration";
15
14
 
@@ -143,8 +142,8 @@ describe("chant ci quarantine (#4677)", () => {
143
142
  expect(expired.err).toMatch(/^chant\.workspace\.json:\d+:\d+: ci\.green\.quarantine: test: .* expired on /);
144
143
  });
145
144
 
146
- test("its floor is the next release", () => {
147
- expect(CI_QUARANTINE_FLOOR).toBe(NEXT_RELEASE);
145
+ test("its floor is the release it shipped in", () => {
146
+ expect(CI_QUARANTINE_FLOOR).toBe("0.124.63");
148
147
  });
149
148
 
150
149
  test("parses --phase, --runner and --only", () => {
@@ -29,12 +29,11 @@
29
29
 
30
30
  import { formatError } from "../cli/format";
31
31
  import type { CommandContext } from "../cli/registry";
32
- import { NEXT_RELEASE } from "../release-floors";
33
32
  import { locateWorkspace } from "./which-chant";
34
33
  import { quarantineDay, readDeclaration, WorkspaceReadError, type CiGreen, type CiQuarantineEntry } from "./declaration";
35
34
 
36
35
  /** The first chant that reads `ci.green.quarantine` and runs `chant ci quarantine` (#4677). */
37
- export const CI_QUARANTINE_FLOOR = NEXT_RELEASE;
36
+ export const CI_QUARANTINE_FLOOR = "0.124.63";
38
37
 
39
38
  export const QUARANTINE_RUNNERS = ["nextest", "playwright", "list"] as const;
40
39
  export type QuarantineRunner = (typeof QUARANTINE_RUNNERS)[number];
@@ -60,7 +60,6 @@
60
60
  import { execFileSync } from "node:child_process";
61
61
  import { realpathSync } from "node:fs";
62
62
  import { basename, dirname, relative, resolve, sep } from "node:path";
63
- import { NEXT_RELEASE } from "../release-floors";
64
63
  import type { PullRequestCloses } from "./forge-work";
65
64
  import { declaredRecordKinds, readDeclaration, readerVersion, resolveGroups, WORKSPACE_ERROR_CODES, WorkspaceReadError, type Declaration } from "./declaration";
66
65
  import { declaredKindFile } from "./declared-kinds";
@@ -91,7 +90,7 @@ import { idList, isDecided, WORK_WARNING_CODES, type WorkLink, type WorkWarningC
91
90
  /** The version of the `intent` document this chant writes. */
92
91
  export const INTENT_CONTRACT_VERSION = 1;
93
92
  /** The first chant whose intent graph and record walk carry a commit's `closes`, with `--forge-issues` (#4649). */
94
- export const INTENT_CLOSES_FLOOR = NEXT_RELEASE;
93
+ export const INTENT_CLOSES_FLOOR = "0.124.63";
95
94
 
96
95
  /** `$id` of the JSON Schema for the document, shipped beside this file. */
97
96
  export const INTENT_OUTPUT_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/intent/v1/intent.schema.json";
@@ -49,6 +49,13 @@
49
49
  "type": "string",
50
50
  "description": "The trunk walked: ci.green.branch, else what origin/HEAD names."
51
51
  },
52
+ "lane": {
53
+ "type": [
54
+ "string",
55
+ "null"
56
+ ],
57
+ "description": "The green lane whose tags were read (#4692), from --lane or release.lane in the member's chant.config.ts: candidates carry ci/green-<lane>/<sha> and skipped commits ci/revoked-<lane>/<sha>. Null when ci/green/<sha> was read. Added by #4692, written by chant 0.124.64 and newer."
58
+ },
52
59
  "tip": {
53
60
  "type": [
54
61
  "string",
@@ -10,7 +10,9 @@
10
10
  * latest deploy records name in `releaseDigest`, as the `releases` read
11
11
  * (./releases.ts) says.
12
12
  *
13
- * Every green commit that is not revoked is a candidate. Its `changes` are
13
+ * Every green commit that is not revoked is a candidate. With a lane (#4692),
14
+ * green and revoked are that lane's tags, `ci/green-<lane>/<sha>` and
15
+ * `ci/revoked-<lane>/<sha>`, as `release cut --lane` checks them. Its `changes` are
14
16
  * the first-parent commits after the previous candidate up to and including
15
17
  * it, so the candidates partition the walk. A revoked commit is listed under
16
18
  * `skipped`, and its changes carry on into the next candidate. Commits after
@@ -52,7 +54,9 @@ import type { ForgeWorkOptions, PullRequestCloses } from "./forge-work";
52
54
 
53
55
  export const RELEASE_CANDIDATES_CONTRACT_VERSION = 1;
54
56
  /** The first chant whose candidates carry `changes[].closes` and `groups[].issue` (#4649). */
55
- export const RELEASE_CANDIDATES_CLOSES_FLOOR = NEXT_RELEASE;
57
+ export const RELEASE_CANDIDATES_CLOSES_FLOOR = "0.124.63";
58
+ /** The first chant whose candidates document carries `lane` and reads a lane's tags (#4692). */
59
+ export const RELEASE_CANDIDATES_LANE_FLOOR = NEXT_RELEASE;
56
60
  export const RELEASE_CANDIDATES_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/release-candidates/v1/release-candidates.schema.json";
57
61
 
58
62
  /** Why the read stopped. Closed; each code is in `reason-codes.ts`. */
@@ -150,6 +154,8 @@ export type ReleaseCandidatesDocument =
150
154
  chant: string;
151
155
  member: string | null;
152
156
  branch: string;
157
+ /** The green lane whose tags were read (#4692), or null for `ci/green/<sha>`. Added within contract 1 by chant {@link RELEASE_CANDIDATES_LANE_FLOOR}. */
158
+ lane: string | null;
153
159
  /** The tip of the branch as this clone knows it. */
154
160
  tip: string | null;
155
161
  environments: CandidateEnvironment[];
@@ -171,6 +177,8 @@ export interface ReleaseCandidatesQuery {
171
177
  limit?: number;
172
178
  /** Walk this branch of `ci.green.branch` (#4325) instead of the first. */
173
179
  branch?: string;
180
+ /** Read this lane's tags (#4692), one `ci.green.lanes` declares, in place of `ci/green/` and `ci/revoked/`. */
181
+ lane?: string;
174
182
  /** Ask the forge which issues each pull request closes (#4649), with these options. Left out, the forge is not read. */
175
183
  forgeIssues?: ForgeWorkOptions;
176
184
  }
@@ -259,6 +267,13 @@ export async function releaseCandidatesDocument(query: ReleaseCandidatesQuery):
259
267
  if (query.branch !== undefined && !(green && greenBranches(green).includes(query.branch))) {
260
268
  throw new Error(`--branch ${query.branch} is not a branch ci.green judges${green ? ` (${greenBranches(green).join(", ")})` : ", and the declaration has no ci.green"}`);
261
269
  }
270
+ // #4692: an unknown lane, or one with no ci.green, stops the read with the lanes declared.
271
+ let lane: string | null = null;
272
+ if (query.lane !== undefined) {
273
+ if (!green) throw new Error(`--lane ${query.lane} names a ci.green lane, and the declaration has no ci.green`);
274
+ const { laneOf } = await import("./declaration");
275
+ lane = laneOf(green, query.lane).name;
276
+ }
262
277
  const trunk = resolveTrunk(top, query.branch ?? green?.branch ?? null);
263
278
  const tip =
264
279
  tryGit(top, ["rev-parse", "--verify", "--quiet", `refs/remotes/${trunk.remote}/${trunk.branch}^{commit}`]) ??
@@ -294,7 +309,7 @@ export async function releaseCandidatesDocument(query: ReleaseCandidatesQuery):
294
309
  environments.push({ env, running });
295
310
  }
296
311
 
297
- const empty = { ...head, member: ledger.members.length > 0 ? ledger.members.join("/") : null, branch: trunk.branch, tip, environments, since: null, candidates: [], skipped: [], pending: [] };
312
+ const empty = { ...head, member: ledger.members.length > 0 ? ledger.members.join("/") : null, branch: trunk.branch, lane, tip, environments, since: null, candidates: [], skipped: [], pending: [] };
298
313
  if (!tip) return empty;
299
314
 
300
315
  // The oldest commit any environment runs bounds the walk, when every environment runs one.
@@ -313,7 +328,7 @@ export async function releaseCandidatesDocument(query: ReleaseCandidatesQuery):
313
328
  // An environment's newest running commit on the line, by position (smaller is newer).
314
329
  const newestRun = new Map(environments.map((e) => [e.env, Math.min(...runningCommits(e).map((c) => position.get(c)!), Number.POSITIVE_INFINITY)]));
315
330
 
316
- const tags = await judgedCiTags(top, green);
331
+ const tags = await judgedCiTags(top, green, lane ?? undefined);
317
332
  const details = commitDetails(top, walk);
318
333
  const merges = new Map<string, Record<string, unknown>>();
319
334
  for (const sha of walk) {
@@ -393,6 +393,53 @@
393
393
  "channel": {
394
394
  "type": "string",
395
395
  "description": "Added by #4168 4.3, written by chant 0.124.35 and newer. The tag release publish moves in place of latest (an npm dist-tag, an image tag), from release cut --channel. Absent for latest."
396
+ },
397
+ "lane": {
398
+ "type": "string",
399
+ "description": "Added by #4692, written by chant 0.124.64 and newer. The green lane the cut checked, from release cut --lane or release.lane in chant.config.ts: the commit carried ci/green-<lane>/<sha> and no ci/revoked-<lane>/<sha>. Absent on a cut that checked ci/green/<sha>."
400
+ },
401
+ "override": {
402
+ "type": "object",
403
+ "required": [
404
+ "green",
405
+ "tag",
406
+ "by",
407
+ "at",
408
+ "reason",
409
+ "digest",
410
+ "sealed"
411
+ ],
412
+ "properties": {
413
+ "green": {
414
+ "const": false,
415
+ "description": "The commit was not green."
416
+ },
417
+ "tag": {
418
+ "type": "string",
419
+ "description": "The green tag it had none of that counts: ci/green/<sha>, or ci/green-<lane>/<sha>."
420
+ },
421
+ "by": {
422
+ "type": "string",
423
+ "description": "Who wrote the override, a person the overriders file at base lists."
424
+ },
425
+ "at": {
426
+ "type": "string",
427
+ "description": "When the override was written."
428
+ },
429
+ "reason": {
430
+ "type": "string",
431
+ "description": "Why, in the overrider's words."
432
+ },
433
+ "digest": {
434
+ "type": "string",
435
+ "description": "The override digest on _gates/policy-override.jsonl, binding the subject release-<sha12>, the commit and the rule."
436
+ },
437
+ "sealed": {
438
+ "type": "boolean",
439
+ "description": "Whether the override was sealed, as a release gate in identity.gates requires."
440
+ }
441
+ },
442
+ "description": "Added by #4693, written by chant 0.124.64 and newer. The commit was not green, and release cut --override-green cut it under a person's override, which it spent. Absent on a cut of a green commit."
396
443
  }
397
444
  }
398
445
  },
@@ -164,6 +164,50 @@ describe("seal version 2 covers the checkpoint", () => {
164
164
  });
165
165
  });
166
166
 
167
+ // #4697: seal version 3 signs a relay's binding as the last line, after any
168
+ // checkpoint, and versions 1 and 2 sign what they did.
169
+ describe("seal version 3 covers the relay's binding", () => {
170
+ test("the payload adds a binding line last, only when the approval carries one", () => {
171
+ const a = approval({ relayedBy: "bot" });
172
+ const b = approval({ relayedBy: "bot", binding: "deploy dep_42 until 2026-11-01T12:00:00Z" });
173
+ expect(gateSealVersion(b)).toBe(3);
174
+ expect(gateSealPayload(b).toString()).toBe(`${gateSealPayload(a).toString()}\nbinding deploy dep_42 until 2026-11-01T12:00:00Z`);
175
+ const c = approval({ checkpointDigest: "jcs1-sha256:cp", binding: "x" });
176
+ expect(gateSealVersion(c)).toBe(3);
177
+ expect(gateSealPayload(c).toString()).toBe("migrations\nmigrations-wave-1\n\njcs1-sha256:abc\nalice\n2026-10-11T00:00:00.000Z\ncheckpoint jcs1-sha256:cp\nbinding x");
178
+ expect(gateSealPayload({ ...c, binding: undefined }).toString()).toBe(gateSealPayload(approval({ checkpointDigest: "jcs1-sha256:cp" })).toString());
179
+ });
180
+
181
+ test("a carried approval signs the original's binding", () => {
182
+ const carried = approval({
183
+ gate: "new-name",
184
+ timestamp: "2026-10-12T00:00:00.000Z",
185
+ binding: "deploy dep_42",
186
+ carriedFrom: { op: "migrations", gate: "migrations-wave-1", timestamp: "2026-10-11T00:00:00.000Z", checkpointDigest: "jcs1-sha256:cp" },
187
+ });
188
+ expect(gateSealVersion(carried)).toBe(3);
189
+ expect(gateSealPayload(carried)).toEqual(gateSealPayload(approval({ checkpointDigest: "jcs1-sha256:cp", binding: "deploy dep_42" })));
190
+ });
191
+
192
+ test.skipIf(!hasSshKeygen)("a version 3 seal verifies, and changing, removing or adding a binding stops it", () => {
193
+ const k = key("alice-binding", ["-t", "ed25519"]);
194
+ const a = approval({ binding: "deploy dep_42 until 2026-11-01T12:00:00Z" });
195
+ const seal = { signer: "alice", key: "SHA256:x", signature: sign(k, gateSealPayload(a)), version: 3 };
196
+ const policy = policyOf(`alice ${k.pub}\n`);
197
+ expect(both(policy, { ...a, seal })).toEqual({ ours: null, keygen: true });
198
+ for (const edited of [{ binding: "deploy dep_43 until 2026-11-01T12:00:00Z" }, { binding: undefined }]) {
199
+ const res = both(policy, { ...a, ...edited, seal });
200
+ expect(res.keygen).toBe(false);
201
+ expect(res.ours).toMatch(/does not verify for alice/);
202
+ }
203
+ // A seal made before #4697, with no binding, can't take one on afterwards.
204
+ const plain = approval();
205
+ const old = { signer: "alice", key: "SHA256:x", signature: sign(k, gateSealPayload(plain)) };
206
+ expect(both(policy, { ...plain, seal: old })).toEqual({ ours: null, keygen: true });
207
+ expect(both(policy, { ...plain, binding: "deploy dep_42", seal: old }).ours).toMatch(/does not verify for alice/);
208
+ });
209
+ });
210
+
167
211
  describe("the refusals that need no signature", () => {
168
212
  const signers = (over: Partial<GateSigners> = {}): GateSigners => ({ base: "a".repeat(40), signersPath: ".chant/allowed_signers", active: true, signers: [], problems: [], ...over });
169
213