core/tests/test_adr_0107_deferral.py
Shay 7cc2f7b422
feat(adr): ADR-0107 mathematics_logic expert-demo promotion deferred (#114)
The ADR-0106 contract correctly refused promotion. ADR-0107 records the
deferral and reserves two follow-up ADRs:

- ADR-0109 (lane-shape-aware threshold amendment): ADR-0106 \xc2\xa71.2
  prescribes cognition-pack-shape metrics uniformly, but math /
  physics / systems / hebrew-greek lanes carry native shapes
  (accuracy, passed_rate, all_pass_rate). Prerequisite for any future
  expert-demo promotion.
- ADR-0110 (math re-attempt): conditional on ADR-0109 landing and
  inference_closure substantively passing (currently all_pass_rate=0.4
  on public).

tests/test_adr_0107_deferral.py pins adr_0107_no_silent_promotion: math
stays at reasoning-capable, has no expert_demo_claims entry, and the
ledger row carries a named refusal reason.

No change to core/capability/expert_demo.py or reporting.py -- the
contract is honored, not amended. README sequencing updated to reflect
ADR-0107 acceptance and the new ADR-0109/0110 prerequisites.
2026-05-22 11:49:37 -07:00

49 lines
1.8 KiB
Python

"""ADR-0107 — `mathematics_logic` expert-demo deferral invariant.
Pins `adr_0107_no_silent_promotion`: the ADR-0107 decision is *defer*,
not promote. If a later change silently flips the math row to
`expert_demo=true` without ADR-0109 + ADR-0110 landing first, this gate
must fail.
This test reads the *live* ledger, not a fixture. A green test asserts
that the contract is behaving as ADR-0107 records: math sits at
`reasoning-capable`, no `expert_demo_claims` entry for math is present,
and the row carries a named refusal reason.
"""
from __future__ import annotations
from core.capability.reporting import ledger_report
from core.capability.reviewers import load_reviewer_registry
from core.capability.sources import LEDGER_SOURCES
from pathlib import Path
_REPO_ROOT = Path(__file__).resolve().parent.parent
def _math_row() -> dict:
report = ledger_report()
for row in report["domains"]:
if row["domain"] == "mathematics_logic":
return row
raise AssertionError("mathematics_logic row missing from ledger_report()")
class TestAdr0107NoSilentPromotion:
def test_math_row_is_reasoning_capable_not_expert_demo(self) -> None:
row = _math_row()
assert row["predicates"]["reasoning_capable"] is True
assert row["predicates"]["expert_demo"] is False
assert row["status"] == "reasoning-capable"
def test_math_has_no_expert_demo_claim(self) -> None:
registry_path = _REPO_ROOT / LEDGER_SOURCES.reviewers
registry = load_reviewer_registry(registry_path)
assert registry.expert_demo_claim_for("mathematics_logic") is None
def test_refusal_reason_is_named(self) -> None:
row = _math_row()
reason = row.get("expert_demo_reason", "")
assert reason, "expert_demo_reason must be populated"
assert reason != "all expert-demo predicates satisfied"