Skip to content

ci(e2e): retry BrowserStack builds on infra-class flakes#113

Merged
gmaclennan merged 2 commits into
mainfrom
fix/browserstack-infra-retry
Jun 22, 2026
Merged

ci(e2e): retry BrowserStack builds on infra-class flakes#113
gmaclennan merged 2 commits into
mainfrom
fix/browserstack-infra-retry

Conversation

@gmaclennan

Copy link
Copy Markdown
Member

Problem

The iOS e2e job on chore/merge-prerelease failed with Unable to set permissions for app com.comapeo.core.e2e: Connection reset on iPhone 17 / iOS 26.4, while iPhone 15 / iOS 17.5 passed the identical app + flow.

The Maestro stack trace puts the failure on the launchApp command, before the app rendered anything:

CommandFailed: Unable to set permissions for app com.comapeo.core.e2e: Connection reset
  at xcuitest.XCTestDriverClient.executeJsonRequest (okhttp SocketException)
  at xcuitest.XCTestDriverClient.setPermissions
  at maestro.Maestro.setPermissions
  at maestro.orchestra.Orchestra.launchAppCommand

This is a test-environment flake: a socket reset on the link between the Maestro CLI and the on-device XCUITest driver (Maestro issues a default setPermissions on every launchApp). It's not the app — the other device passed, and the app never launched. Newest-OS devices (iOS 26) are the most prone to it on the BrowserStack device cloud.

Change

Reworks the shared composite action (run-browserstack-maestro, used by both iOS and Android e2e jobs):

  • Merge the Trigger build + Poll for result steps into one Run tests step wrapped in an attempt loop. New max_attempts input, default 3.
  • Gated retry (is_infra_only): a failed build is only re-triggered when every failed session's Maestro log matches an infra signature (Unable to set permissions, Connection reset, ECONNRESET, Failed to install app, WebDriverAgent, XCTestDriverClient, …). Any failed session without a signature — or whose log can't be fetched — is treated as a real failure and fails immediately, so genuine regressions are never retried away.
  • Better failure report: report_failure now dumps the tail of each failed session's Maestro log, so the actual error is visible in the CI log without an API dig.

Validation

  • shellcheck clean on all run blocks (no suppressions).
  • Unit-tested the gating logic with a stubbed curl across 6 scenarios — pure-infra retries; real, mixed, and unclassifiable failures do not; the real-world "one device passed / other flaked" case correctly retries.

Notes

  • Retries only fire on infra failures (which terminate fast — the failing build was ~3 min), so up to 3 attempts stay within the job's timeout-minutes: 30. Timeouts aren't classified as infra, so a hung build won't be retried.
  • Covers both iOS and Android e2e, since only the shared action changed.

🤖 Generated with Claude Code

