fix(ios): fail the screenshot capture on the language that captures nothing

Merged
TE
2mo ago
+109-0

Release run 35225939389 (v0.64.25) spent 47 minutes failing, and the message it ended on named the wrong file:

no localized raws in ios/fastlane/screenshots; run capture first
[!] Exit status of command 'python3 .../propagate_locales.py ...' was 1 instead of 0.

Anyone reading the tail of that log concludes propagate_locales.py is broken. The real error was 18 identical copies of a Swift compile failure much earlier:

Cannot find 'GhosttySurfaceWorkQueue' in scope
Testing cancelled because the build failed.
** TEST FAILED **   Exit status: 65
  SwiftCompile normal arm64 .../CmuxMobileTerminalTests/GhosttySurfaceWorkQueueTests.swift

At v0.64.25 that test file began import Foundation / import Testing and nothing else — no @testable import CmuxMobileTerminal — so the type was genuinely out of scope.

Why one broken test target stops every screenshot

The lane passes no testplan:, deliberately, and says so: with -testPlan the UI test runs and passes but fastlane collects zero screenshots. The plain cmux-ios scheme invocation is the known-good path, and it requires every test target in the scheme's default plan to at least compile.

capture_screenshots does not raise when that build fails. It records the failure and returns. So the lane worked through all nine languages on two devices, each with a retry, capturing nothing every time, and the failure only surfaced at the end from the frame lane — pointing at the propagate script.

Resulting behavior

The lane counts the screenshots on disk across each capture and stops at the first language that produced none, naming the precondition and pointing at exit status 65. A compile error now fails in roughly the time of one language instead of eighteen doomed builds, with a message that names the actual cause.

Nothing else changes: no triggers, no devices, no languages, no testplan.

Scope

The missing import is already fixed on main by 0251a448c9 (2026-09-20), and origin/main now has import os + @testable import CmuxMobileTerminal. The next release cut from main should pass this step. This pull request is about the 47 minutes and the misleading message, which will otherwise repeat the next time any test target in that scheme stops compiling.

Validation

Two commits, per the repository's regression policy:

  1. 7474982 adds tests/test_ios_screenshot_capture_guard.py only — fails against the current Fastfile on two assertions.
  2. 39f94d8 applies the fix — passes.

The test also runs ruby -c on the Fastfile wherever a Ruby is on PATH, and says so explicitly when it skips. Verified locally against ruby 3.3.8: ruby -c ios/fastlane/Fastfile reports Syntax OK, and the guard test exercises that path rather than skipping it.

(An earlier revision of this description said the syntax was unverified because this machine had no Ruby. It now does, and it is verified.)

A gap this does not close, and cannot close the obvious way

Nothing in pull-request CI compiles CmuxMobileTerminalTests. The SwiftPM gate in .github/workflows/ci-macos.yml has an explicit PACKAGES=(...) allowlist, and CmuxMobileTerminal is not in it, so a broken test target there is first discovered by the screenshot lane 47 minutes into a release.

Adding it to that allowlist does not work, and I want to record why so nobody tries it: that gate runs swift test on macOS, and CmuxMobileTerminal declares platforms: [.iOS(.v17)] with 39 of its 83 sources importing UIKit. The two mobile packages that are in the allowlist, CmuxMobileTerminalKit and CmuxMobileWorkspace, both declare .macOS(.v14) as well and import UIKit in zero files. The omission is correct, not an oversight.

Closing the gap properly needs an iOS-simulator build of that package — a real cost decision, and a separate change.

🤖 Generated with Claude Code