Skip to content

refactor(ios): share the discovery-pending retry loop - #2851

Closed
thymikee wants to merge 1 commit into
mainfrom
refactor/ios-simulator-discovery-retry-loop
Closed

thymikee wants to merge 1 commit into
mainfrom
refactor/ios-simulator-discovery-retry-loop

Conversation

@thymikee

Copy link
Copy Markdown
Member

Summary

Follow-up on #2838's review note: resolveLaunchedTarget (snapshot-observability.ts) and resolveTargetForObservation (snapshot-route.ts) each looped on simulator-target-discovery-pending themselves, differing only in their exit rule — one returns undefined on any other failure, the other also gives up once a live runner can answer instead. Both now call a single resolveSimulatorTargetJoiningDiscovery loop added to snapshot-target.ts (which already owns the discovery-pending reason), passing their own continuation rule as a parameter. isSimulatorTargetDiscoveryPending drops its export since the shared loop is now its only caller (flagged by fallow).

Behavior is unchanged for both callers, including cancellation via the request signal (each caller keeps its own signal check exactly where it had it) and the discovery's own deadline (untouched, in resolveSimulatorSnapshotTarget). No new tests: the existing suites already exercise both exit rules through production resolvers (snapshot-observability.test.ts's pending-vs-non-pending table, snapshot-route.test.ts's hasLiveRunnerSession scenarios).

Touched files: 3.

Validation

Tested at 90dc3cadb8e9a646af47355813ec2edbed6b02c0. pnpm check:affected --run passes clean (264 files / 1706 tests, format/lint/typecheck/layering/fallow/build all green). Two earlier runs on this host hit unrelated flakes (a provider-integration timeout and a tmpdir ENOTEMPTY cleanup race) that reproduced only under load and passed in isolation and on a clean re-run — consistent with documented host-contention flakiness, not a regression from this change.

No device run: this is a behavior-preserving internal refactor with no observable-surface or command-semantics change.

…nch probe and the capture route

resolveLaunchedTarget and resolveTargetForObservation each looped on
simulator-target-discovery-pending themselves, differing only in what
ends the retry: one gives up after any non-pending failure, the other
also gives up once a live runner can answer instead. Both now call
resolveSimulatorTargetJoiningDiscovery in snapshot-target.ts, passing
their own continuation rule; isSimulatorTargetDiscoveryPending drops
its export since the shared loop is now its only caller.
@github-actions

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
Installed (including dependencies) 4.80 MB 4.80 MB -5.1 kB
Package (unpacked) 4.80 MB 4.80 MB -5.1 kB
Package (download) 1.43 MB 1.43 MB -1.1 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 28.4 ms 27.7 ms -0.7 ms
CLI --help 81.5 ms 78.0 ms -3.5 ms

@thymikee

Copy link
Copy Markdown
Member Author

Closing: an adversarial review found this adds more indirection than it removes (net +30 lines to share about 4). Reasoning is on #2838.

@thymikee thymikee closed this Sep 23, 2026
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-23 17:59 UTC

@thymikee
thymikee deleted the refactor/ios-simulator-discovery-retry-loop branch September 25, 2026 08:23
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