Repository navigation
Fixes 37376: Let data products take assets from subdomains of their domain - #39252
Conversation
…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.
…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.
… 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.
…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.
…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.
…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.
❌ PR checklist incompleteThis 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 |
# Conflicts: # openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataProductRepository.java
Code Review ✅ Approved 🔴 High riskChanging domain validation and move/delete reconciliation alters stored asset–data-product links; errors could leave assignments inconsistent with an asset’s effective domains. Data products with Data Product Domain Validation enabled now accept assets from their domain and any subdomain at any depth, and domain moves and deletes keep subtree assets consistent. No open issues found. VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Not backported to
|
|
🤖 Backport to |
…heir domain (backport 2.1 #39252) (#39470) * Fixes #37376: Let data products take assets from subdomains of their 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) * Keep subdomain assets consistent when a data product moves or a subdomain 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) * Re-home only uncovered assets and reconcile inheriting descendants on 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) * Leave assets inheriting a covered subdomain in place on a data product 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) * Reconcile a deleted domain's assets by their effective domains after 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) * Judge asset domains by stored FQNs and clear inherited subdomains from 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) * Assert the forged-FQN IT is rejected by the domain rule itself (cherry picked from commit 4e3d473) * Decrement domain lineage only for the domains a moved asset counted toward * Keep inherited domain lineage when a data product's domains are cleared * Expect the SDK's wrapped exception in the forged-FQN IT --------- Co-authored-by: karanh37 <[email protected]>
…heir domain (backport 2.0 #39252) (#39473) * Fixes #37376: Let data products take assets from subdomains of their 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) * Keep subdomain assets consistent when a data product moves or a subdomain 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) * Re-home only uncovered assets and reconcile inheriting descendants on 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) * Leave assets inheriting a covered subdomain in place on a data product 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) * Reconcile a deleted domain's assets by their effective domains after 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) * Judge asset domains by stored FQNs and clear inherited subdomains from 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) * Assert the forged-FQN IT is rejected by the domain rule itself (cherry picked from commit 4e3d473) * Adapt the subdomain data product backport to 2.0 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. * Decrement domain lineage only for the domains a moved asset counted toward * Keep a data product when a Domain page move stays within its domain subtree * Expect the SDK's wrapped exception in the forged-FQN IT * Drop assets a failed domain delete captured when the next delete starts 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. --------- Co-authored-by: karanh37 <[email protected]>
Describe your changes:
Fixes #37376
With Data Product Domain Validation enabled, a data product only accepted assets assigned directly to its own domain. The domain's Assets tab counts its whole subtree. A data product now accepts assets from its domain and any subdomain, at any depth. The reverse still fails (a subdomain's data product can't take a parent-domain asset), and a domain whose name merely shares a prefix (
SalesvsSalesOps) is not a subdomain. The rule is recorded indocs/decisions/2026-11-30-a-data-product-accepts-assets-from-its-domain-subtree.md.Type of change:
High-level design:
One check, used by every path that applies the rule.
DomainRepository.isWithinAnyDomain(domainIds, scopeDomainIds, knownFqns)is true on an exact id match. Otherwise it compares stored FQNs withFullyQualifiedName.isParent. Callers used to compare raw ids (Collections.disjoint). They are:LogicOps.validateDataProductDomainMatch, the rule itself. It reuses FQNs only from server-resolved data-product domains; the asset's domain FQNs come from the request body, so they are looked up by id and never trusted.DataProductRepository#conflicts, the detach mirror. It is used when a data product's domain changes, by the Domain-page asset move and its dry run, and by domain delete.reconcileConflictsresolves FQNs once per 200-asset chunk.getQueryFilterToIncludeDomain) now usesterm+prefixper domain, the same query shape the domain Assets tab uses. The asset page's data-product picker (fetchDataProductsElasticSearch) widens the asset's domains to their ancestors.Paths that re-home or strip an asset's domain keep the rule true for subtree assets:
planDomainMove):main.Alternatives rejected:
Tests:
Use cases covered
Sales.Emea.Retailcan join aSalesdata product, through bulk Add Assets and through a PATCH on the asset. The asset stays editable.SalesOpsasset is rejected by aSalesdata product, including when the PATCH forges aSales.xFQN onto theSalesOpsid.Salesdata product toMarketingre-homes itsSales.Emeaassets to[Marketing]only. An inheriting asset leaves Emea's Assets listing and joins Marketing's.Emeadata product toSaleskeeps a heldRetailasset and an inheritingRetailasset where they are.RetailtoEmeaon the Domain page keeps itsSalesdata product.Sales.Emeadetaches theSalesdata product from a now domainless asset and from its inheriting descendant. It keeps the data product on an asset whose schema still gives itSales.Unit tests
RuleEngineTest#assetInASubdomainOfTheDataProductDomainSatisfiesTheDomainRulecovers a grandchild domain (accepted), a prefix sibling (rejected), the parent→subdomain direction (rejected) and a forged request FQN (rejected).DomainFilterUtils.test.ts(subtree clauses,getDomainFqnsWithAncestors),DomainUtils.test.tsx,dataProductAPI.test.ts.RuleEngineTest17/17,EntityCsvTest72/72,DomainRepositoryListingTest7/7,DataProductDomainContainmentRepairTest6/6 andDataProductIndexMappingTest2/2 all pass. Jest:DomainFilterUtils.test.ts,DomainUtils.test.tsx,dataProductAPI.test.ts,DataProductsContainer,DataProductsSectionandDomainTreeView.integrationall pass.LogicOps.javahas no unit test that references it by name.RuleEngineTestexercises it throughRuleEngine.apply.DataProductsDetailsPageJest suite (which fails to load because of themarkeddependency) and two other suites (which can't resolveemojibase-data). Both are local dependency problems in the shared node_modules.Backend integration tests
openmetadata-integration-tests/for the changed write paths.DataProductResourceIT:test_subdomainAssetJoinsParentDomainDataProducttest_domainChangeRehomesSubdomainAssetstest_domainWideningKeepsCoveredSubdomainAssetstest_domainPageMoveWithinSubtreeKeepsDataProducttest_hardDeletingSubdomainDetachesParentDomainDataProducttest_hardDeletingSubdomainKeepsDataProductTheContainerStillMatchestest_forgedDomainFqnCannotBypassTheDomainRulemake java_affected ARGS="--scope focused") selectsRuleEngineTest(unit) andDataProductResourceIT(mysql-elasticsearch, parallel). The unit test ran, as above. The IT is left for the merge queue; it compiles (test-compileOK).Local Java test run: PASSED (unit only)
4e3d4739e5d(baseorigin/main); the unit runs were on3a76f7d47d9, whose main code is identical.Ingestion integration tests
Playwright (UI) tests
make playwright_affected) need a running stack; the merge queue runs the full suite. The two pickers are covered by Jest on the query shape only. No Playwright spec checks that a subdomain asset appears in Add Assets.Manual testing performed
Not performed against a running stack. Repro for reviewers:
DomainA→DomainA.SubB→DomainA.SubB.SubC. Assign a table toSubC.DomainA, then open Assets → Add Assets. TheSubCtable is listed and can be added.DomainAdata product.UI screen recording:
Not applicable: this is a bug fix (picker query scope plus backend rule), not a UI feature.
Checklist:
I have read CONTRIBUTING.md (the pre-review gate) and the contributor docs.
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: not applicable (no schema change).
For a UI feature or feature task: not applicable (bug fix, explained above).
I have added tests (unit / integration / Playwright as applicable) and listed them above.
Self-review: I reviewed the final diff against
REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.3a76f7d47d9, the sixth pass.4e3d4739e5donly tightens the forged-FQN IT assertion, as that review suggested.main's "assets follow the data product's domain" behavior. Only subdomain assets are kept.conflictingDataProductslooks up FQNs per asset on a non-exact match: that is at most one query per non-matching data product. An earlier pass preferred that to an unconditional prefetch.Decision check: adds
docs/decisions/2026-11-30-a-data-product-accepts-assets-from-its-domain-subtree.md.I have added a test that covers the exact scenario we are fixing.
🤖 Generated with Claude Code