38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
import json
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
EVIDENCE_ROOT = Path(sys.argv[1]) if len(sys.argv) > 1 else ROOT / "evidence"
|
|
MANIFEST = EVIDENCE_ROOT / "manifest.jsonl"
|
|
|
|
|
|
def main() -> int:
|
|
print(f"evidence_root: {EVIDENCE_ROOT}")
|
|
if not MANIFEST.exists():
|
|
print(f"ERROR: manifest missing: {MANIFEST}")
|
|
return 1
|
|
|
|
lines = [line for line in MANIFEST.read_text(encoding="utf-8").splitlines() if line.strip()]
|
|
print(f"manifest_entries: {len(lines)}")
|
|
if not lines:
|
|
print("ERROR: manifest is empty")
|
|
return 1
|
|
|
|
for idx, line in enumerate(lines[:5], start=1):
|
|
record = json.loads(line)
|
|
for key in ("screenshotPath", "domPath", "urlPath"):
|
|
path = Path(record[key])
|
|
if not path.exists():
|
|
print(f"ERROR: missing {key} for entry {idx}: {path}")
|
|
return 1
|
|
print(f"OK: entry {idx} -> {record['label']}")
|
|
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|