fix(runner): surface clear message on WDA connection drop

This commit is contained in:
pj committed 2026-04-23 17:27:49 +07:00
1 parent f05bdbd0ba
commit 788dd94bc5
1 file changed
+10
+10
View File
@@ -6,6 +6,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"log/slog" "log/slog"
"strings"
"time" "time"
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
@@ -192,6 +193,9 @@ func Run(ctx context.Context, options Options) (Summary, error) {
if nextErr == nil { if nextErr == nil {
if err := applyAction(ctx, options.Driver, nextAction, tree); err != nil { if err := applyAction(ctx, options.Driver, nextAction, tree); err != nil {
if isWDADrop(err) {
return summary, fmt.Errorf("step %d: iOS XCTest runner lost connection - known WDA startup flake, re-run the test: %w", stepIndex, err)
}
return summary, fmt.Errorf("step %d apply: %w", stepIndex, err) return summary, fmt.Errorf("step %d apply: %w", stepIndex, err)
} }
actionCopy := nextAction actionCopy := nextAction
@@ -500,6 +504,12 @@ func encodeResiduals(residuals map[string]ltl.Formula) (map[string]json.RawMessa
return encoded, firstErr return encoded, firstErr
} }
func isWDADrop(err error) bool {
msg := err.Error()
return strings.Contains(msg, "ConnectException") ||
(strings.Contains(msg, "code = Internal") && strings.Contains(msg, "SocketException"))
}
func traceExceptions(exceptions []verifier.Exception) []trace.Exception { func traceExceptions(exceptions []verifier.Exception) []trace.Exception {
if len(exceptions) == 0 { if len(exceptions) == 0 {
return nil return nil