@intentius/chant 0.124.64 → 0.124.66

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 (112) hide show
  1. package/dist/cli/handlers/pr.d.ts.map +1 -1
  2. package/dist/cli/handlers/pr.js +3 -1
  3. package/dist/cli/handlers/release.d.ts.map +1 -1
  4. package/dist/cli/handlers/release.js +20 -2
  5. package/dist/cli/handlers/run.d.ts +30 -1
  6. package/dist/cli/handlers/run.d.ts.map +1 -1
  7. package/dist/cli/handlers/run.js +108 -7
  8. package/dist/cli/main.d.ts.map +1 -1
  9. package/dist/cli/main.js +17 -2
  10. package/dist/cli/parse-args.d.ts.map +1 -1
  11. package/dist/cli/parse-args.js +7 -0
  12. package/dist/cli/registry.d.ts +5 -1
  13. package/dist/cli/registry.d.ts.map +1 -1
  14. package/dist/components/cli-support.d.ts +19 -1
  15. package/dist/components/cli-support.d.ts.map +1 -1
  16. package/dist/components/cli-support.js +11 -3
  17. package/dist/components/component.d.ts +19 -0
  18. package/dist/components/component.d.ts.map +1 -1
  19. package/dist/components/component.schema.json +17 -0
  20. package/dist/components/index.d.ts +1 -1
  21. package/dist/components/index.d.ts.map +1 -1
  22. package/dist/components/release-run.d.ts +48 -0
  23. package/dist/components/release-run.d.ts.map +1 -0
  24. package/dist/components/release-run.js +166 -0
  25. package/dist/components/starter-plugin.d.ts +1 -0
  26. package/dist/components/starter-plugin.d.ts.map +1 -1
  27. package/dist/components/starter-plugin.js +5 -1
  28. package/dist/components/unchanged-inputs.d.ts +81 -0
  29. package/dist/components/unchanged-inputs.d.ts.map +1 -0
  30. package/dist/components/unchanged-inputs.js +121 -0
  31. package/dist/components/verbs/index.d.ts +1 -0
  32. package/dist/components/verbs/index.d.ts.map +1 -1
  33. package/dist/components/verbs/index.js +1 -0
  34. package/dist/components/verbs/release-image.d.ts +36 -0
  35. package/dist/components/verbs/release-image.d.ts.map +1 -0
  36. package/dist/components/verbs/release-image.js +33 -0
  37. package/dist/lifecycle/delivery-metrics.d.ts.map +1 -1
  38. package/dist/lifecycle/delivery-metrics.js +4 -2
  39. package/dist/lifecycle/gate-statement.d.ts.map +1 -1
  40. package/dist/lifecycle/gate-statement.js +1 -2
  41. package/dist/lifecycle/git.d.ts.map +1 -1
  42. package/dist/lifecycle/git.js +6 -1
  43. package/dist/lifecycle/ledger-read.js +1 -1
  44. package/dist/lifecycle/publish-homebrew.d.ts.map +1 -1
  45. package/dist/lifecycle/publish-homebrew.js +1 -2
  46. package/dist/lifecycle/publish-marketplace.d.ts.map +1 -1
  47. package/dist/lifecycle/publish-marketplace.js +2 -3
  48. package/dist/lifecycle/query.d.ts +2 -2
  49. package/dist/lifecycle/query.d.ts.map +1 -1
  50. package/dist/lifecycle/query.js +3 -3
  51. package/dist/lifecycle/release-cut.d.ts +32 -2
  52. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  53. package/dist/lifecycle/release-cut.js +47 -7
  54. package/dist/lifecycle/release-ledger.d.ts +11 -0
  55. package/dist/lifecycle/release-ledger.d.ts.map +1 -1
  56. package/dist/lifecycle/release-store.d.ts +17 -3
  57. package/dist/lifecycle/release-store.d.ts.map +1 -1
  58. package/dist/lifecycle/release-store.js +10 -3
  59. package/dist/op/activities/activity-contracts.d.ts +4 -4
  60. package/dist/op/op-waves-run.js +5 -3
  61. package/dist/pr-forge.d.ts.map +1 -1
  62. package/dist/pr-forge.js +3 -1
  63. package/dist/release-floors.d.ts +1 -1
  64. package/dist/release-floors.js +1 -1
  65. package/dist/wave-runtime.mjs +311 -311
  66. package/dist/workspace/delivery-metrics.schema.json +1 -1
  67. package/dist/workspace/release-candidates.d.ts.map +1 -1
  68. package/dist/workspace/release-candidates.js +1 -2
  69. package/dist/workspace/releases.schema.json +7 -2
  70. package/package.json +1 -1
  71. package/src/cli/handlers/pr.ts +3 -1
  72. package/src/cli/handlers/release.ts +18 -2
  73. package/src/cli/handlers/run-unchanged.e2e.test.ts +112 -0
  74. package/src/cli/handlers/run.ts +117 -7
  75. package/src/cli/main.ts +17 -2
  76. package/src/cli/parse-args.ts +6 -0
  77. package/src/cli/registry.ts +5 -1
  78. package/src/components/cli-support.test.ts +53 -0
  79. package/src/components/cli-support.ts +26 -4
  80. package/src/components/component.schema.json +17 -0
  81. package/src/components/component.ts +20 -0
  82. package/src/components/index.ts +1 -0
  83. package/src/components/registry.test.ts +1 -1
  84. package/src/components/release-run.test.ts +127 -0
  85. package/src/components/release-run.ts +188 -0
  86. package/src/components/starter-plugin.ts +5 -0
  87. package/src/components/unchanged-inputs.test.ts +98 -0
  88. package/src/components/unchanged-inputs.ts +150 -0
  89. package/src/components/verbs/index.ts +1 -0
  90. package/src/components/verbs/release-image.ts +52 -0
  91. package/src/lifecycle/delivery-metrics.ts +4 -2
  92. package/src/lifecycle/gate-statement.ts +1 -2
  93. package/src/lifecycle/git.test.ts +15 -0
  94. package/src/lifecycle/git.ts +5 -1
  95. package/src/lifecycle/ledger-read.ts +1 -1
  96. package/src/lifecycle/publish-homebrew.ts +1 -2
  97. package/src/lifecycle/publish-marketplace.ts +2 -3
  98. package/src/lifecycle/query.ts +3 -3
  99. package/src/lifecycle/release-cut-lane.test.ts +18 -0
  100. package/src/lifecycle/release-cut-override.test.ts +12 -0
  101. package/src/lifecycle/release-cut.test.ts +45 -0
  102. package/src/lifecycle/release-cut.ts +67 -7
  103. package/src/lifecycle/release-ledger.ts +11 -0
  104. package/src/lifecycle/release-store.ts +28 -5
  105. package/src/op/op-waves-run.ts +4 -2
  106. package/src/pr-forge.ts +3 -1
  107. package/src/pr-requires.test.ts +10 -0
  108. package/src/release-floors.ts +1 -1
  109. package/src/workspace/delivery-metrics.schema.json +1 -1
  110. package/src/workspace/delivery-metrics.test.ts +8 -0
  111. package/src/workspace/release-candidates.ts +1 -2
  112. package/src/workspace/releases.schema.json +7 -2
