Shaders: under Wine the v1 receipt import lists the cache folder once #3506

Open
Royalflamejlh wants to merge 1 commit from upstream-pr/3506 into main
Royalflamejlh commented 2026-11-30 03:58:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-11-30T03:58:00Z.


Edited 2026-12-02: head 11ceb6a2 after bmjask's reviews (see Tested).

Under Wine the launch pass's workers spent about 80 s before their first record listing the shader cache folder. When a worker's v2 receipt file is missing, Verified::open tries 529 v1 file names one by one, and under Wine an open of a name that is not there lists the whole folder; the translated cache keeps its files in that same folder. The import now takes the v1 names from one listing and reads only the ones that exist. Part of #3067.

What is in it

  • crates/xcl/src/shaders/warm_blobs.rs: legacy_names lists the folder once; Verified::open skips a v1 name that is not in it. One new test of the listing; the existing import test (workers_reuse_previous_slices_and_merge_concurrent_checkpoints) covers that a v1 receipt is still imported.

Tested

  • Windows, the whole suite at 11ceb6a2 (RTX 2070 SUPER 8 GB, cargo test --workspace -- --test-threads=4, debug, 1 run): 3,007 passed, 0 failed, 52 ignored.
  • Linux only: Wine 11.21 Staging, vkd3d-proton master 71cae091, RTX 4060 Ti 16 GB (driver 615.71.09), rustc 1.98.0, release build for x86_64-pc-windows-gnu, head 157fd72c on main f97120dc.
  • Head 11ceb6a2 (2026-12-02; 3824539f rebased onto main 078358a0, no change), after bmjask's two reviews: a listing that fails, even part way, falls back to opening the 529 names; listed names are compared in lower case, as the open matched them. cargo test --lib --release -- warm_blobs driver_cache shaders:: under Wine on the CPU only (lavapipe, no card): 119 passed, 1 failed (an_older_process_cannot_remove_a_replacement_blob, as on main), 14 SKIPPED (no device). Each change has a test that fails without it.
  • Head 6588e5a0 (2026-12-01): the listing is used only under Wine (under_wine()); Windows opens the 529 names as main does. cargo test --lib -- warm_blobs driver_cache shaders::: 109 passed, 1 failed (an_older_process_cannot_remove_a_replacement_blob, which fails on main under Wine too), 2 SKIPPED. The timings below are from the head before it and are unchanged under Wine by the gate.
  • cargo test -p xcl --lib --release -- warm_blobs: 4 passed, 0 failed.
  • The cost without it, 1 launch of a retail title on main f97120dc with other PRs merged (our Linux branch), 12 workers, 145,872 files in the cache folder: the pass reported 0 records checked from 156 s to about 236 s. In 10 s of that, about half of the workers' CPU samples (perf, 99 Hz) were in readdir64 and its callers, and in 6 s one worker opened the folder 78 times and read it through each time (16,970 getdents64 calls). After that phase readdir64 was 2 % of the samples.
  • Verified::open alone on that folder, for a device with no receipt, in one process (a temporary timing test, not in the PR; 3 runs each, a title running beside it): 10.08, 9.29 and 9.30 s on main 9335bc0d; 2.45, 0.57 and 0.66 s with this change.

Regression run
RTX 2070 SUPER 8 GB (driver 621.01), Ryzen 7 5700X3D, Windows 11 Pro 26200, release builds by scripts/smoke.ps1, the same retail title for 60 s each.

main:

xcl-smoke v1
commit: 078358a058f7ba5d16690dba8dc4e55d2c88ae0a
gpu: NVIDIA GeForce RTX 2070 SUPER
title: 5330474d
seconds: 60
exit: 0x0
frames shown: 1531 (PresentX 1531)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15557 MB

this PR's head:

xcl-smoke v1
commit: 11ceb6a269df196c5f44e0c2cefec07b0773b3ca
gpu: NVIDIA GeForce RTX 2070 SUPER
title: 5330474d
seconds: 60
exit: 0x0
frames shown: 1509 (PresentX 1509)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15407 MB

Not tested

  • The 80 s phase itself with this change: the next launch took a shorter path through the pass (history only, receipts already there), so it is not a comparison.
  • A listing on Windows: not measured. Windows does not take it (under_wine()) and opens the 529 names as main does.
  • AMD.

AI use

  • Claude Code. Claude Fable 5.2 found the cost (perf, strace), wrote the change and the test, ran the tests above and wrote this description. Claude Opus 5.5 added the Wine gate. Claude Opus 5.5 made the changes after bmjask's reviews and their tests.
