fix: idempotent ladder_rank migration for legacy gate_evidence tables
This commit is contained in:
@@ -358,6 +358,12 @@ def write_gate_evidence(
|
||||
|
||||
with HarnessLog(db_path, run_id) as log:
|
||||
log.create_table("gate_evidence", _GATE_EVIDENCE_COLS)
|
||||
# 幂等迁移(对齐 question_gen/run_store 先例):块序贯时代的旧表只有
|
||||
# block_idx 列,CREATE TABLE IF NOT EXISTS 不补列,直接插 ladder_rank
|
||||
# 会 OperationalError——为旧 workspace 复用补列,新表恒为 no-op。
|
||||
cols = {r["name"] for r in log.query("PRAGMA table_info(gate_evidence)")}
|
||||
if "ladder_rank" not in cols:
|
||||
log.execute("ALTER TABLE gate_evidence ADD COLUMN ladder_rank INTEGER")
|
||||
for row in rows:
|
||||
log.insert("gate_evidence", {"epoch": epoch, "step": step, **row})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user