Fix P0 bug: JSONL lookup now returns LAST match (bd-58c0)

Addresses code review feedback:

 P0 (Must Fix):
- Fix JSONL lookup to return LAST match, not FIRST (resurrection.go:160-162)
  - Changed from early return to scan all matches and keep last
  - Respects JSONL append-only semantics

 P1 (Should Fix):
- Add test for multiple JSONL versions
  - TestTryResurrectParent_MultipleVersionsInJSONL verifies correct behavior
- Document error message change in CHANGELOG.md
  - Old: "parent issue X does not exist"
  - New: "parent issue X does not exist and could not be resurrected from JSONL history"
  - Marked as breaking change for script parsers

 P2/P3 (Nice to Have):
- Add documentation to AGENTS.md explaining auto-resurrection behavior
- Document best-effort dependency resurrection

⏸️ Deferred (P1 - Optimize batch resurrection):
- Caching optimization deferred (no batch use cases currently)

All tests pass:
- Unit tests: internal/storage/sqlite/
- Integration test: TestImportWithDeletedParent
This commit is contained in:
Steve Yegge
2025-11-04 22:07:36 -08:00
parent 4c77631e48
commit 3af353ade3
6 changed files with 121 additions and 390 deletions

View File

@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- **Parent Resurrection** (bd-58c0): Automatic resurrection of deleted parent issues from JSONL history
- Prevents import failures when parent issues have been deleted
- Creates tombstone placeholders for missing hierarchical parents
- Best-effort dependency resurrection from JSONL
### Changed
- **Error Messages**: Improved error messages for missing parent issues
- Old: `"parent issue X does not exist"`
- New: `"parent issue X does not exist and could not be resurrected from JSONL history"`
- **Breaking**: Scripts parsing exact error messages may need updates
### Fixed
- **JSONL Resurrection Logic**: Fixed to use LAST occurrence instead of FIRST (append-only semantics)
## [0.21.7] - 2025-11-04
### Fixed