mapbox / mapbox/mapbox-navigation-ios

Parallel copies of route in Router can get out of sync

Open
#3,343 7 comments 0 reactions 2 assignees View on GitHub

@S2Ler is already working on this.

Since Sep 30, 2021.

  • #3344 by @OttyLab — merged
bug Core jira-sync-complete op-ex
Dominant language
Swift
Stars
918
Forks
326
Avg merge
1h 16m
Merged PRs (30d)
3

Description

Router implementations store both an IndexedRouteResponse (that is, a RouteResponse plus a route index) and a RouteProgress (that is, a Route plus a leg index etc.) side by side. As a result, they effectively hold two parallel copies of the current Route that can get out of sync. For example, after a reroute, RouteController sets the routeProgress property but neglects to update the indexedRouteResponse property:

https://github.com/mapbox/mapbox-navigation-ios/blob/3c81bdb6df768707073f9d96188ffd92d6a79985/Sources/MapboxCoreNavigation/RouteController.swift#L587-L589

This contrasts to LegacyRouteController, which does happen to set both properties:

https://github.com/mapbox/mapbox-navigation-ios/blob/5e9954da1a5b4523dfe032a491d1beb6020abd80/Sources/MapboxCoreNavigation/LegacyRouteController.swift#L62-L64

In both RouteController and LegacyRouteController, routeProgress is publicly settable but indexedRouteResponse is not. This makes it entirely possible for client code to have inconsistent behavior depending on how it gets the route from the Router.

/cc @mapbox/navigation-ios

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.