Fix substring bug in dependency tree cycle detection (#159)
* Add .worktrees/ to .gitignore Prevents git worktree contents from being tracked in the repository. * Fix substring bug in dependency tree cycle detection The cycle detection in GetDependencyTree() was using a simple substring match which incorrectly flagged valid nodes as cycles. For example, "bd-1" would be blocked because "bd-10" contains "bd-1" as a substring. This bug affects any beads project where issue IDs contain each other as substrings (BD-1/BD-10, ISSUE-1/ISSUE-10, etc). Changed from: AND t.path NOT LIKE '%' || i.id || '%' To delimiter-aware checks that respect the → separator: AND t.path != i.id AND t.path NOT LIKE i.id || '→%' AND t.path NOT LIKE '%→' || i.id || '→%' AND t.path NOT LIKE '%→' || i.id This ensures we only match complete issue IDs, not substrings. Added TestGetDependencyTree_SubstringBug to demonstrate and prevent regression of this issue. The test creates a chain from bd-10 to bd-1 and verifies all nodes appear in the dependency tree. Discovered while testing dependency tree visualization with bd-1/bd-10.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -53,3 +53,6 @@ result
|
||||
|
||||
# GoReleaser build artifacts
|
||||
dist/
|
||||
|
||||
# Git worktrees
|
||||
.worktrees/
|
||||
|
||||
Reference in New Issue
Block a user