[PR #5529] [MERGED] Back up before restoring level.dat_old, refuse other-series worlds on every open path #6337

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5529
Author: @kacpherek
Created: 10/31/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/p12-saves


📝 Commits (2)

  • 108ef4a Back up a world before restoring its level.dat_old
  • 136dc81 Refuse to open a world saved by another series

📊 Changes

3 files changed (+31 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game/world_loading.rs (+14 -0)
📝 crates/horizon-client/src/title.rs (+13 -2)
📝 crates/horizon-client/src/title/tests.rs (+4 -1)

📄 Description

What and why

Two gaps left around world safety (the other #3517 rows on this, level.dat_old fallback, restore, the backup prompt and listing damaged worlds, turned out to be on main already):

  • Back up before restoring level.dat_old. The Recover screen's Attempt to Restore moved the broken level.dat aside and put level.dat_old in its place without copying the world. Vanilla RecoverWorldDataScreen.attemptRestore runs EditWorldScreen.makeBackupAndShowToast first (a zip of the world folder without session.lock) and restores once that finishes, whether or not the backup worked. The button now does the same through the existing backup screen, with the toast.
  • Refuse a world from another series on every open path. A world whose Version.Series is not main went straight to the file fixes and was upgraded in place when opened by the dedicated server or the agent launch (WorldRequest::prepare). Vanilla's server Main returns before DataFixers.getFileFixer().fix when summary.isCompatible() is false (DataVersion.isCompatible compares the series), and the client shows the incompatible alert (WorldOpenFlows.openWorldCheckVersionCompatibility). The title screen already refused it; now the open path does too.

Part of #3517.

Vanilla reference

RecoverWorldDataScreen.attemptRestore, EditWorldScreen.makeBackupAndShowToast, LevelStorageAccess.restoreLevelDataFromOld, server Main (isCompatible check), LevelSummary.isCompatible, DataVersion.isCompatible (pure vanilla 26.3 decompile).

How it was checked

cargo check -p horizon-client --tests passes; world_with_unreadable_level_dat_is_listed_and_recovers_from_level_dat_old (updated to finish the backup first) passes. Not run in game.


🔄 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/5529 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/p12-saves` --- ### 📝 Commits (2) - [`108ef4a`](https://github.com/horizon-rust/horizon/commit/108ef4ad6df46e38813b56eec79aeb8d8e5cae66) Back up a world before restoring its level.dat_old - [`136dc81`](https://github.com/horizon-rust/horizon/commit/136dc81b8e87db86f4571cc8cf74c93334bdb04f) Refuse to open a world saved by another series ### 📊 Changes **3 files changed** (+31 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/world_loading.rs` (+14 -0) 📝 `crates/horizon-client/src/title.rs` (+13 -2) 📝 `crates/horizon-client/src/title/tests.rs` (+4 -1) </details> ### 📄 Description ## What and why Two gaps left around world safety (the other #3517 rows on this, level.dat_old fallback, restore, the backup prompt and listing damaged worlds, turned out to be on main already): - **Back up before restoring level.dat_old.** The Recover screen's Attempt to Restore moved the broken `level.dat` aside and put `level.dat_old` in its place without copying the world. Vanilla `RecoverWorldDataScreen.attemptRestore` runs `EditWorldScreen.makeBackupAndShowToast` first (a zip of the world folder without `session.lock`) and restores once that finishes, whether or not the backup worked. The button now does the same through the existing backup screen, with the toast. - **Refuse a world from another series on every open path.** A world whose `Version.Series` is not `main` went straight to the file fixes and was upgraded in place when opened by the dedicated server or the agent launch (`WorldRequest::prepare`). Vanilla's server `Main` returns before `DataFixers.getFileFixer().fix` when `summary.isCompatible()` is false (`DataVersion.isCompatible` compares the series), and the client shows the incompatible alert (`WorldOpenFlows.openWorldCheckVersionCompatibility`). The title screen already refused it; now the open path does too. Part of #3517. ## Vanilla reference `RecoverWorldDataScreen.attemptRestore`, `EditWorldScreen.makeBackupAndShowToast`, `LevelStorageAccess.restoreLevelDataFromOld`, server `Main` (isCompatible check), `LevelSummary.isCompatible`, `DataVersion.isCompatible` (pure vanilla 26.3 decompile). ## How it was checked `cargo check -p horizon-client --tests` passes; `world_with_unreadable_level_dat_is_listed_and_recovers_from_level_dat_old` (updated to finish the backup first) passes. Not run in game. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:18:32 +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#6337
No description provided.