fix: bd doctor false positive for molecule/wisp prefix variants

The prefix mismatch check in bd doctor was reporting warnings when
issues were created via molecule workflows (bd mol pour), which
intentionally use a different prefix pattern (<base>-mol instead
of just <base>).

Added recognition of valid workflow prefix variants:
- <prefix>-mol (molecules from bd mol pour)
- <prefix>-wisp (ephemeral wisps)
- <prefix>-eph (ephemeral issues)

These are intentional prefix extensions for visual distinction, not
actual mismatches. The check now only warns for truly mismatched
prefixes (e.g., different project entirely).

Added comprehensive regression tests for all prefix variant cases.

Fixes #811

Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-30 17:43:47 -08:00
parent 4ab85eeb9d
commit aff38708e0
2 changed files with 153 additions and 1 deletions

View File

@@ -480,8 +480,21 @@ func CheckDatabaseJSONLSync(path string) DoctorCheck {
}
// Only warn if majority of issues have wrong prefix
// BUT: recognize that <prefix>-mol and <prefix>-wisp are valid variants
// created by molecule/wisp workflows (see internal/storage/sqlite/queries.go:166-170)
if mostCommonPrefix != dbPrefix && maxCount > jsonlCount/2 {
issues = append(issues, fmt.Sprintf("Prefix mismatch: database uses %q but most JSONL issues use %q", dbPrefix, mostCommonPrefix))
// Check if the common prefix is a known workflow variant of the db prefix
isValidVariant := false
for _, suffix := range []string{"-mol", "-wisp", "-eph"} {
if mostCommonPrefix == dbPrefix+suffix {
isValidVariant = true
break
}
}
if !isValidVariant {
issues = append(issues, fmt.Sprintf("Prefix mismatch: database uses %q but most JSONL issues use %q", dbPrefix, mostCommonPrefix))
}
}
}