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:
@@ -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++
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user