@@ -66,15 +66,30 @@ export const TEMPLATES_SUBDIR = "templates";
66
66
  /** The `kind` a release digest is computed under, so it can never equal a plan digest of another kind. */
67
67
  export const RELEASE_DIGEST_KIND = "release";
68
68
 
69
- /** An artifact built once from the release's commit: an `image` or `asset` archive entry. */
69
+ /**
70
+ * An artifact built once from the release's commit: an `image` or `asset`
71
+ * archive entry the cut built, or an image built elsewhere and handed to the
72
+ * cut by digest (#4694, `chant release cut --image`).
73
+ */
70
74
  export interface ReleaseArtifact {
71
75
  component: string;
72
76
  kind: "image" | "asset";
73
- /** The archive path the build step wrote. */
77
+ /** The archive path the build step wrote. Empty for an image handed to the cut, which no build step wrote. */
74
78
  path: string;
75
79
  digest: string;
80
+ /**
81
+ * For an image handed to the cut (#4694): where it is, as
82
+ * `<repository>@<digest>`, the reference a deploy under the release runs.
83
+ * Absent on an artifact the cut built. In the release digest when present,
84
+ * so a release that records one is read by chant {@link RELEASE_IMAGE_REF_FLOOR}
85
+ * and newer.
86
+ */
87
+ ref?: string;
76
88
  }
77
89
 
90
+ /** The first chant that writes and reads an artifact's `ref` (#4694). */
91
+ export const RELEASE_IMAGE_REF_FLOOR = "0.124.65";
92
+
78
93
  /** One template of a target: a file a component's deploy reads, compiled for the target's environment. */
79
94
  export interface ReleaseTemplate {
80
95
  /** The component whose deploy reads it, or null for a project with no components. */
@@ -207,12 +222,12 @@ export type ReleaseSubject = Pick<Release, "member" | "commit" | "artifactDigest
207
222
 
208
223
  const byString = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0);
209
224
 
