[PR #6478] [MERGED] Launcher: settings.json is replaced, not truncated #6904

Closed
opened 2026-11-03 06:28:52 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6478
Author: @Domanffe
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/launcher-settings-atomic


📝 Commits (1)

  • c7b0451 Launcher: settings.json is replaced, not truncated, and a failed save is printed

📊 Changes

1 file changed (+12 additions, -5 deletions)

View changed files

📝 launcher/src/backend.rs (+12 -5)

📄 Description

🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself.

Settings::save wrote settings.json with a plain fs::write, so the file is
truncated for as long as the write takes, and both the creation of the folder
and the write dropped their errors. Settings::load parses whatever it finds
and answers Self::default() when the JSON does not parse, so a write that
stopped halfway (power loss, a full disk, the process killed during an update)
silently resets every launcher setting instead of keeping the old file.

This writes a settings.<pid>.tmp beside the file, renames it over
settings.json once it is whole, and prints the error when any step fails, the
shape Accounts::save_to already uses for the same reason. Nothing else changes:
load still parses the same file and falls back the same way.

What I did not observe: a crash during the write, and the launcher's window
after one. cargo check and cargo fmt --all --check pass in launcher/; the
launcher's own tests run in pr_ready.

The pr_ready block follows as a comment.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/6478 **Author:** [@Domanffe](https://github.com/Domanffe) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/launcher-settings-atomic` --- ### 📝 Commits (1) - [`c7b0451`](https://github.com/horizon-rust/horizon/commit/c7b045112b410a1515c39db9d6b4c2a6dd30f069) Launcher: settings.json is replaced, not truncated, and a failed save is printed ### 📊 Changes **1 file changed** (+12 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `launcher/src/backend.rs` (+12 -5) </details> ### 📄 Description > 🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself. `Settings::save` wrote `settings.json` with a plain `fs::write`, so the file is truncated for as long as the write takes, and both the creation of the folder and the write dropped their errors. `Settings::load` parses whatever it finds and answers `Self::default()` when the JSON does not parse, so a write that stopped halfway (power loss, a full disk, the process killed during an update) silently resets every launcher setting instead of keeping the old file. This writes a `settings.<pid>.tmp` beside the file, renames it over `settings.json` once it is whole, and prints the error when any step fails, the shape `Accounts::save_to` already uses for the same reason. Nothing else changes: `load` still parses the same file and falls back the same way. What I did not observe: a crash during the write, and the launcher's window after one. `cargo check` and `cargo fmt --all --check` pass in `launcher/`; the launcher's own tests run in `pr_ready`. The `pr_ready` block follows as a comment. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:28:52 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6904
No description provided.