feat: complete lazy graph expansion implementation with cache-aware search and transfer depth limiting
- Task 1: Hub station selection and BuildGraphFromHubs - Task 2: Yandex /search on-demand edge expansion with caching - Task 3: FindRoute with lazy expansion and 4-5 transfer depth limit - Task 4: Cache-aware search results with TTL policies (near-term: 2-6h, far-term: 7d) - Task 5: End-to-end verification and documentation - Task 6: Final verification - all internal/routing unit tests pass (22/22) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -677,7 +677,8 @@ func TestExpandGraphLazy(t *testing.T) {
|
||||
graph.AddNode(moscow)
|
||||
|
||||
// Test expanding from a station to destination city
|
||||
err := graph.ExpandGraphLazy(moscow, "Simferopol", "2026-08-20")
|
||||
opts := SearchOptions{FarTerm: false}
|
||||
err := graph.ExpandGraphLazy(moscow, "Simferopol", "2026-08-20", &opts)
|
||||
if err != nil {
|
||||
t.Errorf("expected no error from ExpandGraphLazy, got: %v", err)
|
||||
}
|
||||
@@ -725,7 +726,8 @@ func TestExpandGraphLazy_FromCityHub(t *testing.T) {
|
||||
graph.AddNode(simferopol)
|
||||
|
||||
// Test expanding from a city hub to station hubs
|
||||
err := graph.ExpandGraphLazy(simferopol, "Moscow", "2026-08-20")
|
||||
opts := SearchOptions{FarTerm: false}
|
||||
err := graph.ExpandGraphLazy(simferopol, "Moscow", "2026-08-20", &opts)
|
||||
if err != nil {
|
||||
t.Errorf("expected no error from ExpandGraphLazy, got: %v", err)
|
||||
}
|
||||
@@ -744,7 +746,8 @@ func TestExpandGraphLazy_InvalidNodeType(t *testing.T) {
|
||||
// This test verifies the default case in ExpandGraphLazy
|
||||
// We can't easily create an invalid node type, so we just verify
|
||||
// the method handles errors gracefully
|
||||
err := graph.ExpandGraphLazy(nil, "Test", "2026-08-20")
|
||||
opts := SearchOptions{FarTerm: false}
|
||||
err := graph.ExpandGraphLazy(nil, "Test", "2026-08-20", &opts)
|
||||
// Should not panic, just return an error
|
||||
if err == nil {
|
||||
t.Error("expected error from ExpandGraphLazy with nil node")
|
||||
|
||||
Reference in New Issue
Block a user