Remove sequential ID generation and SyncAllCounters (bd-c7af, bd-8e05, bd-4c74)
- Removed SyncAllCounters() and all call sites (already no-op with hash IDs) - Removed AllocateNextID() and getNextIDForPrefix() - sequential ID generation - Removed collision remapping logic in internal/storage/sqlite/collision.go - Removed rename collision handling in internal/importer/importer.go - Removed branch-merge example (collision resolution no longer needed) - Updated EXTENDING.md to remove counter sync examples These were all deprecated code paths for sequential IDs that are obsolete with hash-based IDs. Hash ID collisions are handled by extending the hash, not by remapping to new sequential IDs.
This commit is contained in:
@@ -711,10 +711,7 @@ func TestImportCounterSyncAfterHighID(t *testing.T) {
|
||||
t.Fatalf("Failed to import high ID issue: %v", err)
|
||||
}
|
||||
|
||||
// Step 4: Sync counters after import (mimics import command behavior)
|
||||
if err := testStore.SyncAllCounters(ctx); err != nil {
|
||||
t.Fatalf("Failed to sync counters: %v", err)
|
||||
}
|
||||
// REMOVED (bd-c7af): Counter sync - no longer needed with hash IDs
|
||||
|
||||
// Step 5: Create another auto-generated issue
|
||||
// This should get bd-101 (counter should have synced to 100), not bd-4
|
||||
|
||||
@@ -151,11 +151,7 @@ func profileImportOperation(t *testing.T, numIssues int) {
|
||||
phases["create_update"] = time.Since(createStart)
|
||||
|
||||
// Phase 4: Sync counters
|
||||
syncStart := time.Now()
|
||||
if err := sqliteStore.SyncAllCounters(ctx); err != nil {
|
||||
t.Fatalf("Failed to sync counters: %v", err)
|
||||
}
|
||||
phases["sync_counters"] = time.Since(syncStart)
|
||||
// REMOVED (bd-c7af): Counter sync - no longer needed with hash IDs
|
||||
|
||||
totalDuration := time.Since(startTime)
|
||||
|
||||
|
||||
@@ -290,17 +290,7 @@ func renumberIssuesInDB(ctx context.Context, prefix string, idMapping map[string
|
||||
}
|
||||
|
||||
// Update the counter to the highest renumbered ID so next issue gets correct number
|
||||
// After renumbering to bd-1..bd-N, set counter to N so next issue is bd-(N+1)
|
||||
// We need to FORCE set it (not MAX) because counter may be higher from deleted issues
|
||||
// Strategy: Reset (delete) the counter row, then SyncAllCounters recreates it from actual max ID
|
||||
sqliteStore, _ := store.(*sqlite.SQLiteStorage)
|
||||
if err := sqliteStore.ResetCounter(ctx, prefix); err != nil {
|
||||
return fmt.Errorf("failed to reset counter: %w", err)
|
||||
}
|
||||
// Now sync will recreate it from the actual max ID in the database
|
||||
if err := sqliteStore.SyncAllCounters(ctx); err != nil {
|
||||
return fmt.Errorf("failed to sync counter: %w", err)
|
||||
}
|
||||
// REMOVED (bd-c7af): Counter sync after renumbering - no longer needed with hash IDs
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user