feat(sor): confirmatory data-collection executor (anti-fabrication)

Measures RQ1 bridge-correlation AUC + RQ2 Shannon entropy from REAL
per-hop pcaps of live isolated-docker circuits. run_battery(live=False)
hard-raises and the executor refuses (ExecutorError) any DV it did not
measure — the executor-side twin of the launcher's "never fabricate
cells" guard. Wired into confirmatory_run's triple-locked tokened GO
(executor.run_battery(live=True) behind operator token + verified frozen
prereg SHA + engine!=local + green preflight + full grid).

Containment intact: self-fixture bytes only, isolated engine only, no
external target. Frozen prereg untouched (SHA f22331a72e…).

Verify: test_sor_executor.py 7 + confirmatory_run + full SOR suite = 163
passed; preflight green (grid 3/3, READY); no confirmatory data collected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
leetcrypt
2026-07-19 23:00:39 -07:00
parent c3ef888648
commit ce68d41348
5 changed files with 475 additions and 16 deletions
+30 -3
View File
@@ -39,12 +39,39 @@ def test_go_holds_on_grid_completion(monkeypatch):
assert cr.main(["--operator-go", "--out", "x"]) == 2
def test_go_holds_for_operator_even_on_full_grid(monkeypatch):
def test_go_collects_on_full_grid_with_token(monkeypatch):
monkeypatch.setattr(cr, "preflight", lambda *a, **k: dict(_READY_GRID_FULL))
monkeypatch.setattr(cr, "verify_freeze", lambda: True)
monkeypatch.setenv(cr.OPERATOR_TOKEN_ENV, "1")
# Full grid + all locks: the immutable data run is still the operator's to
# initiate — the launcher does not fabricate confirmatory cells.
# Stub the live executor so the unit test does not stand up docker; assert the
# GO path actually invokes the real data collector with live=True.
from cmd_chat.sor import executor
calls = {}
def _fake_run_battery(out_root, **kw):
calls.update(kw)
calls["out_root"] = str(out_root)
return {"n_runs": 180, "measured_from": "live-docker-pcap",
"_results_path": str(out_root) + "/battery-results.json"}
monkeypatch.setattr(executor, "run_battery", _fake_run_battery)
# Full grid + all three locks + token: collect for real (returns 0).
assert cr.main(["--operator-go", "--out", "x"]) == 0
assert calls["live"] is True # never a dry/synthetic confirmatory path
def test_go_executor_refusal_never_fabricates(monkeypatch):
monkeypatch.setattr(cr, "preflight", lambda *a, **k: dict(_READY_GRID_FULL))
monkeypatch.setattr(cr, "verify_freeze", lambda: True)
monkeypatch.setenv(cr.OPERATOR_TOKEN_ENV, "1")
from cmd_chat.sor import executor
def _refuse(out_root, **kw):
raise executor.ExecutorError("no real pcap measurement available")
monkeypatch.setattr(executor, "run_battery", _refuse)
# If the executor cannot measure real data it refuses; the launcher surfaces
# that as a NO-GO (2) rather than emitting a fabricated DV.
assert cr.main(["--operator-go", "--out", "x"]) == 2