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.
Summary
cdidx exportdeletes 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:184deletesoutputPathwhen it already exists.src/CodeIndex/Cli/ExportImportCommandRunner.cs:186creates the new archive afterward.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.