@biffo/cli 0.211.7 → 0.212.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.
|
@@ -81,6 +81,11 @@ LIST=""
|
|
|
81
81
|
FAILED=""
|
|
82
82
|
PASSED=""
|
|
83
83
|
SKIPPED=""
|
|
84
|
+
# Checks that were APPLICABLE and did not run. Kept apart from SKIPPED because
|
|
85
|
+
# the summary must not print "not applicable here: pg-test" about a lane this
|
|
86
|
+
# repo demonstrably has -- absence and blindness reading identically is the
|
|
87
|
+
# defect, not a formatting nit.
|
|
88
|
+
NOT_RUN=""
|
|
84
89
|
# Defined up here, not inside run_check. `run_check` returns EARLY in --list
|
|
85
90
|
# mode, before it would set this -- so `pytest_record "$d" "$LAST_CHECK_SECONDS"`
|
|
86
91
|
# read an unset variable and `set -u` killed the script silently, mid-list.
|
|
@@ -404,6 +409,120 @@ else
|
|
|
404
409
|
skip python "no pyproject.toml anywhere in this repo"
|
|
405
410
|
fi
|
|
406
411
|
|
|
412
|
+
# Postgres-dependent tests -- the lane a SQLite suite cannot stand in for.
|
|
413
|
+
#
|
|
414
|
+
# Tests that assert on row-level security, real DDL, or anything the app leaves
|
|
415
|
+
# to Postgres only mean something against Postgres. They are selected by the
|
|
416
|
+
# same CONVENTION their CI lane uses -- a module needing real Postgres is named
|
|
417
|
+
# `test_*_pg.py` -- rather than a hand-maintained list, which is a fail-open
|
|
418
|
+
# waiting to happen: add a Postgres test, forget the list, and it skips locally
|
|
419
|
+
# and runs nowhere.
|
|
420
|
+
#
|
|
421
|
+
# Why this is here at all. On 2026-08-02 **9 of 13** locally-catchable failing
|
|
422
|
+
# CI steps across the estate were this lane, every one of them a genuine
|
|
423
|
+
# assertion failure on a feature branch that a local run would have caught. The
|
|
424
|
+
# gate simply did not run it: `verify.sh` had no reference to Postgres in any
|
|
425
|
+
# form, so a required check that costs a full CI round trip had no local
|
|
426
|
+
# counterpart. Measured on tabsii-platform: schema build ~2s, 310 tests ~28s.
|
|
427
|
+
#
|
|
428
|
+
# The budget is deliberately its own, and larger than pytest's. `pytest_is_fast`
|
|
429
|
+
# excludes a suite over 15s because a slow unit suite slows every push for a
|
|
430
|
+
# class of failure the fast checks mostly catch first; this lane is the opposite
|
|
431
|
+
# trade -- it is the ONLY local sight of a required check, and 30s against a
|
|
432
|
+
# ~7-minute CI round trip pays for itself the first time it fires.
|
|
433
|
+
PG_TEST_BUDGET_SECONDS="${BIFFO_VERIFY_PG_BUDGET:-120}"
|
|
434
|
+
PG_TEST_DSN="${BIFFO_TEST_PG_DSN:-${TABSII_TEST_PG_DSN:-}}"
|
|
435
|
+
|
|
436
|
+
# `.claude/worktrees` is excluded alongside `.worktrees`, and finding out why
|
|
437
|
+
# cost a wrong answer: tabsii-platform reported **66** modules where its CI lane
|
|
438
|
+
# runs 40, because an agent tool keeps its worktrees INSIDE the repo under
|
|
439
|
+
# `.claude/`. A gate that runs a stale nested checkout's copy of a test would
|
|
440
|
+
# fail a push over code that is not being pushed -- and the first such false
|
|
441
|
+
# positive is what teaches people to reach for BIFFO_SKIP_VERIFY.
|
|
442
|
+
pg_test_modules() {
|
|
443
|
+
find . -name 'test_*_pg.py' \
|
|
444
|
+
-not -path "*/node_modules/*" -not -path "*/.venv/*" \
|
|
445
|
+
-not -path "*/.worktrees/*" -not -path "*/.claude/*" -not -path "*/.git/*" 2>/dev/null | sort
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
# Assert the lane EXERCISED something, not merely that pytest exited 0.
|
|
449
|
+
#
|
|
450
|
+
# Both inputs degrade to empty silently: a DSN pointing at a database whose
|
|
451
|
+
# schema never built makes every module skip, and pytest reports "0 passed" as
|
|
452
|
+
# success. A green gate that ran nothing is the exact shape this whole lane
|
|
453
|
+
# exists to end, so the summary line is asserted rather than trusted -- the same
|
|
454
|
+
# assertions its CI workflow makes, for the same reason.
|
|
455
|
+
pg_test_run() {
|
|
456
|
+
_out="/tmp/biffo-verify-pg.$$"
|
|
457
|
+
if ! TABSII_TEST_PG_DSN="$PG_TEST_DSN" BIFFO_TEST_PG_DSN="$PG_TEST_DSN" \
|
|
458
|
+
timeout "$PG_TEST_BUDGET_SECONDS" uv run --directory "$1" pytest -q $2 >"$_out" 2>&1; then
|
|
459
|
+
cat "$_out"
|
|
460
|
+
rm -f "$_out"
|
|
461
|
+
return 1
|
|
462
|
+
fi
|
|
463
|
+
if grep -qiE '[0-9]+ skipped' "$_out"; then
|
|
464
|
+
echo "A Postgres module reported skips -- the lane exercised nothing."
|
|
465
|
+
echo "The DSN is set but the database is probably missing its schema."
|
|
466
|
+
tail -5 "$_out"
|
|
467
|
+
rm -f "$_out"
|
|
468
|
+
return 1
|
|
469
|
+
fi
|
|
470
|
+
if ! grep -qE '[0-9]+ passed' "$_out"; then
|
|
471
|
+
echo "No tests passed -- the lane did not run."
|
|
472
|
+
tail -5 "$_out"
|
|
473
|
+
rm -f "$_out"
|
|
474
|
+
return 1
|
|
475
|
+
fi
|
|
476
|
+
rm -f "$_out"
|
|
477
|
+
return 0
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
_pg_modules=$(pg_test_modules)
|
|
481
|
+
# Order matters, and getting it wrong made these very tests machine-dependent:
|
|
482
|
+
# with `uv not installed` checked FIRST, a runner without uv skipped quietly and
|
|
483
|
+
# the gap warning never printed -- green on a workstation, red on CI, for a
|
|
484
|
+
# reason unconnected to the change. "This repo has a lane and nothing local is
|
|
485
|
+
# checking it" is true whether or not uv is installed, and it is the more
|
|
486
|
+
# actionable of the two, so it is reported first. `uv` is only required to
|
|
487
|
+
# actually RUN the lane.
|
|
488
|
+
if [ -z "$_pg_modules" ]; then
|
|
489
|
+
skip pg-test "no Postgres-dependent tests (test_*_pg.py) in this repo"
|
|
490
|
+
elif [ -z "$PG_TEST_DSN" ]; then
|
|
491
|
+
# NOT a quiet `--`. Every other skip in this file means "this repo does not
|
|
492
|
+
# have the thing"; this one means "this repo HAS the thing and the gate is
|
|
493
|
+
# blind to it", which is the fail-open shape, and printing the two the same
|
|
494
|
+
# way is how a gap gets read as coverage. It stays a skip rather than a
|
|
495
|
+
# failure because a push must not be blocked by a database being down -- but
|
|
496
|
+
# it says so where it cannot be missed, and names the command that fixes it.
|
|
497
|
+
if [ -z "$LIST" ]; then
|
|
498
|
+
NOT_RUN="$NOT_RUN pg-test"
|
|
499
|
+
printf ' \033[33mWARN\033[0m %-16s NOT RUN - %s Postgres module(s) present, no DSN set\n' \
|
|
500
|
+
"pg-test" "$(echo "$_pg_modules" | wc -l | tr -d ' ')"
|
|
501
|
+
printf ' \033[33m%s\033[0m\n' \
|
|
502
|
+
"CI runs these as a required check; nothing local is checking them."
|
|
503
|
+
printf ' \033[90m%s\033[0m\n' \
|
|
504
|
+
"set BIFFO_TEST_PG_DSN, or run scripts/pg-test-db.sh if this repo ships one"
|
|
505
|
+
fi
|
|
506
|
+
elif ! command -v uv >/dev/null 2>&1; then
|
|
507
|
+
skip pg-test "uv not installed"
|
|
508
|
+
else
|
|
509
|
+
# Run from the uv project that owns the modules, with paths relative to it, so
|
|
510
|
+
# this works wherever a repo keeps its API (root here, services/api in every
|
|
511
|
+
# instance and sibling).
|
|
512
|
+
_pg_dir=$(echo "$_pg_modules" | head -1)
|
|
513
|
+
while [ "$_pg_dir" != "." ] && [ "$_pg_dir" != "/" ]; do
|
|
514
|
+
_pg_dir=$(dirname "$_pg_dir")
|
|
515
|
+
[ -f "$_pg_dir/pyproject.toml" ] && break
|
|
516
|
+
done
|
|
517
|
+
if [ ! -f "$_pg_dir/pyproject.toml" ]; then
|
|
518
|
+
skip pg-test "no pyproject.toml above the Postgres modules"
|
|
519
|
+
else
|
|
520
|
+
_pg_rel=$(echo "$_pg_modules" | sed "s|^$_pg_dir/||" | tr '\n' ' ')
|
|
521
|
+
# shellcheck disable=SC2086
|
|
522
|
+
run_check pg-test pg_test_run "$_pg_dir" "$_pg_rel"
|
|
523
|
+
fi
|
|
524
|
+
fi
|
|
525
|
+
|
|
407
526
|
# Terraform, wherever this repo keeps it: modules/ in the template and
|
|
408
527
|
# instances, infra/ and modules/ in siblings.
|
|
409
528
|
if [ -n "$LIST" ] || command -v terraform >/dev/null 2>&1; then
|
|
@@ -602,6 +721,7 @@ if [ -z "$PASSED" ]; then
|
|
|
602
721
|
fi
|
|
603
722
|
printf '\033[32mverify passed\033[0m -%s\n' "$PASSED"
|
|
604
723
|
[ -n "$SKIPPED" ] && printf '\033[90mnot applicable here:%s\033[0m\n' "$SKIPPED"
|
|
724
|
+
[ -n "$NOT_RUN" ] && printf '\033[33mAPPLICABLE BUT NOT RUN:%s - CI checks this and the gate did not\033[0m\n' "$NOT_RUN"
|
|
605
725
|
# Say which question was answered. Without this, a repo whose ci.yml was deleted
|
|
606
726
|
# prints exactly what a fully-mirrored repo prints (#942).
|
|
607
727
|
[ -n "${NO_CI:-}" ] && printf '\033[33mno ci.yml - nothing to mirror, so every applicable check ran as\nbest-effort. This is NOT evidence that CI requires them. If this repo is\nmeant to have CI, its workflow is missing.\033[0m\n'
|
|
@@ -81,6 +81,11 @@ LIST=""
|
|
|
81
81
|
FAILED=""
|
|
82
82
|
PASSED=""
|
|
83
83
|
SKIPPED=""
|
|
84
|
+
# Checks that were APPLICABLE and did not run. Kept apart from SKIPPED because
|
|
85
|
+
# the summary must not print "not applicable here: pg-test" about a lane this
|
|
86
|
+
# repo demonstrably has -- absence and blindness reading identically is the
|
|
87
|
+
# defect, not a formatting nit.
|
|
88
|
+
NOT_RUN=""
|
|
84
89
|
# Defined up here, not inside run_check. `run_check` returns EARLY in --list
|
|
85
90
|
# mode, before it would set this -- so `pytest_record "$d" "$LAST_CHECK_SECONDS"`
|
|
86
91
|
# read an unset variable and `set -u` killed the script silently, mid-list.
|
|
@@ -404,6 +409,120 @@ else
|
|
|
404
409
|
skip python "no pyproject.toml anywhere in this repo"
|
|
405
410
|
fi
|
|
406
411
|
|
|
412
|
+
# Postgres-dependent tests -- the lane a SQLite suite cannot stand in for.
|
|
413
|
+
#
|
|
414
|
+
# Tests that assert on row-level security, real DDL, or anything the app leaves
|
|
415
|
+
# to Postgres only mean something against Postgres. They are selected by the
|
|
416
|
+
# same CONVENTION their CI lane uses -- a module needing real Postgres is named
|
|
417
|
+
# `test_*_pg.py` -- rather than a hand-maintained list, which is a fail-open
|
|
418
|
+
# waiting to happen: add a Postgres test, forget the list, and it skips locally
|
|
419
|
+
# and runs nowhere.
|
|
420
|
+
#
|
|
421
|
+
# Why this is here at all. On 2026-08-02 **9 of 13** locally-catchable failing
|
|
422
|
+
# CI steps across the estate were this lane, every one of them a genuine
|
|
423
|
+
# assertion failure on a feature branch that a local run would have caught. The
|
|
424
|
+
# gate simply did not run it: `verify.sh` had no reference to Postgres in any
|
|
425
|
+
# form, so a required check that costs a full CI round trip had no local
|
|
426
|
+
# counterpart. Measured on tabsii-platform: schema build ~2s, 310 tests ~28s.
|
|
427
|
+
#
|
|
428
|
+
# The budget is deliberately its own, and larger than pytest's. `pytest_is_fast`
|
|
429
|
+
# excludes a suite over 15s because a slow unit suite slows every push for a
|
|
430
|
+
# class of failure the fast checks mostly catch first; this lane is the opposite
|
|
431
|
+
# trade -- it is the ONLY local sight of a required check, and 30s against a
|
|
432
|
+
# ~7-minute CI round trip pays for itself the first time it fires.
|
|
433
|
+
PG_TEST_BUDGET_SECONDS="${BIFFO_VERIFY_PG_BUDGET:-120}"
|
|
434
|
+
PG_TEST_DSN="${BIFFO_TEST_PG_DSN:-${TABSII_TEST_PG_DSN:-}}"
|
|
435
|
+
|
|
436
|
+
# `.claude/worktrees` is excluded alongside `.worktrees`, and finding out why
|
|
437
|
+
# cost a wrong answer: tabsii-platform reported **66** modules where its CI lane
|
|
438
|
+
# runs 40, because an agent tool keeps its worktrees INSIDE the repo under
|
|
439
|
+
# `.claude/`. A gate that runs a stale nested checkout's copy of a test would
|
|
440
|
+
# fail a push over code that is not being pushed -- and the first such false
|
|
441
|
+
# positive is what teaches people to reach for BIFFO_SKIP_VERIFY.
|
|
442
|
+
pg_test_modules() {
|
|
443
|
+
find . -name 'test_*_pg.py' \
|
|
444
|
+
-not -path "*/node_modules/*" -not -path "*/.venv/*" \
|
|
445
|
+
-not -path "*/.worktrees/*" -not -path "*/.claude/*" -not -path "*/.git/*" 2>/dev/null | sort
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
# Assert the lane EXERCISED something, not merely that pytest exited 0.
|
|
449
|
+
#
|
|
450
|
+
# Both inputs degrade to empty silently: a DSN pointing at a database whose
|
|
451
|
+
# schema never built makes every module skip, and pytest reports "0 passed" as
|
|
452
|
+
# success. A green gate that ran nothing is the exact shape this whole lane
|
|
453
|
+
# exists to end, so the summary line is asserted rather than trusted -- the same
|
|
454
|
+
# assertions its CI workflow makes, for the same reason.
|
|
455
|
+
pg_test_run() {
|
|
456
|
+
_out="/tmp/biffo-verify-pg.$$"
|
|
457
|
+
if ! TABSII_TEST_PG_DSN="$PG_TEST_DSN" BIFFO_TEST_PG_DSN="$PG_TEST_DSN" \
|
|
458
|
+
timeout "$PG_TEST_BUDGET_SECONDS" uv run --directory "$1" pytest -q $2 >"$_out" 2>&1; then
|
|
459
|
+
cat "$_out"
|
|
460
|
+
rm -f "$_out"
|
|
461
|
+
return 1
|
|
462
|
+
fi
|
|
463
|
+
if grep -qiE '[0-9]+ skipped' "$_out"; then
|
|
464
|
+
echo "A Postgres module reported skips -- the lane exercised nothing."
|
|
465
|
+
echo "The DSN is set but the database is probably missing its schema."
|
|
466
|
+
tail -5 "$_out"
|
|
467
|
+
rm -f "$_out"
|
|
468
|
+
return 1
|
|
469
|
+
fi
|
|
470
|
+
if ! grep -qE '[0-9]+ passed' "$_out"; then
|
|
471
|
+
echo "No tests passed -- the lane did not run."
|
|
472
|
+
tail -5 "$_out"
|
|
473
|
+
rm -f "$_out"
|
|
474
|
+
return 1
|
|
475
|
+
fi
|
|
476
|
+
rm -f "$_out"
|
|
477
|
+
return 0
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
_pg_modules=$(pg_test_modules)
|
|
481
|
+
# Order matters, and getting it wrong made these very tests machine-dependent:
|
|
482
|
+
# with `uv not installed` checked FIRST, a runner without uv skipped quietly and
|
|
483
|
+
# the gap warning never printed -- green on a workstation, red on CI, for a
|
|
484
|
+
# reason unconnected to the change. "This repo has a lane and nothing local is
|
|
485
|
+
# checking it" is true whether or not uv is installed, and it is the more
|
|
486
|
+
# actionable of the two, so it is reported first. `uv` is only required to
|
|
487
|
+
# actually RUN the lane.
|
|
488
|
+
if [ -z "$_pg_modules" ]; then
|
|
489
|
+
skip pg-test "no Postgres-dependent tests (test_*_pg.py) in this repo"
|
|
490
|
+
elif [ -z "$PG_TEST_DSN" ]; then
|
|
491
|
+
# NOT a quiet `--`. Every other skip in this file means "this repo does not
|
|
492
|
+
# have the thing"; this one means "this repo HAS the thing and the gate is
|
|
493
|
+
# blind to it", which is the fail-open shape, and printing the two the same
|
|
494
|
+
# way is how a gap gets read as coverage. It stays a skip rather than a
|
|
495
|
+
# failure because a push must not be blocked by a database being down -- but
|
|
496
|
+
# it says so where it cannot be missed, and names the command that fixes it.
|
|
497
|
+
if [ -z "$LIST" ]; then
|
|
498
|
+
NOT_RUN="$NOT_RUN pg-test"
|
|
499
|
+
printf ' \033[33mWARN\033[0m %-16s NOT RUN - %s Postgres module(s) present, no DSN set\n' \
|
|
500
|
+
"pg-test" "$(echo "$_pg_modules" | wc -l | tr -d ' ')"
|
|
501
|
+
printf ' \033[33m%s\033[0m\n' \
|
|
502
|
+
"CI runs these as a required check; nothing local is checking them."
|
|
503
|
+
printf ' \033[90m%s\033[0m\n' \
|
|
504
|
+
"set BIFFO_TEST_PG_DSN, or run scripts/pg-test-db.sh if this repo ships one"
|
|
505
|
+
fi
|
|
506
|
+
elif ! command -v uv >/dev/null 2>&1; then
|
|
507
|
+
skip pg-test "uv not installed"
|
|
508
|
+
else
|
|
509
|
+
# Run from the uv project that owns the modules, with paths relative to it, so
|
|
510
|
+
# this works wherever a repo keeps its API (root here, services/api in every
|
|
511
|
+
# instance and sibling).
|
|
512
|
+
_pg_dir=$(echo "$_pg_modules" | head -1)
|
|
513
|
+
while [ "$_pg_dir" != "." ] && [ "$_pg_dir" != "/" ]; do
|
|
514
|
+
_pg_dir=$(dirname "$_pg_dir")
|
|
515
|
+
[ -f "$_pg_dir/pyproject.toml" ] && break
|
|
516
|
+
done
|
|
517
|
+
if [ ! -f "$_pg_dir/pyproject.toml" ]; then
|
|
518
|
+
skip pg-test "no pyproject.toml above the Postgres modules"
|
|
519
|
+
else
|
|
520
|
+
_pg_rel=$(echo "$_pg_modules" | sed "s|^$_pg_dir/||" | tr '\n' ' ')
|
|
521
|
+
# shellcheck disable=SC2086
|
|
522
|
+
run_check pg-test pg_test_run "$_pg_dir" "$_pg_rel"
|
|
523
|
+
fi
|
|
524
|
+
fi
|
|
525
|
+
|
|
407
526
|
# Terraform, wherever this repo keeps it: modules/ in the template and
|
|
408
527
|
# instances, infra/ and modules/ in siblings.
|
|
409
528
|
if [ -n "$LIST" ] || command -v terraform >/dev/null 2>&1; then
|
|
@@ -602,6 +721,7 @@ if [ -z "$PASSED" ]; then
|
|
|
602
721
|
fi
|
|
603
722
|
printf '\033[32mverify passed\033[0m -%s\n' "$PASSED"
|
|
604
723
|
[ -n "$SKIPPED" ] && printf '\033[90mnot applicable here:%s\033[0m\n' "$SKIPPED"
|
|
724
|
+
[ -n "$NOT_RUN" ] && printf '\033[33mAPPLICABLE BUT NOT RUN:%s - CI checks this and the gate did not\033[0m\n' "$NOT_RUN"
|
|
605
725
|
# Say which question was answered. Without this, a repo whose ci.yml was deleted
|
|
606
726
|
# prints exactly what a fully-mirrored repo prints (#942).
|
|
607
727
|
[ -n "${NO_CI:-}" ] && printf '\033[33mno ci.yml - nothing to mirror, so every applicable check ran as\nbest-effort. This is NOT evidence that CI requires them. If this repo is\nmeant to have CI, its workflow is missing.\033[0m\n'
|