Skip to content

Commit e670a92

Browse files
thymikeeclaude
andcommitted
refactor(ios-runner): drop the restart composition typed reasons made redundant
With the connect-failure reasons exclusive, no error that grants a restart before send can also carry a terminal connect verdict, so the restart predicate reads its own axis. Doc comments now say which failures carry a BootFailureReason and that the rows above the startup block include foreign-runtime text matchers. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 1c35269 commit e670a92

2 files changed

Lines changed: 7 additions & 15 deletions

File tree

‎packages/platform-apple/src/runner/__tests__/runner-error-classification.test.ts‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,17 +234,12 @@ test('a refused connection before send restarts the session', () => {
234234
);
235235
});
236236

237-
test('a terminal connect verdict refuses the restart', () => {
237+
test('an early exit or a foreign transport failure earns no restart before send', () => {
238238
const earlyExit = runnerConnectFailure(
239239
'xcodebuild_exited_early',
240240
'xcodebuild exited early: runner did not accept connection',
241241
);
242242
assert.equal(shouldRestartRunnerBeforeCommandSend(earlyExit), false);
243-
const busy = runnerConnectFailure(
244-
'runner_connect_refused',
245-
'Device is busy (Connecting to iPhone): runner did not accept connection',
246-
);
247-
assert.equal(shouldRestartRunnerBeforeCommandSend(busy), false);
248243
assert.equal(shouldRestartRunnerBeforeCommandSend(commandFailed('socket hang up')), false);
249244
});
250245

‎packages/platform-apple/src/runner/runner-error-classification.ts‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ type RunnerErrorDetailsMatch = (details: AppErrorDetails) => boolean;
2424
/**
2525
* Why agent-device's own runner connect path gave up, published in
2626
* `details.runnerConnectFailureReason` by the error that path throws. It sits beside
27-
* `details.reason` rather than in it: on these failures `reason` already carries the
28-
* `BootFailureReason` the caller's hint answers.
27+
* `details.reason` rather than in it: on the refused-connection and early-exit failures
28+
* `reason` already carries the `BootFailureReason` the caller's hint answers.
2929
*/
3030
export type RunnerConnectFailureReason =
3131
| 'xcodebuild_exited_early'
@@ -304,7 +304,8 @@ export const RUNNER_ERROR_RULES: readonly RunnerErrorRule[] = [
304304
// caller and no recovery verdicts, because there is no session to invalidate and nothing was sent
305305
// to resend. Specific rows precede generic ones: the classifier takes the first match.
306306
//
307-
// Why these rows are text matchers while the rows above key on a code or a typed field:
307+
// Why these rows are text matchers while the rows above key on a code, a typed field, or a
308+
// foreign runtime's message:
308309
// `runnerToolText` reads xcodebuild's own prose because that prose is the only publication these
309310
// failures have — there is no code and no typed field to key on. Its haystack is deliberately
310311
// narrow: our message plus the tool's stdout/stderr, never the whole details bag, which also
@@ -560,14 +561,10 @@ export function resolveRunnerFatalErrorReason(error: unknown): string | undefine
560561
/**
561562
* A connect-shaped failure that surfaced before the command was sent: restart
562563
* the runner session and replay the command, rather than probing a runner
563-
* that never accepted the connection. Composed with the connect-retry axis so
564-
* a terminal connect verdict still refuses the restart.
564+
* that never accepted the connection.
565565
*/
566566
export function shouldRestartRunnerBeforeCommandSend(error: unknown): boolean {
567-
return (
568-
(runnerErrorVerdict(error, 'restartBeforeSend') ?? false) &&
569-
shouldRetryRunnerConnectError(error)
570-
);
567+
return runnerErrorVerdict(error, 'restartBeforeSend') ?? false;
571568
}
572569

573570
/**

0 commit comments

Comments
 (0)