base red: release-config test builds compile UiLayerPreviewTests

Merged
LA
5d ago
+13-4

swift build --build-tests -c release of Packages/macOS/CmuxNext has failed since fe5fcb878380 (#24978):

Tests/CmuxNextUiLayerPreviewTests/UiLayerPreviewTests.swift:6:20: error: cannot find 'UiLayerPreviewData' in scope

CmuxNextUiLayerPreview defines CMUX_UI_LAYER_PREVIEW only .when(configuration: .debug), and all of its source is inside #if CMUX_UI_LAYER_PREVIEW. In Release the library is empty, but its test target had no define and no guard. This stops every Release-config Swift suite step on the fleet (package-test-lane.sh suite with CMUX_SWIFT_SUITE_CONFIGURATION=release), for example jobs a836ea817d9250a196502b2b and 9d819957423526c18421578e.

Fix: the test target gets the same define with the same condition (one shared uiLayerPreviewDefine, so the two cannot drift), and the test file is inside #if CMUX_UI_LAYER_PREVIEW. In Release the test target builds with no tests. In Debug the test runs as before.

Why not move UiLayerPreviewData out of the guard: #24978 makes the preview leaf Debug-only on purpose. docs/cmux-next/native-ui-host.md says it "is compiled only in the Debug configuration ... not included in release app builds", and architecture-layers.json lists it as Debug-only. Its only consumer is the Debug Prototypes/UiLayerHost.

Changelog

none

Evidence

  • Red at base 2a822f8157d4: 7441c6241e1956e7e3c69ef2 (release-config suite build, KeepAwakePolicyTests, CMUX_SWIFT_SUITE_CONFIGURATION=release).
  • Green at head: f430149443470620d2a286e6 (same step).
  • Head compile-check (--app --package CmuxNext --recipe-version 2): ec318721bca96a6782e73a9d.

Observed / Not run

Observed: the base error in job a836ea817d9250a196502b2b's full log (line 3939, the error above); prepush-gate.py passed (no new violations). lint-ios-package-conventions.sh --namespace-fix reports one base error in a file this PR does not touch (CmuxNextAgentPane/AgentPaneHandoffPrompt.swift:11, namespace-type).
Not run: the Debug-config UiLayerPreviewTests run. It compiled at the head in job ec318721bca96a6782e73a9d; the test body did not change, only the guard was added around it.

No capture: build configuration and test guard only, no UI change.