[PR #3370] [MERGED] port-pack: upgrade-datapack rewrites density functions #4936

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3370
Author: @ThatCakeIsAPie
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @ludovic111

Base: main ← Head: feat/upgrade-datapack-2a


📝 Commits (4)

  • 81b3803 port-pack: upgrade-datapack, a 26.2 data pack's registries in 26.3's formats
  • 2aca6fe port-pack: upgrade-datapack rewrites density functions
  • 0771f59 upgrade-datapack: refuse pack entries that leave the pack
  • 825f8f8 Merge feat/upgrade-datapack-1: refuse pack entries that leave the pack

📊 Changes

7 files changed (+1119 additions, -3 deletions)

View changed files

📝 crates/horizon-port-pack/Cargo.toml (+3 -1)
📝 crates/horizon-port-pack/src/lib.rs (+1 -0)
📝 crates/horizon-port-pack/src/main.rs (+22 -2)
➕ crates/horizon-port-pack/src/upgrade/density.rs (+317 -0)
➕ crates/horizon-port-pack/src/upgrade/mod.rs (+496 -0)
➕ crates/horizon-port-pack/src/upgrade/noise.rs (+112 -0)
➕ crates/horizon-port-pack/src/upgrade/registries.rs (+168 -0)

📄 Description

🤖 Opened by ThatCakeIsAPie's AI agent (Claude), not by ThatCakeIsAPie themself.

Builds on #3369 (feat/upgrade-datapack-1): until that merges, its commits show here too; this PR's own change is the last commit(s) on top of it.

What and why

Part 2 of 5 of horizon-port-pack upgrade-datapack (26.2 data packs in 26.3's formats; part 1 has the command and the background). This part rewrites named density functions (worldgen/density_function/) in 26.3's form:

  • inputs are named input/left/right (26.2: argument, argument1/argument2);
  • invert becomes reciprocal, y_clamped_gradient a gradient on axis y, shifted_noise a noise with shift_x/shift_y/shift_z (same sampling), end_islands end_outer_islands, and constant its number;
  • 26.2's flat_cache held each column's value at y = 0. When its input depends on y (followed through the pack's own functions; unknown ids count as depending on y), it becomes a cache around a slice at y = 0. 26.2's other caches (cache_2d, cache_once, cache_all_in_cell) only memoise in 26.3, so they become cache. A cache_2d around a function of y is reported as not faithful;
  • interpolated takes its cell from the noise settings whose router reaches it (size_horizontal * 4, size_vertical * 4, which 26.2 read from the settings), or vanilla's overworld cell when none does. A function shared by settings with different cells is reported;
  • a y_clamped_gradient with from_y == to_y becomes a step, reported as not faithful: 26.2 gave NaN at that y.

Vanilla reference

26.2's DensityFunctions (FlatCache, Cache2D, YClampedGradient, ShiftedNoise, EndIslandDensityFunction) and NoiseChunk's interpolation cell against 26.3's density function codecs. tools/datapack_upgrade_rosetta.py (part 5) upgrades vanilla 26.2's own density functions and compares them with 26.3's. The unit tests cover argument renames, removed types and flat_cache. Tooling: no harness.

Unchanged by the split into parts: on the 26.2 pack To The Max (175 density functions), the five parts together write byte-identical output to the original single-file version.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on DESKTOP-LT6RAH8, against upstream/main at e1b2b0b2f, 15 min 8 s)

Check Result
Scope ⚠️ 7 files, +1073 −3; 1076 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 401 run, FAILED (failures=1, errors=1, skipped=1) (2 min 47 s)
rustfmt ✅ (13 s)
clippy ✅ (1 min 32 s)
tests: horizon-port-pack ✅ 73 passed (1 min 49 s)
doc tests ✅ 0 passed
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (1 s)
launcher clippy ❌ failed (1 min 0 s)
launcher tests ✅ 212 passed (7 min 34 s)
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The Python tests that fail here fail the same way on upstream main on this Windows machine (symlink privilege, path separators); they're independent of this change, and CI runs them on Linux. Launcher clippy fails on Windows on upstream main too: an unused CommandExt import in launcher/src/sources.rs (9f1fa0a0a), which this change doesn't touch; #3363 removes it.

Label: skip-release.

🤖 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/3370 **Author:** [@ThatCakeIsAPie](https://github.com/ThatCakeIsAPie) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/upgrade-datapack-2a` --- ### 📝 Commits (4) - [`81b3803`](https://github.com/horizon-rust/horizon/commit/81b38030176f5e9e8beac500403a80265e88ce64) port-pack: upgrade-datapack, a 26.2 data pack's registries in 26.3's formats - [`2aca6fe`](https://github.com/horizon-rust/horizon/commit/2aca6fe06c3a9f551d2b1566acafe0043318d8f9) port-pack: upgrade-datapack rewrites density functions - [`0771f59`](https://github.com/horizon-rust/horizon/commit/0771f59bca57243d668e2aafbed932dfe25f38d6) upgrade-datapack: refuse pack entries that leave the pack - [`825f8f8`](https://github.com/horizon-rust/horizon/commit/825f8f8845503b37435f329f3f1ecfb400573c63) Merge feat/upgrade-datapack-1: refuse pack entries that leave the pack ### 📊 Changes **7 files changed** (+1119 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-port-pack/Cargo.toml` (+3 -1) 📝 `crates/horizon-port-pack/src/lib.rs` (+1 -0) 📝 `crates/horizon-port-pack/src/main.rs` (+22 -2) ➕ `crates/horizon-port-pack/src/upgrade/density.rs` (+317 -0) ➕ `crates/horizon-port-pack/src/upgrade/mod.rs` (+496 -0) ➕ `crates/horizon-port-pack/src/upgrade/noise.rs` (+112 -0) ➕ `crates/horizon-port-pack/src/upgrade/registries.rs` (+168 -0) </details> ### 📄 Description > 🤖 Opened by ThatCakeIsAPie's AI agent (Claude), not by ThatCakeIsAPie themself. **Builds on #3369** (`feat/upgrade-datapack-1`): until that merges, its commits show here too; this PR's own change is the last commit(s) on top of it. ## What and why Part 2 of 5 of `horizon-port-pack upgrade-datapack` (26.2 data packs in 26.3's formats; part 1 has the command and the background). This part rewrites named density functions (`worldgen/density_function/`) in 26.3's form: - inputs are named `input`/`left`/`right` (26.2: `argument`, `argument1`/`argument2`); - `invert` becomes `reciprocal`, `y_clamped_gradient` a `gradient` on axis y, `shifted_noise` a `noise` with `shift_x`/`shift_y`/`shift_z` (same sampling), `end_islands` `end_outer_islands`, and `constant` its number; - 26.2's `flat_cache` held each column's value at y = 0. When its input depends on y (followed through the pack's own functions; unknown ids count as depending on y), it becomes a `cache` around a `slice` at y = 0. 26.2's other caches (`cache_2d`, `cache_once`, `cache_all_in_cell`) only memoise in 26.3, so they become `cache`. A `cache_2d` around a function of y is reported as not faithful; - `interpolated` takes its cell from the noise settings whose router reaches it (`size_horizontal * 4`, `size_vertical * 4`, which 26.2 read from the settings), or vanilla's overworld cell when none does. A function shared by settings with different cells is reported; - a `y_clamped_gradient` with `from_y == to_y` becomes a step, reported as not faithful: 26.2 gave NaN at that y. ## Vanilla reference 26.2's `DensityFunctions` (`FlatCache`, `Cache2D`, `YClampedGradient`, `ShiftedNoise`, `EndIslandDensityFunction`) and `NoiseChunk`'s interpolation cell against 26.3's density function codecs. `tools/datapack_upgrade_rosetta.py` (part 5) upgrades vanilla 26.2's own density functions and compares them with 26.3's. The unit tests cover argument renames, removed types and `flat_cache`. Tooling: no harness. Unchanged by the split into parts: on the 26.2 pack *To The Max* (175 density functions), the five parts together write byte-identical output to the original single-file version. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on DESKTOP-LT6RAH8, against upstream/main at e1b2b0b2f, 15 min 8 s) | Check | Result | | --- | --- | | Scope | ⚠️ 7 files, +1073 −3; 1076 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 401 run, FAILED (failures=1, errors=1, skipped=1) (2 min 47 s) | | rustfmt | ✅ (13 s) | | clippy | ✅ (1 min 32 s) | | tests: horizon-port-pack | ✅ 73 passed (1 min 49 s) | | doc tests | ✅ 0 passed | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ❌ failed (1 min 0 s) | | launcher tests | ✅ 212 passed (7 min 34 s) | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The Python tests that fail here fail the same way on upstream main on this Windows machine (symlink privilege, path separators); they're independent of this change, and CI runs them on Linux. Launcher clippy fails on Windows on upstream main too: an unused `CommandExt` import in `launcher/src/sources.rs` (9f1fa0a0a), which this change doesn't touch; #3363 removes it. Label: `skip-release`. 🤖 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:09:02 +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#4936
No description provided.