[PR #2935] [CLOSED] Mods: 16 MiB / 256 files of storage, set per server in server.toml; where files go, no sockets #4691

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2935
Author: @ludovic111
Created: 10/27/2026
Status: ❌ Closed

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


📝 Commits (1)

  • d534c9a Mods: storage holds 16 MiB and 256 files, set per server in server.toml

📊 Changes

11 files changed (+227 additions, -28 deletions)

View changed files

📝 crates/horizon-client/src/game/mods.rs (+3 -1)
📝 crates/horizon-mods/src/runtime.rs (+98 -15)
📝 crates/horizon-mods/tests/sandbox.rs (+23 -8)
📝 crates/horizon-server/src/config.rs (+40 -0)
📝 crates/horizon-server/src/engine.rs (+9 -1)
📝 crates/horizon-server/src/settings.rs (+2 -0)
📝 crates/horizon-server/src/supervisor.rs (+1 -1)
📝 docs/api/mods.md (+1 -1)
📝 docs/api/server-reference.md (+9 -0)
📝 docs/hosting.md (+4 -0)
📝 docs/mods.md (+37 -1)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

First of four stacked PRs for brief mod-shaders-1 (mods: their own shaders, a bigger storage, no sockets). This one stands alone.

What

  • Storage quota: 16 MiB and 256 files for each mod (it was 4 MiB and 64 keys).
    • It lives in horizon_mods::StorageQuota { bytes, files }, which replaces the two consts.
    • The game reads it from HORIZON_MOD_STORAGE=<MiB>,<files> (1–1024 MiB, 1–65 536 files). With nothing set, it uses the default.
  • Server owners set it in server.toml:
    [mods]
    storage_mib = 16
    storage_files = 256
    
    • horizon-server checks the ranges and passes the value to the game it supervises through that environment variable.
    • It's an environment variable, not a CLI flag, so an older game binary still starts.
    • horizon-server config set mods.storage_mib=… checks the same ranges.
  • docs/mods.md:
    • "Where a mod's files go": a table that says assets and data ship in the .hmod (registries), and storage is only for what the mod writes while it runs.
    • "No sockets: what to use instead": net messages and typed events. It also gives the design of a read-only packets capability for server mods, marked as not built.
    • packets is added to the "planned" table.
  • Regenerated: docs/api/server-reference.md. Updated: docs/hosting.md and docs/api/mods.md.

Tests

  • runtime::tests::storage_quota_reads_mib_and_files: parses the values and refuses ones out of range.
  • In tests/sandbox.rs:
    • the quota test runs with a quota of 4 MiB set through StorageQuota::parse;
    • the key-count test now expects 256.
  • horizon-server's template_is_the_default now covers the [mods] section of the template.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at de24a16ef, 3 min 57 s)

Check Result
Scope ✅ 11 files, +227 −28
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 369 passed (45 s)
rustfmt ✅ (4 s)
clippy ✅ (9 s)
tests: horizon-client, horizon-mods, horizon-server ✅ 1425 passed (1 min 49 s)
doc tests ✅ 0 passed (2 s)
content root tests ✅ 5 passed (59 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (1 s)
launcher clippy ✅ (1 s)
launcher tests ✅ 197 passed (3 s)
Parity ➖ 31 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 19 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The full run (with harnesses) before this commit's rustfmt-only amend: Parity ✅ 33 passed (27 min). rustfmt was its only failure, which the amend fixes (above).

🤖 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/2935 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/27/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/mod-storage-quota` --- ### 📝 Commits (1) - [`d534c9a`](https://github.com/horizon-rust/horizon/commit/d534c9ab1dd6a0f9bc63d6feb36dfdd14c368be5) Mods: storage holds 16 MiB and 256 files, set per server in server.toml ### 📊 Changes **11 files changed** (+227 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/mods.rs` (+3 -1) 📝 `crates/horizon-mods/src/runtime.rs` (+98 -15) 📝 `crates/horizon-mods/tests/sandbox.rs` (+23 -8) 📝 `crates/horizon-server/src/config.rs` (+40 -0) 📝 `crates/horizon-server/src/engine.rs` (+9 -1) 📝 `crates/horizon-server/src/settings.rs` (+2 -0) 📝 `crates/horizon-server/src/supervisor.rs` (+1 -1) 📝 `docs/api/mods.md` (+1 -1) 📝 `docs/api/server-reference.md` (+9 -0) 📝 `docs/hosting.md` (+4 -0) 📝 `docs/mods.md` (+37 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. First of four stacked PRs for brief mod-shaders-1 (mods: their own shaders, a bigger storage, no sockets). This one stands alone. ## What - **Storage quota: 16 MiB and 256 files** for each mod (it was 4 MiB and 64 keys). - It lives in `horizon_mods::StorageQuota { bytes, files }`, which replaces the two consts. - The game reads it from `HORIZON_MOD_STORAGE=<MiB>,<files>` (1–1024 MiB, 1–65 536 files). With nothing set, it uses the default. - **Server owners set it in `server.toml`:** ```toml [mods] storage_mib = 16 storage_files = 256 ``` - `horizon-server` checks the ranges and passes the value to the game it supervises through that environment variable. - It's an environment variable, not a CLI flag, so an older game binary still starts. - `horizon-server config set mods.storage_mib=…` checks the same ranges. - **docs/mods.md:** - **"Where a mod's files go"**: a table that says assets and data ship in the `.hmod` (`registries`), and `storage` is only for what the mod writes while it runs. - **"No sockets: what to use instead"**: `net` messages and typed events. It also gives the design of a read-only `packets` capability for server mods, marked as not built. - `packets` is added to the "planned" table. - Regenerated: docs/api/server-reference.md. Updated: docs/hosting.md and docs/api/mods.md. ## Tests - `runtime::tests::storage_quota_reads_mib_and_files`: parses the values and refuses ones out of range. - In `tests/sandbox.rs`: - the quota test runs with a quota of 4 MiB set through `StorageQuota::parse`; - the key-count test now expects 256. - horizon-server's `template_is_the_default` now covers the `[mods]` section of the template. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at de24a16ef, 3 min 57 s) | Check | Result | | --- | --- | | Scope | ✅ 11 files, +227 −28 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 369 passed (45 s) | | rustfmt | ✅ (4 s) | | clippy | ✅ (9 s) | | tests: horizon-client, horizon-mods, horizon-server | ✅ 1425 passed (1 min 49 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ✅ 5 passed (59 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ (1 s) | | launcher tests | ✅ 197 passed (3 s) | | Parity | ➖ 31 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 19 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The full run (with harnesses) before this commit's rustfmt-only amend: Parity ✅ 33 passed (27 min). rustfmt was its only failure, which the amend fixes (above). 🤖 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-03 05:07:13 +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#4691
No description provided.