Commit Graph
1 Commits
Author SHA1 Message Date
Ubuntu d68cdaf7ff feat(主系统对接): 导入失败留痕 + 首次告警 + 恢复销账(后续不再"无声收不到")
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
开发者 2026-10-17:「后续不能出现这种无法接收到的情况」。

事故链(本地真机):主系统 22:48 派单并推 preparations.allocated(SUP37831443),
我方因"台账指向的本系统订单已不存在"返回 500,主系统重试 3 次后放弃;
旧实现只打日志、界面/通知零痕迹,直到人工查主系统投递记录才发现。

三层保证:
① 自愈(上一提交 ef81c7c):陈旧占坑/台账指针自动清理并重建;
② 可见+告警(本次):失败落 public.main_system_import_failures
   (键 = 分公司×配送日×主系统分公司×主系统订单,attempts 累加不刷屏),
   首次失败站内通知 admin/super_admin(6 小时内去重),新增只读接口
   GET /api/integration/main-system/import-failures 供界面/排障查看;
   下一次导入成功自动销账(resolved_at)。
③ 兜底重试:定时对账每 10 分钟一次(已存在);生产需补 client secret 才可用(已在文档标注)。

新增迁移 20261057;trackDayOutcome() 挂在建单/追加两条返回路径上,异常一律吞掉(告警不许反过来把导入搞挂)。

验证:
· 服务侧真库冒烟:首次失败 attempts=1/isFirst=true → 再次 attempts=2;open 可查;clear 后 open=0
· 迁移 upsert 语义(同键累加、单行)真库事务内验证通过
· 单测 mainSystemImportFailureLedger 6 条;mainSystem 子集 30 文件 / 473 用例全过
· 设计门禁:8 通过 / 1 已知红 check-ai-cost / verify-facts 因本地缺 tenant_br003 红(均基线)
2026-10-17 23:06:47 +08:00