Repository navigation
Physical iOS deploys never empty the app container (MOB-408) - #142
Merged
Merged
Conversation
The deploy copied BEAMs with devicectl --remove-existing-content, meant to replace Documents/otp/<app>; on an iPhone it empties the app's whole data container except the destination (SQLite, sessions, Library, tmp), on every deploy. Every copy is now a merge. For a runtime that reads them (the project's mob has ios/mob_code_versions.h and the phone has Documents/otp/<app>.versions/, which that runtime creates at boot), upload to a fresh <app>.versions/<N> numbered above every listed entry, read back <app>.beam, then copy <N>/.mob_complete: the app loads only committed versions, so an interrupted deploy leaves the previous code running. Older runtimes get a merge into Documents/otp/<app>; an error after the copy began says what each case leaves on the phone. Decision: decisions/2026-10-15-ios-deploy-never-empties-the-container.md.
Review: ios_code_plan/2 can still guess wrong when the project's mob moves across 0.9.20 without --native (a versioned upload an old runtime ignores, or a legacy merge a new runtime shadows with its committed version), and the deploy then reported success while the phone ran old code. After the relaunch, wait (up to 20 s) for Documents/mob_diag_beams_dir.txt, which every runtime since mob 0.6.2 writes at boot, to name the directory just written; otherwise fail, naming where the app booted from. Clear the partial-upload note once the marker is committed. Decision record: correct the downgrade claim, the --native wording, note concurrent deploys.
A legacy deploy expects the same Documents/otp/<app> path every time, so the previous boot's mob_diag_beams_dir.txt could satisfy the check before the new boot wrote its own. Overwrite it with a placeholder before the relaunch; a placeholder or missing file at the deadline reports that the app never said what it loaded.
GenericJam
force-pushed
the
mob-408-ios-deploy-versioned
branch
from
October 15, 2026 20:16
06a826b to
6fc00a6
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.
MOB-408, deployer half. Runtime half: GenericJam/mob#207 (mob 0.9.20).
Problem
mix mob.deployto a physical iPhone copied BEAMs withxcrun devicectl device copy to ... --destination Documents/otp/<app> --remove-existing-content true. Measured on Kevin's iPhone SE (devicectl 642.16): with that flag devicectl empties the app's whole data container except the destination. Reproduced with a blank host on mob 0.9.19 + mob_dev 0.7.26: a Documents sentinel, a SQLite row, a nested dir, aLibrary/file and a sibling inDocuments/otpwere all gone after one BEAM-only deploy.Change
--remove-existing-content; every copy is a merge.ios_code_plan/2: if the project's:mobdep shipsios/mob_code_versions.hand the phone hasDocuments/otp/<app>.versions/(the new runtime creates it at boot), upload to a fresh<app>.versions/<N>(N above every listed entry), read back<app>.beam, then copy<N>/.mob_complete. Otherwise merge intoDocuments/otp/<app>for the older runtime.Documents/mob_diag_beams_dir.txt(written at boot by every runtime since mob 0.6.2) to name the directory just written; fail otherwise, naming where the app booted from. Catches an app whose native runtime and:mobdep disagree, where the plan's guess would be ignored or shadowed.mob.deploymoduledoc,decisions/2026-10-15-ios-deploy-never-empties-the-container.md, amendments to two older records, thepersistable?/1comment.Verification
mix test(3042 passed),mix credo --strict,mix format --check-formatted,mix compile --warnings-as-errorslocally.d408with this branch + mob#207 (path deps): sentinels survived ~16 deploys (legacy push on the first--native, then versioned 1→12, GC'd behind); killing the devicectl copy mid-upload (382/448 entries) and killingmixmid-deploy both left the previous version booting; the next deploy collected the partial dirs. Old runtime (mob 0.9.19 via--native): legacy merges, nothing wiped, even with a leftover<app>.versions/. Mismatches: new deps on the old runtime and old deps on the new runtime each failed the deploy with the booted-from path instead of reporting success.Review
Codex rate-limited (until 17:26) → reviewer subagent: MERGE; its should-fix (silent stale code when the guess is wrong) is fixed by the boot check in 06a826b. Re-review: see comment below.