Skip to content

fix(dataProducts): key ODPS import identity on productID, not display name (2.0 backport) - #34193

Merged
sonika-shah merged 6 commits into
2.0from
backport/odps-productid-identity-2.0
Sep 29, 2026
Merged

sonika-shah merged 6 commits into
2.0from
backport/odps-productid-identity-2.0

Conversation

@sonika-shah

Copy link
Copy Markdown
Collaborator

Backport of #33993 to 2.0.

Problem

ODPS import derived a data product's entity name from the ODPS name (the editable display label); the stable productID was validated but never used. Because the merge/update path matches by entity name, re-importing the same product under a changed name (or from an export) created a new, separate product instead of updating the existing one, and import was not symmetric with export. (OpenMetadata still blocks two products with the same name — these are distinct names for one logical product.)

Fix

Map ODPS productID → entity name (sanitized) and ODPS name → displayName, mirroring export, so matching keys on productID. Plus: match by raw productID first (non-slug names round-trip), quote the lookup FQN (dotted productIDs match), and fall back to the name when a productID has no valid entity-name characters.

Clean cherry-pick of the 5 commits from #33993 (2.0's ODPS files were identical to main's baseline). Build verified on 2.0; unit tests 36/36 and re-import ITs pass on main.

Fixes #33995

… name

ODPS import derived the entity name from the ODPS `name` (display label),
sanitized: "[DEV] Alarms Info" became "DEV_Alarms_Info". `productID` (the
stable ODPS identifier) was validated but never used. Since the merge path
matches an existing product by entity name, re-importing a product whose
display name differs from its slug never matched the existing one — it
created a duplicate and left the original untouched.

This also disagreed with our own exporter: toODPS writes productID from the
entity identifier and name from displayName, so an exported document could
not be re-imported onto itself.

Map ODPS productID -> entity name (sanitized to an FQN-safe slug) and ODPS
name -> displayName. Matching then keys on productID, so re-imports update
the same product. Import and export are now symmetric.

Updates ODPSConverterTest assertions to the new mapping and adds
DataProductResourceIT#importFromODPS_matchesExistingProductByProductId,
which fails without the fix (re-import creates a duplicate).
Now that the entity name comes from productID, dotted identifiers are the
common case (reverse-domain IDs, and toODPS writes the FQN into productID).
DataProduct uses quoteFqn=false, so a dotted name is persisted as a quoted
FQN ("a.b"), but findExistingByName looked it up with the raw unquoted name
and never matched — the PUT re-import then took the create path and failed
with 409 Conflict. Quote the lookup (as DataProductRepository already does
for its rename check); a name with no dots is unchanged.

The re-import IT now uses a dotted productID, which reproduces the 409
without this change.
The round-trip spec gave the re-import a "fresh identity" by renaming only
the ODPS `name`. Now that import identity comes from `productID`, leaving
productID unchanged made the re-import collide with the source product
(409 instead of 201). Rename productID (the identity field) so the exported
document re-homes onto a new product; name maps to displayName.
…names round-trip

Entity names allow spaces, brackets and single colons (entityName forbids only
`::`, `>`, `"`, control chars, max 256), but sanitizeEntityName slugs to
[a-zA-Z0-9_.-] capped at 64. So a product named e.g. "Customer 360" (created via
UI/API) exports productID="Customer 360" and re-imported as "Customer_360" — no
match, duplicate created; long/punctuated productIDs also collide on the 64-char cut.

Match the existing product by the raw productID (which export writes as the entity
FQN) before falling back to the sanitized name, and treat a productID that isn't a
valid entity name as "no match". smartMerge/fullReplace already keep the existing
identity, so a matched product is updated in place.

Adds importFromODPS_matchesExistingNonSlugProductByProductId, which fails without
the raw-productID lookup (re-import creates a duplicate).
… entity-name chars

Deriving the entity name from productID meant an all-non-ASCII or punctuation-only
productID (which sanitizes to empty) failed the import with a 400 — a regression for
documents that imported fine before productID became the identity (they keyed on the
name). Fall back to sanitizing the name in that case, so those documents keep importing.

Also fixes a misleading error: the "ODPS product name '<x>'" message no longer reports
a productID value under the "name" label — the throw now only fires for the name field
(productID goes through the non-throwing sanitizeEntityNameOrNull). Both fields
unusable still fails, with the value that was actually rejected.

Adds fromODPS_fallsBackToNameWhenProductIdNotSanitizable (fails without the fallback).
@sonika-shah
sonika-shah requested review from a team as code owners September 29, 2026 05:42
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

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

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 added backend safe to test Add this label to run secure Github workflows on PRs labels Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit db794e4b8b78c73751f7ae95a4e48bdd34b7abbd in Playwright run 36602644202, attempt 1.

✅ 776 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 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) 53m 17s

⏱️ Max setup 3m 25s · max shard execution 19m 4s · max shard-job elapsed before upload 22m 26s · reporting 4s

🌐 200.05 requests/attempt · 2.50 app boots/UI scenario · 32.08% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 32.08% (convergence target: at most 15%).
  • Browser traffic was 200.05 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.5 per UI scenario (1980 boots / 793 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 140 0 0 0 0 0
✅ Shard chromium-02 163 0 0 0 0 0
✅ Shard chromium-03 152 0 0 0 0 0
✅ Shard chromium-04 163 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 ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 11 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0

📦 Download artifacts

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

@gitar-bot

gitar-bot Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🔴 High risk · Risk could not be assessed, so high risk was applied as a precaution.

ODPS import now derives data product entity names from the stable productID instead of the editable display name, fixing re-import duplication when product names change. Products can now be updated in place rather than creating duplicates, and import is symmetric with export.

✅ 1 closed
✅ Bug: Products imported before this change duplicate on next PUT re-import

📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/domains/DataProductResource.java:1854-1857 📄 openmetadata-service/src/main/java/org/openmetadata/service/util/ODPSConverter.java:166-167
Before this change, ODPS imports got their entity name from the slugified details.name. On 2.0, a product imported that way (e.g. name Sales Analytics → entity Sales_Analytics, productID marketing.sales-analytics) now gets looked up only by the raw productID and then by the sanitized productID. Neither matches, so the same document creates a second product named marketing.sales-analytics alongside the original. Because this is a backport to a stable branch, users who already import on a schedule will get duplicates after upgrading, with no warning. There are two ways to fix it. One is to add a final legacy lookup by sanitizeEntityNameOrNull(details.getName()), used only when both productID lookups miss (and ideally only when that product has no conflicting productID). The other is to ship a migration or release note that renames the entities imported the old way.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

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

@sonika-shah
sonika-shah merged commit 4f3a9b5 into 2.0 Sep 29, 2026
143 of 148 checks passed
@sonika-shah
sonika-shah deleted the backport/odps-productid-identity-2.0 branch September 29, 2026 18:47
@sonarqubecloud

Copy link
Copy Markdown

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

backend 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.

2 participants