fix: resolve P2 sync noise and cleanup issues

- bd-6pni: Auto-filter tombstoned issues with mismatched prefixes during
  import instead of failing. Tombstones from contributor PRs with different
  test prefixes are pollution and safe to ignore.

- bd-ffr9: Stop recreating deletions.jsonl after tombstone migration.
  Added IsTombstoneMigrationComplete() check to all code paths that write
  to the legacy deletions manifest.

- bd-admx: Fix perpetual "JSONL file hash mismatch" warning. Now clears
  both export_hashes AND jsonl_file_hash when mismatch detected, so the
  warning doesn't repeat.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-16 00:55:43 -08:00
parent 88ccce884c
commit 2c86404d65
9 changed files with 341 additions and 30 deletions

View File

@@ -62,6 +62,39 @@ func TestRecordDeletion(t *testing.T) {
}
}
// TestRecordDeletion_SkipsAfterMigration tests that recordDeletion is a no-op after tombstone migration (bd-ffr9)
func TestRecordDeletion_SkipsAfterMigration(t *testing.T) {
tmpDir := t.TempDir()
// Set up dbPath so getDeletionsPath() works
oldDbPath := dbPath
dbPath = filepath.Join(tmpDir, "beads.db")
defer func() { dbPath = oldDbPath }()
// Create the .beads directory
if err := os.MkdirAll(tmpDir, 0750); err != nil {
t.Fatalf("failed to create directory: %v", err)
}
// Create the .migrated marker file to indicate tombstone migration is complete
migratedPath := filepath.Join(tmpDir, "deletions.jsonl.migrated")
if err := os.WriteFile(migratedPath, []byte("{}"), 0644); err != nil {
t.Fatalf("failed to create migrated marker: %v", err)
}
// Test recordDeletion - should be a no-op
err := recordDeletion("test-abc", "test-user", "test reason")
if err != nil {
t.Fatalf("recordDeletion failed: %v", err)
}
// Verify deletions.jsonl was NOT created
deletionsPath := getDeletionsPath()
if _, err := os.Stat(deletionsPath); !os.IsNotExist(err) {
t.Error("deletions.jsonl should not be created after tombstone migration")
}
}
// TestRecordDeletions tests that recordDeletions creates multiple deletion manifest entries
func TestRecordDeletions(t *testing.T) {
tmpDir := t.TempDir()