Skip to content

Commit 17ae6b1

Browse files
committed
fix(ios-runner): resolve the full-screen review — one fallback formula, one rule block, one nightly job
- Drop the frame.minY > 1 branch so one inset-based formula serves every back route (a minY+22 point on a windowed iPad is the window-controls strip). - Set the probe's loggedFills flag only in the fills-screen case so a first windowed answer cannot hide the line the nightly grep reads. - Share the foreground-ownership and frame-fill rule between the runner bridge and the snapshot bridge as one byte-identical block, pinned equal by test/repo-guards/full-screen-rule-parity.test.ts; delete both copies. - Early-return on the phone idiom so RunnerFullScreenEvidenceUnknown keeps one meaning. - Reuse the nightly full-suite job for the iPad leg via its matrix instead of a parallel job; rename the back fixture test to what it now proves and delete the stale iPad-refuses doc lines.
1 parent 5eed73e commit 17ae6b1

8 files changed

Lines changed: 225 additions & 197 deletions

File tree

‎.github/workflows/xctest-nightly.yml‎

Lines changed: 61 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,25 @@ concurrency:
2020

2121
jobs:
2222
full-suite:
23-
name: iOS Runner Full XCTest Suite
23+
name: iOS Runner Full XCTest Suite (${{ matrix.leg.name }})
2424
runs-on: macos-26
2525
timeout-minutes: 45
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
leg:
30+
# Both legs share the toolchain, the runner build cache, and the artifact steps above.
31+
# The full suite runs on an iPhone, where the sole-screen rule is decided by the idiom
32+
# alone. The iPad leg boots an iPad and runs only the sole-screen tests: the iPad half
33+
# of the rule — the route opens only while the in-process full-screen evidence proves
34+
# the app fills its screen — can execute nowhere else, and the evidence line that probe
35+
# prints is what turns a revert to idiom-only routing red instead of silently green.
36+
- name: iPhone full suite
37+
device-name: iPhone 17 Pro
38+
lane: nightly
39+
- name: iPad sole-screen evidence
40+
device-name: iPad Pro 11-inch (M4)
41+
lane: nightly-ipad
2642
env:
2743
# Must match apple.yml. The runtime version rides in the derived-data cache key, and
2844
# AGENT_DEVICE_XCUITEST_INCLUDE_UNIT_TESTS is BOTH an input to the cache's build-variant
@@ -38,7 +54,7 @@ jobs:
3854
AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH: ${{ github.workspace }}/.tmp/ios-runner-derived
3955
RESULT_BUNDLE_PATH: ${{ github.workspace }}/.tmp/xctest-nightly/RunnerTests.xcresult
4056
RESULT_SUMMARY_PATH: ${{ github.workspace }}/.tmp/xctest-nightly/test-results-summary.json
41-
XCTEST_LANE: nightly
57+
XCTEST_LANE: ${{ matrix.leg.lane }}
4258
steps:
4359
- name: Checkout
4460
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -67,7 +83,7 @@ jobs:
6783
uses: ./.github/actions/boot-ios-test-simulator
6884
with:
6985
runtime-version: ${{ env.IOS_RUNTIME_VERSION }}
70-
preferred-device-name: iPhone 17 Pro
86+
preferred-device-name: ${{ matrix.leg.device-name }}
7187

