Improve AI structure agent path diagnostics
CI / python (push) Has been cancelled
CI / rust (push) Has been cancelled

This commit is contained in:
2026-05-22 04:40:35 +03:00
parent e12332d3c6
commit b3689b1d9e
4 changed files with 92 additions and 5 deletions
+46 -1
View File
@@ -2081,7 +2081,15 @@ def test_html5_ai_structure_page_shows_agent_status_panel():
json={"name": "AI Page", "structure_source": "CF_FILE", "agent": {"cf_agent_id": agent_id}},
)
assert settings.status_code == 200
heartbeat = client.post("/agent/heartbeat", json={"agent_id": agent_id, "host": "test-host", "version": "0.2.31"})
heartbeat = client.post(
"/agent/heartbeat",
json={
"agent_id": agent_id,
"host": "test-host",
"version": "0.2.31",
"network_roots": [r"\\192.168.220.220\mst"],
},
)
assert heartbeat.status_code == 200
page = client.get(f"/html5/projects/{project_id}/ai-structure")
@@ -2091,6 +2099,7 @@ def test_html5_ai_structure_page_shows_agent_status_panel():
assert agent_id in page.text
assert "test-host" in page.text
assert "0.2.31" in page.text
assert r"\\192.168.220.220\mst" in page.text
def test_html5_ai_structure_page_shows_missing_agent_hint():
@@ -2109,6 +2118,42 @@ def test_html5_ai_structure_page_shows_missing_agent_hint():
assert "Укажите его в настройках проекта" in page.text
def test_html5_ai_structure_reports_unc_root_mismatch_for_online_agent(tmp_path: Path):
cf_input = r"\\192.168.220.200\mst\1c\MARKA\CODEX\CF\demo.cf"
client = TestClient(app)
project_id = f"ai-root-mismatch-{uuid4()}"
agent_id = f"win-agent-{uuid4()}"
settings = client.post(
f"/projects/{project_id}/settings",
json={"name": "AI Root Mismatch", "structure_source": "CF_FILE", "agent": {"cf_agent_id": agent_id}},
)
assert settings.status_code == 200
heartbeat = client.post(
"/agent/heartbeat",
json={
"agent_id": agent_id,
"host": "test-host",
"network_roots": [r"\\192.168.220.220\mst"],
},
)
assert heartbeat.status_code == 200
queued = client.post(
f"/html5/projects/{project_id}/ai-structure/run",
data={
"project_id": project_id,
"input_path": cf_input,
"output_path": str(tmp_path / "out"),
"smb_username": "m",
"smb_password": "secret",
},
)
assert queued.status_code == 200
assert "сейчас не может открыть путь" in queued.text
assert r"\\192.168.220.220\mst" in queued.text
def test_import_full_replace_replaces_current_normalized_project(tmp_path: Path):
first = tmp_path / "first"
second = tmp_path / "second"