"""Fix metadata.json status."""
from pathlib import Path
import json
p = Path("conductor/tracks/result_migration_small_files_20260617/metadata.json")
with p.open(encoding="utf-8") as f:
    md = json.load(f)
md["status"] = "completed"
if "phase_12_outcome" not in md:
    md["phase_12_outcome"] = {"status": "completed"}
with p.open("w", encoding="utf-8") as f:
    json.dump(md, f, indent=2, ensure_ascii=False)
print("metadata status:", md["status"])
print("phase_12_outcome keys:", list(md["phase_12_outcome"].keys()))