fix(import): Update database mtime after import to prevent bd doctor false warnings (#263)
When 'bd sync --import-only' completes, it imports JSONL changes into the database but doesn't update the database file's modification time. This causes 'bd doctor' to incorrectly warn that 'JSONL is newer than database' even when they're in sync. Root cause: SQLite in WAL mode writes to beads.db-wal; the main beads.db mtime often doesn't change until a checkpoint. bd doctor compares JSONL mtime to beads.db mtime, so it can misfire without an mtime bump. The fix adds touchDatabaseFile() that: - Only runs when import actually made changes (not dry-run, not unchanged) - Sets DB mtime to max(JSONL mtime, now) + 1ns to handle clock skew - Is best-effort (logs warning on failure, doesn't fail import) - Includes tests for basic touch and clock skew scenarios Fixes: bd-g3ey
This commit is contained in:
4
.beads/.gitignore
vendored
4
.beads/.gitignore
vendored
@@ -18,7 +18,3 @@ bd.db
|
||||
!*.jsonl
|
||||
!metadata.json
|
||||
!config.json
|
||||
|
||||
# Exclude merge artifacts (temporary files from 3-way merge)
|
||||
beads.base.jsonl
|
||||
beads.left.jsonl
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"database": "beads.db",
|
||||
"version": "0.21.6",
|
||||
"version": "0.23.0",
|
||||
"jsonl_export": "beads.jsonl"
|
||||
}
|
||||
Reference in New Issue
Block a user