Fix bd-4oob: Add multi-repo deletion tracking support

- Added getMultiRepoJSONLPaths() helper to enumerate all JSONL files
- Updated daemon_sync.go to capture/update snapshots for each repo
- Added TestMultiRepoDeletionTracking to verify fix
- Added TestMultiRepoSnapshotIsolation for isolation guarantees

Previously, deletion tracking only worked for single-repo mode because
snapshot operations were hardcoded to the primary JSONL path. This fix
ensures snapshots are managed per-repository in multi-repo mode.
This commit is contained in:
Steve Yegge
2025-11-06 19:21:04 -08:00
parent 7726d6207e
commit 47185830bb
3 changed files with 358 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ import (
"path/filepath"
"reflect"
"github.com/steveyegge/beads/internal/config"
"github.com/steveyegge/beads/internal/merge"
"github.com/steveyegge/beads/internal/storage"
)
@@ -329,6 +330,33 @@ func initializeSnapshotsIfNeeded(jsonlPath string) error {
return nil
}
// getMultiRepoJSONLPaths returns all JSONL file paths for multi-repo mode
// Returns nil if not in multi-repo mode
func getMultiRepoJSONLPaths() []string {
multiRepo := config.GetMultiRepoConfig()
if multiRepo == nil {
return nil
}
var paths []string
// Primary repo JSONL
primaryPath := multiRepo.Primary
if primaryPath == "" {
primaryPath = "."
}
primaryJSONL := filepath.Join(primaryPath, ".beads", "issues.jsonl")
paths = append(paths, primaryJSONL)
// Additional repos' JSONLs
for _, repoPath := range multiRepo.Additional {
jsonlPath := filepath.Join(repoPath, ".beads", "issues.jsonl")
paths = append(paths, jsonlPath)
}
return paths
}
// applyDeletionsFromMerge applies deletions discovered during 3-way merge
// This is the main entry point for deletion tracking during sync
func applyDeletionsFromMerge(ctx context.Context, store storage.Storage, jsonlPath string) error {