fix(sync,blocked): add safety guards for issue deletion and include status=blocked in bd blocked

GH#464: Add safety guards to prevent deletion of open/in_progress issues during sync:
- Safety guard in git-history-backfill (importer.go)
- Safety guard in deletions manifest processing
- Warning when uncommitted changes detected before pull (daemon_sync.go)
- Enhanced repo ID mismatch error message

GH#545: Fix bd blocked to show status=blocked issues (sqlite/ready.go):
- Changed from INNER JOIN to LEFT JOIN to include issues without dependencies
- Added WHERE clause to include both status=blocked AND dependency-blocked issues

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-14 23:07:54 -08:00
parent db3e22fef9
commit 8e58c306a7
4 changed files with 82 additions and 9 deletions

View File

@@ -359,12 +359,16 @@ This usually means:
3. Database corruption
4. bd was upgraded and URL canonicalization changed
⚠️ CRITICAL: This mismatch can cause beads to incorrectly delete issues during sync!
The git-history-backfill mechanism may treat your local issues as deleted
because they don't exist in the remote repository's history.
Solutions:
- If remote URL changed: bd migrate --update-repo-id
- If bd was upgraded: bd migrate --update-repo-id
- If wrong database: rm -rf .beads && bd init
- If correct database: BEADS_IGNORE_REPO_MISMATCH=1 bd daemon
(Warning: This can cause data corruption across clones!)
(Warning: This can cause data corruption and unwanted deletions across clones!)
`, storedRepoID[:8], currentRepoID[:8])
}
@@ -558,6 +562,18 @@ func performAutoImport(ctx context.Context, store storage.Storage, skipGit bool,
// Pull from git if not in git-free mode
if !skipGit {
// SAFETY CHECK (bd-k92d): Warn if there are uncommitted local changes
// This helps detect race conditions where local work hasn't been pushed yet
jsonlPath := findJSONLPath()
if jsonlPath != "" {
if hasLocalChanges, err := gitHasChanges(importCtx, jsonlPath); err == nil && hasLocalChanges {
log.log("⚠️ WARNING: Uncommitted local changes detected in %s", jsonlPath)
log.log(" Pulling from remote may overwrite local unpushed changes.")
log.log(" Consider running 'bd sync' to commit and push your changes first.")
// Continue anyway, but user has been warned
}
}
// Try sync branch first
pulled, err := syncBranchPull(importCtx, store, log)
if err != nil {