From 024889529872de24592931a6154dc847ab3134e8 Mon Sep 17 00:00:00 2001 From: beads/crew/giles Date: Sun, 11 Jan 2026 20:44:52 -0800 Subject: [PATCH] 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 --- internal/storage/sqlite/queries.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/storage/sqlite/queries.go b/internal/storage/sqlite/queries.go index eed43d44..ba913dff 100644 --- a/internal/storage/sqlite/queries.go +++ b/internal/storage/sqlite/queries.go @@ -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 }