Fix bd-in7q: prevent migrate-tombstones from corrupting deletions manifest (#554)

Root cause: bd doctor hydrate was re-adding migrated tombstones to the
deletions manifest because getCurrentJSONLIDs() included all issues,
including tombstones. When compared against git history, tombstones
appeared as 'deleted' and were incorrectly added to the manifest as new
deletions, corrupting the database on next sync.

Fix: Skip tombstone-status issues in getCurrentJSONLIDs() so they don't
participate in deletion detection. Tombstones represent already-recorded
deletions/migrations and shouldn't be treated as active issues.

Changes:
- cmd/bd/doctor/fix/deletions.go: Skip tombstones in getCurrentJSONLIDs()
- cmd/bd/doctor/fix/deletions_test.go: New tests for tombstone skipping
- cmd/bd/migrate_tombstones_test.go: Test that tombstones are valid

This fixes the bug where 'bd migrate-tombstones' followed by 'bd sync'
would add thousands of deletion records with author 'bd-doctor-hydrate'
This commit is contained in:
matt wilkie
2025-12-14 15:11:27 -07:00
committed by GitHub
parent 3a9749279a
commit a22d949cbd
9 changed files with 10800 additions and 811 deletions

42
.beads/.gitignore vendored
View File

@@ -1,20 +1,32 @@
# Ignore all .beads/ contents by default (local workspace files)
# Only files explicitly whitelisted below will be tracked in git
*
# SQLite databases
*.db
*.db?*
*.db-journal
*.db-wal
*.db-shm
# === Files tracked in git (shared across clones) ===
# Daemon runtime files
daemon.lock
daemon.log
daemon.pid
bd.sock
# This gitignore file itself
!.gitignore
# Local version tracking (prevents upgrade notification spam after git ops)
.local_version
# Issue data in JSONL format (the main data file)
# Legacy database files
db.sqlite
bd.db
# Merge artifacts (temporary files from 3-way merge)
beads.base.jsonl
beads.base.meta.json
beads.left.jsonl
beads.left.meta.json
beads.right.jsonl
beads.right.meta.json
# Keep JSONL exports and config (source of truth for git)
!issues.jsonl
# Repository metadata (database name, JSONL filename)
!metadata.json
# Configuration template (sync branch, integrations)
!config.yaml
# Documentation for contributors
!README.md
!config.json

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
{"id":"bd-3pd","ts":"2025-12-02T05:05:53.732197Z","by":"stevey","reason":"batch delete"}
{"id":"bd-ksc","ts":"2025-12-02T05:05:53.742343Z","by":"stevey","reason":"batch delete"}
{"id":"bd-360","ts":"2025-12-02T05:05:53.74642Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cb64c226.1","ts":"2025-12-14T06:42:56.65452Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cb64c226.6","ts":"2025-12-14T06:42:56.660775Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cb64c226.8","ts":"2025-12-14T06:42:56.66501Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cb64c226.9","ts":"2025-12-14T06:42:56.669731Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cb64c226.10","ts":"2025-12-14T06:42:56.674952Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cb64c226.12","ts":"2025-12-14T06:42:56.678754Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cb64c226.13","ts":"2025-12-14T06:42:56.682961Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cbed9619.1","ts":"2025-12-14T06:42:56.686774Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cbed9619.2","ts":"2025-12-14T06:42:56.690962Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cbed9619.3","ts":"2025-12-14T06:42:56.694789Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cbed9619.4","ts":"2025-12-14T06:42:56.698915Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cbed9619.5","ts":"2025-12-14T06:42:56.702767Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cb64c226.1","ts":"2025-12-14T06:43:28.945078Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cb64c226.6","ts":"2025-12-14T06:43:28.951574Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cb64c226.8","ts":"2025-12-14T06:43:28.956558Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cb64c226.9","ts":"2025-12-14T06:43:28.961447Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cb64c226.10","ts":"2025-12-14T06:43:28.96553Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cb64c226.12","ts":"2025-12-14T06:43:28.969449Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cb64c226.13","ts":"2025-12-14T06:43:28.973591Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cbed9619.1","ts":"2025-12-14T06:43:28.977362Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cbed9619.2","ts":"2025-12-14T06:43:28.981423Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cbed9619.3","ts":"2025-12-14T06:43:28.985436Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cbed9619.4","ts":"2025-12-14T06:43:28.989612Z","by":"stevey","reason":"batch delete"}
{"id":"bd-cbed9619.5","ts":"2025-12-14T06:43:28.993408Z","by":"stevey","reason":"batch delete"}

File diff suppressed because one or more lines are too long

View File

@@ -2,4 +2,4 @@
"database": "beads.db",
"jsonl_export": "issues.jsonl",
"last_bd_version": "0.27.2"
}
}