[PR #5325] [MERGED] Carry private native item components over the wire #6210

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5325
Author: @arismoko
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: native-component-types


📝 Commits (1)

  • 2238e66 Carry private native item components over the wire

📊 Changes

12 files changed (+446 additions, -15 deletions)

View changed files

📝 crates/horizon-client/src/content_identity.rs (+6 -0)
📝 crates/horizon-client/src/game/remote.rs (+31 -3)
📝 crates/horizon-client/src/item_sync.rs (+25 -2)
📝 crates/horizon-client/src/lan/conn.rs (+13 -7)
📝 crates/horizon-client/src/lan/data.rs (+13 -2)
📝 crates/horizon-client/src/lan/guest.rs (+19 -0)
📝 crates/horizon-client/src/net.rs (+3 -0)
➕ crates/horizon-client/tests/custom_component_unregistered.rs (+22 -0)
➕ crates/horizon-client/tests/custom_component_wire.rs (+162 -0)
📝 crates/horizon-protocol/src/item.rs (+12 -1)
➕ crates/horizon-protocol/src/item/custom.rs (+133 -0)
📝 crates/horizon-protocol/src/registry.rs (+7 -0)

📄 Description

🤖 Opened by Aria's agent swarm, Dyna, not by Aria.

Part of #4806.

Summary

Carry a private, frozen table of native component IDs through item stack NBT wire values, removals and component hashes. This is the transport slice. A follow-up will expose native registration and validate values; this PR adds no supported native API.

Reuse the content identity challenge and its registry-tagged hash from #5267. A server with custom component IDs rejects vanilla-brand clients deliberately. A vanilla creative client could return an edited stack without those components and lose data. This is stricter than the existing policy for mod blocks and items.

A custom-enabled client can join an unchallenged server. It logs and omits custom components it cannot send. It logs and drops an incoming stack with an unnegotiated custom ID before conversion or wire caching. The bounded context-free packet decoder recognizes local custom IDs; the per-connection semantic check decides whether to accept the decoded stack. The existing lan/containers.rs::hashed_matches still checks only item ID and count, not component hashes.

In-game proof

On arch, a throwaway instrumented native mod built against exact engine head 2238e66444027163094bc4feb1adbeed8675b7eb. On both the integrated server thread and a dedicated server, sample:charge = {charge: 42} and removal of sample:mode (ID 123) survived save and reload. Server and client hashes were -1311065120 before and after reload. Ordinary client outbound hashes and creative-slot return on the server matched in both modes.

A custom-enabled client reached gameplay on an older unchallenged Horizon dedicated server with custom_components=false. A protocol bot sending the vanilla brand was rejected by a custom-enabled server with the expected content registry mismatch. The bot was not a Mojang client. Screenshots were recorded.

The recommended end-to-end route is https://github.com/arismoko/horizon-machine-sample. It was not used here because this transport slice intentionally exposes no native registration API; the proof used a throwaway instrumented mod.

Readiness

Both custom component integration tests passed. Strict Clippy for horizon-protocol passed. The full check below has two baseline failures, both reproduced on unchanged base 9069aea3e:

  • Clippy: main's #5123 merge e05a09220f453758e1df6793639ca0285e2ae4f3 added an S::Attack arm that overlaps the existing arm at crates/horizon-client/src/lan/hub.rs:2706. The later arm at line 2810 is unreachable.
  • Eight lan_bot tests: #4787 merge 258a11a81784d0d8fa5ec881995d6c1e4ac49b5f, including commit e11584375, moved inbox processing into drain_packets; the test harness still calls Hub::tick, which does not call it. These are not missing-resource, port or sandbox failures. The game calls drain_packets separately. Hosted CI runs these tests but their assertions return early without the prepared .local data.

First assertion or error in each baseline LAN failure:

  • a_move_behind_a_use_on_a_block_and_its_swing_waits_for_the_next_tick: the use was not handled, left 0, right 1.
  • a_move_behind_an_attack_and_its_swing_waits_for_the_next_tick: the landing move did not run on the next tick.
  • a_respawned_guest_is_immune_until_its_client_loads_the_world: the packet marks it loaded.
  • guests_see_each_other_and_the_world_entities: zombies 0 players 1 moves 32.
  • recipe_settings_packets_update_only_the_players_book_and_survive_save: assertion left false, right true.
  • sprint_commands_survive_keyboard_input_changes: s.hub.guests[0].sprinting.
  • status_and_join: placed block was not broadcast, left None, right Some(([9, -59, 9], 1)).
  • the_prediction_records_each_client_tick_and_the_server_ticks_it_had_seen: the prediction records.

pr_ready (tools/pr_ready.py --quick --base HEAD^ on desktop, against HEAD^ at 9069aea3e, 4 min 42 s)

Check Result
Scope ✅ 12 files, +446 −15
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 499 passed (26 s)
rustfmt ✅ (5 s)
clippy ❌ failed (10 s)
tests: horizon-client, horizon-protocol ❌ 1411 passed, 8 failed (3 min 41 s)
doc tests ✅ 0 passed (10 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 68 affected, to run in CI (--quick): arrow, auto_jump, block_entity_anim, block_entity_render, block_removal, block_tint, block_transformer, cauldron, chest_pair, composter, container_title, crafter and 56 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Dyna.


🔄 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/5325 **Author:** [@arismoko](https://github.com/arismoko) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `native-component-types` --- ### 📝 Commits (1) - [`2238e66`](https://github.com/horizon-rust/horizon/commit/2238e66444027163094bc4feb1adbeed8675b7eb) Carry private native item components over the wire ### 📊 Changes **12 files changed** (+446 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/content_identity.rs` (+6 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+31 -3) 📝 `crates/horizon-client/src/item_sync.rs` (+25 -2) 📝 `crates/horizon-client/src/lan/conn.rs` (+13 -7) 📝 `crates/horizon-client/src/lan/data.rs` (+13 -2) 📝 `crates/horizon-client/src/lan/guest.rs` (+19 -0) 📝 `crates/horizon-client/src/net.rs` (+3 -0) ➕ `crates/horizon-client/tests/custom_component_unregistered.rs` (+22 -0) ➕ `crates/horizon-client/tests/custom_component_wire.rs` (+162 -0) 📝 `crates/horizon-protocol/src/item.rs` (+12 -1) ➕ `crates/horizon-protocol/src/item/custom.rs` (+133 -0) 📝 `crates/horizon-protocol/src/registry.rs` (+7 -0) </details> ### 📄 Description > 🤖 Opened by Aria's agent swarm, Dyna, not by Aria. Part of #4806. ## Summary Carry a private, frozen table of native component IDs through item stack NBT wire values, removals and component hashes. This is the transport slice. A follow-up will expose native registration and validate values; this PR adds no supported native API. Reuse the content identity challenge and its registry-tagged hash from #5267. A server with custom component IDs rejects vanilla-brand clients deliberately. A vanilla creative client could return an edited stack without those components and lose data. This is stricter than the existing policy for mod blocks and items. A custom-enabled client can join an unchallenged server. It logs and omits custom components it cannot send. It logs and drops an incoming stack with an unnegotiated custom ID before conversion or wire caching. The bounded context-free packet decoder recognizes local custom IDs; the per-connection semantic check decides whether to accept the decoded stack. The existing `lan/containers.rs::hashed_matches` still checks only item ID and count, not component hashes. ## In-game proof On arch, a throwaway instrumented native mod built against exact engine head `2238e66444027163094bc4feb1adbeed8675b7eb`. On both the integrated server thread and a dedicated server, `sample:charge = {charge: 42}` and removal of `sample:mode` (ID 123) survived save and reload. Server and client hashes were `-1311065120` before and after reload. Ordinary client outbound hashes and creative-slot return on the server matched in both modes. A custom-enabled client reached gameplay on an older unchallenged Horizon dedicated server with `custom_components=false`. A protocol bot sending the `vanilla` brand was rejected by a custom-enabled server with the expected content registry mismatch. The bot was **not** a Mojang client. Screenshots were recorded. The recommended end-to-end route is https://github.com/arismoko/horizon-machine-sample. It was not used here because this transport slice intentionally exposes no native registration API; the proof used a throwaway instrumented mod. ## Readiness Both custom component integration tests passed. Strict Clippy for `horizon-protocol` passed. The full check below has two baseline failures, both reproduced on unchanged base `9069aea3e`: - Clippy: main's #5123 merge `e05a09220f453758e1df6793639ca0285e2ae4f3` added an `S::Attack` arm that overlaps the existing arm at `crates/horizon-client/src/lan/hub.rs:2706`. The later arm at line 2810 is unreachable. - Eight `lan_bot` tests: #4787 merge `258a11a81784d0d8fa5ec881995d6c1e4ac49b5f`, including commit `e11584375`, moved inbox processing into `drain_packets`; the test harness still calls `Hub::tick`, which does not call it. These are not missing-resource, port or sandbox failures. The game calls `drain_packets` separately. Hosted CI runs these tests but their assertions return early without the prepared `.local` data. First assertion or error in each baseline LAN failure: - `a_move_behind_a_use_on_a_block_and_its_swing_waits_for_the_next_tick`: `the use was not handled`, left 0, right 1. - `a_move_behind_an_attack_and_its_swing_waits_for_the_next_tick`: `the landing move did not run on the next tick`. - `a_respawned_guest_is_immune_until_its_client_loads_the_world`: `the packet marks it loaded`. - `guests_see_each_other_and_the_world_entities`: `zombies 0 players 1 moves 32`. - `recipe_settings_packets_update_only_the_players_book_and_survive_save`: assertion left false, right true. - `sprint_commands_survive_keyboard_input_changes`: `s.hub.guests[0].sprinting`. - `status_and_join`: `placed block was not broadcast`, left None, right Some(([9, -59, 9], 1)). - `the_prediction_records_each_client_tick_and_the_server_ticks_it_had_seen`: `the prediction records`. **pr_ready** (`tools/pr_ready.py --quick --base HEAD^` on desktop, against HEAD^ at 9069aea3e, 4 min 42 s) | Check | Result | | --- | --- | | Scope | ✅ 12 files, +446 −15 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 499 passed (26 s) | | rustfmt | ✅ (5 s) | | clippy | ❌ failed (10 s) | | tests: horizon-client, horizon-protocol | ❌ 1411 passed, 8 failed (3 min 41 s) | | doc tests | ✅ 0 passed (10 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 68 affected, to run in CI (--quick): arrow, auto_jump, block_entity_anim, block_entity_render, block_removal, block_tint, block_transformer, cauldron, chest_pair, composter, container_title, crafter and 56 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with Dyna. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:15:54 +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#6210
No description provided.