@@ -399,6 +399,44 @@ async def result():return dict(points=[new],index=0,mode='coastal',route_key=key
399399 self .assertNotIn ('regional_waiting' ,sample )
400400 await navigator .close ()
401401
402+ async def test_outward_tail_does_not_relabel_retained_forward_runway (self ):
403+ key = [0 ,0 ,1 ];start ,first ,end ,exit_point = geo (800 ,1000 ),geo (800 ,2000 ),geo (800 ,3000 ),geo (1000 ,3000 )
404+ navigator = RegionalNavigator (None );navigator .key = key
405+ sample = dict (lap = 0 ,leg = 0 ,waypoint = 1 ,position = start ,native = {},
406+ regional_navigation = dict (points = [first ,end ],index = 0 ,mode = 'coastal' ,route_key = key ,
407+ policy = REGIONAL_POLICY ,job = 'runway' ,probe_position = geo (800 ,0 )))
408+ async def result ():return dict (points = [exit_point ],index = 0 ,mode = 'shallow_exit' ,route_key = key ,
409+ policy = REGIONAL_POLICY ,job = 'exit' ,probe_position = end ,
410+ continuation_of = dict (job = 'runway' ,endpoint = end ))
411+ navigator .task = asyncio .create_task (result ());await navigator .task
412+ self .assertEqual (navigator .update (sample ,geo (800 ,90000 )),first )
413+ plan = sample ['regional_navigation' ]
414+ self .assertEqual (plan ['mode' ],'coastal' );self .assertEqual (plan ['shallow_exit_start_index' ],2 )
415+ sample ['position' ]= first
416+ self .assertEqual (navigator .active_point (sample ,key ),end )
417+ sample ['position' ]= geo (800 ,2950 )
418+ self .assertEqual (navigator .active_point (sample ,key ),end )
419+ self .assertEqual (plan ['mode' ],'coastal' )
420+ sample ['position' ]= end
421+ self .assertEqual (navigator .active_point (sample ,key ),exit_point )
422+ self .assertEqual (plan ['mode' ],'shallow_exit' );self .assertEqual (plan ['index' ],2 )
423+ await navigator .close ()
424+
425+ async def test_saved_exit_with_retained_points_migrates_only_its_phase (self ):
426+ key = [0 ,0 ,1 ];first ,end ,exit_point = geo (800 ,2000 ),geo (800 ,3000 ),geo (1000 ,3000 )
427+ plan = dict (points = [first ,end ,exit_point ],index = 0 ,mode = 'shallow_exit' ,route_key = key ,
428+ policy = REGIONAL_POLICY ,job = 'saved' ,probe_position = geo (800 ,0 ),retained_checked_points = 2 )
429+ sample = dict (position = geo (800 ,1000 ),native = {},regional_navigation = plan )
430+ navigator = RegionalNavigator (None )
431+ self .assertEqual (navigator .active_point (sample ,key ),first )
432+ self .assertEqual (plan ['mode' ],'coastal' );self .assertEqual (plan ['points' ],[first ,end ,exit_point ])
433+ sample ['position' ]= first
434+ self .assertEqual (navigator .active_point (sample ,key ),end )
435+ sample ['position' ]= end
436+ self .assertEqual (navigator .active_point (sample ,key ),exit_point )
437+ self .assertEqual (plan ['mode' ],'shallow_exit' )
438+ await navigator .close ()
439+
402440 async def test_exhausted_coast_accepts_checked_replacement_water_route (self ):
403441 async def rpc (* args ,** kwargs ):await asyncio .Event ().wait ()
404442 class Near :
0 commit comments