Repository navigation
io: remove the .sctmp temporary file when a save fails - #450
Merged
h-a-n-a-s-h-i merged 1 commit intoOct 13, 2026
Merged
Conversation
write_file writes `<path>.sctmp` and renames it over the workbook. When the write or the rename failed (a full disk, or the target locked by another app such as Excel or a sync client), the temporary file was left beside the user's workbook. Remove it on either failure and report the same error. Adds io::tests::failed_save_leaves_no_temporary_file, which fails before this change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Merged — thank you @SteamSmith for the contribution! If you haven't already, come join us on Discord: https://discord.gg/artcraft |
Contributor
Author
|
yes, im on the discord under the same name.
…On Mon, Oct 12, 2026 at 11:47 PM Brandon Thomas ***@***.***> wrote:
*echelon* left a comment (storytold/gridcraft#450)
<#450 (comment)>
Merged — thank you @SteamSmith <https://github.com/SteamSmith> for the
contribution!
If you haven't already, come join us on Discord:
https://discord.gg/artcraft
—
Reply to this email directly, view it on GitHub
<#450?email_source=notifications&email_token=CRLATRAN5WHZWOZMBK3PKGL5TWQUVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMMJTG43TOMZXG4ZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-6137773772>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/CRLATRHD7XDQXGKCN2C5GQ35TWQUVAVCNFSNUABGKJSXA33TNF2G64TZHMYTIMBYGI4DKNJYGI5US43TOVSTWNJYGA3DINBSGM3DRILWAI>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/CRLATRB6GGTQGN2TTUT6CY35TWQUVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMMJTG43TOMZXG4ZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/CRLATRBUAAT5VEMNBDTASST5TWQUVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMMJTG43TOMZXG4ZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
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.
Summary
crates/engine/src/io.rswrite_filewrites<path>.sctmpand then renames it over the target. If either step fails — a full disk, or the workbook held open/locked by another app (Excel, a sync client) so the rename is refused — the.sctmpfile is left next to the user's workbook.This change removes the temporary file whenever the write or the rename fails, and returns the same error as before. Successful saves are unchanged.
Test
io::tests::failed_save_leaves_no_temporary_file: makes the rename fail by putting a folder where the workbook goes, then checks no.sctmpremains; also checks an ordinary save still works. It fails onmainand passes with this change.cargo fmt --all -- --checkandcargo clippy -p gridcraft-engine --all-targets -- -D warningsare clean.cargo test -p gridcraft-engine --no-fail-fast: identical results tomainplus the new test.Note (unrelated to this PR)
On Windows (rustc 1.99.0), two engine tests already fail on current
main(3926d21) without this change:io::tests::csv_save_keeps_the_separator_it_was_opened_withandtests::saving_an_opened_semicolon_csv_keeps_semicolons. A large number is written as1.24412E+11where the tests expect124412140710. They may pass on Linux CI; flagging in case it's platform-specific.🤖 Generated with Claude Code