Pipeline: an entry published by another writer during conversion is used (fixes #890) #1070

Closed
acleofe wants to merge 1 commit from upstream-pr/1070 into main
acleofe commented 2026-11-24 15:27:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by acleofe on 2026-11-24T15:27:56Z.


What

When Cache::get_or_convert cannot rename its staged output into place but the entry exists by then, it returns the entry instead of the rename error. The staging file is still removed, and a failure with no entry there is still an error.

Why

Two converters of the same key can race: the loser's rename replaces the winner's file, which on Windows fails with access denied while anything holds that file open without delete sharing (antivirus, another process, a mapping). The entry is content-addressed by converter id, version and input, so the winner's output is the loser's; the conversion succeeded and the result is there.

Test

  • an_entry_published_meanwhile_is_used (Windows): a converter publishes its own key's entry while converting and holds it open with read sharing only. Before this change get_or_convert failed with Access is denied. (os error 5); now it returns the entry, its content is right and no staging file is left.
  • failed_publication_removes_the_staging_file still fails as before (a directory at the entry's path is not an entry).
  • cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings and cargo test --workspace --locked pass.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6585311018 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1070). Originally posted by [acleofe](https://github.com/acleofe) on 2026-11-24T15:27:56Z. --- ## What When `Cache::get_or_convert` cannot rename its staged output into place but the entry exists by then, it returns the entry instead of the rename error. The staging file is still removed, and a failure with no entry there is still an error. ## Why Two converters of the same key can race: the loser's `rename` replaces the winner's file, which on Windows fails with access denied while anything holds that file open without delete sharing (antivirus, another process, a mapping). The entry is content-addressed by converter id, version and input, so the winner's output is the loser's; the conversion succeeded and the result is there. ## Test - `an_entry_published_meanwhile_is_used` (Windows): a converter publishes its own key's entry while converting and holds it open with read sharing only. Before this change `get_or_convert` failed with `Access is denied. (os error 5)`; now it returns the entry, its content is right and no staging file is left. - `failed_publication_removes_the_staging_file` still fails as before (a directory at the entry's path is not an entry). - `cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings` and `cargo test --workspace --locked` pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DenRakEiw commented 2026-11-24 16:04:40 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T15:32:45Z.

Review: APPROVED


Tested head 5229ab8 (fast-forward on main ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC):

  • cargo test -p victory-pipeline: 5 passed, 0 failed (including cache::tests::an_entry_published_meanwhile_is_used)
  • cargo clippy -p victory-pipeline --all-targets: 0 warnings
  • cargo xtask policy: ok

Clean Windows concurrent-publication fix for Cache::get_or_convert (fixes #890). Approving.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6042293060 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1070#pullrequestreview-6042293060). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-24T15:32:45Z. **Review:** APPROVED --- Tested head `5229ab8` (fast-forward on `main` `ffe310e`) on Windows 11 x64 (Rust 1.98.1 MSVC): - `cargo test -p victory-pipeline`: **5 passed, 0 failed** (including `cache::tests::an_entry_published_meanwhile_is_used`) - `cargo clippy -p victory-pipeline --all-targets`: **0 warnings** - `cargo xtask policy`: ok Clean Windows concurrent-publication fix for `Cache::get_or_convert` (fixes #890). Approving. AI-assisted (Gemini 4 Neon).
catminou4 commented 2026-11-24 16:04:40 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T15:37:31Z.

Review: APPROVED


Losing a publication race to an identical entry is now a hit instead of an error — the reasoning holds because the cache key covers converter id + version + input, so a concurrently published entry for the same key is byte-identical output. The staging temp file is still removed on failure, and path.is_file() only accepts an already-complete entry (the writer publishes by rename, so a partial file can't be observed). The #[cfg(windows)] racer test reproduces the exact Windows condition (reader holding the entry without delete sharing) and also asserts no staging file leaks.

Verified locally: test-merge with main clean; cargo test -p victory-pipeline --locked (macOS arm64, rustc 1.98.1) → 4 passed / 0 failed. Scope note: the new race test itself is Windows-only (it needs share_mode), so macOS covers compilation and the existing cache tests; the fix is platform-independent logic. Approving.

<!-- greyfinch-sync:Marvisak/VIctory:review:6042383888 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1070#pullrequestreview-6042383888). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T15:37:31Z. **Review:** APPROVED --- Losing a publication race to an identical entry is now a hit instead of an error — the reasoning holds because the cache key covers converter id + version + input, so a concurrently published entry for the same key is byte-identical output. The staging temp file is still removed on failure, and `path.is_file()` only accepts an already-complete entry (the writer publishes by rename, so a partial file can't be observed). The `#[cfg(windows)]` racer test reproduces the exact Windows condition (reader holding the entry without delete sharing) and also asserts no staging file leaks. Verified locally: test-merge with main clean; `cargo test -p victory-pipeline --locked` (macOS arm64, rustc 1.98.1) → **4 passed / 0 failed**. Scope note: the new race test itself is Windows-only (it needs `share_mode`), so macOS covers compilation and the existing cache tests; the fix is platform-independent logic. Approving.
ThomasHFWright commented 2026-11-24 16:05:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ThomasHFWright on 2026-11-24T15:52:51Z.


Independent Linux/Wine validation of 5229ab872aebabd90449d8a901eddf48cd6f68b4 on base ffe310e: The new cache::tests::an_entry_published_meanwhile_is_used passes under Wine, including reading the winner's content and checking that no staging file is left. The existing failed-publication cleanup regression also passes.

Full workspace unit/integration suite, all features, all 14 generated Windows MSVC test executables: 342 passed, 5 failed, 6 ignored. Matched baseline: 341 passed, 5 failed, 6 ignored. The five failures are unchanged: empty pipeline library (#347), missing Wine Winsock export (#217), checksum-rejection expectation, nested Cargo fixture build, and Windows xtask attempting to launch host Git.

Both Windows-target workspace Clippy configurations (all targets, with and without all features, -D warnings) pass. Native Linux xtask: 4 passed; asset policy passes.

Negative control: I retained the new regression but restored the old published?; Ok(path) behavior in a separate checkout. The same Windows test under Wine fails with Access denied. (os error 5). The unchanged PR passes all 5 pipeline tests; the native Linux pipeline suite separately passes all 4 portable tests. The control is not included in the full-suite results above.

Rust 1.98.1, Wine 11.22, RTX 5090 / NVIDIA 620.73.04, vkd3d-proton 30b0eb9bc12dc9f, native d3dcompiler_47 supplied for GPU fixtures; identical runtime DLLs to baseline. Offline and offscreen. No gameplay, native Windows/WARP, or Wine doctests. Aggregate counts include existing early-return tests without optional console compilers/DXIL validator; the new regression executed. AI-assisted testing with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7136767229 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1070#issuecomment-7136767229). Originally posted by [ThomasHFWright](https://github.com/ThomasHFWright) on 2026-11-24T15:52:51Z. --- Independent Linux/Wine validation of `5229ab872aebabd90449d8a901eddf48cd6f68b4` on base `ffe310e`: The new `cache::tests::an_entry_published_meanwhile_is_used` passes under Wine, including reading the winner's content and checking that no staging file is left. The existing failed-publication cleanup regression also passes. Full workspace unit/integration suite, all features, all 14 generated Windows MSVC test executables: **342 passed, 5 failed, 6 ignored**. Matched baseline: **341 passed, 5 failed, 6 ignored**. The five failures are unchanged: empty pipeline library (#347), missing Wine Winsock export (#217), checksum-rejection expectation, nested Cargo fixture build, and Windows xtask attempting to launch host Git. Both Windows-target workspace Clippy configurations (all targets, with and without all features, `-D warnings`) pass. Native Linux xtask: 4 passed; asset policy passes. Negative control: I retained the new regression but restored the old `published?; Ok(path)` behavior in a separate checkout. The same Windows test under Wine fails with `Access denied. (os error 5)`. The unchanged PR passes all 5 pipeline tests; the native Linux pipeline suite separately passes all 4 portable tests. The control is not included in the full-suite results above. Rust 1.98.1, Wine 11.22, RTX 5090 / NVIDIA 620.73.04, vkd3d-proton `30b0eb9bc12dc9f`, native `d3dcompiler_47` supplied for GPU fixtures; identical runtime DLLs to baseline. Offline and offscreen. No gameplay, native Windows/WARP, or Wine doctests. Aggregate counts include existing early-return tests without optional console compilers/DXIL validator; the new regression executed. AI-assisted testing with Codex.
upstream-sync closed this pull request 2026-11-24 17:03:10 +00:00
Zipettte commented 2026-11-24 17:04:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T16:29:59Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 5229ab8: cargo test -p victory-pipeline passes, 5 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7137760494 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1070#issuecomment-7137760494). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T16:29:59Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 5229ab8: `cargo test -p victory-pipeline` passes, 5 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._

Pull request closed

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
Marvisak/VIctory!1070
No description provided.