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

[WIP] Cleanup PipelineBuilder validation code #4805

Conversation

andrewballantyne
Copy link
Contributor

@andrewballantyne andrewballantyne commented Mar 24, 2020

Fixes:
https://issues.redhat.com/browse/ODC-3165

Analysis / Root cause:
When the Pipeline Builder was put into 4.4 as a feature the week before Feature Freeze, corners were cut to get around some yup & Formik issues. This has caused a very brittle validation schema and served as non-stop issues.

Solution Description:
Rewrite the validation schema to validate the entirety of the Pipeline Builder and remove all custom error code / handling.

Screen shots / Gifs for design review:

@openshift/team-devconsole-ux

Empty Name:
Screen Shot 2020-03-24 at 9 00 30 AM

Invalid Name:
Screen Shot 2020-03-24 at 9 06 21 AM

Array Param with error & description (breaks from the norm?):
image

Counter example of first field error:
image

Successful Resource connections:
Screen Shot 2020-03-24 at 9 17 42 AM

Rename a resource; breaks connection:
Screen Shot 2020-03-24 at 10 49 46 AM

Update to correct:
Screen Shot 2020-03-24 at 9 18 13 AM

Delete resource (breaks connection but no fix):
Screen Shot 2020-03-24 at 10 50 03 AM

Unit test coverage report:

  • Tests coming

Test setup:

  • Need Pipeline Operator
  • Need to be on the Pipeline Builder (create Pipeline button on the Pipelines page)

This is my validation path, these should all pass (with the exception of one -- noted below).

  1. Name
    1. Empty (error)
    2. Invalid characters (error)
  2. Tasks (prompts a silent error for needing at least one)
    1. Visualization
      1. No initial errors; openshift-client (no error)
      2. Initial Resource errors; s2i-nodejs (error)
      3. Initial Param & Resource errors; s2i-java-11 (error, resources over params)
    2. Details
      1. Array Param; ie openshift-client
        1. Add a new row (error); removing empty should clear the error
        2. Emptying the only field there (error)
      2. Param & Resource errors; s2i-java-11
        1. Initial (error, resources)
        2. Clear the Resource error by creating resources (error, params)
        3. Clear the param error by filling in the required fields (no error)
      3. Name
        1. Emptying (error)
        2. Invalid (error)
        3. Doesn’t update unless valid and on blur (to be fixed later)
      4. Resources connections
        1. Add s2i-nodejs (error)
        2. Create two resources; git & image (still in error)
        3. Update both in the details panel (no error)
        4. Change the name of one of the resources in the main form (error)
        5. Update in Details (no error)
        6. Delete resource from main form (error)
        7. No change possible (still in error)
        8. Add openshift-client task (for a positive passing task)
        9. Remove s2i-nodejs (error? — Formik has issues, still looking into it, any further update clears the error)
  3. Parameters & Resources should error on blur of any required field (name for both & type for resources)

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

/kind cleanup
/cc @rohitkrai03

@openshift-ci-robot openshift-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Mar 24, 2020
@openshift-ci-robot openshift-ci-robot added component/dev-console Related to dev-console component/shared Related to console-shared labels Mar 24, 2020
Copy link
Contributor Author

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

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

Some initial comments to help with reviews.

values,
} = props;
const statusRef = React.useRef(status);
statusRef.current = status;
useFormikValidationFix(values);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Odd that this does not fix my update error... Will need to investigate why. cc @rohitkrai03

Copy link
Contributor

Choose a reason for hiding this comment

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

You might try moving this to the specific part of the form where validation issue is happening.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting... figured this was a deep compare... but will look into it. Perhaps there is some React non-triggering happening that could be triggering the issue. I'll investigate, thanks Rohit.

import * as React from 'react';

