🔄 Update lab URLs, Sync phone deployment config on usercache put#1092
🔄 Update lab URLs, Sync phone deployment config on usercache put#1092JGreenlee merged 2 commits intoe-mission:masterfrom
Conversation
This should finish off the lab name change updates in this repo
The phone will now include i) the current app version, and ii) the version of the deployment config it is currently using, in every usercache/put request. On the server, we will check if the phone's config is outdated and if the app version is high enough to upgrade to the server's copy of the config; if yes the server will send its copy in the response
shankari
left a comment
There was a problem hiding this comment.
Given time sensitivity, let's merge this now and add tests later
| # If the server's STUDY_CONFIG doesn't match the opcode, skip the version check. | ||
| # This happen on stage where the server is on stage-program but some opcodes are stage-study or stage-timeuse. | ||
| # This is not an issue on prod since 1 deployment has 1 config. | ||
| if STUDY_CONFIG not in user_token: |
There was a problem hiding this comment.
I would put in an explicit check for stage like we do in other places in https://github.com/e-mission/nrel-openpath-join-page/blob/58f653ebaac8e8d5aac0bd78cc01a410c2333447/frontend/index.html#L556
This will also allow additional error handling for the case where the server or the deployment config is misconfigured.
There was a problem hiding this comment.
Also, it would be good to add a unit test for this in emission/tests/netTests/TestWebserver.py (copilot can do this pretty quickly)
There was a problem hiding this comment.
I initially just had this check if STUDY_CONFIG was stage-program and return None if it was.
I changed it to check for a mismatch between opcode and STUDY_CONFIG, since this should actually work on stage-program opcodes and we don't want to return early for those.
Noted on better error handling, though. we can do that with a 2-level check.
If opcode and STUDY_CONFIG mismatch and we are on stage: no problem, log debug
If opcode and STUDY_CONFIG mismatch and not on stage: log error
🔄 update lab URLs
🔄 Sync phone deployment config on usercache put