Skip to content

[2.0] Fixes 37376: Let data products take assets from subdomains of their domain (backport 2.0 #39252) - #39473

Merged
sonika-shah merged 12 commits into
2.0from
backport/2.0-39252
Dec 2, 2026
Merged

sonika-shah merged 12 commits into
2.0from
backport/2.0-39252

Conversation

@sonika-shah

@sonika-shah sonika-shah commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Backport of #39252 to 2.0. Merge after #39252 lands on main.

With "Data Product Domain Validation" on, a data product now accepts assets from its domain and any subdomain of it, not only the exact domain. The Add Assets picker and an asset's data product picker show the same scope. A domain that only shares a name prefix (Sales vs SalesOps) is still rejected. A data product domain move and a subdomain hard delete keep the assets consistent.

The 7 commits from #39252 are cherry-picked with -x. The last commit adapts them to 2.0.

Adaptations vs main

  • Domain-delete reconcile runs from DomainRepository.postDelete. 2.0 has no DeleteLifecycle. On 2.0, postDelete runs after the domain's edges are removed, in both the single and the bulk cascade path. This is the PR's own earlier shape (commit "Reconcile a deleted domain's assets…").
  • Conflict helpers carried over. The reconcile needs detachConflictingDataProductsAfterDomainChange and the helpers under it, which exist on main from Fixes #30679: detach conflicting data products on data product domain change #32944. They are added here only for the domain-delete reconcile. The data product domain-change detach from Fixes #30679: detach conflicting data products on data product domain change #32944 is not wired in, and conflictingDataProducts (unused on 2.0) is left out.
  • Domain-page asset move keeps covering data products. 2.0's Domain-page asset add (and its dry run) dropped every data product whose domain was not exactly the target domain. It now drops a data product only when the target domain is outside all of the data product's domain subtrees, matching main. A data product with several domains no longer fails the lookup. Moving an asset to an unrelated domain still drops the data product.
  • Small helpers copied verbatim from main: RuleEngine.isOperationEnabled, DomainDAO.listSubtreeIds, EntityUtil.domainAndSubDomainIds, DomainRepository.dataProductRepository(), plus the DATA_PRODUCT_DOMAIN_MATCH_OPERATION and RECONCILE_CHUNK_SIZE constants.
  • Left out because the code doesn't exist on 2.0: the PolicyConditionUpdater block in postDelete and the users-defaulting-to-domain eviction. They are main-only context, not part of this PR.
  • UI: 2.0 has no interface/queryFilter.interface.ts, so prefix goes on QueryFieldInterface in pages/ExplorePage/ExplorePage.interface.ts. 2.0 has no dataProductAPI.test.ts, so it is created with only this PR's test. The isOutsideSelectedDomain tests are main-only context and are not brought over.
  • IT: adds the moveDataProductDomain helper, which is main-only. Main's Fixes #30679: detach conflicting data products on data product domain change #32944 ITs are not brought over.

Behaviour note (same as #39252 on main): with the rule turned off, moving a data product's domain now also removes an old subdomain that an asset holds directly (an asset on Sales.Emea.Retail in a data product moved from Sales to Mkt ends on [Mkt] instead of [Mkt, Sales.Emea.Retail]). planDomainMove runs on every data product domain change; only the detach after it is gated on the rule.

Domain lineage on data product move

Moving a data product to another domain now subtracts each moved asset from domain lineage only for the old domains it counted toward: its own domains, or its inherited ones when it holds none. So an asset holding D.S no longer deletes a D edge that another asset still supports, an asset inheriting D.S no longer leaves a stale edge, and clearing a data product's domains subtracts only the domains an asset directly holds (its inherited domains and subdomains stay).

Case (asset in the data product, lineage to a table in X) Before this commit This branch main
L1 asset holds D PASS PASS PASS
L2 asset inherits D PASS PASS PASS
L3 asset holds D.S, another asset in D keeps D->X FAIL (D->X deleted) PASS PASS
L4 asset inherits D.S FAIL (stale S->X=1) PASS PASS
L5 two assets in D both move PASS PASS PASS
L6 one of two assets in D moves PASS PASS PASS
L7 covered asset (D.S.T, data product widened to D) PASS PASS PASS
L8 rule off, asset in unrelated domain Y FAIL (D->X deleted) PASS PASS
L9 data product in [D1, D2], asset holds D1 FAIL (D2->X deleted) PASS PASS
L10 upstream X -> asset, asset holds D.S FAIL (X->D deleted) PASS PASS
C1 data product domains cleared, asset holds D.S PASS PASS PASS
C2 data product domains cleared, asset inherits D.S PASS PASS PASS
C3 data product domains cleared, asset inherits D FAIL (D->X deleted) PASS PASS

Each case checks the exact assetEdges of every domain-to-domain edge it creates.

Test results (unpatched 2.0 tip vs this branch)

Case Before After
Bulk add same-domain table 200 200
Bulk add subdomain / child / inherited-domain table, subdomain glossary term 400 200
Bulk add prefix-sibling domain (SalesOps) 400 400
PATCH subdomain table into parent-domain DP 400 200
PATCH reverse (parent table into subdomain DP), prefix sibling, forged FQN 400 400 (RULE_VIOLATION)
DP domain move: subdomain assets stay in old subdomain (never attached) re-homed to new domain, DP kept, edit 200
Hard delete subdomain holding a parent-DP asset n/a (attach was 400) asset detached (dp [], domains []), edit 200, DP assets []
Rule OFF: bulk add / PATCH / domain-page move / hard delete baseline identical
Rule OFF: data product move, asset holding an old subdomain [Mkt, Sales.Emea.Retail] [Mkt] (see note)
UI Add Assets picker (rule on) top-domain table only, term filter whole subtree, term+prefix filter, add 200
UI DP picker on a subdomain / inherited-domain table no options parent-domain DPs only (not the prefix-sibling DP), PATCH 200
UI rule OFF unscoped unscoped (same)
Details
  • Build: mvn -pl openmetadata-dist,openmetadata-integration-tests -am package -DskipTests passes, before and after the rebase onto the current 2.0.
  • Unit: RuleEngineTest passes (16 tests). Jest: DomainFilterUtils.test.ts, DomainUtils.test.tsx and dataProductAPI.test.ts pass (21 tests). The CI UI lint sequence (organize-imports, eslint --fix, prettier) leaves no diff.
  • The before/after runs used server images built from the unpatched 2.0 tip and from this branch, each on a fresh Postgres + Elasticsearch stack. The UI checks used each image's own UI bundle.
  • Known 2.0 difference, same before and after: with the rule OFF, a domain-less table can join a data product (main returns 400 there). This is pre-existing and unchanged.
  • The new DataProductResourceIT cases compile here. They run in CI.
  • test_forgedDomainFqnCannotBypassTheDomainRule now expects OpenMetadataException. The SDK's update() wraps the server's 400 in that type, so the test checks the same 400 RULE_VIOLATION and that the data product is not attached.
  • A domain hard delete that fails inside cleanup() (after the assets to reconcile were captured) never reaches postDelete, so the per-thread map kept that entry. preDelete of the next top-level domain delete now clears it; sub-domains of a cascade leave it alone. Checked with a delete forced to fail by a database trigger: the failed delete changes nothing, an unrelated delete right after it and a retry of the same delete detach the data product correctly, and a parent delete cascades as before, both through the API and from the Domain page in the UI. The lineage, cleared-domain, rule-on/off and move suites give the same results as before this commit.
  • After the domain-lineage and Domain-page commits, the API cases above and the rule-OFF run were rerun on an image built from the final commit (rule-OFF output identical to the previous run of this branch, diff exit 0). The three UI checks were rerun after the lineage commit; the Domain-page commit changes no UI code. The UI checks needed selector updates for the 2.0 sign-in and picker markup; what they assert is unchanged.

karanh37 and others added 8 commits December 1, 2026 19:36
…domain

With Data Product Domain Validation enabled, a data product accepted only assets
assigned directly to its own domain, while the domain's Assets tab counts the
whole subtree. The rule (LogicOps), its reconcile mirror (DataProductRepository
conflicts) and both UI pickers now treat a subdomain at any depth as within the
data product's domain.

(cherry picked from commit c81326e)
…main is deleted

Moving a data product's domain now removes its assets from the old domains'
whole subtree, and hard-deleting a domain detaches data products its assets no
longer match. Adds regression ITs and the decision record.

(cherry picked from commit 49058f1)
… domain delete

A data product's domain move now leaves assets in subdomains the new domains
still cover, and removes each re-homed asset only from the subdomains it holds,
so no other asset's domain lineage changes. Hard-deleting a domain also
reconciles descendants that inherit it. The subdomain check reuses FQNs the
caller already holds and resolves the rest once per reconcile chunk.

(cherry picked from commit 492cace)
…t move

Coverage now also uses an asset's inherited domain, so a table under a schema in
a still-covered subdomain keeps inheriting it instead of being pinned to the new
domain. The Domain-page conflict check prefetches FQNs once; adds ITs for the
inherited and Domain-page cases.

(cherry picked from commit 49be4f2)
…its edges go

Hard-deleting a domain now captures its direct assets before the edges are
removed and reconciles them in postDelete with the inheritance-aware detach, so
an asset that now inherits a matching domain keeps its data product. The work
runs only when a surviving ancestor domain holds a data product.

(cherry picked from commit 0ffd6a6)
…m search on a move

The domain rule now resolves the asset's domain FQNs by id instead of trusting
the request body. A data product move also drops inherited old subdomains from
the re-homed assets' search documents, skips the subdomain work when there is
none, and the deleted-domain reconcile runs when the delete lifecycle closes so
its per-thread entry is always cleared.

(cherry picked from commit 3a76f7d)
2.0 lacks pieces the change builds on in main, so this carries the smallest
equivalents:
- RuleEngine.isOperationEnabled, to gate the domain-delete reconcile on the
  "Data Product Domain Validation" rule.
- DomainDAO.listSubtreeIds and EntityUtil.domainAndSubDomainIds, used to find a
  data product's old subdomains on a domain move.
- The data-product conflict helpers the domain-delete reconcile calls, and
  their constants. The data-product domain-change detach that uses them on
  main is a separate change and is not wired in here.
- The deleted domain's assets are reconciled from postDelete, which on 2.0
  runs after the domain's edges are removed; 2.0 has no delete lifecycle hook.
- dataProductRepository() helper in DomainRepository, plus imports.
@sonika-shah
sonika-shah marked this pull request as ready for review December 1, 2026 14:16
@sonika-shah
sonika-shah requested review from a team as code owners December 1, 2026 14:16
@sonika-shah
sonika-shah requested review from harsh-vador and yan-3005 and removed request for a team December 1, 2026 14:16
@github-actions

github-actions Bot commented Dec 1, 2026

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.

Copilot AI balanced review requested due to automatic review settings December 1, 2026 19:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings December 1, 2026 21:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

A delete that throws in cleanup() never reaches postDelete, so its captured
assets stayed in the per-thread map. A new top-level domain delete now clears
them before anything is captured; sub-domains of a cascade leave the map alone.
Copilot AI balanced review requested due to automatic review settings December 2, 2026 07:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@gitar-bot

gitar-bot Bot commented Dec 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk

Domain moves and hard-delete reconciliation rewrite asset, data-product, and lineage relationships; mistakes could detach valid assignments or leave lineage inconsistent.

Backports subdomain-aware data product domain validation to 2.0, so data products accept assets from their domain and any subdomain while prefix-sibling domains are still rejected. Domain moves and subdomain hard deletes now keep data product assets and domain lineage consistent.

No issues found during review.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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 ed9d37f into 2.0 Dec 2, 2026
66 of 69 checks passed
@sonika-shah
sonika-shah deleted the backport/2.0-39252 branch December 2, 2026 09:04
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.

4 participants