Commit Graph

2 Commits

Author SHA1 Message Date
Steve Yegge
93195e336b feat(import): implement parent resurrection (bd-cc4f, bd-d76d, bd-02a4)
Phase 2 of fixing import failure on missing parent issues (bd-d19a).

Implemented:
- TryResurrectParent: searches JSONL history for deleted parents
- TryResurrectParentChain: recursively resurrects entire parent chains
- Creates tombstones (status=closed) to preserve hierarchical structure
- Modified EnsureIDs and CreateIssue to call resurrection before validation

When importing a child issue with missing parent:
1. Searches .beads/issues.jsonl for parent in git history
2. If found, creates tombstone with status=closed
3. Preserves original title and metadata
4. Appends original description to tombstone
5. Copies dependencies if targets exist

This allows imports to proceed even when parents were deleted,
enabling multi-repo workflows and normal database hygiene operations.

Part of bd-d19a (fix import failure on missing parents).

Amp-Thread-ID: https://ampcode.com/threads/T-a1c9e824-885e-40ce-a179-148cf39c7e64
Co-authored-by: Amp <amp@ampcode.com>
2025-11-04 22:25:33 -08:00
Steve Yegge
c399d177a7 Add comprehensive tests for migrations.go and batch_ops.go (bd-3b7f)
- migrations_test.go: Tests all 10 migration functions
- batch_ops_test.go: Tests batch operations and bulk helpers
- All tests passing
- Completes bd-3b7f and sqlite refactoring epic bd-fc2d

Amp-Thread-ID: https://ampcode.com/threads/T-80ad18be-cff5-46c5-9540-47b55b92b4eb
Co-authored-by: Amp <amp@ampcode.com>
2025-11-01 23:25:44 -07:00