[PR #4774] [MERGED] Port WorldUpgrader (Optimize World worker) #5844

Closed
opened 2026-11-03 05:15:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4774
Author: @levzzz5154
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @levzzz5154

Base: main ← Head: parity/L1-upgrader


📝 Commits (1)

  • a26ebcb Port WorldUpgrader and RegionStorageUpgrader (Optimize World's worker)

📊 Changes

5 files changed (+1012 additions, -3 deletions)

View changed files

📝 crates/horizon-world/src/datafix/files.rs (+2 -2)
📝 crates/horizon-world/src/datafix/mod.rs (+1 -0)
📝 crates/horizon-world/src/datafix/progress.rs (+114 -1)
➕ crates/horizon-world/src/datafix/world_upgrader.rs (+597 -0)
➕ crates/horizon-world/src/datafix/world_upgrader_tests.rs (+298 -0)

📄 Description

🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally.

Part of #3518

First of two PRs for Optimize World. This one is the worker (no screen yet); the second PR adds OptimizeWorldScreen and the Edit World flow.

What

crates/horizon-world/src/datafix/world_upgrader.rs (new) ports WorldUpgrader, RegionStorageUpgrader (+ Builder, FileToUpgrade, TagModifier) and UpgradeStatusTranslator:

  • a worker thread upgrades entities, then poi (default version 1945), then region (chunk) of every dimension, in vanilla's order, counting all dimensions before upgrading any (upgradeLevels);
  • per chunk: read, run the tag modifiers at the current version (verifyChunkPos, or verifyChunkPosAndEraseCache with erase cache), upgrade to the current DataVersion, write only if changed (always when recreating region files, writing to new_<folder> and replacing each file when finished);
  • vanilla's converted = converted && processOnePosition(..) short circuit is kept as is: a chunk that is skipped ends the pass over its file;
  • progress (converted, skipped, totalChunks, per-dimension and total progress, Status, DataFixTypes) added to the existing UpgradeProgress; cancel() joins the worker; a panic in the worker sets FAILED and finished like the uncaught exception handler.

Not ported

  • SavedDataStorage of the overworld (saveAndJoin/close): nothing loads or changes saved data in this run.
  • UpgradeProgress.logProgress / notification service (server management protocol).
  • Dimensions come from dimensions/ folders plus the three vanilla ones, standing in for the LEVEL_STEM registry; the generator type of the datafix context comes from world_gen_settings.dat.

Vanilla followed

WorldUpgrader.{work,upgradeLevels,verifyChunkPos,verifyChunkPosAndEraseCache,getDataFixContextTag,cancel}, RegionStorageUpgrader.{init,upgrade,processOnePosition,tryProcessOnePosition,upgradeTag,onFileFinished,getAllChunkPositions}, SimpleRegionStorage.upgradeChunkTag, RecreatingSimpleRegionStorage, UpgradeStatusTranslator.translate.

Tests

11 unit tests on temp dirs (cargo test -p horizon-world --lib world_upgrader): converted/skipped counts, the short circuit, POI default version, erase cache, recreate, cancel, the thread, status keys, region names and dimension folders. fmt and clippy -D warnings clean.

🤖 Generated with Claude Code


🔄 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/4774 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `parity/L1-upgrader` --- ### 📝 Commits (1) - [`a26ebcb`](https://github.com/horizon-rust/horizon/commit/a26ebcb37efcb95b865fc3562e001ce43f5fd7e8) Port WorldUpgrader and RegionStorageUpgrader (Optimize World's worker) ### 📊 Changes **5 files changed** (+1012 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/datafix/files.rs` (+2 -2) 📝 `crates/horizon-world/src/datafix/mod.rs` (+1 -0) 📝 `crates/horizon-world/src/datafix/progress.rs` (+114 -1) ➕ `crates/horizon-world/src/datafix/world_upgrader.rs` (+597 -0) ➕ `crates/horizon-world/src/datafix/world_upgrader_tests.rs` (+298 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally. Part of #3518 First of two PRs for Optimize World. This one is the worker (no screen yet); the second PR adds `OptimizeWorldScreen` and the Edit World flow. ## What `crates/horizon-world/src/datafix/world_upgrader.rs` (new) ports `WorldUpgrader`, `RegionStorageUpgrader` (+ `Builder`, `FileToUpgrade`, `TagModifier`) and `UpgradeStatusTranslator`: - a worker thread upgrades `entities`, then `poi` (default version 1945), then `region` (chunk) of every dimension, in vanilla's order, counting all dimensions before upgrading any (`upgradeLevels`); - per chunk: read, run the tag modifiers at the current version (`verifyChunkPos`, or `verifyChunkPosAndEraseCache` with erase cache), upgrade to the current DataVersion, write only if changed (always when recreating region files, writing to `new_<folder>` and replacing each file when finished); - vanilla's `converted = converted && processOnePosition(..)` short circuit is kept as is: a chunk that is skipped ends the pass over its file; - progress (`converted`, `skipped`, `totalChunks`, per-dimension and total progress, `Status`, `DataFixTypes`) added to the existing `UpgradeProgress`; `cancel()` joins the worker; a panic in the worker sets `FAILED` and finished like the uncaught exception handler. ## Not ported - `SavedDataStorage` of the overworld (`saveAndJoin`/`close`): nothing loads or changes saved data in this run. - `UpgradeProgress.logProgress` / notification service (server management protocol). - Dimensions come from `dimensions/` folders plus the three vanilla ones, standing in for the `LEVEL_STEM` registry; the generator type of the datafix context comes from `world_gen_settings.dat`. ## Vanilla followed `WorldUpgrader.{work,upgradeLevels,verifyChunkPos,verifyChunkPosAndEraseCache,getDataFixContextTag,cancel}`, `RegionStorageUpgrader.{init,upgrade,processOnePosition,tryProcessOnePosition,upgradeTag,onFileFinished,getAllChunkPositions}`, `SimpleRegionStorage.upgradeChunkTag`, `RecreatingSimpleRegionStorage`, `UpgradeStatusTranslator.translate`. ## Tests 11 unit tests on temp dirs (`cargo test -p horizon-world --lib world_upgrader`): converted/skipped counts, the short circuit, POI default version, erase cache, recreate, cancel, the thread, status keys, region names and dimension folders. fmt and clippy `-D warnings` clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:15:23 +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#5844
No description provided.