[PR #3438] [MERGED] Windows: link untouched directories into the pack overlay with junctions #4975

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3438
Author: @Joansitoh
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix/windows-overlay-junctions


📝 Commits (3)

  • 90014f6 Windows: link untouched directories into the pack overlay with junctions, not a file-by-file mirror
  • dc44f98 Packs overlay: quote mklink's paths, compile the junction only on Windows
  • 70a6aa4 Merge main into this branch after the render crate split (#3186)

📊 Changes

2 files changed (+63 additions, -7 deletions)

View changed files

📝 crates/horizon-client-render/src/packs.rs (+61 -6)
📝 crates/horizon-client-render/src/packs/cache.rs (+2 -1)

📄 Description

🤖 Opened by Joansitoh's AI agent (Claude Code), not by Joansitoh.

What and why

Turning a resource pack on, or joining a server that pushes one, takes minutes on Windows (#3385, #3234; also behind the long "preparing resources" in #3283).

Root cause: build_overlay_uncached cannot link a directory on Windows, so for every directory no pack touches it recursed and mirrored the whole prepared root (.local/horizon-client/26.3: 28 181 files) into .horizon-cache/resourcepacks/<hash>/, and the cache marker then read every one of those files back to validate them (cache::stamp hashes content on not(unix)). Unix symlinks the untouched directories and never visits them.

This links each untouched directory with a junction (mklink /J, no privileges needed, unlike a directory symlink), so the mirror only walks the directories a pack really changes. If mklink fails, it falls back to the old file-by-file mirror, so nothing loses the overlay (#1688). A pack with filters still mirrors, as on unix. VERSION in packs/cache.rs goes 4 → 5 so old markers are rebuilt.

Measured on Windows 11, release build, calling packs::build_overlay on the real prepared root (28 181 files) with a one-texture folder pack:

cold build cache hit files in the overlay
this branch 8.7 s 0.78 s 1 445

I did not measure main on this machine. Numbers on main from #3234 (same kind of root, Windows 11): 34 s cold, 4.5 s hit.

Refs, not Fixes: #3385 also reports skins disappearing after the load and a black screen on relaunch; this does not touch those. It also leaves the files of the directories a pack does touch to be copied, which #3286 turns into hardlinks; the two changes do not overlap in code.

Vanilla reference

None: this is how the overlay is built on Windows, not vanilla behaviour. Vanilla reads packs as a stack and never materializes a copy of its resources.

Self-check

tools/pr_ready.py --base origin/main --quick, on Windows 11:

Check Result
Scope ✅ 2 files, +46 −6
Cargo.lock ✅ unchanged
Public tree ✅
rustfmt ✅
Python tests ❌ 1 failure, test_port_publish: UnicodeEncodeError ('charmap' cannot encode →) on Windows; not in files this PR touches
clippy ❌ horizon-world/src/worldgen/aquifer/noise_based.rs:450 manual !RangeInclusive::contains; not in files this PR touches
tests: horizon-client ❌ the run exited with STATUS_HEAP_CORRUPTION (0xc0000374); not investigated, so I do not know whether main does it too
doc tests ✅

cargo test -p horizon-client --lib packs:: → 21 passed, 1 ignored. The existing overlay_layers_packs_over_vanilla now also reads a file from an untouched directory, which goes through the junction on Windows.

The game starts on this branch. The BungeeCord server-pack join itself has not been run by the agent; the person who reproduced it will test it.

Screenshots

None: players see no UI change, only a shorter wait.

🤖 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/3438 **Author:** [@Joansitoh](https://github.com/Joansitoh) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/windows-overlay-junctions` --- ### 📝 Commits (3) - [`90014f6`](https://github.com/horizon-rust/horizon/commit/90014f63d287b46efd96bd12ae3212ad46f15cca) Windows: link untouched directories into the pack overlay with junctions, not a file-by-file mirror - [`dc44f98`](https://github.com/horizon-rust/horizon/commit/dc44f9881816131d8cb345064d1dd5db08b09685) Packs overlay: quote mklink's paths, compile the junction only on Windows - [`70a6aa4`](https://github.com/horizon-rust/horizon/commit/70a6aa45aa9927faa0178a17003ba3d3b44b0fa2) Merge main into this branch after the render crate split (#3186) ### 📊 Changes **2 files changed** (+63 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/packs.rs` (+61 -6) 📝 `crates/horizon-client-render/src/packs/cache.rs` (+2 -1) </details> ### 📄 Description > 🤖 Opened by Joansitoh's AI agent (Claude Code), not by Joansitoh. ## What and why Turning a resource pack on, or joining a server that pushes one, takes minutes on Windows (#3385, #3234; also behind the long "preparing resources" in #3283). Root cause: `build_overlay_uncached` cannot link a directory on Windows, so for every directory no pack touches it recursed and mirrored the whole prepared root (`.local/horizon-client/26.3`: 28 181 files) into `.horizon-cache/resourcepacks/<hash>/`, and the cache marker then read every one of those files back to validate them (`cache::stamp` hashes content on `not(unix)`). Unix symlinks the untouched directories and never visits them. This links each untouched directory with a junction (`mklink /J`, no privileges needed, unlike a directory symlink), so the mirror only walks the directories a pack really changes. If `mklink` fails, it falls back to the old file-by-file mirror, so nothing loses the overlay (#1688). A pack with filters still mirrors, as on unix. `VERSION` in `packs/cache.rs` goes 4 → 5 so old markers are rebuilt. Measured on Windows 11, release build, calling `packs::build_overlay` on the real prepared root (28 181 files) with a one-texture folder pack: | | cold build | cache hit | files in the overlay | | --- | --- | --- | --- | | this branch | 8.7 s | 0.78 s | 1 445 | I did not measure `main` on this machine. Numbers on `main` from #3234 (same kind of root, Windows 11): 34 s cold, 4.5 s hit. Refs, not Fixes: #3385 also reports skins disappearing after the load and a black screen on relaunch; this does not touch those. It also leaves the files of the directories a pack does touch to be copied, which #3286 turns into hardlinks; the two changes do not overlap in code. ## Vanilla reference None: this is how the overlay is built on Windows, not vanilla behaviour. Vanilla reads packs as a stack and never materializes a copy of its resources. ## Self-check `tools/pr_ready.py --base origin/main --quick`, on Windows 11: | Check | Result | | --- | --- | | Scope | ✅ 2 files, +46 −6 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | rustfmt | ✅ | | Python tests | ❌ 1 failure, `test_port_publish`: `UnicodeEncodeError` ('charmap' cannot encode `→`) on Windows; not in files this PR touches | | clippy | ❌ `horizon-world/src/worldgen/aquifer/noise_based.rs:450` `manual !RangeInclusive::contains`; not in files this PR touches | | tests: horizon-client | ❌ the run exited with `STATUS_HEAP_CORRUPTION` (0xc0000374); not investigated, so I do not know whether `main` does it too | | doc tests | ✅ | `cargo test -p horizon-client --lib packs::` → 21 passed, 1 ignored. The existing `overlay_layers_packs_over_vanilla` now also reads a file from an untouched directory, which goes through the junction on Windows. The game starts on this branch. The BungeeCord server-pack join itself has not been run by the agent; the person who reproduced it will test it. ## Screenshots None: players see no UI change, only a shorter wait. 🤖 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:09:19 +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#4975
No description provided.