Skip to content

test(ios): lock the folder a failing sync merge save writes to, since the core resets its mode - #4686

Merged
datlechin merged 1 commit into
mainfrom
test/ios-library-save-lock
Nov 28, 2026
Merged

datlechin merged 1 commit into
mainfrom
test/ios-library-save-lock

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • AppStateLibraryTests.unsavedSyncMergeIsReported set Core/ to 0o555 to make a sync merge's save fail. The core's fs::write_private_blocking calls ensure_private_dir, which sets that folder back to 0700 before every write (core/crates/storage/src/fs.rs). So the save went through and the test failed on main.
  • The test now locks the folder with the user-immutable flag. The core's set_permissions is refused with EPERM, so the save fails as the test intends.
  • The lock lives in whileLocked(_:_:), which clears the flag in a defer on every way out of its body: normal return, a failed #expect and a thrown error. A failure to clear it is recorded as an issue, not dropped. A flag left set would make the fixture's temp folder undeletable.
  • Test only. No app or core change.

Test plan

  • Fails on main: the same test, iOS app sources and core, run on integ/mac-keys-ui-r1 at 3919e4a, failed at line 649 every time, alone too (1 of 52).
  • With this change, on that tree: AppStateLibraryTests 52/52.
  • After the run, no folder under the simulator's app-state-* test roots carries the immutable flag (find ... -flags +uchg finds none).

@datlechin
datlechin merged commit 9ebc4f0 into main Nov 28, 2026
2 checks passed
@datlechin
datlechin deleted the test/ios-library-save-lock branch November 28, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant