Fix bd-dvd and bd-ymj: Parent resurrection and export metadata

Bug 1 (bd-dvd): GetNextChildID now attempts parent resurrection from JSONL
before failing. Added TryResurrectParent call to match CreateIssue behavior.

Bug 2 (bd-ymj): Export now updates last_import_hash metadata to prevent
'JSONL content has changed' errors on subsequent exports.

Files changed:
- internal/storage/sqlite/hash_ids.go: Add resurrection attempt
- cmd/bd/daemon_sync.go: Add metadata updates after export
- Tests added for both fixes
- Fixed pre-existing bug in integrity_content_test.go

Follow-up work tracked in epic bd-ar2 (9 issues for improvements).

Fixes GH #334
This commit is contained in:
Steve Yegge
2025-11-21 10:29:30 -05:00
parent ff3ccdd26e
commit 4c5f99c5bd
6 changed files with 230 additions and 20 deletions

View File

@@ -34,7 +34,14 @@ func (s *SQLiteStorage) GetNextChildID(ctx context.Context, parentID string) (st
return "", fmt.Errorf("failed to check parent existence: %w", err)
}
if count == 0 {
return "", fmt.Errorf("parent issue %s does not exist", parentID)
// Try to resurrect parent from JSONL history before failing (bd-dvd fix)
resurrected, err := s.TryResurrectParent(ctx, parentID)
if err != nil {
return "", fmt.Errorf("failed to resurrect parent %s: %w", parentID, err)
}
if !resurrected {
return "", fmt.Errorf("parent issue %s does not exist and could not be resurrected from JSONL history", parentID)
}
}
// Calculate current depth by counting dots