@intentius/chant 0.124.62 → 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 (262) hide show
  1. package/dist/cli/handlers/approve.d.ts +26 -0
  2. package/dist/cli/handlers/approve.d.ts.map +1 -1
  3. package/dist/cli/handlers/approve.js +167 -18
  4. package/dist/cli/handlers/plan.d.ts +10 -0
  5. package/dist/cli/handlers/plan.d.ts.map +1 -0
  6. package/dist/cli/handlers/plan.js +71 -0
  7. package/dist/cli/handlers/pr.d.ts.map +1 -1
  8. package/dist/cli/handlers/pr.js +2 -1
  9. package/dist/cli/handlers/release.d.ts +11 -7
  10. package/dist/cli/handlers/release.d.ts.map +1 -1
  11. package/dist/cli/handlers/release.js +93 -20
  12. package/dist/cli/main.d.ts.map +1 -1
  13. package/dist/cli/main.js +48 -7
  14. package/dist/cli/mcp/workspace-tools.d.ts.map +1 -1
  15. package/dist/cli/mcp/workspace-tools.js +2 -1
  16. package/dist/cli/parse-args.d.ts.map +1 -1
  17. package/dist/cli/parse-args.js +43 -0
  18. package/dist/cli/registry.d.ts +18 -2
  19. package/dist/cli/registry.d.ts.map +1 -1
  20. package/dist/config.d.ts +50 -0
  21. package/dist/config.d.ts.map +1 -1
  22. package/dist/config.js +1 -0
  23. package/dist/gate-decision.d.ts +1 -1
  24. package/dist/gate-decision.d.ts.map +1 -1
  25. package/dist/gate-decision.js +4 -2
  26. package/dist/gate-statement.schema.json +46 -0
  27. package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +20 -0
  28. package/dist/lifecycle/__fixtures__/publish-fakes.d.ts.map +1 -1
  29. package/dist/lifecycle/__fixtures__/publish-fakes.js +119 -3
  30. package/dist/lifecycle/gate-ledger.d.ts +28 -5
  31. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  32. package/dist/lifecycle/gate-ledger.js +6 -0
  33. package/dist/lifecycle/gate-seal.d.ts +59 -7
  34. package/dist/lifecycle/gate-seal.d.ts.map +1 -1
  35. package/dist/lifecycle/gate-seal.js +68 -15
  36. package/dist/lifecycle/gate-statement.d.ts +95 -0
  37. package/dist/lifecycle/gate-statement.d.ts.map +1 -0
  38. package/dist/lifecycle/gate-statement.js +110 -0
  39. package/dist/lifecycle/gate-webauthn.d.ts +79 -0
  40. package/dist/lifecycle/gate-webauthn.d.ts.map +1 -0
  41. package/dist/lifecycle/gate-webauthn.js +105 -0
  42. package/dist/lifecycle/git.d.ts +1 -1
  43. package/dist/lifecycle/git.d.ts.map +1 -1
  44. package/dist/lifecycle/git.js +24 -19
  45. package/dist/lifecycle/ledger-remote.d.ts +37 -0
  46. package/dist/lifecycle/ledger-remote.d.ts.map +1 -0
  47. package/dist/lifecycle/ledger-remote.js +42 -0
  48. package/dist/lifecycle/plan-stale.d.ts +76 -0
  49. package/dist/lifecycle/plan-stale.d.ts.map +1 -0
  50. package/dist/lifecycle/plan-stale.js +120 -0
  51. package/dist/lifecycle/publish-credentials.d.ts +1 -1
  52. package/dist/lifecycle/publish-credentials.d.ts.map +1 -1
  53. package/dist/lifecycle/publish-credentials.js +2 -0
  54. package/dist/lifecycle/publish-declaration.d.ts +107 -0
  55. package/dist/lifecycle/publish-declaration.d.ts.map +1 -1
  56. package/dist/lifecycle/publish-declaration.js +110 -1
  57. package/dist/lifecycle/publish-forge.d.ts +5 -1
  58. package/dist/lifecycle/publish-forge.d.ts.map +1 -1
  59. package/dist/lifecycle/publish-forge.js +13 -4
  60. package/dist/lifecycle/publish-git-ssh.d.ts +82 -0
  61. package/dist/lifecycle/publish-git-ssh.d.ts.map +1 -0
  62. package/dist/lifecycle/publish-git-ssh.js +180 -0
  63. package/dist/lifecycle/publish-github.d.ts +69 -0
  64. package/dist/lifecycle/publish-github.d.ts.map +1 -0
  65. package/dist/lifecycle/publish-github.js +153 -0
  66. package/dist/lifecycle/publish-homebrew.d.ts +77 -0
  67. package/dist/lifecycle/publish-homebrew.d.ts.map +1 -0
  68. package/dist/lifecycle/publish-homebrew.js +265 -0
  69. package/dist/lifecycle/publish-marketplace.d.ts +85 -0
  70. package/dist/lifecycle/publish-marketplace.d.ts.map +1 -0
  71. package/dist/lifecycle/publish-marketplace.js +398 -0
  72. package/dist/lifecycle/publish-targets.d.ts +6 -0
  73. package/dist/lifecycle/publish-targets.d.ts.map +1 -1
  74. package/dist/lifecycle/publish-targets.js +15 -0
  75. package/dist/lifecycle/publish-tauri.d.ts +61 -0
  76. package/dist/lifecycle/publish-tauri.d.ts.map +1 -0
  77. package/dist/lifecycle/publish-tauri.js +181 -0
  78. package/dist/lifecycle/release-cut.d.ts +51 -5
  79. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  80. package/dist/lifecycle/release-cut.js +165 -16
  81. package/dist/lifecycle/release-publish.d.ts +18 -2
  82. package/dist/lifecycle/release-publish.d.ts.map +1 -1
  83. package/dist/lifecycle/release-publish.js +5 -0
  84. package/dist/lifecycle/release-revocation.d.ts +4 -3
  85. package/dist/lifecycle/release-revocation.d.ts.map +1 -1
  86. package/dist/lifecycle/release-revocation.js +5 -4
  87. package/dist/lifecycle/release-store.d.ts +32 -0
  88. package/dist/lifecycle/release-store.d.ts.map +1 -1
  89. package/dist/lifecycle/release-store.js +11 -0
  90. package/dist/lifecycle/snapshot-store.d.ts.map +1 -1
  91. package/dist/lifecycle/snapshot-store.js +17 -9
  92. package/dist/lifecycle/test-passkey.d.ts +25 -0
  93. package/dist/lifecycle/test-passkey.d.ts.map +1 -0
  94. package/dist/lifecycle/test-passkey.js +39 -0
  95. package/dist/notify.d.ts +23 -3
  96. package/dist/notify.d.ts.map +1 -1
  97. package/dist/notify.js +8 -2
  98. package/dist/notify.schema.json +12 -3
  99. package/dist/op/gate.d.ts +1 -1
  100. package/dist/op/gate.d.ts.map +1 -1
  101. package/dist/op/gate.js +2 -1
  102. package/dist/pr-forge.d.ts +20 -0
  103. package/dist/pr-forge.d.ts.map +1 -1
  104. package/dist/pr-forge.js +87 -8
  105. package/dist/release-floors.d.ts +1 -1
  106. package/dist/release-floors.js +1 -1
  107. package/dist/wave-runtime.mjs +333 -331
  108. package/dist/workspace/ci-builds.d.ts +21 -0
  109. package/dist/workspace/ci-builds.d.ts.map +1 -1
  110. package/dist/workspace/ci-builds.js +14 -0
  111. package/dist/workspace/ci-green.d.ts +45 -2
  112. package/dist/workspace/ci-green.d.ts.map +1 -1
  113. package/dist/workspace/ci-green.js +123 -5
  114. package/dist/workspace/ci-quarantine-report.d.ts +80 -0
  115. package/dist/workspace/ci-quarantine-report.d.ts.map +1 -0
  116. package/dist/workspace/ci-quarantine-report.js +204 -0
  117. package/dist/workspace/ci-quarantine.d.ts +73 -0
  118. package/dist/workspace/ci-quarantine.d.ts.map +1 -0
  119. package/dist/workspace/ci-quarantine.js +170 -0
  120. package/dist/workspace/ci-serve.d.ts.map +1 -1
  121. package/dist/workspace/ci-serve.js +7 -4
  122. package/dist/workspace/class-data.d.ts +3 -1
  123. package/dist/workspace/class-data.d.ts.map +1 -1
  124. package/dist/workspace/class-data.js +4 -1
  125. package/dist/workspace/declaration.d.ts +45 -2
  126. package/dist/workspace/declaration.d.ts.map +1 -1
  127. package/dist/workspace/declaration.js +45 -2
  128. package/dist/workspace/declaration.schema.json +51 -3
  129. package/dist/workspace/forge-work.d.ts +76 -0
  130. package/dist/workspace/forge-work.d.ts.map +1 -0
  131. package/dist/workspace/forge-work.js +160 -0
  132. package/dist/workspace/identity-gate-rule.d.ts +3 -2
  133. package/dist/workspace/identity-gate-rule.d.ts.map +1 -1
  134. package/dist/workspace/identity-gate-rule.js +5 -7
  135. package/dist/workspace/identity.d.ts +3 -2
  136. package/dist/workspace/identity.d.ts.map +1 -1
  137. package/dist/workspace/identity.js +6 -3
  138. package/dist/workspace/intent-cli.d.ts +3 -2
  139. package/dist/workspace/intent-cli.d.ts.map +1 -1
  140. package/dist/workspace/intent-cli.js +26 -5
  141. package/dist/workspace/intent-record.d.ts +3 -0
  142. package/dist/workspace/intent-record.d.ts.map +1 -1
  143. package/dist/workspace/intent-record.schema.json +32 -0
  144. package/dist/workspace/intent.d.ts +9 -0
  145. package/dist/workspace/intent.d.ts.map +1 -1
  146. package/dist/workspace/intent.js +2 -0
  147. package/dist/workspace/intent.schema.json +32 -0
  148. package/dist/workspace/kind-readers.d.ts.map +1 -1
  149. package/dist/workspace/kind-readers.js +2 -1
  150. package/dist/workspace/kinds.d.ts +6 -1
  151. package/dist/workspace/kinds.d.ts.map +1 -1
  152. package/dist/workspace/kinds.js +8 -3
  153. package/dist/workspace/plan-stale.schema.json +286 -0
  154. package/dist/workspace/release-candidates.d.ts +42 -7
  155. package/dist/workspace/release-candidates.d.ts.map +1 -1
  156. package/dist/workspace/release-candidates.js +64 -23
  157. package/dist/workspace/release-candidates.schema.json +55 -2
  158. package/dist/workspace/releases.schema.json +47 -0
  159. package/dist/workspace/trust/policy.d.ts +10 -0
  160. package/dist/workspace/trust/policy.d.ts.map +1 -1
  161. package/dist/workspace/trust/policy.js +19 -1
  162. package/dist/workspace/trust/run-commits.d.ts.map +1 -1
  163. package/dist/workspace/trust/run-commits.js +2 -1
  164. package/dist/workspace/trust/seal.d.ts.map +1 -1
  165. package/dist/workspace/trust/seal.js +34 -3
  166. package/dist/workspace/trust/trust-files.d.ts.map +1 -1
  167. package/dist/workspace/trust/trust-files.js +6 -1
  168. package/package.json +2 -1
  169. package/src/cli/handlers/approve-external-signature.test.ts +328 -0
  170. package/src/cli/handlers/approve.ts +206 -18
  171. package/src/cli/handlers/plan.ts +74 -0
  172. package/src/cli/handlers/pr.ts +2 -1
  173. package/src/cli/handlers/release.ts +84 -20
  174. package/src/cli/main.ts +48 -7
  175. package/src/cli/mcp/workspace-tools.ts +2 -1
  176. package/src/cli/parse-args.ts +33 -0
  177. package/src/cli/registry.ts +18 -2
  178. package/src/config.ts +8 -0
  179. package/src/gate-decision-bundle.test.ts +4 -2
  180. package/src/gate-decision.ts +11 -2
  181. package/src/gate-statement.schema.json +46 -0
  182. package/src/lifecycle/__fixtures__/publish-fakes.ts +125 -5
  183. package/src/lifecycle/gate-ledger.ts +34 -5
  184. package/src/lifecycle/gate-seal.ts +86 -15
  185. package/src/lifecycle/gate-statement.ts +144 -0
  186. package/src/lifecycle/gate-webauthn.test.ts +77 -0
  187. package/src/lifecycle/gate-webauthn.ts +133 -0
  188. package/src/lifecycle/git.ts +23 -19
  189. package/src/lifecycle/ledger-remote.test.ts +183 -0
  190. package/src/lifecycle/ledger-remote.ts +46 -0
  191. package/src/lifecycle/plan-stale.test.ts +149 -0
  192. package/src/lifecycle/plan-stale.ts +172 -0
  193. package/src/lifecycle/publish-credentials.ts +2 -0
  194. package/src/lifecycle/publish-declaration.ts +116 -1
  195. package/src/lifecycle/publish-forge.ts +14 -4
  196. package/src/lifecycle/publish-git-ssh.ts +202 -0
  197. package/src/lifecycle/publish-github.ts +174 -0
  198. package/src/lifecycle/publish-homebrew.test.ts +358 -0
  199. package/src/lifecycle/publish-homebrew.ts +283 -0
  200. package/src/lifecycle/publish-marketplace.test.ts +406 -0
  201. package/src/lifecycle/publish-marketplace.ts +421 -0
  202. package/src/lifecycle/publish-resume.test.ts +40 -0
  203. package/src/lifecycle/publish-target-context.test.ts +2 -2
  204. package/src/lifecycle/publish-targets.test.ts +23 -0
  205. package/src/lifecycle/publish-targets.ts +15 -0
  206. package/src/lifecycle/publish-tauri.test.ts +163 -0
  207. package/src/lifecycle/publish-tauri.ts +198 -0
  208. package/src/lifecycle/release-cut-lane.test.ts +177 -0
  209. package/src/lifecycle/release-cut-override.test.ts +213 -0
  210. package/src/lifecycle/release-cut.ts +198 -17
  211. package/src/lifecycle/release-publish.ts +23 -3
  212. package/src/lifecycle/release-revocation.ts +5 -4
  213. package/src/lifecycle/release-store.ts +44 -0
  214. package/src/lifecycle/snapshot-store.ts +16 -9
  215. package/src/lifecycle/test-passkey.ts +55 -0
  216. package/src/notify-bundle.test.ts +3 -1
  217. package/src/notify.schema.json +12 -3
  218. package/src/notify.ts +20 -3
  219. package/src/op/gate.ts +2 -1
  220. package/src/override-gate-bundle.test.ts +2 -0
  221. package/src/pr-forge-bundle.test.ts +2 -2
  222. package/src/pr-forge.test.ts +38 -0
  223. package/src/pr-forge.ts +93 -11
  224. package/src/pr-requires.test.ts +9 -0
  225. package/src/release-floors.ts +1 -1
  226. package/src/stage-hooks-bundle.test.ts +2 -0
  227. package/src/wave-runtime-bundle.test.ts +3 -2
  228. package/src/workspace/ci-builds.ts +27 -0
  229. package/src/workspace/ci-green-stale.test.ts +193 -0
  230. package/src/workspace/ci-green.ts +137 -6
  231. package/src/workspace/ci-quarantine-report.test.ts +145 -0
  232. package/src/workspace/ci-quarantine-report.ts +234 -0
  233. package/src/workspace/ci-quarantine.test.ts +160 -0
  234. package/src/workspace/ci-quarantine.ts +188 -0
  235. package/src/workspace/ci-serve.ts +7 -4
  236. package/src/workspace/class-data.ts +5 -1
  237. package/src/workspace/declaration.schema.json +51 -3
  238. package/src/workspace/declaration.test.ts +1 -0
  239. package/src/workspace/declaration.ts +88 -5
  240. package/src/workspace/forge-work.test.ts +143 -0
  241. package/src/workspace/forge-work.ts +195 -0
  242. package/src/workspace/identity-gate-rule.ts +6 -8
  243. package/src/workspace/identity.ts +6 -3
  244. package/src/workspace/intent-cli.ts +24 -5
  245. package/src/workspace/intent-record.schema.json +32 -0
  246. package/src/workspace/intent-record.ts +3 -0
  247. package/src/workspace/intent.schema.json +32 -0
  248. package/src/workspace/intent.ts +9 -0
  249. package/src/workspace/kind-readers.ts +2 -1
  250. package/src/workspace/kinds.test.ts +13 -0
  251. package/src/workspace/kinds.ts +12 -3
  252. package/src/workspace/plan-stale.schema.json +286 -0
  253. package/src/workspace/release-candidates.schema.json +55 -2
  254. package/src/workspace/release-candidates.test.ts +77 -4
  255. package/src/workspace/release-candidates.ts +80 -23
  256. package/src/workspace/releases.schema.json +47 -0
  257. package/src/workspace/trust/gate-seal.test.ts +44 -0
  258. package/src/workspace/trust/policy.ts +24 -1
  259. package/src/workspace/trust/run-commits.ts +2 -1
  260. package/src/workspace/trust/seal.ts +35 -3
  261. package/src/workspace/trust/trust-files.test.ts +5 -0
  262. package/src/workspace/trust/trust-files.ts +15 -1
