ReviewOS

also looking at this

craft-native/craft

test(ios): preserve native shortcuts through bundle initialization

#423
Merged glennmichael123 wants to merge fix/native-screen-shortcuts-module into main
3 files +91 -0
7 days ago

Scope correction

The maintained iOS host already exposes native craft.shortcuts.set/clear through the Shortcuts capability and updates UIApplication.shared.shortcutItems. The original description incorrectly said native screens could only answer unsupported.

Restoring keep('shortcuts', ...) replaced that capability-owned accessor with the generic adoption setter. During bundle initialization, a replacement namespace could then bypass native dispatch. Reinstalling the bridge after bundle evaluation could hide the bootstrap regression.

Changes

  • Remove the redundant false-returning fallback; retain the existing native accessor and document why it must not be wrapped in keep().
  • Replace the string-presence assertion with an executable test of the actual bridge and extras preludes, before and after post-bundle reinstall. Check partial objects, browser-shaped methods, null/undefined assignments, retained extras, and exact native set/clear requests.
  • Add an iOS simulator regression for screen and app-script contexts that checks registration and clearing against the actual UIKit shortcut menu after partial/null namespace replacement.

Follow-up commit 0dc49366 changes exactly three files. No history rewrite.

Verification

  • Red/green demonstrated: the new behavioral test fails on the original PR with false instead of the native response, and passes after removing the fallback.
  • iOS builder: 133 passed.
  • Typecheck, package builds, 43 package-surface checks, pinned formatting, 397 release tests, and lint passed (0 errors, 27 existing warnings).
  • Full SDK ran three times, each with 798 passed / 8 skipped / 1 failure in an unchanged subprocess fixture: process disposal (5-second deadline), ADB reconnect/update (5-second deadline), then recorder startup (first-frame deadline instead of DISPLAY_UNAVAILABLE). The earlier failing cases passed in later full runs. No timeout or unrelated source changes were made; the full SDK suite is not claimed green.
  • iOS 26.5 simulator: NativeShortcutsUnitTests passed 6/6, zero failures/skips, including real UIKit registration/clearing in both screen and app-script contexts. Retained result: /tmp/craft-423-shortcuts-retry.xcresult. The first attempt could not connect to testmanagerd; unchanged retry passed after restarting only the dedicated test simulator. That disposable simulator has been removed.
  • Latest-head CI must finish before merge.

Related: #412. This is regression coverage for the existing native capability, not a new implementation or a claim that unsupported stubs resolve #412.

3 changed files on the files tab, with 0 review threads.

Sign in to comment on this pull request.