[PR #1694] [MERGED] Save: the write paths report a failure instead of dropping it #3694

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1694
Author: @Domanffe
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @ludovic111

Base: main ← Head: fix/swallowed-save-errors


📝 Commits (2)

  • a96dccf Save: the write paths report a failure instead of dropping it
  • c0bf5cf Dedicated: the list saves log vanilla's warnings

📊 Changes

6 files changed (+30 additions, -18 deletions)

View changed files

📝 crates/horizon-client/src/command_storage.rs (+4 -2)
📝 crates/horizon-client/src/game/bossbars.rs (+4 -2)
📝 crates/horizon-client/src/game/chat.rs (+6 -2)
📝 crates/horizon-client/src/game/debug_keys.rs (+3 -1)
📝 crates/horizon-client/src/game/dedicated.rs (+11 -10)
📝 crates/horizon-client/src/save.rs (+2 -1)

📄 Description

🤖 Agent

An audit of the save paths turned up six places that write state and drop the error, so a write that never happened looked like one that did.

The four moderation lists on a dedicated server are the worst of them (game/dedicated.rs): let _ = l.bans.save(); and the same for IP bans, operators and the white list. The closure that logs the load results is already right there, so they go through it now. Disk full, a file held by a scanner, a read-only folder: the command answered success and after a restart the list was empty, with nothing in the log.

The same shape in three world files: command storage (command_storage.rs, every /data namespace), boss bars and the world clocks and difficulty (game/chat.rs). Those are state players build contraptions and datapacks on, and losing them silently is the hardest kind of bug to reproduce. Each is a log::warn! with the namespace or the path in the message.

save::write_dat had a matching hole of its own: it moves the current file aside before putting the new one in place, like vanilla, but that first rename was let _ =. When it fails (OneDrive or an antivirus holding level.dat for a moment is the ordinary case on Windows) the second rename then fails on the existing path, the error came back as usual, and every caller above dropped it. It now propagates with the path in the message.

game/debug_keys.rs saves before an intentional crash (Minecraft.emergencySaveAndCrash); a failure there is now logged instead of swallowed.

No behaviour changes on the success path. cargo check -p horizon-client is clean; the full test set is 1063 passed with the same three Windows failures as before this branch (save session lock, packs cache, crash frames).


🔄 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/1694 **Author:** [@Domanffe](https://github.com/Domanffe) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/swallowed-save-errors` --- ### 📝 Commits (2) - [`a96dccf`](https://github.com/horizon-rust/horizon/commit/a96dccf6918aa18b509b42a217dc0388a7fb5ec6) Save: the write paths report a failure instead of dropping it - [`c0bf5cf`](https://github.com/horizon-rust/horizon/commit/c0bf5cf95497042db5d4a52e5188f7543ab2549c) Dedicated: the list saves log vanilla's warnings ### 📊 Changes **6 files changed** (+30 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/command_storage.rs` (+4 -2) 📝 `crates/horizon-client/src/game/bossbars.rs` (+4 -2) 📝 `crates/horizon-client/src/game/chat.rs` (+6 -2) 📝 `crates/horizon-client/src/game/debug_keys.rs` (+3 -1) 📝 `crates/horizon-client/src/game/dedicated.rs` (+11 -10) 📝 `crates/horizon-client/src/save.rs` (+2 -1) </details> ### 📄 Description 🤖 Agent An audit of the save paths turned up six places that write state and drop the error, so a write that never happened looked like one that did. The four moderation lists on a dedicated server are the worst of them (`game/dedicated.rs`): `let _ = l.bans.save();` and the same for IP bans, operators and the white list. The closure that logs the *load* results is already right there, so they go through it now. Disk full, a file held by a scanner, a read-only folder: the command answered success and after a restart the list was empty, with nothing in the log. The same shape in three world files: command storage (`command_storage.rs`, every `/data` namespace), boss bars and the world clocks and difficulty (`game/chat.rs`). Those are state players build contraptions and datapacks on, and losing them silently is the hardest kind of bug to reproduce. Each is a `log::warn!` with the namespace or the path in the message. `save::write_dat` had a matching hole of its own: it moves the current file aside before putting the new one in place, like vanilla, but that first rename was `let _ =`. When it fails (OneDrive or an antivirus holding `level.dat` for a moment is the ordinary case on Windows) the second rename then fails on the existing path, the error came back as usual, and every caller above dropped it. It now propagates with the path in the message. `game/debug_keys.rs` saves before an intentional crash (`Minecraft.emergencySaveAndCrash`); a failure there is now logged instead of swallowed. No behaviour changes on the success path. `cargo check -p horizon-client` is clean; the full test set is 1063 passed with the same three Windows failures as before this branch (`save` session lock, `packs` cache, `crash` frames). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:11:28 +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#3694
No description provided.