test: 式舆防卫战/快捷手册 fixture + vision_hint 断言 - #19
Conversation
新增 9 子态(选关主界面-3of5/4of5、弱点编队、预备编队选队、战斗画面、一层结束、入口前可交互、挑战结果-下一防线/S评级)+ 快捷手册 2 TAB;删 3 重复(选关主界面/作战/目标 = 新版同图);战斗结束.webp 重命名挑战结果-下一防线.webp。
Walkthrough本次变更新增或更新多张 WebP 界面资源,并为 Changes界面资源
vision_hint 测试覆盖
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with 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.
Inline comments:
In `@test/zzz_od/backend/test_backend_context.py`:
- 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().
In `@test/zzz_od/backend/test_http_routes.py`:
- Line 103: 更新相关 HTTP 路由测试及其 mock 配置,让 mock 返回具体的非空 vision_hint,并将断言从默认 None
改为验证响应 JSON 保留该提示值;同时保留字段存在性验证。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d714974a-92f7-45fc-9e2c-66d5cb8b689a
📒 Files selected for processing (15)
screens/式舆防卫战/一层结束-阶段切换.webpscreens/式舆防卫战/入口前可交互.webpscreens/式舆防卫战/弱点编队界面.webpscreens/式舆防卫战/战斗画面.webpscreens/式舆防卫战/挑战结果-S评级.webpscreens/式舆防卫战/挑战结果-下一防线.webpscreens/式舆防卫战/选关主界面-3of5.webpscreens/式舆防卫战/选关主界面-4of5.webpscreens/式舆防卫战/预备编队选队.webpscreens/快捷手册/作战TAB.webpscreens/快捷手册/目标TAB.webptest/zzz_od/backend/test_backend_context.pytest/zzz_od/backend/test_http_routes.pytest/zzz_od/backend/test_mcp_app.pytest/zzz_od/backend/test_schemas.py
| 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 时带能力边界提示 |
There was a problem hiding this comment.
🎯 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().
| 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 |
There was a problem hiding this comment.
🎯 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 保留该提示值;同时保留字段存在性验证。
对应主仓 #2517「画面建档 + skill 方法论 + analyze_screen vision_hint」的测试配套。
主仓 PR:OneDragon-Anything/ZenlessZoneZero-OneDragon#2517