Skip to content

fix: reset privacy permissions when clearing an app on ios simulator - #486

Merged
gmegidish merged 2 commits into
mainfrom
fix/simulator-clear-app-permissions
Oct 4, 2026
Merged

gmegidish merged 2 commits into
mainfrom
fix/simulator-clear-app-permissions

Conversation

@gmegidish

@gmegidish gmegidish commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

On Android, apps clear (pm clear) also resets an app's runtime permissions, so it asks for them again. On an iOS simulator, ClearApp only emptied the data container, and granted or denied permissions stayed.

ClearApp on the simulator now also runs xcrun simctl privacy <udid> reset all <bundle>, so apps clear behaves the same on both platforms. This is useful for repeatable permission-prompt tests in mobilewright (device.clearAppData()).

Notification permission is not covered by simctl privacy and still only resets on reinstall. The README and openrpc docs mention the permission reset.

Test plan

  • new apps clear test in test/simulator.spec.ts: grants camera + microphone, runs apps clear, checks the app has no rows left in the simulator's TCC database (read with node:sqlite)
  • the test fails on the previous simulator.go and passes with this change (iPhone 17 Pro, iOS 26.5)
  • manual: after apps clear, Playground shows camera and location as "Not Determined" again
  • go test ./devices

Summary by CodeRabbit

  • Bug Fixes
    • Clearing an app from the simulator now also resets its privacy permissions, including camera and microphone access. This prevents permissions granted during an earlier run from carrying over after the app’s data is cleared. If the permission reset fails, the clear operation reports an error rather than indicating that it completed successfully.

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: mobile-next/mobilecli/.coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: 459cc367-1810-4468-aa8d-97d058928bae

📥 Commits

Reviewing files that changed from the base of the PR and between 4123c6a and b08874d.

⛔ Files ignored due to path filters (3)
  • README.md is excluded by !**/*.md
  • docs/openrpc.json is excluded by !docs/**
  • docs/openrpc.md is excluded by !**/*.md, !docs/**
📒 Files selected for processing (3)
  • devices/simulator.go
  • test/simctl.ts
  • test/simulator.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 5 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

Clearing a simulator app now also resets its privacy permissions. Test helpers grant permissions and inspect the simulator’s TCC database, and an apps clear test checks that camera and microphone permission records are removed.

Changes

Simulator app clearing

Layer / File(s) Summary
Reset permissions during app clearing
devices/simulator.go
ClearApp runs simctl privacy reset all for the target bundle after clearing its data container. It returns an error if the command fails.
Permission test and helpers
test/simctl.ts, test/simulator.spec.ts
Test helpers grant privacy permissions and read the bundle’s recorded TCC services. The apps clear test checks for camera and microphone records before clearing, then checks that no records remain.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: hakanor

Merge Risk: ⚪ Minimal · up to b0887

The change resets simulator privacy permissions when clearing an app and reports reset failures. No actionable merge-blocking risk remains; merge after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: resetting privacy permissions when clearing an app on the iOS simulator.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@gmegidish
gmegidish merged commit c6c3c61 into main Oct 4, 2026
62 of 67 checks passed
@gmegidish
gmegidish deleted the fix/simulator-clear-app-permissions branch October 4, 2026 12:02
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