[GH-ISSUE #7024] Native hook stamping fails on main (server_event and state_block fragments), and 89 hook markers match no fragment #3126

Closed
opened 2026-11-03 04:06:03 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @arismoko on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7024

Originally assigned to: @arismoko on GitHub.

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

Summary

Every pending hook fragment on main is left unstamped. The native hook stamp workflow (.github/workflows/native-hook-stamp.yml) has failed on every push to main that touched a fragment since 2026-11-01T21:37Z. Its last success was at 885f47a49a, the run that opened #6441. So no pending fragment gets an API number, and no stamp PR opens.

Fixing the hard errors won't be enough on its own: 89 hook markers would still be left unnumbered after a successful run.

What blocks it (main 2b6d855da0)

  1. tools/native-hook-fragments/server_event.json lists crates/horizon-client/src/game/native_server.rs under comments, but that file has no @API:server_event@ marker. The doc comment of native_server_event at native_server.rs:398-403 carries no marker, and git log -S'@API:server_event@' finds none in its history. stamp_native_hooks.py:90 raises missing @API:server_event@ in crates/horizon-client/src/game/native_server.rs. That is the error in the run on 6d91fa6 (09:26Z today).
  2. tools/native-hook-fragments/state_block.json lists crates/horizon-client/src/game/native_hooks.rs under comments. That file is SOURCE, which stamp_native_hooks.py:86 rejects as invalid comment path. With item 1 worked around locally, this is the next error. SOURCE is always stamped anyway, so the entry can simply go.

Markers that would stay unnumbered

stamp_native_hooks.py:58 builds the marker from the fragment's file name: @API:{path.stem}@. In 89 doc comments the marker matches no fragment file:

  • 79 are the @API:native_<hook>@ form, where the fragment is <hook>.json. For example, native_hooks.rs:3826 and mod_api/generated.rs:2459 carry @API:native_anvil_damaged@, but the fragment is anvil_damaged.json.
  • 6 more hook comments match no fragment name: player_flower_pot_manipulate, player_insert_lectern_book, player_item_frame_change, player_item_mend, player_lectern_page_change and player_take_lectern_book.
  • 4 more are in docs/native-mods.md: spawn_change, world_border_bounds_changed, world_border_center_changed and world_game_rule_change.

After a stamp, these would keep the literal marker in native_hooks.rs, in the generated mod_api trait docs that mods read, and in the docs page.

A few fragments are named native_<hook>.json, such as native_bucket_empty.json, and their markers do match. So both naming forms are in use.

Suggested fix

  • Drop the comments entry from state_block.json.
  • Either add the marker to native_server_event's doc comment or drop the comments entry from server_event.json.
  • Rename each listed marker to @API:<fragment file stem>@.
  • A check in xtask mod-api --check or in the stamper's --check mode, failing when a marker matches no pending fragment, would stop this from coming back. Open PRs with fragments currently follow the same pattern.

How this was found

Running python3 tools/stamp_native_hooks.py on a clean main checkout, plus a dry-run script that applies the stamper's own rules (comments paths, the marker per fragment stem) to every fragment and every @API:…@ marker in the stamped files. horizon-machine-sample wasn't used because no mod is involved: this is release tooling.

Originally created by @arismoko on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7024 Originally assigned to: @arismoko on GitHub. > 🤖 Filed by Aria's agent swarm, Dyna, not by Aria. ## Summary Every pending hook fragment on main is left unstamped. The `native hook stamp` workflow (`.github/workflows/native-hook-stamp.yml`) has failed on every push to main that touched a fragment since 2026-11-01T21:37Z. Its last success was at 885f47a49a, the run that opened #6441. So no pending fragment gets an API number, and no stamp PR opens. Fixing the hard errors won't be enough on its own: 89 hook markers would still be left unnumbered after a successful run. ## What blocks it (main 2b6d855da0) 1. **`tools/native-hook-fragments/server_event.json`** lists `crates/horizon-client/src/game/native_server.rs` under `comments`, but that file has no `@API:server_event@` marker. The doc comment of `native_server_event` at `native_server.rs:398-403` carries no marker, and `git log -S'@API:server_event@'` finds none in its history. `stamp_native_hooks.py:90` raises `missing @API:server_event@ in crates/horizon-client/src/game/native_server.rs`. That is the error in the run on 6d91fa6 (09:26Z today). 2. **`tools/native-hook-fragments/state_block.json`** lists `crates/horizon-client/src/game/native_hooks.rs` under `comments`. That file is `SOURCE`, which `stamp_native_hooks.py:86` rejects as `invalid comment path`. With item 1 worked around locally, this is the next error. `SOURCE` is always stamped anyway, so the entry can simply go. ## Markers that would stay unnumbered `stamp_native_hooks.py:58` builds the marker from the fragment's file name: `@API:{path.stem}@`. In 89 doc comments the marker matches no fragment file: - **79 are the `@API:native_<hook>@` form, where the fragment is `<hook>.json`.** For example, `native_hooks.rs:3826` and `mod_api/generated.rs:2459` carry `@API:native_anvil_damaged@`, but the fragment is `anvil_damaged.json`. - **6 more hook comments** match no fragment name: `player_flower_pot_manipulate`, `player_insert_lectern_book`, `player_item_frame_change`, `player_item_mend`, `player_lectern_page_change` and `player_take_lectern_book`. - **4 more are in `docs/native-mods.md`:** `spawn_change`, `world_border_bounds_changed`, `world_border_center_changed` and `world_game_rule_change`. After a stamp, these would keep the literal marker in `native_hooks.rs`, in the generated `mod_api` trait docs that mods read, and in the docs page. A few fragments are named `native_<hook>.json`, such as `native_bucket_empty.json`, and their markers do match. So both naming forms are in use. ## Suggested fix - Drop the `comments` entry from `state_block.json`. - Either add the marker to `native_server_event`'s doc comment or drop the `comments` entry from `server_event.json`. - Rename each listed marker to `@API:<fragment file stem>@`. - A check in `xtask mod-api --check` or in the stamper's `--check` mode, failing when a marker matches no pending fragment, would stop this from coming back. Open PRs with fragments currently follow the same pattern. ## How this was found Running `python3 tools/stamp_native_hooks.py` on a clean main checkout, plus a dry-run script that applies the stamper's own rules (`comments` paths, the marker per fragment stem) to every fragment and every `@API:…@` marker in the stamped files. horizon-machine-sample wasn't used because no mod is involved: this is release tooling.
Author
Owner

@arismoko commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

I'll take this. I traced it to the fragment data; the stamper itself is fine.

  1. server_event.json lists crates/horizon-client/src/game/native_server.rs under comments, but its @API:server_event@ marker is only in doc_summary. The fragment's comments entry goes.

  2. state_block.json lists crates/horizon-client/src/game/native_hooks.rs. The stamper always stamps that file, so it rejects it as a comment path. The entry goes.

  3. 88 markers name no fragment file. The stamper replaces @API:<fragment stem>@, but:

    • 79 markers read @API:native_X@ while the fragment is X.json (from #6801);
    • 9 read @API:X@ while the fragment is native_X.json: the flower pot, lectern, item frame, item mend, spawn change and world border hooks.

    Each marker is renamed to its fragment's stem. The mod API is regenerated rather than hand-edited.

A test in tests/ will fail when a marker matches no pending fragment, so this can't come back silently.

Ludovic, if you'd rather fix it in your own workflow, go ahead and I'll drop this.

<!-- gh-comment-id:6574570352 --> @arismoko commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim I'll take this. I traced it to the fragment data; the stamper itself is fine. 1. `server_event.json` lists `crates/horizon-client/src/game/native_server.rs` under `comments`, but its `@API:server_event@` marker is only in `doc_summary`. The fragment's `comments` entry goes. 2. `state_block.json` lists `crates/horizon-client/src/game/native_hooks.rs`. The stamper always stamps that file, so it rejects it as a comment path. The entry goes. 3. 88 markers name no fragment file. The stamper replaces `@API:<fragment stem>@`, but: - 79 markers read `@API:native_X@` while the fragment is `X.json` (from #6801); - 9 read `@API:X@` while the fragment is `native_X.json`: the flower pot, lectern, item frame, item mend, spawn change and world border hooks. Each marker is renamed to its fragment's stem. The mod API is regenerated rather than hand-edited. A test in `tests/` will fail when a marker matches no pending fragment, so this can't come back silently. Ludovic, if you'd rather fix it in your own workflow, go ahead and I'll drop this.
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#3126
No description provided.