[PR #3602] [MERGED] Pack cache tests: wait for the filesystem clock's next tick after each build #5085

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

📋 Pull Request Information

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

Base: main ← Head: fix/pack-cache-test-mtime


📝 Commits (2)

  • 5410e79 Pack cache tests: rewrite files as an edit would, a clock tick later
  • ea01f56 Pack cache tests: wait for the clock's next tick after each build

📊 Changes

1 file changed (+22 additions, -0 deletions)

View changed files

📝 crates/horizon-client-render/src/packs/cache.rs (+22 -0)

📄 Description

🤖 Opened by GIGABAIT93's AI agent (Claude Code, Claude Opus 5.5), not by GIGABAIT93 directly.

What and why

packs::cache::tests::normalized_and_external_overlay_roots_keep_merged_bytes_current fails at random on Linux: under WSL2 it failed 3 runs in 5 on an unchanged main (assertion left == right on the output signatures, cache.rs:369), and directory_inputs_config_and_owned_output_recovery fails now and then the same way.

On Unix the overlay cache validates its dependencies by stamp (length, mtime, ctime, inode; stamp()), and Linux takes file times from a coarse clock, a few milliseconds a tick. The fixtures edit a source within the tick of the build before ({"p":1} → {"p":2}: same length, and the same mtime and ctime), so the marker still matches and the cached overlay keeps the old bytes. A person's edit never lands in the same few milliseconds as the game's build, so the cache is right for players; the tests just went faster than any editor.

Fixture::rebuild_matches now ends with next_tick(), which waits until a probe file's modification time moves (new bytes each time: NTFS keeps the time of a write that changes nothing), at most a second. Every edit a test makes after a build then gets a later stamp, whether it goes through Fixture::write, its own fs::write and set_times, or adds and removes files in a directory. The cache itself is unchanged.

If you would rather have the cache catch even sub-tick rewrites on Unix, the alternative is to hash the content of materialized (merged) files there as stamp() already does on other systems; that costs reading them on every hit, so I left it as a question rather than a change.

Checked under WSL2 (Ubuntu, ext4): the module's tests passed 30 runs in 30 after the change; on Windows they pass too.

Suggested label: skip-release (tests only).

Vanilla reference

None: tests.

Self-check

Run on Linux (WSL2).

pr_ready (tools/pr_ready.py --quick --base upstream/main on GIGABAIT, against upstream/main at 11494e17f, 1 min 12 s)

Check Result
Scope ✅ 1 files, +22 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 408 passed (27 s)
rustfmt ✅ (6 s)
clippy ✅ (27 s)
tests: horizon-client-render ✅ 499 passed (6 s)
doc tests ✅ 0 passed (5 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/3602 **Author:** [@GIGABAIT93](https://github.com/GIGABAIT93) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/pack-cache-test-mtime` --- ### 📝 Commits (2) - [`5410e79`](https://github.com/horizon-rust/horizon/commit/5410e798110cb5d6db6b8f87d2c0d172a6856b7d) Pack cache tests: rewrite files as an edit would, a clock tick later - [`ea01f56`](https://github.com/horizon-rust/horizon/commit/ea01f563b4506f0eaa277cce7cd0e3c51f6d2d93) Pack cache tests: wait for the clock's next tick after each build ### 📊 Changes **1 file changed** (+22 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/packs/cache.rs` (+22 -0) </details> ### 📄 Description > 🤖 Opened by GIGABAIT93's AI agent (Claude Code, Claude Opus 5.5), not by GIGABAIT93 directly. ## What and why `packs::cache::tests::normalized_and_external_overlay_roots_keep_merged_bytes_current` fails at random on Linux: under WSL2 it failed 3 runs in 5 on an unchanged main (`assertion left == right` on the output signatures, `cache.rs:369`), and `directory_inputs_config_and_owned_output_recovery` fails now and then the same way. On Unix the overlay cache validates its dependencies by stamp (length, mtime, ctime, inode; `stamp()`), and Linux takes file times from a coarse clock, a few milliseconds a tick. The fixtures edit a source within the tick of the build before (`{"p":1}` → `{"p":2}`: same length, and the same mtime and ctime), so the marker still matches and the cached overlay keeps the old bytes. A person's edit never lands in the same few milliseconds as the game's build, so the cache is right for players; the tests just went faster than any editor. `Fixture::rebuild_matches` now ends with `next_tick()`, which waits until a probe file's modification time moves (new bytes each time: NTFS keeps the time of a write that changes nothing), at most a second. Every edit a test makes after a build then gets a later stamp, whether it goes through `Fixture::write`, its own `fs::write` and `set_times`, or adds and removes files in a directory. The cache itself is unchanged. If you would rather have the cache catch even sub-tick rewrites on Unix, the alternative is to hash the content of materialized (merged) files there as `stamp()` already does on other systems; that costs reading them on every hit, so I left it as a question rather than a change. Checked under WSL2 (Ubuntu, ext4): the module's tests passed 30 runs in 30 after the change; on Windows they pass too. Suggested label: `skip-release` (tests only). ## Vanilla reference None: tests. ## Self-check Run on Linux (WSL2). **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on GIGABAIT, against upstream/main at 11494e17f, 1 min 12 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +22 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 408 passed (27 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (27 s) | | tests: horizon-client-render | ✅ 499 passed (6 s) | | doc tests | ✅ 0 passed (5 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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:10:08 +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#5085
No description provided.