feat: add DAG-based parallel phase execution with depends_on support

Phases can now declare `depends_on` to enable parallel execution of
independent phases via asyncio.gather. Backward compatible — templates
without depends_on continue to use sequential execution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
renjianbo
2026-06-18 21:31:16 +08:00
parent ed724dad1b
commit e0efa7e9b1
2 changed files with 408 additions and 170 deletions

View File

@@ -800,35 +800,32 @@ Output format — include a JSON release plan:
}"""
TEST_PLANNER_PROMPT = """You are a Test Planner leading a user simulation testing team. Your job is to design test strategies that simulate real user behavior to verify system applications.
TEST_PLANNER_PROMPT = """CRITICAL: Your ENTIRE response must be a single valid JSON object. Do NOT output any markdown, any explanatory text, or any code fences. The first character must be { and the last must be }.
Your responsibilities:
1. Analyze the target application — understand its user personas, core workflows, and business logic
2. Design realistic user scenarios — create test cases that mirror how actual users would interact with the system
3. Prioritize test scenarios by risk and business impact
4. Assign test areas to team members based on their expertise
5. Compile test results into a comprehensive test report
You are a Test Planner leading a system application testing team with: Functional Tester, UX Reviewer, Edge Explorer, Performance Evaluator.
When you receive a testing task:
- First, identify the target application's user profiles (e.g., novice user, power user, admin)
- Map out the critical user journeys across the application
- Design test scenarios covering: happy path, alternative paths, edge cases, error recovery
- Create a test plan with clear acceptance criteria
- Coordinate with functional testers, UX reviewers, edge explorers, and performance evaluators
When given a project, output ONLY this JSON (no other text):
Output format — include a JSON test plan:
{
"application_name": "...",
"user_personas": [{"name": "...", "description": "...", "typical_tasks": ["..."]}],
"test_scenarios": [
{"id": "TS-001", "name": "...", "priority": "P0/P1/P2", "persona": "...", "steps": ["..."], "expected_result": "..."}
"project_name": "...",
"analysis": "...",
"user_stories": ["..."],
"phases": [
{
"phase": 1,
"name": "...",
"role": "functional_tester|ux_reviewer|edge_explorer|performance_evaluator",
"description": "...",
"expected_output": "...",
"depends_on": []
}
],
"test_coverage": {"happy_path_pct": N, "error_path_pct": N, "edge_case_pct": N},
"risk_areas": [{"area": "...", "risk": "high/medium/low", "mitigation": "..."}],
"team_assignments": {"functional_tester": ["..."], "ux_reviewer": ["..."], "edge_explorer": ["..."], "performance_evaluator": ["..."]}
"acceptance_criteria": ["..."]
}
Always provide actionable, specific test scenarios — not generic testing advice."""
Role assignment priority: functional_tester (core features), ux_reviewer (UX), edge_explorer (edge cases), performance_evaluator (load/perf). 4-6 phases. Use Chinese.
depends_on: list of phase numbers this phase depends on. Phases with no mutual dependencies will execute in PARALLEL. Example: UX review and edge exploration can both depend on functional testing, and they'll run concurrently. Omit or use [] for phases with no dependencies (they can run immediately)."""
FUNCTIONAL_TESTER_PROMPT = """You are a Functional Tester simulating a real user. You verify that system features work correctly from the end-user's perspective.
@@ -1193,13 +1190,16 @@ Always output your plan as valid JSON with this structure:
"name": "Requirements Analysis",
"role": "pm",
"description": "Detailed description of what this phase must accomplish",
"expected_output": "What deliverables this phase produces"
"expected_output": "What deliverables this phase produces",
"depends_on": []
}
],
"acceptance_criteria": ["criterion1", "criterion2"]
}
Keep the plan focused and practical. 4-7 phases is ideal. Use Chinese for output when the project description is in Chinese."""
Keep the plan focused and practical. 4-7 phases is ideal. Use Chinese for output when the project description is in Chinese.
depends_on: list of phase numbers this phase depends on. Phases with no mutual dependencies will execute in PARALLEL. Example: after PM's requirements (phase 1), Designer (phase 2) and Developer (phase 3) can both depend on phase 1 and run concurrently. Omit or use [] for phases with no dependencies."""
DESIGNER_SYSTEM_PROMPT = """You are a UX/UI Designer. Your responsibilities: