refactor: rename last_import_hash to jsonl_content_hash (bd-39o)
The metadata key 'last_import_hash' was misleading because it's updated on both import AND export. Renamed to 'jsonl_content_hash' which more accurately describes its purpose - tracking the content hash of the JSONL file. Added migration support: read operations try new key first, then fall back to old key for backwards compatibility with existing databases. Files modified: - cmd/bd/integrity.go: Update key name with migration support - cmd/bd/import.go: Update key name - cmd/bd/sync.go: Update key name - cmd/bd/autoflush.go: Update key name with migration support - cmd/bd/daemon_sync.go: Update key name - cmd/bd/daemon_event_loop.go: Update key name with migration support - internal/autoimport/autoimport.go: Update key name with migration support - Updated all related tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -174,10 +174,13 @@ func checkDaemonHealth(ctx context.Context, store storage.Storage, log daemonLog
|
||||
// Health check 1: Verify metadata is accessible
|
||||
// This helps detect if external operations (like bd import --force) have modified metadata
|
||||
// Without this, daemon may continue operating with stale metadata cache
|
||||
if _, err := store.GetMetadata(ctx, "last_import_hash"); err != nil {
|
||||
log.log("Health check: metadata read failed: %v", err)
|
||||
// Non-fatal: daemon continues but logs the issue
|
||||
// This helps diagnose stuck states in sandboxed environments
|
||||
// Try new key first, fall back to old for migration (bd-39o)
|
||||
if _, err := store.GetMetadata(ctx, "jsonl_content_hash"); err != nil {
|
||||
if _, err := store.GetMetadata(ctx, "last_import_hash"); err != nil {
|
||||
log.log("Health check: metadata read failed: %v", err)
|
||||
// Non-fatal: daemon continues but logs the issue
|
||||
// This helps diagnose stuck states in sandboxed environments
|
||||
}
|
||||
}
|
||||
|
||||
// Health check 2: Database integrity check
|
||||
|
||||
Reference in New Issue
Block a user