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

feat(protocol-designer): add air gap form validation #6226

Merged
merged 1 commit into from
Aug 3, 2020

Conversation

shlokamin
Copy link
Member

Overview

This PR closes #6007 by adding air gap validation to PD.

Note: the min air gap volume is "enforced" via a form level warning. The "masking" (which is done by dependentFieldsUpdateMoveLiquid.js) only clamps the air gap volume to a value between 0 and the max air gap volume defined in the ticket.

Changelog

  • Add air gap form validation

Review requests

Code review, including tests!

  • Make a protocol with an air gap
  • When you type a value larger than (pipette capacity - min pipette volume), the value should be clamped to (pipette capacity - min pipette volume)
  • You shouldn't be able to type negative numbers
  • You shouldn't be able to type decimals

Risk assessment

Low, adding validation behind FF

@shlokamin shlokamin force-pushed the pd_air-gap-validation branch from 43a5b67 to 11f8b31 Compare July 28, 2020 14:39
@shlokamin shlokamin requested review from IanLondon and Kadee80 July 28, 2020 14:41
@shlokamin shlokamin marked this pull request as ready for review July 28, 2020 14:41
@shlokamin shlokamin requested a review from a team July 28, 2020 14:41
@codecov
Copy link

codecov bot commented Jul 28, 2020

Codecov Report

❗ No coverage uploaded for pull request base (edge@aa6eba8). Click here to learn what that means.
The diff coverage is n/a.

@@ -48,11 +48,11 @@ describe('no-op cases should pass through the patch unchanged', () => {

it('empty patch', () => {
const patch = {}
expect(handleFormHelper(patch, minimalBaseForm)).toBe(patch)
expect(handleFormHelper(patch, minimalBaseForm)).toEqual(patch)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think to toBe here was making sure that the object wasn't duplicated unnecessarily. Eg if you had a reducer that did return {...prevState}, the selectors on that reducer wouldn't be able to use shallow memoization because the state is being replaced each time. I'm not sure if there is any memoization on the form data itself directly, but if we avoid duplicating the form in cases where it doesn't change, we at least make shallow memoization possible for the form data if we need it later.

Also, the form goes thru handleFormChange on each key press when the user is typing. So performance might be significant here

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh okay, thanks for pointing that out

@shlokamin shlokamin requested a review from IanLondon July 29, 2020 17:02
Copy link
Contributor

@Kadee80 Kadee80 left a comment

Choose a reason for hiding this comment

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

Looks like we have some merge conflicts... gross

@shlokamin shlokamin force-pushed the pd_air-gap-validation branch from b99fd71 to 391f79a Compare August 3, 2020 15:06
@shlokamin shlokamin requested a review from Kadee80 August 3, 2020 15:06
@shlokamin
Copy link
Member Author

@Kadee80 fixed! Thanks to @IanLondon for sorting that out with me

Copy link
Contributor

@Kadee80 Kadee80 left a comment

Choose a reason for hiding this comment

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

🐺

Copy link
Contributor

@IanLondon IanLondon left a comment

Choose a reason for hiding this comment

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

looks good, raised a question about what the aggregate intended behavior btw defaults vs clamping is supposed to be in slack, but I think this is right

@shlokamin
Copy link
Member Author

Cool, I'll merge this for now and we can make changes in a follow up PR if need be. Thanks for raising that @IanLondon!

@shlokamin shlokamin merged commit 46958b3 into edge Aug 3, 2020
@shlokamin shlokamin deleted the pd_air-gap-validation branch August 3, 2020 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: PD Validation- Airgap
3 participants