Repository navigation
ci(ios): fix rn-bare launch smoke log gaps and iOS debug e2e timeouts on hosted runners - #9541
Mastersam07 wants to merge 9 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
…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.
ee5fd2b to
6185e24
Compare
…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.
… 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.
russellwheatley
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| async function awaitJetExitWithStallGuard( | ||
| jetSession, | ||
| stallMs = jetAwaitExitStallTimeoutMs(), | ||
| firstProgressMs = jetFirstProgressTimeoutMs(), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 () { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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 smokereported 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 inlog show.SceneDelegatenow writes its own report (key window present, connected scene count, scene role) to a file in its data container. The smoke reads it withsimctl get_app_containerand requires one application scene with a key window.NoSceneLifecycleAdoption) still fails the run.log showoutput 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.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 intests/e2e/jetExitStallGuard.js, with unit tests.tests_e2e_ios.ymlturns 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
AndroidiOSOther(macOS, web)e2etests added or updated inpackages/\*\*/e2ejesttests added or updated inpackages/\*\*/__tests__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.jsyarn test-rn-bare:ios:buildyarn lint:jstest-rn-bare iOS build + launch smoke, its dynamic-probe job, andiOS (debug, 0)/iOS (release, 0)run on this PR.Maintainer note: Fixes internal CPRN-694