fix: Make child→parent dep fix opt-in with --fix-child-parent (bd-cuek)
GH#740: bd doctor --fix was auto-removing child→parent dependencies, calling them an 'anti-pattern'. While these often indicate modeling mistakes (deadlock), they may be intentional in some workflows. Changes: - Add --fix-child-parent flag (required to remove child→parent deps) - Remove ChildParentDependencies from default --fix set - Update warning message to reference new flag - Update comments to reflect more nuanced understanding 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -308,8 +308,9 @@ func CheckTestPollution(path string) DoctorCheck {
|
||||
}
|
||||
}
|
||||
|
||||
// CheckChildParentDependencies detects the child→parent dependency anti-pattern.
|
||||
// This creates a deadlock: child can't start (parent open), parent can't close (children not done).
|
||||
// CheckChildParentDependencies detects child→parent blocking dependencies.
|
||||
// These often indicate a modeling mistake (deadlock: child waits for parent, parent waits for children).
|
||||
// However, they may be intentional in some workflows, so removal requires explicit opt-in.
|
||||
func CheckChildParentDependencies(path string) DoctorCheck {
|
||||
beadsDir := filepath.Join(path, ".beads")
|
||||
dbPath := filepath.Join(beadsDir, beads.CanonicalDatabaseName)
|
||||
@@ -374,9 +375,9 @@ func CheckChildParentDependencies(path string) DoctorCheck {
|
||||
return DoctorCheck{
|
||||
Name: "Child-Parent Dependencies",
|
||||
Status: "warning",
|
||||
Message: fmt.Sprintf("%d child→parent dependency anti-pattern(s) detected", len(badDeps)),
|
||||
Message: fmt.Sprintf("%d child→parent dependency detected (may cause deadlock)", len(badDeps)),
|
||||
Detail: detail,
|
||||
Fix: "Run 'bd doctor --fix' to remove child→parent dependencies",
|
||||
Fix: "Run 'bd doctor --fix --fix-child-parent' to remove (if unintentional)",
|
||||
Category: CategoryMetadata,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user