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:
@@ -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" {
|
||||
|
||||
@@ -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"},
|
||||
|
||||
Reference in New Issue
Block a user