Remove sequential ID code path (bd-aa744b)

- Removed nextSequentialID() and getIDMode() functions
- Removed issue_counters table from schema
- Made SyncAllCounters() a no-op for backward compatibility
- Simplified ID generation to hash-only (adaptive length)
- Removed id_mode config setting
- Removed sequential ID tests and migration code
- Updated CONFIG.md and AGENTS.md to remove sequential ID references

Follow-up bd-2a70 will remove obsolete test files and renumber command.
This commit is contained in:
Steve Yegge
2025-10-30 21:51:39 -07:00
parent 0f7ed1bdb4
commit e3afecca37
17 changed files with 85 additions and 1527 deletions

View File

@@ -942,24 +942,10 @@ func (m *MemoryStorage) UnderlyingConn(ctx context.Context) (*sql.Conn, error) {
return nil, fmt.Errorf("UnderlyingConn not available in memory storage")
}
// SyncAllCounters synchronizes ID counters based on existing issues
// SyncAllCounters is a no-op now that sequential IDs are removed (bd-aa744b).
// Kept for backward compatibility with existing code that calls it.
func (m *MemoryStorage) SyncAllCounters(ctx context.Context) error {
m.mu.Lock()
defer m.mu.Unlock()
// Reset counters
m.counters = make(map[string]int)
// Recompute from issues
for _, issue := range m.issues {
prefix, num := extractPrefixAndNumber(issue.ID)
if prefix != "" && num > 0 {
if m.counters[prefix] < num {
m.counters[prefix] = num
}
}
}
// No-op: hash IDs don't use counters
return nil
}

View File

@@ -825,40 +825,6 @@ func TestMetadataOperations(t *testing.T) {
}
}
func TestSyncAllCounters(t *testing.T) {
store := New("")
defer store.Close()
ctx := context.Background()
// Load issues with different prefixes
issues := []*types.Issue{
{ID: "bd-5", Title: "Test 1", Status: types.StatusOpen, Priority: 1, IssueType: types.TypeTask},
{ID: "bd-10", Title: "Test 2", Status: types.StatusOpen, Priority: 1, IssueType: types.TypeTask},
{ID: "custom-3", Title: "Test 3", Status: types.StatusOpen, Priority: 1, IssueType: types.TypeTask},
}
if err := store.LoadFromIssues(issues); err != nil {
t.Fatalf("LoadFromIssues failed: %v", err)
}
// Manually corrupt counter
store.counters["bd"] = 1
// Sync counters
if err := store.SyncAllCounters(ctx); err != nil {
t.Fatalf("SyncAllCounters failed: %v", err)
}
// Verify corrected
if store.counters["bd"] != 10 {
t.Errorf("Expected bd counter to be 10, got %d", store.counters["bd"])
}
if store.counters["custom"] != 3 {
t.Errorf("Expected custom counter to be 3, got %d", store.counters["custom"])
}
}
func TestThreadSafety(t *testing.T) {
store := setupTestMemory(t)