[PR #7432] [MERGED] Normalize /setblock states before placement #7601

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

📋 Pull Request Information

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

Base: main ← Head: fix/7256-initial-note-instrument


📝 Commits (2)

  • ac0a69f Normalize setblock states before placement
  • 2f32ceb Clarify the vanilla method mapped by command state normalization

📊 Changes

3 files changed (+58 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/commands.rs (+32 -0)
📝 tools/command_exec_corpus.py (+25 -0)
📝 tools/port_map/rest-006.tsv (+1 -1)

📄 Description

🤖 Opened by TheMrZZ's AI agent (Codex, gpt-6.1-sol), not by TheMrZZ personally.

What and why

Fixes #7256.

A note block created with /setblock above stone initially used harp until its support changed. Normalize the requested state against its neighbours before placement, then reapply explicitly supplied properties, as vanilla does. Strict mode continues to skip normalization.

Extend the existing command-execution corpus with initial placement, support changes, explicit instrument/note overrides, strict mode, normalization before the unchanged-state check, and the fallback when shape updates return air.

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

Java 26.3 SetBlockCommand.setBlock, BlockInput.place, BlockInput.overwriteWithDefinedProperties, Block.updateFromNeighbourShapes, and NoteBlock.updateShape / setInstrument. The command path normalizes neighbour shapes unless flag 16 is set, restores the input when normalization returns air, and reapplies defined properties before placing the state.

Regression coverage: tools/test_command_exec_parity.py, extended through tools/command_exec_corpus.py.

Other projects' code

None.

Self-check

pr_ready (tools/pr_ready.py locally, against origin/main at a9de2a1f7, 10 min 46 s)

Check Result
Scope ✅ 3 files, +58 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 612 passed (1 min 24 s)
rustfmt ✅ (17 s)
clippy ✅ (6 min 1 s)
tests: horizon-client ✅ 684 passed (2 min 22 s)
doc tests ✅ 0 passed (3 s)
content root tests ➖ content root untouched
mod API up to date ✅ (38 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (no vanilla data here): 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)

Additional verification with the pinned Java 26.3 jars and prepared resources: ran the 21 new world_misc commands through the existing command-execution runner, using the same setup and command sequence for each binary. The unchanged a9de2a1f7 binary failed with five command mismatches; the fixed binary matched all 21 commands, including feedback, styles, and callback results. Explicit instrument/note overrides, strict mode, the unchanged-input case, and the air fallback are included.

The ledger base check completed, and the edited port-map validation reported 150 rows with no problems. The ledger flags a structural call-graph gap on place_state: property overwrite runs earlier, from its /setblock caller. The Python suite ran 612 tests with one skipped.

The pr_ready block above predates importing the game data. The focused Java/Rust regression subsequently passed; the full affected-harness suite has not been run locally.

🤖 Generated with Codex


🔄 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/7432 **Author:** [@TheMrZZ](https://github.com/TheMrZZ) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/7256-initial-note-instrument` --- ### 📝 Commits (2) - [`ac0a69f`](https://github.com/horizon-rust/horizon/commit/ac0a69f04c8c81fb7e1d1d054d55e8d03650bfe5) Normalize setblock states before placement - [`2f32ceb`](https://github.com/horizon-rust/horizon/commit/2f32ceb119d994a1048ad92f844df174bfbd1658) Clarify the vanilla method mapped by command state normalization ### 📊 Changes **3 files changed** (+58 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands.rs` (+32 -0) 📝 `tools/command_exec_corpus.py` (+25 -0) 📝 `tools/port_map/rest-006.tsv` (+1 -1) </details> ### 📄 Description > 🤖 Opened by TheMrZZ's AI agent (Codex, gpt-6.1-sol), not by TheMrZZ personally. ## What and why Fixes #7256. A note block created with `/setblock` above stone initially used `harp` until its support changed. Normalize the requested state against its neighbours before placement, then reapply explicitly supplied properties, as vanilla does. Strict mode continues to skip normalization. Extend the existing command-execution corpus with initial placement, support changes, explicit instrument/note overrides, strict mode, normalization before the unchanged-state check, and the fallback when shape updates return air. ## Kind - [x] 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 Java 26.3 `SetBlockCommand.setBlock`, `BlockInput.place`, `BlockInput.overwriteWithDefinedProperties`, `Block.updateFromNeighbourShapes`, and `NoteBlock.updateShape` / `setInstrument`. The command path normalizes neighbour shapes unless flag 16 is set, restores the input when normalization returns air, and reapplies defined properties before placing the state. Regression coverage: `tools/test_command_exec_parity.py`, extended through `tools/command_exec_corpus.py`. ## Other projects' code None. ## Self-check **pr_ready** (`tools/pr_ready.py` locally, against origin/main at a9de2a1f7, 10 min 46 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +58 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 612 passed (1 min 24 s) | | rustfmt | ✅ (17 s) | | clippy | ✅ (6 min 1 s) | | tests: horizon-client | ✅ 684 passed (2 min 22 s) | | doc tests | ✅ 0 passed (3 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (38 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (no vanilla data here): 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) | Additional verification with the pinned Java 26.3 jars and prepared resources: ran the 21 new `world_misc` commands through the existing command-execution runner, using the same setup and command sequence for each binary. The unchanged `a9de2a1f7` binary failed with five command mismatches; the fixed binary matched all 21 commands, including feedback, styles, and callback results. Explicit instrument/note overrides, strict mode, the unchanged-input case, and the air fallback are included. The ledger base check completed, and the edited port-map validation reported 150 rows with no problems. The ledger flags a structural call-graph gap on `place_state`: property overwrite runs earlier, from its `/setblock` caller. The Python suite ran 612 tests with one skipped. The `pr_ready` block above predates importing the game data. The focused Java/Rust regression subsequently passed; the full affected-harness suite has not been run locally. 🤖 Generated with [Codex](https://openai.com/codex/) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 07:20:34 +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#7601
No description provided.