"""Describe stored approximate hook-length annotations; no optimal-length or performance estimate.

Usage: python3 reproduce-hook-timing-coverage-2026-v1.py short-form-hook-corpus-2026.json
No network, file writes, new video viewing, timing measurements or recoding.
"""
from pathlib import Path
import hashlib,json,math,sys
SOURCE_SHA='d854e2fec64db8a8ae1170a21bde3fcea58b1f73f8ffc6eafdca9ce83dc3345c'
def derive(raw):
 if hashlib.sha256(raw).hexdigest()!=SOURCE_SHA:raise ValueError('Use the exact original version1 export; corrected views remain separate.')
 rows=json.loads(raw)['records']
 if len(rows)!=52 or len({r['researchId']for r in rows})!=52:raise ValueError('Unexpected edition identities or denominator')
 present=[];missing=[]
 for r in rows:
  value=r.get('approximateHookLengthSeconds')
  if value is None:missing.append(r['researchId']);continue
  if type(value)not in[int,float]or not math.isfinite(value)or value<=0:raise ValueError('Unexpected annotation; do not recode it as missing or zero')
  present.append(dict(research_id=r['researchId'],source_video_id=r['sourceVideoId'],title=r['publicTitle'],approximate_hook_seconds=value,site_watch_url=r['siteWatchUrl']))
 return dict(view_id='HOOK-TIMING-COVERAGE-2026-v1',source_sha256=SOURCE_SHA,selected_video_editions=52,numeric_annotation_records=len(present),unrecorded_annotation_records=len(missing),minimum_stored_estimate_seconds=min(r['approximate_hook_seconds']for r in present),maximum_stored_estimate_seconds=max(r['approximate_hook_seconds']for r in present),stored_view_count_records=sum(r.get('publicViewCountSnapshot')is not None for r in rows),numeric_annotations=present,unrecorded_ids=missing,limits=['Approximate stored annotations, not frame-measured timings or recommended targets.','Unrecorded estimates are unknown, not zero-second hooks.','One selected single-creator YouTube-edition corpus, not an industry sample.','Zero stored view snapshots does not mean zero views; no timing/performance relationship can be calculated from these exports.','No new viewing observations, recoding or changes to original editions.'])
if __name__=='__main__':
 if len(sys.argv)!=2:raise SystemExit(__doc__)
 try:print(json.dumps(derive(Path(sys.argv[1]).read_bytes()),indent=2,ensure_ascii=False))
 except(ValueError,KeyError)as e:raise SystemExit(str(e))
