From 81aaa8e2d0a4ecee30af594d73113163053de313 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Mon, 23 Mar 2026 04:26:30 -0700 Subject: [PATCH] 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 --- .../DisplayResolutionRegressionUITests.swift | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cmuxUITests/DisplayResolutionRegressionUITests.swift b/cmuxUITests/DisplayResolutionRegressionUITests.swift index 2b3ef233..a4dd9620 100644 --- a/cmuxUITests/DisplayResolutionRegressionUITests.swift +++ b/cmuxUITests/DisplayResolutionRegressionUITests.swift @@ -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