fix(b82-01): 任务行部分字段落库改 update(null, wrapper),13 处部分实体 updateById 不再抹 failure_category
B82-01:failureCategory 标 FieldStrategy.ALWAYS(V186 让清错误分支的 null 真落库)的代价是任何 new 出来的部分实体走 updateById 都把该列无条件抹回 NULL。现网只读探针(2026-11-05,SSH 主机B)实证列全表零非空:近 7 天 194 条 FAILED 全空,9 条文案命中 CREDENTIAL/DELIVERY markers 的行列也是空。本笔只动调用点一边;注解半边由 TaskFailureCategoryMigrationV186Test 的 ALWAYS 钉守住。 写点转换(13 处 updateById,12 个条目,DedupeRunService 收尾一处两调用):convert/split/productrisk/queryasin/withdraw/similarasin/appearance-patent/pricetrack 显式两到四列;shopdatacrawl 快照+归属三列;deletebrand 终态分支 error_message 与分类同笔配对 TaskFailureLedger.categoryOf(护栏格1连线语义);dedupe FAILED 收尾同笔配对;similarasin 归属绑定(rustfs 回退)。Explore 初判 12 处漏了 withdraw/pricetrack 族——逐支验明全是 loadTaskForExecution 全实体(selectById/缓存血统),非抹列点,留痕不扩 scope;DELIVERY/CREDENTIAL 两族终态写点接 ledger 属后续批,不在本笔。 护栏 TaskFailureCategoryGuardrailTest 5→7:① ledger 对六组 markers 各出一条值非空断言(配对写恒 NULL 也绿那半堵上);② .updateById( 总量棘轮 173→160(本仓 ALWAYS 字段还有 PriceTrackLoopRun/ShopKey/SkipPriceAsin 四实体,棘轮按全量钉,新增写法必须登记复审)。测试适配:共享探针 UpdateWrapperProbe(getSqlSet 列序+MPGENVAL 精确取值+列名 snake 归一——单测 JVM 的 Lambda 列缓存可能被自动初始化成驼峰,不归一则快照取决于测试类执行顺序);4 份 golden 重钉 11 行(窄写面 status 不在写面渲染成 -);ShopDataCrawlOwnerColumnTest 假 DB 从只会 CAS 升级为按 SQL 语义应用 SET 段(whereEq 校验 id/status eq);SimilarAsinTaskServiceSubmitTest 归属断言改为录 SET 段断言零 owner_instance_id(touchJavaSideTaskActivity 本就合法走 update(null,wrapper),verify(never) 会误杀)。 门禁:受影响七支定向 50/0 失败/0 错误/3 skipped(既有 skip,零新增);mvn -o test 整量 5321/0 失败/0 错误/19 skipped BUILD SUCCESS(5:01,skip 数与在册基线逐字相同);后端无 lint/格式器如实跳过;未动 application.yml/路由/Flyway/env,门禁5不适用。
This commit is contained in:
+16
-1
@@ -226,7 +226,10 @@ class SimilarAsinTaskServiceSubmitTest {
|
||||
configureNewChunkAndScope();
|
||||
when(taskChunkMapper.selectCount(any())).thenReturn(1L);
|
||||
configureChunkStore(true);
|
||||
when(fileTaskMapper.updateById(any(FileTaskEntity.class))).thenReturn(0);
|
||||
// B82-01:owner 绑定失败的注入点改打 update(null, wrapper)——部分实体 updateById 已从写面退场
|
||||
when(fileTaskMapper.update(org.mockito.ArgumentMatchers.isNull(),
|
||||
org.mockito.ArgumentMatchers.any(com.baomidou.mybatisplus.core.conditions.Wrapper.class)))
|
||||
.thenReturn(0);
|
||||
|
||||
IllegalStateException thrown = assertThrows(IllegalStateException.class,
|
||||
() -> service.submitResult(TASK_ID, request(false)));
|
||||
@@ -248,11 +251,23 @@ class SimilarAsinTaskServiceSubmitTest {
|
||||
configureChunkStore(true);
|
||||
when(transientPayloadStorageService.extractPointer(STORED_CHUNK_POINTER)).thenReturn(CHUNK_POINTER);
|
||||
when(taskChunkMapper.selectCount(any())).thenReturn(1L);
|
||||
// B82-01:owner 绑定也改走 update(null, wrapper)——但活动心跳(touchJavaSideTaskActivity)
|
||||
// 本来就合法地走同一形状,所以不能 verify(never()).update;改成录下每一笔 SET 段,
|
||||
// 断言「没有任何一次写 owner_instance_id」=重复候选确实没被改绑归属。
|
||||
java.util.List<java.util.Map<String, Object>> updateSets = new java.util.ArrayList<>();
|
||||
when(fileTaskMapper.update(org.mockito.ArgumentMatchers.isNull(),
|
||||
org.mockito.ArgumentMatchers.any(com.baomidou.mybatisplus.core.conditions.Wrapper.class)))
|
||||
.thenAnswer(invocation -> {
|
||||
updateSets.add(com.nanri.aiimage.testutil.UpdateWrapperProbe.setValues(invocation.getArgument(1)));
|
||||
return 1;
|
||||
});
|
||||
|
||||
service.submitResult(TASK_ID, request(false));
|
||||
|
||||
verify(taskChunkMapper, never()).insert(any(TaskChunkEntity.class));
|
||||
verify(fileTaskMapper, never()).updateById(any(FileTaskEntity.class));
|
||||
assertTrue(updateSets.stream().noneMatch(sets -> sets.containsKey("owner_instance_id")),
|
||||
"重复候选不得改写归属列(owner 绑定只许发生在新增 chunk 的路径上)");
|
||||
verify(transientPayloadStorageService, never()).deletePayloadIfPresent(STORED_CHUNK_POINTER);
|
||||
}
|
||||
|
||||
|
||||
+9
-2
@@ -171,9 +171,16 @@ class SimilarAsinCreateTaskSnapshotTest {
|
||||
return 1;
|
||||
}).when(fileTaskMapper).insert(any(FileTaskEntity.class));
|
||||
doAnswer(invocation -> {
|
||||
captured.events.add("task.update: " + renderTaskUpdate(invocation.getArgument(0)));
|
||||
// B82-01:任务行部分字段落库改走 update(null, wrapper)——从 SET 段重建探针实体,
|
||||
// moduleType/status 不在写面里 ⇒ 渲染成 "-",快照把「窄写」钉在脸上
|
||||
com.baomidou.mybatisplus.core.conditions.Wrapper<FileTaskEntity> wrapper = invocation.getArgument(1);
|
||||
FileTaskEntity probe = new FileTaskEntity();
|
||||
probe.setId(com.nanri.aiimage.testutil.UpdateWrapperProbe.eqId(wrapper));
|
||||
probe.setResultJson((String) com.nanri.aiimage.testutil.UpdateWrapperProbe.setValues(wrapper).get("result_json"));
|
||||
captured.events.add("task.update: " + renderTaskUpdate(probe));
|
||||
return 1;
|
||||
}).when(fileTaskMapper).updateById(any(FileTaskEntity.class));
|
||||
}).when(fileTaskMapper).update(org.mockito.ArgumentMatchers.isNull(),
|
||||
org.mockito.ArgumentMatchers.any(com.baomidou.mybatisplus.core.conditions.Wrapper.class));
|
||||
doAnswer(invocation -> {
|
||||
captured.events.add("result.insert: " + renderResultInsert(invocation.getArgument(0)));
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user