fix(firstleg): allow confirmed preload reassign during loading

This commit is contained in:
2026-08-24 12:34:34 +08:00
parent 2389a63858
commit 4377a7acd9
4 changed files with 38 additions and 3 deletions
@@ -360,6 +360,8 @@ class SmartLoadingServiceTest {
Plan result = service.assign(1, new AssignRequest(10L, 20L, 1, 5, "assign-loading"), 7, "u");
assertThat(result.status()).isEqualTo("LOADING");
verify(splitPreloadService).ensureForRunningLoadingAllocation(9L, 10L, 7L, "u");
verify(splitPreloadService, never()).ensurePendingForLoadingAllocation(anyLong(), anyLong(), anyLong(), anyString());
var order = inOrder(loadingPickService, repository, loadingModelBridge);
order.verify(loadingPickService).lockMutable(1L);
order.verify(repository).touch(1, 5, 7, "u");
@@ -80,4 +80,16 @@ class SplitPreloadServiceTest {
verify(repository, never()).createPlan(any());
}
@Test
void runningLoadingAllocationMayReuseConfirmedPreload() {
when(repository.findInbound(10, 20)).thenReturn(new InboundSnapshot(20L, 10L, "WAIT_SPLIT", 3));
PreloadPlanEntity plan = new PreloadPlanEntity();
plan.setStatus("CONFIRMED");
when(repository.findPlan(10, 20)).thenReturn(plan);
service.ensureForRunningLoadingAllocation(10, 20, 7, "admin");
verify(repository, never()).createPlan(any());
}
}