from pathlib import Path def test_worker_streams_pi_output_while_running(): worker = Path("src/worker_payload.py").read_text(encoding="utf-8") assert "def run_cmd_streaming" in worker assert '"logs" / "pi_live_output.txt"' in worker assert "Pi is still working" in worker assert "sync_pi_traces(run_dir" in worker assert "run_cmd_streaming(" in worker def test_progress_endpoint_no_longer_exposes_pi_stdout_payload(): bucket = Path("src/bucket.py").read_text(encoding="utf-8") app = Path("app.py").read_text(encoding="utf-8") assert '"pi_live_log": _safe_read_text' not in bucket assert '"pi_output_log": _safe_read_text' not in bucket assert "include_heavy: bool = True" in bucket assert "include_job_logs: bool = False" in app assert '"pi_live_log"' not in app def test_ui_has_pi_live_trace_panel_and_renderer(): html = Path("web/index.html").read_text(encoding="utf-8") js = Path("web/static/progress.js").read_text(encoding="utf-8") css = Path("web/static/app.css").read_text(encoding="utf-8") assert 'id="piTracePanel"' not in html assert "Pi process stdout" not in html assert "function renderPiLiveTrace" not in js assert "p.pi_live_log" not in js assert ".pi-trace-output" not in css def test_app_version_v57(): assert '"version": "v74-grouped-timeline-rings"' in Path("app.py").read_text(encoding="utf-8")