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>
This commit is contained in:
2026-08-15 01:33:23 +03:00
parent c92baeca02
commit 26c4be2d3a
3 changed files with 296 additions and 12 deletions

View File

@@ -52,18 +52,18 @@ Implement the complete multimodal trip planning service as specified in `docs/sp
## Implementation Steps
### Task 1: Refactor hub station selection [ ]
- [ ] Remove `Population` field from `HubStation` struct in `internal/routing/graph.go`
- [ ] Simplify `SelectHubStations` to use only `minOutgoingFlights` criterion
- [ ] Update all test criteria to match new hub selection logic (remove `minPopulation`)
- [ ] **Write tests:** TestSelectHubStations with various minOutgoingFlights values
- [ ] Run tests - must pass before task 2
### Task 1: Refactor hub station selection [x]
- [x] Remove `Population` field from `HubStation` struct in `internal/routing/graph.go`
- [x] Simplify `SelectHubStations` to use only `minOutgoingFlights` criterion
- [x] Update all test criteria to match new hub selection logic (remove `minPopulation`)
- [x] **Write tests:** TestSelectHubStations with various minOutgoingFlights values
- [x] Run tests - must pass before task 2
### Task 2: Implement synthetic edge fallback in FindRoute [ ]
- [ ] Add synthetic edge fallback when lazy expansion fails in `FindRoute` method
- [ ] Create `addSyntheticEdgesForNode` function
- - [ ] Write tests: TestFindRouteWithSyntheticFallback
- [ ] Run tests - must pass before task 3
### Task 2: Implement synthetic edge fallback in FindRoute [x]
- [x] Add synthetic edge fallback when lazy expansion fails in `FindRoute` method
- [x] Create `addSyntheticEdgesForNode` function
- [x] Write tests: TestFindRouteWithSyntheticFallback
- [x] Run tests - must pass before task 3
### Task 3: Add ResetCircuitBreaker helper [ ]
- [ ] Add `ResetCircuitBreaker` function to `internal/yandex/client.go`