-
Notifications
You must be signed in to change notification settings - Fork 114
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
🚑️ 🐛 Ensure that we do show the replaced mode when the `mode_of_inter… #1150
🚑️ 🐛 Ensure that we do show the replaced mode when the `mode_of_inter… #1150
Conversation
…est` matches At some point, we changed the mode and purpose user inputs as objects that were stored to be full objects, with start and end timestamps, instead of just the labels. We changed all uses of the MODE and PURPOSE to match it, but apparently forgot to change this location, where the replaced mode button is conditionally displayed. This is a quick change to make the usage here consistent with the rest of the code so that we can push this out ASAP. @JGreenlee, please let me know if there is a more principled fix, it is late and I don't want to experiment any further. Testing done: Please see PR
I am going to merge this tomorrow morning and submit for review, given that it is a showstopper. |
I looked at the git blame and it looked like this had not been changed since the before the rewrite - it still used If so, then from #1150 (comment), people might get a whole slew of "To label" trips for trips that they had already labeled. That's good, because our data will be nice again, but we may want to send a heads-up, both as a notification, and to the current deployers in case they get a slew of questions. Maybe we can combine it with the upcoming stacked bar chart change. @JGreenlee can you draft this update?
|
The tests are failing as below. So we actually had a unit test for this, but apparently the test was wrong??!
|
The previous unit tests for the input matching assumed that the user input would be of the form of the label options, so reused the label options as mock options. However, they actually are of the form of user input objects with data and metadata and the input as a label. We create new mock objects with the correct format, and use them in the tests. This is the reason why e-mission#1150 was not caught for so long. And when we fixed the code, the test broke. e-mission#1150 (comment) e-mission#1150 (comment) Testing done: ``` npx jest www/__tests__/confirmHelper.test.ts Test Suites: 1 passed, 1 total Tests: 11 passed, 11 total ```
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1150 +/- ##
=======================================
Coverage 26.42% 26.42%
=======================================
Files 114 114
Lines 4980 4980
Branches 1026 1062 +36
=======================================
Hits 1316 1316
+ Misses 3664 3662 -2
- Partials 0 2 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
I am glad you caught this. I believe your investigation is correct; when I unified the format of ENKETO vs MULTILABEL user inputs on the phone (which was the first step of e-mission/e-mission-docs#1045), I missed this bit of code and the corresponding unit test. Since this was a pretty serious issue, I want to take a moment and reflect on it. I think there are a couple things that could have helped prevent this issue from going undetected:
Type safety is an ongoing effort; we have been gradually adding types throughout the codebase wherever possible. As OpenPATH grows to support more deployments with differing configurations, I think it is growing increasingly difficult to validate the full range of features with manual testing. We cover as much as we can with our small team Integration and end-to-end testing have been long-term goals, but maybe one key takeaway from this is how crucial they are to the long-term success of the project. When we have time, we should really sit down and devote some time to those, or at least form a concrete plan for when and how we can implement them (like what can we do before the cordova migration vs. what should we wait until after to do?) |
…est` matches
At some point, we changed the mode and purpose user inputs as objects that were stored to be full objects, with start and end timestamps, instead of just the labels. We changed all uses of the MODE and PURPOSE to match it, but apparently forgot to change this location, where the replaced mode button is conditionally displayed.
This is a quick change to make the usage here consistent with the rest of the code so that we can push this out ASAP.
@JGreenlee, please let me know if there is a more principled fix, it is late and I don't want to experiment any further.
Testing done:
Please see PR