fix: decouple manual tidy from vehicle assignment

This commit is contained in:
zgw
2026-07-24 11:37:43 +08:00
parent 947edbdbc8
commit 8b84459072
11 changed files with 240 additions and 66 deletions

View File

@@ -31,7 +31,7 @@
- Produces: `CapacityResult calculate(List<VehicleSnapshot> vehicles, int activeManualWorkflows, int maxConcurrency)`.
- Produces: `int AlgorithmProperties.getTidyManualMaxConcurrency()` and `void setTidyManualMaxConcurrency(int value)`.
- [ ] **Step 1: Write failing capacity and default tests**
- [x] **Step 1: Write failing capacity and default tests**
Replace assigned-vehicle assertions with literal cases proving:
@@ -43,7 +43,7 @@ assertThat(capacity.calculate(unavailableVehicles, 0, 3).newSlots()).isZero();
assertThat(new AlgorithmProperties().getTidyManualMaxConcurrency()).isEqualTo(3);
```
- [ ] **Step 2: Run tests and verify RED**
- [x] **Step 2: Run tests and verify RED**
Run:
@@ -53,7 +53,7 @@ mvn -pl ruoyi-admin -am -Dtest=TidyVehicleCapacityTest,AlgorithmConfigurationTes
Expected: test compilation fails because the new capacity signature and property getter do not exist.
- [ ] **Step 3: Implement the minimal capacity and configuration changes**
- [x] **Step 3: Implement the minimal capacity and configuration changes**
Implement:
@@ -69,7 +69,7 @@ Add `tidyManualMaxConcurrency = 3` plus getter/setter to `AlgorithmProperties`,
tidy-manual-max-concurrency: ${FORTUCKY_TIDY_MANUAL_MAX_CONCURRENCY:3}
```
- [ ] **Step 4: Run focused tests and verify GREEN**
- [x] **Step 4: Run focused tests and verify GREEN**
Run the command from Step 2. Expected: all specified tests pass.
@@ -85,11 +85,11 @@ Run the command from Step 2. Expected: all specified tests pass.
- Consumes: `TidyVehicleCapacity.calculate(vehicles, activeWorkflows, properties.getTidyManualMaxConcurrency())`.
- Removes: `selectActiveManualTidyVehicleIds` and `assignTidyWorkflowVehicle` runtime mapper operations.
- [ ] **Step 1: Write a failing scheduler behavior test**
- [x] **Step 1: Write a failing scheduler behavior test**
Create a scheduler with mocked database/external boundaries. Return two healthy idle vehicles, one active workflow, maximum concurrency `3`, and two planner candidates. Assert that `TidyWorkflowTransaction.start` receives both candidates in planner order. The existing implementation starts only one because it subtracts the active workflow from the already-idle snapshot.
- [ ] **Step 2: Run the scheduler test and verify RED**
- [x] **Step 2: Run the scheduler test and verify RED**
Run:
@@ -99,7 +99,7 @@ mvn -pl ruoyi-admin -am -Dtest=ManualTidySchedulerTest -Dsurefire.failIfNoSpecif
Expected: FAIL because only one workflow is started or compilation fails until the scheduler adopts the new capacity signature.
- [ ] **Step 3: Implement scheduler ownership changes**
- [x] **Step 3: Implement scheduler ownership changes**
Remove assigned-vehicle collection and the vehicle iterator. Calculate slots with the configured ceiling, iterate only planner candidates, and call:
@@ -111,7 +111,7 @@ Do not update a workflow vehicle. Log a candidate-oriented warning if workflow c
Remove the two unused vehicle-binding methods from `WmsAlgorithmMapper` and their MyBatis XML statements. Leave the schema column and diagnostics unchanged.
- [ ] **Step 4: Run focused tidy tests and verify GREEN**
- [x] **Step 4: Run focused tidy tests and verify GREEN**
Run:
@@ -130,13 +130,13 @@ Expected: all specified tests pass.
**Interfaces:**
- Produces: deployable `ruoyi-admin/target/ruoyi-admin.jar` and an updated handoff record.
- [ ] **Step 1: Run source and diff checks**
- [x] **Step 1: Run source and diff checks**
```powershell
git diff --check
```
- [ ] **Step 2: Run the full reactor tests**
- [x] **Step 2: Run the full reactor tests**
```powershell
mvn test
@@ -144,7 +144,7 @@ mvn test
Expected: all reactor tests pass with zero failures and errors.
- [ ] **Step 3: Build the deployment artifact**
- [x] **Step 3: Build the deployment artifact**
```powershell
mvn -DskipTests package
@@ -152,10 +152,10 @@ mvn -DskipTests package
Expected: all reactor modules report `SUCCESS`.
- [ ] **Step 4: Update the handoff record**
- [x] **Step 4: Update the handoff record**
Record the capacity-ownership change, verification totals, JAR size, and current SHA-256. Preserve the existing statement that an actual-WCS read-only snapshot smoke test remains a deployment step.
- [ ] **Step 5: Review and commit exact files**
- [x] **Step 5: Review and commit exact files**
Run `git diff --cached --check`, inspect the complete staged diff, and commit only the implementation, tests, configuration, spec/plan files that belong to this change. Verify `git show --name-status HEAD` after committing.