feat: add nix-hash staleness detection to bd preflight --check (bd-lfak.4)

- Add Warning field to CheckResult for soft failures
- Implement runNixHashCheck() that detects go.sum changes
- Warnings (⚠) shown separately from failures (✗)
- Warnings don't fail the overall preflight result
- Summary shows warning count separately
- Add test for warning state

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Executed-By: beads/crew/dave
Rig: beads
Role: crew
This commit is contained in:
beads/crew/dave
2025-12-31 00:05:53 -08:00
committed by Steve Yegge
parent 1b432ad9b6
commit 6298359b60
2 changed files with 75 additions and 0 deletions
+26
View File
@@ -126,6 +126,32 @@ func TestPreflightResult_WithSkipped(t *testing.T) {
}
}
func TestPreflightResult_WithWarning(t *testing.T) {
results := PreflightResult{
Checks: []CheckResult{
{Name: "Tests pass", Passed: true, Command: "go test ./..."},
{Name: "Nix hash current", Passed: false, Warning: true, Command: "git diff HEAD -- go.sum", Output: "go.sum changed"},
},
Passed: true, // Warnings don't fail the overall result
Summary: "1/2 checks passed, 1 warning(s)",
}
// Warnings don't count as failures
if !results.Passed {
t.Error("Expected result to pass (warning doesn't count as failure)")
}
warnCount := 0
for _, c := range results.Checks {
if c.Warning {
warnCount++
}
}
if warnCount != 1 {
t.Errorf("Expected 1 warning, got %d", warnCount)
}
}
func TestTruncateOutput(t *testing.T) {
tests := []struct {
name string