fix: orphan detection false positive with dots in directory name

Only treat issue IDs as hierarchical (parent.child) when the dot appears
AFTER the first hyphen. This prevents false positives when the project
directory name contains a dot (e.g., "my.project-abc123" was incorrectly
being treated as having parent "my").

Fixes GH#508

🤖 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-16 01:05:55 -08:00
parent 2c86404d65
commit 39e09449cc
3 changed files with 139 additions and 5 deletions

View File

@@ -202,8 +202,13 @@ func EnsureIDs(ctx context.Context, conn *sql.Conn, prefix string, issues []*typ
}
}
// For hierarchical IDs (bd-a3f8e9.1), ensure parent exists
if strings.Contains(issues[i].ID, ".") {
// For hierarchical IDs (prefix-hash.child), ensure parent exists
// Only consider dots that appear AFTER the first hyphen (the prefix-hash separator)
// This avoids false positives when the prefix itself contains dots (e.g., "my.project-abc")
// See GH#508
hyphenIdx := strings.Index(issues[i].ID, "-")
hasHierarchicalDot := hyphenIdx >= 0 && strings.Contains(issues[i].ID[hyphenIdx+1:], ".")
if hasHierarchicalDot {
// Extract parent ID (everything before the last dot)
lastDot := strings.LastIndex(issues[i].ID, ".")
parentID := issues[i].ID[:lastDot]