Repository navigation
[2.0] Fixes 37376: Let data products take assets from subdomains of their domain (backport 2.0 #39252) - #39473
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. (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)
(cherry picked from commit 4e3d473)
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.
❌ 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 |
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.
Code Review ✅ Approved 🔴 High riskDomain 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. 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 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 (
SalesvsSalesOps) 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
DomainRepository.postDelete. 2.0 has noDeleteLifecycle. On 2.0,postDeleteruns 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…").detachConflictingDataProductsAfterDomainChangeand 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, andconflictingDataProducts(unused on 2.0) is left out.RuleEngine.isOperationEnabled,DomainDAO.listSubtreeIds,EntityUtil.domainAndSubDomainIds,DomainRepository.dataProductRepository(), plus theDATA_PRODUCT_DOMAIN_MATCH_OPERATIONandRECONCILE_CHUNK_SIZEconstants.PolicyConditionUpdaterblock inpostDeleteand the users-defaulting-to-domain eviction. They are main-only context, not part of this PR.interface/queryFilter.interface.ts, soprefixgoes onQueryFieldInterfaceinpages/ExplorePage/ExplorePage.interface.ts. 2.0 has nodataProductAPI.test.ts, so it is created with only this PR's test. TheisOutsideSelectedDomaintests are main-only context and are not brought over.moveDataProductDomainhelper, 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.Retailin a data product moved fromSalestoMktends on[Mkt]instead of[Mkt, Sales.Emea.Retail]).planDomainMoveruns 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.Sno longer deletes aDedge that another asset still supports, an asset inheritingD.Sno 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).D->XD->Xdeleted)S->X=1)D->Xdeleted)D2->Xdeleted)X -> asset, asset holds D.SX->Ddeleted)D->Xdeleted)Each case checks the exact
assetEdgesof every domain-to-domain edge it creates.Test results (unpatched 2.0 tip vs this branch)
SalesOps)dp [],domains []), edit 200, DP assets[][Mkt, Sales.Emea.Retail][Mkt](see note)termfilterterm+prefixfilter, add 200Details
mvn -pl openmetadata-dist,openmetadata-integration-tests -am package -DskipTestspasses, before and after the rebase onto the current 2.0.RuleEngineTestpasses (16 tests). Jest:DomainFilterUtils.test.ts,DomainUtils.test.tsxanddataProductAPI.test.tspass (21 tests). The CI UI lint sequence (organize-imports, eslint --fix, prettier) leaves no diff.DataProductResourceITcases compile here. They run in CI.test_forgedDomainFqnCannotBypassTheDomainRulenow expectsOpenMetadataException. The SDK'supdate()wraps the server's 400 in that type, so the test checks the same 400RULE_VIOLATIONand that the data product is not attached.cleanup()(after the assets to reconcile were captured) never reachespostDelete, so the per-thread map kept that entry.preDeleteof 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.diffexit 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.