[PR #324] [MERGED] Diff vanilla classes method by method and map them to Horizon #2493

Closed
opened 2026-11-02 15:56:39 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: feat/version-port-classes


📝 Commits (3)

  • 720e91f Design the version-port pipeline: detect, prepare, diff, regenerate, report
  • 58ad816 version_port.py: detect, prepare and diff Minecraft releases
  • 93bb113 Diff vanilla classes method by method and map them to Horizon

📊 Changes

7 files changed (+1738 additions, -0 deletions)

View changed files

📝 docs/README.md (+1 -0)
➕ docs/version-ports.md (+278 -0)
➕ tests/test_class_index.py (+170 -0)
➕ tests/test_version_port.py (+144 -0)
➕ tools/class_index.py (+327 -0)
➕ tools/vanilla_map.py (+227 -0)
➕ tools/version_port.py (+591 -0)

📄 Description

Stacked on #323. Slice (b) of docs/version-ports.md.

What

  • tools/class_index.py: indexes every net/minecraft and com/mojang class of a jar: superclass, interfaces, fields, and one hash per method. Before hashing, every constant-pool reference is replaced by what it names, branch and switch targets become instruction indices, ldc_w/goto_w count as ldc/goto, and lambdas fold into one lambda$<method> entry per declaring method. So recompiled-but-unchanged code hashes the same, and renumbered lambdas don't show up as changes. The class diff gives added/removed/changed classes (methods and fields added, removed and changed), plus moved classes (same local name, another package).
  • tools/vanilla_map.py: vanilla class → Horizon map, built from the repository in ~7 s:
    • Rust // comments that name a vanilla class (CamelCase names that resolve to exactly one class; one-word names only with .member), with the member when one is named;
    • Java oracles' imports (wildcards resolved against the names the file uses) and fully qualified names, linked to the harnesses whose scripts or recorded parity dependencies use them;
    • harness probes (examples/bins a harness names) and the modules they use.
      vanilla_map.py INDEX net.minecraft.world.food.FoodData prints the Rust files and harnesses.
  • version_port.py prepare now writes classes.json. diff adds a classes section, with each changed or removed class's Horizon files and harnesses (looked up under the old name), and writes vanilla_map.json.

Proof: 26.2 → 26.3 on the Mac mini

  • Indexing: 2 s per version (11,383 classes, 91,424 methods for 26.3); the whole diff takes 6 s.
  • classes: +786 -355, 194 moved, 2521 changed (13774 methods); 1258 of the changed or removed ones are ported or proved by Horizon
  • No false positives in the spot checks: each sampled one-method change is a real bytecode change (GLX.make → Util.make, RegistryCodecs.homogeneousList → registries.codec.RegistryCodecs.holderSet, a logger call with the throwable, the "Memory (non-heap)" typo fix).
  • Map: 3,017 vanilla classes are named by Horizon code, 1,765 of them covered by a harness, and all 301 harnesses reach at least one class. FoodData → hunger.rs, food_storage.rs, food_properties.rs, effects.rs/game.rs (eat), harnesses food, player_food, food_storage… LightEngine → light.rs (isEmptyShape, shapeOccludes), harness light.

How tested

  • python3 -m unittest tests.test_class_index tests.test_version_port: 21 tests. test_class_index assembles class files in the test (no game code). It checks that hashes ignore constant-pool layout and ldc width, that a changed literal or call target changes the hash, lambda folding, diff with moves, name resolution and tie-breaks, Rust comment scanning, Java imports (wildcard, static, qualified), and probe modules.
  • The full tests/ suite: same 2 pre-existing errors as origin/main on the Mac mini. tools/check_public_tree.py passes.

Needs Ludovic

Nothing.

🤖 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/324 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/version-port-classes` --- ### 📝 Commits (3) - [`720e91f`](https://github.com/horizon-rust/horizon/commit/720e91fb8cec9c7af5a530102ecde8baf7d8d748) Design the version-port pipeline: detect, prepare, diff, regenerate, report - [`58ad816`](https://github.com/horizon-rust/horizon/commit/58ad81674b383d4148daf31ed41a344fe9a4afee) version_port.py: detect, prepare and diff Minecraft releases - [`93bb113`](https://github.com/horizon-rust/horizon/commit/93bb113e0d24f5bd6d995d1838dbf4ffe99ac526) Diff vanilla classes method by method and map them to Horizon ### 📊 Changes **7 files changed** (+1738 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/README.md` (+1 -0) ➕ `docs/version-ports.md` (+278 -0) ➕ `tests/test_class_index.py` (+170 -0) ➕ `tests/test_version_port.py` (+144 -0) ➕ `tools/class_index.py` (+327 -0) ➕ `tools/vanilla_map.py` (+227 -0) ➕ `tools/version_port.py` (+591 -0) </details> ### 📄 Description Stacked on #323. Slice (b) of docs/version-ports.md. ## What - `tools/class_index.py`: indexes every `net/minecraft` and `com/mojang` class of a jar: superclass, interfaces, fields, and one hash per method. Before hashing, every constant-pool reference is replaced by what it names, branch and switch targets become instruction indices, `ldc_w`/`goto_w` count as `ldc`/`goto`, and lambdas fold into one `lambda$<method>` entry per declaring method. So recompiled-but-unchanged code hashes the same, and renumbered lambdas don't show up as changes. The class diff gives added/removed/changed classes (methods and fields added, removed and changed), plus moved classes (same local name, another package). - `tools/vanilla_map.py`: vanilla class → Horizon map, built from the repository in ~7 s: - Rust `//` comments that name a vanilla class (CamelCase names that resolve to exactly one class; one-word names only with `.member`), with the member when one is named; - Java oracles' imports (wildcards resolved against the names the file uses) and fully qualified names, linked to the harnesses whose scripts or recorded parity dependencies use them; - harness probes (examples/bins a harness names) and the modules they `use`. `vanilla_map.py INDEX net.minecraft.world.food.FoodData` prints the Rust files and harnesses. - `version_port.py prepare` now writes `classes.json`. `diff` adds a `classes` section, with each changed or removed class's Horizon files and harnesses (looked up under the old name), and writes `vanilla_map.json`. ## Proof: 26.2 → 26.3 on the Mac mini - Indexing: 2 s per version (11,383 classes, 91,424 methods for 26.3); the whole `diff` takes 6 s. - `classes: +786 -355, 194 moved, 2521 changed (13774 methods); 1258 of the changed or removed ones are ported or proved by Horizon` - No false positives in the spot checks: each sampled one-method change is a real bytecode change (`GLX.make` → `Util.make`, `RegistryCodecs.homogeneousList` → `registries.codec.RegistryCodecs.holderSet`, a logger call with the throwable, the "Memory (non-heap)" typo fix). - Map: 3,017 vanilla classes are named by Horizon code, 1,765 of them covered by a harness, and all 301 harnesses reach at least one class. `FoodData` → `hunger.rs`, `food_storage.rs`, `food_properties.rs`, `effects.rs`/`game.rs` (`eat`), harnesses `food`, `player_food`, `food_storage`… `LightEngine` → `light.rs` (`isEmptyShape`, `shapeOccludes`), harness `light`. ## How tested - `python3 -m unittest tests.test_class_index tests.test_version_port`: 21 tests. `test_class_index` assembles class files in the test (no game code). It checks that hashes ignore constant-pool layout and `ldc` width, that a changed literal or call target changes the hash, lambda folding, diff with moves, name resolution and tie-breaks, Rust comment scanning, Java imports (wildcard, static, qualified), and probe modules. - The full `tests/` suite: same 2 pre-existing errors as origin/main on the Mac mini. `tools/check_public_tree.py` passes. ## Needs Ludovic Nothing. 🤖 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-02 15:56:39 +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#2493
No description provided.