Skip to content

Commit 682d43d

Browse files
committed
fix(maestro): fail explicit notifications reset instead of reset-all fallback
A notifications-only unset must not clear microphone, location and other permissions through the reset-all sledgehammer. The probe gate rejects unlisted notifications again; the reset-all fallback stays for runtimes that list the service but block the direct reset. Regression proves a microphone grant survives the failed reset.
1 parent cf1f91d commit 682d43d

2 files changed

Lines changed: 25 additions & 18 deletions

File tree

‎packages/platform-apple/src/core/__tests__/app-settings.test.ts‎

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,10 @@ test('setIosSetting permission reset notifications falls back to reset all when
485485
);
486486
});
487487

488-
test('setIosSetting permission reset notifications falls back to reset all when unlisted in privacy help', async () => {
489-
// Runtimes like iOS 26.3 omit notifications from `simctl privacy help`, yet
490-
// direct reset fails only with "operation not permitted" while `reset all`
491-
// succeeds — so reset bypasses the probe gate into the existing fallback.
488+
test('setIosSetting permission reset notifications fails explicitly without touching other services', async () => {
489+
// Runtimes like iOS 26.3 omit notifications from `simctl privacy help`, where
490+
// no targeted reset exists: the probe gate rejects before any privacy call,
491+
// so an earlier microphone grant survives the failed reset.
492492
const device: DeviceInfo = {
493493
...IOS_TEST_SIMULATOR,
494494
simulatorSetPath: '/fake/privacy-help-no-notifications',
@@ -503,19 +503,28 @@ test('setIosSetting permission reset notifications falls back to reset all when
503503
if (isSimctlListDevices(args)) return BOOTED_SIM_LIST_JSON;
504504
if (args.includes('help')) return HELP_WITHOUT_NOTIFICATIONS;
505505
const flat = args.join(' ');
506-
if (flat.includes('reset notifications com.example.app')) {
507-
return { stderr: 'Failed to reset access\nOperation not permitted', exitCode: 1 };
508-
}
509-
if (flat.includes('reset all com.example.app')) return '';
506+
if (flat.includes('grant microphone com.example.app')) return '';
510507
return unexpectedArgs(args);
511508
},
512509
async ({ calls }) => {
513-
await setIosSetting(device, 'permission', 'reset', 'com.example.app', {
514-
permissionTarget: 'notifications',
510+
await setIosSetting(device, 'permission', 'grant', 'com.example.app', {
511+
permissionTarget: 'microphone',
515512
});
513+
await assertRejectsAppError(
514+
() =>
515+
setIosSetting(device, 'permission', 'reset', 'com.example.app', {
516+
permissionTarget: 'notifications',
517+
}),
518+
{ code: 'UNSUPPORTED_OPERATION', message: /does not support service "notifications"/i },
519+
);
516520
const flat = calls.map((args) => args.join(' '));
517521
assert.equal(
518522
flat.some((line) => line.includes('reset all com.example.app')),
523+
false,
524+
flat.join('; '),
525+
);
526+
assert.equal(
527+
flat.some((line) => line.includes('grant microphone com.example.app')),
519528
true,
520529
flat.join('; '),
521530
);

‎packages/platform-apple/src/core/app-settings.ts‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,7 @@ async function runIosPrivacyCommand(
272272
appBundleId: string,
273273
): Promise<void> {
274274
const supportedServices = await getSimctlPrivacyServices(device);
275-
// reset notifications falls back to `reset all` below (direct reset fails
276-
// with "operation not permitted" on runtimes whose help omits the service),
277-
// so it passes the probe gate even when the service is unlisted. Grant/deny
278-
// for notifications stay loud rejections.
279-
if (!supportedServices.has(target) && !(action === 'reset' && target === 'notifications')) {
275+
if (!supportedServices.has(target)) {
280276
throw new AppError(
281277
'UNSUPPORTED_OPERATION',
282278
`iOS simctl privacy does not support service "${target}" on this runtime.`,
@@ -313,9 +309,11 @@ async function runIosPrivacyCommand(
313309
}
314310

315311
/**
316-
* Direct `reset notifications` fails with "operation not permitted" on
317-
* runtimes whose help omits the service, while `reset all` succeeds — so
318-
* reset goes through the fallback instead of failing loudly like grant/deny.
312+
* Direct `reset notifications` can fail with "operation not permitted" even on
313+
* runtimes that list the service, while `reset all` succeeds — so reset goes
314+
* through the fallback instead of failing loudly like grant/deny. When the
315+
* probe omits notifications entirely there is no targeted reset available, and
316+
* the gate above fails explicitly rather than clearing unrelated state.
319317
*/
320318
async function resetIosNotificationsPermission(
321319
device: DeviceInfo,

0 commit comments

Comments
 (0)