@futurelastic/colab-handbook 1.22.0-rc.7 → 1.22.1-rc.1

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
@@ -33,5 +33,5 @@
33
33
  "engines": {
34
34
  "node": ">=18"
35
35
  },
36
- "version": "1.22.0-rc.7"
36
+ "version": "1.22.1-rc.1"
37
37
  }
package/tools/colab CHANGED
@@ -2675,6 +2675,7 @@ function cmdReleaseFinalize(argv) {
2675
2675
  const cutRunOpts = {
2676
2676
  tag: cand.tag, cutAt: cand.cutAt, ownRunId: process.env.GITHUB_ACTIONS === 'true' ? process.env.GITHUB_RUN_ID || null : null,
2677
2677
  jobCount: forge ? null : (id) => git.ghRunJobCount(repoAbs, id), // #681: a commit status has no jobs to count
2678
+ jobsOf: forge ? null : (id) => git.ghRunJobs(repoAbs, id), // #749: a skipped run whose every job skipped is gated off
2678
2679
  };
2679
2680
  const cutRun = releaseFinalize.cutRunVerdict(rawRows, cutRunOpts);
2680
2681
  // #565: a run that failed only in its deploy jobs (staging) — the three run-reading conditions
@@ -345,13 +345,22 @@ const CUT_RUN_SLACK_MS = 120000;
345
345
  * pending run GitHub cancelled out of the release workflow's concurrency group when a newer one queued —
346
346
  * so it cut nothing and is dropped. Asked lazily, only for a cancelled row; null (unread) keeps it.
347
347
  *
348
+ * A SKIPPED row whose jobs `jobsOf(databaseId)` read as all skipped (or none at all) never started a
349
+ * job — the measured shape of a post-cut `workflow_run` smoke whose every job is gated by
350
+ * `if: vars.<LANE>_CI == 'true'` while that lane has no runner (#749). It published nothing, so it is
351
+ * neutral, the way #616 treats a skipped-only workflow for ci-green/full-suite, and the verdict names it
352
+ * once. Asked lazily, only for a skipped row; null (unread) keeps it, and so does a run where any job
353
+ * did something other than skip — a job that ran and then a publish skipped or cancelled is still the
354
+ * #566 refusal. A re-run cannot change a skipped run (the same `if:` skips it again), so the refusal
355
+ * offers `gh run rerun` only for a run that can conclude differently.
356
+ *
348
357
  * No run in progress at the cut → ok: the candidate was cut by hand (`colab release cut` outside a
349
358
  * workflow), and no run owes it anything. A completed row with no `updatedAt` (an older read) cannot
350
359
  * be placed around the cut and is not counted — absence of the field never refuses.
351
360
  *
352
361
  * Returns { ok, detail, runs } — `runs` the cutter rows' ids, for the report.
353
362
  */
354
- function cutRunVerdict(rows, { tag, cutAt, ownRunId = null, jobCount = null } = {}) {
363
+ function cutRunVerdict(rows, { tag, cutAt, ownRunId = null, jobCount = null, jobsOf = null } = {}) {
355
364
  if (rows === null || rows === undefined) return { ok: false, detail: `the workflow runs at ${tag} could not be read — the run that cut it cannot be checked`, runs: [] };
356
365
  const cut = Date.parse(cutAt);
357
366
  if (Number.isNaN(cut)) return { ok: false, detail: `${tag} carries no readable cut time — the run that cut it cannot be found`, runs: [] };
@@ -366,16 +375,34 @@ function cutRunVerdict(rows, { tag, cutAt, ownRunId = null, jobCount = null } =
366
375
  if (r.conclusion === 'cancelled' && typeof jobCount === 'function' && r.databaseId != null && jobCount(r.databaseId) === 0) return false;
367
376
  return true;
368
377
  });
369
- const ids = cutters.map((r) => r.databaseId).filter((x) => x !== null && x !== undefined);
370
378
  const name = (r) => `${r.workflowName || '(unnamed workflow)'} run ${r.databaseId != null ? r.databaseId : '(id unread)'}`;
379
+ // #749: a skipped run that started no job is gated off by its own `if:` — neutral, named once.
380
+ const gatedOff = (r) => {
381
+ if (r.status !== 'completed' || r.conclusion !== 'skipped' || typeof jobsOf !== 'function' || r.databaseId == null) return false;
382
+ const jobs = jobsOf(r.databaseId);
383
+ return Array.isArray(jobs) && jobs.every((j) => j && j.status === 'completed' && j.conclusion === 'skipped');
384
+ };
385
+ const neutral = cutters.filter(gatedOff);
386
+ const vouching = cutters.filter((r) => !neutral.includes(r));
387
+ const note = neutral.length ? ` (${neutral.map((r) => `${name(r)} skipped by its own gate — not a publisher at this candidate`).join('; ')})` : '';
388
+ const ids = vouching.map((r) => r.databaseId).filter((x) => x !== null && x !== undefined);
371
389
  if (!cutters.length) return { ok: true, detail: `no workflow run at ${tag} was in progress when it was cut (${cutAt}) — cut by hand, no run's publish to wait for`, runs: [] };
372
- const bad = cutters.filter((r) => !(r.status === 'completed' && r.conclusion === 'success'));
373
- if (!bad.length) return { ok: true, detail: `the run that cut ${tag} (${cutters.map(name).join(', ')}) concluded success`, runs: ids };
390
+ if (!vouching.length) return { ok: true, detail: `no run that cut ${tag} published anything after the cut${note}`, runs: [] };
391
+ const bad = vouching.filter((r) => !(r.status === 'completed' && r.conclusion === 'success'));
392
+ if (!bad.length) return { ok: true, detail: `the run that cut ${tag} (${vouching.map(name).join(', ')}) concluded success${note}`, runs: ids };
374
393
  const how = (r) => (r.status === 'completed' ? `concluded ${r.conclusion || 'with no conclusion'}` : `is still ${r.status || 'running'}`);
375
- const rerun = bad.filter((r) => r.status === 'completed' && r.databaseId != null).map((r) => `gh run rerun ${r.databaseId} --failed`);
394
+ // A skipped run is skipped again by the same `if:` on a re-run — never offer one for it.
395
+ const rerunnable = (r) => r.status === 'completed' && r.conclusion !== 'skipped' && r.databaseId != null;
396
+ const rerun = bad.filter(rerunnable).map((r) => `gh run rerun ${r.databaseId} --failed`);
397
+ const running = bad.some((r) => r.status !== 'completed');
398
+ const skipped = bad.filter((r) => r.status === 'completed' && r.conclusion === 'skipped');
399
+ const next = [];
400
+ if (rerun.length) next.push(`Re-run it (${rerun.join('; ')}) and finalize again, or cut a new candidate.`);
401
+ else if (running) next.push('Wait for it to finish, then finalize again.');
402
+ if (skipped.length) next.push(`A re-run cannot change ${skipped.map(name).join(', ')}: a skipped run is skipped again by the same condition, and ${typeof jobsOf === 'function' ? 'its jobs show one did not skip, or could not be read' : 'its jobs were not read'} — look at its jobs; if none started, it is gated off and publishes nothing (#749).`);
376
403
  return {
377
404
  ok: false,
378
- detail: `the run that cut ${tag} — ${bad.map((r) => `${name(r)} ${how(r)}`).join('; ')} — did not finish what it publishes after the cut (an image, a package, a Release): ${tag}'s artifacts may not exist. An earlier green run at the same commit that cut nothing cannot vouch for it (#566). ${rerun.length ? `Re-run it (${rerun.join('; ')}) and finalize again, or cut a new candidate.` : 'Wait for it to finish, then finalize again.'}`,
405
+ detail: `the run that cut ${tag} — ${bad.map((r) => `${name(r)} ${how(r)}`).join('; ')} — did not finish what it publishes after the cut (an image, a package, a Release): ${tag}'s artifacts may not exist. An earlier green run at the same commit that cut nothing cannot vouch for it (#566).${note} ${next.join(' ')}`,
379
406
  runs: ids,
380
407
  };
381
408
  }