Skip to content

Commit 26ac865

Browse files
authored
refactor: consolidate Apple platform internals (#968)
1 parent f4882bc commit 26ac865

164 files changed

Lines changed: 859 additions & 1514 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.fallowrc.json‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,28 @@
6868
{
6969
"file": "src/platforms/ios/index.ts",
7070
"exports": ["listSimulatorApps", "uninstallIosApp"]
71+
},
72+
{
73+
"file": "src/platforms/apple/core/apps.ts",
74+
"exports": ["listSimulatorApps", "uninstallIosApp"]
75+
},
76+
{
77+
"file": "src/platforms/apple/core/runner/runner-contract.ts",
78+
"exports": ["resolveRunnerEarlyExitHint"]
79+
},
80+
{
81+
"file": "src/platforms/apple/core/runner/runner-session.ts",
82+
"exports": ["stopAllIosRunnerSessions"]
83+
},
84+
{
85+
"file": "src/platforms/apple/core/runner/runner-xctestrun.ts",
86+
"exports": [
87+
"resolveRunnerBuildDestination",
88+
"resolveRunnerAppBundleId",
89+
"resolveRunnerSigningBuildSettings",
90+
"resolveRunnerBundleBuildSettings",
91+
"assertSafeDerivedCleanup"
92+
]
7193
}
7294
],
7395
"usedClassMembers": ["name", "listActiveLeases", "delete", "values", "elapsedMs", "isExpired"],

‎.github/workflows/ios.yml‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,6 @@ jobs:
6666
run: |
6767
node --experimental-strip-types src/bin.ts test test/integration/replays/ios/simulator/01-settings.ad --udid "${{ steps.ios-simulator.outputs.simulator-udid }}" --retries 2 --artifacts-dir test/artifacts/replays-ios-simulator-smoke --report-junit test/artifacts/replays-ios-simulator-smoke.junit.xml
6868
69-
# Gate for runner refactors (Phase 3 step c): assert the iOS runner request
70-
# count is unchanged vs. the committed baseline. Runs in its own isolated
71-
# daemon (temp --state-dir) so it never contends with the smoke daemon's
72-
# lease; `clean:daemon` first releases the shared daemon's UDID lease. A
73-
# real count drift fails loudly; an infra hiccup is tolerated (see harness).
74-
- name: Assert iOS runner request count
75-
run: |
76-
pnpm clean:daemon
77-
node --experimental-strip-types scripts/runner-request-count/run.ts --udid "${{ steps.ios-simulator.outputs.simulator-udid }}" --prepare-timeout-ms "$AGENT_DEVICE_IOS_PREPARE_TIMEOUT_MS" --artifacts-dir test/artifacts/runner-request-count
78-
7969
- name: Run iOS physical device smoke replay
8070
if: env.IOS_UDID != ''
8171
env:

‎docs/adr/0009-apple-platform-consolidation.md‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,16 @@ preserved). The tvOS focus-only interaction contract (no coordinate `tap`) must
4949
and snapshot fidelity is uneven (the deep-RN AX-server fallback is iOS-simulator-only). The final
5050
`Platform` collapse of `ios`+`macos` into `apple` is the last, highest-diff step.
5151

52-
This composes with ADR 0008 (the descriptor's capability facet) and ADR 0003. The phased sequencing and
53-
per-OS readiness live in `plans/apple-platform-consolidation.md`; this ADR owns the decision.
52+
This composes with ADR 0008 (the descriptor's capability facet) and ADR 0003.
53+
54+
Implementation status as of 2026-06:
55+
56+
- Shipped: additive `appleOs` groundwork, the shared Apple engine under `src/platforms/apple/core`, macOS leaf
57+
files under `src/platforms/apple/os/macos`, direct internal imports to the Apple modules, and visionOS
58+
profile/build/discovery groundwork.
59+
- Deferred: the public `Platform` collapse from `ios`/`macos` to `apple`, a dedicated tvOS leaf, per-`AppleOS`
60+
capability tables, and any watchOS unsupported sentinel. watchOS remains out of scope for the current
61+
consolidation.
62+
63+
This ADR owns the architectural decision; implementation progress for the remaining platform-plugin work lives
64+
in `plans/phase3-platform-plugin-progress.md`.

‎fallow-baselines/health.json‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,15 @@
434434
"count": 1
435435
}
436436
},
437-
"src/platforms/ios/apps.ts": {
437+
"src/platforms/apple/core/apps.ts": {
438438
"complexity_high": {
439439
"count": 1
440440
},
441441
"crap_moderate": {
442442
"count": 2
443443
}
444444
},
445-
"src/platforms/ios/devices.ts": {
445+
"src/platforms/apple/core/devices.ts": {
446446
"crap_moderate": {
447447
"count": 1
448448
}
@@ -455,43 +455,43 @@
455455
"count": 1
456456
}
457457
},
458-
"src/platforms/ios/macos-helper.ts": {
458+
"src/platforms/apple/os/macos/helper.ts": {
459459
"crap_high": {
460460
"count": 1
461461
}
462462
},
463-
"src/platforms/ios/perf.ts": {
463+
"src/platforms/apple/core/perf.ts": {
464464
"complexity_high": {
465465
"count": 1
466466
},
467467
"crap_high": {
468468
"count": 1
469469
}
470470
},
471-
"src/platforms/ios/runner-transport.ts": {
471+
"src/platforms/apple/core/runner/runner-transport.ts": {
472472
"crap_high": {
473473
"count": 1
474474
}
475475
},
476-
"src/platforms/ios/runner-xctestrun.ts": {
476+
"src/platforms/apple/core/runner/runner-xctestrun.ts": {
477477
"complexity_moderate": {
478478
"count": 1
479479
}
480480
},
481-
"src/platforms/ios/screenshot-status-bar.ts": {
481+
"src/platforms/apple/core/screenshot-status-bar.ts": {
482482
"complexity_moderate": {
483483
"count": 1
484484
},
485485
"crap_moderate": {
486486
"count": 2
487487
}
488488
},
489-
"src/platforms/ios/screenshot.ts": {
489+
"src/platforms/apple/core/screenshot.ts": {
490490
"complexity_moderate": {
491491
"count": 1
492492
}
493493
},
494-
"src/platforms/ios/simulator.ts": {
494+
"src/platforms/apple/core/simulator.ts": {
495495
"crap_moderate": {
496496
"count": 1
497497
}
@@ -701,7 +701,7 @@
701701
"src/cli/commands/connection-runtime.ts:complexity",
702702
"src/daemon/context.ts:high impact",
703703
"src/utils/success-text.ts:high impact",
704-
"src/platforms/ios/apps.ts:complexity",
704+
"src/platforms/apple/core/apps.ts:complexity",
705705
"src/compat/maestro/runtime-targets.ts:high impact",
706706
"src/utils/timeouts.ts:high impact",
707707
"src/replay/script-utils.ts:high impact",

‎ios-runner/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@
353353
SWIFT_EMIT_LOC_STRINGS = YES;
354354
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
355355
SWIFT_VERSION = 5.0;
356-
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator";
357-
TARGETED_DEVICE_FAMILY = "1,2,3";
356+
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator xros xrsimulator";
357+
TARGETED_DEVICE_FAMILY = "1,2,3,7";
358358
TVOS_DEPLOYMENT_TARGET = 15.6;
359359
};
360360
name = Debug;
@@ -387,8 +387,8 @@
387387
SWIFT_EMIT_LOC_STRINGS = YES;
388388
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
389389
SWIFT_VERSION = 5.0;
390-
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator";
391-
TARGETED_DEVICE_FAMILY = "1,2,3";
390+
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator xros xrsimulator";
391+
TARGETED_DEVICE_FAMILY = "1,2,3,7";
392392
TVOS_DEPLOYMENT_TARGET = 15.6;
393393
};
394394
name = Release;
@@ -412,8 +412,8 @@
412412
SWIFT_OBJC_BRIDGING_HEADER = "AgentDeviceRunnerUITests/AgentDeviceRunnerUITests-Bridging-Header.h";
413413
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
414414
SWIFT_VERSION = 5.0;
415-
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator";
416-
TARGETED_DEVICE_FAMILY = "1,2,3";
415+
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator xros xrsimulator";
416+
TARGETED_DEVICE_FAMILY = "1,2,3,7";
417417
TVOS_DEPLOYMENT_TARGET = 15.6;
418418
TEST_TARGET_NAME = AgentDeviceRunner;
419419
};
@@ -438,8 +438,8 @@
438438
SWIFT_OBJC_BRIDGING_HEADER = "AgentDeviceRunnerUITests/AgentDeviceRunnerUITests-Bridging-Header.h";
439439
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
440440
SWIFT_VERSION = 5.0;
441-
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator";
442-
TARGETED_DEVICE_FAMILY = "1,2,3";
441+
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator xros xrsimulator";
442+
TARGETED_DEVICE_FAMILY = "1,2,3,7";
443443
TVOS_DEPLOYMENT_TARGET = 15.6;
444444
TEST_TARGET_NAME = AgentDeviceRunner;
445445
};

‎ios-runner/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,31 @@ - (void)viewDidLoad {
8282

8383
@end
8484

85+
#if defined(TARGET_OS_VISION) && TARGET_OS_VISION
86+
@interface AgentDeviceRunnerSceneDelegate : UIResponder <UIWindowSceneDelegate>
87+
@property(nonatomic, strong) UIWindow *window;
88+
@end
89+
90+
@implementation AgentDeviceRunnerSceneDelegate
91+
92+
- (void)scene:(UIScene *)scene
93+
willConnectToSession:(UISceneSession *)session
94+
options:(UISceneConnectionOptions *)connectionOptions {
95+
(void)session;
96+
(void)connectionOptions;
97+
98+
if (![scene isKindOfClass:UIWindowScene.class]) {
99+
return;
100+
}
101+
102+
self.window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];
103+
self.window.rootViewController = [[AgentDeviceRunnerViewController alloc] init];
104+
[self.window makeKeyAndVisible];
105+
}
106+
107+
@end
108+
#endif
109+
85110
@interface AgentDeviceRunnerAppDelegate : UIResponder <UIApplicationDelegate>
86111
@property(nonatomic, strong) UIWindow *window;
87112
@end
@@ -93,13 +118,33 @@ - (BOOL)application:(UIApplication *)application
93118
(void)application;
94119
(void)launchOptions;
95120

121+
#if defined(TARGET_OS_VISION) && TARGET_OS_VISION
122+
return YES;
123+
#else
96124
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
97125
self.window.rootViewController = [[AgentDeviceRunnerViewController alloc] init];
98126
[self.window makeKeyAndVisible];
99127

100128
return YES;
129+
#endif
101130
}
102131

132+
#if defined(TARGET_OS_VISION) && TARGET_OS_VISION
133+
- (UISceneConfiguration *)application:(UIApplication *)application
134+
configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession
135+
options:(UISceneConnectionOptions *)options {
136+
(void)application;
137+
(void)connectingSceneSession;
138+
(void)options;
139+
140+
UISceneConfiguration *configuration =
141+
[[UISceneConfiguration alloc] initWithName:@"Default Configuration"
142+
sessionRole:UIWindowSceneSessionRoleApplication];
143+
configuration.delegateClass = AgentDeviceRunnerSceneDelegate.class;
144+
return configuration;
145+
}
146+
#endif
147+
103148
@end
104149

105150
int main(int argc, char *argv[]) {

‎ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ extension RunnerTests {
122122
}
123123

124124
func rotateDevice(to orientationName: String) -> Bool {
125-
#if os(macOS) || os(tvOS)
125+
#if os(macOS) || os(tvOS) || os(visionOS)
126126
return false
127127
#else
128128
switch orientationName {

‎package.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,16 @@
7777
"clean:xcuitest:ios": "node scripts/clean-xcuitest-derived.mjs ios",
7878
"clean:xcuitest:macos": "node scripts/clean-xcuitest-derived.mjs macos",
7979
"clean:xcuitest:tvos": "node scripts/clean-xcuitest-derived.mjs tvos",
80+
"clean:xcuitest:visionos": "node scripts/clean-xcuitest-derived.mjs visionos",
8081
"build:node": "pnpm build && pnpm clean:daemon",
8182
"build:xcuitest": "pnpm build:xcuitest:ios && pnpm build:xcuitest:macos",
8283
"build:xcuitest:ios": "AGENT_DEVICE_XCUITEST_PLATFORM=ios sh ./scripts/build-xcuitest-apple.sh",
8384
"build:xcuitest:ios:clean": "pnpm clean:xcuitest:ios && pnpm build:xcuitest:ios",
8485
"build:xcuitest:macos": "AGENT_DEVICE_XCUITEST_PLATFORM=macos sh ./scripts/build-xcuitest-apple.sh",
8586
"build:xcuitest:tvos": "AGENT_DEVICE_XCUITEST_PLATFORM=tvos sh ./scripts/build-xcuitest-apple.sh",
8687
"build:xcuitest:tvos:clean": "pnpm clean:xcuitest:tvos && pnpm build:xcuitest:tvos",
88+
"build:xcuitest:visionos": "AGENT_DEVICE_XCUITEST_PLATFORM=visionos sh ./scripts/build-xcuitest-apple.sh",
89+
"build:xcuitest:visionos:clean": "pnpm clean:xcuitest:visionos && pnpm build:xcuitest:visionos",
8790
"build:android-snapshot-helper": "sh ./scripts/build-android-snapshot-helper.sh $(node -p \"require('./package.json').version\") .tmp/android-snapshot-helper",
8891
"package:android-snapshot-helper": "sh ./scripts/package-android-snapshot-helper.sh $(node -p \"require('./package.json').version\") v$(node -p \"require('./package.json').version\") .tmp/android-snapshot-helper",
8992
"package:android-snapshot-helper:npm": "rm -rf android-snapshot-helper/dist && sh ./scripts/package-android-snapshot-helper.sh $(node -p \"require('./package.json').version\") v$(node -p \"require('./package.json').version\") android-snapshot-helper/dist",
@@ -98,7 +101,6 @@
98101
"perf": "node --experimental-strip-types scripts/perf/run.ts",
99102
"perf:ios": "node --experimental-strip-types scripts/perf/run.ts --platform ios",
100103
"perf:android": "node --experimental-strip-types scripts/perf/run.ts --platform android",
101-
"validate:runner-count": "node --experimental-strip-types scripts/runner-request-count/run.ts",
102104
"lint": "oxlint . --deny-warnings",
103105
"format": "node ./node_modules/oxfmt/bin/oxfmt --write src test skills package.json tsconfig.json tsconfig.lib.json rslib.config.ts vitest.config.ts .github/actions/setup-node-pnpm/action.yml .oxlintrc.json .oxfmtrc.json '!test/skillgym/.skillgym-results/**'",
104106
"format:check": "node ./node_modules/oxfmt/bin/oxfmt --check src test skills package.json tsconfig.json tsconfig.lib.json rslib.config.ts vitest.config.ts .github/actions/setup-node-pnpm/action.yml .oxlintrc.json .oxfmtrc.json '!test/skillgym/.skillgym-results/**'",

0 commit comments

Comments
 (0)