7288
# Same command as apple.yml's targeted step minus every `-only-testing:` flag, so the
7389
# xctestrun's own test plan decides what runs — with one exception.
@@ -84,6 +100,7 @@ jobs:
84100
# A typo in that identifier silently re-arms the hang, so
85101
# `pnpm check:xctest-selection` validates `-skip-testing:` exactly like `-only-testing:`.
86102
- name: Run the full iOS runner XCTest suite
103+
if: matrix.leg.lane == 'nightly'
87104
run: |
88105
set -euo pipefail
89106
XCTESTRUN_PATH="$(find "$AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH/Build/Products" -maxdepth 1 -name '*.xctestrun' -print -quit)"
@@ -102,6 +119,45 @@ jobs:
102119
}
103120
'
104121
122+
# The iPad leg's liveness check is its own grep below: it runs a named selection, not the
123+
# whole bundle, so the count assertion the full-suite leg makes does not apply to it. The
124+
# boot action falls back to any simulator when the preferred name is missing, so this step
125+
# proves it booted the iPad that leg claims — the evidence line can only come from one.
126+
- name: Run the sole-screen tests on iPad
127+
if: matrix.leg.lane == 'nightly-ipad'
128+
run: |
129+
set -euo pipefail
130+
UDID='${{ steps.ios-simulator.outputs.simulator-udid }}'
131+
xcrun simctl list devices -j | node -e '
132+
const fs = require("node:fs");
133+
const udid = process.argv[1];
134+
const payload = JSON.parse(fs.readFileSync(0, "utf8"));
135+
const device = Object.values(payload.devices ?? {})
136+
.flat()
137+
.find((entry) => entry.udid === udid);
138+
if (!device?.name?.startsWith("iPad")) {
139+
console.error(`Booted ${device?.name ?? udid}; this leg needs an iPad simulator`);
140+
process.exit(1);
141+
}
142+
' "$UDID"
143+
XCTESTRUN_PATH="$(find "$AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH/Build/Products" -maxdepth 1 -name '*.xctestrun' -print -quit)"
144+
test -n "$XCTESTRUN_PATH"
145+
xcodebuild test-without-building \
146+
-xctestrun "$XCTESTRUN_PATH" \
147+
-destination "platform=iOS Simulator,id=$UDID" \
148+
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testLongPressOnAnUnserializableTreeIsSynthesizedOnTheSoleScreen \
149+
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testGestureViewportOnAnUnserializableTreeIsTheSoleScreen \
150+
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testSoleScreenDisplayIDIsNamedOnlyForAnAppThatFillsItsScreen \
151+
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testInAppBackVerifiesSoleScreenWhenXCTestCannotReadFramesOrEnumerate \
152+
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testInAppBackAfterARejectedQueryTapsThroughTheRouteThatOpens \
153+
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testRankedInAppBackUsesSynthesisWithoutXCTestTap \
154+
2>&1 | tee .tmp/xctest-nightly/runner.log
155+
# The probe prints this line only when a non-phone idiom asks it. Its absence means the
156+
# iPad never probed (a revert to idiom-only routing), not that a test failed.
157+
grep -q 'AGENT_DEVICE_RUNNER_FULL_SCREEN_EVIDENCE result=fills-screen' \
158+
.tmp/xctest-nightly/runner.log \
159+
|| { echo 'The iPad sole-screen route never produced full-screen evidence.'; exit 1; }
160+
105161
# Best-effort and never the job's verdict on its own; the step below is what asserts.
106162
# `--compact` first because a red night's summary is the large one, and the job summary
107163
# has a 1 MiB cap — the plain form is the fallback if an Xcode version rejects the flag.
@@ -126,7 +182,7 @@ jobs:
126182
# as red too. The failure list is capped so a badly red night cannot blow the 1 MiB
127183
# job-summary limit and lose the headline with it.
128184
- name: Report the run and assert the source-derived count
129-
if: always()
185+
if: always() && matrix.leg.lane == 'nightly'
130186
run: |
131187
set -euo pipefail
132188
if [ ! -s "$RESULT_SUMMARY_PATH" ]; then
@@ -142,96 +198,7 @@ jobs:
142198
if: always()
143199
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
144200
with:
145-
name: xctest-nightly-results-${{ github.run_id }}-${{ github.run_attempt }}
201+
name: xctest-nightly-${{ matrix.leg.lane }}-${{ github.run_id }}-${{ github.run_attempt }}
146202
include-hidden-files: true
147203
path: .tmp/xctest-nightly
148204
if-no-files-found: warn
149-
150-
# The full suite above runs on an iPhone, where the sole-screen rule is decided by the idiom
151-
# alone. The iPad half of the rule — the route opens only while the in-process full-screen
152-
# evidence proves the app fills its screen — can only execute on an iPad. This leg boots one,
153-
# runs the sole-screen tests, and asserts the evidence line the probe prints: no other lane can
154-
# emit it, so a revert to idiom-only routing turns this red instead of silently green.
155-
ipad-sole-screen:
156-
name: iOS Runner Sole-Screen Evidence (iPad)
157-
runs-on: macos-26
158-
timeout-minutes: 30
159-
env:
160-
# Byte-identical inputs to the job above, so both restore the same runner cache entry.
161-
IOS_RUNTIME_VERSION: '26.2'
162-
AGENT_DEVICE_XCUITEST_ARCHS: 'arm64'
163-
AGENT_DEVICE_XCUITEST_INCLUDE_UNIT_TESTS: '1'
164-
AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH: ${{ github.workspace }}/.tmp/ios-runner-derived
165-
steps:
166-
- name: Checkout
167-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
168-
169-
- name: Setup toolchain
170-
uses: ./.github/actions/setup-node-pnpm
171-
with:
172-
cache-dependency-path: |
173-
pnpm-lock.yaml
174-
examples/test-app/pnpm-lock.yaml
175-
176-
- name: Restore and build iOS XCTest runner
177-
uses: ./.github/actions/setup-apple-runner-build
178-
with:
179-
derived-path: ${{ env.AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH }}
180-
cache-key-prefix: ios-runner-prebuilt
181-
cache-key-suffix: -ios-${{ env.IOS_RUNTIME_VERSION }}-arm64
182-
gate: swift-runner-ios
183-
xcuitest-platform: ios
184-
xcuitest-destination: generic/platform=iOS Simulator
185-
186-
- name: Boot iPad test simulator
187-
id: ipad-simulator
188-
uses: ./.github/actions/boot-ios-test-simulator
189-
with:
190-
runtime-version: ${{ env.IOS_RUNTIME_VERSION }}
191-
preferred-device-name: iPad Pro 11-inch (M4)
192-
193-
- name: Run the sole-screen tests on iPad
194-
run: |
195-
set -euo pipefail
196-
UDID='${{ steps.ipad-simulator.outputs.simulator-udid }}'
197-
# The boot action falls back to any simulator when the preferred name is missing. This
198-
# leg proves an iPad-only rule, so a non-iPad fallback must fail here, not at the grep.
199-
xcrun simctl list devices -j | node -e '
200-
const fs = require("node:fs");
201-
const udid = process.argv[1];
202-
const payload = JSON.parse(fs.readFileSync(0, "utf8"));
203-
const device = Object.values(payload.devices ?? {})
204-
.flat()
205-
.find((entry) => entry.udid === udid);
206-
if (!device?.name?.startsWith("iPad")) {
207-
console.error(`Booted ${device?.name ?? udid}; this leg needs an iPad simulator`);
208-
process.exit(1);
209-
}
210-
' "$UDID"
211-
XCTESTRUN_PATH="$(find "$AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH/Build/Products" -maxdepth 1 -name '*.xctestrun' -print -quit)"
212-
test -n "$XCTESTRUN_PATH"
213-
mkdir -p .tmp/xctest-nightly-ipad
214-
xcodebuild test-without-building \
215-
-xctestrun "$XCTESTRUN_PATH" \
216-
-destination "platform=iOS Simulator,id=${{ steps.ipad-simulator.outputs.simulator-udid }}" \
217-
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testLongPressOnAnUnserializableTreeIsSynthesizedOnTheSoleScreen \
218-
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testGestureViewportOnAnUnserializableTreeIsTheSoleScreen \
219-
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testSoleScreenDisplayIDIsNamedOnlyForAnAppThatFillsItsScreen \
220-
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testInAppBackVerifiesSoleScreenWhenXCTestCannotReadFramesOrEnumerate \
221-
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testInAppBackStillAsksForWindowsWhereNoSoleScreenAnswers \
222-
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testRankedInAppBackUsesSynthesisWithoutXCTestTap \
223-
2>&1 | tee .tmp/xctest-nightly-ipad/runner.log
224-
# The probe prints this line only when a non-phone idiom asks it. Its absence means the
225-
# iPad never probed (a revert to idiom-only routing), not that a test failed.
226-
grep -q 'AGENT_DEVICE_RUNNER_FULL_SCREEN_EVIDENCE result=fills-screen' \
227-
.tmp/xctest-nightly-ipad/runner.log \
228-
|| { echo 'The iPad sole-screen route never produced full-screen evidence.'; exit 1; }
229-
230-
- name: Upload iPad log
231-
if: always()
232-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
233-
with:
234-
name: xctest-nightly-ipad-${{ github.run_id }}-${{ github.run_attempt }}
235-
include-hidden-files: true
236-
path: .tmp/xctest-nightly-ipad
237-
if-no-files-found: warn

