From ecfd862dac77606764db0f4130a80847214d2d84 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Sun, 28 Dec 2025 12:49:48 -0800 Subject: [PATCH] Add preflight-tests step to mol-polecat-work Checks tests on main BEFORE starting work. Scotty Principle: - Quick fix (<15 min): Fix it, commit, continue - Big fix: File bead, notify Witness, proceed Closes gt-3zkjw --- .beads/formulas/mol-polecat-work.formula.toml | 75 ++++++++++++++++++- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/.beads/formulas/mol-polecat-work.formula.toml b/.beads/formulas/mol-polecat-work.formula.toml index 766da11a..f5d89670 100644 --- a/.beads/formulas/mol-polecat-work.formula.toml +++ b/.beads/formulas/mol-polecat-work.formula.toml @@ -33,7 +33,7 @@ You are an autonomous worker. You: | Context filling | Use gt handoff to cycle to fresh session | | Unsure what to do | Mail Witness, don't guess |""" formula = "mol-polecat-work" -version = 2 +version = 3 [[steps]] id = "load-context" @@ -131,10 +131,81 @@ If rebase conflicts: **Exit criteria:** You're on a clean feature branch, rebased on latest main.""" +[[steps]] +id = "preflight-tests" +title = "Verify tests pass on main" +needs = ["branch-setup"] +description = """ +Check if the codebase is healthy BEFORE starting your work. + +**The Scotty Principle:** Don't walk past a broken warp core. But also don't +let someone else's mess consume your entire mission. + +**1. Check tests on main:** +```bash +git stash # Save your branch state +git checkout origin/main +go test ./... # Or appropriate test command +``` + +**2. If tests PASS:** +```bash +git checkout - # Back to your branch +git stash pop # Restore state +``` +Continue to implement step. + +**3. If tests FAIL on main:** + +Make a judgment call: + +| Situation | Action | +|-----------|--------| +| Quick fix (<15 min) | Fix it, commit to main, then continue | +| Medium fix (15-60 min) | Fix if it blocks your work, else file bead | +| Big fix (>1 hour) | File bead, notify Witness, proceed with your work | + +**Quick fix path:** +```bash +# Fix the issue +git add +git commit -m "fix: (pre-existing failure)" +git push origin main +git checkout - +git stash pop +git rebase origin/main # Get your fix +``` + +**File and proceed path:** +```bash +bd create --title "Pre-existing test failure: " \ + --type bug --priority 1 + +gt mail send /witness -s "NOTICE: Main has failing tests" \ + -m "Found pre-existing test failures on main. +Filed: +Proceeding with my assigned work ({{issue}})." + +git checkout - +git stash pop +``` + +**Context consideration:** +If fixing pre-existing failures consumed significant context: +```bash +gt handoff -s "Fixed pre-existing failures, ready for assigned work" \ + -m "Issue: {{issue}} +Fixed: +Ready to start: implement step" +``` +Fresh session continues from implement. + +**Exit criteria:** Tests pass on main (or issue filed), ready to implement.""" + [[steps]] id = "implement" title = "Implement the solution" -needs = ["branch-setup"] +needs = ["preflight-tests"] description = """ Do the actual implementation work.