docs: snapshot Local G2 detector report order

This commit is contained in:
梁薄云
2026-07-31 16:09:20 +08:00
parent 5b072c0e35
commit 49c7e5b0c0
@@ -1194,14 +1194,26 @@ git commit -m "feat: validate local G2 candidate quality"
- Create: `ClumsyPilot/tests/verify_path_smoothing_local_g2_integration.ps1` - Create: `ClumsyPilot/tests/verify_path_smoothing_local_g2_integration.ps1`
- Modify: `ClumsyPilot/tests/verify_path_smoothing_service.ps1` - Modify: `ClumsyPilot/tests/verify_path_smoothing_service.ps1`
**Planned imports:**
```csharp
using System.Collections.ObjectModel;
```
**Interfaces:** **Interfaces:**
- Consumes: validated request, prepared path and fair raw baseline. - Consumes: validated request, prepared path and fair raw baseline.
- Consumes `LocalG2RegionWorkOrder.TryCreate(...)`; pipeline iteration must not use report-order regions directly. - Snapshots detector-order regions into an immutable read-only `reportOrder` before
- Publishes region reports in the detector's original ascending order, independently of processing order. calling `LocalG2RegionWorkOrder.TryCreate(...)`; work-order creation does not
mutate this snapshot, and pipeline iteration must not use report-order regions
directly.
- Publishes region reports by indexed iteration over `reportOrder` in the
detector's original ascending order, independently of processing order.
- Produces: - Produces:
```csharp ```csharp
private readonly LocalG2RegionWorkOrder _workOrder = new LocalG2RegionWorkOrder();
internal PathSmoothingResult Smooth( internal PathSmoothingResult Smooth(
PathSmoothingRequest request, PathSmoothingRequest request,
PreparedPath preparedPath, PreparedPath preparedPath,
@@ -1291,8 +1303,11 @@ Expected: fail because the service cannot resolve `LocalG2Quintic`.
Pipeline pseudocode must be implemented directly: Pipeline pseudocode must be implemented directly:
```csharp ```csharp
IReadOnlyList<LocalG2SmoothingRegion> reportOrder =
new ReadOnlyCollection<LocalG2SmoothingRegion>(new List<LocalG2SmoothingRegion>(regions));
if (!_workOrder.TryCreate( if (!_workOrder.TryCreate(
regions, reportOrder,
out IReadOnlyList<LocalG2SmoothingRegion> workRegions, out IReadOnlyList<LocalG2SmoothingRegion> workRegions,
out string orderReason)) out string orderReason))
{ {
@@ -1350,9 +1365,9 @@ foreach (LocalG2SmoothingRegion region in workRegions)
} }
} }
var reports = new List<PathSmoothingRegionReport>(regions.Count); var reports = new List<PathSmoothingRegionReport>(reportOrder.Count);
for (int reportIndex = 0; reportIndex < regions.Count; reportIndex++) for (int reportIndex = 0; reportIndex < reportOrder.Count; reportIndex++)
reports.Add(reportsByRegion[regions[reportIndex]]); reports.Add(reportsByRegion[reportOrder[reportIndex]]);
``` ```
Regions are disjoint after merging, so successful earlier replacements remain when a later region fails. Regions are disjoint after merging, so successful earlier replacements remain when a later region fails.