Skip to content

Fixes #32677: preserve user data in table-type custom property editor when a column is named 'id' - #32741

Merged
sonika-shah merged 7 commits into
mainfrom
detail/bug-fix/fixes-32677-preserve-user-data-in-table-type-custo-2182f0
Sep 11, 2026
Merged

sonika-shah merged 7 commits into
mainfrom
detail/bug-fix/fixes-32677-preserve-user-data-in-table-type-custo-2182f0

Conversation

@detail-app

@detail-app detail-app Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Detail bug report: View on Detail

Describe your changes:

Closes #32677

I worked on preserving user data in the table-type custom property editor when a user defines a column literally named id, because the editor was silently overwriting and then stripping the user's id column value on every save (data loss).

Type of change:

  • Bug fix

High-level design:

N/A — small change.

Root cause. EditTableTypePropertyModal reused the bare literal id as its internal row-identifier key: the useState initializer did rows.map((row, index) => ({ ...row, id: index + '' })) (clobbering any user row.id with the row index) and handleUpdate did omit(row, 'id') on save (stripping the id column from every row). Since table-type custom property columns are user-defined and "id" is a legal column name end-to-end (UI form, backend validateTableTypeConfig, generated TableConfig schema all accept it), this was a reachable, silent data-loss collision.

Fix (two layers):

  • Defense-in-depth (core): The modal now uses a prefixed internal key __row_id__ instead of bare id. The useState initializer seeds { ...row, [ROW_ID_KEY]: index + '' }, the useGridEditController hook is invoked with rowIdKey: ROW_ID_KEY, and handleUpdate strips omit(row, ROW_ID_KEY). User column data — including a column literally named id — now passes through load and save verbatim.
  • Reserved-name rejection (primary prevention): Both the UI form (AddCustomProperty.tsx columns validator) and the backend validator (TypeRepository.validateTableTypeConfig) now reject id and __row_id__ as column names at definition time, with a reserved-column-name message (new i18n key synced to all 20 locales). The backend check covers direct API calls that bypass the UI.

The default rowIdKey = 'id' in useGridEditController is unchanged, so BulkEntityImportPage (which relies on it) and AddDomainFormExtensionFields (which uses rowIdKey: null) are unaffected.

Tests:

Use cases covered

  • User-defined table-type custom property with a column literally named id preserves the user's id value through load and save (no data loss).
  • The internal row-id key never leaks into persisted row data.
  • Reserved column names (id, __row_id__) are rejected at definition time by both the UI form and the backend API.
  • Non-reserved column names continue to be accepted end-to-end.
  • Existing table-type custom property editing (add row, filter empty rows, cancel/save) is unchanged.
  • Other useGridEditController consumers (BulkEntityImportPage, AddDomainFormExtensionFields) are unaffected.

Unit tests

  • I added unit tests for the new/changed logic.
  • Files added/updated:
    • openmetadata-ui/.../TableTypeProperty/EditTableTypePropertyModal.test.tsx — added should preserve a user-defined column named "id" on init and save (no data loss) (renders with columns: ['id', 'name'], rows: [{ id: 'abc-123', name: 'foo' }], asserts dataSource[0].id === 'abc-123' and onSave receives the id value verbatim) and should not leak the internal __row_id__ key into saved rows.
    • The 6 pre-existing tests in the same file still pass.

Backend integration tests

  • I added integration tests in openmetadata-integration-tests/ for the changed API validation.
  • Files added/updated:
    • openmetadata-integration-tests/.../TypeResourceIT.java — test_addTableTypeCustomPropertyWithValidColumns (happy path: ["name","value"] accepted and persisted), test_addTableTypeCustomPropertyWithReservedColumnName_fails (["id","name"] rejected), test_addTableTypeCustomPropertyWithReservedRowIdKey_fails (["__row_id__","name"] rejected).
  • Ran the full TypeResourceIT suite against a running Postgres + OpenSearch stack: 37 tests run, 0 failures, 0 errors (1 pre-existing unrelated skip). The 3 new tests trigger HTTP 400 from the new backend validation check with the reserved-column message.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes). The UI change is internal to the table editor (a key rename + a form validator), fully covered by unit tests and the backend integration tests. A Playwright auth-bootstrap blocker (see Manual testing) prevented running CustomProperties.spec.ts end-to-end.

