codewhale 0.9.8 → 0.9.9

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.8",
4
- "codewhaleBinaryVersion": "0.9.8",
3
+ "version": "0.9.9",
4
+ "codewhaleBinaryVersion": "0.9.9",
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",
@@ -229,7 +229,11 @@ async function findReleaseWorkflowRun(repo, tag, tagSha, api = githubApi) {
229
229
  (job) => job.name === "release" && job.conclusion === "success",
230
230
  );
231
231
  if (releaseJob) {
232
- return candidate;
232
+ // #5429: pin asset freshness to the successful release job's own
233
+ // started_at, not the run-level run_started_at. A job-level rerun
234
+ // (`gh run rerun --failed`) bumps run_started_at past the asset upload
235
+ // timestamps even though this release job produced those assets.
236
+ return { ...candidate, release_job_started_at: releaseJob.started_at || null };
233
237
  }
234
238
  }
235
239
 
@@ -260,7 +264,12 @@ function assertReleaseAssetsFresh(release, expectedAssets, run) {
260
264
  throw new Error(`GitHub Release is missing required release asset(s): ${missing.join(", ")}`);
261
265
  }
262
266
 
263
- const runStartedAt = parseGitHubTime(run.run_started_at || run.created_at, "workflow run start");
267
+ // #5429: compare against the successful release job's started_at when the
268
+ // run record carries it; fall back to the run-level timestamp only when a
269
+ // job baseline is unavailable.
270
+ const baseline = run.release_job_started_at || run.run_started_at || run.created_at;
271
+ const baselineLabel = run.release_job_started_at ? "release job start" : "workflow run start";
272
+ const freshnessBaseline = parseGitHubTime(baseline, baselineLabel);
264
273
  const stale = [];
265
274
  for (const expected of expectedAssets) {
266
275
  const asset = assetsByName.get(expected);
@@ -269,7 +278,7 @@ function assertReleaseAssetsFresh(release, expectedAssets, run) {
269
278
  continue;
270
279
  }
271
280
  const updatedAt = parseGitHubTime(asset.updated_at || asset.created_at, `${expected} update`);
272
- if (updatedAt < runStartedAt) {
281
+ if (updatedAt < freshnessBaseline) {
273
282
  stale.push(`${expected} updated at ${asset.updated_at || asset.created_at}`);
274
283
  }
275
284
  }
@@ -120,6 +120,38 @@ test("assertReleaseAssetsFresh accepts assets updated by the release workflow ru
120
120
  );
121
121
  });
122
122
 
123
+ test("assertReleaseAssetsFresh accepts assets uploaded before a job-level rerun bumped run_started_at (#5429)", () => {
124
+ assert.doesNotThrow(() =>
125
+ assertReleaseAssetsFresh(
126
+ { assets: [{ name: "codewhale-linux-x64", state: "uploaded", updated_at: "2026-08-15T02:00:00Z" }] },
127
+ ["codewhale-linux-x64"],
128
+ {
129
+ database_id: 123,
130
+ // `gh run rerun --failed` moves the run-level start forward…
131
+ run_started_at: "2026-08-15T10:00:00Z",
132
+ // …but the release job that actually uploaded the assets is unchanged.
133
+ release_job_started_at: "2026-08-15T01:00:00Z",
134
+ },
135
+ ),
136
+ );
137
+ });
138
+
139
+ test("assertReleaseAssetsFresh still rejects assets older than the successful release job", () => {
140
+ assert.throws(
141
+ () =>
142
+ assertReleaseAssetsFresh(
143
+ { assets: [{ name: "codewhale-linux-x64", state: "uploaded", updated_at: "2026-08-15T00:30:00Z" }] },
144
+ ["codewhale-linux-x64"],
145
+ {
146
+ database_id: 123,
147
+ run_started_at: "2026-08-15T10:00:00Z",
148
+ release_job_started_at: "2026-08-15T01:00:00Z",
149
+ },
150
+ ),
151
+ /asset set is stale/,
152
+ );
153
+ });
154
+
123
155
  test("findReleaseWorkflowRun accepts a successful release job when a downstream job failed", async () => {
124
156
  const run = {
125
157
  id: 123,
@@ -136,13 +168,16 @@ test("findReleaseWorkflowRun accepts a successful release job when a downstream
136
168
  assert.equal(endpoint, "/actions/runs/123/jobs?per_page=100");
137
169
  return {
138
170
  jobs: [
139
- { name: "release", conclusion: "success" },
171
+ { name: "release", conclusion: "success", started_at: "2026-08-12T07:30:00Z" },
140
172
  { name: "npm", conclusion: "failure" },
141
173
  ],
142
174
  };
143
175
  };
144
176
 
145
- assert.equal(await findReleaseWorkflowRun("owner/repo", "v0.9.6", "abc123", api), run);
177
+ assert.deepEqual(await findReleaseWorkflowRun("owner/repo", "v0.9.6", "abc123", api), {
178
+ ...run,
179
+ release_job_started_at: "2026-08-12T07:30:00Z",
180
+ });
146
181
  });
147
182
 
148
183
  test("findReleaseWorkflowRun rejects runs without a successful release job", async () => {