fix(doctor,sync): clean up deletions manifest and reduce sync noise

- bd-8v5o: When doctor --fix hydrates issues from git history, also
  remove them from the deletions manifest to prevent perpetual skip
  warnings during sync

- bd-wsqt: Remove verbose per-issue "Skipping bd-xxx" messages during
  sync. Caller already shows summary of skipped issues.

Added RemoveDeletions() function to deletions package with tests.

🤖 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-16 00:42:04 -08:00
parent 171f7de250
commit 8c45069228
5 changed files with 420 additions and 3 deletions

View File

@@ -36,6 +36,18 @@ func DatabaseVersion(path string) error {
if err := cmd.Run(); err != nil {
return fmt.Errorf("failed to initialize database: %w", err)
}
// bd-8v5o: Clean up deletions manifest for hydrated issues
// After init, remove any issues from deletions.jsonl that exist in JSONL
// This prevents perpetual "Skipping bd-xxx (in deletions manifest)" warnings
jsonlPath := findJSONLPath(beadsDir)
if jsonlPath != "" {
if err := cleanupDeletionsManifest(beadsDir, jsonlPath); err != nil {
// Non-fatal - just log warning
fmt.Printf(" Warning: failed to clean up deletions manifest: %v\n", err)
}
}
return nil
}
@@ -52,6 +64,22 @@ func DatabaseVersion(path string) error {
return nil
}
// findJSONLPath returns the path to the JSONL file in the beads directory.
// Returns empty string if no JSONL file exists.
func findJSONLPath(beadsDir string) string {
jsonlPath := filepath.Join(beadsDir, "issues.jsonl")
if _, err := os.Stat(jsonlPath); err == nil {
return jsonlPath
}
beadsJSONLPath := filepath.Join(beadsDir, "beads.jsonl")
if _, err := os.Stat(beadsJSONLPath); err == nil {
return beadsJSONLPath
}
return ""
}
// SchemaCompatibility fixes schema compatibility issues by running bd migrate
func SchemaCompatibility(path string) error {
return DatabaseVersion(path)