Skip to content

cdidx export should replace archive outputs atomically #2839

Description

@Widthdom

Summary

cdidx export deletes an existing archive before creating the new one. If export then fails while creating or writing the zip, the previous valid archive is lost and callers can be left with no usable backup artifact.

Evidence

  • src/CodeIndex/Cli/ExportImportCommandRunner.cs:184 deletes outputPath when it already exists.
  • src/CodeIndex/Cli/ExportImportCommandRunner.cs:186 creates the new archive afterward.
  • The export path already uses a temporary snapshot database, but the final archive output itself is not staged and atomically moved into place.

Expected

Export should write to a temporary archive in the destination directory, flush and close it, then atomically replace the requested output path where the platform supports it. On failure, the previous archive should remain intact.

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