Skip to content

Fixes #31329: Allow assigning Data Products across domains from the UI - #32011

Merged
karanh37 merged 8 commits into
mainfrom
fix-issue-31329
Aug 28, 2026
Merged

karanh37 merged 8 commits into
mainfrom
fix-issue-31329

Conversation

@karanh37

@karanh37 karanh37 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • Rule enabled → dropdown stays scoped to the asset's domain (current behavior).
  • Rule disabled → dropdown lists Data Products across all domains, and the "select a domain first" gate on the add/edit action is lifted.

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) — reads entityRules.requireDomainForDataProduct directly.
  • DataProductsContainer (entity right panel / common widgets, version pages) — new optional requireDomainForDataProduct prop, defaulting to true (strict), threaded from CommonWidgets and EntityRightPanel.

Type of change:

  • New feature

How the changes have been tested:

Unit tests

  • Added/updated Jest unit tests.
  • Files:
    • 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

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Added Playwright E2E tests in the dedicated data-asset-rules runner.
  • Files:
    • 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

  1. Disabled the "Data Product Domain Validation" rule under Settings → Data Assets Rules.
  2. Opened a table assigned to Domain A, edited Data Products, confirmed products from Domain B are now listed and assignable.
  3. Re-enabled the rule and confirmed the dropdown is again scoped to the asset's domain.

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:

  • I have read the CONTRIBUTING document.
  • 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.
  • For UI changes: covered by Playwright E2E (see above).
  • I have added tests (unit + Playwright) and listed them 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.

  • Allows cross-domain Data Product searches and assignment when validation is disabled.
  • Threads rule-loading state through shared entity widgets and assignment surfaces.
  • Adds unit and Playwright coverage for enabled and disabled rule behavior.

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

Filename Overview
openmetadata-ui/src/main/resources/ui/src/hooks/useEntityRules.ts Adds loaded-state detection, but cached entries cannot become stale-invalidated after an administrator changes the rule.
openmetadata-ui/src/main/resources/ui/src/context/RuleEnforcementProvider/RuleEnforcementProvider.tsx Its session-lifetime completed-type cache prevents rule refreshes and leaves assignment behavior stale after settings changes.
openmetadata-ui/src/main/resources/ui/src/components/common/DataProductsSection/DataProductsSection.tsx Applies strict loading behavior and conditionally removes domain filtering based on the loaded rule.
openmetadata-ui/src/main/resources/ui/src/components/DataProducts/DataProductsContainer/DataProductsContainer.component.tsx Supports rule-controlled domain filtering and domain-requirement gating with a strict default.
openmetadata-ui/src/main/resources/ui/src/components/DataAssets/CommonWidgets/CommonWidgets.tsx Propagates fail-closed rule-loading state into the shared Data Product widget.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DataAssetRulesDisabled.spec.ts Covers assigning a Data Product from another domain while validation is disabled.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DataAssetRulesEnabled.spec.ts Covers same-domain visibility and exclusion of products from other domains while validation is enabled.

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]
Loading

Reviews (8): Last reviewed commit: "Merge branch 'main' into fix-issue-31329" | Re-trigger Greptile

…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]>
Copilot AI lite review requested due to automatic review settings August 25, 2026 09:23

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 reached their quota limit.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 30 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 30 warning(s) across 8 changed file(s).

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-changed

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 67%
67.17% (80211/119403) 51.68% (48843/94507) 52.68% (14723/27944)

Address 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]>
Copilot AI review requested due to automatic review settings August 25, 2026 10:00

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 reached their quota limit.

@karanh37

Copy link
Copy Markdown
Contributor Author

Addressed the loading-window finding in 4594b15: useEntityRules now exposes isRulesLoaded (derived from whether the entity's rules have actually been fetched — the backend only returns enabled rules, so an empty set is indistinguishable from "not loaded yet"). It's threaded through the GenericProvider context, and DataProductsSection, CommonWidgets, and EntityRightPanel now hold the strict domain-scoped behavior until the rules resolve, so a cross-domain product can't be offered/selected before an enabled rule loads. Added unit coverage for the loading window. Also applied the prettier/organize-imports fixes flagged by UI Checkstyle.

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 reached their quota limit.

Comment on lines +43 to +46
const isRulesLoaded = useMemo(
() => Boolean(allEntityRules?.[entityType]),
[allEntityRules, entityType]
);

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.

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

@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — manual (2026-08-26T16:43:06Z)

Blocked the queue: integration-tests-mysql-elasticsearch

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 reached their quota limit.

@gitar-bot

gitar-bot Bot commented Aug 27, 2026

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

Allows 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

📄 openmetadata-ui/src/main/resources/ui/src/components/common/DataProductsSection/DataProductsSection.tsx:100-104 📄 openmetadata-ui/src/main/resources/ui/src/components/common/DataProductsSection/DataProductsSection.tsx:210-213 📄 openmetadata-ui/src/main/resources/ui/src/components/common/DataProductsSection/DataProductsSection.tsx:288-290
entityRules.requireDomainForDataProduct defaults to false while rules are still being fetched (getEntityRulesValidation initializes it to false and only flips to true after an enabled DATA_PRODUCT_DOMAIN_VALIDATION rule is parsed). During that initial load window both DataProductsSection (which reads entityRules directly) and DataProductsContainer (fed entityRules.requireDomainForDataProduct from CommonWidgets/EntityRightPanel) will treat the rule as disabled: the domain gate is lifted and the dropdown fetches Data Products across all domains, even when the rule is actually enabled. A user who opens the selector before rules load could see/select a cross-domain product and hit a backend rejection on save. Consider gating the relaxed behavior on rules having finished loading (e.g. use isLoading from useEntityRules so the strict default holds until rules resolve).

Options

Display: compact → Showing less information.

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

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-08-27T13:35:07Z)

Blocked the queue: playwright-summary

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

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow assigning Data Products across domains from the UI

3 participants