fix: skip interactions.jsonl in FindJSONLInDir (GH#709)

FindJSONLInDir() was returning interactions.jsonl when issues.jsonl
didn't exist. This caused bd sync to write issue data to the wrong
file after fresh init.

Add interactions.jsonl to the skip list alongside deletions.jsonl
and merge artifacts, so the function correctly defaults to issues.jsonl.
This commit is contained in:
Steve Yegge
2025-12-22 23:37:45 -08:00
parent bd6fa5cbbb
commit 9480041605
2 changed files with 13 additions and 2 deletions

View File

@@ -39,11 +39,12 @@ func FindJSONLInDir(dbDir string) string {
}
}
// Last resort: use first match (but skip deletions.jsonl and merge artifacts)
// Last resort: use first match (but skip deletions.jsonl, interactions.jsonl, and merge artifacts)
for _, match := range matches {
base := filepath.Base(match)
// Skip deletions manifest and merge artifacts
// Skip deletions manifest, interactions (audit trail), and merge artifacts
if base == "deletions.jsonl" ||
base == "interactions.jsonl" ||
base == "beads.base.jsonl" ||
base == "beads.left.jsonl" ||
base == "beads.right.jsonl" {

View File

@@ -110,6 +110,16 @@ func TestFindJSONLInDir(t *testing.T) {
files: []string{"deletions.jsonl"},
expected: "issues.jsonl",
},
{
name: "only interactions.jsonl - returns default issues.jsonl",
files: []string{"interactions.jsonl"},
expected: "issues.jsonl",
},
{
name: "interactions.jsonl with issues.jsonl - prefers issues",
files: []string{"interactions.jsonl", "issues.jsonl"},
expected: "issues.jsonl",
},
{
name: "only merge artifacts - returns default issues.jsonl",
files: []string{"beads.base.jsonl", "beads.left.jsonl", "beads.right.jsonl"},