Skip to content

Commit 6b2a901

Browse files
iOS inner loop: detect physical device BEFORE signing artifacts on device path
The device-job branch was running find_and_stage_signing_artifacts() first, then detect_physical_device() second. On Mac.iPhone.13.Perf the signing artifacts are missing, so the work item bails before logging anything about what physical hardware is (or isn't) attached. Result: when a human asks 'what iPhone is on that queue?' the only answer in the logs is 'we never checked'. Reorder so physical-device detection runs first (its own loud failure banner) and signing-artifact discovery runs after (its own loud failure banner). Both gates check independent infrastructure — a disconnected iPhone vs missing keychain materials — and surface independently. Now the device log always shows what hardware 'xcrun devicectl list devices' returned, regardless of signing state. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c97143d commit 6b2a901

1 file changed

Lines changed: 37 additions & 32 deletions

File tree

src/scenarios/mauiiosinnerloop/setup_helix.py

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,43 @@ def main():
12341234
create_and_boot_simulator(workitem_root)
12351235

12361236
if is_physical_device:
1237+
# Order matters: detect the physical device FIRST, signing artifacts
1238+
# SECOND. Both gates check independent infra (one is hardware on the
1239+
# USB hub, the other is files in the keychain / on disk), and either
1240+
# can fail by itself. Detecting the device first means the log always
1241+
# shows what hardware the queue exposed regardless of signing state,
1242+
# which is what humans actually need to debug a red work item.
1243+
1244+
# Detect and validate the connected physical device. We require one;
1245+
# there is NO fallback to the simulator on a device job. A green
1246+
# device job MUST mean device measurements ran on real hardware,
1247+
# never that we silently downgraded to a simulator.
1248+
device_udid = detect_physical_device()
1249+
if not device_udid:
1250+
reason = (
1251+
"No physical iOS device detected on this Helix machine. "
1252+
"Device job requires a connected, paired iPhone — there is "
1253+
"NO simulator fallback by design. This is a queue "
1254+
"provisioning gap (device disconnected, not paired, or "
1255+
"queue capacity issue), not a scenario bug. Verify the "
1256+
"Mac.iPhone.13.Perf machine has its iPhone connected and "
1257+
"paired (xcrun devicectl list devices)."
1258+
)
1259+
log_raw("=" * 70, tee=True)
1260+
log_raw("WORK ITEM FAILED — NO PHYSICAL DEVICE", tee=True)
1261+
log_raw("=" * 70, tee=True)
1262+
log(reason, tee=True)
1263+
log_raw("=" * 70, tee=True)
1264+
_dump_log()
1265+
sys.exit(1)
1266+
1267+
# Log the detected UDID for diagnostics. Note: os.environ changes
1268+
# in this Python process do NOT persist to subsequent Helix commands
1269+
# (test.py, post.py). runner.py re-detects the device independently
1270+
# via iOSHelper.detect_connected_device().
1271+
os.environ["IOS_DEVICE_UDID"] = device_udid
1272+
log(f"IOS_DEVICE_UDID detected: {device_udid}", tee=True)
1273+
12371274
# Search for embedded.mobileprovision and 'sign' tool on the
12381275
# Helix machine and stage them so ioshelper.py's signing flow
12391276
# can find them.
@@ -1266,38 +1303,6 @@ def main():
12661303
log_raw("=" * 70, tee=True)
12671304
_dump_log()
12681305
sys.exit(1)
1269-
1270-
# Detect and validate the connected physical device. We require one;
1271-
# there is NO fallback to the simulator on a device job. A green
1272-
# device job MUST mean device measurements ran on real hardware,
1273-
# never that we silently downgraded to a simulator. Fail fast and
1274-
# loud here so a missing/disconnected device shows up as a queue
1275-
# provisioning bug, not as 5 minutes of wasted dotnet build before
1276-
# runner.py finally raises during install.
1277-
device_udid = detect_physical_device()
1278-
if not device_udid:
1279-
reason = (
1280-
"No physical iOS device detected on this Helix machine. "
1281-
"Device job requires a connected, paired iPhone — there is "
1282-
"NO simulator fallback by design. This is a queue "
1283-
"provisioning gap (device disconnected, not paired, or "
1284-
"queue capacity issue), not a scenario bug. Verify the "
1285-
"Mac.iPhone.13.Perf machine has its iPhone connected and "
1286-
"paired (xcrun devicectl list devices)."
1287-
)
1288-
log_raw("=" * 70, tee=True)
1289-
log_raw("WORK ITEM FAILED — NO PHYSICAL DEVICE", tee=True)
1290-
log_raw("=" * 70, tee=True)
1291-
log(reason, tee=True)
1292-
log_raw("=" * 70, tee=True)
1293-
_dump_log()
1294-
sys.exit(1)
1295-
1296-
# Log the detected UDID for diagnostics. Note: os.environ changes
1297-
# in this Python process do NOT persist to subsequent Helix commands
1298-
# (test.py, post.py). runner.py re-detects the device independently
1299-
# via iOSHelper.detect_connected_device().
1300-
os.environ["IOS_DEVICE_UDID"] = device_udid
13011306
log(f"IOS_DEVICE_UDID detected: {device_udid}", tee=True)
13021307

13031308
# Step 5: Install the maui-ios workload

0 commit comments

Comments
 (0)