fix(api): add sync safety guards against degenerate SDS responses

Add SYNC_GUARDS thresholds so a partial/degenerate upstream response never
triggers a destructive operation:
- skip stale category deletion when the fetched tree is suspiciously small
  vs the existing SDS category count
- skip delist detection unless both leaf-category and seen-product counts
  are healthy

Verified: 77 tests pass; live SDS returns 226 categories (guard off),
incident-case ratios (2/226, 2/2) are correctly blocked.
This commit is contained in:
yeuimu
2026-08-20 16:37:44 +08:00
parent 79fabd85f7
commit aed9afef92
6 changed files with 342 additions and 45 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ PORT=3001
后台无需额外环境变量;Vite 代理已把 `/api/*` 转给 `http://localhost:3001`
### 3. 启动
### 3. 部署
启动顺序:先启动后端,再启动另两个。