Skip to content

Fix corrupt local cache restores after Wireit is killed mid-write - #1516

Merged
aomarks merged 1 commit into
mainfrom
atomic-local-cache
Sep 25, 2026
Merged

aomarks merged 1 commit into
mainfrom
atomic-local-cache

Conversation

@aomarks

@aomarks aomarks commented Sep 25, 2026

Copy link
Copy Markdown
Member

LocalCache.set copied output straight into the entry's final folder. If Wireit was killed or crashed part way through, the partial entry stayed in the cache, and later runs with the same inputs restored it instead of running the script, with files missing or truncated and no error.

Now set copies into a temp folder under the script's ".wireit" folder and renames it into place. The temp folder is per script, so the script's lock tells a leftover from another process's write in progress. The next write moves leftovers to the trash.

LocalCache.set copied output straight into the entry's final folder. If Wireit
was killed or crashed part way through, the partial entry stayed in the cache,
and later runs with the same inputs restored it instead of running the script,
with files missing or truncated and no error.

Now set copies into a temp folder under the script's ".wireit" folder and
renames it into place. The temp folder is per script, so the script's lock
tells a leftover from another process's write in progress. The next write
moves leftovers to the trash.
@aomarks
aomarks requested a review from augustjk September 25, 2026 19:04
@aomarks
aomarks merged commit 0a80f6d into main Sep 25, 2026
38 of 39 checks passed
@aomarks
aomarks deleted the atomic-local-cache branch September 25, 2026 19:26
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.

2 participants