| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| def test_smoke_accepts_image_like_gradio_results_and_keeps_latency_event_aliases(): | |
| worker = (ROOT / "src" / "worker_payload.py").read_text(encoding="utf-8") | |
| assert "type_hints" in worker | |
| assert "pil." in worker | |
| assert "recommended_zero_gpu_duration_seconds" in worker | |
| assert "recommended_zerogpu_duration_seconds" in worker | |
| def test_frontend_latency_reads_zero_gpu_duration_aliases(): | |
| app = (ROOT / "web" / "static" / "app.js").read_text(encoding="utf-8") | |
| fn = app.split("function readRunLatencyPayload", 1)[1].split("function renderActiveLatency", 1)[0] | |
| assert "recommended_zero_gpu_duration_seconds" in fn | |
| assert "recommended_zerogpu_duration_seconds" in fn | |
| assert "numberFromEvents" in fn | |
| def test_progress_poll_refreshes_actions_documents_and_recovery_live(): | |
| app = (ROOT / "web" / "static" / "app.js").read_text(encoding="utf-8") | |
| refresh = app.split("function refreshProgress", 1)[1].split("function numberFromEvents", 1)[0] | |
| assert "renderActiveRunActions({...p.summary,bucket_source:p.bucket_source},p)" in refresh | |
| assert "renderRunDocuments({...p,summary:{...p.summary,bucket_source:p.bucket_source}})" in refresh | |
| assert "renderAgentRecovery(p)" in refresh | |
| def test_prefill_helper_still_detects_validation_events_but_button_is_best_effort(): | |
| runs = (ROOT / "web" / "static" / "runs.js").read_text(encoding="utf-8") | |
| assert "function runHasValidationResult(detail={},summaryOverride={})" in runs | |
| assert "const canPrefill=Boolean(targetSpace)" in runs | |
| assert "summary.observed_latency_seconds" in runs | |
| assert "generation_smoke" in runs | |
| def test_run_document_buttons_trust_backend_presence_from_progress_payload(): | |
| runs = (ROOT / "web" / "static" / "runs.js").read_text(encoding="utf-8") | |
| assert "traceDocState('traces/raw'" in runs | |
| assert "traceDocState('traces/redacted'" in runs | |
| assert "byId.get('smoke').present&&byId.get('smoke').url" in runs | |
| def test_summary_exposes_latency_and_zero_gpu_duration_aliases(): | |
| bucket = (ROOT / "src" / "bucket.py").read_text(encoding="utf-8") | |
| assert '"recommended_zero_gpu_duration_seconds"' in bucket | |
| assert '"recommended_zerogpu_duration_seconds"' in bucket | |
| assert '"observed_latency_seconds"' in bucket | |