-
Notifications
You must be signed in to change notification settings - Fork 905
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
Adjust add-on input validation #3263
Conversation
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
I would expect this to also have some processing to handle cases, the flows aren't entirely consistent, but I think this behaviour should be the same. |
I also noticed that if I put in a negative number I still get the unhelpful message: |
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Done! Addressed in a1fb0c6
Fixed in 906f63a |
tests/framework/cli/test_starters.py
Outdated
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5", | ||
"6", | ||
"none", | ||
"2,3,4", | ||
"3-5", | ||
"all", | ||
"1, 2, 3", | ||
"1, 2, 3", | ||
" 1, 2, 3 ", | ||
" 1-3 ", | ||
" 1 - 3 ", | ||
"ALL", | ||
"All", | ||
"AlL", | ||
"NONE", | ||
"None", | ||
"nonE", | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these tests are repetitive, can it be reduce some of these to one example. For example
"ALL",
"All",
"AlL"
can be reduced to one since AlL
is probably the most weird case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do agree AlL
is probably the strangest case, though I'd avoid simplifying to just either ALL
or All
as I'd want to ensure all small letters, all capitals, and a mix of the two are all processed correctly. AlL
and nonE
have both been dropped in 5ad8bab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general, leave a minor comment to reduce the test cases, each test case should be testing one specific thing.
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
There's still a difference in user experience when I enter a negative number vs a positive invalid number: This might be fine, because |
@merelcht Do you mean to say that a negative value should be accepted and auto corrected to be a positive value? Only when it falls within correct range, i.e we should validate the absolute value? |
@amandakys I think @merelcht is referring to the fact that they both invalid options but inconsistent errors are returned depending on what the input is, rather than processing any negative numbers as positive. Currently the input is received as a string, I personally don't see any issues with the differing error messages as the errors are indeed thrown for different reasons (no |
I suggest test it after solving the conflicts. I suspect this maybe solved already as a side-effect of #3265. I introduced a new dictionary and use it everywhere, this avoids an addition rules because the condition it checking if value |
Signed-off-by: Nok Lam Chan <nok.lam.chan@quantumblack.com>
Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
…o-org/kedro into fix/add-on-input-validation Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
I found one more interesting edge case, what if you put a range that's way beyond the acceptable number, e.g. "5-12", now you'll get: Maybe I'm going too far into what users could reasonably enter, but I don't see why this shouldn't just throw: "'12' is not a valid selection. |
Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
…o-org/kedro into fix/add-on-input-validation Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
@merelcht This is a reasonable expectation, I have made the changes and updated the tests. |
@SajidAlamQB Did you test with latest branch? There are test cases covering that already and it seems working fine on my end. |
I created a new environment and it seemed to work there. Perhaps my old environment had some issues... 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @noklam @AhdraMeraliQB!
Thank you @AhdraMeraliQB for implementing the solution 😸 I just help to fix a test. |
Description
Following #3185, this PR ensures that invalid inputs to the add-on prompt fail immediately. Additionally, case sensitivity has been removed, whitespaces are now ignored, and selections larger than 9 are processed as invalid selections instead of improper formatting.
The case sensitivity changes have also been made to the add-on flag inputs (they were already whitespace robust prior to this PR).
Development notes
Developer Certificate of Origin
We need all contributions to comply with the Developer Certificate of Origin (DCO). All commits must be signed off by including a
Signed-off-by
line in the commit message. See our wiki for guidance.If your PR is blocked due to unsigned commits, then you must follow the instructions under "Rebase the branch" on the GitHub Checks page for your PR. This will retroactively add the sign-off to all unsigned commits and allow the DCO check to pass.
Checklist
RELEASE.md
file