Add RAG basic implementation
This commit is contained in:
@@ -13,6 +13,7 @@ from tests.unit.agent.conftest import (
|
||||
clarify_out,
|
||||
critic_out,
|
||||
decompose_out,
|
||||
estimate_out,
|
||||
q,
|
||||
)
|
||||
|
||||
@@ -336,12 +337,29 @@ def test_timeout(monkeypatch, backend_dsn):
|
||||
assert body["error"]["code"] == "timeout"
|
||||
|
||||
|
||||
def test_roles_without_a_rate_are_blocked_up_front(monkeypatch, backend_dsn):
|
||||
rows = [*DOC_WBS[:-1], ("Админка", Role.FRONTEND, 8, 16, 24)]
|
||||
def test_roles_without_a_rate_are_blocked_up_front(monkeypatch, backend_dsn, tmp_path):
|
||||
import re
|
||||
import shutil
|
||||
|
||||
# a market file without a designer rate: the model must not be allowed to plan designer work
|
||||
shutil.copytree("config", tmp_path / "config")
|
||||
market = tmp_path / "config" / "market" / "2026Q4.toml"
|
||||
market.write_text(re.sub(r"^designer = .*\n", "", market.read_text(), flags=re.MULTILINE))
|
||||
rows = [*DOC_WBS[:-1], ("Макеты", Role.DESIGNER, 8, 16, 24)]
|
||||
gw = AutoGateway(decompose=[decompose_out(rows)] * 2)
|
||||
body = fail_case(monkeypatch, backend_dsn, gw)
|
||||
body = fail_case(monkeypatch, backend_dsn, gw, EST_CONFIG_DIR=str(tmp_path / "config"))
|
||||
assert body["error"]["code"] == "pipeline_invalid" and "roles not allowed" in body["error"]["message"]
|
||||
assert "allowed roles: analyst, backend, qa, devops" in gw.calls[1]["user"]
|
||||
assert "allowed roles: analyst, backend, qa, devops, frontend" in gw.calls[1]["user"]
|
||||
|
||||
|
||||
def test_frontend_and_designer_roles_are_priced(monkeypatch, backend_dsn):
|
||||
rows = [*DOC_WBS[:-1], ("Админка", Role.FRONTEND, 8, 16, 24), ("Макеты", Role.DESIGNER, 4, 8, 12)]
|
||||
gw = AutoGateway(decompose=[decompose_out(rows)], estimate=[estimate_out(rows)])
|
||||
body = fail_case(monkeypatch, backend_dsn, gw)
|
||||
assert body["status"] == "done"
|
||||
by_role = {x["role"]: x for x in body["result"]["price"]["by_role"]}
|
||||
assert by_role["frontend"]["rate"] == 1800 and by_role["designer"]["rate"] == 1500
|
||||
assert "allowed roles: analyst, backend, qa, devops, frontend, designer" in gw.calls[1]["user"]
|
||||
|
||||
|
||||
def test_critic_outage_still_gives_an_estimate(monkeypatch, backend_dsn):
|
||||
|
||||
Reference in New Issue
Block a user