Skip to content

fix(ios): keep the fresh-install directory layout on clear-app-state - #3198

Merged
thymikee merged 2 commits into
callstack:mainfrom
pvedula7:fix/clear-app-state-tmp
Oct 4, 2026
Merged

thymikee merged 2 commits into
callstack:mainfrom
pvedula7:fix/clear-app-state-tmp

Conversation

@pvedula7

@pvedula7 pvedula7 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #3156. On an iOS simulator, settings clear-app-state removes the data container's top-level directories, not just their contents. On relaunch iOS recreates Documents and Library, but not tmp or SystemData. Without tmp, every URLSession download task fails until the app is reinstalled. We hit it as Expo's asset loader failing to fetch fonts (UnableToDownloadAssetException) after app.clearState(), while plain data requests kept working.

After clearing, the container now gets back the directories a fresh install has (Documents, Library/Caches, Library/Preferences, SystemData, tmp), empty. 3 files: the fix, its unit test, and the commands doc.

Validation

  • 528b66ee9: pnpm check:affected --run passes. The extended app-settings.test.ts case fails on main.
  • iOS 26.5 simulator, Xcode 26.6, Expo SDK 57 dev-client app. Data container after settings clear-app-state <bundle> and a relaunch:
    • fresh install: Documents, Library/{Caches,Preferences}, SystemData, tmp
    • main: no tmp or SystemData; asset downloads fail
    • this branch: same layout as a fresh install; assets load
  • Risk: the directory list is what iOS 26.5 creates; other runtimes could differ.

Review in cubic

…tate

Clearing removed Documents, Library/Caches, Library/Preferences, SystemData,
and tmp themselves. iOS does not recreate tmp on relaunch, so every
URLSession download task failed until the app was reinstalled. Recreate the
directories a fresh install has, empty, after clearing.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/platform-apple/src/core/app-settings.ts
Comment thread packages/platform-apple/src/core/app-settings.ts
@thymikee

thymikee commented Oct 3, 2026

Copy link
Copy Markdown
Member

The PR is ready at 528b66e. The code keeps the fresh-install directory layout on clear-app-state as intended, and I found no problems in the change.

Not blocking: the directory list in app-settings.ts matches the iOS 26.5 layout, so a short note in the commands.md sentence or the constant's comment would say so, since older runtimes and tvOS or visionOS simulators could differ. Extra empty directories are harmless because the old code already wiped those containers. You can take this or leave it.

The Cubic P2 thread on the tvOS and visionOS guard still applies, but it is the same documentation caveat and not a defect (#3198 (comment)). The Cubic P3 thread on non-atomic mkdir does not apply, so please resolve it: a mkdir failure surfaces as an error, and a rerun converges to the full layout (#3198 (comment)).

The one reported check passed, and it covers the route this diff touches (clearIosSimulatorAppState and its unit test). I did not run the unit test or any simulator. The regression claim comes from reading the diff. The iOS 26.5 live validation and the claim that asset downloads fail on main come from the PR body. I did not check the layout on other iOS runtimes, tvOS or visionOS. No conflicts are known, and nothing else must happen before merge.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 3, 2026
The recreated directory list was checked against an iOS 26.5 fresh install.
Older runtimes and tvOS or visionOS simulators may differ; an extra empty
directory there is harmless.
@pvedula7

pvedula7 commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Added the note in 3791616: the comment on FRESH_INSTALL_DATA_DIRECTORIES and the clear-app-state line in commands.md now say the list matches the iOS 26.5 fresh-install layout and other runtimes may differ. No code changes.

@thymikee

thymikee commented Oct 4, 2026

Copy link
Copy Markdown
Member

I re-reviewed this PR at 3791616 and found no code problems. Since the earlier review at 528b66e, the new commit changes comments and docs only, so the code I reviewed before still stands. The one check reported on this head passes, and there are no conflicts. I did not check the iOS 26.5 layout claim on a live simulator, and I did not individually verify the two resolved threads. The delta does not touch their code. Nothing else must happen before merge.

@thymikee
thymikee merged commit d051ff7 into callstack:main Oct 4, 2026
16 checks passed
@pvedula7
pvedula7 deleted the fix/clear-app-state-tmp branch October 4, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants