fix(controlBrowser): never report moveMouse/search success without a real move
Some checks failed
Release / semantic-release (push) Successful in 19s
tests / Unit tests (Linux, Python 3.11) (push) Failing after 5m15s
Release / build-linux (push) Failing after 7m7s
Release / build-windows (push) Has been cancelled
Release / build-macos (arm64, macos-latest) (push) Has been cancelled
Release / build-macos (x64, macos-15-intel) (push) Has been cancelled
Release / release-main (push) Has been cancelled
Release / release-develop (push) Has been cancelled
Some checks failed
Release / semantic-release (push) Successful in 19s
tests / Unit tests (Linux, Python 3.11) (push) Failing after 5m15s
Release / build-linux (push) Failing after 7m7s
Release / build-windows (push) Has been cancelled
Release / build-macos (arm64, macos-latest) (push) Has been cancelled
Release / build-macos (x64, macos-15-intel) (push) Has been cancelled
Release / release-main (push) Has been cancelled
Release / release-develop (push) Has been cancelled
moveMouse returned ok:true even when humanHover did nothing (no on-screen box) or the selector never matched — recreating the "claims it moved but didn't" bug. Now: humanHover returns a boolean (and brings the element into view first); moveMouse returns ok:false when the target isn't found or has no on-screen box, and when site=naver/... whose box isn't on the current page it navigates to the site home first before hovering. search now reports input=human|api-fallback|api so a silent fallback to cursor-less DOM input is visible, and the tool surfaces that note in the reply instead of implying a human-like search happened.
This commit is contained in:
@@ -35,3 +35,22 @@ def test_description_distinguishes_cursor_paths(tool):
|
||||
desc = tool.description
|
||||
assert "moveMouse" in desc
|
||||
assert "address bar" in desc # navigate is described as address-bar typing
|
||||
|
||||
|
||||
def test_search_summary_flags_cursorless_fallback(tool):
|
||||
# When the real xdotool cursor path didn't run, the summary must say so
|
||||
# rather than implying a human-like search happened.
|
||||
human = tool._summarise("search", {"query": "날씨"}, {"ok": True, "site": "naver", "query": "날씨", "input": "human"})
|
||||
assert "참고: 실제 마우스" not in human
|
||||
|
||||
fell_back = tool._summarise("search", {"query": "날씨"}, {"ok": True, "site": "naver", "query": "날씨", "input": "api-fallback"})
|
||||
assert "실제 마우스 커서 이동 없이" in fell_back
|
||||
|
||||
|
||||
def test_movemouse_summary_only_runs_on_success(tool):
|
||||
# _summarise is only called on ok:true; an ok:false (target not found / no
|
||||
# xdotool) is handled by run() as a failure reply, so a failed move can no
|
||||
# longer be reported as "moved". Sanity-check the success summary names a
|
||||
# target rather than a placeholder when one is present.
|
||||
summary = tool._summarise("moveMouse", {"selector": "#query"}, {"ok": True, "target": "#query"})
|
||||
assert "#query" in summary
|
||||
|
||||
Reference in New Issue
Block a user