"""Verify the research queue and the numerical summary of sensitivity to the paired training seed.""" import pytest def test_full_study_finishes_single_seed_work_before_replications_and_analyzes_seeds_last(tmp_path,monkeypatch): from thirdloss import checkpoint_flatness,hybrid,study from thirdloss import seed_sensitivity from thirdloss.records import write_json events=[] write_json(tmp_path/"results/verification/pythia-scoring-batches.json",{}) monkeypatch.setattr(study,"prepare_stage",lambda *a:None) monkeypatch.setattr(study,"feasibility",lambda *a:None) monkeypatch.setattr(study,"select",lambda *a:{"trace":.01,"third":.01}) def run(project,storage,stage,method,phase,seed,*unused): events.append((phase,stage,method,seed)) return {"id":events[-1]} monkeypatch.setattr(study,"run_one",run) monkeypatch.setattr(study,"milestone",lambda *a:None) monkeypatch.setattr(study,"freeze",lambda p,s,stage:{"runs":[stage]}) monkeypatch.setattr(study,"evaluate_one",lambda p,s,run,d:events.append(("test",run)) or {}) monkeypatch.setattr(hybrid,"run_hybrids",lambda *a,cohort,**kw:events.append(("hybrid",cohort))) monkeypatch.setattr(checkpoint_flatness,"flatness_study",lambda p,s,st,phase,*a:events.append(("geometry",phase))) monkeypatch.setattr(seed_sensitivity,"finish_seed_sensitivity",lambda *a:events.append(("seed-sensitivity",))) study.run_study(tmp_path,tmp_path,["stories","abstracts"],"cpu",False,with_hybrid=True,with_flatness=True) single=[i for i,e in enumerate(events) if e[0] in {"pilot","control"} or e==("hybrid","example") or (e[0]=="confirm" and e[3]==1)] repeats=[i for i,e in enumerate(events) if e[0]=="confirm" and e[3]>1] assert max(single)