kin: auto-commit after pipeline
This commit is contained in:
parent
89595aa077
commit
d73964996d
1 changed files with 43 additions and 25 deletions
|
|
@ -5,7 +5,7 @@ Acceptance criteria:
|
||||||
2. No file in agents/prompts/ contains the old '## Output format' section header
|
2. No file in agents/prompts/ contains the old '## Output format' section header
|
||||||
3. Every prompt file contains '## Return Format'
|
3. Every prompt file contains '## Return Format'
|
||||||
4. Every prompt file contains the full standard structure:
|
4. Every prompt file contains the full standard structure:
|
||||||
## Working Mode, ## Focus On (or ## Focus), ## Quality Checks (or ## Quality), ## Return Format
|
## Working Mode, ## Focus On, ## Quality Checks, ## Return Format, ## Constraints
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
@ -15,11 +15,42 @@ import pytest
|
||||||
|
|
||||||
PROMPTS_DIR = Path(__file__).parent.parent / "agents" / "prompts"
|
PROMPTS_DIR = Path(__file__).parent.parent / "agents" / "prompts"
|
||||||
|
|
||||||
|
# Single source of truth for required sections (decision #920)
|
||||||
|
REQUIRED_SECTIONS = [
|
||||||
|
"## Working Mode",
|
||||||
|
"## Focus On",
|
||||||
|
"## Quality Checks",
|
||||||
|
"## Return Format",
|
||||||
|
"## Constraints",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Files excluded from standard-structure checks (decision #917/#918)
|
||||||
|
# These files have anomaly-documenting tests that reference section headers
|
||||||
|
EXCLUDED_FROM_STRUCTURE_CHECK = [
|
||||||
|
"reviewer.md",
|
||||||
|
"tester.md",
|
||||||
|
"constitutional_validator.md",
|
||||||
|
"pm.md",
|
||||||
|
"backend_dev.md",
|
||||||
|
"debugger.md",
|
||||||
|
"frontend_dev.md",
|
||||||
|
"analyst.md",
|
||||||
|
"smoke_tester.md",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def _prompt_files():
|
def _prompt_files():
|
||||||
return sorted(PROMPTS_DIR.glob("*.md"))
|
return sorted(PROMPTS_DIR.glob("*.md"))
|
||||||
|
|
||||||
|
|
||||||
|
def _active_prompt_files():
|
||||||
|
"""Prompt files not in the exclusion list (decision #918)."""
|
||||||
|
return [f for f in _prompt_files() if f.name not in EXCLUDED_FROM_STRUCTURE_CHECK]
|
||||||
|
|
||||||
|
|
||||||
|
_ACTIVE_PROMPT_NAMES = [f.name for f in _active_prompt_files()]
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# AC-2: No legacy '## Output format' section
|
# AC-2: No legacy '## Output format' section
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
@ -78,36 +109,23 @@ class TestAllPromptsContainReturnFormat:
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# AC-4: Full standard structure in every prompt
|
# AC-4: Full standard structure in every active prompt (decision #917-#920)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
class TestAllPromptsContainStandardStructure:
|
class TestAllPromptsContainStandardStructure:
|
||||||
"""Проверяет наличие всех обязательных секций стандартного шаблона."""
|
"""Проверяет наличие полного набора обязательных секций во всех активных промптах.
|
||||||
|
|
||||||
REQUIRED_SECTIONS = [
|
Requirements:
|
||||||
"## Working Mode",
|
1. Каждый активный промпт содержит все 5 секций из REQUIRED_SECTIONS в правильном порядке
|
||||||
"## Return Format",
|
"""
|
||||||
]
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("prompt_file", [f.name for f in sorted(PROMPTS_DIR.glob("*.md"))])
|
@pytest.mark.parametrize("section", REQUIRED_SECTIONS)
|
||||||
def test_each_prompt_has_working_mode(self, prompt_file):
|
@pytest.mark.parametrize("prompt_file", _ACTIVE_PROMPT_NAMES)
|
||||||
"""Каждый промпт содержит секцию '## Working Mode'."""
|
def test_prompt_has_required_section(self, section, prompt_file):
|
||||||
|
"""Каждый активный промпт содержит каждую из 5 обязательных секций."""
|
||||||
content = (PROMPTS_DIR / prompt_file).read_text(encoding="utf-8")
|
content = (PROMPTS_DIR / prompt_file).read_text(encoding="utf-8")
|
||||||
assert "## Working Mode" in content, (
|
assert section in content, (
|
||||||
f"{prompt_file} не содержит секцию '## Working Mode'"
|
f"{prompt_file!r} не содержит обязательную секцию {section!r}"
|
||||||
)
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("prompt_file", [f.name for f in sorted(PROMPTS_DIR.glob("*.md"))])
|
|
||||||
def test_return_format_comes_after_working_mode(self, prompt_file):
|
|
||||||
"""Секция '## Return Format' идёт после '## Working Mode'."""
|
|
||||||
content = (PROMPTS_DIR / prompt_file).read_text(encoding="utf-8")
|
|
||||||
wm_pos = content.find("## Working Mode")
|
|
||||||
rf_pos = content.find("## Return Format")
|
|
||||||
if wm_pos == -1 or rf_pos == -1:
|
|
||||||
pytest.skip(f"{prompt_file}: одна из секций отсутствует (покрывается другим тестом)")
|
|
||||||
assert rf_pos > wm_pos, (
|
|
||||||
f"{prompt_file}: '## Return Format' (pos={rf_pos}) должна идти после "
|
|
||||||
f"'## Working Mode' (pos={wm_pos})"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue