squid-main-space / tests /test_p0_finish_v380.py
Zin299's picture
Deploy v4.6.20 agent reliability fixes
c175ac0
Raw
History Blame
1.57 kB
import pathlib, re, subprocess, shutil
ROOT=pathlib.Path(__file__).resolve().parents[1]
def test_version_380():
assert (ROOT/'VERSION').read_text(encoding='utf-8').strip()=='4.6.20'
def test_chat_runtime_extracted():
ui=(ROOT/"ui_server.py").read_text(encoding="utf-8")
runtime=(ROOT/"services"/"chat_runtime.py").read_text(encoding="utf-8")
assert "init_chat_runtime(globals())" in ui
for name in ("stream_chat","harness_stream_chat","dispatch_chat_stream"):
assert f"async def {name}" not in ui
assert f"async def {name}" in runtime
def test_chat_routes_extracted():
ui=(ROOT/"ui_server.py").read_text(encoding="utf-8")
route=(ROOT/"routes"/"chat.py").read_text(encoding="utf-8")
assert "register_chat_routes(app, globals())" in ui
for name in ("new_thread","upload_user_file","download_fisheries_export","usage_event","chat"):
assert f"async def {name}" not in ui
assert f"async def {name}" in route
for path in ("/api/threads","/api/upload","/api/fisheries/download/{token}","/api/usage","/api/chat"):
assert path in route
def test_frontend_runtime_guard_script():
smoke=ROOT/"scripts"/"frontend_runtime_smoke.js"
assert smoke.exists()
text=smoke.read_text(encoding="utf-8")
assert "stray standalone async token" in text
assert "auth-pending" in text
assert "bindSidebarToolsToggle" in text
if shutil.which("node"):
r=subprocess.run(["node",str(smoke)],cwd=ROOT,capture_output=True,text=True)
assert r.returncode==0, r.stderr or r.stdout