"""Upload only the explicitly packaged release; never the workspace or auth directory.""" import json,hashlib from pathlib import Path from huggingface_hub import HfApi,hf_hub_download from common import write_json root=Path('/home/ach18533cl/workspace/SceneBench');cfg=json.loads((root/'config.json').read_text());auth=json.loads(Path('/home/ach18533cl/.cache/scenebench-auth/credentials.json').read_text());folder=root/'huggingface' for p in folder.rglob('*'): if p.is_file(): assert not p.is_symlink() if p.suffix in ['.py','.json','.jsonl','.md','.txt','.yaml','.yml']: txt=p.read_text();assert auth['hf'] not in txt and auth['openrouter'] not in txt, 'Credential detected in upload tree' api=HfApi(token=auth['hf']);api.create_repo(cfg['hf_repo'],repo_type='dataset',private=cfg['hf_private'],exist_ok=True) info=api.repo_info(cfg['hf_repo'],repo_type='dataset');assert info.private==cfg['hf_private'],'Unexpected repository visibility' commit=api.upload_folder(repo_id=cfg['hf_repo'],repo_type='dataset',folder_path=folder,commit_message='SceneBench v1: frozen source-derived test benchmark and verified artifacts') download=hf_hub_download(repo_id=cfg['hf_repo'],repo_type='dataset',filename='FROZEN.json',revision=commit.oid,token=auth['hf']);frozen=json.loads(Path(download).read_text());assert frozen==json.loads((folder/'FROZEN.json').read_text()) files=api.list_repo_files(cfg['hf_repo'],repo_type='dataset',revision=commit.oid);assert len([p for p in files if p.endswith('.parquet')])==6 write_json(root/'work/hf_upload_report.json',dict(status='pass',repo=cfg['hf_repo'],private=info.private,commit=commit.oid,url=f'https://huggingface.co/datasets/{cfg["hf_repo"]}',files=len(files),frozen_manifest_readback='pass')) print(json.dumps(dict(status='pass',repo=cfg['hf_repo'],private=info.private,commit=commit.oid,files=len(files))),flush=True)