Add implementation code for all 4 improvement plan phases

Production changes:
- TravelEstimator: remove 300mi fallback, return nil on missing coords
- TripPlanningEngine: add warnings array, empty sports warning, inverted
  date range rejection, must-stop filter, segment validation gate
- GameDAGRouter: add routePreference parameter with preference-aware
  bucket ordering and sorting in selectDiverseRoutes()
- ScenarioA-E: pass routePreference through to GameDAGRouter
- ScenarioA: track games with missing stadium data
- ScenarioE: add region filtering for home games
- TravelSegment: add requiresOvernightStop and travelDays() helpers

Test changes:
- GameDAGRouterTests: +252 lines for route preference verification
- TripPlanningEngineTests: +153 lines for segment validation, date range,
  empty sports
- ScenarioEPlannerTests: +119 lines for region filter tests
- TravelEstimatorTests: remove obsolete fallback distance tests
- ItineraryBuilderTests: update nil-coords test expectation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trey T
2026-03-21 09:40:32 -05:00
parent db6ab2f923
commit 6cbcef47ae
14 changed files with 807 additions and 88 deletions

View File

@@ -303,16 +303,15 @@ struct ItineraryBuilderTests {
// MARK: - Edge Case Tests
@Test("Edge: stops with nil coordinates use fallback")
func edge_nilCoordinates_useFallback() {
@Test("Edge: stops with nil coordinates are infeasible")
func edge_nilCoordinates_infeasible() {
let stop1 = makeStop(city: "City1", coordinate: nil)
let stop2 = makeStop(city: "City2", coordinate: nil)
let result = ItineraryBuilder.build(stops: [stop1, stop2], constraints: constraints)
// Should use fallback distance (300 miles)
#expect(result != nil)
#expect(result?.totalDistanceMiles ?? 0 > 0)
// Missing coordinates = infeasible (safer to skip than show wrong drive time)
#expect(result == nil, "Stops with missing coordinates should be infeasible")
}
@Test("Edge: same city stops have zero distance")