From 57451dc26944cb99f9b16c81044d44f7fce681c9 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 27 四月 2026 10:36:44 +0800
Subject: [PATCH] fix: keep flow topology independent from capacity

---
 src/test/java/com/zy/ai/service/FlowTopologySnapshotServiceImplTest.java |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/test/java/com/zy/ai/service/FlowTopologySnapshotServiceImplTest.java b/src/test/java/com/zy/ai/service/FlowTopologySnapshotServiceImplTest.java
index f0adab1..811fb52 100644
--- a/src/test/java/com/zy/ai/service/FlowTopologySnapshotServiceImplTest.java
+++ b/src/test/java/com/zy/ai/service/FlowTopologySnapshotServiceImplTest.java
@@ -70,6 +70,32 @@
         assertEquals("OUT", result.getDirectionCode());
     }
 
+    @Test
+    void flowStationIdsAndCountsAreNotTruncatedByBufferCapacity() {
+        FlowTopologySnapshotServiceImpl service = new FlowTopologySnapshotServiceImpl();
+        StationFlowCapacity capacity = capacity(101, "OUT", 1);
+        Map<Integer, List<Integer>> adjacency = new LinkedHashMap<>();
+        adjacency.put(101, Arrays.asList(104, 102, 103));
+
+        AutoTuneFlowTopologyItem item = service.buildTopologyItem(
+                capacity,
+                adjacency,
+                Arrays.asList(
+                        runtime(101, 1, 0, 0),
+                        runtime(102, 1, 1, 0),
+                        runtime(103, 1, 0, 9001),
+                        runtime(104, 0, 0, 0)
+                )
+        );
+
+        assertEquals(Arrays.asList(101, 102, 103, 104), item.getFlowStationIds());
+        assertEquals(2, item.getOccupiedCount());
+        assertEquals(1, item.getLoadingCount());
+        assertEquals(1, item.getTaskHoldingCount());
+        assertEquals(1, item.getNonAutoingCount());
+        assertEquals(0, item.getFreeCount());
+    }
+
     private StationFlowCapacity capacity(Integer stationId, String directionCode, Integer bufferCapacity) {
         StationFlowCapacity capacity = new StationFlowCapacity();
         capacity.setStationId(stationId);

--
Gitblit v1.9.1