Repository navigation
Write author-owned payload files through a staging file - #103
Merged
Merged
Conversation
sambvfx
force-pushed
the
staged-author-payload-copy
branch
from
November 18, 2026 21:46
8b9495e to
777ba09
Compare
sambvfx
force-pushed
the
staged-author-payload-copy
branch
from
November 19, 2026 00:27
777ba09 to
65569ea
Compare
`DirectoryRuntimePayload.extractAuthorTree` streamed each bundled file straight onto its live path. A copy that failed partway left a partial file there, and a partial file matches no shipped version, so every later launch kept it as an author's edit. An unedited lighting profile could stay half-written for good without anyone having edited it. The first write of a missing file had the same hole. Each author-owned file is now copied to `<name>.staging` beside its target, flushed to disk, and moved into place only once the copy is complete. The move is atomic where the file system supports it, and it retries like the other renames the extraction commits with. A failed copy or move leaves the previous live file as it was and removes the staging file, and only that one file, so the next launch still sees an unedited default and replaces it. The flush covers a power loss or a system crash. Without it the move can reach the disk before the bytes it moved, and the file comes back empty or zeroed, which is kept as an edit like any other partial file. The SDK tree keeps its direct copy. It is written into `remix-sdk.staging/`, which a retry deletes and rebuilds and which replaces the live SDK only after every copy succeeds. ## Testing - `DirectoryRuntimePayloadTest` opens the bundled file through a stream that fails after half its bytes and checks, for an update and for a first write, that the live file is unchanged, no staging file remains, a retry writes the file, and an author's edit beside it is kept. - Both tests fail against the direct copy: the live file holds the first half of the new default. - A third test holds the live file open so the move fails on every retry, and checks the same things. It fails when the move sits outside the cleanup. - A fourth puts a folder on the staging path and checks that a failed write deletes nothing inside it. It fails against a recursive cleanup. - `gradlew build test` passes for each 1.21.1 loader with 0 failures: Fabric 912 JVM tests, Forge 892, NeoForge 886. - Not fault-injected in a running game, and no test shows that the flush reached the disk. Fixes NVIDIAGameWorks#95 Signed-off-by: Sam Bourne <sbourne@nvidia.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
sambvfx
force-pushed
the
staged-author-payload-copy
branch
from
November 20, 2026 02:00
65569ea to
ed911be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An interrupted write of an author-owned payload file could leave a partial file that every later launch kept as an author's edit.
DirectoryRuntimePayload.extractAuthorTreestreamed each bundled file straight onto its live path. A copy that failed partway left a partial file there, and a partial file matches no shipped version, so the hash check that protects edits kept it. An unedited lighting profile could stay half-written for good without anyone having edited it. The first write of a missing file had the same hole.Changes
<name>.stagingbeside its target, flushed to disk, and moved into place only once the copy is complete. A failed copy or move leaves the previous live file as it was and removes the staging file, so the next launch still sees an unedited default and replaces it.remix-sdk.staging/, which a retry deletes and rebuilds and which replaces the live SDK only after every copy succeeds.Testing
DirectoryRuntimePayloadTestopens the bundled file through a stream that fails after half its bytes and checks, for an update and for a first write, that the live file is unchanged, no staging file remains, a retry writes the file, and an author's edit beside it is kept.gradlew build testpasses for each 1.21.1 loader with 0 failures: Fabric 912 JVM tests, Forge 892, NeoForge 886.Fixes #95
🤖 Generated with Claude Code