Preserve F1 settings when a save fails #4942
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4942"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-12-01T14:56:24Z.
Refs #4939, point 3.
What it changes
The F1 rewrite on
mainopened the settings file for overwrite even after a read failure. Saving one changed setting could then replace the other saved values. This restores the F1 persistence safeguards from #2256. Read errors reach the menu, and a successful save writes and syncs a temporary file beside the target before replacing it. An existing settings symlink is resolved before the write.How it was tested
5fabb46eand294f3b3f017182e7beda54c8e929444ad83441d0on synthetic files.cargo xtask policy --stagedaccepted the changed file.Checked for overlap
menu.rs. #2868 deals with launch-time settings precedence and reset. #4934 saves the game's separate settings XML.Please retain the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the change into another commit.AI-assisted with OpenAI Codex.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by gut0to on 2026-12-01T15:12:17Z.
Review: COMMENTED
AI-assisted review: I inspected the settings save path and the failure handling in this diff. I used AI assistance and verified the test gap against the current source.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by gut0to on 2026-12-01T15:12:17Z.
Code review location:
crates/victory-gpu/src/host/menu.rs; line 1190Could this failure path get an in-tree regression test? This change prevents a read/parse error from replacing the saved settings, but the reported fixture is external to the repository. A temp-file test with invalid UTF-8 (or another read_to_string error) could call write_settings and assert the original bytes remain unchanged; a failed atomic replacement should likewise leave self.started unchanged. That would make the central corruption fix durable.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-12-01T18:29:38Z.
Current main already resolves a settings symlink, preserves the previous file on a read failure, and syncs a temporary file before replacing it. Closing this proposal as superseded. Source checked at 93aa9a92.
Pull request closed