fix: preserve required shadow comparison evidence

This commit is contained in:
zgw
2026-09-03 15:52:52 +08:00
parent 746a6b5647
commit 9617038e4c
2 changed files with 136 additions and 59 deletions

View File

@@ -212,13 +212,22 @@ class ShadowPlanningEngineTest {
ShadowInputMapper mapper = mock(ShadowInputMapper.class);
when(mapper.insertComparison(any(), any(), any(), any(Long.class),
any(Instant.class), any(), any(), any())).thenReturn(1);
ShadowPlanningEngine engine = engine(mock(SchedulingFacade.class), mapper);
String shadowDiagnostic = "snapshotGeneration=42; snapshotSync=2026-09-03T00:00:00Z"
+ "; sourceSignature=ABC123; project=" + "中".repeat(255)
+ "; shadowCandidates=17; reason=" + "长".repeat(5000);
InboundShadowObservation observation = new InboundShadowObservation(
true, 42L, "01", SNAPSHOT.synchronizedAt(), SNAPSHOT.sourceSignature(),
"JOB-1", "READY", "SPACE-9", shadowDiagnostic);
SchedulingFacade facade = mock(SchedulingFacade.class);
String oversized = "中".repeat(5000);
ShadowInboundReference reference = inboundReference(oversized);
reference.setRequestId(oversized);
reference.setProjectNo(oversized);
reference.setProductId(oversized);
reference.setLotNo(oversized);
reference.setShadowCandidateCount(17);
when(mapper.selectInboundInput("01", 42L, "TASK-1", "TRAY-1")).thenReturn(reference);
when(mapper.selectPublishedSnapshot("01")).thenReturn(descriptor(SNAPSHOT));
when(facade.planInboundFromPublishedSnapshot(eq("01"), any()))
.thenReturn(new InboundPlanningResult(InboundPlan.assigned(inboundAssignment()),
VersionToken.numeric(8)));
ShadowPlanningEngine engine = engine(facade, mapper);
InboundShadowObservation observation = engine.planInbound(SNAPSHOT, "TASK-1", "TRAY-1");
engine.compareInbound(observation, "READY", "LEGACY-SPACE-9");
@@ -236,13 +245,23 @@ class ShadowPlanningEngineTest {
ShadowInputMapper mapper = mock(ShadowInputMapper.class);
when(mapper.insertComparison(any(), any(), any(), any(Long.class),
any(Instant.class), any(), any(), any())).thenReturn(1);
ShadowPlanningEngine engine = engine(mock(SchedulingFacade.class), mapper);
String shadowDiagnostic = "snapshotGeneration=42; snapshotSync=2026-09-03T00:00:00Z"
+ "; sourceSignature=ABC123; project=" + "中".repeat(255)
+ "; shadowMatches=23; reason=" + "长".repeat(5000);
OutboundShadowObservation observation = new OutboundShadowObservation(
true, 42L, "01", SNAPSHOT.synchronizedAt(), SNAPSHOT.sourceSignature(),
"DETAIL-1", "READY", "STOCK-1", "SPACE-9", shadowDiagnostic);
SchedulingFacade facade = mock(SchedulingFacade.class);
String oversized = "中".repeat(5000);
ShadowStockReference reference = projectReference(oversized);
reference.setRequestId(oversized);
reference.setProjectNo(oversized);
reference.setProductId(oversized);
reference.setTrayNo(oversized);
reference.setStockId(oversized);
reference.setSpaceId(oversized);
reference.setShadowMatchCount(23);
when(mapper.selectProjectOutboundReference("01", 42L, "DETAIL-1")).thenReturn(reference);
when(mapper.selectPublishedSnapshot("01")).thenReturn(descriptor(SNAPSHOT));
when(facade.planOutboundFromPublishedSnapshot(eq("01"), any()))
.thenReturn(OutboundPlan.ready(outboundAssignment(), TaskCountEstimate.zero()));
ShadowPlanningEngine engine = engine(facade, mapper);
OutboundShadowObservation observation = engine.planProjectOutbound(SNAPSHOT, "DETAIL-1");
engine.compareOutbound(observation, "10");