"""Host checks for the Issue #259 CD_SUBQ caller ABI ledger (docs/research/cd-subq-contract.md). Pure text checks: the ledger table is parsed and each row's status is validated. No ROM, no emulator, no reference BIOS. A promotion (UNKNOWN/HYPOTHESIS -> SOURCE_FACT without a pinned value, or any VERIFIED/OBSERVED/PASS/DEV_CALLABLE status) must fail these tests. """ import re import unittest from pathlib import Path ROOT = Path(__file__).resolve().parents[2] LEDGER = ROOT / 'docs' / 'research' / 'cd-subq-contract.md' ALLOWED_STATUS = {'SOURCE_FACT', 'HYPOTHESIS', 'UNKNOWN', 'BLOCKED'} FORBIDDEN_STATUS = {'VERIFIED', 'OBSERVED', 'PASS', 'DEV_CALLABLE', 'CALLABLE'} # \b does not split CJK-adjacent text (e.g. 'VERIFIED扱い'), so the boundary is an explicit # ASCII alnum/underscore lookaround: any non-ASCII character counts as a boundary. FORBIDDEN_WORD_RE = re.compile(r'(?