Repository navigation
host/fs: refuse save commits after failed path mutations - #2690
Closed
thehobbit85 wants to merge 1 commit into
Closed
thehobbit85 wants to merge 1 commit into
thehobbit85 wants to merge 1 commit into
Conversation
thehobbit85
force-pushed
the
codex/save-mutation-failures
branch
from
November 14, 2026 17:11
6f60972 to
b998ca1
Compare
seedds
added a commit
that referenced
this pull request
Nov 15, 2026
…ommit (PR #2690) Failed writes and resizes already refused the save transaction's next Commit; path lookup, opening for writing, create, delete, mkdir, rmdir, clean and rename did not. A game that ignores such a failure (Horizon's save storage never fails, so games do not check) could then commit an incomplete save, e.g. an old file deleted and its replacement not created on a full disk. A failure in those operations now marks the transaction of the guest mount it names (aliases share it), even before a physical path exists, unless the error is one Horizon answers too (missing, existing, wrong type, not empty, bad name or argument; fs_guest_error). Read-only and non-transactional mounts are untouched. A rename whose name metadata and rollback both fail marks it whatever the first error. Recursive deletes stop at the first failure and keep its errno. New t_fs_mutation (464 checks on real APFS clones; failed 105 of the PR's 432 on the previous main). Synthetic only: no lost save was reported, and the link to #1692's crash and black screen is unconfirmed. Related to #1692. Co-authored-by: Eliran Zach <4012041+thehobbit85@users.noreply.github.com> Co-authored-by: AmateurWizrd <196495025+AmateurWizrd@users.noreply.github.com>
Owner
|
Landed on main as 73f6cbb, with you and AmateurWizrd credited as co-authors. Thanks. Changes on top of this PR:
#1692 stays open: this hasn't been shown to cause its crash and black screen. Real save and recovery on a device with a full disk is still untested. |
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.
Unexpected save-path errors invalidate the affected working transaction, preserve the last committed save and notify the front end. The connection to issue #1692's game crash and black screen remains unconfirmed; existing damaged saves are not repaired, and the issue stays open.
Conflict refresh — November 14, 2026
Rebased
6f6097230e6e96efb1aabf203853ac8988170f39onto main678481d280ee09cbc436bb51416a878ec6183ec3, producingb998ca1baace97a973b6a692b140d256a6495799on the same branch. The sole conflict was additive documentation: Ocarina's “Found on this game” list retains main's Metal archive-cleanup and graceful-prewarm findings plus the save-failure finding. All seven feature paths retain the same added/removed lines; the filesystem implementation and regression/stub sources are byte-identical to the author's published head. Main's newer lifecycle, pool and dirty-retirement fixes remain intact. Generated symptoms, range-diff, remaining diff and ancestry were checked.The following checks passed on
e886e92a323718a3bb4df5f059405fdd0cb7367aagainst1df3182f88c0b067f365c665ab8c1f05408a24d5, Apple M2 Max, Xcode 27.2, native Python 3.14.6 and LLVM 23.1.4:t_fs_mutation: 432 checks passed, and 432 passed under AddressSanitizer/UndefinedBehaviorSanitizer with leak detection disabled. Built throughmake -C dm/host/tests GAME=0400486024DEC000using separate native/sanitizer build directories. No real saves were used.make -C dm/host GAME=0400486024DEC000 -j3: passed with the current main integration.lint_c.py tidy --against 1df3182f88c0b067f365c665ab8c1f05408a24d5 dm/host/hle_fs.c dm/host/tests/t_fs_mutation.cpassed: five existing findings, zero new/stale baseline pairs. Whitespace checks passed.After main advanced to
678481d280ee09cbc436bb51416a878ec6183ec3, the candidate was rebased again. Complete host, graphics and Ocarina profile Git trees and build inputs are byte-identical to the tested integration above, retaining its native, sanitizer, host and C-lint evidence. The only incoming changes concern provisional Unreal memory defaults and their documentation/profile tests. Fresh final-head documentation, profile-guesser, cache, usage and environment tests passed: 50 tests, zero skips; no unchanged native campaign was repeated.The author's broader host/tools/graphics and failing-before evidence is preserved below with its original revisions. It was not rerun or relabeled as fresh. In particular, the historical graphics run's initial MetalFX HDR assertion remains a limitation. No current full graphics, five-game comparison, gameplay, damaged-save recovery or iOS runtime result is claimed. The original five impacted-game choices and unavailable game-build explanation below remain applicable. Remote CI on this replacement head requires separate verification.
Original proposal, attribution and validation (historical)
An unexpected host error during a save path operation could leave earlier changes in the working directory eligible for
Commit. Refuse that incomplete transaction, retain the last committed version, notify the front end through the existing save-failure path, and allow the next complete save to succeed.Related to #1692 (partial correction; do not close the issue). Credit to AmateurWizrd's filesystem lead and offered commit 566afc34. This adapts the failure handling to current main and adds an independent synthetic regression. The reported game's area-transition crash and subsequent black screen have not been reproduced or connected to this bug. Existing damaged saves are not repaired.
Path lookup, writable opens, create/delete operations and renames now attribute unexpected errors to the exact guest mount's backing transaction, even when lookup fails before a physical path exists. Aliases share that transaction; an independent save can still commit. Ordinary missing/existing/type/invalid-name results, read operations, read-only mounts and nontransactional mounts do not invalidate a save. Recursive deletion stops at the first error instead of losing it on a subsequent directory read. Rename destination probes and guest-name metadata failures also retain the original error.
Validation
Apple M2 Max, macOS 26.6, native arm64, Python 3.14.6, LLVM 23.1.4. No game files were used. Tested head
6f6097230e6e96efb1aabf203853ac8988170f39, based on mainde2018e0100e75e782464a830250800bdfebb219.t_fs_mutation: 432 checks pass, also under AddressSanitizer + UndefinedBehaviorSanitizer. It uses the actual filesystem HLE and real APFS clone/commit/recovery, injecting only the failing POSIX operation. Checks cover failure before path resolution and afterward, shared aliases, independent saves, committed data preservation, one front-end notification with the original errno, ordinary probe results and a successful subsequent save.arch -arm64 make -j4 -C dm/host/tests GAME=0400486024DEC000 run fs-directory: pass.python3 -m unittest discover -s dm/tools/tests: 1,586 tests, 32 skipped, pass (includes documentation checks).arch -arm64 make -j4 -C dm/host GAME=0400486024DEC000: pass, including after rebase.lint_c.py tidy dm/host/hle_fs.c dm/host/tests/t_fs_mutation.cwith LLVM 23.1.4: zero file/check pairs above baseline. Five existing findings remain in the host file; the new test has none.arch -arm64 make -j4 -C dm/gfx/tests GAME=0400486024DEC000 runinitially stopped at onet_upscaler_mfxHDR assertion (0.59375 instead of 0.5). The unchanged focusedcheck_t_upscaler_mfxtarget then passed all its configurations, and the remaining graphics targets passed. This transient initial failure is retained as a validation limitation, not hidden as an uninterrupted clean run.9e0ddeebdplus this patch. The only intervening main change was PR Initialize dirty tracking before concurrent pool registration #2225's dirty-page initialization. After rebasing, reran the save regression (432/432), Mac host build and the incomingcheck_t_dirty_init(8 pools, 0 failed). The filesystem patch and test contents did not change during rebase.git diff --check: pass. No shader-chain tool changed.scripts/regress.py impact HEADidentifies four affected profiles from usage manifests (Hades, Breath of the Wild, Pokémon Scarlet, Tears of the Kingdom), with 166 profiles lacking manifests. This is static reach analysis, not gameplay validation.The required
scripts/regress.py check --games 0400486024DEC000,0100152000022000,01006F8002326000,010099C022B96000,01007EF00011E000was attempted and exits 2 becauseREGRESS_ROOT/REGRESS_GAMESare not configured and there are no local game files. Selected routes and rationale:No gameplay, damaged-save recovery or iOS runtime validation is claimed.
Documentation and scope
Durable mechanism in
docs/reference/services.md, linked from Ocarina's “Found on this game” list; symptom index anddocs/development.mdupdated. No game assets, keys, agent planning files or execution journals are included. Fresh main, all-state PR inventory (including drafts), issue timeline, relevant save changes and the offered commit's PR associations were rechecked before publication; no existing PR implements this correction.