"""Doc-contract checks for task-specific LLM workflow split (#333).""" from pathlib import Path REPO_ROOT = Path(__file__).resolve().parent.parent SKILL_DIR = REPO_ROOT / "skills" / "llm-project-workflow" def test_work_issue_workflow_file_exists(): path = SKILL_DIR / "workflows" / "work-issue.md" text = path.read_text(encoding="utf-8") assert "canonical: true" in text assert "work-issue" in text assert "## 0. Load the canonical workflow first" in text assert "## 29. Controller handoff schema" in text assert "## 30. Stop conditions summary" in text assert "ISSUE_ELIGIBILITY_UNVERIFIED" in text assert "OPEN_PR_EXISTS" in text assert "author/coder workflow" in text.lower() def test_work_issue_final_report_schema_exists(): path = SKILL_DIR / "schemas" / "work-issue-final-report.md" text = path.read_text(encoding="utf-8") assert "Controller Handoff" in text assert "Issue inventory pagination proof:" in text assert "File edits by author:" in text assert "Workspace mutations" in text # documented as rejected def test_skill_router_points_to_work_issue_workflow(): skill = (SKILL_DIR / "SKILL.md").read_text(encoding="utf-8") assert "## Task mode router" in skill assert "workflows/work-issue.md" in skill assert "schemas/work-issue-final-report.md" in skill assert "Identify task mode before any mutation" in skill def test_skill_still_declares_controller_handoff_contract(): skill = (SKILL_DIR / "SKILL.md").read_text(encoding="utf-8") assert "## Controller Handoff" in skill assert "assess_controller_handoff" in skill assert "## Global LLM Worktree Rule" in skill def test_start_issue_template_references_work_issue_workflow(): text = (SKILL_DIR / "templates" / "start-issue.md").read_text(encoding="utf-8") assert "workflows/work-issue.md" in text