brouter: How to handle backward incompatible change to voice hint indexing?
c9ae7c8681 changed indexing of voice hints, e.g. it now has TRU = 12; // Right U-turn which was OFFR = 12; // Off route before, breaking everyone depending on those ids (see also nrenner/brouter-web#751).
As far as I can see those changes have not been approved in a review, neither is there any discussion in the commit message on why those changes are needed, nor any mention in the release notes or even tests to catch such regressions. This way it is hard to know what the original motivation for that re-indexing was.
Since the breakage already shipped in 1.7.0, there are now two options:
- Revert the re-indexing and append new ids only at the end.
-
This will restore backward compatibility somewhat, but there would still be a regression (i.e. an unknown hint) in old clients for
TLU, which probably was emitted asTUor something else before. -
It will also require clients which already incorporated the changes to yet again adapt their code, possibly having to support pre-1.7.0, 1.7.0 and post-1.7.0.
- Keep the changes as-is.
-
This will require clients which did not yet adapt to be changed, which might be an issue for unmaintained projects.
-
It might require clients to support two different indexing schemes in parallel, i.e. pre-1.7.0 and 1.7.0.
Do we know which projects are already aware of this or still need to adapt? There is BRouter-Web, fit-route, OsmAnd, Locus, QMapShack and probably many more…
Which option should we implement?
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 28 (3 by maintainers)
While I find it questionable that you rename
TUtoTLU, this won’t affect the GeoJSON API, since both before and after the change10is emitted, both times meaningu-turn-left. That’s okay, but not the topic of this issue.However, as mentioned in my very first comment,
TRUis where it breaks, whereoff-routewould be shown by clients. That’s not okay, but surprisingly your example makes it look as if it was unaffected.I don’t even want to think about what happens when the “should be changed to u-turn-left when osmand uses new voice hint constants”-comment in BRouter’s code comes into fruition. It will be another mess for sure, when multiple old and new versions of BRouter, BRouter-Web and OsmAnd are interacting with each other.
You must be joking, right? Of course clients could simply use strings via JavaScript. It is BRouter’s GeoJSON API which is forcing ids upon them.
To me it looks like you want to:
u-turn-180, withu-turn-leftandu-turn-rightalready existing. – Not sure whether that’s really needed (marking errors in the route this way is a bit of a strange workaround), but whatever.T180, you thinkTUlooks nice and proceed to steal it fromu-turn-left. – Now clients got a problem, because the meaning ofTUhas silently changed.u-turn-leftis without string. You think it might be nice for it to look similar toTRU, soTLUit is. – A new string which clients know nothing about, while they could showu-turn-leftjust fine before.TLU,TUandTRUshould be ordered numerically one after the other for beauty, so you assign10,11and12. – This completely ignores that those numbers are used in the API to represent meaning, e.g.12now meansu-turn-right, while before it meantoff-road.This is what you achieved:
TU.9.What you should have done (assuming
u-turn-180is really needed, which I am not convinced about):u-turn-180.T180) and an id (e.g.15).This would have achieved:
TUis called like that for historical reasons and should not be changed to keep compatibility. After all,TUandTRUwere co-existing even beforeT180came along, so nothing new really.FINAL QUESTIONS:
Would you accept a PR where I completely eliminate the concept of numerical ids for voice hints in the codebase?
Obviously that would needs clients using the GeoJSON/JSON APIs to adapt, but since they would need to be changed anyway due to the re-indexing, it would not be much more work for them (I can do it for BRouter-Web), and they could then also benefit from “constants” like you are describing as being superior in Java (rightfully so!). In addition, you could order the constant in the code any way you’d like (randomly, alphabetically, by type, by length etc.), and it won’t affect the changed meaning of
TU.Patches to achieve that are already done for BRouter as well as for BRouter-Web.
Alternatively, would you accept a PR where I revert the re-indexing of ids in the API? (This also won’t affect the changed meaning of
TU.)@quaelnix Please have a look here #436.