‎apple/runner/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m‎

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -666,25 +666,15 @@ - (void)viewDidLoad {
666666
self.navigationBackStatus = label;
667667
label.accessibilityIdentifier = @"agent-device-back-status";
668668
if ([NSProcessInfo.processInfo.arguments containsObject:@"--navigation-bar"]) {
669-
// Same band rule as the plain fixture below: the bar sits under the screen's own top inset,
670-
// which differs by family (59 pt on an iPhone 17 Pro, 32 pt on an iPad Pro), so the bar
671-
// anchors to the safe-area top instead of a hardcoded iPhone y.
672-
UINavigationBar *bar = [[UINavigationBar alloc] init];
673-
bar.translatesAutoresizingMaskIntoConstraints = NO;
669+
UINavigationBar *bar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 62, self.view.bounds.size.width, 44)];
674670
UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:@"Thread"];
675671
item.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Go back" style:UIBarButtonItemStylePlain target:self action:@selector(navigationBackPressed)];
676672
bar.items = @[item];
677673
[self.view addSubview:bar];
678-
[NSLayoutConstraint activateConstraints:@[
679-
[bar.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor],
680-
[bar.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor],
681-
[bar.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor],
682-
[bar.heightAnchor constraintEqualToConstant:44],
683-
]];
684674
} else {
685-
// The bar band sits under the screen's own top inset, which differs by family (59 pt on an
686-
// iPhone 17 Pro, 32 pt on an iPad Pro). Pinning the control to the safe-area top keeps this
687-
// fixture inside the band the fallback aims at, on either idiom.
675+
// The control sits in the top bar band, whose height above the content differs by family
676+
// (59 pt on an iPhone 17 Pro, 32 pt on an iPad Pro), so it anchors to the safe-area top
677+
// instead of a hardcoded iPhone y.
688678
UIButton *back = [UIButton buttonWithType:UIButtonTypeSystem];
689679
back.translatesAutoresizingMaskIntoConstraints = NO;
690680
[back setTitle:@"Go back" forState:UIControlStateNormal];

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,8 @@ extension RunnerTests {
183183
/// directly under the top inset of the frame the tap lands in. A fraction of the frame height
184184
/// cannot serve both families — an iPhone 17 Pro measures a 59-pt inset with its bar at y 62-116,
185185
/// while an iPad Pro 11" measures 32 with its bar at y 32-86, where the iPhone's height-derived 96
186-
/// lands below the bar. `22` is half of UIKit's standard 44-pt top bar. The screen's inset counts
187-
/// only when the frame starts at the screen's own top (the sole-screen route and a maximized
188-
/// window); a window that starts below the screen top places its bar at its own top instead. The
189-
/// bounds keep a runtime that reports no inset inside a plausible bar, and a large inset from
190-
/// leaving it.
186+
/// lands below the bar. `22` is half of UIKit's standard 44-pt top bar. The bounds keep a runtime
187+
/// that reports no inset inside a plausible bar, and a large inset from leaving it.
191188
static func topLeadingNavigationFallbackPoint(
192189
in frame: CGRect,
193190
topSafeAreaInset: CGFloat
@@ -197,11 +194,6 @@ extension RunnerTests {
197194
}
198195
// Aim at the standard leading navigation slot, bounded for compact and tablet widths.
199196
let xOffset = min(max(frame.width * 0.08, 28), 44)
200-
// A screen-top frame takes the screen's inset and the band bounds; a window that starts lower
201-
// places its bar at its own top, so the point centers a standard bar there instead.
202-
if frame.minY > 1 {
203-
return CGPoint(x: frame.minX + xOffset, y: frame.minY + 22)
204-
}
205197
let yOffset = min(max(topSafeAreaInset + 22, 56), 96)
206198
return CGPoint(x: frame.minX + xOffset, y: frame.minY + yOffset)
207199
}

0 commit comments

Comments
 (0)