From f3af00e6454bb029f5e5c6c2d958f72dcdd9b0c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=BF=E4=BA=91=E7=A7=8B=E6=9C=88?= <15273589815@163.com> Date: Sun, 13 Sep 2026 19:30:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(trade):=20=E8=A1=A5=20from=20None=20?= =?UTF-8?q?=E4=BF=AE=E6=8E=89=20ruff=20B904=EF=BC=9B=E9=99=84=20integratio?= =?UTF-8?q?n=20=E6=8A=A2=E9=98=9F=E5=88=97=E7=9A=84=E5=A4=8D=E7=8E=B0?= =?UTF-8?q?=E7=BB=93=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 两件事,都源自组员 e3c316a(下单授权与适当性校验)合并之后: 1) ruff B904:app/service/trade_service.py 在 except 分支里抛 SuitabilityMismatchError 时没写 from None/from exc,门禁因此变红。 这里被捕获的是"风险等级字段解析失败",对上层没有诊断价值, 用 from None 截断因果链即可。 2) tests/integration 出现 2 个失败,**与代码无关**,是常驻 Agent Worker 抢队列: - 带 Worker 跑:102 passed / 2 failed - 停掉 Worker 跑:104 passed(已复现两次) 失败用例是 test_complete_run_rolls_back_every_write_on_outbox_conflict 与 test_cancel_is_idempotent_and_terminates_original_request,都是 run 队列相关 —— Worker 会把测试创建的 run 领走并执行,测试自己的状态机就乱了。 这正是 docs/20 与 AGENTS.md「跑验收前先停常驻 Worker」那条的实际复现, 顺手把结论写进 commit 备查:判断 integration 红不红之前,先确认 Worker 在不在跑。 --- app/service/trade_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/service/trade_service.py b/app/service/trade_service.py index 9f30deb..c600c73 100644 --- a/app/service/trade_service.py +++ b/app/service/trade_service.py @@ -202,7 +202,7 @@ class TradeService: except (AttributeError, ValueError): raise SuitabilityMismatchError( f"产品 {getattr(product, 'product_code', '')} 风险等级无效,交易已拒绝" - ) + ) from None decision = await evaluate( SuitabilityToolInput( customer_id=str(customer_id),