Fix transaction conflict in TryResurrectParent (bd-58c0)

Refactored resurrection functions to accept optional *sql.Conn parameter:
- Added tryResurrectParentWithConn() internal function
- Added tryResurrectParentChainWithConn() internal function
- Updated CreateIssue to use conn-based resurrection
- Updated EnsureIDs to use conn-based resurrection

This eliminates 'database is locked' errors when resurrection
happens inside an existing transaction.

Fixes bd-58c0
This commit is contained in:
Steve Yegge
2025-11-04 17:00:37 -08:00
parent c5865bc77e
commit 3cb2e790a9
4 changed files with 47 additions and 24 deletions

View File

@@ -197,7 +197,9 @@ func TestCreateIssue_HierarchicalID_ParentNotExists(t *testing.T) {
if err == nil {
t.Errorf("expected error for child without parent, got nil")
}
if err != nil && err.Error() != "parent issue bd-nonexistent does not exist" {
t.Errorf("unexpected error message: %v", err)
// With resurrection feature, error message includes JSONL history check
expectedErr := "parent issue bd-nonexistent does not exist and could not be resurrected from JSONL history"
if err != nil && err.Error() != expectedErr {
t.Errorf("unexpected error message: got %q, want %q", err.Error(), expectedErr)
}
}