Files
SupplierSystem/server
Ubuntu e1efe3b2e9
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
fix(对接体检): 回读通道鉴权改为 Bearer(与主系统实现对齐)+ 编码不认识单列原因并 warn
背景:主系统第八批已交付(`22ef34a8` 绑定入口 + `0dad08f3` binding.changed 推送),本轮做对接体检。

体检发现的**我方**缺口(已修):
  1. 回读通道鉴权不匹配:他们交付的 `GET /api/supplier/integration-bindings` 走
     `Authorization: Bearer <对接 token>`(按 token 所属 client 圈作用域),
     而我方初版按草稿发 `X-Client-Id`/`X-Client-Secret` ⇒ 会 401。已改为用
     `getMainSystemToken()` 换 token 后 Bearer 调用;并补 `?include_disabled=1`
     (默认只返回 status=1 ⇒ 不加就永远同步不到"解绑")。
     supplier_code 取法:镜像 active 绑定 → 分公司手工登记 → 台账最近值;都没有则跳过(冷启动无绑定可对账)。
  2. 「编码不认识」与「这家没绑我们」原先都回 `not_bound`,真机上分不清。现在单列
     `unknown_access_code`(并 `console.warn` 打出编码原值)—— 抄错一位是这条路上最可能的人为错,
     必须能从对方的投递日志/我方日志一眼看出。

体检发现(记录进清单 §2.11.4b,给我方待办):
  · 他们的 `bindIntegrationSupplier()` **不校验编码格式**,错码会静默变成"没绑"⇒ 建议加正则
    `^SC[23456789ABCDEFGHJKMNPQRSTUVWXYZ]{10}$`(P1 加固,我们已用 warn + 独立 reason 兜住可观测性)。

体检结论(他们的实现与契约逐条对齐):
  · 信封带 `subsystem_code`(`supplierPrepWebhookService.ts:149`,空码行为 null);
  · `binding.changed` 推送:事件名/字段(同时给 subsystem_code 与 access_code)/改绑=unbind+bind/
    目标解析不看 status(解绑也要推)✅;
  · 迁移 `20261014_supplier_integration_subsystem_code.sql` 加列 + 部分索引,且**空码 = 存量行为不变**;
  · P0-4:自动授权**只对已绑编码的行补**(`supplierIntegrationClientService.ts:420-440`)✅;
  · 回读端点按 token 的 client 圈作用域(无跨客户端视图)✅。

验证:服务端 2333 用例 / 失败 30、失败文件 24 = 与基线逐字相同(无新增失败);
branchAccessCode 14 例 + branchBindingSync 16 例全绿;tsc 通过;门禁同基线(check-ai-cost 既知红)。
2026-10-10 17:47:39 +08:00
..