@@ -0,0 +1,163 @@
1
+ /**
2
+ * #4676: the Tauri updater target against the forge fake. The stage fills a
3
+ * draft for the rolling tag while the published rolling release stays as it
4
+ * was; the reveal swaps the draft in. Nothing reaches a network.
5
+ */
6
+
7
+ import { afterAll, describe, expect, test } from "vitest";
8
+ import { createHash } from "node:crypto";
9
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
10
+ import { tmpdir } from "node:os";
11
+ import { join } from "node:path";
12
+ import { createRedactor } from "./publish-credentials";
13
+ import { PublishDeclarationSchema } from "./publish-declaration";
14
+ import { createPublishTargets } from "./publish-targets";
15
+ import { tauriManifest } from "./publish-tauri";
16
+ import { PublishTargetError, type PublishContext } from "./release-publish";
17
+ import { makeRelease, type ReleaseArtifact } from "./release-store";
18
+ import { startFakeForge } from "./__fixtures__/publish-fakes";
19
+
20
+ const dirs: string[] = [];
21
+ afterAll(() => {
22
+ for (const d of dirs) rmSync(d, { recursive: true, force: true });
23
+ });
24
+
25
+ const CUT = { actor: "alice", label: "app-v1.4.0", timestamp: "2026-10-17T10:00:00.000Z", runId: "1", signature: null };
26
+ function context(cwd: string, over: Partial<PublishContext> & { artifacts?: ReleaseArtifact[] } = {}): PublishContext & { lines: string[] } {
27
+ const env = over.env ?? { GITHUB_TOKEN: "ghs_tokentoken" };
28
+ const redactor = createRedactor(env);
29
+ const lines: string[] = [];
30
+ const release = makeRelease({ member: null, commit: "c0ffee".padEnd(40, "0"), artifactDigests: over.artifacts ?? [], targets: [{ env: "dev", params: [], templates: [] }] });
31
+ return { release, label: "app-v1.4.0", releaseTag: "release/app-v1.4.0", cut: CUT, provenance: { oidc: false, ci: null, reason: "" }, cwd, tag: null, env, redactor, log: (l) => lines.push(redactor.redact(l)), ...over, lines };
32
+ }
33
+
34
+ async function refused(p: Promise<unknown>): Promise<PublishTargetError> {
35
+ try {
36
+ await p;
37
+ } catch (err) {
38
+ if (err instanceof PublishTargetError) return err;
39
+ throw err;
40
+ }
41
+ throw new Error("expected a PublishTargetError");
42
+ }
43
+
44
+ const API = "https://api.github.test";
45
+ const digest = (text: string) => `sha256:${createHash("sha256").update(text).digest("hex")}`;
46
+ function member(): string {
47
+ const dir = mkdtempSync(join(tmpdir(), "chant-publish-tauri-"));
48
+ dirs.push(dir);
49
+ mkdirSync(join(dir, "dist"));
50
+ const files: Record<string, string> = {
51
+ "Arugula_aarch64.app.tar.gz": "mac arm bundle",
52
+ "Arugula_aarch64.app.tar.gz.sig": "c2lnbmF0dXJlIGFybQ==\n",
53
+ "Arugula_x64.app.tar.gz": "mac intel bundle",
54
+ "Arugula_x64.app.tar.gz.sig": "c2lnbmF0dXJlIHg2NA==\n",
55
+ "Arugula_1.4.0_amd64.AppImage": "linux bundle",
56
+ "Arugula_1.4.0_amd64.AppImage.sig": "c2lnbmF0dXJlIGxpbnV4\n",
57
+ "Arugula_1.4.0_aarch64.dmg": "dmg",
58
+ };
59
+ for (const [name, text] of Object.entries(files)) writeFileSync(join(dir, "dist", name), text);
60
+ writeFileSync(join(dir, "NOTES.md"), "Faster sync.\n");
61
+ return dir;
62
+ }
63
+ const declaration = (over: Record<string, unknown> = {}) =>
64
+ PublishDeclarationSchema.parse({
65
+ type: "tauri-updater",
66
+ repo: "arugula-salad/arugula",
67
+ tag: "app-latest",
68
+ api: API,
69
+ platforms: { "darwin-aarch64": "dist/Arugula_aarch64.app.tar.gz", "darwin-x86_64": "dist/Arugula_x64.app.tar.gz", "linux-x86_64": "dist/Arugula_1.4.0_amd64.AppImage" },
70
+ assets: ["dist/Arugula_1.4.0_aarch64.dmg"],
71
+ notes: "NOTES.md",
72
+ ...over,
73
+ });
74
+ const NAMES = ["Arugula_aarch64.app.tar.gz", "Arugula_x64.app.tar.gz", "Arugula_1.4.0_amd64.AppImage", "Arugula_1.4.0_aarch64.dmg", "latest.json"];
75
+ const download = (name: string) => `https://github.com/arugula-salad/arugula/releases/download/app-latest/${name}`;
76
+
77
+ describe("tauri updater (#4676)", () => {
78
+ test("writes the v2 updater manifest from the bundles' .sig files, stages it with the bundles on a draft, and swaps the rolling release at the reveal", async () => {
79
+ const dir = member();
80
+ const old = { id: 7, tag_name: "app-latest", draft: false, target: "old".padEnd(40, "0"), assets: [{ name: "latest.json", digest: digest("old"), bytes: "old" }], name: "app-latest 1.3.0" };
81
+ const forge = startFakeForge("github", API, "arugula-salad/arugula", [old]);
82
+ const [target] = await createPublishTargets([declaration()], { fetch: forge.fetch });
83
+ const ctx = context(dir);
84
+
85
+ const manifest = {
86
+ version: "1.4.0",
87
+ notes: "Faster sync.",
88
+ pub_date: "2026-10-17T10:00:00.000Z",
89
+ platforms: {
90
+ "darwin-aarch64": { signature: "c2lnbmF0dXJlIGFybQ==", url: download("Arugula_aarch64.app.tar.gz") },
91
+ "darwin-x86_64": { signature: "c2lnbmF0dXJlIHg2NA==", url: download("Arugula_x64.app.tar.gz") },
92
+ "linux-x86_64": { signature: "c2lnbmF0dXJlIGxpbnV4", url: download("Arugula_1.4.0_amd64.AppImage") },
93
+ },
94
+ };
95
+ const text = `${JSON.stringify(manifest, null, 2)}\n`;
96
+ const plan = await target!.plan(ctx);
97
+ expect(plan.map((i) => i.name)).toEqual([...NAMES.slice(0, 4).map((n) => `dist/${n}`), "latest.json"]);
98
+ expect(plan.at(-1)).toEqual({ name: "latest.json", destination: "github arugula-salad/arugula release app-latest, asset latest.json", digest: digest(text) });
99
+ expect(forge.calls).toEqual([]);
100
+
101
+ // The second upload fails: the draft keeps the first, and the rolling release still serves the old manifest.
102
+ forge.failOnce("POST https://uploads.forge.test/repos/arugula-salad/arugula/releases/101/assets?name=Arugula_x64");
103
+ expect((await refused(target!.stage(ctx))).code).toBe("publish-tauri-failed");
104
+ const staged = await target!.stage(ctx);
105
+ expect(staged.items.map((i) => i.present ?? false)).toEqual([true, false, false, false, false]);
106
+ expect(staged.state).toEqual({ releaseId: "101" });
107
+ expect(forge.visible()).toEqual([{ tag: "app-latest", assets: ["latest.json"] }]);
108
+ const draft = forge.releases.find((r) => r.id === 101)!;
109
+ expect(draft).toMatchObject({ draft: true, name: "app-latest 1.4.0", target: ctx.release.commit });
110
+ expect(JSON.parse(draft.assets.find((a) => a.name === "latest.json")!.bytes)).toEqual(manifest);
111
+
112
+ await target!.reveal(ctx, staged);
113
+ expect(forge.visible()).toEqual([{ tag: "app-latest", assets: NAMES }]);
114
+ expect(forge.releases.some((r) => r.id === 7)).toBe(false);
115
+ expect(forge.tags.get("app-latest")).toBe(ctx.release.commit);
116
+ expect(forge.releases.find((r) => r.id === 101)!.make_latest).toBe("false");
117
+ expect(ctx.lines.join("\n")).not.toContain("ghs_tokentoken");
118
+
119
+ // Run again: the reveal finds the draft published; a stage finds every file there and stages nothing.
120
+ const n = forge.calls.length;
121
+ await target!.reveal(ctx, staged);
122
+ expect(forge.calls.slice(n).map((c) => c.method)).toEqual(["GET"]);
123
+ const again = await target!.stage(ctx);
124
+ expect(again.state).toEqual({ published: "101" });
125
+ expect(again.items.every((i) => i.present)).toBe(true);
126
+ });
127
+
128
+ test("with no rolling release yet, the reveal only publishes the draft, with the declared latest and url", async () => {
129
+ const dir = member();
130
+ const forge = startFakeForge("github", API, "arugula-salad/arugula");
131
+ const [target] = await createPublishTargets([declaration({ latest: "legacy", url: "https://dl.arugula.example/{version}/{name}", notes: undefined, assets: undefined })], { fetch: forge.fetch });
132
+ const ctx = context(dir, { cut: null });
133
+ await target!.reveal(ctx, await target!.stage(ctx));
134
+ const rel = forge.releases[0]!;
135
+ expect(rel).toMatchObject({ draft: false, make_latest: "legacy" });
136
+ const manifest = JSON.parse(rel.assets.find((a) => a.name === "latest.json")!.bytes) as Record<string, unknown>;
137
+ expect(Object.keys(manifest)).toEqual(["version", "platforms"]);
138
+ expect(manifest.platforms).toMatchObject({ "linux-x86_64": { url: "https://dl.arugula.example/1.4.0/Arugula_1.4.0_amd64.AppImage" } });
139
+ });
140
+
141
+ test("refuses a bundle that is not the release's, a missing .sig, a release with no version, a missing token, and a draft asset that differs", async () => {
142
+ const make = async (fetch = startFakeForge("github", API, "arugula-salad/arugula").fetch, over: Record<string, unknown> = {}) => (await createPublishTargets([declaration(over)], { fetch }))[0]!;
143
+ const dir = member();
144
+ const artifacts: ReleaseArtifact[] = [{ component: "app", kind: "asset", path: "dist/Arugula_x64.app.tar.gz.sig", digest: `sha256:${"0".repeat(64)}` }];
145
+ expect((await refused((await make()).plan(context(dir, { artifacts })))).code).toBe("publish-artifact-digest-mismatch");
146
+ expect((await refused((await make(undefined, { platforms: { "windows-x86_64-nsis": "dist/Arugula_1.4.0_aarch64.dmg" } })).plan(context(dir)))).code).toBe("publish-file-missing");
147
+ expect((await refused((await make()).plan(context(dir, { label: "latest" })))).code).toBe("publish-tauri-no-version");
148
+ expect((await refused((await make()).plan(context(dir, { env: {} })))).code).toBe("publish-credentials-missing");
149
+ const differs = startFakeForge("github", API, "arugula-salad/arugula", [
150
+ { id: 9, tag_name: "app-latest", draft: true, target: "x", name: "app-latest 1.4.0", assets: [{ name: "latest.json", digest: digest("other"), bytes: "other" }] },
151
+ ]);
152
+ expect((await refused((await make(differs.fetch)).stage(context(dir)))).code).toBe("publish-tauri-asset-exists");
153
+ expect(() => declaration({ platforms: { macos: "x" } })).toThrow();
154
+ expect(() => declaration({ platforms: {} })).toThrow();
155
+ });
156
+
157
+ test("the manifest's keys are in Tauri's order and its platforms sorted", () => {
158
+ const bytes = tauriManifest({ version: "1.0.0", notes: null, pubDate: "2026-01-01T00:00:00Z", platforms: { "windows-x86_64": { signature: "s", url: "u" }, "darwin-aarch64": { signature: "t", url: "v" } } });
159
+ expect(Buffer.from(bytes).toString()).toBe(
160
+ `${JSON.stringify({ version: "1.0.0", pub_date: "2026-01-01T00:00:00Z", platforms: { "darwin-aarch64": { signature: "t", url: "v" }, "windows-x86_64": { signature: "s", url: "u" } } }, null, 2)}\n`,
161
+ );
162
+ });
163
+ });
@@ -0,0 +1,198 @@
1
+ /**
2
+ * The Tauri updater target (#4676): the updater manifest a Tauri v2 app reads
3
+ * (`latest.json`), and a rolling GitHub release under a fixed tag, such as
4
+ * `app-latest`, that holds the release's bundles and that manifest. Each
5
+ * publish replaces what the rolling release held.
6
+ *
7
+ * The manifest is the updater's static JSON:
8
+ *
9
+ * ```json
10
+ * {
11
+ * "version": "1.4.0",
12
+ * "notes": "...",
13
+ * "pub_date": "2026-10-17T10:00:00.000Z",
14
+ * "platforms": {
15
+ * "darwin-aarch64": { "signature": "<the .sig file's text>", "url": "https://.../Acme_aarch64.app.tar.gz" }
16
+ * }
17
+ * }
18
+ * ```
19
+ *
20
+ * `version` is the release's label from its first digit on; `notes` is the
21
+ * text of the declared `notes` file, left out without one; `pub_date` is the
22
+ * time of the cut whose signature the publish carries, left out when none is
23
+ * known, so the manifest is the same bytes on every run. Each platform's
24
+ * `signature` is the text of the `.sig` file the Tauri build wrote beside its
25
+ * updater bundle, and `url` is the `url` pattern for that bundle, by default
26
+ * its download URL on the rolling release.
27
+ *
28
+ * GitHub can't replace a release's contents in one request, so the two steps
29
+ * (#4048) are a draft and a swap:
30
+ *
31
+ * - The stage makes a draft release for the rolling tag named
32
+ * `<tag> <version>` at the release's commit, or finds the one an earlier
33
+ * stage made, and uploads each bundle, each declared asset and the manifest
34
+ * to it. A file already on the draft with the same digest is not sent
35
+ * again; one that differs is refused (`publish-tauri-asset-exists`). The
36
+ * published rolling release is untouched, so the updater sees nothing new.
37
+ * A rolling release that already holds every file with the same digests is
38
+ * what an earlier reveal left, and the stage does nothing.
39
+ * - The reveal deletes the published rolling release, deletes the tag so it
40
+ * is made again at the release's commit, and publishes the draft with
41
+ * `make_latest` from `latest` (default `false`: a rolling release is not
42
+ * the repository's latest). Between the delete and the publish, a few
43
+ * requests apart, the rolling release's URLs answer 404, which an updater
44
+ * treats as no update.
45
+ */
46
+
47
+ import { readFileSync } from "node:fs";
48
+ import { basename } from "node:path";
49
+ import { readCredential } from "./publish-credentials";
50
+ import type { TauriUpdaterPublishDeclaration } from "./publish-declaration";
51
+ import { GitHubRepo, githubApi, type GitHubRelease } from "./publish-github";
52
+ import { fillUrl, releaseVersion } from "./publish-homebrew";
53
+ import { bytesDigest, checkReleaseDigest, memberFile, publishTargetKey } from "./publish-targets";
54
+ import { PublishTargetError, type PublishContext, type PublishDeps, type PublishFetch, type PublishItem, type PublishTarget, type StagedTarget } from "./release-publish";
55
+
56
+ /** The first chant that publishes a `tauri-updater` target (#4676). */
57
+ export const PUBLISH_TAURI_UPDATER_FLOOR = "0.124.63";
58
+
59
+ interface File {
60
+ path: string;
61
+ name: string;
62
+ bytes: Uint8Array;
63
+ digest: string;
64
+ }
65
+
66
+ /** The updater manifest's bytes: 2-space JSON with a trailing newline, keys in the order Tauri's docs show them. */
67
+ export function tauriManifest(m: { version: string; notes: string | null; pubDate: string | null; platforms: Record<string, { signature: string; url: string }> }): Uint8Array {
68
+ const platforms: Record<string, { signature: string; url: string }> = {};
69
+ for (const key of Object.keys(m.platforms).sort()) platforms[key] = { signature: m.platforms[key]!.signature, url: m.platforms[key]!.url };
70
+ const doc = { version: m.version, ...(m.notes !== null ? { notes: m.notes } : {}), ...(m.pubDate !== null ? { pub_date: m.pubDate } : {}), platforms };
71
+ return new Uint8Array(Buffer.from(`${JSON.stringify(doc, null, 2)}\n`, "utf-8"));
72
+ }
73
+
74
+ export function tauriUpdaterTarget(decl: TauriUpdaterPublishDeclaration, deps: PublishDeps): PublishTarget {
75
+ const fetchImpl: PublishFetch = deps.fetch ?? ((url, init) => fetch(url, init as RequestInit));
76
+ const tokenNames = [decl.tokenEnv ?? "GITHUB_TOKEN"];
77
+ const manifestName = decl.manifest ?? "latest.json";
78
+ const urlPattern = decl.url ?? `https://github.com/${decl.repo}/releases/download/{tag}/{name}`;
79
+
80
+ const read = (ctx: PublishContext, path: string): File => {
81
+ const bytes = new Uint8Array(readFileSync(memberFile(ctx.cwd, path)));
82
+ const digest = bytesDigest(bytes);
83
+ checkReleaseDigest(ctx.release, "asset", ctx.cwd, path, [digest]);
84
+ return { path, name: basename(path), bytes, digest };
85
+ };
86
+
87
+ const setup = (ctx: PublishContext) => {
88
+ const version = releaseVersion(ctx.label);
89
+ if (!version || !ctx.label) {
90
+ throw new PublishTargetError(
91
+ "publish-tauri-no-version",
92
+ `the updater manifest's version is the release's label from its first digit, and release ${ctx.release.releaseDigest} has ${ctx.label ? `the label ${ctx.label}, which has no digit` : "no label"}`,
93
+ "Cut the release with a label such as app-v1.4.0.",
94
+ );
95
+ }
96
+ const token = readCredential(ctx.env, tokenNames, ctx.redactor);
97
+ if (!token) {
98
+ throw new PublishTargetError("publish-credentials-missing", `the tauri-updater target reads its token from ${tokenNames[0]}, and it is not set`, `Set ${tokenNames[0]} to a token that may write releases on ${decl.repo}.`);
99
+ }
100
+ const files: File[] = [];
101
+ const platforms: Record<string, { signature: string; url: string }> = {};
102
+ for (const [platform, path] of Object.entries(decl.platforms)) {
103
+ const bundle = read(ctx, path);
104
+ const sig = read(ctx, `${path}.sig`);
105
+ const signature = Buffer.from(sig.bytes).toString("utf-8").trim();
106
+ if (!signature) throw new PublishTargetError("publish-tauri-signature-missing", `${path}.sig is empty, and the updater installs only a signed bundle`);
107
+ if (!files.some((f) => f.name === bundle.name)) files.push(bundle);
108
+ platforms[platform] = { signature, url: fillUrl(urlPattern, { tag: decl.tag, label: ctx.label, version, name: bundle.name }) };
109
+ }
110
+ for (const path of decl.assets ?? []) files.push(read(ctx, path));
111
+ const notes = decl.notes ? readFileSync(memberFile(ctx.cwd, decl.notes), "utf-8").trim() : null;
112
+ const bytes = tauriManifest({ version, notes, pubDate: ctx.cut?.timestamp ?? null, platforms });
113
+ files.push({ path: manifestName, name: manifestName, bytes, digest: bytesDigest(bytes) });
114
+ const names = new Set<string>();
115
+ for (const f of files) {
116
+ if (names.has(f.name)) throw new PublishTargetError("publish-tauri-asset-name-taken", `two files are named ${f.name}, and a release holds one asset per name`);
117
+ names.add(f.name);
118
+ }
119
+ const repo = new GitHubRepo(githubApi(decl.api, ctx.env), decl.repo, token, fetchImpl, ctx, "publish-tauri-failed");
120
+ return { version, token, files, repo, draftName: `${decl.tag} ${version}` };
121
+ };
122
+ const where = (name: string) => `github ${decl.repo} release ${decl.tag}, asset ${name}`;
123
+ const itemOf = (f: File, present = false): PublishItem => ({ name: f.path, destination: where(f.name), digest: f.digest, ...(present ? { present: true } : {}) });
124
+ const holdsAll = (rel: GitHubRelease, files: File[]) => rel.assets.size === files.length && files.every((f) => rel.assets.get(f.name) === f.digest);
125
+
126
+ const target: PublishTarget = {
127
+ kind: "tauri-updater",
128
+ name: `tauri updater ${decl.repo} ${decl.tag}`,
129
+ destination: `github ${decl.repo} release ${decl.tag}`,
130
+ credentialEnv: tokenNames,
131
+ key: publishTargetKey(decl),
132
+ async plan(ctx) {
133
+ return setup(ctx).files.map((f) => itemOf(f));
134
+ },
135
+ async stage(ctx): Promise<StagedTarget> {
136
+ const { version, token, files, repo, draftName } = setup(ctx);
137
+ ctx.log(`using the token from ${token.from}`);
138
+ const done = (items: PublishItem[], state: Record<string, string>): StagedTarget => ({ target: target.name, destination: target.destination, items, state });
139
+ const published = await repo.publishedRelease(decl.tag);
140
+ if (published && holdsAll(published, files)) {
141
+ ctx.log(`release ${decl.tag} already holds ${version}'s files`);
142
+ return done(
143
+ files.map((f) => itemOf(f, true)),
144
+ { published: published.id },
145
+ );
146
+ }
147
+ let draft = await repo.draftRelease(decl.tag, draftName);
148
+ if (draft) ctx.log(`using the draft release ${draftName}`);
149
+ else {
150
+ ctx.log(`creating a draft release ${draftName} at ${ctx.release.commit.slice(0, 12)}`);
151
+ draft = await repo.createDraft(decl.tag, ctx.release.commit, draftName);
152
+ }
153
+ const items: PublishItem[] = [];
154
+ for (const f of files) {
155
+ if (draft.assets.has(f.name)) {
156
+ const theirs = draft.assets.get(f.name);
157
+ if (theirs !== f.digest) {
158
+ throw new PublishTargetError(
159
+ "publish-tauri-asset-exists",
160
+ `the draft release ${draftName} on ${decl.repo} already has ${f.name}${theirs ? ` with digest ${theirs}, not ${f.digest}` : ", and GitHub reports no digest to compare"}`,
161
+ "Delete the draft on GitHub so the stage makes it again.",
162
+ );
163
+ }
164
+ items.push(itemOf(f, true));
165
+ continue;
166
+ }
167
+ ctx.log(`uploading ${f.name} (${f.bytes.byteLength} bytes) to the draft`);
168
+ await repo.uploadAsset(draft, f.name, f.bytes);
169
+ items.push(itemOf(f));
170
+ }
171
+ return done(items, { releaseId: draft.id });
172
+ },
173
+ async reveal(ctx, staged) {
174
+ const items = staged.items.map((i) => ({ name: i.name, destination: i.destination, ...(i.digest ? { digest: i.digest } : {}) }));
175
+ if (staged.state.published) return { target: target.name, destination: target.destination, items: items.map((i) => ({ ...i, present: true })) };
176
+ const id = staged.state.releaseId;
177
+ if (!id) throw new PublishTargetError("publish-tauri-failed", `the staged release for ${decl.tag} has no draft id to publish`);
178
+ const { repo } = setup(ctx);
179
+ const old = await repo.publishedRelease(decl.tag);
180
+ if (old?.id === id) {
181
+ ctx.log(`release ${decl.tag} is already the staged draft, published`);
182
+ return { target: target.name, destination: target.destination, items };
183
+ }
184
+ if (old) {
185
+ ctx.log(`deleting the published release ${decl.tag} (${old.id}) and its tag`);
186
+ await repo.deleteRelease(old.id);
187
+ }
188
+ // A tag that is there stays where it is when a release is published on it, so it goes, and the publish makes it at the release's commit.
189
+ await repo.deleteRef(`tags/${decl.tag}`);
190
+ const makeLatest = String(decl.latest ?? false);
191
+ ctx.log(`publishing the draft as ${decl.tag} with make_latest ${makeLatest}`);
192
+ const res = await repo.publishDraft(id, makeLatest);
193
+ if (res.status !== 200) repo.fail(`publishing the draft release ${decl.tag}`, res);
194
+ return { target: target.name, destination: target.destination, items };
195
+ },
196
+ };
197
+ return target;
198
+ }
@@ -0,0 +1,177 @@
1
+ /**
2
+ * #4692: a release cut from a lane's green tag. A cut given a lane that
3
+ * `ci.green.lanes` declares checks `ci/green-<lane>/<sha>` and
4
+ * `ci/revoked-<lane>/<sha>` in place of the full green tags, and the cut
5
+ * line names the lane. `release candidates --lane` reads the same tags.
6
+ */
7
+
8
+ import { describe, test, expect } from "vitest";
9
+ import { withTestDir } from "@intentius/chant-test-utils";
10
+ import { spawnSync } from "node:child_process";
11
+ import { mkdirSync, writeFileSync } from "node:fs";
12
+ import { join } from "node:path";
13
+ import { cutRelease, planRelease, ReleaseCutError } from "./release-cut";
14
+ import { readCuts, type ReleaseArtifact } from "./release-store";
15
+ import type { CompiledTarget, TargetCompiler } from "../components/release-compile";
16
+ import { releasesDocument } from "../workspace/releases";
17
+ import { releaseCandidatesDocument } from "../workspace/release-candidates";
18
+ import { contract, declaration } from "../workspace/__fixtures__/contract-repo";
19
+ import releasesSchema from "../workspace/releases.schema.json";
20
+ import candidatesSchema from "../workspace/release-candidates.schema.json";
21
+
22
+ function git(dir: string, ...args: string[]): string {
23
+ const r = spawnSync("git", args, { cwd: dir, encoding: "utf-8" });
24
+ if (r.status !== 0) throw new Error(`git ${args.join(" ")}: ${r.stderr}`);
25
+ return r.stdout.trim();
26
+ }
27
+
28
+ const GREEN = {
29
+ branch: "main",
30
+ phases: { lint: ["lint"], test: ["test"], windows: ["windows"] },
31
+ require: ["lint", "test", "windows"],
32
+ lanes: { server: { require: ["lint", "test"] } },
33
+ };
34
+
35
+ /** A workspace whose root member is a chant project with two environments, on main, with `ci.green` as given. */
36
+ function workspace(dir: string, green: unknown = GREEN): string {
37
+ git(dir, "init", "-q", "-b", "main");
38
+ git(dir, "config", "user.email", "test@chant.dev");
39
+ git(dir, "config", "user.name", "Test");
40
+ writeFileSync(join(dir, "chant.workspace.json"), declaration([{ name: "root", dir: ".", kind: "other", because: "the release fixture" }], green ? { ci: { green } } : {}));
41
+ writeFileSync(join(dir, "chant.config.ts"), `export default { environments: ["dev", "prod"] };\n`);
42
+ mkdirSync(join(dir, "api"), { recursive: true });
43
+ writeFileSync(join(dir, "api", "Dockerfile"), "FROM scratch\n");
44
+ writeFileSync(join(dir, "api.component.ts"), "export const api = {};\n");
45
+ git(dir, "add", ".");
46
+ git(dir, "commit", "-q", "-m", "init");
47
+ return git(dir, "rev-parse", "HEAD");
48
+ }
49
+
50
+ function compiler(): TargetCompiler {
51
+ return {
52
+ async compile(env): Promise<CompiledTarget> {
53
+ return {
54
+ env,
55
+ params: [],
56
+ components: ["api"],
57
+ buildSteps: { api: [{ kind: "docker-build", context: "api", into: "api.tar" }] },
58
+ buildInputs: { api: ["api"] },
59
+ componentFiles: { api: "api.component.ts" },
60
+ templates: [{ component: "api", path: "dist/api.json", content: `{"env":"${env}"}\n` }],
61
+ };
62
+ },
63
+ async buildArtifacts(_env, components): Promise<ReleaseArtifact[]> {
64
+ return components.map((c) => ({ component: c, kind: "image" as const, path: `${c}.tar`, digest: `sha256:${"b".repeat(64)}` }));
65
+ },
66
+ };
67
+ }
68
+
69
+ const NOW = () => new Date("2026-11-01T10:00:00.000Z");
70
+ const cut = (dir: string, lane?: string, label: string | null = "v1.0.0") =>
71
+ cutRelease({ cwd: dir, compiler: compiler(), label, actor: "alice", env: {}, now: NOW, ...(lane !== undefined ? { lane } : {}) });
72
+ const refusal = async (p: Promise<unknown>): Promise<ReleaseCutError> => {
73
+ const err = await p.catch((e: unknown) => e);
74
+ expect(err).toBeInstanceOf(ReleaseCutError);
75
+ return err as ReleaseCutError;
76
+ };
77
+
78
+ describe("a cut from a lane (#4692)", () => {
79
+ test("a commit green only in its lane is cut with --lane, and the cut line and releases document name the lane", async () => {
80
+ await withTestDir(async (dir) => {
81
+ const sha = workspace(dir);
82
+ git(dir, "tag", `ci/green-server/${sha}`, sha);
83
+
84
+ const without = await refusal(cut(dir));
85
+ expect(without.code).toBe("release-commit-not-green");
86
+ expect(without.message).toContain("has no ci/green tag");
87
+
88
+ const plan = await planRelease({ cwd: dir, compiler: compiler(), label: "v1.0.0", actor: "alice", env: {}, lane: "server" });
89
+ expect(plan.lane).toBe("server");
90
+
91
+ const result = await cut(dir, "server");
92
+ expect(result.cut?.lane).toBe("server");
93
+ const { cuts } = await readCuts({ cwd: dir });
94
+ expect(cuts.map((c) => c.lane)).toEqual(["server"]);
95
+
96
+ const doc = await releasesDocument({ cwd: dir });
97
+ if ("error" in doc) throw new Error(doc.error.message);
98
+ expect(doc.releases[0].cuts[0].lane).toBe("server");
99
+ contract(releasesSchema).expectValid(doc);
100
+ });
101
+ });
102
+
103
+ test("a cut without a lane writes no lane, and a full green commit is cut as before", async () => {
104
+ await withTestDir(async (dir) => {
105
+ const sha = workspace(dir);
106
+ git(dir, "tag", `ci/green/${sha}`, sha);
107
+ const result = await cut(dir);
108
+ expect(result.cut).not.toBeNull();
109
+ expect(result.cut).not.toHaveProperty("lane");
110
+ // The full green tag does not stand in for the lane's.
111
+ const err = await refusal(cut(dir, "server", "v1.0.1"));
112
+ expect(err.code).toBe("release-commit-not-green");
113
+ expect(err.message).toContain("has no ci/green-server tag");
114
+ expect(err.fix).toContain("chant ci last-green --lane server");
115
+ });
116
+ });
117
+
118
+ test("a lane's revoked tag refuses the cut in that lane", async () => {
119
+ await withTestDir(async (dir) => {
120
+ const sha = workspace(dir);
121
+ git(dir, "tag", `ci/green-server/${sha}`, sha);
122
+ git(dir, "tag", `ci/revoked-server/${sha}`, sha);
123
+ const err = await refusal(cut(dir, "server"));
124
+ expect(err.code).toBe("release-commit-revoked");
125
+ expect(err.message).toContain("has a ci/revoked-server tag");
126
+ });
127
+ });
128
+
129
+ test("a lane the declaration does not declare, or no ci.green, is declaration-invalid and writes nothing", async () => {
130
+ await withTestDir(async (dir) => {
131
+ const sha = workspace(dir);
132
+ git(dir, "tag", `ci/green-app/${sha}`, sha);
133
+ const err = await refusal(cut(dir, "app"));
134
+ expect(err.code).toBe("declaration-invalid");
135
+ expect(err.message).toContain(`no lane "app"; it declares server`);
136
+ expect((await readCuts({ cwd: dir })).cuts).toEqual([]);
137
+ });
138
+ await withTestDir(async (dir) => {
139
+ const sha = workspace(dir, null);
140
+ git(dir, "tag", `ci/green-server/${sha}`, sha);
141
+ const err = await refusal(cut(dir, "server"));
142
+ expect(err.code).toBe("declaration-invalid");
143
+ expect(err.message).toContain("declares no ci.green");
144
+ });
145
+ });
146
+ });
147
+
148
+ describe("release candidates in a lane (#4692)", () => {
149
+ test("reads the lane's tags, names the lane, and skips a commit the lane revoked", async () => {
150
+ await withTestDir(async (dir) => {
151
+ const a = workspace(dir);
152
+ git(dir, "commit", "-q", "--allow-empty", "-m", "b");
153
+ const b = git(dir, "rev-parse", "HEAD");
154
+ git(dir, "commit", "-q", "--allow-empty", "-m", "c");
155
+ const c = git(dir, "rev-parse", "HEAD");
156
+ git(dir, "tag", `ci/green/${a}`, a);
157
+ git(dir, "tag", `ci/green-server/${b}`, b);
158
+ git(dir, "tag", `ci/green-server/${c}`, c);
159
+ git(dir, "tag", `ci/revoked-server/${c}`, c);
160
+
161
+ const full = await releaseCandidatesDocument({ cwd: dir });
162
+ if ("error" in full) throw new Error(full.error.message);
163
+ expect(full.lane).toBeNull();
164
+ expect(full.candidates.map((x) => x.commit)).toEqual([a]);
165
+
166
+ const lane = await releaseCandidatesDocument({ cwd: dir, lane: "server" });
167
+ if ("error" in lane) throw new Error(lane.error.message);
168
+ expect(lane.lane).toBe("server");
169
+ expect(lane.candidates.map((x) => x.commit)).toEqual([b]);
170
+ expect(lane.skipped.map((x) => x.commit)).toEqual([c]);
171
+ contract(candidatesSchema).expectValid(lane);
172
+
173
+ const unknown = await releaseCandidatesDocument({ cwd: dir, lane: "app" });
174
+ expect("error" in unknown && unknown.error.message).toContain(`no lane "app"`);
175
+ });
176
+ });
177
+ });