Skip to content

rename-prefix doesn't update blocked_issues_cache table #1016

@bglenden

Description

@bglenden

Summary

The bd rename-prefix command updates issue IDs in the issues table and dependencies, but does not update or invalidate the blocked_issues_cache table. This causes blocked issues to incorrectly appear as ready after a prefix rename.

Steps to Reproduce

  1. Create a project with issues and blocking dependencies
  2. Run bd rename-prefix to change the prefix (e.g., dndmanagedm)
  3. Run bd ready --json

Expected Behavior

Blocked issues should be excluded from bd ready output.

Actual Behavior

All issues appear as ready because the blocked_issues_cache table still contains entries with the OLD prefix (e.g., dndmanage-8l6) while the issues table has the NEW prefix (e.g., dm-8l6). The NOT EXISTS check in GetReadyWork() fails to match anything.

Evidence

-- After rename-prefix from dndmanage to dm:
sqlite> SELECT * FROM blocked_issues_cache LIMIT 3;
dndmanage-2v5
dndmanage-8l6
dndmanage-fz8

sqlite> SELECT id FROM issues LIMIT 3;
dm-05u
dm-0ko
dm-2v5

Workaround

Modify any blocking dependency to trigger a cache rebuild:

bd dep remove <issue> <blocker>
bd dep add <issue> <blocker>

Suggested Fix

In cmd/bd/rename_prefix.go, after renaming IDs, either:

  1. Update entries in blocked_issues_cache with the new prefix, or
  2. Clear the cache and trigger a rebuild via rebuildBlockedCache()

Option 2 is simpler and consistent with how dependency changes already trigger rebuilds.

Version

bd version 0.47.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions