Repository navigation
Never pass devicectl's --remove-existing-content: it deleted game data on the device - #266
Merged
Merged
Conversation
On a real device the flag deletes the destination's siblings too, not only its contents. A save push to Documents/games/<id>/save removed the game's romfs.img, and a cheats push removed what sits beside Documents/games/<id>/cheats. The copies now merge into the destination and delete nothing. A file the Mac no longer has can stay in the device's folder, which is far safer than wiping game data (devicectl has no command to delete a single file). The stand-in devicectl in the tests now wipes the parent's entries when the flag is passed, and the tests assert the flag is never passed and that game data stays. Found and reproduced on real devices by Tiomehsh (#250). Co-authored-by: Tiomehsh <[email protected]>
This was referenced Oct 30, 2026
Collaborator
Author
|
@LNPANDY merged, CI was green. Since v0.6.0 to v0.7.2 can delete a device's game data when a player pushes a save or cheats, I'd suggest a patch release soon, with a line in the notes: players who used Saves or Cheats with a device may need to copy their game data to the device again (Install or Manage → game data). |
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.
What and why
Data loss.
xcrun devicectl device copy to ... --remove-existing-content truedoes not only clear the destination folder, it also deletes the destination's siblings. The launcher passed the flag on two copies to the device:Documents/games/<id>/save, so it could deleteromfs.img,aoc/andenv.txtnext to it. @Tiomehsh sawDocuments/romfs.img(multi-GB game data) andDocuments/env.txtgone on both an iPhone and an iPad after one push. The save itself copied correctly.Documents/games/<id>/cheats, so it could delete the game'sromfs.img,aoc/and the save beside it.Since when. Main has had this since #66 (2026-10-27), shipped in v0.6.0 to v0.7.2. The cheats push came with #218.
How it was found. @Tiomehsh tested #260 on a real iPhone 16 Pro and iPad Pro (see #250). After the UI transfer both devices had lost
Documents/romfs.imgandDocuments/env.txt. They then reproduced it in an isolateddevicectltemporary folder: copying a directory toprobe/savewith--remove-existing-content truealso deleted the siblingprobe/root.txt, and without the flag it stayed. Our fakeDeviceControlonly modelled removing the destination, so the tests could not see it. Thank you, this was an excellent catch.Fix. The flag is never passed.
SaveTransfer.copyToCommand(used by the save push and, throughCheatTransfer.copyCommand, by the cheats push) now merges the Mac's files into the destination folder and deletes nothing, like the install'sarchiveCopyalready did.devicectlhas no command to delete a single file (copyhas onlytoandfrom,info filesonly lists), so one trade-off remains: a file the Mac no longer has can stay in the device's save or cheats folder. That is far safer than wiping game data, and the existing backup of the device save before a push is unchanged. Backups and confirmation behaviour are unchanged, and no string changed.Tests: the fake
devicectlnow behaves like the real one (the flag deletes every entry in the destination's parent, without it the folder is merged and overwritten). New tests check that a save push leavesDocuments/romfs.img,Documents/env.txt,Documents/games/<id>/romfs.img,aoc/andcheats/in place, that a cheats push leavesromfs.img,aoc/and the save in place, and that the flag is never passed. The old assertion that it was passed is inverted. A test on the stand-in itself shows it would catch a regression.For @LNPANDY: this affects shipped releases (v0.6.0 to v0.7.2). It probably warrants a quick patch release, plus a warning in the release notes: players who pushed a save or cheats from the Mac to a device may have lost their game data on the device (
romfs.img,env.txt, DLC) and need to copy it to the device again. Their saves are not lost, the Mac keeps them and a backup is made before each push. #260 gets the same fix.Refs #250 (the data loss part, the rest is #260).
Checked
cd frontend && swift build && swift test(477 tests, 0 failures, 15 skipped as before),python3 scripts/patches.py checkok. No Qt change (no string changed, Qt has no devicectl code).devicectlwas not run against any device here. The behaviour of the flag is @Tiomehsh's reproduction on real devices.Scope