gmaclennan and others added 2 commits June 22, 2026 12:51
BrowserStack/Maestro occasionally fails a build before the app runs a
single assertion — most commonly the XCUITest driver connection resetting
during the implicit setPermissions of `launchApp` ("Unable to set
permissions ...: Connection reset"). These pass on retry and on the other
device in the same build, but currently fail the whole job.

Merge trigger + poll into one step wrapped in an attempt loop (new
`max_attempts` input, default 3). A failed build is only re-triggered when
every failed session's Maestro log matches an infra signature; any failed
session without one — or whose log can't be fetched — is treated as a real
failure and fails immediately, so genuine regressions are never retried away.

Also dump the tail of each failed session's Maestro log in the failure
report, so the actual error is visible in the CI log without an API dig.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gmaclennan gmaclennan enabled auto-merge June 22, 2026 12:01
@gmaclennan gmaclennan merged commit 39d1b4e into main Jun 22, 2026
11 checks passed
@gmaclennan gmaclennan deleted the fix/browserstack-infra-retry branch June 22, 2026 12:11
@gmaclennan gmaclennan added the maintenance Refactor / test / chore / ci / build (changelog) label Jun 22, 2026
gmaclennan added a commit that referenced this pull request Jun 22, 2026
## Optic Release Automation

This **draft** PR is opened by Github action
[optic-release-automation-action](https://github.com/nearform-actions/optic-release-automation-action).

A new **draft** GitHub release
[v1.0.0-pre.2](https://github.com/digidem/comapeo-core-react-native/releases/tag/untagged-352a6c41c12fd02dec37)
has been created.

Release author: @gmaclennan

#### If you want to go ahead with the release, please merge this PR.
When you merge:

- The GitHub release will be published

- The npm package with tag pre will be published according to the
publishing rules you have configured



- No major or minor tags will be updated as configured


#### If you close the PR

- The new draft release will be deleted and nothing will change

<!-- Release notes generated using configuration in .github/release.yml
at 7fe80b4 -->

## What's Changed
### 🚀 Features
* Integrate @comapeo/core via IPC over Unix sockets by @gmaclennan in
#5
* Add iOS support & test infrastructure by @gmaclennan in
#6
* iOS Phase 1: unified JS bundle + smoke test (simulator-only) by
@gmaclennan in
#15
* iOS Phase 2: xcframework Embed & Sign for native addons by @gmaclennan
in #16
* Phase 2 Android: jniLibs packaging + unified rollup loader plugin by
@gmaclennan in
#17
* android: read abiFilters from reactNativeArchitectures (#30) by
@gmaclennan in
#35
* Add rootkey persistence and lifecycle state management by @gmaclennan
in #36
* Sentry integration: Phase 1 + Phase 2a + Phase 2b by @gmaclennan in
#54
* feat(backend): polywasm-backed undici on iOS, re-enable maps plugin by
@gmaclennan in
#62
* feat(sentry): land Phase 3 — backend loader + RPC tracing by
@gmaclennan in
#63
* feat(sentry): land Phases 6 + 7a — Android exit reasons & iOS
MetricKit app-exit telemetry by @gmaclennan in
#72
* feat(sentry): migrate to @sentry/react-native v8; exit telemetry as
Application Metrics by @gmaclennan in
#73
* Map server integration by @gmaclennan in
#86
* feat(config): let the consuming app supply the default project config
by @gmaclennan in
#95
### 🐛 Bug Fixes
* fix(android): drop setUnlockedDeviceRequired from rootkey wrapper key
by @gmaclennan in
#57
* fix(backend): cache stopping/error frames for late joiners by
@gmaclennan in
#58
* fix(ios-tests): wait for STOPPING before signalling node exit by
@gmaclennan in
#59
* fix(android): drain JNI stdio pumps before returning from node::Start
by @gmaclennan in
#60
* fix(ios-tests): serialise STOPPING/STOPPED observers in
testFullLifecycleStateTransitions by @gmaclennan in
#71
* fix(sentry): make exit telemetry lossless and stop cross-process
clobbering by @gmaclennan in
#84
* fix: start fastify listening by @gmaclennan in
#93
* fix(ci): ignore-scripts in ios npm installs by @gmaclennan in
#96
* fix(ci): replace --ignore-scripts with npm strict-allow-scripts
allowlist by @gmaclennan in
#106
* fix(release): stop `npm pack --dry-run` leaking dry-run into backend
install by @gmaclennan in
#129
### ⚡ Performance
* perf(backend): switch bundler from rollup to rolldown by @gmaclennan
in #94
### ⬆️ Dependencies
* update some native deps used in backend by @achou11 in
#14
* chore(deps): upgrade to Expo SDK 56 (React Native 0.85) by @gmaclennan
in #87
### 🏗️ Maintenance
* Android Testing Infrastructure & Bug Fixes by @gmaclennan in
#3
* chore: prebuild example/android; harden instrumented tests by
@gmaclennan in
#10
* chore: adjust repo setup by @achou11 in
#12
* chore: minor fixes based on expo-doctor by @achou11 in
#13
* chore: add architecture docs & plans by @gmaclennan in
#11
* chore: post-Phase-2 cleanup — comments, plan docs, agents.md by
@gmaclennan in
#33
* refactor: simplify build-backend.ts; rollup writes directly to native
asset trees by @gmaclennan in
#34
* chore: fix eslint configuration by @achou11 in
#41
* android: audit 16 KB page alignment on every shipped .so by
@gmaclennan in
#43
* chore: move example app into apps directory by @achou11 in
#18
* refactor: per-component lifecycle state with derived ComapeoState by
@gmaclennan in
#47
* android: fold waitForFile into connect retry loop by @gmaclennan in
#52
* chore: add e2e testing app by @achou11 in
#49
* ci: drop unreliable Android emulator snapshot caching by @gmaclennan
in #64
* use npm list instead of custom traversal to get native module versions
by @achou11 in
#70
* chore(e2e): add e2e tests on browserstack via Maestro by @achou11 in
#56
* chore(ci): add release workflow by @gmaclennan in
#90
* chore: fix npm script and release build script by @gmaclennan in
#91
* chore(pack): don't try to package build files by @gmaclennan in
#92
* chore(release): merge prerelease branch. by @gmaclennan in
#110
* ci(e2e): retry BrowserStack builds on infra-class flakes by
@gmaclennan in
#113
### Other Changes
* ci: derive changelog labels from PR titles + add Dependabot by
@gmaclennan in
#114

## New Contributors
* @achou11 made their first contribution in
#12
* @optic-release-automation[bot] made their first contribution in
#112

**Full Changelog**:
https://github.com/digidem/comapeo-core-react-native/commits/v1.0.0-pre.2

<!--

<release-meta>{"id":342970724,"version":"v1.0.0-pre.2","npmTag":"pre","opticUrl":"https://optic-zf3votdk5a-ew.a.run.app/api/generate/"}</release-meta>
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Refactor / test / chore / ci / build (changelog)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant