ROX-27260: Fix policy scope validation for edit/clone #18925
Merged
+32
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes policy wizard step 4 validation failing on edit/clone when an excluded deployment scope has only a name (e.g. "node-resolver") and no scope.
The backend returns
scope: nullfor name only exclusions, but the UI form initializes new exclusions withscope: { label: {} }. The yup schema didn't accept null, so validation rejected the entry before the custom test (which already handles null via optional chaining) could run. Added.nullable()to the scope schema and updated theWizardExcludedDeploymenttype to allow null.User-facing documentation
Testing and quality
Automated testing
How I validated my change
Added additional automated tests and performed the following manual verification:
The system policy "90-Day Image Age" includes an inclusion/exclusion scope where only a deployment name is specified. Prior to this fix, cloning or editing the policy caused the Next button to be disabled. After this change, the Next button now works as expected.