Manual testing performed

  • Re-ran unit tests across the affected UI suites: EditTableTypePropertyModal (8/8 pass), AddCustomProperty.test (3/3), AddDomainFormExtensionFields (58/58 incl. the columns: ['id'] test data), CustomPropertyTable (40/40), BulkEntityImportPage (36/36). Routine gates also pass: ESLint 0 errors, Prettier clean, tsc --noEmit shows no errors in changed files, mvn spotless:check clean (service + integration tests), yarn check-i18n clean across 20 locales.
  • Backend: mvn compile -pl openmetadata-service succeeds; brought up Postgres + OpenSearch via docker/development/docker-compose-postgres.yml, ran DB migrations (OpenMetadataOperations migrate --force), started the OpenMetadata server with JWT_KEY_ID=test-key pointing at the test-resource RSA keys, minted an admin JWT, then exercised the public Type API directly: PUT /api/v1/metadata/types/<table> with customPropertyConfig.config.columns including "id" → HTTP 400 with "Column name(s) 'id' are reserved for internal use and cannot be used as table custom property columns."; same for "__row_id__"; /["name","value"] → HTTP 200 and the property is subsequently returned by GET ...?fields=customProperties with config={"columns":["name","value"]}.
  • Playwright E2E: attempted to run playwright/e2e/Pages/CustomProperties.spec.ts. Installed Playwright Chromium + system libs (libatk-1.0), started the Vite UI dev server on :3000 proxying to the backend, and bootstrapped the admin user record via API. Blocked at the auth-setup step: POST /api/v1/auth/login for [email protected] / admin returns HTTP 401 because the standard IT bootstrap pipeline (testcontainers / mvn verify -Ppostgres-opensearch) is what provisions the admin user with the password hash the auth endpoint expects; a manually created dev-server user does not satisfy it. The unit and integration tests above cover the same contracts the Playwright suite would exercise.

UI screen recording / screenshots:

Not applicable. The UI change is a non-visual rename of an internal row-id key plus a form validator; no user-visible layout/styling/interactions changed.

Checklist:

  • I have read the CONTRIBUTING document.

  • My PR title is Fixes <issue-number>: <short explanation>

  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.

  • I have commented on my code, particularly in hard-to-understand areas.

  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

  • For UI changes: I attached a screen recording and/or screenshots above.

  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

  • I have added a test that covers the exact scenario we are fixing. For complex issues, comment the issue number in the test for future reference.


Automatic Fixes PRs can be configured here.

@github-actions

github-actions Bot commented Sep 6, 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 6, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 71cf606cff4e116b12480d5d9978fc321be22e84 in Playwright run 34510270469, attempt 1.

✅ 4500 passed · ❌ 0 failed · 🟡 10 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 37m 19s

⏱️ Max setup 4m 57s · max shard execution 20m 41s · max shard-job elapsed before upload 23m 54s · reporting 26s

