"""Freeze source-only full511 graph retrieval under the unchanged development policy.""" from pathlib import Path import hashlib,json from prepare_openqa_dev161_equal_budget import freeze ROOT=Path(__file__).resolve().parent FULL=ROOT/'miriad_public/graph_common_corpus_gpt_20261121/full4685' OUT=FULL/'human511_retrieval_prospective_v1' def sha(p):return hashlib.sha256(p.read_bytes()).hexdigest() def main(): OUT.mkdir(exist_ok=True);source=ROOT/'miriad_public/openqa_human511_readers/selected_items.jsonl';items=[json.loads(x) for x in source.read_text().splitlines()];assert len(items)==511 corpus=ROOT/'miriad_public/source_only_topic_corpus.jsonl';assert sha(corpus)==sha(FULL/'corpus.jsonl') rows=[{'id':x['id'],'question':x['question']} for x in items];path=OUT/'source_only_queries511_local_only.jsonl';freeze(path,''.join(json.dumps(x)+'\n' for x in rows)) ledgers={p.name:sha(p) for p in FULL.glob('*usage*.jsonl')} freeze(OUT/'protocol_before_queries.json',json.dumps({'scope':'All511historically exposed human OpenQA questions, title-free unchanged queries; no reader/gold/source-identity fields in query inputs. Exploratory source-conditioned comparison, NOT untouchedconfirmatorytest.', 'questions':511,'corpus_passages':4685,'corpus_sha256':sha(corpus),'queries_sha256':sha(path),'source_items_sha256':sha(source), 'graph_variant':'Existing mixed2354DeepSeek extraction records plus Luna continuation, compiled Medical nano fork, NOT official Microsoft GraphRAG. Do not rebuild/rename as pureLuna.', 'graph_query':'Existing localtop10/sourceonly/no community reports; source token4000and12000 arms, unchanged fromdevelopment2x2.', 'context_selection':'Freeze existing development first8uniquegraphsourceparents; graph_original vsquestionBM25 parentorder. Same old parentformatter; shared final per-question actual minimum across graph/BM/native parent arms <=6000; no gold or target quote selection. Prepare contexts before opening referencecoverage labels.', 'parent_selection_policy_sha256':sha(ROOT/'evaluate_graph_candidate_query_rerank.py'),'source_adapter_sha256':sha(ROOT/'openqa_graph_source_adapter.py'), 'new_llm_index_calls_allowed':0,'new_reader_calls':0,'before_query_usage_ledgers_sha256':ledgers,'expert_reviews':0,'source_rights':'Raw MIRIAD source text remains local, not newly public-cleared.'},indent=2)+'\n');print('Frozen511source-onlyqueries;0APIcalls') if __name__=='__main__':main()