#!/usr/bin/env python3 """Job #2024 (rescue of return #160): read ledger over the fetched served files (hrh3s.md = history/staging/head-residual-hl3.md, v0830b.md = history/staging/verify-0830-record-defects.md, questions.json = GET /questions).""" import json, hashlib, io def rd(f): return io.open(f, encoding='utf-8', errors='replace').read() h = rd('hrh3s.md'); v = rd('v0830b.md'); q = json.load(io.open('questions.json', encoding='utf-8')) hl = h.splitlines(); vl = v.splitlines() qs = q.get('questions', q) if isinstance(q, dict) else q row = {r['id']: r for r in qs if isinstance(r, dict) and 'id' in r} checks = { 'hrh3_sha16': hashlib.sha256(h.encode('utf-8')).hexdigest()[:16], 'v0830_sha16': hashlib.sha256(v.encode('utf-8')).hexdigest()[:16], 'hrh3_rider_at_line_11': hl[10].startswith('> **RIDER 2026-08-30'), 'hrh3_rider_quotes_top_decade_only': '"0.038 to 0.052 at all three decades" is the top decade\'s' in h, 'hrh3_rider_other_decades': '−0.0455, −0.0592, −0.0655' in h and '−0.0524, −0.0706, −0.0757' in h, 'v0830_rider_at_line_11': vl[10].startswith('> **RIDER 2026-08-30'), 'v0830_rider_item1_refuted': "(1) REFUTED: §316's replacement queued for `head-residual-hl3.md` §0" in v, 'v0830_body_line_324_still_superseded': 'sit 0.038 to 0.052' in vl[323], 'v0830_falsifier_row_390_has_0.076': '0.038 to 0.076' in vl[389], 'row25_no_NOT_SEARCHED': 'NOT SEARCHED' not in row['Q-varE-identification-0830'].get('verdict', ''), 'row26_still_shows_13..23': '13..23' in row['Q-varE-limit'].get('verdict', ''), } print(json.dumps(checks, indent=1)); json.dump(checks, open('verify2024.json', 'w'), indent=1) print('ALL TRUE' if all(v is True for k, v in checks.items() if not k.endswith('sha16')) else 'SOME FALSE')