import ast from pathlib import Path def test_app_wires_gpu_progress_and_queue_updates(): source = Path("app.py").read_text(encoding="utf-8") tree = ast.parse(source) assert source.count("gr.Progress(track_tqdm=True)") == 1 assert "status_update_rate=0.5" in source functions = {node.name: node for node in ast.walk(tree) if isinstance(node, ast.FunctionDef)} assert "gpu_separate" in functions first = functions["gpu_separate"].body[0] assert isinstance(first, ast.Assign) assert isinstance(first.value, ast.Call) assert getattr(first.value.func, "id", None) == "start_gpu_callback_timing" assert ".then(" not in source assert "Date.now" not in source def test_ui_exposes_product_logs_and_staged_execution(): source = Path("src/ui.py").read_text(encoding="utf-8") assert "Runtime log tail" in source assert "Runtime log file" in source assert 'concurrency_id="sesa_gpu"' in source assert "Extra safety margin (+30%, Semi-auto only)" in source assert "1. Prepare / refresh plan" in source assert "separate_prepared" in source assert "Reproducibility record (JSON)" in source assert "Probe" not in source