fix(sqlite): rebuild blocked_issues_cache after rename-prefix (GH#1016)

RenameDependencyPrefix updates issue IDs in the dependencies table but
was not rebuilding the blocked_issues_cache, leaving stale IDs in the
cache that no longer exist in the issues table.

Add invalidateBlockedCache() call at the end of RenameDependencyPrefix
to rebuild the cache with the new issue IDs.

Fixes: GH#1016

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
beads/crew/giles
2026-01-11 20:44:52 -08:00
committed by Steve Yegge
parent 44c17012e5
commit 0248895298

View File

@@ -1090,7 +1090,7 @@ func (s *SQLiteStorage) RenameDependencyPrefix(ctx context.Context, oldPrefix, n
// Update depends_on_id column
_, err = s.db.ExecContext(ctx, `
UPDATE dependencies
UPDATE dependencies
SET depends_on_id = ? || substr(depends_on_id, length(?) + 1)
WHERE depends_on_id LIKE ? || '%'
`, newPrefix, oldPrefix, oldPrefix)
@@ -1098,6 +1098,12 @@ func (s *SQLiteStorage) RenameDependencyPrefix(ctx context.Context, oldPrefix, n
return fmt.Errorf("failed to update depends_on_id in dependencies: %w", err)
}
// GH#1016: Rebuild blocked_issues_cache since it stores issue IDs
// that have now been renamed
if err := s.invalidateBlockedCache(ctx, nil); err != nil {
return fmt.Errorf("failed to rebuild blocked cache: %w", err)
}
return nil
}