fix(mods): raise the size table entries of the files inside the packs mods serve #3172

Merged
HumanBean merged 2 commits from snaildev99/Longshot:mods/pack-member-sizes into main 2026-12-05 17:29:33 +00:00
Member

Summary

The game loads each file inside a pack (Pack/Actor/*.pack.zs and the like) as a resource of its own, with memory
sized by that file's own entry in the resource size table, and the game's entries leave little room to spare. The
size table step on main sizes the files mods serve, and a pack as a whole, but not the files inside a pack. So a mod
that grows a file inside a pack, and ships no size table (or one made for an older version of the mod), loads that file
with too little room for what the game builds from it, and the game sits at a loading screen for ever (Character
Select once hit this with the adult player's animation parameters).

With this change, at each start every pack a mod serves (and every pack the archive merge makes) is compared with the
game's copy, and the entry of each member that grew, or that the game's pack does not have, is raised before the
table is written: a grown member by the same rule as a loose file (with main's room for BYML lists), a new one by
estimate. A pack that does not decode keeps the game's entries and is named in the log, with which copy failed.

How to see it on main: a_grown_pack_member_is_raised_and_the_others_are_not (content's restbl tests) grows a
member from 152 to 304 bytes; on main its entry stays the game's 5352, here it is raised to 10720.

This is the Rust port of #942.

Read first: game/crates/content/src/restbl.rs (fit, raise_pack, raise_members), then layers.rs
(Builder::fit_sizes, the summary line).

Testing

Tested: Windows 11 Pro, RTX 3090, NVIDIA 610.88, in the game, built by longshot-builder play --profile with
this PR and the other mod compatibility ports merged, then the same profile on main. Two test mods made on this PC
from the game's own Pack/Actor/Land_LonLon_WheelTrack_A_05.pack.zs (kept local), each with a different file inside
the pack grown by 64 KiB, and no size table. At the start the log says:
resource size table: Actor/Land_LonLon_WheelTrack_A_05.engine__actor__ActorParam.bgyml in Pack/Actor/Land_LonLon_WheelTrack_A_05.pack.zs (merged): entry 6456 -> 534848,
the same for Component/ModelInfo/...ModelInfo.bgyml (5352 -> 2312928), and ... 2 for the members of 1 packs.
On main the summary line has no member entries and the two files keep the game's. The game then played in
Kakariko and Hyrule Field. A load that reads the grown files was not reached (the pack's actor is not in those
maps): that is the hand test below.
After the rebase onto main @ 3a0f7d8f7, the same profile again, built with this PR @ f0c6de6ac and the other
ports merged (929bf025a): the same two entries (6456 -> 534848, 5352 -> 2312928) and 2 for the members of 1 packs.
Game-free: the restbl tests below.

mise run test, run locally while CI's run waits for approval (Windows 11, tests/run_all.py --strict, 12 checks at
once), here @ f0c6de6ac and on main @ 3a0f7d8f7: 847 passed, 12 failed, 52 skipped here; 845 passed, 14 failed, 52
skipped on main. All 12 also fail on main: test_dlssg, test_fsr4_tune, test_lifter, test_no_game_title,
test_no_map_reload, test_present_acquire_ahead, test_present_geometry_trace, test_present_held_image,
test_present_image_free, test_sync_watch_event, test_turf_budget, test_ui_renderer.

Still to test:

  • Windows: a mod that grows a member of an actor pack and ships no size table (Character Select's adult animation
    parameters), played as adult Link through a load, expecting the area to load (by hand)
  • Windows: the size table step at the start with many served packs, against main (measurement, the review's L4)

Measurements

Verdict: Fixed in the size table: a grown file inside a served pack gets a larger entry, in the tests and at
the game's start, where main keeps the game's. The start's size table step takes about 2 ms more with one served
pack (median 30 ms against 28).

Setup: cargo test -p content on Windows 11, after the rebase onto main @ 3a0f7d8f7: the before side is the test
commit (b9e06c3ef), which is that main's code with the test, and the after side is this PR @ f0c6de6ac. Then the test profile above in the game, Windows 11 Pro, RTX 3090; the game's After column is the
build with the other mod compatibility ports merged (72d64e92f), which holds this PR's commits.

The two in-game rows were measured before the rebase, on main @ f577a1aea and this PR @ 4a279a16f; the summary
line is the same after it (Tested).

Before: main (cargo: the test commit @ b9e06c3ef) After: this PR @ f0c6de6ac (game: @ 4a279a16f)
cargo test -p content a_grown_pack_member_is_raised_and_the_others_are_not 1 failed (entry 5352, wants 10720) 1 passed
cargo test -p content restbl:: 16 passed, 9 failed (the pack members' tests) 25 passed
cargo test -p content (the test above fails) 269 passed
In the game: the size table's summary at the start 1 entries raised for mod files 1 entries raised for mod files, 2 for the members of 1 packs
In the game: the size table step at a start, one served pack (132 KB) 28, 28, 28, 34 ms (4 starts) 28, 30, 30, 30, 31 ms (5 starts)

Risks

  • Every start with mods decodes every pack a mod serves again, to compare its members: about 2 ms more with one
    132 KB pack. A profile that serves many large packs pays more; that isn't measured.
  • A served pack that decodes past 64 MiB is named as unreadable and its members keep the game's entries (the game's
    largest pack is about 24 MiB).
  • Hot reload still looks only at a pack's own entry, not its members'.
  • A served pack whose zstd frame records no content size isn't decoded: it is named as unreadable and its members keep
    the game's entries. A .zs member whose frame records none is taken as four times its bytes, as a loose .zs file
    is on main. The game's own decoders need that size too (host/hos_zstd.c's notes), so the game doesn't load
    such a frame either.
  • Players: a mod that grew a file in a pack stops hanging at a load. Raised entries are only ever larger. No save,
    setting or cache changes. A revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (run locally, Testing names them; CI's run waits for approval)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary The game loads each file inside a pack (`Pack/Actor/*.pack.zs` and the like) as a resource of its own, with memory sized by that file's own entry in the resource size table, and the game's entries leave little room to spare. The size table step on `main` sizes the files mods serve, and a pack as a whole, but not the files inside a pack. So a mod that grows a file inside a pack, and ships no size table (or one made for an older version of the mod), loads that file with too little room for what the game builds from it, and the game sits at a loading screen for ever (Character Select once hit this with the adult player's animation parameters). With this change, at each start every pack a mod serves (and every pack the archive merge makes) is compared with the game's copy, and the entry of each member that grew, or that the game's pack does not have, is raised before the table is written: a grown member by the same rule as a loose file (with `main`'s room for BYML lists), a new one by estimate. A pack that does not decode keeps the game's entries and is named in the log, with which copy failed. How to see it on `main`: `a_grown_pack_member_is_raised_and_the_others_are_not` (content's `restbl` tests) grows a member from 152 to 304 bytes; on `main` its entry stays the game's 5352, here it is raised to 10720. This is the Rust port of #942. Read first: `game/crates/content/src/restbl.rs` (`fit`, `raise_pack`, `raise_members`), then `layers.rs` (`Builder::fit_sizes`, the summary line). ## Testing **Tested:** Windows 11 Pro, RTX 3090, NVIDIA 610.88, in the game, built by `longshot-builder play --profile` with this PR and the other mod compatibility ports merged, then the same profile on `main`. Two test mods made on this PC from the game's own `Pack/Actor/Land_LonLon_WheelTrack_A_05.pack.zs` (kept local), each with a different file inside the pack grown by 64 KiB, and no size table. At the start the log says: `resource size table: Actor/Land_LonLon_WheelTrack_A_05.engine__actor__ActorParam.bgyml in Pack/Actor/Land_LonLon_WheelTrack_A_05.pack.zs (merged): entry 6456 -> 534848`, the same for `Component/ModelInfo/...ModelInfo.bgyml` (`5352 -> 2312928`), and `... 2 for the members of 1 packs`. On `main` the summary line has no member entries and the two files keep the game's. The game then played in Kakariko and Hyrule Field. A load that reads the grown files was not reached (the pack's actor is not in those maps): that is the hand test below. After the rebase onto `main` @ 3a0f7d8f7, the same profile again, built with this PR @ f0c6de6ac and the other ports merged (929bf025a): the same two entries (`6456 -> 534848`, `5352 -> 2312928`) and `2 for the members of 1 packs`. Game-free: the `restbl` tests below. `mise run test`, run locally while CI's run waits for approval (Windows 11, `tests/run_all.py --strict`, 12 checks at once), here @ f0c6de6ac and on `main` @ 3a0f7d8f7: 847 passed, 12 failed, 52 skipped here; 845 passed, 14 failed, 52 skipped on `main`. All 12 also fail on `main`: test_dlssg, test_fsr4_tune, test_lifter, test_no_game_title, test_no_map_reload, test_present_acquire_ahead, test_present_geometry_trace, test_present_held_image, test_present_image_free, test_sync_watch_event, test_turf_budget, test_ui_renderer. **Still to test:** - Windows: a mod that grows a member of an actor pack and ships no size table (Character Select's adult animation parameters), played as adult Link through a load, expecting the area to load (by hand) - Windows: the size table step at the start with many served packs, against `main` (measurement, the review's L4) ## Measurements **Verdict:** Fixed in the size table: a grown file inside a served pack gets a larger entry, in the tests and at the game's start, where `main` keeps the game's. The start's size table step takes about 2 ms more with one served pack (median 30 ms against 28). Setup: `cargo test -p content` on Windows 11, after the rebase onto `main` @ 3a0f7d8f7: the before side is the test commit (b9e06c3ef), which is that `main`'s code with the test, and the after side is this PR @ f0c6de6ac. Then the test profile above in the game, Windows 11 Pro, RTX 3090; the game's After column is the build with the other mod compatibility ports merged (72d64e92f), which holds this PR's commits. The two in-game rows were measured before the rebase, on `main` @ f577a1aea and this PR @ 4a279a16f; the summary line is the same after it (Tested). | | Before: `main` (cargo: the test commit @ b9e06c3ef) | After: this PR @ f0c6de6ac (game: @ 4a279a16f) | |---|---|---| | `cargo test -p content a_grown_pack_member_is_raised_and_the_others_are_not` | 1 failed (entry 5352, wants 10720) | 1 passed | | `cargo test -p content restbl::` | 16 passed, 9 failed (the pack members' tests) | 25 passed | | `cargo test -p content` | (the test above fails) | 269 passed | | In the game: the size table's summary at the start | `1 entries raised for mod files` | `1 entries raised for mod files`, `2 for the members of 1 packs` | | In the game: the size table step at a start, one served pack (132 KB) | 28, 28, 28, 34 ms (4 starts) | 28, 30, 30, 30, 31 ms (5 starts) | ## Risks - Every start with mods decodes every pack a mod serves again, to compare its members: about 2 ms more with one 132 KB pack. A profile that serves many large packs pays more; that isn't measured. - A served pack that decodes past 64 MiB is named as unreadable and its members keep the game's entries (the game's largest pack is about 24 MiB). - Hot reload still looks only at a pack's own entry, not its members'. - A served pack whose zstd frame records no content size isn't decoded: it is named as unreadable and its members keep the game's entries. A `.zs` member whose frame records none is taken as four times its bytes, as a loose `.zs` file is on `main`. The game's own decoders need that size too (`host/hos_zstd.c`'s notes), so the game doesn't load such a frame either. - Players: a mod that grew a file in a pack stops hanging at a load. Raised entries are only ever larger. No save, setting or cache changes. A revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). (run locally, Testing names them; CI's run waits for approval) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The game loads each file inside an actor pack as a resource of its own, sized by that file's own entry in the
resource size table. These checks serve packs whose members grew, are new, are .zs frames or BYML, or cannot be read,
and check the table fit_sizes writes. On main they fail: the fit sizes loose files only, so a grown member keeps the
game's entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(mods): raise the size table entries of the files inside the packs mods serve
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
4a279a16f4
The port of #942 to the Rust content crate.

The game loads each file inside an actor pack (Pack/Actor/x.pack.zs, a SARC archive) as a resource of its own, in a
heap sized by that file's own entry in the resource size table, and the game's entries fit to the byte. The fit sized
loose files only (restbl.rs said the packs are sized as a whole, which is not so for this game: nearly every member
has its own entry). A mod that grows a file inside a pack and ships no table, or a stale one, kept the game's entry:
the file loads, the heap runs out for what is parsed out of it, a loading thread fails on a null object and the game
waits at a loading screen for ever.

fit() now compares every pack the game is served from a mod (a layer's copy, or one made in the cache from member
files or several mods' copies) with the game's copy, member by member, through crate::sarc: a member that grew is
raised as a grown file is (BYML growth included), a member the game's copy lacks gets an estimate, the others are
left alone. A .zs member is sized by its frame's content size. A pack whose served or game copy cannot be read is
named in the log, which copy, and its members keep their entries. The summary line counts the members and packs
raised, and up to 16 lines name them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Tested in game: Windows 11 Pro, RTX 3090, NVIDIA 610.88: built by longshot-builder play --profile with this PR and the other mod compatibility ports merged, adult Link in Kakariko and Hyrule Field. Two local test mods (the same actor pack, each with a different file inside it grown by 64 KiB, no size table): the start's log raises both files' entries (entry 6456 -> 534848, 5352 -> 2312928; '2 for the members of 1 packs'); main's start keeps the game's. A load that reads the grown files is still to test (Testing).

Tested in game: Windows 11 Pro, RTX 3090, NVIDIA 610.88: built by longshot-builder play --profile with this PR and the other mod compatibility ports merged, adult Link in Kakariko and Hyrule Field. Two local test mods (the same actor pack, each with a different file inside it grown by 64 KiB, no size table): the start's log raises both files' entries (entry 6456 -> 534848, 5352 -> 2312928; '2 for the members of 1 packs'); main's start keeps the game's. A load that reads the grown files is still to test (Testing).
Member

Possibly related, for context:

  • issue #3128 Game: Crash entering Zora's Domain with Kaepora randomizer — Related Zora's Domain loading crash; undersized packed resource entry is a suspected cause
Possibly related, for context: - issue #3128 Game: Crash entering Zora's Domain with Kaepora randomizer — Related Zora's Domain loading crash; undersized packed resource entry is a suspected cause
Author
Member

mise run test, run locally while CI's run waits for approval (Windows 11, run_all --strict, 12 checks at once), here @ 4a279a16f and on main @ f577a1aea: 822 passed, 23 failed, 51 skipped here; 820 passed, 25 failed, 51 skipped on main. 19 of the 23 also fail on main (named in Testing); the other four timed out while games built beside the run and pass here alone (--exact). Box ticked.

mise run test, run locally while CI's run waits for approval (Windows 11, run_all --strict, 12 checks at once), here @ 4a279a16f and on main @ f577a1aea: 822 passed, 23 failed, 51 skipped here; 820 passed, 25 failed, 51 skipped on main. 19 of the 23 also fail on main (named in Testing); the other four timed out while games built beside the run and pass here alone (--exact). Box ticked.
snaildev99 changed title from WIP: fix(mods): raise the size table entries of the files inside the packs mods serve to fix(mods): raise the size table entries of the files inside the packs mods serve 2026-12-05 01:53:22 +00:00
BeanBot left a comment

Recommendation: Request changes. The fix skips valid packs whose zstd frames omit a content size, and can underestimate compressed members with the same kind of frame. Those cases can retain the loading hang this change is intended to fix.

The change compares mod-served packs with the game’s packs and raises resource size entries for grown or new members. It adds work at startup and leaves some valid compressed resources insufficiently sized.

Blocking (2): must change before merging.

  1. L1 game/crates/content/src/restbl.rs:535: A valid pack frame without a recorded content size is skipped entirely. (more on the line) Do: Decode frames with unknown content size using a bounded streaming decoder, then compare their members; add a test using a valid unknown-size frame.
  2. L2 game/crates/content/src/restbl.rs:457: Four times the compressed length is not a safe estimate of an unknown-size member’s decompressed length. (more on the line) Do: Determine the actual decompressed size with a bounded streaming decode, including the appropriate dictionary, and test a valid highly compressible frame without a content-size field.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3: The reported game run did not reach a load of a modified member. When: The synthetic test and startup log show a larger table entry, but do not show that the resulting allocation lets the affected resource load and play. Do: Load and play through the affected adult animation parameters with the mod and no size table, and record the result.
  • L4: Startup cost for a profile serving many packs is unknown. When: Each served pack now causes both its mod and game copies to be decoded and compared at every fitting start; the reported one-pack timing does not show the cost for a larger mod profile. Do: Measure interleaved starts against main with a representative profile containing many large packs, including the total startup and size-table step. (@fix does its part first: Cache member comparisons by the contents of the served and game packs so unchanged packs need not be decoded again at each start.)

@fix can do L1, L2 and L4.

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Unproven in the game: the game-free test reports the grown member’s entry increasing, and the Windows startup log reports two raised entries, but neither modified member was loaded during play. The reported size-table step was a median 30 ms after versus 28 ms before with one pack.

Other systems: The fitting code runs at startup on Windows and Linux, independently of GPU. Profiles with many or large packs incur additional decoding and comparison work; their startup cost has not been measured. Hot reload still does not refit pack members.

Switches: None.

Reviewed: 4a279a16f4 against f577a1aeab: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the diff, commit messages, restbl.rs and the changed tests; examined layers.rs, sarc.rs, the host zstd decoder and the applicable standards. Skimmed the changed documentation. docs/review-checklist.md is absent. No recorded runs or generated files were changed.; nothing run (a code review).

Checked and fine:

  • Both commits include AI assistance trailers.
  • The new archive fixtures are constructed in the tests and are described as made-up data.
  • The fake host’s test log is thread-local.
  • No switch, host API version or shader is changed.

Testing: No commands from the project or tests were run during review. The author reports 269 content tests passing and a Windows game startup; CI is still running.

Overlaps and merge order: Not checked; the network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as snaildev99 took it out of WIP. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The fix skips valid packs whose zstd frames omit a content size, and can underestimate compressed members with the same kind of frame. Those cases can retain the loading hang this change is intended to fix. The change compares mod-served packs with the game’s packs and raises resource size entries for grown or new members. It adds work at startup and leaves some valid compressed resources insufficiently sized. **Blocking (2)**: must change before merging. 1. **L1** `game/crates/content/src/restbl.rs:535`: A valid pack frame without a recorded content size is skipped entirely. (more on the line) **Do:** Decode frames with unknown content size using a bounded streaming decoder, then compare their members; add a test using a valid unknown-size frame. 2. **L2** `game/crates/content/src/restbl.rs:457`: Four times the compressed length is not a safe estimate of an unknown-size member’s decompressed length. (more on the line) **Do:** Determine the actual decompressed size with a bounded streaming decode, including the appropriate dictionary, and test a valid highly compressible frame without a content-size field. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3**: The reported game run did not reach a load of a modified member. *When:* The synthetic test and startup log show a larger table entry, but do not show that the resulting allocation lets the affected resource load and play. **Do:** Load and play through the affected adult animation parameters with the mod and no size table, and record the result. - **L4**: Startup cost for a profile serving many packs is unknown. *When:* Each served pack now causes both its mod and game copies to be decoded and compared at every fitting start; the reported one-pack timing does not show the cost for a larger mod profile. **Do:** Measure interleaved starts against main with a representative profile containing many large packs, including the total startup and size-table step. *(`@fix` does its part first: Cache member comparisons by the contents of the served and game packs so unchanged packs need not be decoded again at each start.)* `@fix` can do L1, L2 and L4. **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven in the game: the game-free test reports the grown member’s entry increasing, and the Windows startup log reports two raised entries, but neither modified member was loaded during play. The reported size-table step was a median 30 ms after versus 28 ms before with one pack. **Other systems:** The fitting code runs at startup on Windows and Linux, independently of GPU. Profiles with many or large packs incur additional decoding and comparison work; their startup cost has not been measured. Hot reload still does not refit pack members. **Switches:** None. **Reviewed:** 4a279a16f442 against f577a1aeabdb: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the diff, commit messages, restbl.rs and the changed tests; examined layers.rs, sarc.rs, the host zstd decoder and the applicable standards. Skimmed the changed documentation. docs/review-checklist.md is absent. No recorded runs or generated files were changed.; nothing run (a code review). **Checked and fine:** - Both commits include AI assistance trailers. - The new archive fixtures are constructed in the tests and are described as made-up data. - The fake host’s test log is thread-local. - No switch, host API version or shader is changed. **Testing:** No commands from the project or tests were run during review. The author reports 269 content tests passing and a Windows game startup; CI is still running. **Overlaps and merge order:** Not checked; the network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as snaildev99 took it out of WIP. Nothing was run; a maintainer decides.</sub>
@ -406,0 +454,4 @@
if len == 0 || at + len > p.len() {
return n.saturating_mul(4);
}
let mut v = 0u64;
Member

L2 (blocking): Four times the compressed length is not a safe estimate of an unknown-size member’s decompressed length.

When: A mod can grow a .zs member to a highly compressible payload while its frame omits the content size. Its compressed length can remain near or below the original member’s compressed length, so the comparison skips the grown resource or raises it far too little and its load can hang.

Do: Determine the actual decompressed size with a bounded streaming decode, including the appropriate dictionary, and test a valid highly compressible frame without a content-size field.

**L2** (blocking): Four times the compressed length is not a safe estimate of an unknown-size member’s decompressed length. *When:* A mod can grow a .zs member to a highly compressible payload while its frame omits the content size. Its compressed length can remain near or below the original member’s compressed length, so the comparison skips the grown resource or raises it far too little and its load can hang. **Do:** Determine the actual decompressed size with a bounded streaming decode, including the appropriate dictionary, and test a valid highly compressible frame without a content-size field.
@ -406,0 +532,4 @@
) -> Result<usize, Unread> {
let rel = entry.rel();
let Some(mod_arc) = host.host_zs(served) else { return Err(Unread::Served) };
let orig = if let Some((spelled, _)) = host.game_file(rel) {
Member

L1 (blocking): A valid pack frame without a recorded content size is skipped entirely.

When: When a mod compresses an actor pack without a content-size field and grows a member, host_zs returns None, so raise_pack leaves the member’s stock entry unchanged. Loading that member can still hang even though the game can consume the pack.

Do: Decode frames with unknown content size using a bounded streaming decoder, then compare their members; add a test using a valid unknown-size frame.

**L1** (blocking): A valid pack frame without a recorded content size is skipped entirely. *When:* When a mod compresses an actor pack without a content-size field and grows a member, host_zs returns None, so raise_pack leaves the member’s stock entry unchanged. Loading that member can still hang even though the game can consume the pack. **Do:** Decode frames with unknown content size using a bounded streaming decoder, then compare their members; add a test using a valid unknown-size frame.
snaildev99 force-pushed mods/pack-member-sizes from 4a279a16f4
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to f0c6de6ac5
Some checks failed
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Failing after 7s
2026-12-05 08:19:46 +00:00
Compare
Author
Member

Rebased onto main @ 3a0f7d8f7 for the base conflict; here @ f0c6de6ac. Tested (the game again on this head), mise run test (against main @ 3a0f7d8f7: every failure also fails on main) and Measurements are updated. Answers to the review below.

Rebased onto main @ 3a0f7d8f7 for the base conflict; here @ f0c6de6ac. Tested (the game again on this head), `mise run test` (against main @ 3a0f7d8f7: every failure also fails on main) and Measurements are updated. Answers to the review below.
Author
Member

L1 (a pack frame with no content size is skipped): not changed. The game doesn't load a .zs file whose frame
records no content size, so a pack like that has no member load to size. The game streams its .zs files through its
own zstd wrapper, and that wrapper fails such a frame at the start: host/hos_zstd.c does what the game's wrapper does
there (its notes, and the check at line 354). The frames the builder writes carry the size because the game sizes its
buffer by it (builder/crates/build-assets/src/zs.rs, with_content_size). The pack fails to load as a file. The fit
names it in the log as unreadable (the mod's copy), which tells the mod's author what is wrong. A bounded streaming
decode would also mean changing host/zs.c's decode, which every zstd read of the host goes through: the archive
merge, the mods' size tables, the prompts and the sounds. That is a change of its own. If a run in the game shows a
pack like that loading, this comes back.

L2 (four times the bytes for a .zs member with no content size): not changed, for the same reason. The game's
decoders need the frame's content size. The stream decode fails a frame without one, and the whole-buffer decode's
callers give exactly the content's size (host/hos_zstd.c's notes). So a member like that doesn't decode in the game,
whatever its entry. Four times the bytes is also main's rule for a loose .zs file: fit() takes every served
.zs file's size from host/zs.c's hos_zs_content_size, which does the same. Members follow that rule so the two
agree. Reading the real size needs the same change to host/zs.c as L1.

L3 (a load of the grown member in the game): still to test, by hand. Adult Link through a load with the mod and no
size table. It stays under Still to test until it has run.

L4 (startup cost with many packs): the measurement is still to run. The cache isn't made. main's fit keeps no
record between starts either, so the whole table is made again at each start. A cache for the members alone would mean
a new record in modcache/, keyed by each served pack's content hash and the game copy's version and path, holding the
member sizes, with tests for a miss, a hit and a damaged record. Each start would still read and hash every served
pack, so it would save only part of the 2 ms a 132 KB pack costs now (the two decodes and the archive walks). If the
measurement shows the cost matters, the fix is a cache of the whole fit by its inputs, in a pull request of its own.

**L1** (a pack frame with no content size is skipped): not changed. The game doesn't load a `.zs` file whose frame records no content size, so a pack like that has no member load to size. The game streams its `.zs` files through its own zstd wrapper, and that wrapper fails such a frame at the start: `host/hos_zstd.c` does what the game's wrapper does there (its notes, and the check at line 354). The frames the builder writes carry the size because the game sizes its buffer by it (`builder/crates/build-assets/src/zs.rs`, `with_content_size`). The pack fails to load as a file. The fit names it in the log as unreadable (the mod's copy), which tells the mod's author what is wrong. A bounded streaming decode would also mean changing `host/zs.c`'s `decode`, which every zstd read of the host goes through: the archive merge, the mods' size tables, the prompts and the sounds. That is a change of its own. If a run in the game shows a pack like that loading, this comes back. **L2** (four times the bytes for a `.zs` member with no content size): not changed, for the same reason. The game's decoders need the frame's content size. The stream decode fails a frame without one, and the whole-buffer decode's callers give exactly the content's size (`host/hos_zstd.c`'s notes). So a member like that doesn't decode in the game, whatever its entry. Four times the bytes is also `main`'s rule for a loose `.zs` file: `fit()` takes every served `.zs` file's size from `host/zs.c`'s `hos_zs_content_size`, which does the same. Members follow that rule so the two agree. Reading the real size needs the same change to `host/zs.c` as L1. **L3** (a load of the grown member in the game): still to test, by hand. Adult Link through a load with the mod and no size table. It stays under Still to test until it has run. **L4** (startup cost with many packs): the measurement is still to run. The cache isn't made. `main`'s fit keeps no record between starts either, so the whole table is made again at each start. A cache for the members alone would mean a new record in `modcache/`, keyed by each served pack's content hash and the game copy's version and path, holding the member sizes, with tests for a miss, a hit and a damaged record. Each start would still read and hash every served pack, so it would save only part of the 2 ms a 132 KB pack costs now (the two decodes and the archive walks). If the measurement shows the cost matters, the fix is a cache of the whole fit by its inputs, in a pull request of its own.
Author
Member

Still to test now lists the measurement the review asked for, which the answers above say is still to run.

Still to test now lists the measurement the review asked for, which the answers above say is still to run.
Owner
@review
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The tests show that grown pack members receive larger entries, but the reported game run did not load a modified member. Startup cost with many served packs also remains unmeasured. Recommend approval; not approved on the forge.

The change raises resource size table entries for grown or new members of packs served by mods, reducing the risk of a loading hang. It adds pack decoding and comparisons at startup.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3: The reported game run did not reach a load of a modified member. When: The synthetic test and startup log show a larger table entry, but do not show that the resulting allocation lets the affected resource load and play. Do: Load and play through the affected adult animation parameters with the mod and no size table, and record the result.
  • L4: Startup cost for a profile serving many packs is unknown. When: Each served pack now causes both its mod and game copies to be decoded and compared at every fitting start; the reported one-pack timing does not show the cost for a larger mod profile. Do: Measure interleaved starts against main with a representative profile containing many large packs, including the total startup and size-table step. (@fix does its part first: Cache member comparisons by the contents of the served and game packs so unchanged packs need not be decoded again at each start.)

@fix can do L4.

Since the last review (on 4a279a16f4)
Withdrawn (it was wrong): L1 (A valid pack frame without a recorded content size is skipped entirely.); L2 (Four times the compressed length is not a safe estimate of an unknown-size member’s decomp…)
Still open: L3 (The reported game run did not reach a load of a modified member.); L4 (Startup cost for a profile serving many packs is unknown.)

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Unproven in the game: the regression test reports the grown member rising from 5352 to 10720 and passing here after failing on main. The in-game log shows two entries raised, but neither modified member was loaded.

Other systems: The size fitting runs on Windows and Linux and includes merged packs. The reported game run is on Windows; the cost for profiles with many packs is unknown.

Switches: None.

Reviewed: f0c6de6ac5 against 3a0f7d8f7f: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the changed Rust files and tests, the documentation diff, and the relevant zstd decoder code and notes. The combined tool output truncated portions of the full-file reads; no review checklist or pull request template was found in the file search.; nothing run (a code review).

Checked and fine:

  • The game-free regression test is reported to fail on main and pass with the change.
  • Unreadable served and game pack copies are distinguished in the log.
  • The reported local check failures also occur on main.

Testing: No commands that build or run tests were executed. The author reports 269 content tests passing and an in-game startup check; CI is still running.

Overlaps and merge order: None found in the supplied information.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The tests show that grown pack members receive larger entries, but the reported game run did not load a modified member. Startup cost with many served packs also remains unmeasured. Recommend approval; not approved on the forge. The change raises resource size table entries for grown or new members of packs served by mods, reducing the risk of a loading hang. It adds pack decoding and comparisons at startup. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3**: The reported game run did not reach a load of a modified member. *When:* The synthetic test and startup log show a larger table entry, but do not show that the resulting allocation lets the affected resource load and play. **Do:** Load and play through the affected adult animation parameters with the mod and no size table, and record the result. - **L4**: Startup cost for a profile serving many packs is unknown. *When:* Each served pack now causes both its mod and game copies to be decoded and compared at every fitting start; the reported one-pack timing does not show the cost for a larger mod profile. **Do:** Measure interleaved starts against main with a representative profile containing many large packs, including the total startup and size-table step. *(`@fix` does its part first: Cache member comparisons by the contents of the served and game packs so unchanged packs need not be decoded again at each start.)* `@fix` can do L4. **Since the last review** (on 4a279a16f442) Withdrawn (it was wrong): L1 (A valid pack frame without a recorded content size is skipped entirely.); L2 (Four times the compressed length is not a safe estimate of an unknown-size member’s decomp…) Still open: L3 (The reported game run did not reach a load of a modified member.); L4 (Startup cost for a profile serving many packs is unknown.) **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven in the game: the regression test reports the grown member rising from 5352 to 10720 and passing here after failing on main. The in-game log shows two entries raised, but neither modified member was loaded. **Other systems:** The size fitting runs on Windows and Linux and includes merged packs. The reported game run is on Windows; the cost for profiles with many packs is unknown. **Switches:** None. **Reviewed:** f0c6de6ac5b5 against 3a0f7d8f7f34: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the changed Rust files and tests, the documentation diff, and the relevant zstd decoder code and notes. The combined tool output truncated portions of the full-file reads; no review checklist or pull request template was found in the file search.; nothing run (a code review). **Checked and fine:** - The game-free regression test is reported to fail on main and pass with the change. - Unreadable served and game pack copies are distinguished in the log. - The reported local check failures also occur on main. **Testing:** No commands that build or run tests were executed. The author reports 269 content tests passing and an in-game startup check; CI is still running. **Overlaps and merge order:** None found in the supplied information. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
HumanBean deleted branch mods/pack-member-sizes 2026-12-05 17:29:34 +00:00
Some checks failed
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Failing after 7s
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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
MagicBeanDev/Longshot!3172
No description provided.