From 57101df48d6a83e0faee4013cc59161f71914daf Mon Sep 17 00:00:00 2001 From: PJ Date: Sun, 3 May 2026 11:01:16 +0700 Subject: [PATCH] fix(runtime): surface unresolved action targets instead of dropping silently serializeAction emitted {x:0,y:0} via `?? 0` whenever a Tap/InputText/Swipe target failed to resolve to coordinates. The runner then collapsed those to ErrNoAction, so every selector typo became a silent no-op tick. Have the runtime return null on unresolved targets and log a console warning (visible via chromedp's runtime listener). Drop the now-redundant {0,0} -> ErrNoAction guard so a deliberate Tap at the origin actually fires. --- internal/runner/runner.go | 3 --- pkg/spec/src/web-runtime.ts | 22 +++++++++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/internal/runner/runner.go b/internal/runner/runner.go index f171626..de668f3 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -446,9 +446,6 @@ func nextActionFromV8(ctx context.Context, web driver.WebDriver) (verifier.Actio } switch decoded.Kind { case "Tap": - if decoded.X == 0 && decoded.Y == 0 { - return verifier.Action{}, verifier.ErrNoAction - } return verifier.Action{Kind: verifier.ActionKindTap, X: decoded.X, Y: decoded.Y}, nil case "InputText": return verifier.Action{ diff --git a/pkg/spec/src/web-runtime.ts b/pkg/spec/src/web-runtime.ts index 6ef107e..347234f 100644 --- a/pkg/spec/src/web-runtime.ts +++ b/pkg/spec/src/web-runtime.ts @@ -471,20 +471,32 @@ function serializeAction(action: unknown): unknown { switch (obj.kind) { case "Tap": { const point = pointOf(obj.on); - return { kind: "Tap", x: point?.x ?? 0, y: point?.y ?? 0 }; + if (!point) { + console.warn("[sanderling] Tap target did not resolve to coordinates"); + return null; + } + return { kind: "Tap", x: point.x, y: point.y }; } case "InputText": { const point = pointOf(obj.into); + if (!point) { + console.warn("[sanderling] InputText target did not resolve to coordinates"); + return null; + } return { kind: "InputText", - x: point?.x ?? 0, - y: point?.y ?? 0, + x: point.x, + y: point.y, text: obj.text ?? "", }; } case "Swipe": { - const from = pointOf(obj.from) ?? { x: 0, y: 0 }; - const to = pointOf(obj.to) ?? { x: 0, y: 0 }; + const from = pointOf(obj.from); + const to = pointOf(obj.to); + if (!from || !to) { + console.warn("[sanderling] Swipe endpoints did not resolve to coordinates"); + return null; + } return { kind: "Swipe", from_x: from.x,