Moves only; no behaviour changes. Every file now lives under the part of the project it belongs to, each section has a README, and docs/PRIVACY.md collects the rules all parts follow. core/ engine.js, graph.js, solver.js, python/clean.py collection/ sources/ (form, register, PDF check, daily update), bot/ (importer) analysis/ stats/ (Python statistics), network/ (build-graph.js), reports/ (POLICY.md) planner/ build-policy.js, policy-report.js site/ atlas/ (the page), build.js, qa/ tests/ core/ (unit), parity/ (JS vs Python), fixtures/ Checked against the previous layout: tests pass; coded runs, test outputs, graph.json and policy.json are byte-identical; the built site differs only in comments that name file paths. The published file names Ken's bot downloads (solver.js, graph.js, data/policy.json) are unchanged. Also removes the undefined/ folder of QA screenshots committed by mistake (the QA scripts now default to a temp folder) and test.txt, and drops the unused npm workspaces. Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
931 B
Python
22 lines
931 B
Python
"""Check that the JS engine (core/engine.js) and the Python reference (python/clean.py) code every run identically."""
|
|
import json, sys
|
|
import pandas as pd
|
|
js = pd.DataFrame(json.load(open(sys.argv[1] if len(sys.argv) > 1 else "tests/out/runs_js.json")))
|
|
py = pd.read_csv(sys.argv[2] if len(sys.argv) > 2 else "data/derived/runs_clean.csv", keep_default_na=False, na_values=[""])
|
|
def norm(v):
|
|
if v is None or (not isinstance(v, str) and pd.isna(v)) or v == "":
|
|
return None
|
|
if isinstance(v, float) and v.is_integer():
|
|
return str(int(v))
|
|
if isinstance(v, bool):
|
|
return str(v)
|
|
return str(v)
|
|
bad = {}
|
|
for c in py.columns:
|
|
a, b = [norm(v) for v in py[c]], [norm(v) for v in js[c]]
|
|
d = [(i, x, y) for i, (x, y) in enumerate(zip(a, b)) if x != y]
|
|
if d:
|
|
bad[c] = (len(d), d[:3])
|
|
print("runs:", len(py), len(js), "| mismatching columns:", bad or "NONE")
|
|
sys.exit(1 if bad else 0)
|