<!-- greyfinch-sync:ivall/xcl:issue:5558708745 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-11-30T03:58:00Z. --- _Edited 2026-12-02: head `11ceb6a2` after bmjask's reviews (see **Tested**)._ Under Wine the launch pass's workers spent about 80 s before their first record listing the shader cache folder. When a worker's v2 receipt file is missing, `Verified::open` tries 529 v1 file names one by one, and under Wine an open of a name that is not there lists the whole folder; the translated cache keeps its files in that same folder. The import now takes the v1 names from one listing and reads only the ones that exist. Part of #3067. **What is in it** - `crates/xcl/src/shaders/warm_blobs.rs`: `legacy_names` lists the folder once; `Verified::open` skips a v1 name that is not in it. One new test of the listing; the existing import test (`workers_reuse_previous_slices_and_merge_concurrent_checkpoints`) covers that a v1 receipt is still imported. **Tested** - Windows, the whole suite at `11ceb6a2` (RTX 2070 SUPER 8 GB, `cargo test --workspace -- --test-threads=4`, debug, 1 run): 3,007 passed, 0 failed, 52 ignored. - Linux only: Wine 11.21 Staging, vkd3d-proton `master` `71cae091`, RTX 4060 Ti 16 GB (driver 615.71.09), rustc 1.98.0, release build for `x86_64-pc-windows-gnu`, head `157fd72c` on `main` `f97120dc`. - Head `11ceb6a2` (2026-12-02; `3824539f` rebased onto `main` `078358a0`, no change), after bmjask's two reviews: a listing that fails, even part way, falls back to opening the 529 names; listed names are compared in lower case, as the open matched them. `cargo test --lib --release -- warm_blobs driver_cache shaders::` under Wine on the CPU only (lavapipe, no card): 119 passed, 1 failed (`an_older_process_cannot_remove_a_replacement_blob`, as on `main`), 14 SKIPPED (no device). Each change has a test that fails without it. - Head `6588e5a0` (2026-12-01): the listing is used only under Wine (`under_wine()`); Windows opens the 529 names as `main` does. `cargo test --lib -- warm_blobs driver_cache shaders::`: 109 passed, 1 failed (`an_older_process_cannot_remove_a_replacement_blob`, which fails on `main` under Wine too), 2 SKIPPED. The timings below are from the head before it and are unchanged under Wine by the gate. - `cargo test -p xcl --lib --release -- warm_blobs`: 4 passed, 0 failed. - The cost without it, 1 launch of a retail title on `main` `f97120dc` with other PRs merged (our Linux branch), 12 workers, 145,872 files in the cache folder: the pass reported 0 records checked from 156 s to about 236 s. In 10 s of that, about half of the workers' CPU samples (`perf`, 99 Hz) were in `readdir64` and its callers, and in 6 s one worker opened the folder 78 times and read it through each time (16,970 `getdents64` calls). After that phase `readdir64` was 2 % of the samples. - `Verified::open` alone on that folder, for a device with no receipt, in one process (a temporary timing test, not in the PR; 3 runs each, a title running beside it): 10.08, 9.29 and 9.30 s on `main` `9335bc0d`; 2.45, 0.57 and 0.66 s with this change. **Regression run** RTX 2070 SUPER 8 GB (driver 621.01), Ryzen 7 5700X3D, Windows 11 Pro 26200, release builds by `scripts/smoke.ps1`, the same retail title for 60 s each. `main`: ``` xcl-smoke v1 commit: 078358a058f7ba5d16690dba8dc4e55d2c88ae0a gpu: NVIDIA GeForce RTX 2070 SUPER title: 5330474d seconds: 60 exit: 0x0 frames shown: 1531 (PresentX 1531) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15557 MB ``` this PR's head: ``` xcl-smoke v1 commit: 11ceb6a269df196c5f44e0c2cefec07b0773b3ca gpu: NVIDIA GeForce RTX 2070 SUPER title: 5330474d seconds: 60 exit: 0x0 frames shown: 1509 (PresentX 1509) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15407 MB ``` **Not tested** - The 80 s phase itself with this change: the next launch took a shorter path through the pass (history only, receipts already there), so it is not a comparison. - A listing on Windows: not measured. Windows does not take it (`under_wine()`) and opens the 529 names as `main` does. - AMD. **AI use** - Claude Code. Claude Fable 5.2 found the cost (`perf`, `strace`), wrote the change and the test, ran the tests above and wrote this description. Claude Opus 5.5 added the Wine gate. Claude Opus 5.5 made the changes after bmjask's reviews and their tests.
Foniass commented 2026-12-01 08:03:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:03:13Z.