🌐 217.62 requests/attempt · 2.31 app boots/UI scenario · 42.63% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 42.63% (convergence target: at most 15%).
  • Browser traffic was 217.62 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.31 per UI scenario (10981 boots / 4758 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard advanced-search-01 130 0 0 0 0 0
✅ Shard chromium-01 126 0 0 0 0 0
✅ Shard chromium-02 152 0 0 0 0 0
✅ Shard chromium-03 146 0 0 0 0 0
✅ Shard chromium-04 150 0 0 0 0 0
✅ Shard chromium-05 129 0 0 0 0 0
🟡 Shard chromium-06 141 0 1 0 0 0
✅ Shard chromium-07 145 0 0 0 0 0
✅ Shard chromium-08 191 0 0 0 0 0
✅ Shard chromium-09 125 0 0 0 0 0
✅ Shard chromium-10 171 0 0 0 0 0
✅ Shard chromium-11 131 0 0 0 0 0
✅ Shard chromium-12 143 0 0 0 0 0
✅ Shard chromium-13 143 0 0 0 0 0
🟡 Shard chromium-14 138 0 1 0 0 0
🟡 Shard chromium-15 151 0 1 0 0 0
✅ Shard chromium-16 165 0 0 0 0 0
✅ Shard chromium-17 120 0 0 0 0 0
🟡 Shard chromium-18 187 0 2 0 0 0
✅ Shard chromium-19 176 0 0 0 0 0
✅ Shard chromium-20 159 0 0 1 0 0
✅ Shard chromium-21 150 0 0 0 0 0
✅ Shard chromium-22 156 0 0 0 0 0
✅ Shard chromium-23 141 0 0 0 0 0
🟡 Shard chromium-24 148 0 1 0 0 0
🟡 Shard chromium-25 207 0 1 0 0 0
✅ Shard chromium-26 153 0 0 0 0 0
✅ Shard data-asset-rules-01 65 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
🟡 Shard import-export-01 89 0 1 0 0 0
🟡 Shard import-export-02 29 0 1 0 0 0
✅ Shard import-export-03 30 0 0 0 0 0
🟡 Shard ingestion-01 39 0 1 0 0 0
✅ Shard ingestion-02 55 0 0 0 0 0
✅ Shard reindex-01 28 0 0 0 0 0
✅ Shard search-01 12 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 10 flaky test(s) (passed on retry)
  • Pages/CustomProperties.spec.ts › no duplicate card after update (shard chromium-06, 1 retry)
  • Flow/ObservabilityAlerts.spec.ts › Test case alert (shard chromium-14, 1 retry)
  • Pages/TasksUIFlow.spec.ts › Create and resolve description task for Pipeline via UI (shard chromium-15, 1 retry)
  • Pages/ServiceEntity.spec.ts › Tier Add, Update and Remove (shard chromium-18, 1 retry)
  • Pages/SubDomainPagination.spec.ts › Verify subdomain count and pagination functionality (shard chromium-18, 1 retry)
  • Features/UserProfileOnlineStatus.spec.ts › Should not show online status for inactive users (shard chromium-24, 1 retry)
  • Features/DomainTierCertificationVoting.spec.ts › Domain - Tier assign, update, and remove (shard chromium-25, 1 retry)
  • Features/MetricBulkImportExportEdit.spec.ts › Admin starts exactly one async export job from the metrics listing (shard import-export-01, 1 retry)
  • Features/BulkImport.spec.ts › Database (shard import-export-02, 1 retry)
  • Features/TestSuitePipelineRedeploy.spec.ts › Re-deploy all test-suite ingestion pipelines (shard ingestion-01, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@detail-app detail-app Bot added the safe to test Add this label to run secure Github workflows on PRs label Sep 6, 2026
@github-actions

github-actions Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 1 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 1 warning(s) across 1 changed file(s).

Count Rule
1 react-hooks/exhaustive-deps
All findings
Location Rule Message
🟡 src/components/Settings/CustomProperty/AddCustomProperty/AddCustomProperty.tsx:133:5 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@github-actions

github-actions Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 70%
70.62% (95755/135582) 55.21% (56745/102780) 56.56% (18930/33464)

sonika-shah and others added 3 commits September 10, 2026 10:43
The frontend row-id key rename (id -> __row_id__ in EditTableTypePropertyModal)
already fixes the data loss on its own, and __row_id__ is never persisted. The
backend reserved-name check added the wrong guarantee at the wrong layer: it
rejected `id` -- a legitimate, previously-valid column name -- at the API, and
hard-coded a frontend grid sentinel into backend validation.

- Revert TypeRepository.validateTableTypeConfig reserved-name rejection and its
  RESERVED_TABLE_COLUMN_NAMES constant.
- Remove the three TypeResourceIT tests (and now-unused imports/fixtures) that
  only exercised that backend validation.
- Scope the AddCustomProperty form guard to the frontend's own sentinel
  `__row_id__` (drop `id`), so the form no longer bans a valid column name.
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Playwright impact map auto-refreshed

This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.

- source entries: 757 → 758
- 1 added, 0 removed, 13 changed spec-list

New source→spec entries:
  openmetadata-ui/src/main/resources/ui/src/pages/TableDetailsPageV1/TableAliases/TableAliases.component.tsx

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/playwright/constant/config.ts
  openmetadata-ui/src/main/resources/ui/playwright/constant/sidebar.ts
  openmetadata-ui/src/main/resources/ui/playwright/e2e/fixtures/pages.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/entity/TableClass.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/tag/ClassificationClass.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/team/TeamClass.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/admin.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/scopedLocators.ts
  … and 3 more

What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.

What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit:

python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit  # or a separate commit

Rohit0301
Rohit0301 previously approved these changes Sep 10, 2026
@sonarqubecloud

Copy link
Copy Markdown

@sonika-shah
sonika-shah added this pull request to the merge queue Sep 11, 2026
Merged via the queue into main with commit ca86945 Sep 11, 2026
135 of 136 checks passed
@sonika-shah
sonika-shah deleted the detail/bug-fix/fixes-32677-preserve-user-data-in-table-type-custo-2182f0 branch September 11, 2026 09:27
Rohit0301 added a commit that referenced this pull request Sep 11, 2026
* Fixes #32672: show error placeholder on Topic page for sustained fetch failures (#32736)

* Fixes #32672: show error placeholder on Topic page for sustained fetch failures

* chore(playwright): auto-refresh impact-map.generated.json [skip ci]

---------

Co-authored-by: detail-app[bot] <180357370+detail-app[bot]@users.noreply.github.com>
Co-authored-by: Karan Hotchandani <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Rohit Jain <[email protected]>

* Fixes #32632: reset Impact Analysis pagination to page 1 on search/quick-filter change (#32699)

* fix(ui): reset Impact Analysis pagination to page 1 on search/quick-filter change

* test(ui): add Playwright pagination-reset tests for Impact Analysis (#32632)

Add two E2E tests to Pagination.spec.ts that guard the fix introduced in
change):

- "should reset Impact Analysis table pagination to page 1 on search change"
- "should reset Impact Analysis table pagination to page 1 on quick filter
  change"

Both tests create 16 downstream TableClass entities (exceeding PAGE_SIZE_BASE=15)
so two pages are reachable via ?pageSize=15 in the URL. Each test navigates to
page 2, then triggers the filter/search, and asserts the page-indicator resets
to "1 of X".

Also adds skipUrlParamCheck option to testCompletePaginationWithSearch utility
for callers where search state lives in component state rather than the URL.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* lint fix

* chore(playwright): auto-refresh impact-map.generated.json [skip ci]

---------

Co-authored-by: detail-app[bot] <180357370+detail-app[bot]@users.noreply.github.com>
Co-authored-by: Rohit0301 <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Co-authored-by: Rohit Jain <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Chirag Madlani <[email protected]>

* fix(ui): reset TierCard selectedTier on close to prevent stale radio state (#33115)

* fix(ui): reset TierCard selectedTier on close to prevent stale radio state

Two bugs caused the tier radio button to show stale state:
- Bug A: cancelling a tier change left the cancelled tier selected on reopen
- Bug B: after a successful save, the old tier was shown on reopen because
  handleOpenChange closed over a stale currentTier before React propagated
  the updated prop

Fix: extract handleOpenChange to reset selectedTier to currentTier on every
close, and add a useEffect([currentTier]) guard that re-syncs when the prop
updates while the popover is closed (covers the save-stale race).

Adds unit tests (TierWidget.test.tsx) and a Playwright E2E spec
(TierWidget.spec.ts) covering both scenarios.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* chore(playwright): auto-refresh impact-map.generated.json [skip ci]

* minor fix

* chore(ui): fix formatting in TierWidget spec and test files

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(ui): track TierCard open state internally to guard currentTier re-sync

The useEffect that re-syncs selectedTier on currentTier change was guarding
with !popoverProps?.open, but uncontrolled usages (no popoverProps) have
open === undefined (always falsy), so the reset fired mid-edit, silently
discarding the user's in-progress selection.

Fix: add isOpen state updated in handleOpenChange so the guard works for
both controlled and uncontrolled usages. Also adds isOpen to the useEffect
dependency array to satisfy react-hooks/exhaustive-deps.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* chore(ui): move TableClass init into beforeAll and clarify onOpenChange override

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Fixes #32677: preserve user data in table-type custom property editor when a column is named 'id' (#32741)

* Fixes #32677: preserve user data in table-type custom property editor when a column is named 'id'

* Remove backend reserved-column validation; keep FE __row_id__ guard only

The frontend row-id key rename (id -> __row_id__ in EditTableTypePropertyModal)
already fixes the data loss on its own, and __row_id__ is never persisted. The
backend reserved-name check added the wrong guarantee at the wrong layer: it
rejected `id` -- a legitimate, previously-valid column name -- at the API, and
hard-coded a frontend grid sentinel into backend validation.

- Revert TypeRepository.validateTableTypeConfig reserved-name rejection and its
  RESERVED_TABLE_COLUMN_NAMES constant.
- Remove the three TypeResourceIT tests (and now-unused imports/fixtures) that
  only exercised that backend validation.
- Scope the AddCustomProperty form guard to the frontend's own sentinel
  `__row_id__` (drop `id`), so the form no longer bans a valid column name.

* chore(playwright): auto-refresh impact-map.generated.json [skip ci]

* chore(playwright): auto-refresh impact-map.generated.json [skip ci]

* i18n: translate reserved-column-name into all non-English locales

yarn i18n stamped the English string verbatim into every locale for
message.reserved-column-name; replace those placeholders with real
translations (19 non-en locales), preserving the {{name}} interpolation.

---------

Co-authored-by: detail-app[bot] <180357370+detail-app[bot]@users.noreply.github.com>
Co-authored-by: sonika-shah <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Karan Hotchandani <[email protected]>

* chore(playwright): auto-refresh impact-map.generated.json

* fix(backport): use @playwright/test in TierWidget.spec.ts (base.ts absent in 2.0)

support/fixtures/base.ts was introduced in main after the 2.0 branch cut.
Swap the import to @playwright/test so Playwright can resolve the module
during test discovery on this branch.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---------

Co-authored-by: detail-app[bot] <180357370+detail-app[bot]@users.noreply.github.com>
Co-authored-by: Karan Hotchandani <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Co-authored-by: Chirag Madlani <[email protected]>
Co-authored-by: sonika-shah <[email protected]>

This branch was previously deployed

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

Labels

safe to test Add this label to run secure Github workflows on PRs

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"

3 participants