@biffo/cli 0.279.0 → 0.279.2

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/dist/index.js CHANGED
@@ -9277,7 +9277,7 @@ async function runPluginUpgrade(target, options, deps) {
9277
9277
  }
9278
9278
  if (manifest.tables.length > 0) {
9279
9279
  log.info(
9280
- `Generating migration for services/${entry.name}/'s ${manifest.tables.length} table(s)...`
9280
+ `Checking for a migration for services/${entry.name}/'s ${manifest.tables.length} table(s)...`
9281
9281
  );
9282
9282
  const generatedPaths = await deps.migrations.generate(options.cwd, [entry.name]);
9283
9283
  for (const absPath of generatedPaths) {
@@ -9285,6 +9285,10 @@ async function runPluginUpgrade(target, options, deps) {
9285
9285
  }
9286
9286
  if (generatedPaths.length > 0) {
9287
9287
  log.success(`Generated migration: ${relative5(options.cwd, generatedPaths[0])}`);
9288
+ } else {
9289
+ log.info(
9290
+ `${entry.name}'s tables and columns already match the manifest \u2014 no migration needed.`
9291
+ );
9288
9292
  }
9289
9293
  }
9290
9294
  const label = currentVersion ? `${entry.name} ${currentVersion} -> ${entry.version}` : `${entry.name} to ${entry.version}`;
@@ -9370,7 +9374,9 @@ async function runLocalPluginRefresh(localPath, options, deps) {
9370
9374
  if (generatedPaths.length > 0) {
9371
9375
  log.success(`Generated migration: ${relative5(options.cwd, generatedPaths[0])}`);
9372
9376
  } else {
9373
- log.info(`${source.name}'s table set is unchanged \u2014 no migration needed.`);
9377
+ log.info(
9378
+ `${source.name}'s tables and columns already match the manifest \u2014 no migration needed.`
9379
+ );
9374
9380
  }
9375
9381
  } else {
9376
9382
  log.info(`${source.name} declares no tables \u2014 nothing to migrate.`);
@@ -9448,7 +9454,7 @@ function printLocalDryRun(source, currentVersion, inTreeSource) {
9448
9454
  );
9449
9455
  if (source.manifest.tables.length > 0) {
9450
9456
  console.log(
9451
- ` Would check for a migration for ${source.manifest.tables.length} table(s) (only generated if the table set changed)`
9457
+ ` Would check for a migration for ${source.manifest.tables.length} table(s) (generated for a new table or an added column on an already-migrated table; a removed/retyped/nullability-changed column stops the refresh instead \u2014 #1539)`
9452
9458
  );
9453
9459
  }
9454
9460
  console.log(` Would commit: chore(plugins): refresh ${source.name} from local checkout
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.279.0",
3
+ "version": "0.279.2",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -218,17 +218,49 @@ while :; do
218
218
  exit 2
219
219
  fi
220
220
 
221
+ # Two things this filter has to get right, and the second one bit us (#1552).
222
+ #
223
+ # 1. `when` must not be keyed on `.completedAt` alone. A check run that is
224
+ # STILL RUNNING carries `completedAt: "0001-01-01T00:00:00Z"` — GitHub sends
225
+ # the zero-value timestamp rather than omitting the field or sending null.
226
+ # `//` only falls through on null/false, so a plain
227
+ # `.completedAt // .startedAt` returns that zero date and the FRESHEST run
228
+ # sorts as the oldest value there is. `max_by(.when)` then discarded the
229
+ # running run in favour of the superseded one, and this script reported
230
+ # "All checks concluded, none failed" while `Release Guards` was mid-flight
231
+ # on PR #1548 — GitHub had the PR BLOCKED and was right. So the candidate
232
+ # timestamps are filtered before the first non-empty one is taken.
233
+ #
234
+ # 2. Recency must not be the thing that decides it. Even with the timestamp
235
+ # fixed, "newest wins" answers a proxy question; the real one is "is ANY run
236
+ # for this context still in flight?". So an unfinished entry outranks every
237
+ # concluded one for the same name explicitly, and only a group with nothing
238
+ # unfinished falls back to newest-wins (which is what #1333 needs, so a
239
+ # re-run's SUCCESS supersedes the earlier FAILURE).
240
+ #
241
+ # `seen` carries the pre-collapse count per context so the report can state its
242
+ # denominator instead of implying one (#1363).
221
243
  rollup=$(gh_pr view "$PR" --json statusCheckRollup --jq '
222
244
  [ .statusCheckRollup[]?
223
245
  | { name: (.name // .context),
224
246
  state: (.conclusion // .state // (if .status == "COMPLETED" then "" else null end)),
225
- when: (.completedAt // .startedAt // .updatedAt // .createdAt // "")
247
+ when: ([ .completedAt, .startedAt, .updatedAt, .createdAt ]
248
+ | map(select(. != null and . != "" and . != "0001-01-01T00:00:00Z"))
249
+ | first // "")
226
250
  }
227
251
  ]
228
252
  | group_by(.name)
229
- | map(max_by(.when))
253
+ | map(
254
+ ([ .[] | select(.state == null or .state == "" or .state == "PENDING"
255
+ or .state == "IN_PROGRESS" or .state == "QUEUED"
256
+ or .state == "WAITING") ]) as $unfinished
257
+ | (if ($unfinished | length) > 0
258
+ then ($unfinished | max_by(.when))
259
+ else max_by(.when) end)
260
+ + { seen: length }
261
+ )
230
262
  | .[]
231
- | "\(.name)\t\(.state // "")"') || rollup=""
263
+ | "\(.name)\t\(.state // "")\t\(.seen)"') || rollup=""
232
264
 
233
265
  count=0
234
266
  [ -n "$rollup" ] && count=$(printf '%s\n' "$rollup" | grep -c .)
@@ -305,5 +337,11 @@ fi
305
337
 
306
338
  [ -n "$cancelled" ] && exit 1
307
339
 
308
- echo "${GREEN}All checks concluded, none failed.${OFF}"
340
+ # State the denominator rather than implying one (#1363). A green that does not
341
+ # say what it looked at cannot be told apart from a green that looked at less
342
+ # than it should have — and this script spent months collapsing a running run out
343
+ # of its own input without ever mentioning that it had collapsed anything.
344
+ runs_seen=$(printf '%s\n' "$rollup" | awk -F'\t' 'NF { s += ($3 == "" ? 1 : $3) } END { print s + 0 }')
345
+ echo "${GREEN}All checks concluded, none failed.${OFF} ${DIM}($count context(s), $runs_seen run(s)).${OFF}"
346
+ printf '%s\n' "$rollup" | awk -F'\t' 'NF && $3 > 1 { print " " $1 ": " $3 " runs, newest used" }'
309
347
  exit 0