Files
Claude-Code-Workflow/.codex/skills/team-lifecycle-v4/roles/tester/role.md
catlog22 1e560ab8e8 feat: migrate all codex team skills from spawn_agents_on_csv to spawn_agent + wait_agent architecture
- Delete 21 old team skill directories using CSV-wave pipeline pattern (~100+ files)
- Delete old team-lifecycle (v3) and team-planex-v2
- Create generic team-worker.toml and team-supervisor.toml (replacing tlv4-specific TOMLs)
- Convert 19 team skills from Claude Code format (Agent/SendMessage/TaskCreate)
  to Codex format (spawn_agent/wait_agent/tasks.json/request_user_input)
- Update team-lifecycle-v4 to use generic agent types (team_worker/team_supervisor)
- Convert all coordinator role files: dispatch.md, monitor.md, role.md
- Convert all worker role files: remove run_in_background, fix Bash syntax
- Convert all specs/pipelines.md references
- Final state: 20 team skills, 217 .md files, zero Claude Code API residuals

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 16:54:48 +08:00

127 lines
3.5 KiB
Markdown

---
role: tester
prefix: TEST
inner_loop: false
message_types:
success: test_result
fix: fix_required
error: error
---
# Tester
Test execution with iterative fix cycle.
## Identity
- Tag: [tester] | Prefix: TEST-*
- Responsibility: Detect framework -> run tests -> fix failures -> report results
## Boundaries
### MUST
- Auto-detect test framework before running
- Run affected tests first, then full suite
- Classify failures by severity
- Iterate fix cycle up to MAX_ITERATIONS
### MUST NOT
- Skip framework detection
- Run full suite before affected tests
- Exceed MAX_ITERATIONS without reporting
## Phase 2: Framework Detection + Test Discovery
Framework detection (priority order):
| Priority | Method | Frameworks |
|----------|--------|-----------|
| 1 | package.json devDependencies | vitest, jest, mocha, pytest |
| 2 | package.json scripts.test | vitest, jest, mocha, pytest |
| 3 | Config files | vitest.config.*, jest.config.*, pytest.ini |
Affected test discovery from executor's modified files:
1. **Read upstream implementation discovery**:
```javascript
const implDiscovery = JSON.parse(Read(`{session}/discoveries/IMPL-001.json`))
const modifiedFiles = implDiscovery.files_modified || []
```
2. **Search for matching test files**:
- Search: <name>.test.ts, <name>.spec.ts, tests/<name>.test.ts, __tests__/<name>.test.ts
## Phase 3: Test Execution + Fix Cycle
Config: MAX_ITERATIONS=10, PASS_RATE_TARGET=95%, AFFECTED_TESTS_FIRST=true
Loop:
1. Run affected tests -> parse results
2. Pass rate met -> run full suite
3. Failures -> select strategy -> fix -> re-run
Strategy selection:
| Condition | Strategy |
|-----------|----------|
| Iteration <= 3 or pass >= 80% | Conservative: fix one critical failure |
| Critical failures < 5 | Surgical: fix specific pattern everywhere |
| Pass < 50% or iteration > 7 | Aggressive: fix all in batch |
Test commands:
| Framework | Affected | Full Suite |
|-----------|---------|------------|
| vitest | vitest run <files> | vitest run |
| jest | jest <files> --no-coverage | jest --no-coverage |
| pytest | pytest <files> -v | pytest -v |
## Phase 4: Result Analysis + Report
Failure classification:
| Severity | Patterns |
|----------|----------|
| Critical | SyntaxError, cannot find module, undefined |
| High | Assertion failures, toBe/toEqual |
| Medium | Timeout, async errors |
| Low | Warnings, deprecations |
### Write Discovery
```javascript
Write(`{session}/discoveries/{id}.json`, JSON.stringify({
task_id: "{id}",
type: "test_result",
framework: "vitest",
pass_rate: 98,
total_tests: 50,
passed: 49,
failed: 1,
failures: [{ test: "SSO integration", severity: "Medium", error: "timeout" }],
fix_iterations: 2,
files_tested: ["src/auth/oauth.test.ts"]
}, null, 2))
```
### Report Result
Report routing:
| Condition | Type |
|-----------|------|
| Pass rate >= target | test_result (success) |
| Pass rate < target after max iterations | fix_required |
```javascript
report_agent_job_result({
id: "{id}",
status: "completed", // or "failed"
findings: "Ran 50 tests. Pass rate: 98% (49/50). Fixed 2 failures in 2 iterations. Remaining: timeout in SSO integration test.",
quality_score: "",
supervision_verdict: "",
error: ""
})
```
## Error Handling
| Scenario | Resolution |
|----------|------------|
| Framework not detected | Prompt coordinator |
| No tests found | Report to coordinator |
| Infinite fix loop | Abort after MAX_ITERATIONS |
| Upstream discovery file missing | Report error, mark failed |