Enforce form validation schema in Test run limits dialog#1918
Enforce form validation schema in Test run limits dialog#1918rSnapkoOpenOps wants to merge 2 commits intomainfrom
Conversation
…r `min` and `max` values in `TestRunLimitsForm` (#1910)
| if (min !== undefined) { | ||
| setInternalValue(String(min)); | ||
| onChange?.(min); | ||
| } else { | ||
| onChange?.(undefined); | ||
| } |
There was a problem hiding this comment.
In case min value is provided we avoid having empty input
There was a problem hiding this comment.
Pull request overview
This PR enforces form validation schema in the Test run limits dialog by integrating Typebox schema validation with react-hook-form. The changes ensure that numeric inputs in the test run limits form respect min/max constraints and provide visual feedback for invalid inputs.
Changes:
- Added Typebox schema validation with min/max constraints for test run limit values
- Enhanced NumericInput component to enforce minimum value when input is cleared
- Integrated form validation state to disable save button when form contains invalid values
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/ui-components/src/ui/numeric-input.tsx | Modified to reset to minimum value when cleared instead of allowing undefined |
| packages/ui-components/src/components/test-run-limits-form/test-run-limits-form.tsx | Added Typebox schema validation, visual error indicators, and form validation enforcement |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (min !== undefined) { | ||
| setInternalValue(String(min)); | ||
| onChange?.(min); | ||
| } else { | ||
| onChange?.(undefined); | ||
| } |
There was a problem hiding this comment.
The logic of setting the internal value to min when the input is cleared may not align with user expectations. Users typically expect to be able to clear a numeric input field entirely. Consider allowing the field to remain empty and only enforcing the minimum value on blur or form submission.
| if (min !== undefined) { | |
| setInternalValue(String(min)); | |
| onChange?.(min); | |
| } else { | |
| onChange?.(undefined); | |
| } | |
| onChange?.(undefined); |
There was a problem hiding this comment.
this is behavior we need
packages/ui-components/src/components/test-run-limits-form/test-run-limits-form.tsx
Outdated
Show resolved
Hide resolved
… array in `TestRunLimitsForm`.
|



Fixes OPS-3482.
https://www.loom.com/share/cb3fbc3bdf574c67b9a4a48fb2fd25f3