anhtld commited on
Commit
49f6940
·
verified ·
1 Parent(s): 4079eaf

Accept hash sidecars in leakage audit

Browse files
workspace/scripts/audit_cil_charts.py CHANGED
@@ -130,12 +130,16 @@ def _audit_run_hashes(run_root: Path, warnings: list[str]) -> None:
130
  except json.JSONDecodeError:
131
  warnings.append(f"{path}: invalid JSON; skipped hash audit")
132
  continue
133
- if "data_hash" not in payload:
134
  warnings.append(f"{path}: missing data_hash")
135
- if "split_hash" not in payload:
136
  warnings.append(f"{path}: missing split_hash")
137
 
138
 
 
 
 
 
139
  def _markdown(report: dict[str, Any]) -> str:
140
  lines = [
141
  "# CIL Chart Leakage Audit",
 
130
  except json.JSONDecodeError:
131
  warnings.append(f"{path}: invalid JSON; skipped hash audit")
132
  continue
133
+ if "data_hash" not in payload and not _sidecar_has_content(path.parent / "data_hash.txt"):
134
  warnings.append(f"{path}: missing data_hash")
135
+ if "split_hash" not in payload and not _sidecar_has_content(path.parent / "split_hash.txt"):
136
  warnings.append(f"{path}: missing split_hash")
137
 
138
 
139
+ def _sidecar_has_content(path: Path) -> bool:
140
+ return path.exists() and bool(path.read_text().strip())
141
+
142
+
143
  def _markdown(report: dict[str, Any]) -> str:
144
  lines = [
145
  "# CIL Chart Leakage Audit",