bd-162: Add database integrity checks with oracle review fixes

- Added validatePreExport to prevent data loss
- Added checkDuplicateIDs to detect corruption
- Added checkOrphanedDeps to find orphaned dependencies (both sides)
- Added validatePostImport to ensure imports don't lose data
- CRITICAL FIX: Removed post-pull export that clobbered fresh JSONL
- Conservative checks when JSONL is unreadable
- Efficient COUNT(*) SQL path instead of loading all issues
- Comprehensive test coverage including edge cases
This commit is contained in:
Steve Yegge
2025-10-26 20:17:48 -07:00
parent 3cbd913f31
commit 6271b521b4
5 changed files with 616 additions and 9 deletions

View File

@@ -34,9 +34,8 @@ func countIssuesInJSONL(path string) (int, error) {
if err.Error() == "EOF" {
break
}
// If we hit a decode error, stop counting but return what we have
// This handles partially corrupt files
break
// Return error for corrupt/invalid JSON
return count, fmt.Errorf("invalid JSON at issue %d: %w", count+1, err)
}
count++
}