[PR #1044] [MERGED] Mods: capability storage, a quota'd per-mod key/value folder #3012

Closed
opened 2026-11-02 16:00:49 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1044
Author: @Yvonne-Aizawa
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @ludovic111

Base: main ← Head: feat/mod-storage-capability


📝 Commits (2)

  • 8d55af7 Mods: capability storage, a quota'd per-mod key/value folder
  • c3f23d9 Mods: close three storage gaps Codex's review found

📊 Changes

7 files changed (+296 additions, -25 deletions)

View changed files

📝 crates/horizon-mod-sdk/src/lib.rs (+2 -2)
📝 crates/horizon-mod-sdk/wit/horizon.wit (+12 -0)
📝 crates/horizon-mods/src/manifest.rs (+14 -1)
📝 crates/horizon-mods/src/runtime.rs (+109 -10)
📝 crates/horizon-mods/tests/guest/src/lib.rs (+23 -4)
📝 crates/horizon-mods/tests/sandbox.rs (+125 -2)
📝 docs/mods.md (+11 -6)

📄 Description

What and why

Adds the storage capability from the planned-interfaces list in docs/mods.md: get/set/delete on a small per-mod key/value folder on disk (4 MiB quota per mod, keys restricted to [a-z0-9_.-]{1,64}, one path segment so a key can never leave the mod's own directory). Today a mod's state only lives in its Store and is lost on every reload or restart; this lets a mod persist its own settings, waypoints, etc.

Data lives at <horizon-mods>/.horizon-mod-data/<mod-id>/, sibling to the horizon-mods/ folder so find() never mistakes it for an installed mod. Keyed by the mod's own path and id rather than its Store, so it survives both a cargo-horizon-mod dev reload and a full game restart (manually verified with a small throwaway mod against this branch).

Closes #1040.

Vanilla reference

Horizon-only: mods have no vanilla equivalent.

Self-check

pr_ready: 7 files changed since origin/main; checks on local
  Public tree: pass
  rustfmt: pass
  clippy: fail — horizon-client/src/streaming.rs:634, clippy::boxed_local, pre-existing on main, unrelated to this diff
  tests: horizon-mod-sdk, horizon-mods, horizon-mods-test-guest: pass (21 passed)
  launcher rustfmt: pass
  launcher clippy: pass
  launcher tests: fail — backend::tests::a_replaced_binary_is_replaced_again_at_its_path, pre-existing/flaky on main, unrelated to this diff
  Parity: not run (--quick); nothing in this change affects a vanilla harness

The two failures are both in files this PR doesn't touch; reproduces the same way on main without this branch.

Screenshots

N/A — opt-in capability, no UI change. (Manually verified in-game with a throwaway mod using storage + hud: a note saved with /note <text> reappears on its own after fully quitting and relaunching the client.)

🤖 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/1044 **Author:** [@Yvonne-Aizawa](https://github.com/Yvonne-Aizawa) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/mod-storage-capability` --- ### 📝 Commits (2) - [`8d55af7`](https://github.com/horizon-rust/horizon/commit/8d55af7caeb3dec092610b27f730c8a51e5566a3) Mods: capability storage, a quota'd per-mod key/value folder - [`c3f23d9`](https://github.com/horizon-rust/horizon/commit/c3f23d94525a9e76e6ed89dcf6d4c03e1cb2d5a8) Mods: close three storage gaps Codex's review found ### 📊 Changes **7 files changed** (+296 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-mod-sdk/src/lib.rs` (+2 -2) 📝 `crates/horizon-mod-sdk/wit/horizon.wit` (+12 -0) 📝 `crates/horizon-mods/src/manifest.rs` (+14 -1) 📝 `crates/horizon-mods/src/runtime.rs` (+109 -10) 📝 `crates/horizon-mods/tests/guest/src/lib.rs` (+23 -4) 📝 `crates/horizon-mods/tests/sandbox.rs` (+125 -2) 📝 `docs/mods.md` (+11 -6) </details> ### 📄 Description ## What and why Adds the `storage` capability from the planned-interfaces list in `docs/mods.md`: `get`/`set`/`delete` on a small per-mod key/value folder on disk (4 MiB quota per mod, keys restricted to `[a-z0-9_.-]{1,64}`, one path segment so a key can never leave the mod's own directory). Today a mod's state only lives in its `Store` and is lost on every reload or restart; this lets a mod persist its own settings, waypoints, etc. Data lives at `<horizon-mods>/.horizon-mod-data/<mod-id>/`, sibling to the `horizon-mods/` folder so `find()` never mistakes it for an installed mod. Keyed by the mod's own path and id rather than its `Store`, so it survives both a `cargo-horizon-mod` dev reload and a full game restart (manually verified with a small throwaway mod against this branch). Closes #1040. ## Vanilla reference Horizon-only: mods have no vanilla equivalent. ## Self-check ``` pr_ready: 7 files changed since origin/main; checks on local Public tree: pass rustfmt: pass clippy: fail — horizon-client/src/streaming.rs:634, clippy::boxed_local, pre-existing on main, unrelated to this diff tests: horizon-mod-sdk, horizon-mods, horizon-mods-test-guest: pass (21 passed) launcher rustfmt: pass launcher clippy: pass launcher tests: fail — backend::tests::a_replaced_binary_is_replaced_again_at_its_path, pre-existing/flaky on main, unrelated to this diff Parity: not run (--quick); nothing in this change affects a vanilla harness ``` The two failures are both in files this PR doesn't touch; reproduces the same way on `main` without this branch. ## Screenshots N/A — opt-in capability, no UI change. (Manually verified in-game with a throwaway mod using `storage` + `hud`: a note saved with `/note <text>` reappears on its own after fully quitting and relaunching the client.) 🤖 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 16:00:49 +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#3012
No description provided.