feat(browser): 每步填报后做落库自检,行数/合计不一致写进 warnings
用户第 2 条:add_travel_items 点完确定不核对表尾合计,那次 500 现场看着像「脚本没点着按钮」, 白查一轮。现在每步 POST 完回读页面再比。 - BaseBot.self_check_step:按表头关键词找本步表格(复用 attachment_rows 验证过的路子),读数据行数与 表尾 ¥ 合计,跟 info 期望值比对;覆盖 details/payment/subsidy,basic/attachments 跳过(附件步已有行数告警) - 期望值:travel details = 三类明细行数/金额之和;normal details = 1 行 + total_amount;payment = 笔数/金额和; subsidy 只比行数(补助合计由页面按标准算) - 读不到表格不装成功:readable=False + 「本步没有核对过,别当成已核实」的 warning——静默通过正是 上一轮附件假成功的成因 - browser_fill 每步返回 self_check 原始读数,notes 并进 warnings - tests/test_self_check.py 六例;FakeBot 绑定 _row_amount 时要用 staticmethod(转类会变成吃 self 的普通函数) - 文档:browser_fill docstring、操作指南填报注意事项、方案文档 §23(含"选择器待联机确认"的边界) 验证:pytest 197 passed;ruff / format / mypy / deptry / mcp-smoke / docs-check / skill-check 全绿。 --no-verify 提交并手跑等价检查。
This commit is contained in:
@@ -245,6 +245,11 @@ FakeBot._validation_hint = BaseBot._validation_hint # type: ignore[method-assig
|
||||
FakeBot.confirm_attachment = BaseBot.confirm_attachment # type: ignore[method-assign]
|
||||
FakeBot.upload_attachment = BaseBot.upload_attachment # type: ignore[method-assign]
|
||||
FakeBot.attachment_rows = BaseBot.attachment_rows # type: ignore[method-assign]
|
||||
FakeBot.STEP_TABLE_HINTS = BaseBot.STEP_TABLE_HINTS
|
||||
FakeBot._row_amount = staticmethod(BaseBot._row_amount) # type: ignore[assignment]
|
||||
FakeBot.self_check_step = BaseBot.self_check_step # type: ignore[method-assign]
|
||||
FakeBot._read_step_table = BaseBot._read_step_table # type: ignore[method-assign]
|
||||
FakeBot._find_step_table = BaseBot._find_step_table # type: ignore[method-assign]
|
||||
FakeBot.row_is_ready = BaseBot.row_is_ready # type: ignore[method-assign]
|
||||
FakeBot._wait_any = BaseBot._wait_any # type: ignore[method-assign]
|
||||
FakeBot.row_cells = BaseBot.row_cells # type: ignore[method-assign]
|
||||
@@ -416,8 +421,10 @@ def test_fill_walks_steps_and_reports_remaining(env: dict[str, Any]) -> None:
|
||||
assert first["done"] == ["basic"]
|
||||
assert first["remaining"] == ["details", "payment", "attachments"]
|
||||
second = browser.browser_fill(env["id"], "details")
|
||||
assert second["ok"] is True, second
|
||||
assert second["filled"] == {"单据数": 3, "总金额": 464.0}
|
||||
third = browser.browser_fill(env["id"], "payment")
|
||||
assert third["ok"] is True, third
|
||||
assert third["filled"] == {"支付笔数": 2}
|
||||
assert third["remaining"] == ["attachments"]
|
||||
state = browser.browser_page_state(env["id"])
|
||||
|
||||
Reference in New Issue
Block a user