fix: support delete in --no-db mode (GH#822)

Add CreateTombstone() to MemoryStorage and deleteBatchFallback() to
handle deletion when SQLite is not available. This fixes the error
"tombstone operation not supported by this storage backend" when
using bd delete with --no-db flag.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
beads/crew/emma
2025-12-31 11:45:37 -08:00
committed by Steve Yegge
parent ee51298fd5
commit b161e22144
4 changed files with 217 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ import (
"testing"
"github.com/steveyegge/beads/internal/storage/memory"
"github.com/steveyegge/beads/internal/types"
)
// TestHandleDelete_DryRun verifies that dry-run mode returns what would be deleted
@@ -308,11 +309,15 @@ func TestHandleDelete_WithReason(t *testing.T) {
t.Fatalf("delete with reason failed: %s", resp.Error)
}
// Verify issue was deleted
// Verify issue was converted to tombstone (now that MemoryStorage supports CreateTombstone)
ctx := context.Background()
issue, _ := store.GetIssue(ctx, issueIDs[0])
if issue != nil {
t.Error("issue should have been deleted")
if issue == nil {
t.Error("issue should exist as tombstone")
} else if issue.Status != types.StatusTombstone {
t.Errorf("issue should be tombstone, got status=%s", issue.Status)
} else if issue.DeleteReason != "test deletion with reason" {
t.Errorf("expected DeleteReason='test deletion with reason', got '%s'", issue.DeleteReason)
}
}