codewhale 0.9.6 → 0.9.8

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "codewhale",
3
- "version": "0.9.6",
4
- "codewhaleBinaryVersion": "0.9.6",
3
+ "version": "0.9.8",
4
+ "codewhaleBinaryVersion": "0.9.8",
5
5
  "description": "Terminal coding agent for supported hosted and local models. One runtime on your machine. Rust, MIT.",
6
6
  "author": "Hmbown",
7
7
  "license": "MIT",
@@ -208,22 +208,41 @@ async function resolveTagCommitSha(repo, tag) {
208
208
  return tagObject.object.sha;
209
209
  }
210
210
 
211
- async function findReleaseWorkflowRun(repo, tag, tagSha) {
212
- const runs = await githubApi(repo, "/actions/workflows/release.yml/runs?per_page=100");
213
- const matches = (runs.workflow_runs || [])
211
+ async function findReleaseWorkflowRun(repo, tag, tagSha, api = githubApi) {
212
+ const runs = await api(repo, "/actions/workflows/release.yml/runs?per_page=100");
213
+ const candidates = (runs.workflow_runs || [])
214
214
  .filter((run) => run.head_sha === tagSha)
215
- .filter((run) => run.conclusion === "success")
216
215
  .filter((run) => run.event === "push" || run.event === "workflow_dispatch")
217
216
  .sort((a, b) => String(b.updated_at).localeCompare(String(a.updated_at)));
218
- const tagBranchMatch = matches.find((run) => run.head_branch === tag);
219
- const match = tagBranchMatch || matches[0];
220
- if (!match) {
217
+
218
+ const orderedCandidates = [
219
+ ...candidates.filter((run) => run.head_branch === tag),
220
+ ...candidates.filter((run) => run.head_branch !== tag),
221
+ ];
222
+ for (const candidate of orderedCandidates) {
223
+ const runId = candidate.database_id || candidate.id;
224
+ if (!runId) {
225
+ continue;
226
+ }
227
+ const jobs = await api(repo, `/actions/runs/${runId}/jobs?per_page=100`);
228
+ const releaseJob = (jobs.jobs || []).find(
229
+ (job) => job.name === "release" && job.conclusion === "success",
230
+ );
231
+ if (releaseJob) {
232
+ return candidate;
233
+ }
234
+ }
235
+
236
+ if (orderedCandidates.length === 0) {
221
237
  throw new Error(
222
- `No successful release.yml workflow run found for ${tag} at ${tagSha}. ` +
238
+ `No release.yml workflow run found for ${tag} at ${tagSha}. ` +
223
239
  "Rerun the Release workflow before publishing npm, or increase the verifier's last-100-runs search window.",
224
240
  );
225
241
  }
226
- return match;
242
+ throw new Error(
243
+ `No successful asset-publishing job found in release.yml workflow runs for ${tag} at ${tagSha}. ` +
244
+ "Repair the Release workflow before publishing npm.",
245
+ );
227
246
  }
228
247
 
229
248
  function parseGitHubTime(value, label) {
@@ -347,6 +366,7 @@ module.exports = {
347
366
  assertChecksumManifestIncludes,
348
367
  assertPackageVersionMatchesBinaryVersion,
349
368
  assertReleaseAssetsFresh,
369
+ findReleaseWorkflowRun,
350
370
  hasReleaseBaseOverride,
351
371
  parseChecksumManifest,
352
372
  };
@@ -19,6 +19,7 @@ const {
19
19
  assertChecksumManifestIncludes,
20
20
  assertPackageVersionMatchesBinaryVersion,
21
21
  assertReleaseAssetsFresh,
22
+ findReleaseWorkflowRun,
22
23
  parseChecksumManifest,
23
24
  } = require("../scripts/verify-release-assets");
24
25
 
@@ -119,6 +120,56 @@ test("assertReleaseAssetsFresh accepts assets updated by the release workflow ru
119
120
  );
120
121
  });
121
122
 
123
+ test("findReleaseWorkflowRun accepts a successful release job when a downstream job failed", async () => {
124
+ const run = {
125
+ id: 123,
126
+ head_sha: "abc123",
127
+ head_branch: "v0.9.6",
128
+ event: "push",
129
+ conclusion: "failure",
130
+ updated_at: "2026-08-12T08:48:00Z",
131
+ };
132
+ const api = async (_repo, endpoint) => {
133
+ if (endpoint.includes("/workflows/release.yml/runs")) {
134
+ return { workflow_runs: [run] };
135
+ }
136
+ assert.equal(endpoint, "/actions/runs/123/jobs?per_page=100");
137
+ return {
138
+ jobs: [
139
+ { name: "release", conclusion: "success" },
140
+ { name: "npm", conclusion: "failure" },
141
+ ],
142
+ };
143
+ };
144
+
145
+ assert.equal(await findReleaseWorkflowRun("owner/repo", "v0.9.6", "abc123", api), run);
146
+ });
147
+
148
+ test("findReleaseWorkflowRun rejects runs without a successful release job", async () => {
149
+ const api = async (_repo, endpoint) => {
150
+ if (endpoint.includes("/workflows/release.yml/runs")) {
151
+ return {
152
+ workflow_runs: [
153
+ {
154
+ id: 123,
155
+ head_sha: "abc123",
156
+ head_branch: "v0.9.6",
157
+ event: "push",
158
+ conclusion: "failure",
159
+ updated_at: "2026-08-12T08:48:00Z",
160
+ },
161
+ ],
162
+ };
163
+ }
164
+ return { jobs: [{ name: "release", conclusion: "failure" }] };
165
+ };
166
+
167
+ await assert.rejects(
168
+ findReleaseWorkflowRun("owner/repo", "v0.9.6", "abc123", api),
169
+ /No successful asset-publishing job found/,
170
+ );
171
+ });
172
+
122
173
  test("assertPackageVersionMatchesBinaryVersion allows packaging-only releases only with an explicit override", () => {
123
174
  assert.doesNotThrow(() => assertPackageVersionMatchesBinaryVersion(pkg.version));
124
175
  assert.throws(