diff --git a/skills/do-phase/SKILL.md b/skills/do-phase/SKILL.md index b4f7470..39d560a 100644 --- a/skills/do-phase/SKILL.md +++ b/skills/do-phase/SKILL.md @@ -165,3 +165,29 @@ Before your final commit, verify: - [ ] Every logical step has its own commit - [ ] Output summary is complete and accurate - [ ] Branch name follows convention + +## Test-First Gate + +Before the Maker's output is accepted, the orchestrator validates that tests were included. + +### Validation Logic + +Read `do-maker-files.txt`. Check if any file path matches common test patterns: +- `*test*`, `*spec*`, `*.test.*`, `*.spec.*`, `*_test.*`, `*_spec.*` +- Files in directories named `test/`, `tests/`, `__tests__/`, `spec/` + +For writing domain projects, this gate is skipped. + +### Outcomes + +| Result | Action | +|--------|--------| +| Test files found | Pass — proceed to Check phase | +| No test files, code domain | **Warn** — emit WARNING event, note in do-maker.md | +| No test files + Creator specified tests | **Block** — re-run Maker with test instruction (1 retry) | +| Writing domain | Skip gate entirely | + +The block case triggers a targeted re-run with prompt: +"The proposal specified these test cases: . No test files +were found in your changes. Add the specified tests before finishing." +This is one retry within the Do phase, not a full PDCA cycle. diff --git a/skills/run/SKILL.md b/skills/run/SKILL.md index 9eb6b2c..daaa244 100644 --- a/skills/run/SKILL.md +++ b/skills/run/SKILL.md @@ -245,6 +245,28 @@ After Maker returns: **Critical:** Verify the Maker committed its changes before proceeding. If uncommitted changes exist, instruct the Maker to commit. +#### 2a-ii. Test-First Validation + +After Maker completes, check `do-maker-files.txt` for test files: +```bash +TEST_FILES=$(grep -iE '(test|spec)' ".archeflow/artifacts/${RUN_ID}/do-maker-files.txt" || true) +``` + +If `TEST_FILES` is empty and domain is not `writing`: +1. Check if `plan-creator.md` contains a `### Test Strategy` section +2. If yes: re-run Maker with targeted test instruction (one retry within Do phase) +3. If no test strategy specified: emit WARNING event and proceed + +```bash +./lib/archeflow-event.sh "$RUN_ID" decision do "" \ + '{"what":"test_first_gate","chosen":"","rationale":""}' "$SEQ_MAKER_COMPLETE" +``` + +The re-run prompt for the retry case: +> "The proposal specified these test cases: . No test files were found in your changes. Add the specified tests before finishing." + +This is one retry within the Do phase, not a full PDCA cycle. If the retry also produces no tests, emit WARNING and proceed to Check. + #### 2b. Phase Transition: Do to Check ```bash