feat(brand-check): 品牌检测按任务归属用户取代理并计用量——三处调用接入

- BrandCheckClient 契约扩展:构造器收 UserApiSecretService,check/checkAll/
  checkTitleText(s) 全系带 userId,请求体新增 user_id + proxy_url(proxy 取自
  用户密钥库 module=proxy);响应新增 reason/retryable,retryable=false(供应商
  拒付、用户没配代理)当场停重试阶梯并短路整批
- 三处调用方接入:CollectDataService 品牌过滤、CollectDataBrandRecheckScheduler
  补测(markAttempted 带真实原因)、AppearancePatentLlmClient 标题查标(取
  SecretUsageContext 归属用户)
- 用户未配置代理:整批本地定论「用户未配置代理」,零 HTTP,不再有平台钥匙兜底
- 测试迁移:15 支测试文件按新契约迁移(3 参构造、userId 实参、BrandCheckBatchResult
  第 4 位 reason、Mockito 匹配器加宽);HTTP 类测试 stub findPlainValue 非空代理
  以绕开零 HTTP 短路。13 类 119 例全绿(1 skip 为既有快照写盘门),test-compile 零错误
This commit is contained in:
2026-10-20 18:14:52 +08:00
parent 492a27270a
commit 6c14f29a87
20 changed files with 395 additions and 220 deletions
@@ -140,8 +140,8 @@ class DuplicateSubmissionContractTest {
row.setAsin("B0DUP1234");
lenient().when(collectDataBatchQuery.filter(any(), any())).thenReturn(
new CollectDataBatchQuery.FilterResult(List.of(row), 0, 0));
lenient().when(brandBatchFilter.filter(any())).thenReturn(
new CollectDataBrandBatchFilter.BrandBatchOutcome(List.of(), List.of(), List.of(row)));
lenient().when(brandBatchFilter.filter(any(), any())).thenReturn(
new CollectDataBrandBatchFilter.BrandBatchOutcome(List.of(), List.of(), List.of(row), ""));
lenient().when(resultItemBatchWriter.upsertAccepted(anyLong(), anyLong(), anyString(), anyInt(), any(), anyString()))
.thenReturn(new CollectDataResultItemBatchWriter.UpsertCounts(1, 0, 1));
lenient().when(resultDetailCodec.encodeChunk(any())).thenReturn("{\"chunk\":1}");