Improve AI structure binary input diagnostics
CI / python (push) Has been cancelled
CI / rust (push) Has been cancelled

This commit is contained in:
2026-05-22 01:00:26 +03:00
parent 51d52ccf04
commit d93b7cb07e
3 changed files with 107 additions and 9 deletions
+53
View File
@@ -2015,9 +2015,62 @@ def test_html5_ai_structure_routes_unc_directory_with_cf_through_windows_agent(m
assert copied_targets
assert started["input_path"] == r"\\192.168.220.200\mst\1c\MARKA\CODEX\CF"
assert started["detected_binary_relative_path"] == "base.cf"
assert started["detected_binary_relative_paths"] == ["base.cf"]
assert "agent-import-test" in saved_runs
def test_html5_ai_structure_reports_multiple_binary_files_in_directory(tmp_path: Path):
first = tmp_path / "first.cf"
second = tmp_path / "second.cf"
first.write_bytes(b"cf-1")
second.write_bytes(b"cf-2")
client = TestClient(app)
project_id = f"ai-many-{uuid4()}"
agent_id = f"win-agent-{uuid4()}"
settings = client.post(
f"/projects/{project_id}/settings",
json={"name": "AI Many", "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"})
assert heartbeat.status_code == 200
queued = client.post(
f"/html5/projects/{project_id}/ai-structure/run",
data={"project_id": project_id, "input_path": str(tmp_path), "output_path": str(tmp_path / 'out')},
)
assert queued.status_code == 200
assert "один конкретный файл .cf" in queued.text
assert "first.cf" in queued.text
assert "second.cf" in queued.text
def test_html5_ai_structure_reports_offline_agent_with_last_seen(tmp_path: Path):
cf_input = tmp_path / "demo.cf"
cf_input.write_bytes(b"binary-cf")
client = TestClient(app)
project_id = f"ai-offline-{uuid4()}"
agent_id = f"win-agent-{uuid4()}"
settings = client.post(
f"/projects/{project_id}/settings",
json={"name": "AI Offline", "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"})
assert heartbeat.status_code == 200
main._agent_statuses[agent_id].last_seen_at = "2020-01-01T00:00:00+00:00"
queued = client.post(
f"/html5/projects/{project_id}/ai-structure/run",
data={"project_id": project_id, "input_path": str(cf_input), "output_path": str(tmp_path / 'out')},
)
assert queued.status_code == 200
assert "сейчас офлайн" in queued.text
assert "Последний heartbeat" in queued.text
def test_import_full_replace_replaces_current_normalized_project(tmp_path: Path):
first = tmp_path / "first"
second = tmp_path / "second"