kin: KIN-DOCS-003-backend_dev

This commit is contained in:
Gros Frumos 2026-03-19 19:06:18 +02:00
parent a0d2f814e4
commit 55f37b9444
6 changed files with 180 additions and 13 deletions

View file

@ -115,11 +115,11 @@ class TestAllPromptsContainStandardStructure:
class TestPromptCount:
"""Проверяет, что число промптов не изменилось неожиданно."""
def test_prompt_count_is_25(self):
"""В agents/prompts/ ровно 25 файлов .md."""
def test_prompt_count_is_26(self):
"""В agents/prompts/ ровно 26 файлов .md."""
count = len(_prompt_files())
assert count == 25, ( # 25 промптов — актуально на 2026-03-19 (см. git log agents/prompts/)
f"Ожидалось 25 промптов, найдено {count}. "
assert count == 26, ( # 26 промптов — актуально на 2026-03-19, +knowledge_synthesizer (KIN-DOCS-003, см. git log agents/prompts/)
f"Ожидалось 26 промптов, найдено {count}. "
"Если добавлен новый промпт — обнови этот тест."
)

View file

@ -78,6 +78,7 @@ def test_validate_roles_strips_and_lowercases():
@pytest.mark.parametrize("roles,expected", [
# 1 исследователь → нет knowledge_synthesizer, architect последний
(
["business_analyst"],
["business_analyst", "architect"],
@ -86,17 +87,21 @@ def test_validate_roles_strips_and_lowercases():
["tech_researcher"],
["tech_researcher", "architect"],
),
# ≥2 исследователей → knowledge_synthesizer авто-вставляется перед architect (KIN-DOCS-003, 2026-03-19)
(
["marketer", "business_analyst"],
["business_analyst", "marketer", "architect"],
["business_analyst", "marketer", "knowledge_synthesizer", "architect"],
),
(
["ux_designer", "market_researcher", "tech_researcher"],
["market_researcher", "tech_researcher", "ux_designer", "architect"],
["market_researcher", "tech_researcher", "ux_designer", "knowledge_synthesizer", "architect"],
),
])
def test_build_phase_order_canonical_order_and_appends_architect(roles, expected):
"""KIN-059: роли сортируются в канонический порядок, architect добавляется последним."""
"""KIN-059: роли сортируются в канонический порядок, architect добавляется последним.
При 2 исследователях knowledge_synthesizer авто-вставляется перед architect.
"""
assert build_phase_order(roles) == expected
@ -113,6 +118,28 @@ def test_build_phase_order_architect_always_last():
assert result[-1] == "architect"
def test_build_phase_order_single_researcher_no_synthesizer():
"""KIN-DOCS-003: 1 исследователь → knowledge_synthesizer НЕ вставляется."""
result = build_phase_order(["business_analyst"])
assert "knowledge_synthesizer" not in result
assert result == ["business_analyst", "architect"]
def test_build_phase_order_two_researchers_inserts_synthesizer():
"""KIN-DOCS-003: 2 исследователя → knowledge_synthesizer авто-вставляется перед architect."""
result = build_phase_order(["market_researcher", "tech_researcher"])
assert "knowledge_synthesizer" in result
assert result.index("knowledge_synthesizer") == len(result) - 2
assert result[-1] == "architect"
def test_validate_roles_strips_knowledge_synthesizer():
"""KIN-DOCS-003: knowledge_synthesizer убирается из входных ролей — авто-управляемая роль."""
result = validate_roles(["knowledge_synthesizer", "business_analyst"])
assert "knowledge_synthesizer" not in result
assert "business_analyst" in result
# ---------------------------------------------------------------------------
# create_project_with_phases
# ---------------------------------------------------------------------------
@ -146,7 +173,7 @@ def test_create_project_with_phases_other_phases_remain_pending(conn):
conn, "proj1", "P1", "/path",
description="Desc", selected_roles=["market_researcher", "tech_researcher"],
)
# market_researcher, tech_researcher, architect → 3 фазы
# market_researcher, tech_researcher, knowledge_synthesizer, architect → 4 фазы (KIN-DOCS-003)
for phase in result["phases"][1:]:
assert phase["status"] == "pending"