Skip to content

ci(ios): fix rn-bare launch smoke log gaps and iOS debug e2e timeouts on hosted runners - #9541

Open
Mastersam07 wants to merge 9 commits into
mainfrom
ci/rn-bare-launch-smoke-log-gap
Open

Mastersam07 wants to merge 9 commits into
mainfrom
ci/rn-bare-launch-smoke-log-gap

Conversation

@Mastersam07

@Mastersam07 Mastersam07 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR fixes two iOS CI checks that failed for reasons unrelated to the code under test.

1. rn-bare launch smoke

test-rn-bare iOS build + launch smoke reported a launch failure when the app had launched. It read UIKit's own unified-log lines (Window did become application key, sceneOfRecord), and some self-hosted runners don't keep them, even in log show.

  • The test app's SceneDelegate now writes its own report (key window present, connected scene count, scene role) to a file in its data container. The smoke reads it with simctl get_app_container and requires one application scene with a key window.
  • UIKit's log lines are now a fallback only. A UIScene runtime issue (NoSceneLifecycleAdoption) still fails the run.
  • The smoke stops early and reports the exit when the app process dies.
  • JS deprecation warnings no longer read as "Firebase/init crash likely".
  • The report and log show output are uploaded with the launch-smoke logs on every run.

2. iOS debug e2e timeouts on GitHub-hosted runners

iOS (debug, 0) often hit its 107-minute limit on GitHub-hosted runners. On a saturated host, the app's first Metro bundle request timed out after 60 s, so its JS never loaded, and the harness then waited the full 20-minute stall window before retrying.

  • On iOS, the Jet exit stall guard now also aborts as a retryable stall when Jet shows no test output within RNFB_JET_FIRST_PROGRESS_MS (default 5 min) after launch. It is off on other platforms. The 20-minute overall window is unchanged. The guard now lives in tests/e2e/jetExitStallGuard.js, with unit tests.
  • tests_e2e_ios.yml turns off Spotlight indexing on GitHub-hosted runners, where it is the top CPU consumer.

Related issues

Release Summary

CI only; no user-facing change.

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
    • Other (macOS, web)
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan

  • yarn tests:jest --watchman=false packages/app/__tests__/iosProbeLaunchSmoke.test.js packages/app/__tests__/jetFirstProgressGuard.test.js packages/app/__tests__/jetExitStallGuard.test.js packages/app/__tests__/detoxLatencyPolicy.test.js
  • yarn test-rn-bare:ios:build
  • yarn lint:js
  • CI: test-rn-bare iOS build + launch smoke, its dynamic-probe job, and iOS (debug, 0) / iOS (release, 0) run on this PR.

Maintainer note: Fixes internal CPRN-694

@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.84%. Comparing base (a7d90e4) to head (f6f5ebd).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9541      +/-   ##
============================================
+ Coverage     75.79%   75.84%   +0.05%     
  Complexity     2361     2361              
============================================
  Files           637      639       +2     
  Lines         42452    42495      +43     
  Branches       5321     5321              
============================================
+ Hits          32172    32224      +52     
+ Misses         8715     8706       -9     
  Partials       1565     1565              
Flag Coverage Δ
android-native 71.00% <ø> (ø)
e2e-ts-android 53.90% <ø> (ø)
e2e-ts-ios 53.26% <ø> (ø)
e2e-ts-macos 49.63% <ø> (-<0.01%) ⬇️
ios-native 79.79% <ø> (+0.06%) ⬆️
ios-ruby 100.00% <ø> (ø)
jest 55.47% <100.00%> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Mastersam07 Mastersam07 closed this Dec 2, 2026
@Mastersam07 Mastersam07 reopened this Dec 3, 2026
@Mastersam07
Mastersam07 marked this pull request as draft December 3, 2026 10:20
…isses launch lines

On some self-hosted runners simctl log stream attaches late or drops the
launch burst, so the key-window and sceneOfRecord lines never reach the
capture although the app runs. Read missed markers back with log show,
end the poll early when the app pid exits, and treat a miss as a capture
gap only when the pid outlived the poll and Metro ran the app component.
Keep React Native JS warnings out of the Firebase crash hint.
@Mastersam07
Mastersam07 force-pushed the ci/rn-bare-launch-smoke-log-gap branch from ee5fd2b to 6185e24 Compare December 3, 2026 10:29
…ight on hosted runners

On saturated GitHub-hosted macOS runners the app's first Metro bundle
request can get no bytes for 60s, so iOS cancels it and the app's JS
never runs. Jet then prints no test output, and the await-exit stall
guard waited its full 20 minutes before retrying, pushing the debug job
past its 107-minute limit.

Abort the attempt as a retryable stall when Jet shows no test progress
within RNFB_JET_FIRST_PROGRESS_MS (default 5m) of launch-ready, and turn
off Spotlight indexing on GitHub-hosted iOS runners, where it is the top
CPU consumer during build and simulator boot.
@Mastersam07 Mastersam07 changed the title ci(app, ios): stop failing the rn-bare launch smoke when log stream misses launch lines ci(ios): fix rn-bare launch smoke log gaps and iOS debug e2e timeouts on hosted runners Dec 3, 2026
@Mastersam07 Mastersam07 closed this Dec 3, 2026
@Mastersam07
Mastersam07 deleted the ci/rn-bare-launch-smoke-log-gap branch December 3, 2026 10:55
@Mastersam07
Mastersam07 restored the ci/rn-bare-launch-smoke-log-gap branch December 3, 2026 10:57
@Mastersam07 Mastersam07 reopened this Dec 3, 2026
… capture gap

A launch smoke on main captured the app's launch burst and its
sceneOfRecord line but not "Window did become application key", while
the app was active, Metro had run it, and the screenshot showed it in
the foreground. The capture-gap pass only covered both markers missing.

Allow the gap pass whenever the key-window line is missing, still
requiring the app pid to outlive the poll, no early exit, and Metro's
Running line. A captured key-window line without sceneOfRecord and any
UIScene runtime issue still fail.
…ch smoke

The launch smoke decided pass or fail from UIKit's own unified-log lines
("Window did become application key", "sceneOfRecord"). Some CI hosts
keep neither line, even in log show, so the check fell back to "app
alive and Metro ran", which says nothing about the window or scene.

The test-rn-bare SceneDelegate now writes one RNFB_SMOKE_KEY_WINDOW line
with the connected scene count and scene role to stderr once its window
is key. The smoke launches with simctl launch --stderr and requires that
line to report one application scene. The UIKit lines remain a fallback
when the report is missing, the "app alive and Metro ran" pass is
removed, and a UIScene runtime issue still fails the run. Failed runs
upload the app's stderr with the other launch-smoke logs.
…err held

On both rn-bare CI smokes the app's RNFB_SMOKE_KEY_WINDOW line was
missing from the --stderr file, so the runs passed on the UIKit fallback.

Report from any key window in the scene, not only the delegate's own
window, and always write an RNFB_SMOKE_SCENE_ACTIVE line so a run shows
whether stderr capture works. The smoke now waits up to
RNFB_TEST_RN_BARE_APP_REPORT_GRACE_SEC (10s) for the report after the
UIKit lines, logs the stderr file's size and first lines, and uploads
the launch-smoke logs on every run.
…container

On CI, simctl launch --stderr never created its file, so the app's
report was lost and a run whose unified log also dropped the UIKit lines
failed although the app launched.

SceneDelegate now appends its RNFB_SMOKE_SCENE_ACTIVE and
RNFB_SMOKE_KEY_WINDOW lines to tmp/rnfb-smoke-report.txt in its data
container. The smoke finds that file with simctl get_app_container,
clears it before launch, polls it, and keeps a copy next to the launch
log for the CI artifact.
@Mastersam07
Mastersam07 marked this pull request as ready for review December 4, 2026 09:08

@russellwheatley russellwheatley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, CI is green and the app report is a nicer signal than the UIKit log lines. A few small things inline.

if app_report_seen && (( SECONDS - LAUNCHED_AT >= 3 )); then
break
fi
if launch_logs | grep -Eq "$SCENE_IPS_PATTERN"; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This went from grep -Ei to grep -Eq, so the runtime-issue match is case-sensitive now (same at line 327). Probably fine for this exact UIKit string, but might be worth grep -Eiq in both places to keep the old behaviour and match the CONTAINS[c] in the log show predicate. A test feeding a lowercased nosceneLifecycleAdoption line would keep it covered.

@Mastersam07 Mastersam07 Dec 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both places are back to grep -Eiq, and I dropped the launch_logs | grep -q pipe, since under pipefail the SIGPIPE could hide a match. Added a test with a lowercase nosceneLifecycleAdoption line. Fixed in 2483029.

Comment thread tests/e2e/firebase.test.js Outdated
async function awaitJetExitWithStallGuard(
jetSession,
stallMs = jetAwaitExitStallTimeoutMs(),
firstProgressMs = jetFirstProgressTimeoutMs(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awaitJetExitWithStallGuard is on the shared Detox path, so the 5 min first-progress abort applies to Android cells too, not just iOS. If that's not intended, maybe pass firstProgressMs = 0 when platform !== 'ios' and have startJetFirstProgressWatch no-op on timeoutMs <= 0 (plus a NEGATIVE test for that). If it is intended, I think the PR description and the RNFB_JET_FIRST_PROGRESS_MS row in running-e2e.md should say it covers Android as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not intended; the evidence is iOS-only. jetFirstProgressTimeoutMs(platform) now returns 0 off iOS, and the watch is a no-op for a timeout of 0 or less. There are tests for both, including Android staying off when RNFB_JET_FIRST_PROGRESS_MS is set. running-e2e.md now says iOS only. Fixed in 2483029.

expect(onStall).not.toHaveBeenCalled();
});

it('firebase.test.js stall guard starts and stops the first-progress watch with a retryable stall message', function () {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This regex-matches firebase.test.js source, so a rename breaks it without any behaviour change. Might be worth moving awaitJetExitWithStallGuard into its own module like tests/e2e/jetExitIgnoreKill.js and testing it with fake timers and a fake jetSession: no title rejects with retryableAtJetLevel, title seen leaves only the 20m stall, and exitPromise resolving first clears both timers. Fine as a follow-up if you'd rather not do it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done here. The guard moved to tests/e2e/jetExitStallGuard.js, and jetExitStallGuard.test.js drives it with fake timers and a fake session: no title rejects with retryableAtJetLevel, title seen leaves only the 20m stall, exitPromise first clears both timers, plus the firstProgressMs = 0 and Jet-error cases. The source regex test is gone. Fixed in 2483029.

…e stall guard directly

The first-progress watch ran on the shared Detox path, so it also aborted
Android cells after 5 minutes without test output, although the first
bundle timeout it catches was only seen on iOS simulators.
jetFirstProgressTimeoutMs now returns 0 (off) for non-iOS platforms and
the watch is a no-op for a non-positive timeout.

Move awaitJetExitWithStallGuard into tests/e2e/jetExitStallGuard.js and
test it with fake timers and a fake Jet session instead of matching the
firebase.test.js source.

Match the launch smoke's UIScene runtime-issue pattern case-insensitively
again, as before, and stop piping launch_logs into grep -q under
pipefail.
…ke-log-gap

# Conflicts:
#	okf-bundle/testing/running-e2e.md

This branch has not been deployed

No deployments
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.

2 participants