210
- /** The same release with every list in the order ws-104 sets: artifacts by component then path, targets by env, templates by component then path, params by name. */
225
+ /** The same release with every list in the order ws-104 sets: artifacts by component then path (a handed image's `ref` kept), targets by env, templates by component then path, params by name. */
211
226
  export function normalizeRelease<T extends ReleaseSubject>(release: T): T {
212
227
  return {
213
228
  ...release,
214
229
  artifactDigests: [...release.artifactDigests]
215
- .map(({ component, kind, path, digest }) => ({ component, kind, path, digest }))
230
+ .map(({ component, kind, path, digest, ref }) => ({ component, kind, path, digest, ...(ref !== undefined ? { ref } : {}) }))
216
231
  .sort((a, b) => byString(a.component, b.component) || byString(a.path, b.path)),
217
232
  targets: [...release.targets]
218
233
  .map((t) => ({
@@ -354,7 +369,15 @@ export function parseRelease(text: string): Release | null {
354
369
  (r.member === null || typeof r.member === "string") &&
355
370
  typeof r.commit === "string" &&
356
371
  Array.isArray(r.artifactDigests) &&
357
- r.artifactDigests.every((a) => a && typeof a.component === "string" && (a.kind === "image" || a.kind === "asset") && typeof a.path === "string" && typeof a.digest === "string") &&
372
+ r.artifactDigests.every(
373
+ (a) =>
374
+ a &&
375
+ typeof a.component === "string" &&
376
+ (a.kind === "image" || a.kind === "asset") &&
377
+ typeof a.path === "string" &&
378
+ typeof a.digest === "string" &&
379
+ (a.ref === undefined || typeof a.ref === "string"),
380
+ ) &&
358
381
  Array.isArray(r.targets) &&
359
382
  r.targets.every(
360
383
  (t) =>
@@ -4014,10 +4014,12 @@ async function storeHeadChangeSet(doc: ChangeSetDocument, cwd: string): Promise<
4014
4014
  }
4015
4015
 
4016
4016
  async function writeHeadPlans(plans: HeadPlans, cwd: string): Promise<void> {
4017
- const { pushLifecycle, requireLifecycleLedger, writeBlobToPath } = await import("../lifecycle/git");
4017
+ const { pushLifecycleRebasing, requireLifecycleLedger, writeBlobToPath } = await import("../lifecycle/git");
4018
4018
  const { headPlansPath } = await import("./gate-review");
4019
4019
  await requireLifecycleLedger({ cwd });
4020
4020
  const { dir, file } = headPlansPath(plans.name, plans.head);
4021
4021
  await writeBlobToPath(dir, file, JSON.stringify(plans, null, 2) + "\n", `Op waves plans of ${plans.name} at ${plans.head.slice(0, 12)}`, { cwd });
4022
- if (!(await pushLifecycle({ cwd }))) throw new Error("the plans were recorded locally only: chant/lifecycle has no remote to push to");
4022
+ // The preview, its note and the approval status write the ledger at the same head, so a lost race replays rather than fails the job a pull request's checks wait on.
4023
+ const pushed = await pushLifecycleRebasing({ cwd });
4024
+ if (!pushed.pushed) throw new Error(`the plans were recorded locally only: ${pushed.pushWarning ?? "chant/lifecycle has no remote to push to"}`);
4023
4025
  }
package/src/pr-forge.ts CHANGED
@@ -307,7 +307,9 @@ const MERGE_REFUSED = new Set([405, 406, 409, 422]);
307
307
  function ignoredStatus(ignore: readonly string[]): (name: string) => boolean {
308
308
  const exact = new Set(ignore);
309
309
  const under = ignore.filter((i) => i.endsWith("/"));
310
- return (name) => exact.has(name) || under.some((i) => name.startsWith(i));
310
+ // An entry with `*` in it is a pattern, `*` standing for any run of characters, such as a pipeline job's status with the event after it (plywood#66).
311
+ const globs = ignore.filter((i) => i.includes("*")).map((i) => new RegExp(`^${i.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replaceAll("*", ".*")}$`));
312
+ return (name) => exact.has(name) || under.some((i) => name.startsWith(i)) || globs.some((g) => g.test(name));
311
313
  }
312
314
 
313
315
  /** A refused merge as a result, any other failure rethrown. */
@@ -115,6 +115,16 @@ describe("github", () => {
115
115
  expect((await f.prChecksPassed!(7, HEAD, ["plywood/preview"])).passed).toBe(false);
116
116
  });
117
117
 
118
+ test("checks: an entry with * leaves out every status it matches, and only those", async () => {
119
+ const f = forge({
120
+ [`GET ${repo}/commits/${HEAD}/status`]: { statuses: [{ context: "chant-pr.shop.production / plan (pull_request)", state: "failure" }, { context: "ci/test", state: "success" }] },
121
+ [`GET ${repo}/commits/${HEAD}/check-runs`]: { check_runs: [] },
122
+ });
123
+ expect((await f.prChecksPassed!(7, HEAD, ["chant-pr.*.production / plan*"])).passed).toBe(true);
124
+ expect((await f.prChecksPassed!(7, HEAD, ["chant-pr.*.staging / plan*"])).passed).toBe(false);
125
+ expect((await f.prChecksPassed!(7, HEAD, ["chant-pr.shop.production / plan"])).passed).toBe(false);
126
+ });
127
+
118
128
  test("checks: nothing reported is pending", async () => {
119
129
  const f = forge({ [`GET ${repo}/commits/${HEAD}/status`]: { statuses: [] }, [`GET ${repo}/commits/${HEAD}/check-runs`]: { check_runs: [] } });
120
130
  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.64";
22
+ export const NEXT_RELEASE = "0.124.66";
@@ -191,7 +191,7 @@
191
191
  "count": {
192
192
  "type": "integer",
193
193
  "minimum": 0,
194
- "description": "Deploy records whose timestamp is in the window, leaving out redeploys. Rollbacks count."
194
+ "description": "Deploy records whose timestamp is in the window, leaving out redeploys. Rollbacks count. A record with unchangedSince (#4695) deployed nothing and is in no metric."
195
195
  },
196
196
  "redeploys": {
197
197
  "type": "integer",
@@ -229,6 +229,14 @@ describe("environmentMetrics", () => {
229
229
  expect(m.leadTime.changes).toBe(0);
230
230
  });
231
231
 
232
+ test("a record of a skipped component deployed nothing and is in no metric (#4695)", () => {
233
+ const deploy = record("hub", "06");
234
+ const skip = record("hub", "08", { releaseDigest: "jcs1-sha256:r2", unchangedSince: { env: "prod", runId: deploy.runId, timestamp: deploy.timestamp } });
235
+ const m = environmentMetrics("prod", [deploy, skip], lookups, { since: t("05"), until: NOW });
236
+ expect(m.deployments.count).toBe(1);
237
+ expect(m.deployments.runs).toBe(1);
238
+ });
239
+
232
240
  test("a rollback is a record with restores; nothing else is", () => {
233
241
  expect(rollbackOf(record("api", "01"))).toBeNull();
234
242
  expect(rollbackOf(record("api", "02", { restores: { env: "prod", runId: "x", timestamp: t("01") } }))).toEqual({ env: "prod", runId: "x", timestamp: t("01") });
@@ -44,7 +44,6 @@
44
44
 
45
45
  import { execFileSync } from "node:child_process";
46
46
  import { relative, resolve, sep } from "node:path";
47
- import { NEXT_RELEASE } from "../release-floors";
48
47
  import { latestPerComponent, readReleaseLedger } from "../lifecycle/release-ledger";
49
48
  import { readAllReleases, readCuts } from "../lifecycle/release-store";
50
49
  import { resolveMemberLedger } from "../lifecycle/member-ledger";
@@ -56,7 +55,7 @@ export const RELEASE_CANDIDATES_CONTRACT_VERSION = 1;
56
55
  /** The first chant whose candidates carry `changes[].closes` and `groups[].issue` (#4649). */
57
56
  export const RELEASE_CANDIDATES_CLOSES_FLOOR = "0.124.63";
58
57
  /** The first chant whose candidates document carries `lane` and reads a lane's tags (#4692). */
59
- export const RELEASE_CANDIDATES_LANE_FLOOR = NEXT_RELEASE;
58
+ export const RELEASE_CANDIDATES_LANE_FLOOR = "0.124.64";
60
59
  export const RELEASE_CANDIDATES_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/release-candidates/v1/release-candidates.schema.json";
61
60
 
62
61
  /** Why the read stopped. Closed; each code is in `reason-codes.ts`. */
@@ -113,7 +113,7 @@
113
113
  },
114
114
  "artifactDigests": {
115
115
  "type": "array",
116
- "description": "Each image and asset built once from the commit, sorted by component, then path. A config-only release carries the previous release's entries.",
116
+ "description": "Each image and asset built once from the commit, or handed to the cut by digest, sorted by component, then path. A config-only release carries the previous release's entries.",
117
117
  "items": {
118
118
  "type": "object",
119
119
  "required": [
@@ -133,11 +133,16 @@
133
133
  ]
134
134
  },
135
135
  "path": {
136
- "type": "string"
136
+ "type": "string",
137
+ "description": "The archive path the build step wrote. Empty for an image handed to the cut."
137
138
  },
138
139
  "digest": {
139
140
  "type": "string",
140
141
  "minLength": 1
142
+ },
143
+ "ref": {
144
+ "type": "string",
145
+ "description": "An image handed to the cut by digest (chant release cut --image, #4694), as <repository>@<digest>: the image a deploy under the release runs. Absent on an artifact the cut built. Written by chant 0.124.65 and newer."
141
146
  }
142
147
  }
143
148
  }