-
Notifications
You must be signed in to change notification settings - Fork 47
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
Selection dry-run validation for Shell #4775
Selection dry-run validation for Shell #4775
Conversation
QA Wolf here! As you write new code it's important that your test coverage is keeping up. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…hell-selection-guards-for-circular-shapes
|
||
const shellCommand = async () => { | ||
// TODO: figure out something better than an arbitrarily small value | ||
const DEFAULT_THICKNESS: Models['LengthUnit_type'] = 1e-9 |
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.
Ooof, yeah that's a tough one. I would have done this as a scale of the volume of the model's bounding box as a 1st attempt, but we don't have that information easily accessible.
.find((v) => v.type === 'sweep')?.pathId | ||
|
||
if (!object_id) { | ||
return "Unable to shell, couldn't find the solid" |
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.
Don't want to return Promise.reject?
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.
No, the arg configuration for validation
takes a function that looks like
async function validator ({context, data}) : string | boolean {}
If you return true
passes validation
If you return false
fails validation but you don't get an error message
If you return string
it fails validation but you get to see that message within the failure case.
This function is implemented correctly
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.
.then((result) => { |
Here is the usage of the validator function
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.
Now that I think of this I could have probably have thrown a new Error object with a string instead of saying "success" and returning a string with an error message...
It really isn't any error in the sense of the JS code.. I just need to know if an operation failed or passed then why it failed or passed.
The JS code is just proxying the engine result.
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.
Yup, thanks for the added context @nadr0!
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.
Right I was suggesting changing the type x) All good
Do we need this submodule commit?
|
@nadr0 I was just looking at this on another branch. I have no idea what this is sorry, good catch! |
…guards-for-circular-shapes
@nadr0 should be gone now |
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.
Addressing some comments.
.find((v) => v.type === 'sweep')?.pathId | ||
|
||
if (!object_id) { | ||
return "Unable to shell, couldn't find the solid" |
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.
.then((result) => { |
Here is the usage of the validator function
.find((v) => v.type === 'sweep')?.pathId | ||
|
||
if (!object_id) { | ||
return "Unable to shell, couldn't find the solid" |
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.
Now that I think of this I could have probably have thrown a new Error object with a string instead of saying "success" and returning a string with an error message...
It really isn't any error in the sense of the JS code.. I just need to know if an operation failed or passed then why it failed or passed.
The JS code is just proxying the engine result.
…guards-for-circular-shapes
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.
Thanks for addressing the comments, looks good.
Fixes #4711. Adds playwright test too for the failure case.