fix(collect-data): 品牌检测查询失败不再写入无效品牌表,避免故障期误杀永久拉黑
线上 task-27265 采集结果 0 行的根因:.env 缺 export 导致 Java 请求 16890 不带 X-Token 全线 422 -> 整批 queryFailed,而 filterByBrandCheck 把 queryFailed 与 rejected 一并写入 biz_invalid_asin_data,故障品牌被 永久拉黑,后续任务同品牌商品全部被 invalidFiltered 误杀(9-01 起所有 采集任务均 0 行)。改为仅真正判定无效的 rejected 才写表,rejected 为空 不触发写入;新增 2 个单测固化契约。
This commit is contained in:
+24
@@ -208,6 +208,30 @@ class CollectDataServiceTxBoundaryTest {
|
||||
verify(invalidAsinBatchWriter).writeBatch(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void brandQueryFailedRowsNotWrittenToInvalidWriter() {
|
||||
CollectDataResultRowVo queryFailed = new CollectDataResultRowVo();
|
||||
queryFailed.setAsin("B0QUERYFAIL");
|
||||
when(brandBatchFilter.filter(any())).thenReturn(
|
||||
new CollectDataBrandBatchFilter.BrandBatchOutcome(List.of(), List.of(queryFailed), List.of()));
|
||||
|
||||
service.submitResult(TASK_ID, submitRequest());
|
||||
|
||||
verify(invalidAsinBatchWriter, never()).writeBatch(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void emptyRejectedOutcomeSkipsInvalidWriter() {
|
||||
CollectDataResultRowVo accepted = new CollectDataResultRowVo();
|
||||
accepted.setAsin("B0OK");
|
||||
when(brandBatchFilter.filter(any())).thenReturn(
|
||||
new CollectDataBrandBatchFilter.BrandBatchOutcome(List.of(), List.of(), List.of(accepted)));
|
||||
|
||||
service.submitResult(TASK_ID, submitRequest());
|
||||
|
||||
verify(invalidAsinBatchWriter, never()).writeBatch(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void rustfsFailureAbortsWithoutPartialChunk() {
|
||||
when(transientPayloadStorageService.extractPointer(anyString())).thenReturn("local:/tmp/x");
|
||||
|
||||
Reference in New Issue
Block a user