Steve Yegge
e816e91ecb
Complete bd-ar2 P2 tasks: metadata, resurrection, and testing improvements
This commit addresses the remaining P2 tasks from bd-ar2 code review follow-up:
## Completed Tasks
### bd-ar2.4: Improve parent chain resurrection
- Modified `tryResurrectParentWithConn()` to recursively resurrect ancestor chain
- When resurrecting bd-root.1.2, now also resurrects bd-root.1 if missing
- Handles deeply nested hierarchies where intermediate parents are deleted
- All resurrection tests pass including new edge cases
### bd-ar2.5: Add error handling guidance
- Documented metadata update failure strategy in `updateExportMetadata()`
- Explained trade-off: warnings vs errors (safe, prevents data loss)
- Added user-facing message: "Next export may require running 'bd import' first"
- Clarifies that worst case is requiring import before next export
### bd-ar2.6: Document transaction boundaries
- Added comprehensive documentation for atomicity trade-offs
- Explained crash scenarios and recovery (bd import)
- Documented decision to defer defensive checks (Option 4) until needed
- No code changes - current approach is acceptable for now
### bd-ar2.12: Add metadata key validation
- Added keySuffix validation in `updateExportMetadata()` and `hasJSONLChanged()`
- Prevents ':' separator in keySuffix to avoid malformed metadata keys
- Documented metadata key format in function comments
- Single-repo: "last_import_hash", multi-repo: "last_import_hash:<repo_key>"
### bd-ar2.7: Add edge case tests for GetNextChildID resurrection
- TestGetNextChildID_ResurrectParent_NotInJSONL: parent not in history
- TestGetNextChildID_ResurrectParent_NoJSONL: missing JSONL file
- TestGetNextChildID_ResurrectParent_MalformedJSONL: invalid JSON lines
- TestGetNextChildID_ResurrectParentChain: deeply nested missing parents
- All tests pass, resurrection is robust against edge cases
## Files Changed
- cmd/bd/daemon_sync.go: Metadata validation, error handling docs
- cmd/bd/integrity.go: Added strings import, keySuffix validation
- internal/storage/sqlite/hash_ids.go: Improved resurrection comments
- internal/storage/sqlite/resurrection.go: Recursive ancestor resurrection
- internal/storage/sqlite/child_id_test.go: Added 4 new edge case tests
## Testing
All export, sync, metadata, and resurrection tests pass.
Edge cases properly handled: missing JSONL, malformed JSON, deep nesting.
## Remaining Tasks
- bd-ar2.8 (P3): Additional export metadata edge case tests (deferred)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 11:40:37 -05:00
..
2025-11-20 19:37:01 -05:00
2025-11-12 10:48:36 -08:00
2025-11-20 22:15:04 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 20:21:37 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:54:11 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-05 20:39:47 -08:00
2025-11-06 20:14:34 -08:00
2025-11-05 21:04:00 -08:00
2025-11-07 21:17:24 -08:00
2025-11-05 10:26:58 -08:00
2025-11-07 18:57:43 -08:00
2025-11-07 21:29:22 -08:00
2025-11-05 20:39:47 -08:00
2025-11-07 18:57:43 -08:00
2025-11-07 18:57:43 -08:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 19:00:36 -05:00
2025-11-21 11:28:25 -05:00
2025-11-21 11:40:37 -05:00
2025-11-20 21:57:23 -05:00
2025-11-05 20:39:47 -08:00
2025-11-05 20:39:47 -08:00
2025-11-20 08:13:06 -08:00
2025-11-20 21:57:23 -05:00
2025-11-20 08:13:06 -08:00
2025-11-08 03:10:12 -08:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-15 12:52:34 -08:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-18 05:20:11 -05:00
2025-11-20 19:37:01 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-05 10:26:58 -08:00
2025-11-20 21:57:23 -05:00
2025-11-21 11:28:25 -05:00
2025-11-07 20:07:59 -08:00
2025-11-20 21:54:11 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 19:11:27 -05:00
2025-11-20 21:38:31 -05:00
2025-11-20 21:38:31 -05:00
2025-11-05 20:39:47 -08:00
2025-11-09 14:53:59 -08:00
2025-11-17 10:06:35 -07:00
2025-11-17 10:12:46 -07:00
2025-11-20 21:57:23 -05:00
2025-11-19 05:06:12 -05:00
2025-11-09 14:53:59 -08:00
2025-11-20 21:57:23 -05:00
2025-11-06 13:01:44 -08:00
2025-11-08 00:00:43 -08:00
2025-11-20 22:00:20 -05:00
2025-11-08 02:28:54 -08:00
2025-11-20 21:57:23 -05:00
2025-11-17 10:12:46 -07:00
2025-11-17 10:06:35 -07:00
2025-11-05 19:04:14 -08:00
2025-11-09 14:13:48 -08:00
2025-11-20 21:57:23 -05:00
2025-11-21 10:29:30 -05:00
2025-11-21 11:28:25 -05:00
2025-11-21 11:40:37 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-06 20:00:08 -08:00
2025-11-20 21:57:23 -05:00
2025-11-08 13:09:42 -08:00
2025-11-20 21:54:11 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 20:24:36 -05:00
2025-11-15 12:52:34 -08:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-09 14:53:59 -08:00
2025-11-20 21:57:23 -05:00
2025-11-17 11:32:37 -07:00
2025-11-17 11:32:37 -07:00
2025-11-17 10:12:46 -07:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 22:44:19 -05:00
2025-11-12 10:48:36 -08:00
2025-11-20 21:57:23 -05:00
2025-11-17 10:12:46 -07:00
2025-11-20 21:57:23 -05:00
2025-11-20 20:45:39 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-09 16:16:45 -08:00
2025-11-20 21:57:23 -05:00
2025-11-21 11:28:25 -05:00
2025-11-20 21:57:23 -05:00
2025-11-20 21:57:23 -05:00
2025-11-05 17:37:53 -08:00
2025-11-20 22:15:04 -05:00
2025-11-08 18:22:28 -08:00
2025-11-05 21:04:00 -08:00