feat: add test-first validation gate in Do phase
This commit is contained in:
@@ -165,3 +165,29 @@ Before your final commit, verify:
|
|||||||
- [ ] Every logical step has its own commit
|
- [ ] Every logical step has its own commit
|
||||||
- [ ] Output summary is complete and accurate
|
- [ ] Output summary is complete and accurate
|
||||||
- [ ] Branch name follows convention
|
- [ ] 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: <test strategy section>. 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.
|
||||||
|
|||||||
@@ -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.
|
**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":"<pass|warn|retry>","rationale":"<reason>"}' "$SEQ_MAKER_COMPLETE"
|
||||||
|
```
|
||||||
|
|
||||||
|
The re-run prompt for the retry case:
|
||||||
|
> "The proposal specified these test cases: <test strategy section>. 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
|
#### 2b. Phase Transition: Do to Check
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
Reference in New Issue
Block a user