Skip to content

fix(tests): run-full.sh reaches the api/standalone/postgres tiers again; an unreached tier fails the run (#2888) - #2893

Merged
vybe merged 1 commit into
devfrom
fix/2888-run-full-guard-glob
Sep 20, 2026
Merged

vybe merged 1 commit into
devfrom
fix/2888-run-full-guard-glob

Conversation

@dolho

@dolho dolho commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Fixes #2888

What was wrong

tests/run-full.sh cds into tests/ at line 31, then the unclassified-directory guard globbed tests/*/ — i.e. tests/tests/*/, which matches nothing, stays a literal * under default globbing, fails classification and exit 1s the run before run_tier api. Every full-suite run since a646de8 (2026-08-27) skipped the api, standalone and postgres tiers (~1,900 tests) with nothing saying so.

What this does

  • Guard → tests/harness/check_test_dirs.py, handed $TESTS_DIR explicitly (no cwd-relative glob), and unit-tested. Only a directory that holds test_*.py is a finding — __pycache__, reports/, the venv, a stale local checkout with only node_modules exist on every machine and are collected by nothing, so naming them would fail every run (same truncation, sign flipped). An owner entry with no directory on disk is flagged too (a renamed tier dir keeps its --ignore= silently).
  • Tier ledger (AC fix: add missing logging_config.py to backend Dockerfile #4): DECLARED_TIERS is checked against the recorded rows at the end. A declared tier with no row that the caller did not deselect → NEVER RAN, run fails. --tier / --no-pg deselections are listed as SKIP and the verdict reads PASS (partial — … not a full-suite result).
  • Abort trap: any exit before the summary — an exit N, SIGINT, SIGTERM — prints an ABORTED before the summary banner naming the unrun tiers and exits non-zero. The postgres container teardown is folded into it (replaces the per-tier trap … EXIT).
  • Postgres tier actually works again: the alembic step now carries the dummy Redis/encryption env pg-migrations.yml already sets — revision 0041 imports services → config, which raises without Redis creds. Broken since 2026-08-20; found the first time the tier ran again.

Evidence

Unwired dir added temporarily (AC #2) — guard fires, abort ledger names every tier:

== tests/run-full.sh: test-directory wiring is wrong
   unclassified test directories:
     zzz_unwired/
== tests/run-full.sh ABORTED before the summary (exit 1)
   tiers that did not run: unit integration git-sync security scheduler agent-server journeys api standalone postgres
   This is NOT a full-suite result.
exit=1

--tier api --tier standalone --tier postgres -k "test_health or test_admin_login or alembic_heads" — the three previously-unreachable tiers now run:

  api            PASS  17 passed, 1795 deselected, 15 warnings in 16.64s
  standalone     PASS  3 invocation(s)
  postgres       ...   (alembic upgrade head → 0063 OK after the env fix; tier ran to 53% before my 15-min `timeout` cut it)
  unit           SKIP  deselected by --tier
  ...

SIGTERM mid-unit-tier:

.................................................Terminated
== tests/run-full.sh ABORTED before the summary (exit 143)
   tiers that did not run: unit integration git-sync security scheduler agent-server journeys api standalone postgres

tests/unit/test_2080_harness_contract.py: 24 passed (10 new for #2888). Complete tests/run-full.sh run in progress locally (Python 3.12 venv, under TRINITY_TEST_ALLOW_PY_MISMATCH=1); will post the summary in a comment.

🤖 Generated with Claude Code

…in, and a tier it does not reach fails the run (#2888)

Fixes #2888

The unclassified-directory guard globbed `tests/*/` after the script had
already `cd`'d into `tests/`, so it looked for `tests/tests/*/`, matched
nothing, stayed a literal `*` under default globbing, failed
classification and `exit 1`'d the run at the api boundary. Every
full-suite run since a646de8 (2026-08-27) stopped before the `api`,
`standalone` and `postgres` tiers — ~1,900 tests — and nothing said so.

- The guard is now `tests/harness/check_test_dirs.py`, handed TESTS_DIR
  explicitly instead of globbing relative to the cwd, and testable: only
  a directory that HOLDS test files is a finding (`__pycache__`,
  `reports/`, a stale local checkout with only `node_modules` are on
  every machine and collected by nothing), and an owner entry with no
  directory on disk is flagged too (pytest ignores a missing `--ignore=`
  path silently).
- Tier ledger: DECLARED_TIERS is checked against the recorded rows at
  the end. A declared tier with no row that the caller did not deselect
  is reported `NEVER RAN` and fails the run; deselected tiers (`--tier`,
  `--no-pg`) are listed as SKIP and the verdict says `partial`.
- Abort trap: any exit before the summary — including SIGINT/SIGTERM —
  prints an ABORTED banner naming the tiers left unrun and exits
  non-zero. The disposable postgres container is torn down on that path
  too (the old per-tier `trap ... EXIT` is folded into it).
- The alembic step of the postgres tier now carries the same dummy
  Redis/encryption env pg-migrations.yml sets: revision 0041 (#2330)
  imports `services` → `config`, which raises without Redis credentials.
  Broken since 2026-08-20, a week before the tier stopped being reached.

Guards in tests/unit/test_2080_harness_contract.py: the glob is matched
as code (not the comment that names it), the guard passes on the real
tree with the real owner lists, fires on an unwired directory holding
tests, ignores test-less directories, every `run_tier` name is in
DECLARED_TIERS, and the NEVER-RAN / abort paths are present.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@dolho

dolho commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Complete tests/run-full.sh run on this branch — every declared tier now has a row (local stack, Python 3.12 venv under TRINITY_TEST_ALLOW_PY_MISMATCH=1, so flagged as not-clean by the runner itself):

  FULL SUITE SUMMARY  (20260918_103239)
  unit           FAIL  35 failed, 16606 passed, 31 skipped, 1371 warnings in 2277.16s (0:37:57)
  integration    FAIL  1 failed, 71 passed, 13 skipped, 15 warnings in 28.14s
  git-sync       PASS  23 passed, 15 warnings in 0.54s
  security       PASS  7 passed, 4 skipped, 15 warnings in 6.95s
  scheduler      PASS  224 passed, 326 warnings in 13.19s
  agent-server   PASS  14 skipped, 15 warnings in 0.61s
  journeys       FAIL  3 failed, 12 passed, 2 xfailed, 15 warnings in 169.77s (0:02:49)
  api            FAIL  17 failed, 1611 passed, 124 skipped, 33 warnings, 60 errors in 2978.80s (0:49:38)
  standalone     PASS  3 invocation(s)
  postgres       PASS  1212 passed, 5 skipped, 16337 deselected, 636 warnings in 1625.51s (0:27:05)
  skip-audit     FAIL  unallowlisted skip reason(s) — see above
  NOTE: ran on Python 3.12, NOT the image's 3.13
  RESULT: FAIL

The api (1611 passed), standalone and postgres (1212 passed, real alembic upgrade head to 0063) tiers ran for the first time since 2026-08-27 — that is AC #1. RESULT: FAIL is the run doing its job: the red is what the truncation had been hiding, none of it is in this PR's scope (the change touches only the runner, its helper and their tests):

  • api: 50 of the 60 errors are one fixture — sqlite3.OperationalError: no such table: users at test setup (local DB path/fixture, not a product failure).
  • unit: 8× assert {} == {'scout': 'eugene-max'} (local-state dependent), a _is_internal_address boundary parametrisation, the TestTheRuntimeGate[sqlite] trio.
  • journeys: 3 permission-denial journeys got success: True on this stack; integration: one dispatch-breaker dormant-probe assertion.
  • skip-audit: 143 unallowlisted skips, the bulk TEST_AGENT_NAME not set — ensure_test_agent.py got a 401 from the local backend, so agent-dependent tests skipped rather than ran.

Worth separate issues; I have not filed them here so this PR stays the one-line-fix-plus-guard it is.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge-train: batch validated on train/20260920-1811 (#2913)

@vybe
vybe merged commit ac03afc into dev Sep 20, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants