Add comprehensive tests for parent resurrection (bd-d19a Phase 3)
- Created resurrection_test.go with 9 unit tests covering: * Parent already exists (no-op) * Parent found in JSONL (successful resurrection) * Parent not in JSONL (graceful failure) * Missing JSONL file (graceful handling) * Malformed JSONL lines (skip with warning) * Dependency resurrection (best-effort) * Multi-level chain resurrection * Partial chain missing (stops at gap) * Idempotent resurrection - Added integration test for deleted parent scenario - Fixed resurrection.go dependency insertion (type column name) All unit tests pass. Integration test reveals transaction conflict that needs fixing (separate issue). Relates to: bd-d19a
This commit is contained in:
@@ -83,9 +83,9 @@ func (s *SQLiteStorage) TryResurrectParent(ctx context.Context, parentID string)
|
||||
err := s.db.QueryRowContext(ctx, `SELECT COUNT(*) FROM issues WHERE id = ?`, dep.DependsOnID).Scan(&targetCount)
|
||||
if err == nil && targetCount > 0 {
|
||||
_, err := s.db.ExecContext(ctx, `
|
||||
INSERT OR IGNORE INTO dependencies (issue_id, depends_on_id, dep_type)
|
||||
VALUES (?, ?, ?)
|
||||
`, parentID, dep.DependsOnID, dep.Type)
|
||||
INSERT OR IGNORE INTO dependencies (issue_id, depends_on_id, type, created_by)
|
||||
VALUES (?, ?, ?, ?)
|
||||
`, parentID, dep.DependsOnID, dep.Type, "resurrection")
|
||||
if err != nil {
|
||||
// Log but don't fail - dependency resurrection is best-effort
|
||||
fmt.Fprintf(os.Stderr, "Warning: failed to resurrect dependency for %s: %v\n", parentID, err)
|
||||
|
||||
Reference in New Issue
Block a user