beads/internal/compact
matt wilkie 889ade6b7f
fix(compact): archive content before destructive compaction; make restore work (#4464)
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
2026-06-20 14:12:07 -07:00
..
compactor.go fix(compact): archive content before destructive compaction; make restore work (#4464) 2026-06-20 14:12:07 -07:00
compactor_test.go Add PR CI wrapper command surface (#4211) 2026-05-29 18:52:53 -07:00
compactor_unit_test.go fix(compact): archive content before destructive compaction; make restore work (#4464) 2026-06-20 14:12:07 -07:00
git.go feat(context): centralize RepoContext API for git operations (#1102) 2026-01-15 07:55:08 -08:00
git_test.go test: expand routing and compact coverage 2025-12-29 14:18:33 -08:00
haiku.go fix: remove unnecessary type conversions in haiku.go 2026-03-17 19:42:51 -07:00
haiku_test.go chore: unexport 4 dead symbols in internal/compact 2026-02-07 18:00:22 -08:00