Content compaction (bd admin compact) overwrote an issue's description and cleared design/notes/acceptance_criteria in place with no archive, while the issue_snapshots/compaction_snapshots tables built to hold that archive were dead code (never written). The only recovery, bd restore, was display-only and relied on a largest-history-row heuristic that dolt gc / history-squash can erase. Net: compaction was effectively irreversible. Wire the existing compaction_snapshots table: archive the full pre-compaction content (snapshot_json BLOB) before the destructive overwrite, aborting if the archive fails; add SnapshotIssue/GetCompactionSnapshot/RestoreFromSnapshot to the CompactionStore interface on both Dolt and embedded stores; and rework bd restore to restore from the snapshot (--apply writes it back; default stays read-only display, with the old Dolt-history reconstruction as fallback). Unit tests assert snapshot-before-overwrite ordering and abort-on-archive- failure; an integration test covers the snapshot -> overwrite -> restore round trip against a real Dolt store. CLI reference docs regenerated for the new flag. Refs #4463 Agent-Signature: claude-opus-4-8-high on behalf of maphew |
||
|---|---|---|
| .. | ||
| compactor.go | ||
| compactor_test.go | ||
| compactor_unit_test.go | ||
| git.go | ||
| git_test.go | ||
| haiku.go | ||
| haiku_test.go | ||