#!/usr/bin/env python3 """Close the #2479 dichotomy-wave construction contract for night_mode with SHA evidence.""" import json import os import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src")) os.environ["CS_RUST_LIB"] = "/mnt/workdrive/rune/src/rust/capability_scoring/target/release/libcapability_scoring.so" from rune.construction_interface import ConstructionInterface cid = sys.argv[1] iface = ConstructionInterface(builder="factory-gap-nm") c = iface.close(cid, observed_evidence=[{ "kind": "port_evidence", "detail": "night_mode dichotomy completion — parity 150f5b86 " "feat(night_mode): close PARTIAL gaps — dichotomy wave; " "Phase B (trunc ASCII zero-alloc fast path, rune walk " "only for long/non-ASCII) pushed gitea/master. Go port at " "src/go/night-mode closes all 12 audit-named gaps " "name-preserving (_ctx_budget, get_night_mode, " "start/stop_night_mode, get_status, get_report, to_dict, " "_load, _save, _run_loop, _run_sleep, _run_evaluation + " "_run_iteration/_generate_report); pure/IO split law with " "injected clock/wait/script/HTTP/rand/loop seams. Battery " "10 tests replay the 9-case frozen oracle truth VERBATIM " "(stop guard, idle status/report, 6 _ctx_budget branches); " "live parity 100% (status/report/stop x 3 scenarios + CLI " "round-trip); pytest 37/37 both ways (RUNE_NIGHT_MODE_CORE " "auto vs =python); gofmt+vet clean. Zero regressions " "(failure set byte-identical before/after).", }], scope_files=[ "src/rune/night_mode.py", "src/go/night-mode/main.go", "src/go/night-mode/night_mode_test.go", "src/go/night-mode/frozen_truth.json", "scripts/gen_night_mode_truth.py", "scripts/check_night_mode_parity.py", "tests/test_night_mode.py", "scripts/open_contract_night_mode.py", "scripts/close_contract_night_mode.py", ]) print("close:", json.dumps(c)[:300]) print("CONTRACT", cid, "closed" if c.get("success") else "CLOSE_FAILED")