#!/bin/bash # CHECK: verify all beam reliability primitives # # Runner note (Q105, 2026-10-28). This lane writes its tests in two styles: # unittest.TestCase subclasses and bare module-level `def test_*` / `assert`. # `python3 -m unittest discover` collects only the first -- 276 of the 407 # tests the directory held then -- so a green CHECK said nothing about the # other 131, and test_fenwick.py's 8 cells could be broken without moving # the gate. # # Runner note (Q128, 2026-10-30). Q105's repair pointed this gate at pytest, # which collects both styles but is not installed on every interpreter the # gate runs on: here `python3 -m pytest --version` fails, so the gate printed # "pytest not importable -- cannot grade" and exited 2 -- honest, and running # zero of the lane's cells. The gate now runs `run_lane_tests.py`, which # collects both styles itself on the standard library alone (TestLoader for # the TestCase classes, FunctionTestCase for every module-level `def test_*` # with no parameters, and one import-by-path step that turns a module which # will not import into a fault), so the same cells run with or without # pytest. Counts are not pinned here -- the runner prints them every run, # and `python3 run_lane_tests.py --list` prints the collection alone. # # Exit codes follow the repo's tools/ contract: 0 clean, 1 graded a fault # (a failing test, an erroring test, a module that will not import), 2 could # not grade (no python3, no lane directory, no test files). # # `toposort/test_toposort.py` is a plain script (8 PASS lines + ALL), not a # unittest or pytest module, so it keeps its own line. # # Runner note (Q153, 2026-11-02). Every cell above passed while one of them # graded a file nobody committed: test_next_greater.py carried # `sys.path.insert(0, "/root/.hermes/wizard-outputs/beam")` from `096ba9b`, so # this gate's 681 cells read rc 0, and the committed next_greater.py was never # the module read. `check_bindings.py` puts the repo's import-resolve authority # (tools/import_resolve_check.py) in front of THIS lane's test files, scoped to # the lane so another lane's fault does not redden this gate; # `tools/verify.py` still grades the whole tree. # # Runner note (Q85, 2026-11-02). Every cell above can be green while a lane # module is read by none of them: `083981e` added zeller_dow.py, 38 lines, and # this gate printed `Ran 214` before and after. `check_coverage.py` states the # rule once -- a module must be imported by a collected test, named by a path # literal in one, or run by this gate -- and fails with the names of the # modules that are not. Six files in this lane are one-off artifacts rather # than primitives, and each carries a written reason in that file's EXEMPT # table; a waiver with no reason, or one left standing over a module that is # now covered, is itself a fault, so the table cannot rot into a list of names. set -e set -o pipefail cd "$(dirname "$(readlink -f "$0")")" set +e python3 run_lane_tests.py rc=$? set -e case $rc in 0) ;; 1) echo "CHECK: lane tests failed -- see the failure list above (Q105/Q128)." >&2; exit 1 ;; 2) echo "CHECK: could not grade -- see the runner's message above." >&2; exit 2 ;; 127) echo "CHECK: python3 not found -- cannot grade." >&2; exit 2 ;; *) echo "CHECK: run_lane_tests.py exited $rc -- internal error (a fault)." >&2; exit 1 ;; esac set +e python3 check_bindings.py arc=$? set -e case $arc in 0) ;; 1) echo "CHECK: a lane test binds a module outside the repo (Q153)." >&2; exit 1 ;; 2) echo "CHECK: bindings could not be graded -- see the message above." >&2; exit 2 ;; 127) echo "CHECK: python3 not found -- cannot grade." >&2; exit 2 ;; *) echo "CHECK: check_bindings.py exited $arc -- internal error." >&2; exit 1 ;; esac set +e python3 check_coverage.py crc=$? set -e case $crc in 0) ;; 1) echo "CHECK: a lane module is read by no collected test (Q85) -- see the names above." >&2; exit 1 ;; 2) echo "CHECK: coverage could not be graded -- see the message above." >&2; exit 2 ;; 127) echo "CHECK: python3 not found -- cannot grade." >&2; exit 2 ;; *) echo "CHECK: check_coverage.py exited $crc -- internal error." >&2; exit 1 ;; esac python3 toposort/test_toposort.py