@biffo/cli 0.252.2 → 0.252.4

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 (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/verify.sh +85 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.252.2",
3
+ "version": "0.252.4",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/scripts/verify.sh CHANGED
@@ -242,6 +242,14 @@ SKIPPED=""
242
242
  # repo demonstrably has -- absence and blindness reading identically is the
243
243
  # defect, not a formatting nit.
244
244
  NOT_RUN=""
245
+ # Checks that DID run but could not produce a verdict -- kept apart from
246
+ # FAILED because "cannot tell" and "found something wrong" are different
247
+ # facts, and #703 recorded the cost of rendering them the same: a killed
248
+ # pg-test lane printed `verify failed: pg-test` naming no failing test, and
249
+ # sent the reader hunting a bug that was never there. Same convention
250
+ # `wait-for-checks.sh` and `branch-health.sh` already use: a distinct bucket,
251
+ # a distinct exit code (2), and it is NEVER treated as a pass.
252
+ INCONCLUSIVE=""
245
253
  # Defined up here, not inside run_check. `run_check` returns EARLY in --list
246
254
  # mode, before it would set this -- so `pytest_record "$d" "$LAST_CHECK_SECONDS"`
247
255
  # read an unset variable and `set -u` killed the script silently, mid-list.
@@ -657,14 +665,23 @@ fi
657
665
  # assertion failure on a feature branch that a local run would have caught. The
658
666
  # gate simply did not run it: `verify.sh` had no reference to Postgres in any
659
667
  # form, so a required check that costs a full CI round trip had no local
660
- # counterpart. Measured on tabsii-platform: schema build ~2s, 310 tests ~28s.
668
+ # counterpart.
661
669
  #
662
670
  # The budget is deliberately its own, and larger than pytest's. `pytest_is_fast`
663
671
  # excludes a suite over 15s because a slow unit suite slows every push for a
664
672
  # class of failure the fast checks mostly catch first; this lane is the opposite
665
- # trade -- it is the ONLY local sight of a required check, and 30s against a
666
- # ~7-minute CI round trip pays for itself the first time it fires.
667
- PG_TEST_BUDGET_SECONDS="${BIFFO_VERIFY_PG_BUDGET:-120}"
673
+ # trade -- it is the ONLY local sight of a required check, and paying tens of
674
+ # seconds against a ~7-minute CI round trip pays for itself the first time it
675
+ # fires.
676
+ #
677
+ # Re-measured 2026-08-06 (#703): tabsii-platform's lane had grown from the
678
+ # 310 tests / ~28s this number was originally chosen against to 791-805 tests
679
+ # in one day, and six consecutive runs came in at 93, 101, 105, 107, 107, 108s
680
+ # -- against the 120s budget that left as little as 12s of margin, and
681
+ # shrinking with every test the suite gains. Doubled to 240s, the same
682
+ # doubling this file already suggests as the retry (below) -- comfortable
683
+ # headroom today, and re-measure this comment again once it stops being so.
684
+ PG_TEST_BUDGET_SECONDS="${BIFFO_VERIFY_PG_BUDGET:-240}"
668
685
  PG_TEST_DSN="${BIFFO_TEST_PG_DSN:-${TABSII_TEST_PG_DSN:-}}"
669
686
 
670
687
  # `.claude/worktrees` is excluded alongside `.worktrees`, and finding out why
@@ -702,7 +719,17 @@ pg_test_run() {
702
719
  # tabsii-platform (#703) -- the same push succeeded on retry, unchanged.
703
720
  #
704
721
  # Same discipline as `wait-for-checks` and the dependency audits: "could not
705
- # determine" must never wear the clothes of "found something wrong".
722
+ # determine" must never wear the clothes of "found something wrong" -- and
723
+ # since that discipline is a distinct EXIT STATUS everywhere else in this
724
+ # estate (2 = cannot tell, never a pass), not just a distinct message, this
725
+ # returns 2 rather than 1. The message alone was #1346's fix; it left the
726
+ # exit code lumped in with a real failure because `run_check`'s generic
727
+ # caller only sees pass/fail -- the pg-test call site below now reads this
728
+ # return value directly instead of going through it, precisely so a timeout
729
+ # can carry its own status without teaching every OTHER check (ruff, pyright,
730
+ # bandit, pytest, terraform fmt, ...) that exit 2 means something different
731
+ # from a real failure, when several of those tools already use 2 for their
732
+ # OWN internal errors.
706
733
  if [ "$_pg_rc" -eq 124 ] || [ "$_pg_rc" -eq 137 ]; then
707
734
  echo "TIMED OUT after ${_pg_elapsed}s (budget ${PG_TEST_BUDGET_SECONDS}s)."
708
735
  echo ""
@@ -720,7 +747,7 @@ pg_test_run() {
720
747
  echo "Partial output before the kill (NOT a result):"
721
748
  tail -15 "$_out"
722
749
  rm -f "$_out"
723
- return 1
750
+ return 2
724
751
  fi
725
752
 
726
753
  if [ "$_pg_rc" -ne 0 ]; then
@@ -847,8 +874,42 @@ else
847
874
  skip pg-test "no pyproject.toml above the Postgres modules"
848
875
  else
849
876
  _pg_rel=$(echo "$_pg_modules" | sed "s|^$_pg_dir/||" | tr '\n' ' ')
850
- # shellcheck disable=SC2086
851
- run_check pg-test pg_test_run "$_pg_dir" "$_pg_rel"
877
+ # Not a plain `run_check` call: `pg_test_run` returns THREE states (0 pass,
878
+ # 1 real failure, 2 timed out/inconclusive -- see its own comment), and
879
+ # `run_check` only ever sees pass/fail, so routing through it would collapse
880
+ # a timeout back into FAILED and reproduce the exact #703 defect this whole
881
+ # change exists to fix. This reads the return code directly instead.
882
+ if [ -n "$LIST" ]; then
883
+ # shellcheck disable=SC2086
884
+ echo pg_test_run "$_pg_dir" "$_pg_rel"
885
+ else
886
+ _pg_check_start=$(date +%s)
887
+ # shellcheck disable=SC2086
888
+ pg_test_run "$_pg_dir" "$_pg_rel" >"/tmp/biffo-verify-pg-check.$$" 2>&1
889
+ _pg_check_rc=$?
890
+ _pg_check_elapsed=$(($(date +%s) - _pg_check_start))
891
+ case "$_pg_check_rc" in
892
+ 0)
893
+ PASSED="$PASSED pg-test"
894
+ printf ' \033[32mOK\033[0m %-16s %ss\n' "pg-test" "$_pg_check_elapsed"
895
+ ;;
896
+ 2)
897
+ # Cannot tell -- never a pass, and deliberately never FAILED either.
898
+ # pg_test_run's own output already explains why and how to re-run,
899
+ # so it is printed in full here rather than truncated the way a
900
+ # genuine failure's output is below.
901
+ INCONCLUSIVE="$INCONCLUSIVE pg-test"
902
+ printf ' \033[33mINCONCLUSIVE\033[0m %-16s %ss\n' "pg-test" "$_pg_check_elapsed"
903
+ sed 's/^/ /' "/tmp/biffo-verify-pg-check.$$"
904
+ ;;
905
+ *)
906
+ FAILED="$FAILED pg-test"
907
+ printf ' \033[31mFAIL\033[0m %-16s %ss\n' "pg-test" "$_pg_check_elapsed"
908
+ sed 's/^/ /' "/tmp/biffo-verify-pg-check.$$" | tail -25
909
+ ;;
910
+ esac
911
+ rm -f "/tmp/biffo-verify-pg-check.$$"
912
+ fi
852
913
  fi
853
914
  fi
854
915
 
@@ -1106,6 +1167,22 @@ if [ -n "$FAILED" ]; then
1106
1167
  printf 'Most format failures are one command: pnpm run format\n\n'
1107
1168
  exit 1
1108
1169
  fi
1170
+ if [ -n "$INCONCLUSIVE" ]; then
1171
+ # A real FAILED above always wins this race -- it is the more actionable
1172
+ # fact and must not be buried under a lane that merely ran out of time. Only
1173
+ # once nothing genuinely failed does "could not tell" get to speak for the
1174
+ # whole run, and even then it is never a pass: same three-valued contract as
1175
+ # `wait-for-checks.sh` and `branch-health.sh` (0 green, 1 failed, 2 cannot
1176
+ # tell), and `cli/src/lib/packaged-script-command.ts` already promises every
1177
+ # script reached through `scripts/biffo.sh` passes its exit code through
1178
+ # unchanged -- so this is not a new contract, it is this file finally
1179
+ # keeping the one that already existed.
1180
+ printf '\033[33mverify inconclusive:\033[0m%s\n' "$INCONCLUSIVE"
1181
+ printf 'Not a failure -- the lane above could not produce a verdict (see its own\n'
1182
+ printf 'output, printed above, for why and what to do about it). Do not go\n'
1183
+ printf 'looking for a bug on this evidence; re-run once the cause is addressed.\n\n'
1184
+ exit 2
1185
+ fi
1109
1186
  if [ -z "$PASSED" ]; then
1110
1187
  # "Nothing applicable ran" is a different outcome from "checks passed", and
1111
1188
  # conflating them is the exact failure this gate exists to remove -- the