kin: KIN-089 При попытке добавить креды прод сервера для проекта corelock вылетает 500 Internal Server Error
This commit is contained in:
parent
e80e50ba0c
commit
4a65d90218
13 changed files with 1215 additions and 4 deletions
|
|
@ -406,3 +406,70 @@ class TestPMRoutingOperations:
|
|||
ctx = build_context(ops_conn, "SRV-001", "pm", "srv")
|
||||
prompt = format_prompt(ctx, "pm", "You are PM.")
|
||||
assert "Project type: operations" in prompt
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# KIN-090: Attachments — context builder includes attachment paths
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestAttachmentsInContext:
|
||||
"""KIN-090: AC2 — агенты получают пути к вложениям в контексте задачи."""
|
||||
|
||||
@pytest.fixture
|
||||
def conn_with_attachments(self):
|
||||
c = init_db(":memory:")
|
||||
models.create_project(c, "prj", "Project", "/tmp/prj")
|
||||
models.create_task(c, "PRJ-001", "prj", "Fix bug")
|
||||
models.create_attachment(
|
||||
c, "PRJ-001", "screenshot.png",
|
||||
"/tmp/prj/.kin/attachments/PRJ-001/screenshot.png",
|
||||
"image/png", 1024,
|
||||
)
|
||||
models.create_attachment(
|
||||
c, "PRJ-001", "mockup.jpg",
|
||||
"/tmp/prj/.kin/attachments/PRJ-001/mockup.jpg",
|
||||
"image/jpeg", 2048,
|
||||
)
|
||||
yield c
|
||||
c.close()
|
||||
|
||||
def test_build_context_includes_attachments(self, conn_with_attachments):
|
||||
"""KIN-090: AC2 — build_context включает вложения в контекст для всех ролей."""
|
||||
ctx = build_context(conn_with_attachments, "PRJ-001", "debugger", "prj")
|
||||
assert "attachments" in ctx
|
||||
assert len(ctx["attachments"]) == 2
|
||||
|
||||
def test_build_context_attachments_have_filename_and_path(self, conn_with_attachments):
|
||||
"""KIN-090: вложения в контексте содержат filename и path."""
|
||||
ctx = build_context(conn_with_attachments, "PRJ-001", "debugger", "prj")
|
||||
filenames = {a["filename"] for a in ctx["attachments"]}
|
||||
paths = {a["path"] for a in ctx["attachments"]}
|
||||
assert "screenshot.png" in filenames
|
||||
assert "mockup.jpg" in filenames
|
||||
assert "/tmp/prj/.kin/attachments/PRJ-001/screenshot.png" in paths
|
||||
|
||||
def test_build_context_no_attachments_key_when_empty(self, conn):
|
||||
"""KIN-090: ключ 'attachments' отсутствует в контексте, если вложений нет."""
|
||||
# conn fixture has no attachments
|
||||
ctx = build_context(conn, "VDOL-001", "debugger", "vdol")
|
||||
assert "attachments" not in ctx
|
||||
|
||||
def test_all_roles_get_attachments(self, conn_with_attachments):
|
||||
"""KIN-090: AC2 — все роли (debugger, pm, tester, reviewer) получают вложения."""
|
||||
for role in ("debugger", "pm", "tester", "reviewer", "backend_dev", "frontend_dev"):
|
||||
ctx = build_context(conn_with_attachments, "PRJ-001", role, "prj")
|
||||
assert "attachments" in ctx, f"Role '{role}' did not receive attachments"
|
||||
|
||||
def test_format_prompt_includes_attachments_section(self, conn_with_attachments):
|
||||
"""KIN-090: format_prompt включает секцию '## Attachments' с именами и путями."""
|
||||
ctx = build_context(conn_with_attachments, "PRJ-001", "debugger", "prj")
|
||||
prompt = format_prompt(ctx, "debugger", "You are a debugger.")
|
||||
assert "## Attachments" in prompt
|
||||
assert "screenshot.png" in prompt
|
||||
assert "/tmp/prj/.kin/attachments/PRJ-001/screenshot.png" in prompt
|
||||
|
||||
def test_format_prompt_no_attachments_section_when_none(self, conn):
|
||||
"""KIN-090: format_prompt не добавляет секцию вложений, если их нет."""
|
||||
ctx = build_context(conn, "VDOL-001", "debugger", "vdol")
|
||||
prompt = format_prompt(ctx, "debugger", "Debug this.")
|
||||
assert "## Attachments" not in prompt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue