fix(runner): name a builtin scroll by its drag origin

A builtin gesture carries endpoints and no selector, so every scroll rendered as
"Scroll down " in the prompt's recent-action memory and two scrollable regions
were indistinguishable.

Claude-Session: https://claude.ai/code/session_01Fj4wJUikdABuMQEETwW55J
This commit is contained in:
pj committed 2026-08-12 16:48:31 +05:30
1 parent b5f64bf665
commit ea17eed739
2 files changed
+22 -1

No files matched your search

+8 -1
View File
@@ -302,7 +302,14 @@ func describeAction(action verifier.Action) string {
case verifier.ActionKindInputText:
return fmt.Sprintf("InputText %s = %q", actionTarget(action), action.Text)
case verifier.ActionKindScroll:
return fmt.Sprintf("Scroll %s %s", action.Direction, action.On)
// A builtin gesture carries endpoints rather than a selector, so name the
// container by where the drag starts; that is what tells two scrollable
// regions apart in the recent-action memory.
target := action.On
if target == "" {
target = fmt.Sprintf("(%d,%d)", action.FromX, action.FromY)
}
return fmt.Sprintf("Scroll %s %s", action.Direction, target)
case verifier.ActionKindSwipe:
// Coordinates make a repeated identical swipe recognizable in the
// prompt's recent-action memory.
+14
View File
@@ -62,6 +62,20 @@ func TestActionForCandidatePassesNonTypingThrough(t *testing.T) {
}
}
func TestDescribeActionNamesGesturesByOrigin(t *testing.T) {
builtin := verifier.Action{
Kind: verifier.ActionKindScroll, Direction: "down",
FromX: 200, FromY: 500, ToX: 200, ToY: 340,
}
if got := describeAction(builtin); got != "Scroll down (200,500)" {
t.Errorf("builtin gesture described as %q, want the drag origin", got)
}
authored := verifier.Action{Kind: verifier.ActionKindScroll, Direction: "up", On: "id:List"}
if got := describeAction(authored); got != "Scroll up id:List" {
t.Errorf("authored scroll described as %q, want its selector", got)
}
}
func TestActionForCandidateUsesModelText(t *testing.T) {
source := &llmSource{}
candidate := verifier.ActionCandidate{