Review (head 157fd72c, diff read, not a merge-check; draft with PR description red, so not built or run):

  • Not gated to Wine. legacy_names (warm_blobs.rs ~65) now lists the whole cache folder (145k entries in the PR's measurement) on Windows too, where an open without a v2 receipt used to make 529 cheap failed opens; it runs once per worker process. Gating it with crate::util::under_wine() as #3507 does, or measuring it on Windows, would settle it.
  • Still needed: smoke blocks and a Windows suite run.

Fine: a stale listing can't lose a receipt (nothing writes verified-compute-v1-* any more), the same 529 names are tried, the union of the key sets doesn't depend on order, the existing import test still covers the v1 import, and the new listing test filters correctly.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7304812642 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#issuecomment-7304812642). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:03:13Z. --- Review (head 157fd72c, diff read, not a merge-check; draft with `PR description` red, so not built or run): - **Not gated to Wine.** `legacy_names` (`warm_blobs.rs` ~65) now lists the whole cache folder (145k entries in the PR's measurement) on Windows too, where an open without a v2 receipt used to make 529 cheap failed opens; it runs once per worker process. Gating it with `crate::util::under_wine()` as #3507 does, or measuring it on Windows, would settle it. - Still needed: smoke blocks and a Windows suite run. Fine: a stale listing can't lose a receipt (nothing writes `verified-compute-v1-*` any more), the same 529 names are tried, the union of the key sets doesn't depend on order, the existing import test still covers the v1 import, and the new listing test filters correctly. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Royalflamejlh commented 2026-12-01 08:25:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-01T08:25:57Z.


Thanks, that is right: the listing ran on every platform and was only measured under Wine. It is now gated with under_wine() (head 6588e5a0): Windows opens the 529 names as main does, and the listing is used under Wine, where it measured 0.6 to 2.5 s against 9 to 10 s for the failed opens (3 runs each). The import test covers the listing path under Wine and main's path on the Windows CI. The title says "under Wine" now.

cargo test --lib -- warm_blobs driver_cache shaders::, RTX 4060 Ti under Wine: 109 passed, 1 failed (an_older_process_cannot_remove_a_replacement_blob, as on main under Wine), 2 SKIPPED. The Windows suite and the smoke pair are still owed.

AI use: Claude Code. Claude Opus 5.5 checked the point and wrote the change; Claude Fable 5.2 ran the tests on the card and wrote this reply.

<!-- greyfinch-sync:ivall/xcl:comment:7305308930 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#issuecomment-7305308930). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-12-01T08:25:57Z. --- Thanks, that is right: the listing ran on every platform and was only measured under Wine. It is now gated with `under_wine()` (head `6588e5a0`): Windows opens the 529 names as `main` does, and the listing is used under Wine, where it measured 0.6 to 2.5 s against 9 to 10 s for the failed opens (3 runs each). The import test covers the listing path under Wine and `main`'s path on the Windows CI. The title says "under Wine" now. `cargo test --lib -- warm_blobs driver_cache shaders::`, RTX 4060 Ti under Wine: 109 passed, 1 failed (`an_older_process_cannot_remove_a_replacement_blob`, as on `main` under Wine), 2 SKIPPED. The Windows suite and the smoke pair are still owed. **AI use:** Claude Code. Claude Opus 5.5 checked the point and wrote the change; Claude Fable 5.2 ran the tests on the card and wrote this reply.
Foniass commented 2026-12-01 08:36:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:36:43Z.


Re-review (head 6588e5a0, diff read, not a merge-check; draft, PR description red). Follow-up to my review of 157fd72c.

  • Not gated to Wine: fixed. legacy_names now runs only under under_wine(); on Windows the import opens the same 529 v1 names in the same order as main (warm_blobs.rs ~65-70).
  • Still missing: the xcl-smoke pair on this head and a Windows suite run.

Fine: the listing test, and the existing import test still covers reading the v1 receipt.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7305548349 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#issuecomment-7305548349). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:36:43Z. --- Re-review (head 6588e5a0, diff read, not a merge-check; draft, `PR description` red). Follow-up to my review of 157fd72c. - **Not gated to Wine: fixed.** `legacy_names` now runs only under `under_wine()`; on Windows the import opens the same 529 v1 names in the same order as main (`warm_blobs.rs` ~65-70). - Still missing: the xcl-smoke pair on this head and a Windows suite run. Fine: the listing test, and the existing import test still covers reading the v1 receipt. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Foniass commented 2026-12-01 10:05:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T10:05:12Z.


Triage (#1607) – head 6588e5a

No open or merged PR makes the same change. #3507 and #3556 are other Wine fixes for #3067 in different code (the driver blob cache lookups, and blob reuse in build_with_blob). This one only touches the v1 receipt import in warm_blobs.rs.
The new loop reads the same 529 names plus the unsliced one as main does, and skips the ones missing from one listing only under under_wine(). No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7307646774 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#issuecomment-7307646774). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T10:05:12Z. --- **Triage (#1607)** – head 6588e5a No open or merged PR makes the same change. #3507 and #3556 are other Wine fixes for #3067 in different code (the driver blob cache lookups, and blob reuse in `build_with_blob`). This one only touches the v1 receipt import in `warm_blobs.rs`. The new loop reads the same 529 names plus the unsliced one as main does, and skips the ones missing from one listing only under `under_wine()`. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
bmjask commented 2026-12-02 09:14:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T09:14:35Z.

Code review location: crates/xcl/src/shaders/warm_blobs.rs; line 48

@@ -42,6 +42,13 @@ fn legacy_path(dir: &Path, native: u64, slice: &str) -> PathBuf {
     dir.join(format!("verified-compute-v1-{key:016x}.bin"))
 }
 
+/// The v1 receipts in `dir`, from one listing: under Wine every open of a name that is not
+/// there lists the whole cache folder.
+fn legacy_names(dir: &Path) -> HashSet<std::ffi::OsString> {
+    let names = std::fs::read_dir(dir).into_iter().flatten().flatten().map(|entry| entry.file_name());

legacy_names swallows listing errors (into_iter().flatten().flatten()), so a failed or cut-short read_dir under Wine becomes an empty or partial set, and open then skips v1 receipts that are really there. If read_dir(dir) fails once (access denied, sharing violation) or FindNextFileW fails partway (std's ReadDir treats that as the end), every v1 name not in the set is skipped and nothing is imported. The worker's first flush then writes verified-compute-v2-{native}.bin without the v1 keys, read_keys succeeds from then on, the v1 import never runs again, and every blob those receipts covered is re-validated on the temporary device. Before, one failed open only lost that one file. Returning None (fall back to probing) on any listing error would avoid losing them.

<!-- greyfinch-sync:ivall/xcl:review-comment:4767198446 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#discussion_r4767198446). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T09:14:35Z. **Code review location:** `crates/xcl/src/shaders/warm_blobs.rs`; line 48 ~~~~diff @@ -42,6 +42,13 @@ fn legacy_path(dir: &Path, native: u64, slice: &str) -> PathBuf { dir.join(format!("verified-compute-v1-{key:016x}.bin")) } +/// The v1 receipts in `dir`, from one listing: under Wine every open of a name that is not +/// there lists the whole cache folder. +fn legacy_names(dir: &Path) -> HashSet<std::ffi::OsString> { + let names = std::fs::read_dir(dir).into_iter().flatten().flatten().map(|entry| entry.file_name()); ~~~~ --- `legacy_names` swallows listing errors (`into_iter().flatten().flatten()`), so a failed or cut-short `read_dir` under Wine becomes an empty or partial set, and `open` then skips v1 receipts that are really there. If `read_dir(dir)` fails once (access denied, sharing violation) or `FindNextFileW` fails partway (std's ReadDir treats that as the end), every v1 name not in the set is skipped and nothing is imported. The worker's first flush then writes `verified-compute-v2-{native}.bin` without the v1 keys, `read_keys` succeeds from then on, the v1 import never runs again, and every blob those receipts covered is re-validated on the temporary device. Before, one failed open only lost that one file. Returning None (fall back to probing) on any listing error would avoid losing them.
bmjask commented 2026-12-02 09:14:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T09:14:35Z.

Code review location: crates/xcl/src/shaders/warm_blobs.rs; line 68

@@ -55,13 +62,12 @@ impl Verified {
             entries.known = keys;
         } else {
             // v1 hashed the worker slice into the filename. Only import this native identity.
-            for count in 1..=32 {
-                for i in 0..count {
-                    let old = legacy_path(dir, native, &format!("{i}/{count}"));
-                    if let Some(keys) = read_keys(&old) { entries.known.extend(keys); }
-                }
+            let present = crate::util::under_wine().then(|| legacy_names(dir));
+            let slices = (1..=32).flat_map(|count| (0..count).map(move |i| format!("{i}/{count}"))).chain([String::new()]);
+            for old in slices.map(|slice| legacy_path(dir, native, &slice)) {
+                if present.as_ref().is_some_and(|present| !present.contains(old.file_name().unwrap())) { continue; }

Not certain about this one: the presence check is an exact, case-sensitive OsString match, but the Windows open it replaces matches names case-insensitively. A v1 receipt stored with different case, e.g. after a case-only rename (vfs_hooks.rs notes Wine keeps the old name then) or copied in by a tool that changes case, would have been opened by read_keys on the lower-case legacy_path but is now skipped, and its keys are lost for good once v2 is written. Comparing ASCII-lowercased names would match the old behaviour.

<!-- greyfinch-sync:ivall/xcl:review-comment:4767198458 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#discussion_r4767198458). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T09:14:35Z. **Code review location:** `crates/xcl/src/shaders/warm_blobs.rs`; line 68 ~~~~diff @@ -55,13 +62,12 @@ impl Verified { entries.known = keys; } else { // v1 hashed the worker slice into the filename. Only import this native identity. - for count in 1..=32 { - for i in 0..count { - let old = legacy_path(dir, native, &format!("{i}/{count}")); - if let Some(keys) = read_keys(&old) { entries.known.extend(keys); } - } + let present = crate::util::under_wine().then(|| legacy_names(dir)); + let slices = (1..=32).flat_map(|count| (0..count).map(move |i| format!("{i}/{count}"))).chain([String::new()]); + for old in slices.map(|slice| legacy_path(dir, native, &slice)) { + if present.as_ref().is_some_and(|present| !present.contains(old.file_name().unwrap())) { continue; } ~~~~ --- Not certain about this one: the presence check is an exact, case-sensitive OsString match, but the Windows open it replaces matches names case-insensitively. A v1 receipt stored with different case, e.g. after a case-only rename (vfs_hooks.rs notes Wine keeps the old name then) or copied in by a tool that changes case, would have been opened by `read_keys` on the lower-case `legacy_path` but is now skipped, and its keys are lost for good once v2 is written. Comparing ASCII-lowercased names would match the old behaviour.
bmjask commented 2026-12-02 09:14:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T09:14:35Z.

Review: COMMENTED


Review of 6588e5a0: 2 finding(s). 2 are inline.


These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.

<!-- greyfinch-sync:ivall/xcl:review:6147810653 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#pullrequestreview-6147810653). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T09:14:35Z. **Review:** COMMENTED --- Review of `6588e5a0`: 2 finding(s). 2 are inline. --- _These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it._
bmjask commented 2026-12-02 14:12:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:12:37Z.


@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.

<!-- greyfinch-sync:ivall/xcl:comment:7348167708 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#issuecomment-7348167708). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T14:12:37Z. --- @Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
Royalflamejlh commented 2026-12-02 20:39:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T20:39:16Z.

Code review location: crates/xcl/src/shaders/warm_blobs.rs; line 48

@@ -42,6 +42,13 @@ fn legacy_path(dir: &Path, native: u64, slice: &str) -> PathBuf {
     dir.join(format!("verified-compute-v1-{key:016x}.bin"))
 }
 
+/// The v1 receipts in `dir`, from one listing: under Wine every open of a name that is not
+/// there lists the whole cache folder.
+fn legacy_names(dir: &Path) -> HashSet<std::ffi::OsString> {
+    let names = std::fs::read_dir(dir).into_iter().flatten().flatten().map(|entry| entry.file_name());

Right. legacy_names now returns None when read_dir fails or any entry does, and then the import opens the 529 names as main does (warm_blobs.rs:47). A partial set is never used. The test now checks that a folder that cannot be listed gives None. Head af34f396.

<!-- greyfinch-sync:ivall/xcl:review-comment:4775707373 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#discussion_r4775707373). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-12-02T20:39:16Z. **Code review location:** `crates/xcl/src/shaders/warm_blobs.rs`; line 48 ~~~~diff @@ -42,6 +42,13 @@ fn legacy_path(dir: &Path, native: u64, slice: &str) -> PathBuf { dir.join(format!("verified-compute-v1-{key:016x}.bin")) } +/// The v1 receipts in `dir`, from one listing: under Wine every open of a name that is not +/// there lists the whole cache folder. +fn legacy_names(dir: &Path) -> HashSet<std::ffi::OsString> { + let names = std::fs::read_dir(dir).into_iter().flatten().flatten().map(|entry| entry.file_name()); ~~~~ --- Right. `legacy_names` now returns `None` when `read_dir` fails or any entry does, and then the import opens the 529 names as `main` does (`warm_blobs.rs:47`). A partial set is never used. The test now checks that a folder that cannot be listed gives `None`. Head `af34f396`.
Royalflamejlh commented 2026-12-02 20:39:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T20:39:18Z.

Code review location: crates/xcl/src/shaders/warm_blobs.rs; line 68

@@ -55,13 +62,12 @@ impl Verified {
             entries.known = keys;
         } else {
             // v1 hashed the worker slice into the filename. Only import this native identity.
-            for count in 1..=32 {
-                for i in 0..count {
-                    let old = legacy_path(dir, native, &format!("{i}/{count}"));
-                    if let Some(keys) = read_keys(&old) { entries.known.extend(keys); }
-                }
+            let present = crate::util::under_wine().then(|| legacy_names(dir));
+            let slices = (1..=32).flat_map(|count| (0..count).map(move |i| format!("{i}/{count}"))).chain([String::new()]);
+            for old in slices.map(|slice| legacy_path(dir, native, &slice)) {
+                if present.as_ref().is_some_and(|present| !present.contains(old.file_name().unwrap())) { continue; }

Not changed. The v1 names are XCL's own: one format string with lower-case hex makes them (legacy_path, warm_blobs.rs:40), and only older builds wrote them, with that string. Nothing renames them. The case-only rename note in vfs_hooks.rs (~774) is about renames inside the game folder. These receipts are in dxc::cache_dir() (%LOCALAPPDATA%\xcl\dxil), outside it.

<!-- greyfinch-sync:ivall/xcl:review-comment:4775707975 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#discussion_r4775707975). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-12-02T20:39:18Z. **Code review location:** `crates/xcl/src/shaders/warm_blobs.rs`; line 68 ~~~~diff @@ -55,13 +62,12 @@ impl Verified { entries.known = keys; } else { // v1 hashed the worker slice into the filename. Only import this native identity. - for count in 1..=32 { - for i in 0..count { - let old = legacy_path(dir, native, &format!("{i}/{count}")); - if let Some(keys) = read_keys(&old) { entries.known.extend(keys); } - } + let present = crate::util::under_wine().then(|| legacy_names(dir)); + let slices = (1..=32).flat_map(|count| (0..count).map(move |i| format!("{i}/{count}"))).chain([String::new()]); + for old in slices.map(|slice| legacy_path(dir, native, &slice)) { + if present.as_ref().is_some_and(|present| !present.contains(old.file_name().unwrap())) { continue; } ~~~~ --- Not changed. The v1 names are XCL's own: one format string with lower-case hex makes them (`legacy_path`, `warm_blobs.rs:40`), and only older builds wrote them, with that string. Nothing renames them. The case-only rename note in `vfs_hooks.rs` (~774) is about renames inside the game folder. These receipts are in `dxc::cache_dir()` (`%LOCALAPPDATA%\xcl\dxil`), outside it.
bmjask commented 2026-12-02 20:54:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:54:41Z.

Review: COMMENTED


Review of af34f396: 1 finding(s) (1 medium), most severe first.

  1. Medium crates/xcl/src/shaders/warm_blobs.rs:68: The new skip test is a case-sensitive HashSet<OsString> lookup, but the open it replaces was case-insensitive under Wine (and on Windows), so a v1 receipt whose name on disk differs only in case is now silently skipped. (inline)

These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.

<!-- greyfinch-sync:ivall/xcl:review:6158843606 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#pullrequestreview-6158843606). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T20:54:41Z. **Review:** COMMENTED --- Review of `af34f396`: 1 finding(s) (1 medium), most severe first. 1. **Medium** `crates/xcl/src/shaders/warm_blobs.rs:68`: The new skip test is a case-sensitive `HashSet<OsString>` lookup, but the open it replaces was case-insensitive under Wine (and on Windows), so a v1 receipt whose name on disk differs only in case is now silently skipped. (inline) --- _These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it._
bmjask commented 2026-12-02 20:54:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:54:42Z.

Code review location: crates/xcl/src/shaders/warm_blobs.rs; line 68

@@ -55,13 +62,12 @@ impl Verified {
             entries.known = keys;
         } else {
             // v1 hashed the worker slice into the filename. Only import this native identity.
-            for count in 1..=32 {
-                for i in 0..count {
-                    let old = legacy_path(dir, native, &format!("{i}/{count}"));
-                    if let Some(keys) = read_keys(&old) { entries.known.extend(keys); }
-                }
+            let present = crate::util::under_wine().then(|| legacy_names(dir)).flatten();
+            let slices = (1..=32).flat_map(|count| (0..count).map(move |i| format!("{i}/{count}"))).chain([String::new()]);
+            for old in slices.map(|slice| legacy_path(dir, native, &slice)) {
+                if present.as_ref().is_some_and(|present| !present.contains(old.file_name().unwrap())) { continue; }

Medium: The new skip test is a case-sensitive HashSet<OsString> lookup, but the open it replaces was case-insensitive under Wine (and on Windows), so a v1 receipt whose name on disk differs only in case is now silently skipped. If a receipt is stored as verified-compute-v1-00AB...BIN (copied by a tool, restored from backup, or on a casefold/ciopfs mount), read_keys used to open it and import its keys. Now present.contains misses and the loop continues. The device's receipts are dropped, every compute blob is verified again, and the v2 file is written without the legacy keys, so they're lost for good. Comparing lowercased names (or falling back to the open on a miss) would keep the old behaviour.

<!-- greyfinch-sync:ivall/xcl:review-comment:4775913206 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#discussion_r4775913206). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T20:54:42Z. **Code review location:** `crates/xcl/src/shaders/warm_blobs.rs`; line 68 ~~~~diff @@ -55,13 +62,12 @@ impl Verified { entries.known = keys; } else { // v1 hashed the worker slice into the filename. Only import this native identity. - for count in 1..=32 { - for i in 0..count { - let old = legacy_path(dir, native, &format!("{i}/{count}")); - if let Some(keys) = read_keys(&old) { entries.known.extend(keys); } - } + let present = crate::util::under_wine().then(|| legacy_names(dir)).flatten(); + let slices = (1..=32).flat_map(|count| (0..count).map(move |i| format!("{i}/{count}"))).chain([String::new()]); + for old in slices.map(|slice| legacy_path(dir, native, &slice)) { + if present.as_ref().is_some_and(|present| !present.contains(old.file_name().unwrap())) { continue; } ~~~~ --- **Medium**: The new skip test is a case-sensitive `HashSet<OsString>` lookup, but the open it replaces was case-insensitive under Wine (and on Windows), so a v1 receipt whose name on disk differs only in case is now silently skipped. If a receipt is stored as `verified-compute-v1-00AB...BIN` (copied by a tool, restored from backup, or on a casefold/ciopfs mount), `read_keys` used to open it and import its keys. Now `present.contains` misses and the loop `continue`s. The device's receipts are dropped, every compute blob is verified again, and the v2 file is written without the legacy keys, so they're lost for good. Comparing lowercased names (or falling back to the open on a miss) would keep the old behaviour.
Foniass commented 2026-12-02 21:07:59 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T21:07:59Z.


Follow-up review of af34f396, since 6588e5a (code reading only, not a merge-check; PR description red) · no new findings

In short: The PR makes the v1 receipt import under Wine list the cache folder once instead of opening 529 names that are mostly missing. This push makes a listing that fails, even part way, fall back to opening all the names: a partial listing would skip receipts that are there, and the first v2 save would then lose them. That is the right choice, and the test now checks a missing folder gives None. Nothing blocks it.

Checked and fine
  • Earlier finding fixed (in 6588e5a0, unchanged): the listing runs only under under_wine(). On Windows the import opens the same names in the same order as on main.
  • legacy_names (warm_blobs.rs ~65) returns None when read_dir fails or any entry fails (collect::<io::Result<Vec<_>>>). under_wine().then(..).flatten() then gives None, so every name is opened, as on main.
  • The test now expects None for a missing folder and Some of the one v1 name for a folder holding a v1 receipt, a v2 receipt and a blob.
  • The commit message explains the fallback.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7358836763 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#issuecomment-7358836763). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T21:07:59Z. --- **Follow-up review** of `af34f396`, since `6588e5a` (code reading only, not a merge-check; `PR description` red) · no new findings **In short:** The PR makes the v1 receipt import under Wine list the cache folder once instead of opening 529 names that are mostly missing. This push makes a listing that fails, even part way, fall back to opening all the names: a partial listing would skip receipts that are there, and the first v2 save would then lose them. That is the right choice, and the test now checks a missing folder gives `None`. Nothing blocks it. <details><summary>Checked and fine</summary> - Earlier finding fixed (in `6588e5a0`, unchanged): the listing runs only under `under_wine()`. On Windows the import opens the same names in the same order as on `main`. - `legacy_names` (`warm_blobs.rs` ~65) returns `None` when `read_dir` fails or any entry fails (`collect::<io::Result<Vec<_>>>`). `under_wine().then(..).flatten()` then gives `None`, so every name is opened, as on `main`. - The test now expects `None` for a missing folder and `Some` of the one v1 name for a folder holding a v1 receipt, a v2 receipt and a blob. - The commit message explains the fallback. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
Royalflamejlh commented 2026-12-02 21:22:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T21:22:33Z.

Code review location: crates/xcl/src/shaders/warm_blobs.rs; line 68

@@ -55,13 +62,12 @@ impl Verified {
             entries.known = keys;
         } else {
             // v1 hashed the worker slice into the filename. Only import this native identity.
-            for count in 1..=32 {
-                for i in 0..count {
-                    let old = legacy_path(dir, native, &format!("{i}/{count}"));
-                    if let Some(keys) = read_keys(&old) { entries.known.extend(keys); }
-                }
+            let present = crate::util::under_wine().then(|| legacy_names(dir)).flatten();
+            let slices = (1..=32).flat_map(|count| (0..count).map(move |i| format!("{i}/{count}"))).chain([String::new()]);
+            for old in slices.map(|slice| legacy_path(dir, native, &slice)) {
+                if present.as_ref().is_some_and(|present| !present.contains(old.file_name().unwrap())) { continue; }

Changed, so the open's match is kept: legacy_names now lower-cases each name it lists (to_ascii_lowercase), and the names it is compared with are lower-case already (legacy_path). The test now also writes one receipt under an upper-case name and finds it. Head 3824539f.

<!-- greyfinch-sync:ivall/xcl:review-comment:4776247905 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#discussion_r4776247905). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-12-02T21:22:33Z. **Code review location:** `crates/xcl/src/shaders/warm_blobs.rs`; line 68 ~~~~diff @@ -55,13 +62,12 @@ impl Verified { entries.known = keys; } else { // v1 hashed the worker slice into the filename. Only import this native identity. - for count in 1..=32 { - for i in 0..count { - let old = legacy_path(dir, native, &format!("{i}/{count}")); - if let Some(keys) = read_keys(&old) { entries.known.extend(keys); } - } + let present = crate::util::under_wine().then(|| legacy_names(dir)).flatten(); + let slices = (1..=32).flat_map(|count| (0..count).map(move |i| format!("{i}/{count}"))).chain([String::new()]); + for old in slices.map(|slice| legacy_path(dir, native, &slice)) { + if present.as_ref().is_some_and(|present| !present.contains(old.file_name().unwrap())) { continue; } ~~~~ --- Changed, so the open's match is kept: `legacy_names` now lower-cases each name it lists (`to_ascii_lowercase`), and the names it is compared with are lower-case already (`legacy_path`). The test now also writes one receipt under an upper-case name and finds it. Head `3824539f`.
Foniass commented 2026-12-02 21:24:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T21:24:30Z.


Follow-up review of 3824539f, since af34f396 (code reading only, not a merge-check; PR description red) · no new findings

In short: This push compares the listed v1 receipt names in lower case, as Wine's open matched them, so a receipt whose name was stored in another case is still imported. The test adds an upper-case receipt and checks it is found. Nothing blocks it.

Checked and fine
  • legacy_names (warm_blobs.rs ~47) lowercases each name before filtering. legacy_path makes only lower-case names (verified-compute-v1-{key:016x}.bin), so contains matches.
  • The fallback when the listing fails, from the last push, is unchanged.
  • The listing is still used only under under_wine(), so Windows opens the names as on main.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7359236457 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#issuecomment-7359236457). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T21:24:30Z. --- **Follow-up review** of `3824539f`, since `af34f396` (code reading only, not a merge-check; `PR description` red) · no new findings **In short:** This push compares the listed v1 receipt names in lower case, as Wine's open matched them, so a receipt whose name was stored in another case is still imported. The test adds an upper-case receipt and checks it is found. Nothing blocks it. <details><summary>Checked and fine</summary> - `legacy_names` (`warm_blobs.rs` ~47) lowercases each name before filtering. `legacy_path` makes only lower-case names (`verified-compute-v1-{key:016x}.bin`), so `contains` matches. - The fallback when the listing fails, from the last push, is unchanged. - The listing is still used only under `under_wine()`, so Windows opens the names as on `main`. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
Foniass commented 2026-12-02 22:40:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T22:40:32Z.


Follow-up review of 11ceb6a2, since 3824539f (code reading only, not a merge-check; PR description red) · no new findings

In short: This push only rebases onto main: git range-diff shows the commit identical to 3824539f. Nothing new, and nothing blocks it.

Checked and fine
  • No change since the last review, which found no problems.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7361010614 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3506#issuecomment-7361010614). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T22:40:32Z. --- **Follow-up review** of `11ceb6a2`, since `3824539f` (code reading only, not a merge-check; `PR description` red) · no new findings **In short:** This push only rebases onto `main`: `git range-diff` shows the commit identical to `3824539f`. Nothing new, and nothing blocks it. <details><summary>Checked and fine</summary> - No change since the last review, which found no problems. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3506:upstream-pr/3506'
git switch 'upstream-pr/3506'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3506'
git switch 'upstream-pr/3506'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3506'
git switch 'upstream-pr/3506'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3506'
git switch 'main'
git merge --squash 'upstream-pr/3506'
git switch 'main'
git merge --ff-only 'upstream-pr/3506'
git switch 'main'
git merge 'upstream-pr/3506'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
xcl-dev/xcl!3506
No description provided.