Fix daemon auto-sync delete mutation not reflected in sync branch (#537)

Fix daemon auto-sync delete mutation not reflected in sync branch

When deleting an issue with `bd delete <id> --force`, the daemon auto-sync now properly removes the deleted issue from the sync branch.

**Problem:** The merge logic saw fewer local issues (due to deletion) and would re-add the deleted issue.

**Solution:** Add `ForceOverwrite` option to bypass merge logic when mutations occur. Mutation-triggered exports are authoritative and should overwrite, not merge.

Reviewed-by: stevey
This commit is contained in:
Charles P. Cross
2025-12-13 13:53:09 -05:00
committed by GitHub
parent 520e1007f1
commit eb988fcb21
5 changed files with 937 additions and 456 deletions

View File

@@ -455,7 +455,10 @@ func performExport(ctx context.Context, store storage.Storage, autoCommit, autoP
// Auto-commit if enabled (skip in git-free mode)
if autoCommit && !skipGit {
// Try sync branch commit first
committed, err := syncBranchCommitAndPush(exportCtx, store, autoPush, log)
// Use forceOverwrite=true because mutation-triggered exports (create, update, delete)
// mean the local state is authoritative and should not be merged with worktree.
// This is critical for delete mutations to be properly reflected in the sync branch.
committed, err := syncBranchCommitAndPushWithOptions(exportCtx, store, autoPush, true, log)
if err != nil {
log.log("Sync branch commit failed: %v", err)
return