Add CTO Case adapter contract

This commit is contained in:
Svrnty
2026-05-31 18:47:43 -04:00
parent c5a9f637ea
commit 44ad43d958
4 changed files with 193 additions and 3 deletions
+34
View File
@@ -20,6 +20,7 @@ REQUIRED_FILES = [
"sot/03-PROTOCOLS/CTO-CASE-CANDIDATE-BACKEND-ISSUES.md",
"sot/03-PROTOCOLS/CTO-HARNESS-EVIDENCE-INTERFACE-CONTRACT.md",
"sot/03-PROTOCOLS/CTO-CASE-SOURCE-ADMISSION-RECORD.md",
"sot/03-PROTOCOLS/CTO-CASE-ADAPTER-CONTRACT.md",
]
REQUIRED_BRIEF_PHRASES = [
@@ -97,6 +98,27 @@ REQUIRED_SOURCE_ADMISSION_PHRASES = [
"No moving branch reference may be used as proof without a pinned commit or tag.",
]
REQUIRED_ADAPTER_CONTRACT_PHRASES = [
"Local planning SOT only. Not a Core Protocol. Not active Core authority.",
"This contract does not authorize Runtime behavior",
"register backend id `case` as a gated engine before execution",
"require the harness to accept `--engine case` only when explicitly enabled",
"prevent a parallel runner path outside the existing harness seam",
"`case` must be disabled by default.",
"No missing gate may degrade to a warning. Missing gate means blocked.",
"Adapter Input Contract",
"Adapter Output Contract",
"CTO Eligibility Decision",
"`selected_backend`",
"`denied_backends`",
"`required_gates`",
"`missing_gates`",
"`allowed_mutation_mode`",
"Case must not create or override the Eligibility Decision.",
"Case may recommend. Case must not approve itself or select its own authority.",
"This contract deliberately does not create `case-engine.sh`.",
]
def main() -> int:
checked: list[str] = []
@@ -164,6 +186,16 @@ def main() -> int:
if phrase not in text:
errors.append(f"missing_source_admission_phrase:{phrase}")
adapter_contract = ROOT / "sot/03-PROTOCOLS/CTO-CASE-ADAPTER-CONTRACT.md"
if adapter_contract.is_file():
text = adapter_contract.read_text(encoding="utf-8")
if "core_promotion_status: not-promoted" not in text:
errors.append("adapter_contract_missing_not_promoted_frontmatter")
for phrase in REQUIRED_ADAPTER_CONTRACT_PHRASES:
checked.append(f"adapter_contract_phrase:{phrase}")
if phrase not in text:
errors.append(f"missing_adapter_contract_phrase:{phrase}")
board = ROOT / "WORKBOARD.yaml"
if board.is_file():
text = board.read_text(encoding="utf-8")
@@ -177,6 +209,8 @@ def main() -> int:
errors.append("workboard_cto_work_004_not_validated")
if "CTO-CASE-SOURCE-ADMISSION-RECORD.md" not in text:
errors.append("workboard_missing_source_admission_record_source")
if "CTO-CASE-ADAPTER-CONTRACT.md" not in text:
errors.append("workboard_missing_adapter_contract_source")
payload = {
"ok": not errors,