fix(savedata): recover interrupted backup replacement #15943

Merged
nikhilpanchal1 merged 4 commits from upstream-pr/15943 into main 2026-11-08 07:37:40 +00:00
nikhilpanchal1 commented 2026-11-05 01:57:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nikhilpanchal1 on 2026-11-05T01:57:48Z.


What

Recover a complete host backup left in _sd_backup_old after interrupted replacement, before checking, restoring or making another backup. Retain a complete published copy, retry abandoned-copy cleanup, and remove every recovery copy on successful deletion. A failed live-tree or metadata deletion preserves the backup.

Adds fresh-process interruption, real permission failure, metadata-removal failure, cleanup, rollback, corruption-layout and linked-path regressions. Structural checks do not verify payload or block-sidecar content integrity. This follows up #12748; it does not implement #8005 transaction semantics.

Tested

Linux x86-64, Debian 13, GCC 14.2, Release, pinned bundled dependencies. Current upstream base acac7c8541; final head d7246f0d04. The reviewed SaveData files are identical to e087280bfb after merging the unrelated upstream graphics revert.

  • Full production libs/relinker build and patched-library loading pass.
  • 13 recovery cases plus mount-status and delete: 15/15 pass, no skips. Ten original recovery regressions fail on main SaveData source (unchanged between 0eba5db30d and current base); mount-status passes. Both new deletion-failure regressions fail on initial head 247921582a and pass here. Fault-injection rollback coverage supplements those behavioral controls.
  • Wider SaveData/library/header run: 35/36 pass. Unchanged guest_savedata_dialog fails identically on main: this cloud kernel lacks process_vm_readv (errno 38). No new failure or skip.
  • Five independent reviewers completed two review/repair passes. Fixed backup loss on failed deletion, strengthened metadata/baseline assertions, corrected Windows child arguments and narrowed integrity claims. Final passes found no unresolved substantive issue; independent permission, unsafe-path and compound rollback probes pass.
  • Conventions, strict main sync, registration and whitespace pass. The 1,889-PR overlap scan could not compare four stale branches (#13486, #14212, #15042, #15899); manual merge-base comparisons found no competing recovery implementation or dependency.

No Windows, title, console, power-loss or concurrent-writer qualification. Deletion remains nontransactional; backup-cleanup failure may partially remove its copy. Live-tree/metadata deletion failures preserve backups. Interrupted live restores and Prepare/Commit remain unsupported.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: Yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5164756416 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15943). Originally posted by [nikhilpanchal1](https://github.com/nikhilpanchal1) on 2026-11-05T01:57:48Z. --- ### What Recover a complete host backup left in `_sd_backup_old` after interrupted replacement, before checking, restoring or making another backup. Retain a complete published copy, retry abandoned-copy cleanup, and remove every recovery copy on successful deletion. A failed live-tree or metadata deletion preserves the backup. Adds fresh-process interruption, real permission failure, metadata-removal failure, cleanup, rollback, corruption-layout and linked-path regressions. Structural checks do not verify payload or block-sidecar content integrity. This follows up #12748; it does not implement #8005 transaction semantics. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Linux x86-64, Debian 13, GCC 14.2, Release, pinned bundled dependencies. Current upstream base `acac7c8541`; final head `d7246f0d04`. The reviewed SaveData files are identical to `e087280bfb` after merging the unrelated upstream graphics revert. - Full production `libs`/`relinker` build and patched-library loading pass. - 13 recovery cases plus mount-status and delete: 15/15 pass, no skips. Ten original recovery regressions fail on main SaveData source (unchanged between `0eba5db30d` and current base); mount-status passes. Both new deletion-failure regressions fail on initial head `247921582a` and pass here. Fault-injection rollback coverage supplements those behavioral controls. - Wider SaveData/library/header run: 35/36 pass. Unchanged `guest_savedata_dialog` fails identically on main: this cloud kernel lacks `process_vm_readv` (errno 38). No new failure or skip. - Five independent reviewers completed two review/repair passes. Fixed backup loss on failed deletion, strengthened metadata/baseline assertions, corrected Windows child arguments and narrowed integrity claims. Final passes found no unresolved substantive issue; independent permission, unsafe-path and compound rollback probes pass. - Conventions, strict main sync, registration and whitespace pass. The 1,889-PR overlap scan could not compare four stale branches (#13486, #14212, #15042, #15899); manual merge-base comparisons found no competing recovery implementation or dependency. No Windows, title, console, power-loss or concurrent-writer qualification. Deletion remains nontransactional; backup-cleanup failure may partially remove its copy. Live-tree/metadata deletion failures preserve backups. Interrupted live restores and `Prepare`/`Commit` remain unsupported. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: Yes
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
boykopovar/AnyPS5!15943
No description provided.