Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile version #3487

Merged
merged 2 commits into from
Dec 23, 2016
Merged

Profile version #3487

merged 2 commits into from
Dec 23, 2016

Conversation

TheMarex
Copy link
Member

@TheMarex TheMarex commented Dec 22, 2016

Issue

Add explicit versioning to the profiles. Addresses #3384

This is currently unused but could be utilized to activate other API features only when explicitly bumping the version. This will be used to make #2399 backwards compatible.

Tasklist

  • review
  • adjust for comments

Requirements / Relations

Requirement for #2399

Copy link
Member

@daniel-j-h daniel-j-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the version be checked against somewhere? And logged / aborted on mismatch?

@@ -194,6 +194,7 @@ properties.max_speed_for_map_matching = 180/3.6 -- 180kmph -> m/s
properties.use_turn_restrictions = true
properties.continue_straight_at_waypoint = true
properties.left_hand_driving = false
properties.version = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm should we call it profile_api_version or something like that? Not sure if version alone is telling for users.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually now that you mention it, maybe we should not even put it in ProfileProperties.

Do you think a global variable like profile_api_version = 0 would be too obscure?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking here is that we actually don't need the profile version information outside of the scripting context.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm maybe at the top of the profile, like CMake does it 👍

@TheMarex TheMarex mentioned this pull request Dec 22, 2016
3 tasks
@oxidase
Copy link
Contributor

oxidase commented Dec 22, 2016

@TheMarex maybe not related to the PR, how to do testing in future? Should tests be replicated for every profile version (actually bad idea), just maintain the actual profile version (no tests for deprecated profile versions) or some tests added to check only profile functions?

@TheMarex
Copy link
Member Author

@oxidase that is a good question. I the most feasible solution would be to only have full tests for the current version, but specific tests for functionality changes between versions.

For example in the context of the #2399 PR we should have all our tests run on api_version = 1 (e.g. the new version). But should have a test that api_version = 0-style turn_function and segment_function still work.

@TheMarex TheMarex force-pushed the feature/profile-version branch from 20c60b1 to 81b90f7 Compare December 22, 2016 17:45
@TheMarex
Copy link
Member Author

Moved it to a global variable and enforced correct version over a check.

Currently only `0` is supported (the default).
@TheMarex TheMarex force-pushed the feature/profile-version branch from 81b90f7 to fa43caa Compare December 22, 2016 19:04
@oxidase
Copy link
Contributor

oxidase commented Dec 22, 2016

@TheMarex just a simple test to make codecov green

@TheMarex
Copy link
Member Author

@oxidase the test looks good. 👍 you can just push to the branch, that's fine.

@oxidase oxidase force-pushed the feature/profile-version branch from e4c5343 to 7486d9d Compare December 22, 2016 23:51
@oxidase
Copy link
Contributor

oxidase commented Dec 22, 2016

@TheMarex pushed. Not-defined API version test expects that osrm-extract is not failing if api-version is not defined. api-version 0 will be used as default initialized.

@oxidase oxidase force-pushed the feature/profile-version branch from 7486d9d to 5fb93d6 Compare December 22, 2016 23:55
@emiltin
Copy link
Contributor

emiltin commented Dec 23, 2016

should version be in the format 1.0.0?

@TheMarex
Copy link
Member Author

@emiltin I was think using the same scheme as in the HTTP API, which also uses simple increments. Minor/patch versions are not that useful for single components because you typically only care about breaking changes.

@TheMarex TheMarex merged commit ed9d10e into master Dec 23, 2016
@TheMarex TheMarex deleted the feature/profile-version branch December 23, 2016 14:02
@@ -306,6 +306,20 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
context.has_node_function = node_function.valid();
context.has_way_function = way_function.valid();
context.has_segment_function = segment_function.valid();
auto maybe_version = context.state.get<sol::optional<int>>("api_version");
if (maybe_version)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the formatting is off here ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants