feat(deps): detect/prevent child→parent dependency anti-pattern (bd-nim5)

This prevents a common mistake where users add dependencies from child
issues to their parent epics. This creates a deadlock:
- Child can't start (blocked by open parent)
- Parent can't close (children not done)

Changes:
- dep.go: Reject child→parent deps at creation time with clear error
- server_labels_deps_comments.go: Same check for daemon RPC
- doctor/validation.go: New check detects existing bad deps
- doctor/fix/validation.go: Auto-fix removes bad deps
- doctor.go: Wire up check and fix handler

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-24 13:03:13 -08:00
parent 566e4f5225
commit ce2b05356a
7 changed files with 379 additions and 0 deletions

View File

@@ -400,6 +400,8 @@ func applyFixList(path string, fixes []doctorCheck) {
err = fix.MergeArtifacts(path)
case "Orphaned Dependencies":
err = fix.OrphanedDependencies(path)
case "Child-Parent Dependencies":
err = fix.ChildParentDependencies(path)
case "Duplicate Issues":
// No auto-fix: duplicates require user review
fmt.Printf(" ⚠ Run 'bd duplicates' to review and merge duplicates\n")
@@ -785,6 +787,11 @@ func runDiagnostics(path string) doctorResult {
result.Checks = append(result.Checks, orphanedDepsCheck)
// Don't fail overall check for orphaned deps, just warn
// Check 22a: Child→parent dependencies (anti-pattern, bd-nim5)
childParentDepsCheck := convertDoctorCheck(doctor.CheckChildParentDependencies(path))
result.Checks = append(result.Checks, childParentDepsCheck)
// Don't fail overall check for child→parent deps, just warn
// Check 23: Duplicate issues (from bd validate)
duplicatesCheck := convertDoctorCheck(doctor.CheckDuplicateIssues(path))
result.Checks = append(result.Checks, duplicatesCheck)