fix(beads): also fix FindJSONLPath to skip deletions.jsonl (bd-tqo)

Code review follow-up:
- Fix misleading docstring in FindJSONLInDir (does not return empty)
- Fix same bug in beads.FindJSONLPath (also fell back to matches[0])
- Add comprehensive tests for FindJSONLPath skipping deletions

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-26 23:44:04 -08:00
parent 887c958567
commit d51ddb0b03
3 changed files with 81 additions and 3 deletions

View File

@@ -281,8 +281,24 @@ func FindJSONLPath(dbPath string) string {
return match
}
}
// Return the first .jsonl file found if issues.jsonl not present
return matches[0]
// bd-tqo: Fall back to beads.jsonl for legacy support
for _, match := range matches {
if filepath.Base(match) == "beads.jsonl" {
return match
}
}
// bd-tqo: Skip deletions.jsonl and merge artifacts to prevent corruption
for _, match := range matches {
base := filepath.Base(match)
if base == "deletions.jsonl" ||
base == "beads.base.jsonl" ||
base == "beads.left.jsonl" ||
base == "beads.right.jsonl" {
continue
}
return match
}
// If only deletions/merge files exist, fall through to default
}
// bd-6xd: Default to issues.jsonl (canonical name)