This change fixes the issue where 'bd sync' would fail with a false-positive "JSONL is newer than database" error after the daemon auto-exports. Root Cause: - Daemon exports local changes to JSONL, updating its timestamp - bd sync sees JSONL.mtime > DB.mtime and incorrectly assumes external changes - This blocks export even though content is identical Solution: - Modified isJSONLNewer() to use SHA256 content hash comparison - Only triggers auto-import when JSONL is newer AND content differs - Prevents false positives from daemon auto-export timestamp updates - Maintains conservative fallback if hashes can't be computed Changes: - Added computeJSONLHash() and computeDBHash() helper functions - Created isJSONLNewerWithStore() to support testing with explicit store - Added comprehensive tests for content-based comparison logic - All existing tests pass, including export_mtime tests Fixes: bd-lm2q
7.6 KiB
7.6 KiB