feat(importer): add ConvertedToTombstone counter (bd-wucl)
Track legacy deletions.jsonl entries converted to tombstones during import: - Add Result.ConvertedToTombstone counter - Add Result.ConvertedTombstoneIDs for the converted IDs - Update test to verify the new counter 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -59,10 +59,12 @@ type Result struct {
|
||||
ExpectedPrefix string // Database configured prefix
|
||||
MismatchPrefixes map[string]int // Map of mismatched prefixes to count
|
||||
SkippedDependencies []string // Dependencies skipped due to FK constraint violations
|
||||
Purged int // Issues purged from DB (found in deletions manifest)
|
||||
PurgedIDs []string // IDs that were purged
|
||||
SkippedDeleted int // Issues skipped because they're in deletions manifest
|
||||
SkippedDeletedIDs []string // IDs that were skipped due to deletions manifest
|
||||
Purged int // Issues purged from DB (found in deletions manifest)
|
||||
PurgedIDs []string // IDs that were purged
|
||||
SkippedDeleted int // Issues skipped because they're in deletions manifest
|
||||
SkippedDeletedIDs []string // IDs that were skipped due to deletions manifest
|
||||
ConvertedToTombstone int // Legacy deletions.jsonl entries converted to tombstones (bd-wucl)
|
||||
ConvertedTombstoneIDs []string // IDs that were converted to tombstones
|
||||
}
|
||||
|
||||
// ImportIssues handles the core import logic used by both manual and auto-import.
|
||||
@@ -164,10 +166,11 @@ func ImportIssues(ctx context.Context, dbPath string, store storage.Storage, iss
|
||||
// Already have a tombstone for this ID in JSONL, skip
|
||||
continue
|
||||
}
|
||||
// Check if we skipped this issue above (it was in JSONL but filtered out)
|
||||
// If so, we should create a tombstone for it
|
||||
// Convert this deletion record to a tombstone (bd-wucl)
|
||||
tombstone := convertDeletionToTombstone(id, del)
|
||||
filteredIssues = append(filteredIssues, tombstone)
|
||||
result.ConvertedToTombstone++
|
||||
result.ConvertedTombstoneIDs = append(result.ConvertedTombstoneIDs, id)
|
||||
}
|
||||
|
||||
issues = filteredIssues
|
||||
|
||||
@@ -1335,6 +1335,13 @@ func TestImportIssues_LegacyDeletionsConvertedToTombstones(t *testing.T) {
|
||||
if result.SkippedDeleted != 1 {
|
||||
t.Errorf("Expected 1 skipped deleted (issue in deletions.jsonl), got %d", result.SkippedDeleted)
|
||||
}
|
||||
// Verify ConvertedToTombstone counter (bd-wucl)
|
||||
if result.ConvertedToTombstone != 1 {
|
||||
t.Errorf("Expected 1 converted to tombstone, got %d", result.ConvertedToTombstone)
|
||||
}
|
||||
if len(result.ConvertedTombstoneIDs) != 1 || result.ConvertedTombstoneIDs[0] != "test-abc" {
|
||||
t.Errorf("Expected ConvertedTombstoneIDs [test-abc], got %v", result.ConvertedTombstoneIDs)
|
||||
}
|
||||
|
||||
// Verify regular issue was imported
|
||||
issues, err := store.SearchIssues(ctx, "", types.IssueFilter{})
|
||||
|
||||
Reference in New Issue
Block a user