[PR #2426] [CLOSED] Add an experimental retained tooltip API for modules #4304

Closed
opened 2026-11-03 04:16:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2426
Author: @evilchinesefood
Created: 10/26/2026
Status: ❌ Closed

Base: main ← Head: codex/retained-tooltip-api


📝 Commits (1)

  • e6f1dd2 Add experimental retained tooltip rules to the module SDK and runtime

📊 Changes

18 files changed (+726 additions, -13 deletions)

View changed files

📝 Cargo.lock (+7 -0)
📝 Cargo.toml (+1 -1)
📝 crates/horizon-mod-sdk/src/lib.rs (+2 -2)
📝 crates/horizon-mod-sdk/wit/horizon.wit (+31 -1)
📝 crates/horizon-mods/Cargo.toml (+4 -0)
📝 crates/horizon-mods/src/api_level.rs (+14 -2)
📝 crates/horizon-mods/src/lib.rs (+7 -0)
📝 crates/horizon-mods/src/manifest.rs (+34 -2)
📝 crates/horizon-mods/src/runtime.rs (+27 -0)
➕ crates/horizon-mods/src/tooltip.rs (+171 -0)
📝 crates/horizon-mods/tests/api_reference.rs (+3 -0)
📝 crates/horizon-mods/tests/sandbox.rs (+4 -3)
➕ crates/horizon-mods/tests/tooltip_guest/Cargo.toml (+15 -0)
➕ crates/horizon-mods/tests/tooltip_guest/src/lib.rs (+73 -0)
➕ crates/horizon-mods/tests/tooltip_sandbox.rs (+206 -0)
📝 docs/api/mods-reference.md (+58 -2)
➕ docs/api/tooltip.md (+63 -0)
📝 docs/mods.md (+6 -0)

📄 Description

🤖 Opened by David Ayers's AI agent (OpenAI Codex), not by David himself.

What and why

Standalone modules cannot currently register item tooltip contributions. Add an experimental client-only tooltip capability with atomic replace and clear operations. Modules register exact item or applied/stored enchantment selectors, translation keys and optional RGB colors. This is the SDK/runtime part; the native-rendering follow-up (#2428) makes the rules visible.

WASM init → capability check → atomic validation → indexed rules owned by its instance
disable/remove/reload/trap → instance dropped → rules removed

The contract reserves visibility, ordering, translation and output budgets to the native renderer. There is no WASM callback during hover and no hovered-stack data exposed to modules. Disabling, removing, reloading or stopping an instance drops its rules through the existing lifecycle.

Existing WIT worlds and their records remain unchanged. A new SDK world adds only the new import. Proposed API level 4 is provisional: rebase and renumber if another API lands first. Manifest API versions remain unchanged. This SDK/runtime change is independent of the visibility synchronization fix. The renderer follow-up needs this API and #2425 for correct integrated-server hiding.

Vanilla reference

Horizon-only mod API. Contributions follow the existing vanilla tooltip visibility and ordering implementation; the standalone demonstration module and its enchantment mappings are outside the engine repository.

Self-check

  • Real WASM tests cover registration, atomic rejection, quotas, capability denial, clearing, removal, reload, failed initialization, traps and multiple-module isolation.
  • A retained binary built with the pinned pre-change SDK loads alongside the new tooltip fixture. This compatibility test was explicitly run, not counted from an ignored test.
  • API reference generation and existing module sandbox tests pass. The native assembly tests and screenshots belong to the rendering follow-up.
  • Client and packager builds, formatting, public-tree check and focused Clippy pass. The combined stack passed the required quick gate (below).

Screenshots

A separate 67,674-byte .hmod, importing only horizon:mods/tooltip, passes package validation and sandbox initialization. With the rendering follow-up, 18 visual cases passed in each of integrated-server and in-frame mode. Screenshots were captured and reviewed locally and have not been uploaded; this SDK/runtime part alone does not render contributions.

This verifies the proposed API implementation. The module is not compatible with released stock Horizon until upstream ships the API; live UI toggles and a separate LAN client are outside this capture run.

Publication baseline

Prepared on upstream 72e678be8cc68700bc1853db058386fc5254650f. No relevant SDK/runtime/tooltip files changed from the original validation base. The original combined-stack gate below is retained with its exact base; it is not presented as a gate run on the rebased PR heads. Public-tree/history and patch-whitespace checks passed again before publication. On the rebased combined integration tree, 24 client tooltip tests and 5 module tooltip tests passed (two pre-existing client tests ignored).

Combined-stack gate

pr_ready (tools/pr_ready.py --quick --base 60109e0d911fa592b4669eeb3db10684f8b496cc on Davids-MacBook-Pro, against 60109e0d91 at 60109e0d9, 9 min 31 s)

Check Result
Scope ⚠️ 25 files, +1309 −16; 899 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (5 s)
clippy ✅ (1 min 7 s)
tests: workspace ✅ 2266 passed (6 min 0 s)
doc tests ✅ 2 passed (30 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (2 s)
launcher clippy ✅ (46 s)
launcher tests ✅ 137 passed (1 min 0 s)
Parity ➖ 345 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 333 more

The scope warning applies to the full stack. The wire, SDK/runtime and renderer were separated into review units. The renderer draft includes its API dependency until that PR merges; its renderer-only commit is independently reviewable. The 345 broader parity harnesses were not run locally. A subsequent documentation-generator whitespace fix and WIT comment correction passed all four API-reference tests.

Merge Danger

Door: Two-way while experimental. Reverting prevents new tooltip modules from loading; existing module contracts remain intact.

Blast Radius: Modules. The new capability is opt-in; existing ABI records and worlds remain unchanged.

🤖 Generated with OpenAI 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/2426 **Author:** [@evilchinesefood](https://github.com/evilchinesefood) **Created:** 10/26/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/retained-tooltip-api` --- ### 📝 Commits (1) - [`e6f1dd2`](https://github.com/horizon-rust/horizon/commit/e6f1dd2b8661f25300f0450f87266e0138ac4677) Add experimental retained tooltip rules to the module SDK and runtime ### 📊 Changes **18 files changed** (+726 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+7 -0) 📝 `Cargo.toml` (+1 -1) 📝 `crates/horizon-mod-sdk/src/lib.rs` (+2 -2) 📝 `crates/horizon-mod-sdk/wit/horizon.wit` (+31 -1) 📝 `crates/horizon-mods/Cargo.toml` (+4 -0) 📝 `crates/horizon-mods/src/api_level.rs` (+14 -2) 📝 `crates/horizon-mods/src/lib.rs` (+7 -0) 📝 `crates/horizon-mods/src/manifest.rs` (+34 -2) 📝 `crates/horizon-mods/src/runtime.rs` (+27 -0) ➕ `crates/horizon-mods/src/tooltip.rs` (+171 -0) 📝 `crates/horizon-mods/tests/api_reference.rs` (+3 -0) 📝 `crates/horizon-mods/tests/sandbox.rs` (+4 -3) ➕ `crates/horizon-mods/tests/tooltip_guest/Cargo.toml` (+15 -0) ➕ `crates/horizon-mods/tests/tooltip_guest/src/lib.rs` (+73 -0) ➕ `crates/horizon-mods/tests/tooltip_sandbox.rs` (+206 -0) 📝 `docs/api/mods-reference.md` (+58 -2) ➕ `docs/api/tooltip.md` (+63 -0) 📝 `docs/mods.md` (+6 -0) </details> ### 📄 Description > 🤖 Opened by David Ayers's AI agent (OpenAI Codex), not by David himself. ## What and why Standalone modules cannot currently register item tooltip contributions. Add an experimental client-only `tooltip` capability with atomic `replace` and `clear` operations. Modules register exact item or applied/stored enchantment selectors, translation keys and optional RGB colors. This is the SDK/runtime part; the native-rendering follow-up (#2428) makes the rules visible. ```text WASM init → capability check → atomic validation → indexed rules owned by its instance disable/remove/reload/trap → instance dropped → rules removed ``` The contract reserves visibility, ordering, translation and output budgets to the native renderer. There is no WASM callback during hover and no hovered-stack data exposed to modules. Disabling, removing, reloading or stopping an instance drops its rules through the existing lifecycle. Existing WIT worlds and their records remain unchanged. A new SDK world adds only the new import. Proposed API level 4 is provisional: rebase and renumber if another API lands first. Manifest API versions remain unchanged. This SDK/runtime change is independent of the visibility synchronization fix. The renderer follow-up needs this API and #2425 for correct integrated-server hiding. ## Vanilla reference Horizon-only mod API. Contributions follow the existing vanilla tooltip visibility and ordering implementation; the standalone demonstration module and its enchantment mappings are outside the engine repository. ## Self-check - Real WASM tests cover registration, atomic rejection, quotas, capability denial, clearing, removal, reload, failed initialization, traps and multiple-module isolation. - A retained binary built with the pinned pre-change SDK loads alongside the new tooltip fixture. This compatibility test was explicitly run, not counted from an ignored test. - API reference generation and existing module sandbox tests pass. The native assembly tests and screenshots belong to the rendering follow-up. - Client and packager builds, formatting, public-tree check and focused Clippy pass. The combined stack passed the required quick gate (below). ## Screenshots A separate 67,674-byte `.hmod`, importing only `horizon:mods/tooltip`, passes package validation and sandbox initialization. With the rendering follow-up, 18 visual cases passed in each of integrated-server and in-frame mode. Screenshots were captured and reviewed locally and have not been uploaded; this SDK/runtime part alone does not render contributions. This verifies the proposed API implementation. The module is not compatible with released stock Horizon until upstream ships the API; live UI toggles and a separate LAN client are outside this capture run. ## Publication baseline Prepared on upstream `72e678be8cc68700bc1853db058386fc5254650f`. No relevant SDK/runtime/tooltip files changed from the original validation base. The original combined-stack gate below is retained with its exact base; it is not presented as a gate run on the rebased PR heads. Public-tree/history and patch-whitespace checks passed again before publication. On the rebased combined integration tree, 24 client tooltip tests and 5 module tooltip tests passed (two pre-existing client tests ignored). ## Combined-stack gate **pr_ready** (`tools/pr_ready.py --quick --base 60109e0d911fa592b4669eeb3db10684f8b496cc` on Davids-MacBook-Pro, against 60109e0d911fa592b4669eeb3db10684f8b496cc at 60109e0d9, 9 min 31 s) | Check | Result | | --- | --- | | Scope | ⚠️ 25 files, +1309 −16; 899 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (5 s) | | clippy | ✅ (1 min 7 s) | | tests: workspace | ✅ 2266 passed (6 min 0 s) | | doc tests | ✅ 2 passed (30 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (2 s) | | launcher clippy | ✅ (46 s) | | launcher tests | ✅ 137 passed (1 min 0 s) | | Parity | ➖ 345 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 333 more | The scope warning applies to the full stack. The wire, SDK/runtime and renderer were separated into review units. The renderer draft includes its API dependency until that PR merges; its renderer-only commit is independently reviewable. The 345 broader parity harnesses were not run locally. A subsequent documentation-generator whitespace fix and WIT comment correction passed all four API-reference tests. ## Merge Danger **Door:** Two-way while experimental. Reverting prevents new tooltip modules from loading; existing module contracts remain intact. **Blast Radius:** Modules. The new capability is opt-in; existing ABI records and worlds remain unchanged. 🤖 Generated with [OpenAI 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 04:16:12 +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#4304
No description provided.