Commit Graph

18 Commits

Author SHA1 Message Date
6dcec6a7a5 fix: address code review findings
- Fix type mismatch in search_cache.go: SearchWithCache now returns *yandex.Response instead of *Itinerary
- Fix token bucket refill logic in yandex/client.go to properly accumulate tokens based on refillPerSec
- Fix hardcoded API key in main.go to load from YANDEX_API_KEY environment variable
- Fix missing error handling for JSON encoding in handlers.go RouteGeoJSON function
- Fix incorrect redis.Nil handling in cache/store.go CacheAside.Exists method
- Fix incorrect error return type in station_status.go updateStationStatus to return newStatus instead of empty string
2026-08-17 22:42:08 +03:00
78f662c985 fix: address code review findings 2026-08-17 22:14:48 +03:00
777fda95a3 fix: address code review findings 2026-08-17 21:50:37 +03:00
82757665e9 fix: address code review findings 2026-08-17 20:34:17 +03:00
81686e9adc feat: Full test suite and linter - fixed test failures and increased coverage to 61.1% 2026-08-17 17:00:10 +03:00
2907ed3e0d feat: Implement flight change notifications with route re-search on cancellation/major delay
- Add CheckAndRescheduleRoute, checkRouteForChanges, rescheduleRoute methods to Graph
- Add Route tracking fields (LastChecked, NeedsReSearch, ReSearchReason) to Itinerary
- Implement change detection: cancellation (duration > 86400s), major delay (duration > cost*2)
- Write TestRouteReSearchOnChange test covering both cancellation and major delay scenarios
- Fix graph.go syntax errors and getStationNeighbors function
2026-08-17 13:45:34 +03:00
d67bc5aca7 feat: Implement Pareto-front ranking integration with multi-criteria sorting
- Add RankingMode field to SearchOptions (fastest/fewest_transfers/cheapest)
- Update FindRoutesPareto to respect ranking mode when sorting
- Add ranking_mode query parameter to RouteSearch endpoint
- Add TestParetoFrontGeneration with subtests for all three modes

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-16 19:27:02 +03:00
026b779cb3 feat: Implement lazy hub expansion depth limiting with MaxTransfers support
- Add transfer depth limiting in BFS/Dijkstra (MaxTransfers field in SearchOptions)
- Track transfer count at each step; stop when depth > 5
- Synthetic edge fallback on expansion failure
- Add TestLazyExpansionDepthLimit and TestFindRouteMaxTransfers tests

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-16 18:59:48 +03:00
7c6fe4a99c feat: Implement lazy hub expansion depth limiting with transfer depth limit of 5 (Task 14) 2026-08-16 18:17:36 +03:00
06730fe05c feat: Implement synthetic edges city↔airport (Task 10)
- Add TransferTime constants (AirportToCity, CityToStation, StationToStation)
- Update Edge struct with Synthetic field
- Enhance addSyntheticEdgesForNode to use constants and mark synthetic edges
- Update BuildGraphFromStations to set Synthetic field
- Mark synthetic edges in GeoJSON output as dashed lines
- Write TestSyntheticAirportCityEdges and TestRouteWithSyntheticAirportCityEdges tests
2026-08-16 16:05:50 +03:00
d93445ad55 feat: Add bus transport type to routing with Pareto ranking support 2026-08-16 15:30:03 +03:00
7adb2ebbb3 feat: Implement Pareto-front ranking with multi-criteria sorting and TestRouteParetoRanking test
- Add Cost field to Edge and RouteLeg structs
- Propagate Cost in FindRoute itinerary creation
- Write TestRouteParetoRanking test verifying non-dominated route selection
2026-08-16 14:19:29 +03:00
4de50f4948 feat: Implement on-demand /search integration in lazy graph expansion
- Integrate on-demand Yandex /search calls in FindRoute when lazy expansion + synthetic fallback fails
- Add real route segments from API response as edges, then retry BFS search
- Integrate existing cache key generation and TTL policies (SearchNearTermTTL: 3h, SearchFarTermTTL: 7d)
- Write tests: TestSearchRoutes_onDemand, TestSearchRoutes_onDemandVerifyIntegration, TestFindRouteWithSyntheticFallback
- All tests pass before task 5 (transfer depth limiting)
2026-08-16 13:17:02 +03:00
286cb8653a feat: Add ResetCircuitBreaker helper 2026-08-16 03:41:26 +03:00
26c4be2d3a feat: implement synthetic edge fallback in FindRoute
- Add addSyntheticEdgesForNode function that connects nodes to city hubs
- Modify FindRoute to add synthetic edges as fallback when no route found
- Write TestFindRouteWithSyntheticFallback test

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-15 01:33:23 +03:00
e063d26d4c fix: code correctness, security, and simplicity improvements 2026-08-13 21:23:15 +03:00
1bfe659d2c feat: implement API handlers for MVP endpoints (Task 5)
- Create cmd/api/handlers.go with HTTP handlers for all MVP endpoints
- Implement GET /v1/cities?query= city autocomplete
- Implement GET /v1/cities/{id}/stations city stations including neighbors
- Implement POST /v1/routes/search route search with Pareto-optimal results
- Implement GET /v1/routes/{search_id}/{route_id}/geojson route geometry
- Implement GET /v1/stations/{id}/status station status endpoint
- Add handler tests with success and error cases
- All existing tests pass
2026-08-13 20:26:28 +03:00
39f20bff4f feat: implement routing graph and search algorithm (max 1 transfer) - Task 4
- Create Graph type with Node/Edge types and methods
- Implement BuildGraphFromStations, SortEdges
- Implement BFS/Dijkstra FindRoute with 1-transfer limit
- Implement ApplyMCT for Minimum Connection Time rules
- Add search algorithm tests (success route, no-route, transfer limit)
- Add MCT application tests (city hub reduction, mode change)
- Update plan Task 4 checkboxes
2026-08-13 20:13:49 +03:00