pez-globo / pufferfish-software

All software for the Pufferfish ventilator.
Apache License 2.0
0 stars 1 forks source link

Use backend values to initialize frontend #340

Closed ethanjli closed 3 years ago

ethanjli commented 3 years ago

This PR fixes #312 by making the frontend initialize all backend-derived messages in the store to null on startup, instead of initializing with numbers or default values. Because implementing this required changing the types produced by selectors for those messages, as well as changing the reducers for ParametersRequest, AlarmLimitsRequest, and their standby versions (mainly because those reducers previously had inconsistent implementations and were difficult for me to understand), it led to a large refactor of the store-related code in the frontend (including improvements in organization, naming), with the following main changes:

Additionally, now the backend sends the following messages to the frontend: AlarmMuteRequest, BatteryPower, ScreenStatus, RotaryEncoder, SystemSettingRequest, and FrontendDisplaySetting. However, the backend doesn't simulate these messages or load them from the filesystem during initialization; instead, the backend simulator merely initializes some default values; the frontend does indeed receive them from the backend.

ethanjli commented 3 years ago

@rohanpurohit This PR will almost certainly produce merge conflicts with your other open frontend PRs, we'll need to coordinate on how to merge things - i.e. for PR of yours which we merge into develop first, I'll need to make sure I understand every changed line of code, as I'll probably need to manually "replay" all of your changes on top of my changes. And for any PR of yours which we merge into develop after this PR, you'll need to understand what I changed and what assumptions you may have made which might be violated by the changes I've made in this PR.

ethanjli commented 3 years ago

@rohanpurohit Since this PR touches a bunch of files, it'd be great if you could test all aspects of the frontend to help look for any user-facing regressions introduced by my refactoring.

rohanpurohit commented 3 years ago

@rohanpurohit This PR will almost certainly produce merge conflicts with your other open frontend PRs, we'll need to coordinate on how to merge things - i.e. for PR of yours which we merge into develop first, I'll need to make sure I understand every changed line of code, as I'll probably need to manually "replay" all of your changes on top of my changes. And for any PR of yours which we merge into develop after this PR, you'll need to understand what I changed and what assumptions you may have made which might be violated by the changes I've made in this PR.

yeah sounds good, I did not find time yesterday to work on my PR'S due to emergency reasons, I'm working on them now and I think both approaches are sound, if you are done with the changes on this PR, then I can go through them to try and understand that and make changes accordingly once this PR gets merged.

rohanpurohit commented 3 years ago

@rohanpurohit Since this PR touches a bunch of files, it'd be great if you could test all aspects of the frontend to help look for any user-facing regressions introduced by my refactoring.

Yep, I'll definitely do that.

rohanpurohit commented 3 years ago

so in my light to moderate testing, everything seems fine on alarm modals, dashboard, and other related features. Although mute button seems to not work anymore, triggered by stopping the backend.

ethanjli commented 3 years ago

Great, thanks for catching that! I had forgotten to test alarm muting functionality. I'm able to reproduce the regression. I think it's fine if we leave this up to a future PR in one of the upcoming milestones, because there's some nuance we'll have to figure out there, and it will be easier to do so after #339 gets merged:

I will merge develop back into this PR and then merge this PR into develop as prototype-quality code which has been moderately tested, with known issues to be fixed in future PRs but no regressions identified besides alarm muting functionality. For records-keeping:

  1. This project is licensed under Apache License v2.0 for any software, and Solderpad Hardware License v2.1 for any hardware - do you agree that your contributions to this project will be under these licenses, too? Yes
  2. Were any of these contributions also part of work you did for an employer or a client? No
  3. Does this work include, or is it based on, any third-party work which you did not create? No