from pathlib import Path def test_progress_endpoint_uses_light_bucket_bundle_and_optional_job_logs(): app = Path("app.py").read_text(encoding="utf-8") bucket = Path("src/bucket.py").read_text(encoding="utf-8") assert "include_heavy: bool = True" in bucket assert "include_heavy=False" in app assert "include_job_logs: bool = False" in app assert "if job_id and include_job_logs:" in app assert '"job_logs_polled": bool(include_job_logs)' in app def test_progress_polls_job_logs_less_often_from_frontend(): js = Path("web/static/app.js").read_text(encoding="utf-8") assert "lastJobLogPoll" in js assert ">8000" in js assert "include_job_logs=1" in js assert "state.lastJobLogPoll=0" in js def test_pi_stdout_display_and_api_payload_are_removed(): html = Path("web/index.html").read_text(encoding="utf-8") progress = Path("web/static/progress.js").read_text(encoding="utf-8") app = Path("app.py").read_text(encoding="utf-8") assert "piTracePanel" not in html assert "Pi process stdout" not in html assert "renderPiLiveTrace" not in progress assert "pi_live_log" not in progress assert '"pi_live_log"' not in app def test_delete_selected_run_clears_ui_and_refreshes_runs(): runs = Path("web/static/runs.js").read_text(encoding="utf-8") assert "async function deleteSelectedRun" in runs assert "await apiDelete" in runs assert "await loadRuns(true)" in runs assert "resetRunDetails();" in runs assert "Delete run from bucket" in runs def test_app_version_v62(): assert '"version": "v74-grouped-timeline-rings"' in Path("app.py").read_text(encoding="utf-8")