Files
ledger 5ab4b187c7 beam: add CHECK_DL gate with independent BFS oracle for true DL
The DL module's cells were module-level asserts: run_lane_tests.py --list
reports unittest=0 bare=0 for test_damerau_levenshtein.py, so no named case
moved when the module broke. CHECK_DL runs the shipped cells plus
oracle_dl.py, which grades a deterministic 5300-pair corpus against a BFS
over the edit graph (the definition of true DL) and proves in the same run
that the corpus reds both classic impostors (OSA, plain Levenshtein).

Measured: green on the tree (0/5228 mismatches, 42 OSA witnesses, 252 Lev
witnesses); rc 1 with named witnesses on a transposition-deleted mutant and
on an OSA module.
2026-10-31 02:05:15 +00:00

45 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# CHECK_DL: gate for wizard-work/beam/damerau_levenshtein.py (Q133-DL).
#
# Why this file exists (2026-10-31). The DL module and its cells landed in
# 5bded80, but nothing pinned the *property* the module exists for: the cells
# are module-level asserts that run only when the file is imported, and
# `run_lane_tests.py --list` reports `test_damerau_levenshtein.py unittest=0
# bare=0` -- zero named cases, so the gate's per-test count never moves when
# they break. This gate names the work: the shipped cells run as a script, and
# an independent BFS oracle (oracle_dl.py) grades a deterministic corpus against
# the module and proves, in the same run, that the corpus can red the two
# implementations people ship by mistake (OSA and plain Levenshtein).
#
# Exit codes follow the repo's tools/ contract:
# 0 clean, 1 graded a fault, 2 could not grade.
set -u
set -o pipefail
cd "$(dirname "$(readlink -f "$0")")" || exit 2
if ! command -v python3 >/dev/null 2>&1; then
echo "CHECK_DL: python3 not found -- cannot grade." >&2
exit 2
fi
echo "== shipped cells (test_damerau_levenshtein.py) =="
python3 test_damerau_levenshtein.py
rc=$?
if [ "$rc" -ne 0 ]; then
echo "CHECK_DL: shipped cells failed (rc=$rc)." >&2
exit 1
fi
echo "== independent BFS oracle (oracle_dl.py) =="
python3 oracle_dl.py
rc=$?
case $rc in
0) ;;
1) echo "CHECK_DL: oracle graded a fault -- see MISMATCH/FAIL above." >&2; exit 1 ;;
2) echo "CHECK_DL: oracle could not grade -- see message above." >&2; exit 2 ;;
*) echo "CHECK_DL: oracle exited $rc -- internal error (a fault)." >&2; exit 1 ;;
esac
echo "CHECK_DL: green"