cambios profundos

This commit is contained in:
2026-05-27 16:29:02 +02:00
parent d95ed15766
commit 34b11dfc66
29 changed files with 594 additions and 11102 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ EXAMPLES = (
@pytest.mark.integration
def test_happy_path_completa_sin_hitl(integration_client) -> None: # type: ignore[no-untyped-def]
payload = (EXAMPLES / "02_mos_degradation_pool_sbc.txt").read_text(encoding="utf-8")
r = integration_client.post("/agents/incident_analyzer/invoke", json={"input": payload})
r = integration_client.post("/api/agents/incident_analyzer/invoke", json={"input": payload})
assert r.status_code == 200
body = r.json()
assert body["status"] == "completed"
+4 -4
View File
@@ -12,7 +12,7 @@ EXAMPLES = (
@pytest.mark.integration
def test_hitl_approve_completa(integration_client) -> None: # type: ignore[no-untyped-def]
payload = (EXAMPLES / "01_sip_registration_drop.txt").read_text(encoding="utf-8")
r = integration_client.post("/agents/incident_analyzer/invoke", json={"input": payload})
r = integration_client.post("/api/agents/incident_analyzer/invoke", json={"input": payload})
body = r.json()
assert body["status"] == "awaiting_approval"
assert body["needs_human_for"]
@@ -20,7 +20,7 @@ def test_hitl_approve_completa(integration_client) -> None: # type: ignore[no-u
pending = [a["id"] for a in body["needs_human_for"]]
r2 = integration_client.post(
f"/executions/{trace_id}/approve",
f"/api/executions/{trace_id}/approve",
json={"approved_action_ids": pending, "comment": "OK rollback"},
)
assert r2.status_code == 200
@@ -31,10 +31,10 @@ def test_hitl_approve_completa(integration_client) -> None: # type: ignore[no-u
@pytest.mark.integration
def test_hitl_reject_marca_failed(integration_client) -> None: # type: ignore[no-untyped-def]
payload = (EXAMPLES / "01_sip_registration_drop.txt").read_text(encoding="utf-8")
r = integration_client.post("/agents/incident_analyzer/invoke", json={"input": payload})
r = integration_client.post("/api/agents/incident_analyzer/invoke", json={"input": payload})
trace_id = r.json()["trace_id"]
r2 = integration_client.post(
f"/executions/{trace_id}/reject", json={"reason": "rollback no procede"}
f"/api/executions/{trace_id}/reject", json={"reason": "rollback no procede"}
)
assert r2.status_code == 200
assert r2.json()["status"] == "failed"
+1 -1
View File
@@ -6,7 +6,7 @@ import pytest
@pytest.mark.integration
def test_pii_es_nif_bloquea(integration_client) -> None: # type: ignore[no-untyped-def]
pii_input = "El cliente con NIF 12345678Z reporta caída de servicio. Email juan@example.com"
r = integration_client.post("/agents/incident_analyzer/invoke", json={"input": pii_input})
r = integration_client.post("/api/agents/incident_analyzer/invoke", json={"input": pii_input})
assert r.status_code == 200
body = r.json()
assert body["status"] == "blocked_by_guardrail"
@@ -44,7 +44,7 @@ def test_resume_tras_recreacion_del_app(tmp_path: Path, monkeypatch: pytest.Monk
# 1) Primera "ejecución" del core: invoca y queda en awaiting_approval.
client_a = _fresh()
r = client_a.post("/agents/incident_analyzer/invoke", json={"input": payload})
r = client_a.post("/api/agents/incident_analyzer/invoke", json={"input": payload})
body = r.json()
assert body["status"] == "awaiting_approval"
trace_id = body["trace_id"]
@@ -54,7 +54,7 @@ def test_resume_tras_recreacion_del_app(tmp_path: Path, monkeypatch: pytest.Monk
# 2) Recreamos el app (simula restart del contenedor) — DATA_DIR persiste.
client_b = _fresh()
r2 = client_b.post(
f"/executions/{trace_id}/approve",
f"/api/executions/{trace_id}/approve",
json={"approved_action_ids": pending},
)
assert r2.status_code == 200