Skip to content

Fix flaky CI tests (test_identity_delegate timing out after 10 seconds) - #81

Merged
jrosendahl-opt merged 2 commits into
masterfrom
fix/shared-webview-user-agent
Oct 29, 2026
Merged

jrosendahl-opt merged 2 commits into
masterfrom
fix/shared-webview-user-agent

Conversation

@jrosendahl-opt

@jrosendahl-opt jrosendahl-opt commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Why

test_identify_delegate has been failing intermittently on CI since 1.3.0 (Exceeded timeout of 10 seconds), and passes on rerun.

This isn't caused by the live API being slow.

Since #72 (Swift 6 port), every EdgeAPI created without customUserAgent queues a Task { @MainActor in … } that builds a hidden full-screen WKWebView to read navigator.userAgent. The unit tests create about 70 such instances (the URL-generation test alone builds 64) and never free the main thread, so the tasks pile up. They all run at the start of the integration tests:

  • the @MainActor setUp waits behind them;
  • the delegate callback's hop to the main thread waits behind them too, and misses the 10 s window.

Since the Swift 6 port, every EdgeAPI created without customUserAgent
queues a main-actor task that builds a hidden WKWebView. The unit tests
create ~70 such instances without yielding the main thread, so the
tasks pile up and drain at the start of the integration tests, delaying
the @mainactor setUp and the delegate callbacks past the 10s wait in
test_identify_delegate.

Share one lookup across all instances; an empty result is not kept so
a later instance can retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jrosendahl-opt
jrosendahl-opt requested review from a team as code owners October 28, 2026 17:32
@jrosendahl-opt jrosendahl-opt changed the title Resolve the WebView user agent once per process (fixes flaky test_identify_delegate) Fix flaky CI tests (test_identity_delegate timing out after 10 seconds) Oct 28, 2026
@jrosendahl-opt
jrosendahl-opt merged commit d1899c8 into master Oct 29, 2026
4 checks passed
@jrosendahl-opt
jrosendahl-opt deleted the fix/shared-webview-user-agent branch October 29, 2026 17:59
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.

3 participants