Skip to content

pipeline: remove staging files when cache publication fails - #161

Merged
Marvisak merged 1 commit into
Marvisak:mainfrom
lordon1a:fix/pipeline-staging-cleanup
Nov 24, 2026
Merged

Marvisak merged 1 commit into
Marvisak:mainfrom
lordon1a:fix/pipeline-staging-cleanup

Conversation

@lordon1a

Copy link
Copy Markdown
Contributor

Summary

When Cache::get_or_convert() (crates/victory-pipeline/src/cache.rs) fails to write or rename its staging file into the final cache path, the orphaned temporary file was left behind in the cache directory.

This change:

  1. Opens the staging path with OpenOptions::new().write(true).create_new(true) instead of std::fs::write, drops the file handle before rename (required on Windows), and removes the staging file if writing or publishing fails.
  2. Adds a synthetic unit test (failed_publication_removes_the_staging_file) that creates a directory at the target cache path to force rename failure and verifies no staging file remains.

Verification

Tested on Windows 11 (rustc 1.100.0, x86_64-pc-windows-gnullvm):

  • cargo test -p victory-pipeline: 4 passed, 0 failed (the new test fails on main@9aef3d9 where the staging file is left behind).
  • cargo clippy -p victory-pipeline --all-targets: 0 warnings.
  • cargo xtask policy: 151 files ok (zero game data).

AI-assisted.

Reserve a new staging path and clean it up if writing or publishing fails. Cover a failed publication with a synthetic destination directory.
Copilot AI balanced review requested due to automatic review settings November 24, 2026 01:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@DaviTostes

Copy link
Copy Markdown

The test target does not compile, so the GPU suite cannot run:

error[E0428]: the name `tests` is defined multiple times
    --> crates/victory-gpu/src/host.rs:1974:1
 252 | mod tests { ... }
1974 | mod tests { ... }

The library builds; only cargo test fails, on every platform. The new test module needs to go into the existing mod tests in host.rs after a rebase (the same failure as #134/#135/#175).

No game data used.

edsuuu referenced this pull request in edsuuu/VI-BR-PORT Nov 24, 2026
…fails

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ghost ghost mentioned this pull request Nov 24, 2026
@Marvisak
Marvisak merged commit 787f665 into Marvisak:main Nov 24, 2026
suirentakamura referenced this pull request in suirentakamura/victory-suiren Nov 24, 2026
pipeline: remove staging files when cache publication fails
itsonlysimbo pushed a commit to itsonlysimbo/VIctory that referenced this pull request Nov 24, 2026
…eanup

pipeline: remove staging files when cache publication fails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants