Skip to content

fix(mobile): end stalled requests sooner and log where iOS e2e requests stall - #1478

Open
rjzondervan wants to merge 3 commits into
developmentfrom
fix/ios-e2e-request-stall
Open

rjzondervan wants to merge 3 commits into
developmentfrom
fix/ios-e2e-request-stall

Conversation

@rjzondervan

Copy link
Copy Markdown
Member

Why

The iOS Mobile e2e job failed twice on 2026-11-04 in a way the earlier flake fixes (#1432, #1435) don't cover:

Run Test Hangs at
41785328133 (8288f8b) PairUnlockUITests:111 after tapping "Sign in with your browser", the waiting spinner doesn't appear within 20 s
41857267386 (799e288) VaultFlowsUITests:177 after tapping "Connect", the master-password field doesn't appear within 60 s

From the mobile-media-ios videos and the replay log:

  • The app is still busy at the moment of failure (button disabled, spinner running), with no error.
  • The request the test waits for (POST /login/v2, resp. POST /extension/pair) never reached the replay server; the requests before and after it did.
  • Ruled out: IPv6 (the ::1 Connection refused lines come from the test runner's offline toggles and fall back to IPv4 within a millisecond), the replay's offline mode (OfflineUITests runs later and switches it off), and checkRoom().

Where the request stalls (connection, TLS or the app) can't be seen yet: the app's own log isn't captured.

What

Shared client (KeepiqApi.httpClient): HttpTimeout with a 15 s connect and a 20 s socket (idle) timeout.

  • On iOS (Ktor Darwin) only the socket timeout applies, as the NSURLRequest timeout, which otherwise is 60 s. A stalled request then kept the app busy for a minute without a word; now it ends in "Cannot reach this server".
  • The connect timeout applies on Android (OkHttp).
  • No cap on the whole request, so a slow but moving transfer still completes.

Diagnostics for the next occurrence:

  • mobile/e2e/server.mjs replay: timestamps on every line; TCP open/close; TLS handshake ok/failed with the reason; each request on arrival and on its answer, or closed unanswered.
  • mobile/e2e/ios-run.sh: the simulator log of the Keepiq and KeepiqAutofill processes (URLSession, Network.framework, trust) in simulator.log.
  • mobile-e2e.yml: media/*.log (replay.log, simulator.log) go into the mobile-media-ios artifact.

Verification

  • :shared:jvmTest: 222 tests, 0 failures (1 skipped), including the new KeepiqApiTest.everyRequestCarriesTheConnectAndSocketTimeouts.
  • Replay logging run in node:22 with a normal request, a 401, an untrusted certificate, a stalled body and an offline drop; each case logs as intended.
  • Not run locally (no macOS, no Android SDK): the iOS log capture and the Android unit tests. This PR's own Mobile e2e and Mobile runs are the proof; after that, check that simulator.log in the artifact is non-empty.

This does not make the flake disappear: a stalled request still fails the test, just with an error on screen and with logs that say where it stalled.

🤖 Generated with Claude Code

rjzondervan and others added 2 commits November 5, 2026 11:19
…ts stall

The iOS e2e run failed twice on 2026-11-04 (PairUnlockUITests:111,
VaultFlowsUITests:177) with the app busy and no error: the request the
test waited for never reached the replay server. Two changes.

Shared client: HttpTimeout with a 15 s connect and a 20 s socket (idle)
timeout. On iOS the socket timeout is the NSURLRequest timeout, which
otherwise is 60 s, so a stalled request kept the app busy for a minute
without a word; now it ends in "Cannot reach this server". There is
no cap on the whole request, so a slow but moving transfer completes.

Diagnostics for the next occurrence:
- server.mjs replay: timestamps on every line, tcp open/close, TLS
  handshake ok/failed, each request on arrival and on its answer (or
  "closed unanswered"), so a missing request shows as no connection, a
  failed handshake, or a connection that never sent one.
- ios-run.sh: the simulator log of the Keepiq and KeepiqAutofill
  processes (URLSession, Network.framework, trust) in simulator.log.
- mobile-e2e.yml: media/*.log (replay.log, simulator.log) go into the
  mobile-media-ios artifact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Robert Zondervan <robert@conduction.nl>
…or log

The first run with the app's simulator log wrote 112 MB (936k lines),
nearly all XCTest and accessibility chatter. The network, CFNetwork and
securityd subsystems hold what the stall diagnosis needs: about 12k
lines, 2 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/keepiq @ b387520

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ✅
psalm ✅
phpstan ✅
phpmetrics ✅
eslint ✅
stylelint ✅
build ✅
check-manifest ✅
test-l10n ✅
format ✅
check-l10n-js ✅
check-schema-l10n ✅
composer ✅ ✅ 114/114
npm ✅ ✅ 661/661
app:check-code ⏭️
info.xml ✅
REUSE ✅
lockfile sync ✅
PHPUnit ✅ 3040/3040 · 3 skipped
Newman ✅ 177/177 · 20 skipped
Playwright ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it locally with npx playwright test, or from the Actions tab on a branch with no open pull request into development.
Hydra gates ✅

Quality workflow — 2026-11-05 11:30 UTC

Download the full PDF report from the workflow artifacts.

The new simulator log caught the stall on 2026-11-05 (run 42017106996,
PairUnlockUITests:111): TCP and the TLS handshake reach the server's
certificate, the app hands it to trustd ("Completed async eval
kickoff"), and trustd never answers; 60 of 61 evaluations in that run
returned in about 5 ms. The request then times out at 20 s. Nothing is
wrong in the app or the replay.

- xcodebuild runs each class with -retry-tests-on-failure
  -test-iterations 2. A test that only passed on its retry is posted as
  a GitHub warning, so a flake of our own still shows.
- The simulator log also takes the trustd process, so the next hang
  shows what it waited on.
- Each class's xcodebuild output is kept as <class>.log in the
  artifact (media/*.log), which the warning is read from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/keepiq @ 3381667

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ✅
psalm ✅
phpstan ✅
phpmetrics ✅
eslint ✅
stylelint ✅
build ✅
check-manifest ✅
test-l10n ✅
format ✅
check-l10n-js ✅
check-schema-l10n ✅
composer ✅ ✅ 114/114
npm ✅ ✅ 661/661
app:check-code ⏭️
info.xml ✅
REUSE ✅
lockfile sync ✅
PHPUnit ✅ 3040/3040 · 3 skipped
Newman ✅ 177/177 · 20 skipped
Playwright ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it locally with npx playwright test, or from the Actions tab on a branch with no open pull request into development.
Hydra gates ✅

Quality workflow — 2026-11-05 13:36 UTC

Download the full PDF report from the workflow artifacts.

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.

1 participant