From fa0f85573c29515dabdd54675c67ee69b94ebd83 Mon Sep 17 00:00:00 2001 From: Shay Date: Sat, 25 Jul 2026 16:47:01 -0700 Subject: [PATCH] fix(deduction-serve): resolve assert_corpus_sound name collision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two unrelated functions shared the name assert_corpus_sound: the practice-corpus soundness check in evals/deduction_serve/practice/gold.py (no args) and the curriculum lane's case-contract check in evals/curriculum_serve/runner.py (domain, cases). Renamed to assert_practice_gold_sound and assert_lane_cases_sound respectively so each name states what it validates, and updated all call sites, the gold.py __all__ export, and two prose mentions that named the function. [Verification]: uv run --python 3.12.13 core test --suite smoke -q → 569 passed; --suite deductive -q → 285 passed. --- evals/curriculum_serve/runner.py | 4 ++-- evals/deduction_serve/practice/gold.py | 8 ++++---- evals/deduction_serve/practice/runner.py | 4 ++-- tests/test_deduction_serve_license.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/evals/curriculum_serve/runner.py b/evals/curriculum_serve/runner.py index 83498321..f372c12f 100644 --- a/evals/curriculum_serve/runner.py +++ b/evals/curriculum_serve/runner.py @@ -68,7 +68,7 @@ def assert_provenance(domain: str, cases: list[dict]) -> None: resolve_pinned(curriculum, pinned) # raises UnratifiedChain -def assert_corpus_sound(domain: str, cases: list[dict]) -> None: +def assert_lane_cases_sound(domain: str, cases: list[dict]) -> None: """The independent oracle must re-derive every committed gold (§4.4).""" for case in cases: query = read_curriculum_question(case["text"]) @@ -105,7 +105,7 @@ def assert_anti_recall_coverage(cases: list[dict]) -> None: def build_report(domain: str, cases: list[dict]) -> dict: assert_provenance(domain, cases) - assert_corpus_sound(domain, cases) + assert_lane_cases_sound(domain, cases) assert_anti_recall_coverage(cases) counts = Counter({"correct": 0, "wrong": 0, "declined": 0}) diff --git a/evals/deduction_serve/practice/gold.py b/evals/deduction_serve/practice/gold.py index 381234f6..212b188e 100644 --- a/evals/deduction_serve/practice/gold.py +++ b/evals/deduction_serve/practice/gold.py @@ -119,7 +119,7 @@ _TEMPLATES: dict[str, tuple[tuple[str, Any], ...]] = { # the reader singularizes to ``x3``); ``a, b, c`` are the three distinct # middle/subject/predicate classes. Gold is the unconditional validity (modern # reading) of the standard form — cross-checked against the INDEPENDENT - # syllogism oracle in ``assert_corpus_sound``. + # syllogism oracle in ``assert_practice_gold_sound``. CATEGORICAL: ( # Barbara (AAA) — valid. ("valid", lambda a, b, c: f"All {a}s are {b}s. All {c}s are {a}s. Therefore all {c}s are {b}s."), @@ -180,7 +180,7 @@ def _en_neg(clause: str) -> str: #: English-band templates: (gold, text_builder, intended_premises, intended_query). #: The INTENDED formulas are the template's logical form over fixed placeholder -#: atoms — the reader-independent gold ``assert_corpus_sound`` cross-checks +#: atoms — the reader-independent gold ``assert_practice_gold_sound`` cross-checks #: against the truth-table oracle (INV-25: no reader, no ROBDD involvement). _EN_TEMPLATES: dict[str, tuple[tuple[str, Any, tuple[str, ...], str], ...]] = { EN_CONDITIONAL_SINGLE: ( @@ -1160,7 +1160,7 @@ class ConstructionGoldTether: return str(problem.payload["gold"]) -def assert_corpus_sound() -> None: +def assert_practice_gold_sound() -> None: """Belt-and-suspenders: every generated case's by-construction gold must agree with an INDEPENDENT oracle over its projected form. @@ -1214,6 +1214,6 @@ __all__ = [ "ConstructionGoldTether", "DeductionSolver", "all_gold_problems", - "assert_corpus_sound", + "assert_practice_gold_sound", "generate_problems", ] diff --git a/evals/deduction_serve/practice/runner.py b/evals/deduction_serve/practice/runner.py index 236644e2..0b526b44 100644 --- a/evals/deduction_serve/practice/runner.py +++ b/evals/deduction_serve/practice/runner.py @@ -28,7 +28,7 @@ from evals.deduction_serve.practice.gold import ( ConstructionGoldTether, DeductionSolver, all_gold_problems, - assert_corpus_sound, + assert_practice_gold_sound, ) #: The committed sealed ledger lives next to its serving READER (chat/), mirroring @@ -96,7 +96,7 @@ def build_sealed_artifact() -> dict[str, Any]: def seal_ledger(path: Path = _SEALED_LEDGER_PATH) -> dict[str, Any]: """Regenerate + write the committed sealed ledger. Verifies corpus soundness against the independent oracle first (a mis-stated gold can never seal).""" - assert_corpus_sound() + assert_practice_gold_sound() return write_sealed_ledger(path, build_sealed_artifact()) diff --git a/tests/test_deduction_serve_license.py b/tests/test_deduction_serve_license.py index db5890b7..d9faf2ce 100644 --- a/tests/test_deduction_serve_license.py +++ b/tests/test_deduction_serve_license.py @@ -73,9 +73,9 @@ def test_shape_bands_are_exhaustive_for_the_projector() -> None: def test_corpus_is_sound_against_independent_oracle() -> None: - from evals.deduction_serve.practice.gold import assert_corpus_sound + from evals.deduction_serve.practice.gold import assert_practice_gold_sound - assert_corpus_sound() # raises AssertionError on any mis-stated gold + assert_practice_gold_sound() # raises AssertionError on any mis-stated gold def test_every_band_earns_serve_wrong_zero() -> None: