Skip to content

fix: avoid data loss when table-type custom property has column named "id" - #33044

Closed
a-kash-singh wants to merge 4 commits into
open-metadata:mainfrom
a-kash-singh:fix/table-property-id-column-collision
Closed

fix: avoid data loss when table-type custom property has column named "id"#33044
a-kash-singh wants to merge 4 commits into
open-metadata:mainfrom
a-kash-singh:fix/table-property-id-column-collision

Conversation

@a-kash-singh

@a-kash-singh a-kash-singh commented Sep 9, 2026

Copy link
Copy Markdown

EditTableTypePropertyModal used the bare string 'id' as an internal row-tracking key. When a user defined a column literally named id, the component overwrote the column value with a row index on load and stripped it entirely via omit(row, 'id') on save, causing silent data loss.

Rename the internal sentinel to row_id in the modal state initializer, the save handler, and useGridEditController.handleAddRow so it cannot collide with any user-defined column name.

Fixes #32677

…named "id"

     2
     3	The internal row-tracking key `'id'` collided with user-defined columns of the
     4	same name: the value was overwritten with a row index on load and stripped
     5	entirely on save. Rename the internal sentinel to `__row_id__` across the modal
     6	state initializer, the save handler, and the hook's handleAddRow so there is no
     7	collision with any user-defined column.
     8
     9	Fixes open-metadata#32677
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

const [dataSource, setDataSource] = useState<
TableTypePropertyValueType['rows']
>(() => rows.map((row, index) => ({ ...row, id: index + '' })));
>(() => rows.map((row, index) => ({ ...row, __row_id__: index + '' })));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Quality: No regression test for the "id" column collision fix

The PR fixes silent data loss when a user-defined column is literally named id, but no test exercises that scenario. The existing tests in TableTypePropertyEditTable.test.tsx still use id as internal mock keys and only cover the child table component, not the modal's state initializer/save path where the collision occurred. Add a test that renders EditTableTypePropertyModal with a column named id, edits it, and asserts onSave preserves the user's id value (and that __row_id__ is stripped) to prevent regression.

Was this helpful? React with 👍 / 👎

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@gitar-bot

gitar-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 0 resolved / 1 findings

Fixes silent data loss when a table-type custom property has a column named id by renaming the internal row-tracking key to __row_id__ across the modal state initializer, save handler, and grid controller. Consider adding a regression test that renders the modal with a user-defined id column, edits it, and verifies the value is preserved on save.

💡 Quality: No regression test for the "id" column collision fix

📄 openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/TableTypeProperty/EditTableTypePropertyModal.tsx:54 📄 openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/TableTypeProperty/EditTableTypePropertyModal.tsx:77

The PR fixes silent data loss when a user-defined column is literally named id, but no test exercises that scenario. The existing tests in TableTypePropertyEditTable.test.tsx still use id as internal mock keys and only cover the child table component, not the modal's state initializer/save path where the collision occurred. Add a test that renders EditTableTypePropertyModal with a column named id, edits it, and asserts onSave preserves the user's id value (and that __row_id__ is stripped) to prevent regression.

🤖 Prompt for agents
Code Review: Fixes silent data loss when a table-type custom property has a column named `id` by renaming the internal row-tracking key to `__row_id__` across the modal state initializer, save handler, and grid controller. Consider adding a regression test that renders the modal with a user-defined `id` column, edits it, and verifies the value is preserved on save.

1. 💡 Quality: No regression test for the "id" column collision fix
   Files: openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/TableTypeProperty/EditTableTypePropertyModal.tsx:54, openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/TableTypeProperty/EditTableTypePropertyModal.tsx:77

   The PR fixes silent data loss when a user-defined column is literally named `id`, but no test exercises that scenario. The existing tests in TableTypePropertyEditTable.test.tsx still use `id` as internal mock keys and only cover the child table component, not the modal's state initializer/save path where the collision occurred. Add a test that renders EditTableTypePropertyModal with a column named `id`, edits it, and asserts onSave preserves the user's `id` value (and that `__row_id__` is stripped) to prevent regression.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@a-kash-singh

Copy link
Copy Markdown
Author

Closing in favour of #32741 which covers a more comprehensive fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Detail Bug] Custom property table editor deletes values when a column is named "id"

1 participant