[PR #7809] Reject missing selector predicates before negation #7838

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7809
Author: @TheMrZZ
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/missing-selector-predicate


📝 Commits (1)

  • 85e10d5 Reject missing selector predicates before negation

📊 Changes

3 files changed (+79 additions, -8 deletions)

View changed files

📝 crates/horizon-client/src/game/scoreboard.rs (+7 -6)
📝 tools/command_exec_corpus.py (+42 -1)
📝 tools/test_command_exec_parity.py (+30 -1)

📄 Description

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

What and why

Fixes #7794. A selector now rejects an entity when its named predicate cannot be found, for both predicate=id and predicate=!id. The missing lookup exits before evaluating or applying negation. Defined predicates retain their existing evaluation path.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

Official 26.3 EntitySelectorOptions.lambda$bootStrap$56: an empty registry lookup returns false at bytecode offsets 51–60, before the negation XOR at 144.

The new selector missing predicates command corpus covers sheep, cow, a named pig and chicken; both missing signs; default-namespace aliases; defined positive/negative controls; multiple-filter ordering; and an unrelated target. The test runner installs a small real datapack in both scratch worlds, using qualified minecraft:entity_type predicates. It checks 18 successful Java control results so a missing or invalid fixture cannot falsely pass the comparison.

Fresh Java 26.3 versus the baseline matches 45/55 observations, with ten missing-negation differences; the fixed binary matches 55/55. Scripts and Java reference records are byte-identical between before/after. Additional datapack listing checks with the fixture installed match 3/3. Namespace handling, references, chance, weather and component-view evaluation are unchanged.

Other projects' code

None.

Self-check

pr_ready (tools/pr_ready.py --quick on a local runner, against origin/main at 3fc4c4ca0, 4 min 18 s)

Check Result
Scope ✅ 3 files, +79 −8
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (1 min 10 s)
rustfmt ✅ (7 s)
clippy ✅ (1 min 39 s)
tests: horizon-client ✅ 711 passed (1 min 4 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
mod API up to date ✅ (17 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
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)

🤖 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/7809 **Author:** [@TheMrZZ](https://github.com/TheMrZZ) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/missing-selector-predicate` --- ### 📝 Commits (1) - [`85e10d5`](https://github.com/horizon-rust/horizon/commit/85e10d568623596c632cfb233de0dd65596fe31b) Reject missing selector predicates before negation ### 📊 Changes **3 files changed** (+79 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/scoreboard.rs` (+7 -6) 📝 `tools/command_exec_corpus.py` (+42 -1) 📝 `tools/test_command_exec_parity.py` (+30 -1) </details> ### 📄 Description > 🤖 Opened by TheMrZZ's AI agent (Codex, gpt-6.1-sol), not by TheMrZZ personally. ## What and why Fixes #7794. A selector now rejects an entity when its named predicate cannot be found, for both `predicate=id` and `predicate=!id`. The missing lookup exits before evaluating or applying negation. Defined predicates retain their existing evaluation path. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference Official 26.3 `EntitySelectorOptions.lambda$bootStrap$56`: an empty registry lookup returns false at bytecode offsets 51–60, before the negation XOR at 144. The new `selector missing predicates` command corpus covers sheep, cow, a named pig and chicken; both missing signs; default-namespace aliases; defined positive/negative controls; multiple-filter ordering; and an unrelated target. The test runner installs a small real datapack in both scratch worlds, using qualified `minecraft:entity_type` predicates. It checks 18 successful Java control results so a missing or invalid fixture cannot falsely pass the comparison. Fresh Java 26.3 versus the baseline matches 45/55 observations, with ten missing-negation differences; the fixed binary matches 55/55. Scripts and Java reference records are byte-identical between before/after. Additional datapack listing checks with the fixture installed match 3/3. Namespace handling, references, chance, weather and component-view evaluation are unchanged. ## Other projects' code None. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on a local runner, against origin/main at 3fc4c4ca0, 4 min 18 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +79 −8 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (1 min 10 s) | | rustfmt | ✅ (7 s) | | clippy | ✅ (1 min 39 s) | | tests: horizon-client | ✅ 711 passed (1 min 4 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (17 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | 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) | 🤖 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>
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#7838
No description provided.