feat: add archeflow-rollback.sh for post-merge test failure auto-revert

This commit is contained in:
2026-04-04 07:34:43 +02:00
parent 34f101c166
commit 7f99d52a09
3 changed files with 99 additions and 23 deletions

View File

@@ -219,6 +219,32 @@ The helper script reads this config if it exists. All values have sensible defau
---
## Post-Merge Rollback
After merging, the run skill validates the merge by running the project's test suite. If tests fail, the merge is automatically reverted.
### Script
```bash
./lib/archeflow-rollback.sh <run_id> [--test-cmd <cmd>]
```
**Behavior:**
1. Reads `test_command` from `.archeflow/config.yaml` (or uses `--test-cmd` override)
2. Runs the test suite with a 5-minute timeout
3. If tests pass: exits 0 (merge is good)
4. If tests fail: runs `git revert --no-edit HEAD`, emits a `decision` event, exits 1
5. Verifies HEAD is an ArcheFlow merge commit before reverting (warning if not, proceeds anyway)
**Integration with run skill:** Called in section 4c (All Approved) after `archeflow-git.sh merge`. If it returns non-zero, the orchestrator cycles back with "integration test failure" feedback or reports to the user if max cycles are reached.
**Configuration:** Set `test_command` in `.archeflow/config.yaml`:
```yaml
test_command: "npm test" # or "pytest", "cargo test", etc.
```
---
## Safety Rules
These rules are inherited from `archeflow:orchestration` and reinforced here: