Skip to content

fix: honor the global domain filter on glossary, metric, classification and tag list endpoints - #31180

Closed
sonika-shah wants to merge 4 commits into
mainfrom
fix/glossary-list-domain-filter
Closed

sonika-shah wants to merge 4 commits into
mainfrom
fix/glossary-list-domain-filter

Conversation

@sonika-shah

@sonika-shah sonika-shah commented Aug 7, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #31173

Several REST list() endpoints did not honor the global Domain filter. The UI's withDomainFilter interceptor appends ?domain=<fqn> to non-search GETs, but an endpoint only applies it if its list() declares @QueryParam("domain") and maps it into the ListFilter domainId condition. Endpoints that didn't silently dropped the param and returned entities from every domain regardless of the domain selected in the navbar.

Reported for the Glossary left panel (by a customer). Verified the same gap on a running 2.0 instance for other domain-scoped catalog entities:

Endpoint Honors ?domain= before after
/glossaries ❌ ✅
/metrics ❌ ✅
/classifications ❌ ✅
/tags ❌ ✅
/dataProducts ✅ (unchanged) ✅

This adds the domain query parameter to GlossaryResource, MetricResource, ClassificationResource and TagResource, resolving it into the ListFilter domainId condition — the same pattern already used by DataProductResource#list and the service resources. The condition flows through the entity-agnostic ListFilter.getDomainCondition (matching entity_relationship rows with relation=10), so it scopes each list to the selected domain. The DomainOnlyAccessRole filter applied inside listInternal still runs afterwards, so the navbar selection can never widen a restricted user's scope.

Type of change:

  • Bug fix

Tests

Backend integration tests — test_listWithDomainFilter added to GlossaryResourceIT, MetricResourceIT, ClassificationResourceIT and TagResourceIT: entities assigned to domain A are returned for ?domain=A and absent for ?domain=B, and vice-versa. Each fails without the fix.

Playwright E2E (playwright/e2e/Pages/) — GlossaryDomainFilter.spec.ts, MetricDomainFilter.spec.ts, ClassificationDomainFilter.spec.ts: selecting a domain in the navbar scopes the Glossary / Metrics / Classifications list pages. The glossary spec additionally covers the DomainOnlyAccessRole paths (single-domain isolation for two users, and a multi-domain user narrowing within assigned domains) so the global filter and the RBAC filter are told apart.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR includes integration and E2E tests for the fix.

…dpoint

GET /v1/glossaries ignored the `domain` query parameter that the UI's
global domain filter appends, so the Govern -> Glossary left panel listed
glossaries from every domain regardless of the selected domain.

Resolve the domain name/FQN and apply it as the ListFilter `domainId`
condition, matching the existing DataProductResource#list pattern.

Adds GlossaryResourceIT#test_listWithDomainFilter asserting cross-domain
isolation (fails without the fix).
@sonika-shah
sonika-shah requested a review from a team as a code owner August 7, 2026 11:38
Copilot AI lite review requested due to automatic review settings August 7, 2026 11:38
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This 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 skip-pr-checks label.

@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

The Java checkstyle failed.

Please run mvn spotless:apply in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Java code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

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.

Pull request overview

This PR fixes the backend GET /api/v1/glossaries list endpoint to honor the UI’s global Domain selection by adding a domain query parameter and translating it into the existing ListFilter domain scoping (domainId → ListFilter.getDomainCondition). It also adds an integration test to prevent regressions.

Changes:

  • Add @QueryParam("domain") to GlossaryResource.list() and apply the resolved domainId filter before calling listInternal.
  • Reuse the established domain-filtering pattern already used by service and data product list endpoints.
  • Add an integration test validating that ?domain=<fqn> returns only glossaries assigned to that domain.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryResource.java Adds domain query param handling and maps it to ListFilter domain scoping for glossary listing.
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/GlossaryResourceIT.java Adds an IT verifying glossary list results are correctly scoped by the requested domain.

Comment on lines +131 to +134
@Parameter(
description = "Filter glossaries by domain name or fully qualified name",
schema = @Schema(type = "string", example = "Engineering"))
@QueryParam("domain")
… list endpoints

