[PR #7511] [MERGED] The save round trip covers leads #7635

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7511
Author: @HrafnaValkyrja
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: test/save-leads-roundtrip


📝 Commits (2)

  • d2a4a97 test: save round-trip scene covers leads
  • 828237a Merge remote-tracking branch 'origin/main' into test/save-leads-roundtrip

📊 Changes

2 files changed (+30 additions, -1 deletions)

View changed files

📝 tools/save_roundtrip_scene.py (+16 -0)
📝 tools/test_save_roundtrip_parity.py (+14 -1)

📄 Description

🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself.

Follows #7185 (riders) and the question in the review of #7094: the save round-trip scene had no lead, so a lead dropped by the save path would not have been noticed. This adds two to the scene, a cow tied to a fence and a boat tied to a pig. No bug found: Horizon already saves both exactly as vanilla does.

Part of #6545

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

In vanilla 26.3 Leashable.LeashData saves the leash field either as [I; x, y, z] (the fence knot's block) or as {UUID: [I; ...]} (the holder entity). Vanilla restores the holder on the first tick after loading, and drops the lead if it cannot find it. The scene therefore places the fence, the knot, and the holder with a fixed UUID first, and puts each leashed entity a few blocks from what holds it. The knot entity itself is not saved by vanilla and is not in the comparison. An earlier attempt left no lead in the vanilla save because the entities stood too far from the fence (the summon command places an entity at its own coordinates, not at NBT Pos; the test now reads the position from the entry's Pos). The test also fails if the vanilla save does not keep both leads, so the scene cannot silently lose them again.

Proof

  • Vanilla's save holds leash: [I; 40, -60, 40] on the cow and leash: {UUID: [I; 28672, 0, 0, 68]} on the boat. The first full run reports 0 unexplained differences, so Horizon saves both leads as vanilla does.
  • With the leash write temporarily disabled in write_leash (mobs) and write_boat_leash (boats), the run fails with 2 differences, entity.leash on the cow and on the boat (vanilla has the tag, Horizon null). Restored afterwards.
  • Spawner Delay (vanilla 20, Horizon 10 or 11) is still not stable: in 5 full runs on this branch it matched in 2 and differed in 3. It is unrelated to leads and is left alone here.

Harnesses

Run on this branch: test_save_roundtrip_parity.py (0 unexplained differences in runs 1 and 2 of 5; the other 3 differ only on the spawner Delay), the same test with the lead writers disabled (2 differences, as above), and pr_ready.py --quick (pass; 614 Python tests). No Rust code changed.

A refactor with no behaviour change; proved by script, no human played this change.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on Valhalla, against origin/main at 43d532289, 29 s)

Check Result
Scope ✅ 2 files, +30 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (28 s)
rustfmt ➖ no Rust change
clippy ➖ no Rust change
tests ➖ no crate touched
doc tests ➖ no crate touched
content root tests ➖ content root untouched
mod API up to date ➖ native hooks untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 204 affected, to run in CI (--quick): anvil_turtle_egg, forced_end, free_space, generation_tick, geometry, ghost_recipe, ground_support, hardcore_respawn, height_provider, heightmap, held_drop, held_item_stack and 192 more
Label skip-release

🤖 Generated with Claude Code

https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m


🔄 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/7511 **Author:** [@HrafnaValkyrja](https://github.com/HrafnaValkyrja) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `test/save-leads-roundtrip` --- ### 📝 Commits (2) - [`d2a4a97`](https://github.com/horizon-rust/horizon/commit/d2a4a97c1f440728513b060b651b2530c2a09b99) test: save round-trip scene covers leads - [`828237a`](https://github.com/horizon-rust/horizon/commit/828237afa7306a2ca2c378d3f67d89c38fd6396d) Merge remote-tracking branch 'origin/main' into test/save-leads-roundtrip ### 📊 Changes **2 files changed** (+30 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tools/save_roundtrip_scene.py` (+16 -0) 📝 `tools/test_save_roundtrip_parity.py` (+14 -1) </details> ### 📄 Description > 🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself. Follows #7185 (riders) and the question in the review of #7094: the save round-trip scene had no lead, so a lead dropped by the save path would not have been noticed. This adds two to the scene, a cow tied to a fence and a boat tied to a pig. No bug found: Horizon already saves both exactly as vanilla does. Part of #6545 ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [x] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference In vanilla 26.3 `Leashable.LeashData` saves the `leash` field either as `[I; x, y, z]` (the fence knot's block) or as `{UUID: [I; ...]}` (the holder entity). Vanilla restores the holder on the first tick after loading, and drops the lead if it cannot find it. The scene therefore places the fence, the knot, and the holder with a fixed UUID first, and puts each leashed entity a few blocks from what holds it. The knot entity itself is not saved by vanilla and is not in the comparison. An earlier attempt left no lead in the vanilla save because the entities stood too far from the fence (the `summon` command places an entity at its own coordinates, not at NBT `Pos`; the test now reads the position from the entry's `Pos`). The test also fails if the vanilla save does not keep both leads, so the scene cannot silently lose them again. ## Proof - Vanilla's save holds `leash: [I; 40, -60, 40]` on the cow and `leash: {UUID: [I; 28672, 0, 0, 68]}` on the boat. The first full run reports 0 unexplained differences, so Horizon saves both leads as vanilla does. - With the `leash` write temporarily disabled in `write_leash` (mobs) and `write_boat_leash` (boats), the run fails with 2 differences, `entity.leash` on the cow and on the boat (vanilla has the tag, Horizon null). Restored afterwards. - Spawner `Delay` (vanilla 20, Horizon 10 or 11) is still not stable: in 5 full runs on this branch it matched in 2 and differed in 3. It is unrelated to leads and is left alone here. ## Harnesses Run on this branch: `test_save_roundtrip_parity.py` (0 unexplained differences in runs 1 and 2 of 5; the other 3 differ only on the spawner `Delay`), the same test with the lead writers disabled (2 differences, as above), and `pr_ready.py --quick` (pass; 614 Python tests). No Rust code changed. A refactor with no behaviour change; proved by script, no human played this change. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on Valhalla, against origin/main at 43d532289, 29 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +30 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (28 s) | | rustfmt | ➖ no Rust change | | clippy | ➖ no Rust change | | tests | ➖ no crate touched | | doc tests | ➖ no crate touched | | content root tests | ➖ content root untouched | | mod API up to date | ➖ native hooks untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 204 affected, to run in CI (--quick): anvil_turtle_egg, forced_end, free_space, generation_tick, geometry, ghost_recipe, ground_support, hardcore_respawn, height_provider, heightmap, held_drop, held_item_stack and 192 more | | Label | `skip-release` | 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 07:21:09 +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#7635
No description provided.