Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screens/式舆防卫战/入口前可交互.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screens/式舆防卫战/弱点编队界面.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screens/式舆防卫战/战斗画面.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screens/式舆防卫战/预备编队选队.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screens/快捷手册/作战TAB.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screens/快捷手册/目标TAB.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions test/zzz_od/backend/test_backend_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def test_analyze_maps_ocr_results() -> None:
assert result.success is True
assert [t.text for t in result.ocr_texts] == ["体力", "设定"]
assert result.ocr_texts[0].width == 3
assert result.vision_hint is not None # success 时带能力边界提示

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

断言具体提示内容,避免测试退化为存在性检查。

is not None 允许空字符串或任意错误提示通过,无法验证 analyze() 是否生成了预期的能力边界提示。请断言生产契约规定的具体值,至少改为验证非空内容。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/zzz_od/backend/test_backend_context.py` at line 109, Update the
assertion for result.vision_hint in the backend context test to validate
non-empty content rather than only non-None presence, using the production
contract’s expected capability-boundary hint value when available. Keep the
success-path assertion focused on the output generated by analyze().



def test_analyze_returns_error_when_screenshot_none() -> None:
Expand All @@ -116,6 +117,7 @@ def test_analyze_returns_error_when_screenshot_none() -> None:
result = backend.analyze()
assert result.success is False
assert "截图失败" in (result.error or "")
assert result.vision_hint is None # 失败时不带提示


def test_analyze_returns_screens_and_writes_back_on_precise(monkeypatch) -> None:
Expand Down
1 change: 1 addition & 0 deletions test/zzz_od/backend/test_http_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ async def test_handle_game_analyze_ok() -> None:
assert resp.status_code == 200
data = json.loads(resp.body.decode("utf-8"))
assert data["success"] is True
assert data["vision_hint"] is None # HTTP 显式补字段(P11 对称);mock 未设 → None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

补充 HTTP 层的非空 vision_hint 透传断言。

当前只验证默认 None 和字段存在;即使路由丢弃或错误序列化非空提示,测试仍会通过。请让 mock 返回具体提示,并断言响应 JSON 中保留该值。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/zzz_od/backend/test_http_routes.py` at line 103, 更新相关 HTTP 路由测试及其 mock
配置,让 mock 返回具体的非空 vision_hint,并将断言从默认 None 改为验证响应 JSON 保留该提示值;同时保留字段存在性验证。



@pytest.mark.asyncio
Expand Down
3 changes: 2 additions & 1 deletion test/zzz_od/backend/test_mcp_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,14 @@ def test_analyze_screen_tool_returns_screens_field() -> None:
)
match = ScreenMatch(screen_name='菜单', is_precise=True, areas=[detail])
backend.analyze.return_value = AnalyzeScreenResult(
success=True, ocr_texts=[], error=None, screens=[match])
success=True, ocr_texts=[], error=None, screens=[match], vision_hint='提示透传')
tool = mcp._tool_manager._tools['analyze_screen']
fn = getattr(tool, 'fn', None) or getattr(tool, 'func', None)
result = fn()
assert result.success is True
assert result.screens[0].screen_name == '菜单'
assert result.screens[0].areas[0].area_type == AreaType.TEXT
assert result.vision_hint == '提示透传' # tool 直接 return backend 结果,字段透传


def test_check_game_window_returns_window_status() -> None:
Expand Down
15 changes: 15 additions & 0 deletions test/zzz_od/backend/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,18 @@ def test_analyze_result_default_screenshot_path_none() -> None:
"""AnalyzeScreenResult 默认 screenshot_path=None。"""
r = AnalyzeScreenResult(success=True, ocr_texts=[], error=None)
assert r.screenshot_path is None


def test_analyze_result_default_vision_hint_none() -> None:
"""AnalyzeScreenResult 默认 vision_hint=None(失败 / 未设时)。"""
r = AnalyzeScreenResult(success=True, ocr_texts=[], error=None)
assert r.vision_hint is None
r2 = AnalyzeScreenResult(success=False, ocr_texts=[], error='截图失败')
assert r2.vision_hint is None


def test_analyze_result_vision_hint_settable() -> None:
"""AnalyzeScreenResult.vision_hint 可赋值非空(success 时的能力边界提示)。"""
r = AnalyzeScreenResult(success=True, ocr_texts=[], error=None,
vision_hint='部分识别,请用视觉工具再看')
assert r.vision_hint == '部分识别,请用视觉工具再看'