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

@@ -298,7 +298,7 @@ func CheckStaleness(ctx context.Context, store storage.Storage, dbPath string) (
// FindJSONLInDir finds the JSONL file in the given directory.
// It prefers issues.jsonl over other .jsonl files to prevent accidentally
// reading/writing to deletions.jsonl or merge artifacts (bd-tqo fix).
// Returns empty string if no suitable JSONL file is found.
// Always returns a path (defaults to issues.jsonl if nothing suitable found).
func FindJSONLInDir(dbDir string) string {
pattern := filepath.Join(dbDir, "*.jsonl")
matches, err := filepath.Glob(pattern)