feat: Unified beads redirect for tracked and local beads (#222)

* feat: Beads redirect architecture for tracked and local beads

This change implements proper redirect handling so that all rig agents
(Witness, Refinery, Crew, Polecats) can work with both:
- Tracked beads: .beads/ checked into git at mayor/rig/.beads
- Local beads: .beads/ created at rig root during gt rig add

Key changes:

1. SetupRedirect now handles tracked beads by skipping redirect chains.
   The bd CLI doesn't support chains (A→B→C), so worktrees redirect
   directly to the final destination (mayor/rig/.beads for tracked).

2. ResolveBeadsDir is now used consistently in polecat and refinery
   managers instead of hardcoded mayor/rig paths.

3. Rig-level agents (witness, refinery) now use rig beads with rig
   prefix instead of town beads. This follows the architecture where
   town beads are only for Mayor/Deacon.

4. prime.go simplified to always use ../../.beads for crew redirects,
   letting rig-level redirect handle tracked vs local routing.

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

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

* feat(doctor): Add beads-redirect check for tracked beads

When a repo has .beads/ tracked in git (at mayor/rig/.beads), the rig root
needs a redirect file pointing to that location. This check:

- Detects missing rig-level redirect for tracked beads
- Verifies redirect points to correct location (mayor/rig/.beads)
- Auto-fixes with 'gt doctor --fix'

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

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

* fix: Handle fileLock.Unlock error in daemon

Wrap fileLock.Unlock() return value to satisfy errcheck linter.

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

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

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Julian Knutsen
2026-01-06 12:59:37 -08:00
committed by GitHub
parent 16fb45bb2a
commit 9d7dcde1e2
11 changed files with 1075 additions and 231 deletions

View File

@@ -7,6 +7,8 @@ import (
"os/exec"
"path/filepath"
"strings"
"github.com/steveyegge/gastown/internal/config"
)
// RigIsGitRepoCheck verifies the rig has a valid mayor/rig git clone.
@@ -865,6 +867,214 @@ func (c *BeadsConfigValidCheck) Fix(ctx *CheckContext) error {
return nil
}
// BeadsRedirectCheck verifies that rig-level beads redirect exists for tracked beads.
// When a repo has .beads/ tracked in git (at mayor/rig/.beads), the rig root needs
// a redirect file pointing to that location.
type BeadsRedirectCheck struct {
FixableCheck
}
// NewBeadsRedirectCheck creates a new beads redirect check.
func NewBeadsRedirectCheck() *BeadsRedirectCheck {
return &BeadsRedirectCheck{
FixableCheck: FixableCheck{
BaseCheck: BaseCheck{
CheckName: "beads-redirect",
CheckDescription: "Verify rig-level beads redirect for tracked beads",
},
},
}
}
// Run checks if the rig-level beads redirect exists when needed.
func (c *BeadsRedirectCheck) Run(ctx *CheckContext) *CheckResult {
// Only applies when checking a specific rig
if ctx.RigName == "" {
return &CheckResult{
Name: c.Name(),
Status: StatusOK,
Message: "No rig specified (skipping redirect check)",
}
}
rigPath := ctx.RigPath()
mayorRigBeads := filepath.Join(rigPath, "mayor", "rig", ".beads")
rigBeadsDir := filepath.Join(rigPath, ".beads")
redirectPath := filepath.Join(rigBeadsDir, "redirect")
// Check if this rig has tracked beads (mayor/rig/.beads exists)
if _, err := os.Stat(mayorRigBeads); os.IsNotExist(err) {
// No tracked beads - check if rig/.beads exists (local beads)
if _, err := os.Stat(rigBeadsDir); os.IsNotExist(err) {
return &CheckResult{
Name: c.Name(),
Status: StatusError,
Message: "No .beads directory found at rig root",
Details: []string{
"Beads database not initialized for this rig",
"This prevents issue tracking for this rig",
},
FixHint: "Run 'gt doctor --fix --rig " + ctx.RigName + "' to initialize beads",
}
}
return &CheckResult{
Name: c.Name(),
Status: StatusOK,
Message: "Rig uses local beads (no redirect needed)",
}
}
// Tracked beads exist - check for conflicting local beads
hasLocalData := hasBeadsData(rigBeadsDir)
redirectExists := false
if _, err := os.Stat(redirectPath); err == nil {
redirectExists = true
}
// Case: Local beads directory has actual data (not just redirect)
if hasLocalData && !redirectExists {
return &CheckResult{
Name: c.Name(),
Status: StatusError,
Message: "Conflicting local beads found with tracked beads",
Details: []string{
"Tracked beads exist at: mayor/rig/.beads",
"Local beads with data exist at: .beads/",
"Fix will remove local beads and create redirect to tracked beads",
},
FixHint: "Run 'gt doctor --fix --rig " + ctx.RigName + "' to fix",
}
}
// Case: No redirect file (but no conflicting data)
if !redirectExists {
return &CheckResult{
Name: c.Name(),
Status: StatusError,
Message: "Missing rig-level beads redirect for tracked beads",
Details: []string{
"Tracked beads exist at: mayor/rig/.beads",
"Missing redirect at: .beads/redirect",
"Without this redirect, bd commands from rig root won't find beads",
},
FixHint: "Run 'gt doctor --fix' to create the redirect",
}
}
// Verify redirect points to correct location
content, err := os.ReadFile(redirectPath)
if err != nil {
return &CheckResult{
Name: c.Name(),
Status: StatusWarning,
Message: fmt.Sprintf("Could not read redirect file: %v", err),
}
}
target := strings.TrimSpace(string(content))
if target != "mayor/rig/.beads" {
return &CheckResult{
Name: c.Name(),
Status: StatusError,
Message: fmt.Sprintf("Redirect points to %q, expected mayor/rig/.beads", target),
FixHint: "Run 'gt doctor --fix --rig " + ctx.RigName + "' to correct the redirect",
}
}
return &CheckResult{
Name: c.Name(),
Status: StatusOK,
Message: "Rig-level beads redirect is correctly configured",
}
}
// Fix creates or corrects the rig-level beads redirect, or initializes beads if missing.
func (c *BeadsRedirectCheck) Fix(ctx *CheckContext) error {
if ctx.RigName == "" {
return nil
}
rigPath := ctx.RigPath()
mayorRigBeads := filepath.Join(rigPath, "mayor", "rig", ".beads")
rigBeadsDir := filepath.Join(rigPath, ".beads")
redirectPath := filepath.Join(rigBeadsDir, "redirect")
// Check if tracked beads exist
hasTrackedBeads := true
if _, err := os.Stat(mayorRigBeads); os.IsNotExist(err) {
hasTrackedBeads = false
}
// Check if local beads exist
hasLocalBeads := true
if _, err := os.Stat(rigBeadsDir); os.IsNotExist(err) {
hasLocalBeads = false
}
// Case 1: No beads at all - initialize with bd init
if !hasTrackedBeads && !hasLocalBeads {
// Get the rig's beads prefix from rigs.json (falls back to "gt" if not found)
prefix := config.GetRigPrefix(ctx.TownRoot, ctx.RigName)
// Create .beads directory
if err := os.MkdirAll(rigBeadsDir, 0755); err != nil {
return fmt.Errorf("creating .beads directory: %w", err)
}
// Run bd init with the configured prefix
cmd := exec.Command("bd", "init", "--prefix", prefix)
cmd.Dir = rigPath
if output, err := cmd.CombinedOutput(); err != nil {
// bd might not be installed - create minimal config.yaml
configPath := filepath.Join(rigBeadsDir, "config.yaml")
configContent := fmt.Sprintf("prefix: %s\n", prefix)
if writeErr := os.WriteFile(configPath, []byte(configContent), 0644); writeErr != nil {
return fmt.Errorf("bd init failed (%v) and fallback config creation failed: %w", err, writeErr)
}
// Continue - minimal config created
} else {
_ = output // bd init succeeded
}
return nil
}
// Case 2: Tracked beads exist - create redirect (may need to remove conflicting local beads)
if hasTrackedBeads {
// Check if local beads have conflicting data
if hasLocalBeads && hasBeadsData(rigBeadsDir) {
// Remove conflicting local beads directory
if err := os.RemoveAll(rigBeadsDir); err != nil {
return fmt.Errorf("removing conflicting local beads: %w", err)
}
}
// Create .beads directory if needed
if err := os.MkdirAll(rigBeadsDir, 0755); err != nil {
return fmt.Errorf("creating .beads directory: %w", err)
}
// Write redirect file
if err := os.WriteFile(redirectPath, []byte("mayor/rig/.beads\n"), 0644); err != nil {
return fmt.Errorf("writing redirect file: %w", err)
}
}
return nil
}
// hasBeadsData checks if a beads directory has actual data (issues.jsonl, issues.db, config.yaml)
// as opposed to just being a redirect-only directory.
func hasBeadsData(beadsDir string) bool {
// Check for actual beads data files
dataFiles := []string{"issues.jsonl", "issues.db", "config.yaml"}
for _, f := range dataFiles {
if _, err := os.Stat(filepath.Join(beadsDir, f)); err == nil {
return true
}
}
return false
}
// RigChecks returns all rig-level health checks.
func RigChecks() []Check {
return []Check{
@@ -876,5 +1086,6 @@ func RigChecks() []Check {
NewMayorCloneExistsCheck(),
NewPolecatClonesValidCheck(),
NewBeadsConfigValidCheck(),
NewBeadsRedirectCheck(),
}
}

View File

@@ -0,0 +1,455 @@
package doctor
import (
"os"
"path/filepath"
"strings"
"testing"
)
func TestNewBeadsRedirectCheck(t *testing.T) {
check := NewBeadsRedirectCheck()
if check.Name() != "beads-redirect" {
t.Errorf("expected name 'beads-redirect', got %q", check.Name())
}
if !check.CanFix() {
t.Error("expected CanFix to return true")
}
}
func TestBeadsRedirectCheck_NoRigSpecified(t *testing.T) {
tmpDir := t.TempDir()
check := NewBeadsRedirectCheck()
ctx := &CheckContext{TownRoot: tmpDir, RigName: ""}
result := check.Run(ctx)
if result.Status != StatusOK {
t.Errorf("expected StatusOK when no rig specified, got %v", result.Status)
}
if !strings.Contains(result.Message, "skipping") {
t.Errorf("expected message about skipping, got %q", result.Message)
}
}
func TestBeadsRedirectCheck_NoBeadsAtAll(t *testing.T) {
tmpDir := t.TempDir()
rigName := "testrig"
rigDir := filepath.Join(tmpDir, rigName)
if err := os.MkdirAll(rigDir, 0755); err != nil {
t.Fatal(err)
}
check := NewBeadsRedirectCheck()
ctx := &CheckContext{TownRoot: tmpDir, RigName: rigName}
result := check.Run(ctx)
if result.Status != StatusError {
t.Errorf("expected StatusError when no beads exist (fixable), got %v", result.Status)
}
}
func TestBeadsRedirectCheck_LocalBeadsOnly(t *testing.T) {
tmpDir := t.TempDir()
rigName := "testrig"
rigDir := filepath.Join(tmpDir, rigName)
// Create local beads at rig root (no mayor/rig/.beads)
localBeads := filepath.Join(rigDir, ".beads")
if err := os.MkdirAll(localBeads, 0755); err != nil {
t.Fatal(err)
}
check := NewBeadsRedirectCheck()
ctx := &CheckContext{TownRoot: tmpDir, RigName: rigName}
result := check.Run(ctx)
if result.Status != StatusOK {
t.Errorf("expected StatusOK for local beads (no redirect needed), got %v", result.Status)
}
if !strings.Contains(result.Message, "local beads") {
t.Errorf("expected message about local beads, got %q", result.Message)
}
}
func TestBeadsRedirectCheck_TrackedBeadsMissingRedirect(t *testing.T) {
tmpDir := t.TempDir()
rigName := "testrig"
rigDir := filepath.Join(tmpDir, rigName)
// Create tracked beads at mayor/rig/.beads
trackedBeads := filepath.Join(rigDir, "mayor", "rig", ".beads")
if err := os.MkdirAll(trackedBeads, 0755); err != nil {
t.Fatal(err)
}
check := NewBeadsRedirectCheck()
ctx := &CheckContext{TownRoot: tmpDir, RigName: rigName}
result := check.Run(ctx)
if result.Status != StatusError {
t.Errorf("expected StatusError for missing redirect, got %v", result.Status)
}
if !strings.Contains(result.Message, "Missing") {
t.Errorf("expected message about missing redirect, got %q", result.Message)
}
}
func TestBeadsRedirectCheck_TrackedBeadsCorrectRedirect(t *testing.T) {
tmpDir := t.TempDir()
rigName := "testrig"
rigDir := filepath.Join(tmpDir, rigName)
// Create tracked beads at mayor/rig/.beads
trackedBeads := filepath.Join(rigDir, "mayor", "rig", ".beads")
if err := os.MkdirAll(trackedBeads, 0755); err != nil {
t.Fatal(err)
}
// Create rig-level .beads with correct redirect
rigBeads := filepath.Join(rigDir, ".beads")
if err := os.MkdirAll(rigBeads, 0755); err != nil {
t.Fatal(err)
}
redirectPath := filepath.Join(rigBeads, "redirect")
if err := os.WriteFile(redirectPath, []byte("mayor/rig/.beads\n"), 0644); err != nil {
t.Fatal(err)
}
check := NewBeadsRedirectCheck()
ctx := &CheckContext{TownRoot: tmpDir, RigName: rigName}
result := check.Run(ctx)
if result.Status != StatusOK {
t.Errorf("expected StatusOK for correct redirect, got %v", result.Status)
}
if !strings.Contains(result.Message, "correctly configured") {
t.Errorf("expected message about correct config, got %q", result.Message)
}
}
func TestBeadsRedirectCheck_TrackedBeadsWrongRedirect(t *testing.T) {
tmpDir := t.TempDir()
rigName := "testrig"
rigDir := filepath.Join(tmpDir, rigName)
// Create tracked beads at mayor/rig/.beads
trackedBeads := filepath.Join(rigDir, "mayor", "rig", ".beads")
if err := os.MkdirAll(trackedBeads, 0755); err != nil {
t.Fatal(err)
}
// Create rig-level .beads with wrong redirect
rigBeads := filepath.Join(rigDir, ".beads")
if err := os.MkdirAll(rigBeads, 0755); err != nil {
t.Fatal(err)
}
redirectPath := filepath.Join(rigBeads, "redirect")
if err := os.WriteFile(redirectPath, []byte("wrong/path\n"), 0644); err != nil {
t.Fatal(err)
}
check := NewBeadsRedirectCheck()
ctx := &CheckContext{TownRoot: tmpDir, RigName: rigName}
result := check.Run(ctx)
if result.Status != StatusError {
t.Errorf("expected StatusError for wrong redirect (fixable), got %v", result.Status)
}
if !strings.Contains(result.Message, "wrong/path") {
t.Errorf("expected message to contain wrong path, got %q", result.Message)
}
}
func TestBeadsRedirectCheck_FixWrongRedirect(t *testing.T) {
tmpDir := t.TempDir()
rigName := "testrig"
rigDir := filepath.Join(tmpDir, rigName)
// Create tracked beads at mayor/rig/.beads
trackedBeads := filepath.Join(rigDir, "mayor", "rig", ".beads")
if err := os.MkdirAll(trackedBeads, 0755); err != nil {
t.Fatal(err)
}
// Create rig-level .beads with wrong redirect
rigBeads := filepath.Join(rigDir, ".beads")
if err := os.MkdirAll(rigBeads, 0755); err != nil {
t.Fatal(err)
}
redirectPath := filepath.Join(rigBeads, "redirect")
if err := os.WriteFile(redirectPath, []byte("wrong/path\n"), 0644); err != nil {
t.Fatal(err)
}
check := NewBeadsRedirectCheck()
ctx := &CheckContext{TownRoot: tmpDir, RigName: rigName}
// Verify fix is needed
result := check.Run(ctx)
if result.Status != StatusError {
t.Fatalf("expected StatusError before fix, got %v", result.Status)
}
// Apply fix
if err := check.Fix(ctx); err != nil {
t.Fatalf("Fix failed: %v", err)
}
// Verify redirect was corrected
content, err := os.ReadFile(redirectPath)
if err != nil {
t.Fatalf("redirect file not found: %v", err)
}
if string(content) != "mayor/rig/.beads\n" {
t.Errorf("redirect content = %q, want 'mayor/rig/.beads\\n'", string(content))
}
// Verify check now passes
result = check.Run(ctx)
if result.Status != StatusOK {
t.Errorf("expected StatusOK after fix, got %v", result.Status)
}
}
func TestBeadsRedirectCheck_Fix(t *testing.T) {
tmpDir := t.TempDir()
rigName := "testrig"
rigDir := filepath.Join(tmpDir, rigName)
// Create tracked beads at mayor/rig/.beads
trackedBeads := filepath.Join(rigDir, "mayor", "rig", ".beads")
if err := os.MkdirAll(trackedBeads, 0755); err != nil {
t.Fatal(err)
}
check := NewBeadsRedirectCheck()
ctx := &CheckContext{TownRoot: tmpDir, RigName: rigName}
// Verify fix is needed
result := check.Run(ctx)
if result.Status != StatusError {
t.Fatalf("expected StatusError before fix, got %v", result.Status)
}
// Apply fix
if err := check.Fix(ctx); err != nil {
t.Fatalf("Fix failed: %v", err)
}
// Verify redirect file was created
redirectPath := filepath.Join(rigDir, ".beads", "redirect")
content, err := os.ReadFile(redirectPath)
if err != nil {
t.Fatalf("redirect file not created: %v", err)
}
expected := "mayor/rig/.beads\n"
if string(content) != expected {
t.Errorf("redirect content = %q, want %q", string(content), expected)
}
// Verify check now passes
result = check.Run(ctx)
if result.Status != StatusOK {
t.Errorf("expected StatusOK after fix, got %v", result.Status)
}
}
func TestBeadsRedirectCheck_FixNoOp_LocalBeads(t *testing.T) {
tmpDir := t.TempDir()
rigName := "testrig"
rigDir := filepath.Join(tmpDir, rigName)
// Create only local beads (no tracked beads)
localBeads := filepath.Join(rigDir, ".beads")
if err := os.MkdirAll(localBeads, 0755); err != nil {
t.Fatal(err)
}
check := NewBeadsRedirectCheck()
ctx := &CheckContext{TownRoot: tmpDir, RigName: rigName}
// Fix should be a no-op
if err := check.Fix(ctx); err != nil {
t.Fatalf("Fix failed: %v", err)
}
// Verify no redirect was created
redirectPath := filepath.Join(rigDir, ".beads", "redirect")
if _, err := os.Stat(redirectPath); !os.IsNotExist(err) {
t.Error("redirect file should not be created for local beads")
}
}
func TestBeadsRedirectCheck_FixInitBeads(t *testing.T) {
tmpDir := t.TempDir()
rigName := "testrig"
rigDir := filepath.Join(tmpDir, rigName)
// Create rig directory (no beads at all)
if err := os.MkdirAll(rigDir, 0755); err != nil {
t.Fatal(err)
}
// Create mayor/rigs.json with prefix for the rig
mayorDir := filepath.Join(tmpDir, "mayor")
if err := os.MkdirAll(mayorDir, 0755); err != nil {
t.Fatal(err)
}
rigsJSON := `{
"version": 1,
"rigs": {
"testrig": {
"git_url": "https://example.com/test.git",
"beads": {
"prefix": "tr"
}
}
}
}`
if err := os.WriteFile(filepath.Join(mayorDir, "rigs.json"), []byte(rigsJSON), 0644); err != nil {
t.Fatal(err)
}
check := NewBeadsRedirectCheck()
ctx := &CheckContext{TownRoot: tmpDir, RigName: rigName}
// Verify fix is needed
result := check.Run(ctx)
if result.Status != StatusError {
t.Fatalf("expected StatusError before fix, got %v", result.Status)
}
// Apply fix - this will run 'bd init' if available, otherwise create config.yaml
if err := check.Fix(ctx); err != nil {
t.Fatalf("Fix failed: %v", err)
}
// Verify .beads directory was created
beadsDir := filepath.Join(rigDir, ".beads")
if _, err := os.Stat(beadsDir); os.IsNotExist(err) {
t.Fatal(".beads directory not created")
}
// Verify beads was initialized (either by bd init or fallback)
// bd init creates config.yaml, fallback creates config.yaml with prefix
configPath := filepath.Join(beadsDir, "config.yaml")
if _, err := os.Stat(configPath); os.IsNotExist(err) {
t.Fatal("config.yaml not created")
}
// Verify check now passes (local beads exist)
result = check.Run(ctx)
if result.Status != StatusOK {
t.Errorf("expected StatusOK after fix, got %v", result.Status)
}
}
func TestBeadsRedirectCheck_ConflictingLocalBeads(t *testing.T) {
tmpDir := t.TempDir()
rigName := "testrig"
rigDir := filepath.Join(tmpDir, rigName)
// Create tracked beads at mayor/rig/.beads
trackedBeads := filepath.Join(rigDir, "mayor", "rig", ".beads")
if err := os.MkdirAll(trackedBeads, 0755); err != nil {
t.Fatal(err)
}
// Add some content to tracked beads
if err := os.WriteFile(filepath.Join(trackedBeads, "issues.jsonl"), []byte(`{"id":"tr-1"}`), 0644); err != nil {
t.Fatal(err)
}
// Create conflicting local beads with actual data
localBeads := filepath.Join(rigDir, ".beads")
if err := os.MkdirAll(localBeads, 0755); err != nil {
t.Fatal(err)
}
// Add data to local beads (this is the conflict)
if err := os.WriteFile(filepath.Join(localBeads, "issues.jsonl"), []byte(`{"id":"local-1"}`), 0644); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(localBeads, "config.yaml"), []byte("prefix: local\n"), 0644); err != nil {
t.Fatal(err)
}
check := NewBeadsRedirectCheck()
ctx := &CheckContext{TownRoot: tmpDir, RigName: rigName}
// Check should detect conflicting beads
result := check.Run(ctx)
if result.Status != StatusError {
t.Errorf("expected StatusError for conflicting beads, got %v", result.Status)
}
if !strings.Contains(result.Message, "Conflicting") {
t.Errorf("expected message about conflicting beads, got %q", result.Message)
}
}
func TestBeadsRedirectCheck_FixConflictingLocalBeads(t *testing.T) {
tmpDir := t.TempDir()
rigName := "testrig"
rigDir := filepath.Join(tmpDir, rigName)
// Create tracked beads at mayor/rig/.beads
trackedBeads := filepath.Join(rigDir, "mayor", "rig", ".beads")
if err := os.MkdirAll(trackedBeads, 0755); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(trackedBeads, "issues.jsonl"), []byte(`{"id":"tr-1"}`), 0644); err != nil {
t.Fatal(err)
}
// Create conflicting local beads with actual data
localBeads := filepath.Join(rigDir, ".beads")
if err := os.MkdirAll(localBeads, 0755); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(localBeads, "issues.jsonl"), []byte(`{"id":"local-1"}`), 0644); err != nil {
t.Fatal(err)
}
check := NewBeadsRedirectCheck()
ctx := &CheckContext{TownRoot: tmpDir, RigName: rigName}
// Verify fix is needed
result := check.Run(ctx)
if result.Status != StatusError {
t.Fatalf("expected StatusError before fix, got %v", result.Status)
}
// Apply fix - should remove conflicting local beads and create redirect
if err := check.Fix(ctx); err != nil {
t.Fatalf("Fix failed: %v", err)
}
// Verify local issues.jsonl was removed
if _, err := os.Stat(filepath.Join(localBeads, "issues.jsonl")); !os.IsNotExist(err) {
t.Error("local issues.jsonl should have been removed")
}
// Verify redirect was created
redirectPath := filepath.Join(localBeads, "redirect")
content, err := os.ReadFile(redirectPath)
if err != nil {
t.Fatalf("redirect file not created: %v", err)
}
if string(content) != "mayor/rig/.beads\n" {
t.Errorf("redirect content = %q, want 'mayor/rig/.beads\\n'", string(content))
}
// Verify check now passes
result = check.Run(ctx)
if result.Status != StatusOK {
t.Errorf("expected StatusOK after fix, got %v", result.Status)
}
}