Skip to content

cdidx import deletes live SQLite sidecars before replacement succeeds #2850

Description

@Widthdom

Found during cdidx code-search audit. Evidence: src/CodeIndex/Cli/ExportImportCommandRunner.cs calls DeleteSqliteSidecars(fullDbPath) before File.Move(tempPath, fullDbPath, overwrite: true), then deletes sidecars again after replacement. Impact: if the move fails after the first deletion, the existing live DB remains but its WAL/SHM sidecars may already be removed, risking data loss or forcing recovery outside the successful import path. Suggested fix: replace into a staged path first, use SQLite backup or atomic replacement semantics that preserve the old DB until commit, and delete old sidecars only after the new DB is durably in place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions