"""Verify delivered server.py is byte-identical to input site/server.py, list delivered files, confirm no leftover test submissions.jsonl, and re-check brief calculator arithmetic independently of the JS.""" import hashlib, json from pathlib import Path from decimal import Decimal def sha(p): return hashlib.sha256(Path(p).read_bytes()).hexdigest() orig = sha('site/server.py'); copy = sha('output/site/server.py') files = sorted(str(p) for p in Path('output/site').iterdir()) examples = {1: '268.80', 2: '537.60', 3: '725.76', 8: '1935.36'} calc = {} for seats, expected in examples.items(): sub = Decimal(240) * seats disc = Decimal('0.10') if seats >= 3 else Decimal(0) total = (sub * (1 - disc) * Decimal('1.12')).quantize(Decimal('0.01')) calc[seats] = {'computed': str(total), 'brief_expected': expected, 'pass': str(total) == expected} print(json.dumps({'server_sha256_original': orig, 'server_sha256_copy': copy, 'server_identical': orig == copy, 'delivered_files': files, 'submissions_jsonl_present': Path('output/site/submissions.jsonl').exists(), 'decimal_arithmetic_check': calc}, indent=1))