Repository navigation
Keep the existing file when a desktop save overwrite fails - #207
Merged
Merged
Conversation
Desktop Save As used to truncate the chosen file and stream into it, so a failed or short write left an existing palette (or profile, image, model) empty or partial. Saves now stream into a temporary sibling that a small native command creates inside the fs scope, and rename it over the chosen file only after the whole blob is written. Failures remove the temporary file and leave the original untouched. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Flush and rename in async commands so large exports do not block the UI, replace the file a symlink points to instead of the link, refuse the app's local data folder that the fs plugin denies, and keep saving when a mount rejects chmod. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 19, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From the v4.3.0 release review: if you confirmed replacing an existing
.kpalpalette in the desktop app and the write then failed or came up short, the old file was left empty or partial, even though the app showed an error. Desktop Save As truncated the chosen file before streaming the new contents into it.Now desktop saves write to a hidden temporary file in the same folder and rename it over the chosen file only after the whole file is written. If the write fails, the temporary file is deleted and the old file keeps its contents. This covers every
saveBlobToFilecaller: palettes, profiles, PNG/STL/3MF exports, calibration prints and proofs. Cancelling and browser downloads work as before.The Save dialog only puts the exact chosen file into Tauri's fs scope, so a few small native commands (
src-tauri/src/safe_save.rs) do the work. Capabilities are unchanged. The commands:0600while it is being written when it replaces an existing file, then copy the existing file's Unix mode (best effort, so mounts that rejectchmodstill save)Proof: the new overwrite-failure unit test fails on the old code, which leaves the original truncated to
{"versi, and passes now. Native tests cover replace, discard, a failed rename, read-only files and file modes. A Tauri mock-runtime IPC test runs the full begin →plugin:fs|open/write→ finish sequence against the app's real capabilities and fs scope. It covers files outside the scope, abandoned saves, finished temporary files that can no longer be written, absolute and relative symlinks, and the app-data refusal. I checked it by mutation: removingallow_file(temp), the symlink resolution, the resolve-before-check order or the app-data guard each makes it fail.npm run lint,tsc -b,npm test(1158),cargo test(36, macOS) andnpm run test:e2e:allall pass. The Windows and Linux Rust builds are not compiled locally, and CI does not build Rust.Follow-ups (declined in review): keep Windows ACLs with
ReplaceFileWwhen replacing an existing file. Retry renames that antivirus software briefly blocks on Windows. Clean up temporary files left behind by a crash.Reviewed with sol-loop: 3 rounds with gpt-6.2-sol. Sol verdict: approved
Council review
Rounds: 3
Created with Claude Opus 5.5 in Claude Code (T3 Code); reviewed by GPT-6.2 Sol and Claude Opus 5.5.
🤖 Generated with Claude Code