Skip to content

AI Assistant: sanitize null values for optional args#33716

Merged
anna-shakhova merged 3 commits into
DevExpress:26_1from
anna-shakhova:26_1__ai_assistant_sanitizing
May 27, 2026
Merged

AI Assistant: sanitize null values for optional args#33716
anna-shakhova merged 3 commits into
DevExpress:26_1from
anna-shakhova:26_1__ai_assistant_sanitizing

Conversation

@anna-shakhova
Copy link
Copy Markdown
Contributor

No description provided.

@anna-shakhova anna-shakhova self-assigned this May 26, 2026
Copilot AI review requested due to automatic review settings May 26, 2026 09:43
@anna-shakhova anna-shakhova requested a review from a team as a code owner May 26, 2026 09:43
Copy link
Copy Markdown
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 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 accept null | undefined and transform null → undefined for optional fields.
  • Changed GridCommands.validate() to return parsed/transformed actions (or null), 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-undefined sanitization.

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.

@anna-shakhova anna-shakhova force-pushed the 26_1__ai_assistant_sanitizing branch from 4683705 to 9637bbd Compare May 26, 2026 10:04
Comment thread packages/devextreme/js/__internal/grids/grid_core/ai_assistant/grid_commands.ts Outdated
Copilot AI review requested due to automatic review settings May 26, 2026 11:03
dmirgaev
dmirgaev previously approved these changes May 26, 2026
@anna-shakhova anna-shakhova reopened this May 26, 2026
@anna-shakhova anna-shakhova force-pushed the 26_1__ai_assistant_sanitizing branch 2 times, most recently from bf5c245 to b75233b Compare May 26, 2026 11:31
Copy link
Copy Markdown
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@anna-shakhova anna-shakhova force-pushed the 26_1__ai_assistant_sanitizing branch from b75233b to 406332b Compare May 26, 2026 13:02
Copilot AI review requested due to automatic review settings May 26, 2026 13:18
Copy link
Copy Markdown
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

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Comment thread packages/devextreme/testing/helpers/stubs/zodStub.js
@anna-shakhova anna-shakhova force-pushed the 26_1__ai_assistant_sanitizing branch from 4ad696e to 048a813 Compare May 26, 2026 13:30
@anna-shakhova anna-shakhova merged commit f0509bb into DevExpress:26_1 May 27, 2026
128 of 130 checks passed
@anna-shakhova anna-shakhova deleted the 26_1__ai_assistant_sanitizing branch May 27, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants