AI Assistant: sanitize null values for optional args#33716
Merged
anna-shakhova merged 3 commits intoMay 27, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the DataGrid AI Assistant command validation pipeline so that Zod transforms are applied during validation, enabling null values for optional command arguments to be sanitized into undefined (treating null as “absent”) before command execution.
Changes:
- Added
optionalNullish()Zod helper to acceptnull | undefinedand transformnull → undefinedfor optional fields. - Changed
GridCommands.validate()to return parsed/transformed actions (ornull), and updated the AI Assistant controller + tests accordingly. - Updated selected command schemas (e.g., column pinning, summary) and added/extended Jest tests to cover
null-to-undefinedsanitization.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/devextreme/testing/helpers/stubs/zodStub.js | Extends the QUnit/SystemJS Zod stub to support nullish() and transform() chaining. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/grid_commands.ts | Returns parsed/transformed actions from validation and applies schema parsing output to executed args. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/commands/utils.ts | Introduces optionalNullish() helper to treat null like an omitted optional value. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/commands/index.ts | Modifies the core command registry (currently comments out filterValueCommand). |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/commands/columns.ts | Uses optionalNullish() for fixedPosition to sanitize null values. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/commands/tests/utils.test.ts | Adds unit tests for optionalNullish(). |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/commands/tests/columns.test.ts | Adds coverage for fixedPosition: null → undefined. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/ai_assistant_controller.ts | Consumes parsed actions from validation before execution. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/tests/grid_commands.test.ts | Updates validation tests to assert returned parsed actions and transform application. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/tests/error_handling.integration.test.ts | Updates validate spy behavior to return actions (new API). |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/tests/ai_assistant_view_controller.integration.test.ts | Updates validate spy behavior to return actions (new API). |
| packages/devextreme/js/__internal/grids/data_grid/ai_assistant/commands/summary.ts | Uses optionalNullish() for optional summary item fields. |
| packages/devextreme/js/__internal/grids/data_grid/ai_assistant/commands/tests/summary.test.ts | Adds coverage for null → undefined sanitization in summary command args. |
4683705 to
9637bbd
Compare
dmirgaev
reviewed
May 26, 2026
dmirgaev
reviewed
May 26, 2026
dmirgaev
reviewed
May 26, 2026
dmirgaev
reviewed
May 26, 2026
dmirgaev
previously approved these changes
May 26, 2026
bf5c245 to
b75233b
Compare
b75233b to
406332b
Compare
4ad696e to
048a813
Compare
dmirgaev
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.