Required by bd cook command - each step needs a title field. Cooked 4 protos: deacon(9), witness(10), refinery(11), polecat-arm(6)
165 lines
4.4 KiB
YAML
165 lines
4.4 KiB
YAML
# Refinery Patrol: Merge queue processor with verification gates
|
|
# The Refinery is the Engineer in the engine room. You process polecat branches,
|
|
# merging them to main one at a time with sequential rebasing.
|
|
|
|
formula: mol-refinery-patrol
|
|
description: |
|
|
Merge queue processor patrol loop.
|
|
|
|
The Refinery is the Engineer in the engine room. You process polecat branches,
|
|
merging them to main one at a time with sequential rebasing.
|
|
|
|
**The Scotty Test**: Before proceeding past any failure, ask yourself:
|
|
"Would Scotty walk past a warp core leak because it existed before his shift?"
|
|
version: 1
|
|
|
|
steps:
|
|
- id: inbox-check
|
|
title: Check refinery mail
|
|
description: |
|
|
Check mail for MR submissions, escalations, messages.
|
|
|
|
```bash
|
|
gt mail inbox
|
|
# Process any urgent items
|
|
```
|
|
|
|
Handle shutdown requests, escalations, and status queries.
|
|
|
|
- id: queue-scan
|
|
title: Scan merge queue
|
|
needs: [inbox-check]
|
|
description: |
|
|
Fetch remote and identify polecat branches waiting.
|
|
|
|
```bash
|
|
git fetch origin
|
|
git branch -r | grep polecat
|
|
gt refinery queue <rig>
|
|
```
|
|
|
|
If queue empty, skip to context-check step.
|
|
Track branch list for this cycle.
|
|
|
|
- id: process-branch
|
|
title: Process next branch
|
|
needs: [queue-scan]
|
|
description: |
|
|
Pick next branch. Rebase on current main.
|
|
|
|
```bash
|
|
git checkout -b temp origin/<polecat-branch>
|
|
git rebase origin/main
|
|
```
|
|
|
|
If rebase conflicts and unresolvable:
|
|
- git rebase --abort
|
|
- Notify polecat to fix and resubmit
|
|
- Skip to loop-check for next branch
|
|
|
|
- id: run-tests
|
|
title: Run test suite
|
|
needs: [process-branch]
|
|
description: |
|
|
Run the test suite.
|
|
|
|
```bash
|
|
go test ./...
|
|
```
|
|
|
|
Track results: pass count, fail count, specific failures.
|
|
|
|
- id: handle-failures
|
|
title: Handle test failures
|
|
needs: [run-tests]
|
|
description: |
|
|
**VERIFICATION GATE**: This step enforces the Beads Promise.
|
|
|
|
If tests PASSED: This step auto-completes. Proceed to merge.
|
|
|
|
If tests FAILED:
|
|
1. Diagnose: Is this a branch regression or pre-existing on main?
|
|
2. If branch caused it:
|
|
- Abort merge
|
|
- Notify polecat: "Tests failing. Please fix and resubmit."
|
|
- Skip to loop-check
|
|
3. If pre-existing on main:
|
|
- Option A: Fix it yourself (you're the Engineer!)
|
|
- Option B: File a bead: bd create --type=bug --priority=1 --title="..."
|
|
|
|
**GATE REQUIREMENT**: You CANNOT proceed to merge-push without:
|
|
- Tests passing, OR
|
|
- Fix committed, OR
|
|
- Bead filed for the failure
|
|
|
|
This is non-negotiable. Never disavow. Never "note and proceed."
|
|
|
|
- id: merge-push
|
|
title: Merge and push to main
|
|
needs: [handle-failures]
|
|
description: |
|
|
Merge to main and push immediately.
|
|
|
|
```bash
|
|
git checkout main
|
|
git merge --ff-only temp
|
|
git push origin main
|
|
git branch -d temp
|
|
git branch -D <polecat-branch> # Local delete (branches never go to origin)
|
|
```
|
|
|
|
Main has moved. Any remaining branches need rebasing on new baseline.
|
|
|
|
- id: loop-check
|
|
title: Check for more work
|
|
needs: [merge-push]
|
|
description: |
|
|
More branches to process?
|
|
|
|
If yes: Return to process-branch with next branch.
|
|
If no: Continue to generate-summary.
|
|
|
|
Track: branches processed, branches skipped (with reasons).
|
|
|
|
- id: generate-summary
|
|
title: Generate handoff summary
|
|
needs: [loop-check]
|
|
description: |
|
|
Summarize this patrol cycle.
|
|
|
|
Include:
|
|
- Branches processed (count, names)
|
|
- Test results (pass/fail)
|
|
- Issues filed (if any)
|
|
- Branches skipped (with reasons)
|
|
- Any escalations sent
|
|
|
|
This becomes the digest when the patrol is squashed.
|
|
|
|
- id: context-check
|
|
title: Check own context limit
|
|
needs: [generate-summary]
|
|
description: |
|
|
Check own context usage.
|
|
|
|
If context is HIGH (>80%):
|
|
- Write handoff summary
|
|
- Prepare for burn/respawn
|
|
|
|
If context is LOW:
|
|
- Can continue processing
|
|
|
|
- id: burn-or-loop
|
|
title: Burn and respawn or loop
|
|
needs: [context-check]
|
|
description: |
|
|
End of patrol cycle decision.
|
|
|
|
If queue non-empty AND context LOW:
|
|
- Burn this wisp, start fresh patrol
|
|
- Return to inbox-check
|
|
|
|
If queue empty OR context HIGH:
|
|
- Burn wisp with summary digest
|
|
- Exit (daemon will respawn if needed)
|