Extend the glossary domain-filter fix to the other REST list endpoints
that silently dropped the `domain` query param appended by the UI's
global domain filter: MetricResource, ClassificationResource and
TagResource. Same pattern as glossary and DataProductResource -- resolve
the domain name/FQN and apply it as the ListFilter `domainId` condition.

Adds test_listWithDomainFilter to Metric/Classification/Tag ResourceIT
covering cross-domain isolation (fails without the fix).
Copilot AI review requested due to automatic review settings August 7, 2026 11:59
@sonika-shah sonika-shah changed the title fix(glossary): honor the global domain filter on the glossary list endpoint fix: honor the global domain filter on glossary, metric, classification and tag list endpoints Aug 7, 2026

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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Suppressed comments (4)

openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/TagResourceIT.java:226

  • The test creates new Domain entities but does not register them with TestNamespace cleanup. On shared/external clusters this can accumulate leftover domains across runs and slow down subsequent tests/reindexing. Track the created domain as a root entity via ns.trackRoot so it is hard-deleted in AfterEach cleanup.
  private Domain createTestDomain(TestNamespace ns, String suffix) {
    CreateDomain createDomain =
        new CreateDomain()
            .withName(ns.prefix(suffix))
            .withDescription("Test domain " + suffix)
            .withDomainType(DomainType.AGGREGATE);
    return SdkClients.adminClient().domains().create(createDomain);
  }

openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/MetricResourceIT.java:198

  • The test creates new Domain entities but does not register them with TestNamespace cleanup. On shared/external clusters this can accumulate leftover domains across runs and slow down subsequent tests/reindexing. Track the created domain as a root entity via ns.trackRoot so it is hard-deleted in AfterEach cleanup.
  private Domain createTestDomain(TestNamespace ns, String suffix) {
    CreateDomain createDomain =
        new CreateDomain()
            .withName(ns.prefix(suffix))
            .withDescription("Test domain " + suffix)
            .withDomainType(DomainType.AGGREGATE);
    return SdkClients.adminClient().domains().create(createDomain);
  }

openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/GlossaryResourceIT.java:608

  • The test creates new Domain entities but does not register them with TestNamespace cleanup. On shared/external clusters this can accumulate leftover domains across runs and slow down subsequent tests/reindexing. Track the created domain as a root entity via ns.trackRoot so it is hard-deleted in AfterEach cleanup.
  private Domain createTestDomain(TestNamespace ns, String suffix) {
    CreateDomain createDomain =
        new CreateDomain()
            .withName(ns.prefix(suffix))
            .withDescription("Test domain " + suffix)
            .withDomainType(DomainType.AGGREGATE);
    return SdkClients.adminClient().domains().create(createDomain);
  }

openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/ClassificationResourceIT.java:199

  • The test creates new Domain entities but does not register them with TestNamespace cleanup. On shared/external clusters this can accumulate leftover domains across runs and slow down subsequent tests/reindexing. Track the created domain as a root entity via ns.trackRoot so it is hard-deleted in AfterEach cleanup.
  private Domain createTestDomain(TestNamespace ns, String suffix) {
    CreateDomain createDomain =
        new CreateDomain()
            .withName(ns.prefix(suffix))
            .withDescription("Test domain " + suffix)
            .withDomainType(DomainType.AGGREGATE);
    return SdkClients.adminClient().domains().create(createDomain);
  }

…on domain filter

Add OpenMetadata UI Playwright specs verifying the global (navbar) Domain
filter scopes the Glossary, Metrics and Classifications list pages. The
glossary spec also exercises the DomainOnlyAccessRole paths so the global
filter and the RBAC filter are told apart.
Copilot AI review requested due to automatic review settings August 7, 2026 12:12
@sonika-shah
sonika-shah requested a review from a team as a code owner August 7, 2026 12:12
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

❌ UI Checkstyle Failed

❌ Playwright - ESLint + Prettier + Organise Imports

One or more Playwright test files have linting or formatting issues.

Affected files
  • openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/MetricDomainFilter.spec.ts

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

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.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Suppressed comments (7)

openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/GlossaryResourceIT.java:607

  • Domains created here are not registered with TestNamespace for post-test cleanup. TestNamespaceExtension only deletes roots tracked via ns.trackRoot(...), so this will leave domain entities behind on shared/external clusters and can bloat subsequent tests/reindexing.
    return SdkClients.adminClient().domains().create(createDomain);

openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/MetricResourceIT.java:197

  • Domains created here are not registered with TestNamespace for post-test cleanup. TestNamespaceExtension only deletes roots tracked via ns.trackRoot(...), so this will leave domain entities behind on shared/external clusters and can bloat subsequent tests/reindexing.
    return SdkClients.adminClient().domains().create(createDomain);

openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/ClassificationResourceIT.java:198

  • Domains created here are not registered with TestNamespace for post-test cleanup. TestNamespaceExtension only deletes roots tracked via ns.trackRoot(...), so this will leave domain entities behind on shared/external clusters and can bloat subsequent tests/reindexing.
    return SdkClients.adminClient().domains().create(createDomain);

openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/TagResourceIT.java:225

  • Domains created here are not registered with TestNamespace for post-test cleanup. TestNamespaceExtension only deletes roots tracked via ns.trackRoot(...), so this will leave domain entities behind on shared/external clusters and can bloat subsequent tests/reindexing.
    return SdkClients.adminClient().domains().create(createDomain);

openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/MetricDomainFilter.spec.ts:45

  • The waitForResponse matcher requires a literal ? in the URL. Some callers can hit /api/v1/metrics without a query string, which would make this step hang/flaky. Match the path without enforcing a query separator (consistent with other e2e specs that use includes('/api/v1/...')).
      response.url().includes('/api/v1/metrics?') &&

openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/ClassificationDomainFilter.spec.ts:60

  • The waitForResponse matcher requires a literal ? in the URL. If the request is made without query params (/api/v1/classifications), this will hang/flaky. Prefer matching the path only.
      response.url().includes('/api/v1/classifications?') &&

openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/GlossaryDomainFilter.spec.ts:100

  • The waitForResponse matcher requires a literal ? in the URL. If the request is made without query params (/api/v1/glossaries), this will hang/flaky. Prefer matching the path only.
      response.url().includes('/api/v1/glossaries?') &&

@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

🔴 Playwright Results — workflow failed

Validated commit 987e00fba4cd592004451dca5e99252e68a6197f in Playwright run 31614980555, attempt 1.

✅ 1086 passed · ❌ 2 failed · 🟡 5 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 53m 40s

⏱️ Max setup 3m 5s · max shard execution 19m 5s · max shard-job elapsed before upload 22m 59s · reporting 9s

🌐 202.52 requests/attempt · 2.29 app boots/UI scenario · 14.15% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 202.52 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.29 per UI scenario (2618 boots / 1143 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
🔴 Shard chromium-01 144 1 4 1 0 0
✅ Shard chromium-02 130 0 0 0 0 0
✅ Shard chromium-03 153 0 0 0 0 0
🔴 Shard chromium-04 167 1 1 0 0 0
✅ Shard chromium-05 171 0 0 0 0 0
✅ Shard chromium-06 161 0 0 0 0 0
✅ Shard data-asset-rules-01 61 0 0 0 0 0
✅ Shard domain-isolation-01 14 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard import-export-01 9 0 0 0 0 0
✅ Shard ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 10 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0

Genuine Failures (failed on all attempts)

❌ Pages/GlossaryDomainFilter.spec.ts › DomainOnlyAccess userAB: navbar selector narrows within assigned domains (shard chromium-01)
Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoHaveCount�[2m(�[22m�[32mexpected�[39m�[2m)�[22m failed  Locator:  getByTestId('glossary-left-panel').getByRole('menuitem', { name: 'PW % 085cd1b3 Jolly7d817807', exact: true }) Expected: �[32m0�[39m Received: �[31m1�[39m Timeout:  15000ms  Call log: �[2m  - Expect "toHaveCount" with timeout 15000ms�[22m �[2m  - waiting for getByTestId('glossary-left-panel').getByRole('menuitem', { name: 'PW % 085cd1b3 Jolly7d817807', exact: true })�[22m �[2m    18 × locator resolved to 1 element�[22m �[2m       - unexpected value "1"�[22m 
❌ Pages/MetricDomainFilter.spec.ts › Admin: navbar domain selector filters the metrics list (shard chromium-04)
�[31mTest timeout of 180000ms exceeded.�[39m
🟡 5 flaky test(s) (passed on retry)
  • Features/Glossary/GlossaryAdvancedOperations.spec.ts › should create glossary with multiple owners (users + teams) (shard chromium-01, 1 retry)
  • Features/Glossary/GlossaryAdvancedOperations.spec.ts › should change domain on glossary (shard chromium-01, 1 retry)
  • Features/Glossary/LargeGlossaryPerformance.spec.ts › should expand and collapse all terms (shard chromium-01, 1 retry)
  • Pages/Glossary.spec.ts › Approve and reject glossary term from Glossary Listing (shard chromium-01, 1 retry)
  • Pages/Entity.spec.ts › Domain Propagation (shard chromium-04, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

Include include) {
ListFilter filter = new ListFilter(include);
if (!nullOrEmpty(domain)) {
EntityReference domainReference =

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do we need this call agian? why are we not passing FQN for filtering?

Copilot AI review requested due to automatic review settings August 12, 2026 15:55

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.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Suppressed comments (6)

openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/MetricDomainFilter.spec.ts:45

  • waitForMetricList waits for GET /api/v1/metrics?..., but the Metrics list page is search-backed (it queries GET /api/v1/search/query?index=metric...). This will likely time out and make the spec fail even when the domain filter works.
const waitForMetricList = (page: Page) =>
  page.waitForResponse(
    (response) =>
      response.request().method() === 'GET' &&
      response.url().includes('/api/v1/metrics?') &&

openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryResource.java:163

  • Setting domainId here can get overwritten for DomainOnlyAccessRole users: EntityResource#listInternal unconditionally calls EntityUtil.addDomainQueryParam(...), and Filter#addQueryParam overwrites existing keys. As a result, ?domain= won’t actually narrow results for domain-restricted users (it will be replaced with the user’s assigned domainIds), which also makes the new domain-filter E2E coverage for DomainOnlyAccess users likely to fail.
    if (!nullOrEmpty(domain)) {
      EntityReference domainReference =
          Entity.getEntityReferenceByName(Entity.DOMAIN, domain, Include.NON_DELETED);
      filter.addQueryParam("domainId", String.format("'%s'", domainReference.getId()));
    }

openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/GlossaryResourceIT.java:607

  • This domain is created via the SDK but never registered with TestNamespace#trackRoot, so it won’t be cleaned up by TestNamespaceExtension and can accumulate on shared clusters across test runs.
    return SdkClients.adminClient().domains().create(createDomain);

openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/MetricResourceIT.java:197

  • This domain is created via the SDK but never registered with TestNamespace#trackRoot, so it won’t be cleaned up by TestNamespaceExtension and can accumulate on shared clusters across test runs.
    return SdkClients.adminClient().domains().create(createDomain);

openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/ClassificationResourceIT.java:198

  • This domain is created via the SDK but never registered with TestNamespace#trackRoot, so it won’t be cleaned up by TestNamespaceExtension and can accumulate on shared clusters across test runs.
    return SdkClients.adminClient().domains().create(createDomain);

openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/TagResourceIT.java:225

  • This domain is created via the SDK but never registered with TestNamespace#trackRoot, so it won’t be cleaned up by TestNamespaceExtension and can accumulate on shared clusters across test runs.
    return SdkClients.adminClient().domains().create(createDomain);

@sonarqubecloud

Copy link
Copy Markdown

@sonika-shah

Copy link
Copy Markdown
Collaborator Author

Updated approach - #31538

@gitar-bot

gitar-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Adds domain query parameter support to glossary, metric, classification, and tag endpoints to correctly honor global domain filters, accompanied by comprehensive integration and E2E tests. No issues found.

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

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

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Glossary listing does not honor the global Domain filter

3 participants