from pathlib import Path def test_compact_timeline_groups_are_used_instead_of_all_worker_steps(): js = Path("web/static/progress.js").read_text(encoding="utf-8") css = Path("web/static/app.css").read_text(encoding="utf-8") assert "COMPACT_TIMELINE_GROUPS" in js assert "function compactTimelineItems" in js assert "const list=compactTimelineItems(fullList)" in js assert "repeat(11,minmax(92px,1fr))" in css assert "failure" not in js.split("COMPACT_TIMELINE_GROUPS", 1)[1].split("];", 1)[0] def test_run_selection_does_not_flash_stale_view_pipeline(): runs = Path("web/static/runs.js").read_text(encoding="utf-8") assert "avoid rendering stale view.pipeline" in runs render_detail = runs.split("function renderRunDetail", 1)[1].split("const homeBtn", 1)[0] assert "renderRunViewModel(view" not in render_detail def test_light_progress_poll_does_not_call_hf_job_api_every_tick(): app = Path("app.py").read_text(encoding="utf-8") assert "if job_id and include_job_logs:" in app assert "inspect_job_safe(job_id" in app assert "fetch_recent_logs_safe(job_id" in app def test_refresh_progress_prefers_canonical_status(): js = Path("web/static/app.js").read_text(encoding="utf-8") assert "setText('detailJobStatus',p.status||p.state?.status" in js assert "setText('homeRunDetailStatus',badgeLabel(p.status" in js def test_app_version_v71(): assert '"version": "v74-grouped-timeline-rings"' in Path("app.py").read_text(encoding="utf-8")