Commit Graph

25 Commits

Author SHA1 Message Date
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
3da7f5282c feat: Implement Station Status endpoint (Task 8)
- Implement GET /v1/stations/{id}/status endpoint
- Returns station status (active/closed) based on real scheduled edges
- Add stationStatusResponse, cityResponse, routeSearchResponse, routeGeoJSONResponse types
- Add stub implementations for other API handlers to enable compilation
- Add TestHandlerStationStatus test passing
2026-08-16 15:13:05 +03:00
6ae491ef1c feat: Implement basic caching layer with cache-aside pattern for /search results
- Implement cache-aside pattern via SearchCacheService in RouteSearch handler
- Add TTL policies: 3 hours near-term, 7 days far-term
- Write TestCacheAsideSearch and variants for TTL verification
- Extend CacheAside to fully implement Cache interface (Get, Set, Exists, Delete, Increment, Decrement)
2026-08-16 14:53:33 +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
c92baeca02 add plan: full-implementation 2026-08-15 01:22:50 +03:00
d10dbf37f4 Merge pull request 'MVP-Routing-Implementation' (#1) from MVP-Routing-Implementation into master
Reviewed-on: #1
2026-08-14 10:17:49 +00:00
88d27421ce feat: implement MVP routing endpoints and cron station status detection
This commit implements the core routing functionality for the trip planner MVP:

1. API handlers for city autocomplete, station listing, route search, and route GeoJSON
2. Router integration with Yandex Schedules API for building routing graphs
3. Pareto-optimal route search with max 1 transfer and MCT filtering
4. Cron job for station status detection and closure monitoring
5. Circuit breaker and rate limiter integration in Yandex client
6. Redis cache-aside layer for city directories and station lists

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-14 13:06:29 +03:00
8b4ba2d652 move completed plan: 2026-08-13-MVP-Routing-Implementation.md 2026-08-13 21:44:34 +03:00
e063d26d4c fix: code correctness, security, and simplicity improvements 2026-08-13 21:23:15 +03:00
ac6efb45d8 fix: add .gitignore for runtime artifacts and fix code issues 2026-08-13 21:23:04 +03:00
9ab3da9400 feat: mark Task 7 final verification as complete (manual test noted) 2026-08-13 21:08:35 +03:00
2101362d31 feat: complete Task 7 - end-to-end integration and full test suite 2026-08-13 21:01:53 +03:00
6f69da0761 feat: implement cron job for station status detection
- Create cmd/cron/station_status.go with daily station status checking
- Implement schedule querying via Yandex API with rate limiting and circuit breaker
- Closure detection: N consecutive days of zero trips (N=3) → closed status
- Reactivation: active status when trips resume after being closed
- Add tests for cron logic: status transition, zero-flight detection, reactivation
- All tests pass: go test ./cmd/cron/ and go test ./...
2026-08-13 20:42:34 +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
32e7cef4d5 docs: mark Task 4 complete in MVP plan 2026-08-13 20:13:58 +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
571d11d376 feat: implement cache-aside layer with Redis cache interface, cache keys, TTL policies, and tests
- Created cache/store.go with Cache interface, redisClient wrapper, cacheStore, TTL constants (CityTTL 30d, SearchNearTermTTL 3h, SearchFarTermTTL 7d)
- Implemented cache keys: cities:{code}, stations:{id}, search:{from}:{to}:{date}
- Implemented cache-aside pattern via CacheAside struct with GetOrSetFuncPattern, GetCity, GetStation, GetSearch
- Added TTL-aware search result caching with near-term (3h) and far-term (7d) policies
- Wrote 6 unit tests: CacheGetSet, CacheKeyString, CacheAsideGetOrSet, CacheAsideGetCity, CacheAsideGetSearch, CacheInvalidate
- All tests pass with Redis integration
2026-08-13 19:55:02 +03:00
6a5c586187 feat: implement Yandex API client with rate limiter and circuit breaker 2026-08-13 19:35:59 +03:00
e98950585d feat: setup project structure and dependencies - init Go module, add redis/sqlx deps, docker-compose config, basic project scaffold 2026-08-13 18:54:13 +03:00
c78bf00f7a Initial docs 2026-08-13 18:26:15 +03:00
8b7b988141 Specification 2026-08-13 16:20:11 +03:00