Skip to content

Enforce form validation schema in Test run limits dialog#1918

Open
rSnapkoOpenOps wants to merge 2 commits intomainfrom
fix/setting-test-run-limits
Open

Enforce form validation schema in Test run limits dialog#1918
rSnapkoOpenOps wants to merge 2 commits intomainfrom
fix/setting-test-run-limits

Conversation

@rSnapkoOpenOps
Copy link
Collaborator

@rSnapkoOpenOps rSnapkoOpenOps commented Feb 6, 2026

…r `min` and `max` values in `TestRunLimitsForm` (#1910)
@linear
Copy link

linear bot commented Feb 6, 2026

Comment on lines +59 to +64
if (min !== undefined) {
setInternalValue(String(min));
onChange?.(min);
} else {
onChange?.(undefined);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In case min value is provided we avoid having empty input

@rSnapkoOpenOps rSnapkoOpenOps marked this pull request as ready for review February 6, 2026 12:18
Copilot AI review requested due to automatic review settings February 6, 2026 12:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +59 to +64
if (min !== undefined) {
setInternalValue(String(min));
onChange?.(min);
} else {
onChange?.(undefined);
}
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
if (min !== undefined) {
setInternalValue(String(min));
onChange?.(min);
} else {
onChange?.(undefined);
}
onChange?.(undefined);

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is behavior we need

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

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.

1 participant