From 94800416058b8a08dfe106352887330a554ccb5e Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Mon, 22 Dec 2025 23:37:45 -0800 Subject: [PATCH] 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. --- internal/utils/path.go | 5 +++-- internal/utils/path_test.go | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/utils/path.go b/internal/utils/path.go index 58590bbf..f9ab54ce 100644 --- a/internal/utils/path.go +++ b/internal/utils/path.go @@ -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" { diff --git a/internal/utils/path_test.go b/internal/utils/path_test.go index 165c7529..328e439a 100644 --- a/internal/utils/path_test.go +++ b/internal/utils/path_test.go @@ -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"},