Skip to content

ci: Set simulator boot wait for snapshot status bar override#120

Merged
philprime merged 2 commits intomainfrom
fix/snapshot-boot-timeout
Apr 22, 2026
Merged

ci: Set simulator boot wait for snapshot status bar override#120
philprime merged 2 commits intomainfrom
fix/snapshot-boot-timeout

Conversation

@philprime
Copy link
Copy Markdown
Member

CI screenshots were shipping with the real wall-clock time (e.g. 8:41, 8:43) instead of the expected 9:41. Snapshot prints on every run:

Waiting 0 seconds for device to fully boot before overriding status bar...
Set 'SNAPSHOT_SIMULATOR_WAIT_FOR_BOOT_TIMEOUT' environment variable to adjust timeout

With a 0s wait, xcrun simctl status_bar override runs against a not-yet-booted simulator, silently no-ops, and the real clock leaks into the screenshots.

Root cause is a bug in fastlane/snapshot itself (still unfixed in 2.233.0), in simulator_launcher_base.rb:129:

boot_sleep = ENV["SNAPSHOT_SIMULATOR_WAIT_FOR_BOOT_TIMEOUT"].to_i || 10

In Ruby nil.to_i == 0, and 0 || 10 evaluates to 0 because 0 is truthy. The documented 10-second default is actually 0 unless the env var is set.

Fix: set SNAPSHOT_SIMULATOR_WAIT_FOR_BOOT_TIMEOUT=30 on the CI job steps that invoke snapshot lanes (build-test.yml Screenshots job, release.yml Release step). Scoped to CI because hosted runners are slow; local Macs boot the simulator fast enough that the 0s wait rarely bites.

Worth reporting the Ruby truthiness bug upstream — one-liner fix like (ENV[...] || "10").to_i — but for now this is the right workaround.

CI screenshots were showing the real wall-clock time (e.g. 8:41, 8:43)
instead of the overridden 9:41. Snapshot prints on every run:

    Waiting 0 seconds for device to fully boot before overriding status bar...
    Set 'SNAPSHOT_SIMULATOR_WAIT_FOR_BOOT_TIMEOUT' environment variable to
    adjust timeout

With a 0s wait, `xcrun simctl status_bar override` runs against a
not-yet-booted simulator, silently no-ops, and the real clock leaks
into the screenshots.

Root cause is a bug in fastlane/snapshot itself (still unfixed in
2.233.0), in simulator_launcher_base.rb:129:

    boot_sleep = ENV["SNAPSHOT_SIMULATOR_WAIT_FOR_BOOT_TIMEOUT"].to_i || 10

In Ruby `nil.to_i == 0` and `0 || 10` is `0` (0 is truthy). So the
documented 10-second default is 0 unless the env var is set
explicitly.

Set SNAPSHOT_SIMULATOR_WAIT_FOR_BOOT_TIMEOUT=30 on the CI job steps
that run screenshot lanes. Scoped to CI because hosted runners are
slow; local Macs usually boot the simulator fast enough that the 0s
wait isn't a problem.
Comment thread .github/workflows/build-test.yml
@sentry
Copy link
Copy Markdown

sentry Bot commented Apr 22, 2026

📲 Install Builds

iOS

🔗 App Name App ID Version Configuration
Flinky com.techprimate.Flinky 1.1.3 (52) --

⚙️ flinky Build Distribution Settings

release-beta.yml also runs generate_and_upload_screenshots_ci and was
missed in the previous commit. Without this env var, the weekly
Monday 04:00 UTC beta uploads Sentry screenshots with the real wall-
clock time instead of the overridden 9:41.
@philprime philprime enabled auto-merge (squash) April 22, 2026 09:09
@philprime philprime merged commit f4078bb into main Apr 22, 2026
7 checks passed
@philprime philprime deleted the fix/snapshot-boot-timeout branch April 22, 2026 10:01
philprime added a commit that referenced this pull request Apr 22, 2026
_boot_simulator ran `xcrun simctl boot` and immediately returned, but
that command only kicks off the boot process — it doesn't wait for the
simulator to reach the home screen. On slow CI runners,
_override_status_bar would then race the boot and silently no-op,
leaking the real clock into screenshots (same class of bug that PR
#120 fixed in the snapshot action's path).

Add `xcrun simctl bootstatus <udid> -b` after `boot` to block until the
simulator is fully booted. This matches what fastlane/snapshot does in
simulator_launcher_base.rb:124.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant