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
1 KiB
1 KiB
| id | title | slug | sidebar_position |
|---|---|---|---|
| restore | bd restore | /cli-reference/restore | 999 |
Generated from bd help --doc restore
bd restore
Restore the pre-compaction content of a compacted issue.
When an issue is compacted, its description/design/notes/acceptance criteria are summarized and the originals are archived to a compaction snapshot. This command recovers that original content.
By default it is read-only: it displays the archived content without modifying the database. Pass --apply to write the original content back into the issue and step its compaction level back down.
If no archived snapshot exists (e.g. the issue was compacted by an older bd before snapshot archiving), restore falls back to a best-effort reconstruction from Dolt version history, which can only be displayed, not applied.
bd restore <issue-id> [flags]
Flags:
--apply Write the restored content back into the issue (default: display only)
--json Output restore results in JSON format