Grids: throw E1046 errow if key field was removed from data inside onAIColumnRequestCreating - #34510
Merged
anna-shakhova merged 2 commits intoJul 28, 2026
Merged
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. |
…AIColumnRequestCreating
anna-shakhova
force-pushed
the
ai_column_e1046_main
branch
from
July 28, 2026 08:12
81c1753 to
f945ab4
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
packages/devextreme/js/__internal/grids/grid_core/ai_column/utils.ts:47
isKeyMissingInDatacurrently returnsfalsefor compound keys (keyField: string[]), so it will never detect missing key parts and the request may proceed with invalid key extraction. Also, checkingkeyField in itemdoesn’t catch cases where the key property exists but its value isundefined, which still leads to anundefinedkey (consistent with the existing E1046 check based onrow.key === undefined). Consider validating key presence by value for both single and compound keys.
export const isKeyMissingInData = (
data: UserData[],
keyField: string | string[],
): boolean => {
if (typeof keyField !== 'string') {
Tucchhaa
reviewed
Jul 28, 2026
Tucchhaa
approved these changes
Jul 28, 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.