fix(settings): keep the --app hint on the daemon route and type mode for photos only

Merged
IM
5d ago
+67-17

Summary

Follow-up to #5006 and #5019.

  • Daemon route keeps the --app guidance. parseSettingsArgs returned only the code and message, so a caller sending positionals straight to the daemon lost setting_permission_app_positional and the --app hint. It now normalizes the AppError like other daemon handlers, matching the CLI route.
  • SettingsUpdateOptions takes mode only with photos. The targets that take a mode are read from the catalog forms; every other target types mode?: never, so { permission: 'camera', mode: 'limited' } fails to compile instead of at runtime. A caller that forwards a wide PermissionTarget together with a mode must now narrow it to 'photos' before passing the mode.
  • Help. The settings help says iOS simulator wifi and airplane change only the status bar.
  • Test. The wifi/airplane warning test now checks the setting name and "status bar".

Before / after

parseSettingsArgs with ['permission', 'deny', 'notifications', 'com.example.app']:

   "code": "INVALID_ARGS",
-  "message": "settings permission notifications takes no mode."
+  "message": "settings permission notifications takes no mode.",
+  "hint": "Pass the app with --app com.example.app.",
+  "details": { "reason": "setting_permission_app_positional", "dispatched": "no", "permission": "notifications", "app": "com.example.app" }

tsc on const o: SettingsUpdateOptions = { setting: 'permission', state: 'grant', permission: 'camera', mode: 'limited' }:

base: exit 0
head: probe.ts(2,116): error TS2322: Type 'string' is not assignable to type 'undefined'.

Validation

  • Focused unit-core runs: the four touched settings test files (87 tests) and the command-doc guards (77 tests) passed. generate:command-docs reports commands.md is current.
  • Mutants (each fails a test): dropping the daemon-route details, naming wifi in the airplane warning, removing "status bar", letting non-photos targets take a mode, emptying the moded target set.
  • Base aecafaf30, head e15ede08b. pnpm check:affected --run --head e15ede08b: format, lint, typecheck, layering, fallow, build, package, integration-node, and vitest-related passed.

Start Proof
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.