export const SidebarInputWrapper: React.FC = ({ children }) => {
return <div style={{ width: 'calc(100% - 28px)' }}>{children}</div>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not happy with this -- open to ideas on how I can keep the width of the inputs the same throughout the sidebar (the string[] guy comes with a "-" sign on the right side and that's 28px wide).

@andrewballantyne
Copy link
Contributor Author

/cc @abhinandan13jan

Adding Abhi as the second reviewer as he has taken an interest in Pipelines in the past.

Copy link
Contributor

@serenamarie125 serenamarie125 left a comment

Choose a reason for hiding this comment

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

@andrewballantyne i'll look through a bit more carefully, but I notice that you use "please" in the messages. Our convention is to omit "please" from the UI, so if you can pull that word out, that would be great!

@andrewballantyne
Copy link
Contributor Author

@andrewballantyne i'll look through a bit more carefully, but I notice that you use "please" in the messages. Our convention is to omit "please" from the UI, so if you can pull that word out, that would be great!

Fixed that, thanks for the reminder 😄 -- I've updated the description.

@serenamarie125 While I was there looking at the code, I noticed this scenario got missed in refactor and the solution could not be the same... let me explain.

This is what we have today as the initial resting state (immediately after adding the task and opening the sidebar):
Screen Shot 2020-03-24 at 10 39 32 AM

However, this is functionality that worked because the field was custom before this work... now we are using the standard form field and it's actually not possible to be in an error state, disabled, and where the user has never touched the field. This seems pretty consistent throughout our add forms as well.

Solution... make it just help text (probably not ideal?):
Screen Shot 2020-03-24 at 10 40 10 AM

When you have a field and when you select it... I modified the tooltip to be similar to what I had but slightly different (see description screenshots for the previous look):
Screen Shot 2020-03-24 at 10 41 56 AM
Screen Shot 2020-03-24 at 10 42 02 AM

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 25, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 25, 2020
values,
} = props;
const statusRef = React.useRef(status);
statusRef.current = status;
useFormikValidationFix(values);
Copy link
Contributor

Choose a reason for hiding this comment

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

You might try moving this to the specific part of the form where validation issue is happening.

@rohitkrai03
Copy link
Contributor

/assign

@rohitkrai03
Copy link
Contributor

Okay, just went through the PR again and ran it locally. Found a few issues -

Not sure why validation says required for this field.
Screenshot from 2020-03-28 00-58-57

And i couldn't create any pipeline for some reason. Or even edit already created one. I created a pipeline from git import. Went to edit it and it started showing validation error. Fixed everything up but still got this error -
Screenshot from 2020-03-28 01-02-08

@rohitkrai03
Copy link
Contributor

If the pipeline is already create with resources and parameters defined in it. Why am I seeing this error when trying to edit it? Should the task be already connected with the resources and parameters?

Screenshot from 2020-03-28 01-14-30

@andrewballantyne
Copy link
Contributor Author

I somehow broke logic and didn't test submission after that 🤦‍♂ Ah well, good catch @rohitkrai03 Thanks! I'll fix it. Got name and resource mixed up and it works fine building, but won't pass validation if I submit with inverse of what is needed.

@andrewballantyne
Copy link
Contributor Author

andrewballantyne commented Mar 27, 2020

Not sure why validation says required for this field.
Screenshot from 2020-03-28 00-58-57

Can't reproduce this

Nvm, I can now... doh on my problem though heh... should be an easy fix.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 10, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 15, 2020
@andrewballantyne andrewballantyne changed the title Cleanup PipelineBuilder validation code [WIP] Cleanup PipelineBuilder validation code Apr 17, 2020
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 17, 2020
@andrewballantyne
Copy link
Contributor Author

Adding a WIP label to hide it from filters for Feature Freeze. Will go in next week.

@andrewballantyne
Copy link
Contributor Author

Needs to include logic from #5235 when reworked for 4.6

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: andrewballantyne
To complete the pull request process, please assign jhadvig
You can assign the PR to them by writing /assign @jhadvig in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@andrewballantyne
Copy link
Contributor Author

Another PR to merge in #6228

@andrewballantyne
Copy link
Contributor Author

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 6, 2020
@openshift-ci-robot
Copy link
Contributor

@andrewballantyne: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/frontend 7a20104 link /test frontend
ci/prow/kubevirt-plugin 7a20104 link /test kubevirt-plugin

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 29, 2021

@andrewballantyne: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/kubevirt-plugin 7a20104 link /test kubevirt-plugin
ci/prow/ceph-storage-plugin 7a20104 link /test ceph-storage-plugin

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/dev-console Related to dev-console component/shared Related to console-shared do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants