Fix UI test harness validation: make startPath optional

The CI display helper now uses --start-delay-ms instead of --start-path
because the XCTest sandbox prevents writing to /tmp/. The harness manifest
no longer includes startPath, but the test guard still required it, causing
"Incomplete external display harness configuration" errors.

Make startPath optional in both the manifest and environment variable
harness loading paths, and gate the start signal write on displayStartPath
being non-empty.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
austinpower1258 2026-03-23 04:26:30 -07:00
parent 82a9ccf218
commit 81aaa8e2d0

View file

@ -84,7 +84,8 @@ final class DisplayResolutionRegressionUITests: XCTestCase {
// When pre-launched from CI, the display helper uses --start-delay-ms
// instead of a start signal file (sandbox prevents writing to /tmp/).
if prelaunch == nil {
// displayStartPath is empty when the harness manifest omits startPath.
if prelaunch == nil && !displayStartPath.isEmpty {
do {
try Data("start\n".utf8).write(to: URL(fileURLWithPath: displayStartPath), options: .atomic)
} catch {
@ -153,7 +154,6 @@ final class DisplayResolutionRegressionUITests: XCTestCase {
}
guard let readyPath = externalHarness.readyPath, !readyPath.isEmpty,
let displayIDPath = externalHarness.displayIDPath, !displayIDPath.isEmpty,
let startPath = externalHarness.startPath, !startPath.isEmpty,
let donePath = externalHarness.donePath, !donePath.isEmpty else {
throw NSError(domain: "DisplayResolutionRegressionUITests", code: 3, userInfo: [
NSLocalizedDescriptionKey: "Incomplete external display harness configuration"
@ -161,7 +161,13 @@ final class DisplayResolutionRegressionUITests: XCTestCase {
}
displayReadyPath = readyPath
self.displayIDPath = displayIDPath
displayStartPath = startPath
// startPath is optional CI uses --start-delay-ms instead of a start
// signal file because the XCTest sandbox can't write to /tmp/.
if let startPath = externalHarness.startPath, !startPath.isEmpty {
displayStartPath = startPath
} else {
displayStartPath = ""
}
displayDonePath = donePath
if let logPath = externalHarness.logPath, !logPath.isEmpty {
helperLogPath = logPath
@ -184,7 +190,6 @@ final class DisplayResolutionRegressionUITests: XCTestCase {
private func loadExternalHarnessFromEnvironment(_ env: [String: String]) -> ExternalDisplayHarness? {
guard let readyPath = env["CMUX_UI_TEST_DISPLAY_READY_PATH"], !readyPath.isEmpty,
let displayIDPath = env["CMUX_UI_TEST_DISPLAY_ID_PATH"], !displayIDPath.isEmpty,
let startPath = env["CMUX_UI_TEST_DISPLAY_START_PATH"], !startPath.isEmpty,
let donePath = env["CMUX_UI_TEST_DISPLAY_DONE_PATH"], !donePath.isEmpty else {
return nil
}
@ -192,7 +197,7 @@ final class DisplayResolutionRegressionUITests: XCTestCase {
return ExternalDisplayHarness(
readyPath: readyPath,
displayIDPath: displayIDPath,
startPath: startPath,
startPath: env["CMUX_UI_TEST_DISPLAY_START_PATH"],
donePath: donePath,
logPath: env["CMUX_UI_TEST_DISPLAY_LOG_PATH"],
helperBinaryPath: nil