[PR #2050] [MERGED] Persist forced chunks across world restarts #3967

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2050
Author: @rdbtCVS
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: rdbt/fix-1527-forced-chunk-save


📝 Commits (3)

  • 66f32a7 Persist forced chunks across world restarts
  • 3ae2aad Merge main (save.rs: SaveDir's shape beside the forced chunks; both tests kept)
  • b8e90da Merge main (save.rs tests: the forced-chunk test moves to the end of the module, clear of the tests other PRs add at its top)

📊 Changes

5 files changed (+218 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+2 -0)
📝 crates/horizon-client/src/game/saving.rs (+1 -0)
📝 crates/horizon-client/src/game/world_loading.rs (+1 -0)
📝 crates/horizon-client/src/save.rs (+104 -1)
➕ tools/singleplayer_forced_chunks_audit.py (+110 -0)

📄 Description

🤖 Opened by rdbt’s AI agent (Codex, GPT-6.1 Sol), not by rdbt himself.

What and why

Fixes #1527. Persist each dimension's forced chunks in vanilla's saved-data format and restore them into Streaming.forced when the level opens. Cover regular/autosaves, parked server levels, in-frame dimension departures, and staged closing saves. Preserve other persistent ticket types.

Add a save regression test for three dimensions, signed coordinates, removals, and other ticket preservation, plus the issue's focused restart audit driver. Inactive-dimension ticking (#1525) remains outside this fix.

Vanilla reference

Inspected the pinned 26.3 server jar with tools/rea_vanilla.py and local javap -p -c. ForcedChunksSavedData is absent in 26.3: TicketStorage.TYPE/CODEC, fromPacked, packTickets, and updateChunkForced use data/minecraft/chunk_tickets.dat within each dimension. Followed ServerLevel.getForceLoadedChunks/setChunkForced, ServerChunkCache's saved-data initialization, SavedDataStorage.getDataFile, Ticket.CODEC, ChunkMap.FORCED_TICKET_LEVEL (31), and ChunkPos.CODEC (two-integer array; runtime packing keeps x in the low 32 bits and z in the high 32 bits).

Self-check

pr_ready (tools/pr_ready.py --quick on archlinux, against origin/main at c58af30ca, 3 min 57 s)

Check Result
Scope ✅ 5 files, +218 −1
Cargo.lock ✅ unchanged
Public tree ✅ (2 s)
Python tests ✅ 305 passed (35 s)
rustfmt ✅ (9 s)
clippy ✅ (2 s)
tests: horizon-client ✅ 1298 passed (2 min 45 s)
doc tests ✅ 0 passed (3 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 76 affected, to run in CI (--quick): arrow, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, breaking_model, cauldron, chat_screen, command_exec, command_parse and 64 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Additional validation:

  • cargo build --profile fast -p horizon-client --bins: passed.
  • python3 tools/singleplayer_forced_chunks_audit.py --case force-save: passed in both default server-thread and in-frame singleplayer, with three complete process runs per mode. Added and removed distinct flags in all three dimensions, including negative coordinates, and reopened in the Overworld. Each launch used fresh temporary game, launcher, and XDG homes.
  • Quick command exit: 0; 1,298 Rust tests and 305 Python tests passed; 0 doc tests.
  • Parity execution is left to CI (76 affected harnesses).

🤖 Generated with Codex (GPT-6.1 Sol).


🔄 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/2050 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `rdbt/fix-1527-forced-chunk-save` --- ### 📝 Commits (3) - [`66f32a7`](https://github.com/horizon-rust/horizon/commit/66f32a7a3aab0c00faec4c2c487c3047890c337b) Persist forced chunks across world restarts - [`3ae2aad`](https://github.com/horizon-rust/horizon/commit/3ae2aad69056628b038d2aec705f3aabf341f20f) Merge main (save.rs: SaveDir's shape beside the forced chunks; both tests kept) - [`b8e90da`](https://github.com/horizon-rust/horizon/commit/b8e90da1c2cc70101fede5f5e1883328d90cc464) Merge main (save.rs tests: the forced-chunk test moves to the end of the module, clear of the tests other PRs add at its top) ### 📊 Changes **5 files changed** (+218 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+2 -0) 📝 `crates/horizon-client/src/game/saving.rs` (+1 -0) 📝 `crates/horizon-client/src/game/world_loading.rs` (+1 -0) 📝 `crates/horizon-client/src/save.rs` (+104 -1) ➕ `tools/singleplayer_forced_chunks_audit.py` (+110 -0) </details> ### 📄 Description > 🤖 Opened by rdbt’s AI agent (Codex, GPT-6.1 Sol), not by rdbt himself. ## What and why Fixes #1527. Persist each dimension's forced chunks in vanilla's saved-data format and restore them into `Streaming.forced` when the level opens. Cover regular/autosaves, parked server levels, in-frame dimension departures, and staged closing saves. Preserve other persistent ticket types. Add a save regression test for three dimensions, signed coordinates, removals, and other ticket preservation, plus the issue's focused restart audit driver. Inactive-dimension ticking (#1525) remains outside this fix. ## Vanilla reference Inspected the pinned 26.3 server jar with `tools/rea_vanilla.py` and local `javap -p -c`. `ForcedChunksSavedData` is absent in 26.3: `TicketStorage.TYPE`/`CODEC`, `fromPacked`, `packTickets`, and `updateChunkForced` use `data/minecraft/chunk_tickets.dat` within each dimension. Followed `ServerLevel.getForceLoadedChunks`/`setChunkForced`, `ServerChunkCache`'s saved-data initialization, `SavedDataStorage.getDataFile`, `Ticket.CODEC`, `ChunkMap.FORCED_TICKET_LEVEL` (31), and `ChunkPos.CODEC` (two-integer array; runtime packing keeps x in the low 32 bits and z in the high 32 bits). ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on archlinux, against origin/main at c58af30ca, 3 min 57 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +218 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (2 s) | | Python tests | ✅ 305 passed (35 s) | | rustfmt | ✅ (9 s) | | clippy | ✅ (2 s) | | tests: horizon-client | ✅ 1298 passed (2 min 45 s) | | doc tests | ✅ 0 passed (3 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 76 affected, to run in CI (--quick): arrow, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, breaking_model, cauldron, chat_screen, command_exec, command_parse and 64 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Additional validation: - `cargo build --profile fast -p horizon-client --bins`: passed. - `python3 tools/singleplayer_forced_chunks_audit.py --case force-save`: passed in both default server-thread and in-frame singleplayer, with three complete process runs per mode. Added and removed distinct flags in all three dimensions, including negative coordinates, and reopened in the Overworld. Each launch used fresh temporary game, launcher, and XDG homes. - Quick command exit: 0; 1,298 Rust tests and 305 Python tests passed; 0 doc tests. - Parity execution is left to CI (76 affected harnesses). 🤖 Generated with [Codex](https://openai.com/codex/) (GPT-6.1 Sol). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:13:39 +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#3967
No description provided.