fix(webhook): 忽略原因与 IRIS 实例统一为 ignored_company
IRIS 侧用的是 ignored_company,LICA 侧我原先写的是 org_mismatch ——
MOM 不解析这个字段,但排查时两边日志要对着看,字段名不一致会白白浪费时间。
统一成 IRIS 已在用的 ignored_company(IRIS 在线上,不该为这点小事动它)。
IRIS 侧实测建议里说的「语法编译检查证明不了行为」是对的,我这边也是按
真实载荷逐个验的。
顺带把约定写进 AGENTS.md —— 包括「两边规则刻意相反、不要统一」这条,
很容易被后来者顺手改掉。
实测:
LICA -> {"ok":true,"matched":false} (无 reason = 通过校验)
IRIS/空串/缺失 -> {"ok":true,"matched":false,"reason":"ignored_company"}
outbound 同规则
This commit is contained in:
@ -176,8 +176,11 @@ async def mom_inbound_webhook(
|
||||
# 旧配置直接打这个接口,也不会把别的部门的设备状态改掉。
|
||||
# 返回 200 + matched=False 而非 4xx —— 与「未命中」保持同一契约,
|
||||
# 避免 MOM 侧把它当成故障去重试。
|
||||
#
|
||||
# ⚠️ reason 的取值 "ignored_company" 与 IRIS 实例保持一致 —— MOM 侧不解析
|
||||
# 它,但排查时两边日志对着看,字段名不一致会白白浪费时间。
|
||||
if not _belongs_to_this_org(payload.company_name):
|
||||
return {"ok": True, "matched": False, "reason": "org_mismatch"}
|
||||
return {"ok": True, "matched": False, "reason": "ignored_company"}
|
||||
|
||||
explicit_revoke = _is_outbound_revoke(payload)
|
||||
|
||||
@ -390,7 +393,7 @@ async def mom_outbound_webhook(
|
||||
|
||||
# ── 部门校验(纵深防御)—— 同 mom_inbound,理由见该处注释
|
||||
if not _belongs_to_this_org(payload.company_name):
|
||||
return {"ok": True, "matched": False, "reason": "org_mismatch"}
|
||||
return {"ok": True, "matched": False, "reason": "ignored_company"}
|
||||
|
||||
# ── 按 serial_number(优先)或 sku 匹配"在仓库/已入库"的产品 ──
|
||||
product = None
|
||||
|
||||
Reference in New Issue
Block a user