[PR #6571] [MERGED] Launcher: warn when mods inject at one place, or a HEAD can cancel on a hook point #6956

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

📋 Pull Request Information

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

Base: main ← Head: hooks-build-warnings


📝 Commits (3)

📊 Changes

2 files changed (+515 additions, -0 deletions)

View changed files

📝 docs/native-mods.md (+27 -0)
📝 launcher/src/native_mods.rs (+488 -0)

📄 Description

🤖 Opened by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally.

Fixes #6490. Part of #6452 (Build and safety), part of #4953.

What and why

The launcher reads every mod's [[injection]] list before it builds, but it said nothing when two mods inject at one place, or when a cancelling HEAD sits on a native hook point. Both orders are documented (priority, then mod id, then injection id), but nothing told the player or the author. horizon-mixins refuses only competing OVERWRITEs.

The build now says three things in native/build.log, before anything runs, so a build that fails later still shows them:

warning: mods beta, alpha both inject at hook `frame` HEAD; beta runs first (priority descending, mod id ascending).
warning: mods alpha (HEAD), beta (RETURN) inject into hook `tick`: HEAD runs on entry, RETURN on return, whatever their priorities.
warning: alpha's `stop` can cancel at hook `frame` HEAD: a Break skips the later injections and the function's body.

A place is the function, the kind, the selector and the ordinal as the manifest writes them: two same-place injections run in horizon-mixins' tie-break order (plan.rs sorts by file, node, call site, constant site, then priority descending, mod id ascending, injection id ascending), so only they get a "runs first". A mod's priority defaults to 0, as horizon-mixins defaults it (#[serde(default)] priority: i32), not to the README example's 100. The injections are read leniently: an entry without an id and a site is left out, horizon-mixins refuses it when it applies. A raw target is not matched against the catalog — whether it names a hook point's function only the source knows — so the cancellation warning names a hook, and only a HEAD: the interior kinds' cancellation skips less than the body. Neither warning stops the build.

Proven

A live build in an isolated HORIZON_LAUNCHER_HOME: two bundles (alpha at hook = "frame" HEAD, beta the same with [mod] priority = 200), native-build --trust-native-code --version nightly-2026-11-01-c9d474d. The warning is the first line of native/build.log, before the toolchain; the build finished in 5 min 58 s (368 crates). The order claim checked against what horizon-mixins generated: the staged native_frame calls beta_frame first, then alpha_frame — beta runs first, as the warning says.

Not proven

  • The HEAD+RETURN and the cancellation warnings were not exercised in a live log — both go through the same write as the one above; unit tests cover them.
  • The built game's window was not opened; the order is proven by the staged source.

Self-check

tools/pr_ready.py on DESKTOP-H7P5E7K against origin/main at f8bfa06b9, 2 min 3 s:

Check Result
Scope ✅ 2 files, +515 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 595 passed (1 min 33 s)
launcher rustfmt ✅ (1 s)
launcher clippy ✅ (11 s)
launcher tests ✅ 401 passed (13 s)

🤖 Generated with ZCode AI agent (GLM-5.3)


🔄 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/6571 **Author:** [@Qwerner88880](https://github.com/Qwerner88880) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `hooks-build-warnings` --- ### 📝 Commits (3) - [`fe1e0e5`](https://github.com/horizon-rust/horizon/commit/fe1e0e5004c66a38509e551921bb019c857d1d40) Launcher: warn when mods inject at one place, or a HEAD can cancel on a hook point - [`13db28f`](https://github.com/horizon-rust/horizon/commit/13db28f01834c41b2e1ed08c761a60dc3d483baf) Merge main into #6571 - [`d78433b`](https://github.com/horizon-rust/horizon/commit/d78433b0723c871c03bd969d2e1e135a977bcf8e) Merge main into #6571 ### 📊 Changes **2 files changed** (+515 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/native-mods.md` (+27 -0) 📝 `launcher/src/native_mods.rs` (+488 -0) </details> ### 📄 Description > 🤖 Opened by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally. Fixes #6490. Part of #6452 (Build and safety), part of #4953. ## What and why The launcher reads every mod's `[[injection]]` list before it builds, but it said nothing when two mods inject at one place, or when a cancelling `HEAD` sits on a native hook point. Both orders are documented (priority, then mod id, then injection id), but nothing told the player or the author. horizon-mixins refuses only competing `OVERWRITE`s. The build now says three things in `native/build.log`, before anything runs, so a build that fails later still shows them: ``` warning: mods beta, alpha both inject at hook `frame` HEAD; beta runs first (priority descending, mod id ascending). warning: mods alpha (HEAD), beta (RETURN) inject into hook `tick`: HEAD runs on entry, RETURN on return, whatever their priorities. warning: alpha's `stop` can cancel at hook `frame` HEAD: a Break skips the later injections and the function's body. ``` A place is the function, the kind, the selector and the ordinal as the manifest writes them: two same-place injections run in horizon-mixins' tie-break order (`plan.rs` sorts by file, node, call site, constant site, then priority descending, mod id ascending, injection id ascending), so only they get a "runs first". A mod's `priority` defaults to 0, as horizon-mixins defaults it (`#[serde(default)] priority: i32`), not to the README example's 100. The injections are read leniently: an entry without an id and a site is left out, horizon-mixins refuses it when it applies. A raw `target` is not matched against the catalog — whether it names a hook point's function only the source knows — so the cancellation warning names a `hook`, and only a `HEAD`: the interior kinds' cancellation skips less than the body. Neither warning stops the build. ## Proven A live build in an isolated `HORIZON_LAUNCHER_HOME`: two bundles (`alpha` at `hook = "frame"` `HEAD`, `beta` the same with `[mod] priority = 200`), `native-build --trust-native-code --version nightly-2026-11-01-c9d474d`. The warning is the first line of `native/build.log`, before the toolchain; the build finished in 5 min 58 s (368 crates). The order claim checked against what horizon-mixins generated: the staged `native_frame` calls `beta_frame` first, then `alpha_frame` — `beta` runs first, as the warning says. ## Not proven - The HEAD+RETURN and the cancellation warnings were not exercised in a live log — both go through the same write as the one above; unit tests cover them. - The built game's window was not opened; the order is proven by the staged source. ## Self-check `tools/pr_ready.py` on DESKTOP-H7P5E7K against `origin/main` at f8bfa06b9, 2 min 3 s: | Check | Result | | --- | --- | | Scope | ✅ 2 files, +515 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 595 passed (1 min 33 s) | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ (11 s) | | launcher tests | ✅ 401 passed (13 s) | 🤖 Generated with ZCode AI agent (GLM-5.3) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:30:06 +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#6956
No description provided.