Grids: throw E1046 errow if key field was removed from data inside onAIColumnRequestCreating - #34510
Open
anna-shakhova wants to merge 2 commits into
Open
Grids: throw E1046 errow if key field was removed from data inside onAIColumnRequestCreating#34510anna-shakhova wants to merge 2 commits into
anna-shakhova wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a safeguard to AI Column request creation in Grid Core so that if onAIColumnRequestCreating mutates the dataset and removes the configured key field, the grid reports E1046 and skips sending the AI request. This fits into the grids AI column integration flow by preventing malformed datasets from reaching the AI integration layer.
Changes:
- Added
isKeyMissingInDatahelper to detect missing key values inonAIColumnRequestCreatingoutput. - Added an early E1046 error path in
AIColumnIntegrationController.sendRequestCorewhen the key field is missing after the handler runs. - Moved “API Handlers / onAIColumnRequestCreating” tests into a dedicated Jest test file and added coverage for the new E1046 scenario.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/devextreme/js/__internal/grids/grid_core/ai_column/utils.ts | Adds isKeyMissingInData helper used to validate the key field in handler-mutated data. |
| packages/devextreme/js/__internal/grids/grid_core/ai_column/controllers/m_ai_column_integration_controller.ts | Fires E1046 and aborts request sending when the key field is missing after onAIColumnRequestCreating. |
| packages/devextreme/js/__internal/grids/grid_core/ai_column/tests/ai_column.integration.test.ts | Removes API handler tests from the integration suite (tests are relocated). |
| packages/devextreme/js/__internal/grids/grid_core/ai_column/tests/ai_column.api_handlers.test.ts | New focused test suite for API handler behavior, including the E1046 regression scenario. |
| return false; | ||
| } | ||
|
|
||
| return data.some((item) => !isDefined(item[keyField])); |
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.