feat: improve planning engine travel handling, itinerary reordering, and scenario planners

Add TravelInfo initializers and city normalization helpers to fix repeat
city-pair disambiguation. Improve drag-and-drop reordering with segment
index tracking and source-row-aware zone calculation. Enhance all five
scenario planners with better next-day departure handling and travel
segment placement. Add comprehensive tests across all planners.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-02-13 08:55:23 -06:00
parent 1c97f35754
commit 9736773475
19 changed files with 928 additions and 171 deletions

View File

@@ -75,6 +75,26 @@ final class ScenarioBPlanner: ScenarioPlanner {
)
}
// In explicit date-range mode, fail fast if selected anchors are out of range.
let isGameFirstMode = request.preferences.planningMode == .gameFirst
if !isGameFirstMode, let explicitRange = request.dateRange {
let outOfRangeAnchors = selectedGames.filter { !explicitRange.contains($0.startTime) }
if !outOfRangeAnchors.isEmpty {
return .failure(
PlanningFailure(
reason: .dateRangeViolation(games: outOfRangeAnchors),
violations: [
ConstraintViolation(
type: .dateRange,
description: "\(outOfRangeAnchors.count) selected game(s) are outside the requested date range",
severity: .error
)
]
)
)
}
}
//
// Step 2: Generate date ranges (sliding window or single range)
//