Repository navigation
Fixes #31329: Allow assigning Data Products across domains from the UI - #32011
Conversation
…idation rule is disabled Fixes #31329 The Data Product dropdown on an asset was always scoped to the asset's own domain, so a product legitimately spanning multiple domains could not be assigned without re-homing the asset's domain. Gate the scoping on the existing "Data Product Domain Validation" data asset rule via `entityRules.requireDomainForDataProduct`: - rule enabled -> dropdown stays scoped to the asset's domains (unchanged) - rule disabled -> dropdown lists Data Products across all domains, and the "select a domain first" gate on the add/edit action is lifted Applied to both assignment surfaces: DataProductsSection (summary panel) and DataProductsContainer (entity right panel / common widgets, threaded a new optional requireDomainForDataProduct prop defaulting to strict). The backend already respects the rule through RuleEngine, so no backend change is needed. Adds Jest coverage for both components and Playwright tests in the dedicated data-asset-rules runner (cross-domain assignment allowed when disabled; scoped-out when enabled). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
| Count | Rule |
|---|---|
| 11 | react-hooks/exhaustive-deps |
| 7 | openmetadata-imports/no-circular-imports |
| 5 | openmetadata-imports/no-lower-layer-page-imports |
| 4 | sonarjs/cyclomatic-complexity |
| 3 | sonarjs/no-duplicate-string |
All findings
| Location | Rule | Message | |
|---|---|---|---|
| 🟡 | src/components/Customization/GenericProvider/GenericProvider.interface.ts:19:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/Customization/GenericProvider/GenericProvider.tsx:24:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/Customization/GenericProvider/GenericProvider.tsx:26:1 |
openmetadata-imports/no-circular-imports |
This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency. |
| 🟡 | src/components/Customization/GenericProvider/GenericProvider.tsx:28:1 |
openmetadata-imports/no-circular-imports |
This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency. |
| 🟡 | src/components/Customization/GenericProvider/GenericProvider.tsx:33:1 |
openmetadata-imports/no-circular-imports |
This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency. |
| 🟡 | src/components/DataAssets/CommonWidgets/CommonWidgets.tsx:42:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/DataAssets/CommonWidgets/CommonWidgets.tsx:46:1 |
openmetadata-imports/no-circular-imports |
This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency. |
| 🟡 | src/components/DataAssets/CommonWidgets/CommonWidgets.tsx:47:1 |
openmetadata-imports/no-circular-imports |
This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency. |
| 🟡 | src/components/DataAssets/CommonWidgets/CommonWidgets.tsx:52:1 |
openmetadata-imports/no-circular-imports |
This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency. |
| 🟡 | src/components/DataAssets/CommonWidgets/CommonWidgets.tsx:53:1 |
openmetadata-imports/no-circular-imports |
This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency. |
| 🟡 | src/components/DataAssets/CommonWidgets/CommonWidgets.tsx:260:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 'data'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataAssets/CommonWidgets/CommonWidgets.tsx:264:44 |
sonarjs/cyclomatic-complexity |
{"message":"Function has a complexity of 17 which is greater than 10 authorized.","cost":7,"secondaryLocations":[{"line":264,"column":43,"endLine":264,"endColum |
| 🟡 | src/components/DataAssets/CommonWidgets/CommonWidgets.tsx:309:8 |
sonarjs/cyclomatic-complexity |
{"message":"Function has a complexity of 18 which is greater than 10 authorized.","cost":8,"secondaryLocations":[{"line":309,"column":7,"endLine":309,"endColumn |
| 🟡 | src/components/DataAssets/CommonWidgets/CommonWidgets.tsx:424:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 'handleTagSelection'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataAssets/CommonWidgets/CommonWidgets.tsx:449:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has missing dependencies: 'entityRules.canAddMultipleGlossaryTerm' and 'handleTagSelection'. Either include them or remove the dependency arr |
| 🟡 | src/components/DataAssets/CommonWidgets/CommonWidgets.tsx:485:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has missing dependencies: 'data' and 'onUpdate'. Either include them or remove the dependency array. |
| 🟡 | src/components/DataAssets/CommonWidgets/CommonWidgets.tsx:495:29 |
sonarjs/cyclomatic-complexity |
{"message":"Function has a complexity of 15 which is greater than 10 authorized.","cost":5,"secondaryLocations":[{"line":495,"column":28,"endLine":495,"endColum |
| 🟡 | src/components/DataAssets/CommonWidgets/CommonWidgets.tsx:549:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has missing dependencies: 'editCustomAttributePermission', 'entityRules.canAddMultipleDomains', 'entityType', 'type', and 'viewCustomProperti |
| 🟡 | src/components/DataProducts/DataProductsContainer/DataProductsContainer.component.tsx:120:24 |
sonarjs/no-duplicate-string |
Define a constant instead of duplicating this literal 5 times. |
| 🟡 | src/components/DataProducts/DataProductsContainer/DataProductsContainer.component.tsx:125:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has missing dependencies: 'multiple' and 't'. Either include them or remove the dependency array. |
| 🟡 | src/components/DataProducts/DataProductsContainer/DataProductsContainer.component.tsx:171:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has missing dependencies: 'hasPermission', 'redirectLink', and 't'. Either include them or remove the dependency array. |
| 🟡 | src/components/DataProducts/DataProductsContainer/DataProductsContainer.component.tsx:205:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTab.component.tsx:28:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTab.component.tsx:70:22 |
sonarjs/cyclomatic-complexity |
{"message":"Function has a complexity of 26 which is greater than 10 authorized.","cost":16,"secondaryLocations":[{"line":70,"column":21,"endLine":70,"endColumn |
| 🟡 | src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTab.component.tsx:202:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTab.component.tsx:240:24 |
sonarjs/no-duplicate-string |
Define a constant instead of duplicating this literal 3 times. |
| 🟡 | src/components/Entity/EntityRightPanel/EntityRightPanel.tsx:22:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/common/DataProductsSection/DataProductsSection.tsx:138:24 |
sonarjs/no-duplicate-string |
Define a constant instead of duplicating this literal 6 times. |
| 🟡 | src/components/common/DataProductsSection/DataProductsSection.tsx:198:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 'setPopoverOpen'. Either include it or remove the dependency array. |
| 🟡 | src/hooks/useEntityRules.ts:36:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 'getEntityRuleValidation'. Either include it or remove the dependency array. |
Fix locally (fast - only checks files changed in this branch):
make ui-checkstyle-changedAddress review feedback: entityRules.requireDomainForDataProduct defaults to false while the rules are still being fetched, so during the initial load window the domain gate was lifted and the dropdown fetched Data Products across all domains even when the rule was actually enabled — letting a user select a cross-domain product that the backend then rejects on save. Expose isRulesLoaded from useEntityRules (derived from whether the entity's rules have been fetched, since the backend only returns enabled rules and an empty set is indistinguishable from "not loaded yet") and thread it through the GenericProvider context. DataProductsSection, CommonWidgets and EntityRightPanel now keep the strict domain-scoped behavior until the rules resolve. Also apply prettier/organize-imports fixes flagged by UI Checkstyle. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Addressed the loading-window finding in 4594b15: |
| const isRulesLoaded = useMemo( | ||
| () => Boolean(allEntityRules?.[entityType]), | ||
| [allEntityRules, entityType] | ||
| ); |
There was a problem hiding this comment.
Stale rules unlock assignments
When an entity type is loaded while Data Product Domain Validation is disabled and an administrator subsequently enables the rule in the same application session, isRulesLoaded continues treating the cached entry as current. Assignment controls therefore keep offering cross-domain Data Products, causing the backend to reject the selection on save.
🚦 Removed from the merge queue —
|
Code Review ✅ Approved 1 resolved / 1 findingsAllows assigning Data Products across domains from the UI by conditionally removing domain scoping when the corresponding entity rule is disabled. Addresses the domain scoping during the entityRules loading window. Cleanly implemented with comprehensive unit and Playwright tests. ✅ 1 resolved✅ Edge Case: Domain scoping relaxed during entityRules loading window
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
🚦 Removed from the merge queue —
|



Describe your changes:
Fixes #31329
The Data Product dropdown on an asset was always scoped to the asset's own domain. To associate a table in Domain A with a Data Product in Domain B, users had to first re-assign the table to Domain B, distorting domain ownership for cross-functional Data Products that legitimately span domains.
This change gates the domain scoping on the existing Data Product Domain Validation data asset rule, surfaced in the UI via
entityRules.requireDomainForDataProduct:The backend already respects this rule through
RuleEngine(only enabled rules are evaluated and only enabled rules are returned to the UI for the entity type), so no backend change is required — the UI dropdown scoping was the only blocker.Applied to both assignment surfaces:
DataProductsSection(summary panel) — readsentityRules.requireDomainForDataProductdirectly.DataProductsContainer(entity right panel / common widgets, version pages) — new optionalrequireDomainForDataProductprop, defaulting totrue(strict), threaded fromCommonWidgetsandEntityRightPanel.Type of change:
How the changes have been tested:
Unit tests
DataProductsSection.test.tsx— rule-enabled scoping, rule-disabled all-domains fetch, and domain-requirement gating.DataProductsContainer.component.test.tsx(new) — fetch scoping by rule, and add-button/placeholder gating.Backend integration tests
Ingestion integration tests
Playwright (UI) tests
DataAssetRulesDisabled.spec.ts— asserts a Data Product from a different domain is offered and can be assigned when the rule is disabled.DataAssetRulesEnabled.spec.ts— asserts a same-domain product is listed (positive control) and an other-domain product is scoped out when the rule is enabled.Manual testing performed
UI screen recording / screenshots:
Not applicable — behavior change to an existing dropdown; covered by the Playwright tests above. Happy to attach a recording if reviewers want one.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.🤖 Generated with Claude Code
Greptile Summary
The PR makes Data Product selection follow the server-provided domain-validation rule while retaining strict behavior until rules load.
Confidence Score: 4/5
The PR is not yet safe to merge because assignment controls can retain a stale disabled-rule state after domain validation is enabled.
The authenticated rule provider caches each entity type after its first successful fetch and does not invalidate that entry when rule settings change, so ordinary navigation back to an asset continues using the previous permissive state and can offer assignments that the now-enabled backend rule rejects.
Files Needing Attention: openmetadata-ui/src/main/resources/ui/src/context/RuleEnforcementProvider/RuleEnforcementProvider.tsx; openmetadata-ui/src/main/resources/ui/src/hooks/useEntityRules.ts
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR A[Load entity rules] --> B{Rules loaded?} B -->|No| C[Require asset domain] B -->|Yes| D{Domain validation enabled?} D -->|Yes| C D -->|No| E[Search Data Products across domains] C --> F[Search within asset domains]Reviews (8): Last reviewed commit: "Merge branch 'main' into fix-issue-31329" | Re-trigger Greptile