#!/usr/bin/env python3 """Dashboard patch (2026-11-20): update ONLY the JEDI-lite line in the verdict ledger of ~/sera_v4_dashboard/server.py. Gate 1 was re-measured after the first measurement crashed (measure_jedi.py mode_swap shape bug, fixed separately): dv_swap @ ckpt 010000 = 0.8958, @ 005000 = 0.8870, fs1 reference = 0.0993 -> Gate 1 PASS (threshold 0.08). Gate 2 rollout eval is still running, so the line stays RUNNING. Exact-match asserted; backup at server.py.bak-gate1-20261120. """ import py_compile import shutil from pathlib import Path P = Path.home() / "sera_v4_dashboard" / "server.py" src = P.read_text() orig = src OLD_NOTE = ("Check PASS · smoke PASS (DD median 3,512) · Cong 0 PASS: " "DD_task 5,91 tai ckpt 2k (nguong 1,5) · Cong 1/2 chua co " "ket qua tai thoi diem cap nhat 20/11/2026.") NEW_NOTE = ("Check PASS · smoke PASS (DD median 3,512) · " "Cổng 0 PASS (DD 5,91) · " "Cổng 1 PASS (Δv_swap 0,896 tại 10k, fs1 tham chiếu 0,099) · " "Cổng 2 đang chạy") n = src.count(OLD_NOTE) assert n == 1, f"old JEDI-lite note found {n} times (expected 1)" assert NEW_NOTE not in src src = src.replace(OLD_NOTE, NEW_NOTE) assert src != orig shutil.copy(P, P.with_name("server.py.bak-gate1-20261120")) P.write_text(src) py_compile.compile(str(P), doraise=True) print("dashboard JEDI-lite line updated OK; backup at " "server.py.bak-gate1-20261120; py_compile OK")