Files
SupplierSystem/server/tests
Ubuntu 44a660e18a
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
perf(跨系统): 出站闸门唯一化 + 无未决不拉(未绑编码 = 零沟通)
开发者要求:未绑接入编码的分公司全程不该与主系统沟通;后面可能几千家,
有的连主系统有的不连。核查发现 8-13 的收紧只闸住了"拉货"一条路:

- 申请列表 Q5/Q6(实收对账 / 我方价量对账 / 归档反查 / 按行分组)仍读"任何 active 绑定"
  ⇒ 迁移回填行、空接入编码行也解析出 supplier_code ⇒ 抱着注定 403 的编码换 Token + 发 GET
  (对方已收紧为「必须有接入编码才放行」,回执 §4.5.22)
- 定时对账 fan-out 名单用"有任何 active 绑定行"⇒ 这些分公司每轮白跑一遍
- 两条对账**先拉后判**:本地一条待审都没有也每 10 分钟发一次 GET

P1(判定点唯一):
- branchAccessCode:新增 listConnectableBindingsForBranch(四条规则压进一条 JOIN)+
  listConnectableBranchCodes(同谓词的分公司名单);listAutoPullableBindingsForBranch 保留旧名转发
- mainSystemBranchApi.listSupplierCodesForBranch → 同一判定点(出站正门)
- mainSystemOrderImport.listMainSupplierBranchCodes → listConnectableBranchCodes(fan-out 名单)

P2(无未决 ⇒ 不拉):
- reconcilePendingActualQtyRequests / reconcileOurPriceQtyRequestsWithMainSystem
  先查本地待审计数(轻查询),为 0 直接返回 —— 两者本来就只处理本地 pending 行,语义无变化

验证(真库冒烟,本地栈):
- 已绑编码的 BR002/BR003:仍进名单、仍解析出 1/2 条编码、拉取 ok(真 HTTP);
  真跑 fan-out branches=2 / failed=0
- 反证:临时清空 BR003 编码 ⇒ 名单 ["BR002"]、编码 []、拉取 not_bound(零 HTTP),BR002 不受影响;
  夹具已还原(残留 0)
- P2:0 条待审 ⇒ 跳过拉取;BR002 现库 1 条真实待审 ⇒ 不短路照旧拉;探针待审 ⇒ 立刻恢复真拉取
- 用例:mainSystemReconcileShortCircuit.test.ts(4 例,新)+ bindingAutoPullGuard P1/P2 段(14 例)
  + mainSystemBranchApi(11 例);服务端 tsc 0 错;全量 26 failed/377 passed 与基线持平
- 设计文 docs/design/20261013-主系统订单被本地拉取机制与绑定缺陷.md §9(收益估算:1000 家 43万→14万 GET/天)
2026-10-13 14:28:30 +08:00
..