32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Verify the scratch_analysis.json file is valid and contains expected data."""
|
|
import json
|
|
import sys
|
|
|
|
|
|
def _check(cond, msg):
|
|
"""A failure path `-O` cannot compile away (Q63: assert-only files exit 0 under -O)."""
|
|
if not cond:
|
|
raise RuntimeError(msg)
|
|
|
|
|
|
with open("/root/.hermes/wizard-outputs/spark/scratch_analysis.json") as f:
|
|
# subject: /root/.hermes/wizard-outputs/spark/scratch_analysis.json -- grades the live tree outside the repo by design (not a repo fixture)
|
|
data = json.load(f)
|
|
|
|
# Verify required fields
|
|
_check("total_files" in data, "Missing total_files")
|
|
_check("total_bytes" in data, "Missing total_bytes")
|
|
_check("file_types" in data, "Missing file_types")
|
|
_check("files" in data, "Missing files array")
|
|
|
|
# Verify counts match
|
|
_check(data["total_files"] == len(data["files"]), "File count mismatch")
|
|
_check(data["total_files"] == 165, f"Expected 165 files, got {data['total_files']}")
|
|
_check(230000 <= data["total_bytes"] <= 250000, f"Total bytes out of range: {data['total_bytes']}")
|
|
|
|
print("VERIFICATION PASSED")
|
|
print(f"Total files: {data['total_files']}")
|
|
print(f"Total bytes: {data['total_bytes']}")
|
|
print(f"File types: {data['file_types']}")
|