Skip to content

feat(domain): apply the global navbar domain filter server-side from a persisted defaultDomain - #33908

Merged
sonika-shah merged 98 commits into
mainfrom
fix/global-domain-filter-persisted
Oct 15, 2026
Merged

sonika-shah merged 98 commits into
mainfrom
fix/global-domain-filter-persisted

Conversation

@sonika-shah

@sonika-shah sonika-shah commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The navbar domain selector only narrowed search results; REST lists (glossaries, a schema's tables, services, a glossary's terms, …) ignored it, so picking a domain left most pages unfiltered (#31173). This PR saves the pick on the user (defaultDomain) and applies it server-side to every list endpoint through one central hook, and adds the UI to make the filter visible and reversible.

It is a view filter, not access control: lists narrow to the selected domain and its sub-domains, but any asset still opens by URL, lineage or search (with a notice), and RBAC is never weakened.

Addresses #31173 across every list endpoint (supersedes the narrower attempts #31180 and #31538).
Fixes open-metadata/openmetadata-collate#6454

What this PR changes

Backend

  • User.defaultDomain: the navbar pick, stored as a domain --DEFAULTS_TO--> user relationship (like defaultPersona), settable via PATCH and cleared with null.
  • The auth filter resolves the pick once per request; EntityUtil.addDomainQueryParam (already called by every listInternal) applies it to the list query.
  • Narrows only user-facing data (types in the search all alias) that support domains; settings/config lists (custom property types, alerts, apps, bots, policies, personas, test definitions) and user/team/tag/classification/testCase lists are never narrowed.
  • A pick includes its sub-domains (FQN-hash subtree, recomputed per call, so renames/moves need no cache invalidation).
  • Inherited domains count: on a parent-scoped list (a schema's tables, a glossary's terms) a child matches by its own domain, else its parent's.
  • An explicit ?domain= still wins; bots and internal bulk reads (reindex, listAll) are never narrowed; a domain-only role is only narrowed within its allowed scope, never widened.
  • Deleting a domain clears every pick pointing into it and evicts those users' cached context.

UI

  • The navbar pick is saved to the user and restored on login (also from AI mode's domain scope control and the landing pill).
  • "Filtered by domain [X ✕]" chip on narrowed lists (glossary sidebar, Explore, Settings → Services) to explain and clear the filter.
  • Opening an asset from another domain shows the full page with a notice: "This asset belongs to the X domain. Switch to X to view it with related assets." with Switch Domain and dismiss.
  • Owner/user/team pickers and the asset's data-product picker are not narrowed (people carry no domain, and an asset's data products come from the asset's own domain).

Screenshots

All with Beta picked in the navbar unless noted (admin user, classic UI).

The original issue

No domain picked (All Domains) Beta picked: only Beta glossaries, with the chip
All Domains: every glossary listed Beta picked: glossary list narrowed with chip; Beta terms incl. inherited

Before this PR, picking Beta still listed every glossary, as in the left image (see #31173).

Browse pages follow the effective (inherited) domain: service → database → schema

Service: databases Database: schemas Schema: tables
Service page databases list Database page schemas list Schema page tables: inheriting table listed, other-domain table hidden

Entity page

Table in Beta (inherited): normal page Table in Alpha: full page with a notice and Switch Domain
Table inheriting Beta, no notice Table in Alpha opened while Beta is picked: notice with Switch Domain
Out-of-domain table: Lineage tab still loads Out-of-domain table: Queries tab still loads
Lineage tab of the out-of-domain table Queries tab of the out-of-domain table

Glossary term, data products and domains

Glossary term in Alpha: notice Data products list narrowed to Beta
Glossary term in Alpha with notice Data products list shows only Beta data products
Data product page Domain page (domains are never narrowed)
Data product page Domain page

Explore, Settings, AI mode and the navbar

Explore narrowed, with the chip Settings → Services narrowed, with the chip
Explore narrowed with chip Settings Services narrowed with chip
AI mode: the same filter and chip Navbar domain selector
AI mode glossary with chip Navbar domain selector

Videos

Classic UI: pick Beta → glossary list narrows → out-of-domain term and table show the notice (tabs still load) → schema shows the inherited table → Explore with the chip.

demo_classic.webm

AI mode: the same flow through AI mode's domain scope control.

demo_ai.webm

How to review / test

  1. Create domains A and B, a glossary in each, and a table in A.
  2. Pick B in the navbar: the glossary list shows only B's glossary with the chip; ✕ on the chip clears it.
  3. Open A's table by URL: the full page loads with the notice; Switch Domain moves you to A.
  4. Reload or log in again: the pick is restored.
Design and implementation details

Scope: a view filter, not access control

Selecting a domain narrows what lists show. It never blocks a direct read: an entity in another domain still opens by URL, lineage node, or search hit, and the user can switch to any domain. Access control remains entirely with RBAC (DomainOnlyAccessRole / DomainAccessFilter), which this PR never weakens: a domain-only user is only ever narrowed within their existing scope, never widened.

Design

  • Persistence: defaultDomain (single entityReference) on the User schema, stored as a domain --DEFAULTS_TO--> user relationship (the same pattern as defaultPersona), not inside the user's JSON. It is a requested field (fields=defaultDomain) and is in SubjectCache.USER_CONTEXT_FIELDS, so the cached subject carries it. UserUpdater replaces the row, records the change, and evicts the cached user context immediately and again after commit.
  • Read once per request in the auth layer, applied at the list layer: JwtFilter (and the no-op / OpenID filters) resolves the caller's persisted defaultDomain from the cached subject and carries it as CatalogSecurityContext.activeDomain plus an ActiveDomainContext thread-local, exactly like the active persona. Bots carry none; an impersonated request carries the impersonated user's pick. The list path (EntityUtil.addDomainQueryParam) consumes only that request-carried value and stamps it on the ListFilter. Branch order: bots → skip; non-admin with DomainOnlyAccessRole → the existing enforcement, narrowed to the pick when it is one of the user's allowed domains and never widened; everyone else → the view filter.
  • Gating: supportsDomains && isUserFacingData && !DomainFilterExclusions.isExcluded(entityType). supportsDomains is the entity's intrinsic flag; user-facing data = the type's search index has the all parent alias (so settings/config entities that support domains, e.g. types, alerts, apps, bots, policies, personas, test definitions, doc store, are not narrowed). The exclusion set (user, team, tag, classification, testCase) covers reference/administration lists that must not be emptied.
  • Sub-domains: the hook passes the selected domain's fqnHash, and ListFilter matches against SELECT id FROM domain_entity WHERE fqnHash = :h OR fqnHash LIKE :h.%, recomputed per call from the live table.
  • Parent-scoped lists use the child's effective domain: a list scoped to one parent (?parent=, ?databaseSchema=, ?service=, …) matches a child by its own domain, else the parent's. The parent is the one the list is already authorized against (ListFilter.getResourceContext / getParentResourceContext; the glossary-term list passes its glossary or parent term), resolved lazily and only when a selection applies. If the parent can't be resolved (or for entity-about lists such as tasks), children are listed in full; a list keyed by several ids is narrowed like an unscoped list.
  • Precedence: an explicit ?domain= keeps control. When it only echoes the request's active domain (the UI sends the navbar pick on REST list calls), it is treated as the navbar selection and gets sub-domain matching; any other explicit domain is left exactly as passed.
  • Domain delete: hard-deleting a domain removes its relationship rows, including every DEFAULTS_TO selection pointing at it. DomainRepository collects affected users (one IN (...) query per 500 deleted domains) and evicts their cached context after the cascade. A selection that doesn't resolve to a live domain is treated as "no selection".

Why the auth layer carries it but does not enforce it

The auth layer runs on every request, so it resolves the selection once and makes it available everywhere. Applying it there would block deep-link reads to other domains and empty non-domain lists, so narrowing happens only where list queries are built, with the gating above.

UI details

  • The pick is persisted with a JSON-Patch add upsert on /defaultDomain (first set, change, clear via null); the app-store user is refreshed from the response, then the page reloads. If the PATCH fails, the navbar shows the error and reverts to the persisted value.
  • The request interceptor keeps appending ?domain= to REST GETs and narrowing /search/query, as on main; searches of the user, team and tag indexes (including combined people searches) are not narrowed. searchQuery({ skipDomainFilter: true }) marks a request the interceptor must leave alone (used by the asset's data-product picker).
  • DomainMismatchAlert (entity header, glossary header, data product page) shows when the entity's domain is outside the selection (sub-domain aware); dismissal is per entity. DomainFilterChip renders on the glossary sidebar, Explore and Settings → Services.

Tests

  • Backend unit: DomainNavFilterTest (gating matrix, parent in/outside selection, unresolvable parent, echoed vs explicit domain), EntityUtilTest (addDomainQueryParam_*: view filter for plain user and admin, exclusions, explicit ?domain= wins, bots untouched, domain-only role narrowed within scope, stale selection unfiltered, config lists skipped, multi-id lists), ListFilterTest (subtree subquery), JwtFilterTest (selection carried on the security context; bots carry none).
  • Backend IT: UserResourceIT (defaultDomain PATCH round trip, unknown domain rejected, deleting the selected domain doesn't empty lists, glossary terms follow their effective domain).
  • UI unit: withDomainFilter.test.tsx, searchAPI.test.ts, dataProductAPI.test.ts, useApplicationStore.domain.test.ts, DomainMismatchAlert, DomainFilterChip, DomainFilterUtils, DomainScopeControl, GlossaryLeftPanel, Services, ExploreSearchCard.
  • Playwright: DomainNavFilter/PersistedDomainFilter.spec.ts (sub-domain inclusion, pick survives reload, clearing restores the list), plus the updated Tasks/DomainFiltering.spec.ts and DomainUIInteractions.spec.ts.
  • E2E (local Collate + OSS stacks): API matrix 264/264 on a fresh database; full Playwright suite run with a domain picked to confirm nothing outside the filter's intent is blocked; AUT (1.12.14 → this branch): 0 test failures on PostgreSQL and MySQL.

CI notes

  • The pick is saved per user, so specs that pick a navbar domain run as a throwaway admin (loginAsIsolatedAdmin) to keep the pick out of parallel workers; navbar helpers wait for the pick to save and the page to reload before the next step.
  • RDF: defaultDomain is declared Stored in the ontology contract, like defaultPersona.

Follow-ups (out of scope)

  • Unscoped REST lists match directly assigned domains only; an entity whose domain is only inherited is not matched by /tables without a parent filter. Parent-scoped lists, which the browse pages use, are covered.
  • AI chat / agent search doesn't follow the selection (it streams outside the interceptor).
  • Global lineage: focus on the selected domain rather than hard-filter, to keep cross-domain edges.
  • Audit of list endpoints that bypass listInternal.

The global (navbar) domain filter is a strict domain-membership condition, so
applying it to types that are not domain-scoped in practice (user/team/policy/
tag/...) empties their lists — Settings pages, permission data, tag pickers.
Guard getDomainCondition with an explicit allowlist of domain-scoped catalog
assets and governance artifacts. Absent entityType (legacy ?domain= callers)
is unchanged; safe-by-default: new entity types are not filtered until added.
…enylist

Replace the ~30-entry hardcoded allowlist with the intrinsic
EntityRepository.supportsDomains flag (auto-covers new domain-scoped
entities, nothing to maintain) plus a small, stable DomainFilterExclusions
denylist for domain-supporting types whose lists double as reference/
settings surfaces (user/team/tag/classification). The applies-to rule is
supportsDomains && !isExcluded(entityType), composed at the injection point;
ListFilter keeps the !isExcluded defensive half for legacy ?domain= callers.
…t path

Persist the navbar domain on the user (defaultDomain on user.json). JwtFilter
reads it via the cached SubjectCache into a request-scoped SelectedDomainContext
(mirrors ActivePersonaContext; skipped for bots, best-effort). The paginated
list path (listAfter/listBefore/listWithOffset) applies it through DomainNavFilter
when supportsDomains && !excluded && no explicit ?domain= — internal listAll and
reindex bypass it. testCase joins the exclusions (it inherits its domain and never
materializes one, so strict membership would empty data-quality lists).

Sub-domain descendant expansion and cache invalidation on domain move/delete are
the next step; this applies the exact selected domain.
…t hook

Move the view-lens injection into EntityUtil.addDomainQueryParam — the one
hook every EntityResource.listInternal already calls — and read the persisted
defaultDomain from the already-cached subjectContext there. This removes the
per-repository injection (which the three listAfter/listBefore overrides
bypassed) and the JwtFilter/SelectedDomainContext/PerRequestContextCleaner
plumbing, which were equivalent but reached the auth layer.

The domain-only-role enforcement path in the same hook is unchanged; the view
filter only applies where that enforcement did not, never to bots, and yields
to an explicit ?domain=. Covered by EntityUtilTest.
Copilot AI lite review requested due to automatic review settings September 23, 2026 17:06
@sonika-shah
sonika-shah requested a review from a team as a code owner September 23, 2026 17:06

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 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • Linked issue open-metadata/openmetadata-collate#6454 does not exist or is not accessible.

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 Sep 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ Generated Sources Auto-Updated

The generated TypeScript types (src/generated/) and dereferenced JSON
schemas (src/jsons/, public/jsons/) have been automatically updated
based on JSON schema changes in this PR.

Copilot AI review requested due to automatic review settings September 23, 2026 17:13

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 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 77%
77.68% (125750/161876) 64.33% (79352/123347) 65.54% (26484/40408)

…AC scope

A DomainOnlyAccessRole user kept the full role scope in list views no matter
which domain they picked in the navbar, because the enforcement branch set
domainId first and the view filter yielded to it. Narrow that branch to the
persisted defaultDomain when it is one of the user's assigned domains, keeping
domainAccessControl=true so domainless entities behave exactly as before.

A pick outside the role's scope — only reachable by setting defaultDomain
through the API, since the navbar never lists such a domain — falls back to the
full scope: the filter can narrow within RBAC but never widen past it.
Copilot AI review requested due to automatic review settings September 24, 2026 17:47

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.

…ry list

Review found the feature had no working write path: UserUpdater recorded no
change for defaultDomain, so a PATCH that only set the navbar selection was
dropped, and the cached subject was never evicted. Record the change, evict
the cache, require the reference to resolve to a real domain, and add
defaultDomain to the user patch/update field sets. Covered by ITs that PATCH,
re-read, clear, and reject an unknown domain.

Drop the ListFilter exclusion guard: it ran before domainAccessControl and could
pre-empt DomainOnlyAccessRole scoping for callers that pass entityType; the
exclusion is already decided at the injection point (DomainNavFilter.shouldApply).

GlossaryTermResource.list bypasses listInternal, so it never reached the central
hook; stamp the filter there — the glossary listing was the originally reported gap.
Copilot AI review requested due to automatic review settings September 25, 2026 09:29

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.

…main

The server now scopes list views from the user's persisted defaultDomain, but
nothing in the UI wrote it, so the feature was only reachable through the API.

Seed the navbar from defaultDomain at login (before the existing single-
restricted-domain rule, which stays as the fallback), and persist each switch
with a best-effort JSON-Patch `add` (an upsert: covers first-set, change, and
clear via null). The store updates first so a failed write never blocks
navigation; the app-store user is refreshed from the response.

The ?domain= request interceptor is intentionally kept: several resources
still read it directly, and the server's explicit-domain precedence makes the
overlap a no-op rather than a conflict.
Copilot AI review requested due to automatic review settings September 26, 2026 16:57
@sonika-shah

sonika-shah commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator Author

Update: a follow-up made schemas owned by the picked domain faster on Postgres (5k-table schema 131 → 38 ms): ebe059d541 results.

Performance at scale

Short version: users who haven't picked a domain, bots and personal access tokens run exactly the same SQL as before, so there's no cost to them. With a domain picked, list latency at 250k tables was 10–20x the no-pick time. The new commit 874ecb26ff brings most lists down to about 2–4x, and typical schema lists now take about 20–35 ms. Two edge cases are listed below.

What 874ecb26ff changes

  • The listed type is matched. The domain subquery used to collect every asset of every type in the domain; it now only collects that type (e.g. a table list ignores the domain's dashboards).
  • Domain ids are resolved up front. The selected domain and its sub-domains are looked up once per request (one indexed query on domain_entity), and the ids go into the list SQL as validated UUIDs. Before, the query contained fqnHash LIKE. On Postgres a prepared statement then ran on a generic plan that guessed the domain's size and got it wrong both ways. For a large domain it probed every asset one by one: 600 ms for a count on a 5k-table schema. For an empty domain it scanned an entire 200k-table schema.
  • Anything that isn't a canonical UUID (or a plain type name) is still bound as a parameter, never written into the SQL.

Postgres 15: API latency, p50 ms (admin, 50 rows per page, 30 runs)

Data: 250k tables, 41 domains (10 top-level with 3 sub-domains each, plus an empty one) and 560k domain-to-asset links, 400k of them to other asset types. Schemas of 200k, 50k (owned by a domain) and 5k tables.

List No pick P0 (top-level, 18.5k tables): before → after Sub-domain (5k): before → after Empty domain: before → after
All tables (250k), no schema: API only, see note ¹ 22 312 → 80 95 → 151 ¹ 4 → 6
Schema, 200k tables 31 285 → 59 100 → 58 11 (p95 332) → 7 (p95 9)
Schema, 5k tables (typical) 12 248 → 34 66 → 29 13 → 6
Schema, 50k tables owned by P1, P1 picked (inherited) 15 195 → 147
Glossaries 5 3 → 4 4 → 5 5 → 4

"Before" is this PR before 874ecb26ff, run on the same data.

¹ The only slower cell. The UI never sends this request: every UI call to /tables passes databaseSchema (SchemaTablesTab, DatabaseSchemaPage, DatabaseSchemaVersionPage, EntitySummaryPanelUtilsV1), and bots and personal access tokens skip the filter. See "Remaining edge cases" for the cause.

MySQL 8.0: query time from EXPLAIN ANALYZE, ms (same data and indexes)

Pick List Count: old → new Page: old → new
P0 (16k tables) All tables 108 → 49 102 → 59
P0 (16k tables) Schema, 200k 96 → 52 106 → 56
Sub-domain (4k) All tables 23 → 11 26 → 11
Sub-domain (4k) Schema, 200k 24 → 10 25 → 11
Empty domain Any 0 → 0 0 → 0

Remaining edge cases, both proportional to one list's size

  • A small sub-domain on the unscoped /tables list (no schema) went from 95 to 151 ms on Postgres. The query does less work than before (count about 55 → 20 ms; the page needs about 2.6k index probes, 11 ms when run serially). Postgres underestimates the sub-domain's tables (about 500 against 5,000), so it plans the page as a parallel walk of the name index, and the workers run far past the 51 rows the LIMIT needs (24k probes). I tried two other shapes: reading the domain's assets first, and a Postgres = ANY(ARRAY(...)). Both fix this cell but make large-domain lists 4–15x slower, so I kept this one. MySQL is not affected (26 → 11 ms).
  • A large schema whose tables are all outside the picked domain (0 matches) takes about 100 ms at 50k tables, because the whole schema has to be checked. A schema owned by the picked domain has to check each table for a domain of its own (50k tables: 147 ms).

Per-request overhead

  • The saved domain is read from the per-user cache that authorization already loads, so a cache hit costs nothing. A cache miss costs one extra query, at most once per user per cache TTL.
  • A list with a pick adds one indexed lookup of the domain's sub-domains. It's skipped for excluded types, an explicit ?domain=, bots and personal access tokens.
  • There's no per-row lookup. The count, page and before/after cursor queries all carry the same condition.

Correctness re-checked on the final build

  • Unit tests: 187.
  • API checks: 264 (users × roles × picks × lists) plus 30 post-review checks.
  • Playwright smoke across the affected pages: 25.
  • Default-domain integration tests on MySQL: 6 of 6 pass.

"No domain or a listed domain" was NOT EXISTS ... OR id IN (...). The OR
keeps Postgres from planning it as a join, so it hashes every domain link
in the database (176k rows in the benchmark) before returning a page, even
for a 5k-table schema. A nested NOT EXISTS keeps the same rows and lets
Postgres probe per row for a page and join for a count.

MySQL already checks the OR per row and is slower with the anti-join on
large schemas, so it keeps the existing form.
@sonika-shah

Copy link
Copy Markdown
Collaborator Author

Performance follow-up: ebe059d541

Short version: I re-checked the list calls the UI makes with a domain picked. One real issue: when the picked domain owns the schema, its tables inherit that domain, and the check for them made Postgres hash every domain link in the database before it returned a page. A typical 5k-table schema dropped from 131 ms to 38 ms (13 ms with no pick). Results are unchanged.

What changed

  • Postgres: the "no domain, or a selected domain" check was NOT EXISTS (…) OR id IN (…). The OR stops Postgres from planning it as a join, so it hashed all domain→table links (176k rows here) on every request, even for one page of a small schema. It is now one anti-join (a nested NOT EXISTS), which keeps the same rows. Postgres can then look rows up one by one for a page and join for a count.
  • MySQL keeps the existing form. MySQL already checks the OR row by row, and the anti-join was slower there on large schemas (count 768 → 1108 ms on a 200k-table schema).
  • The same SQL serves the existing domain-only access check (hasDomain() policies), so those lists get faster on Postgres too.

Postgres 15: API p50, ms (admin, 50 rows, best of two alternating runs, same data)

List, picked domain owns the schema No pick Before After
Schema, 5k tables (typical) 13 131 38
Schema, 50k tables 18 160 73

Every other list in the earlier comment runs SQL this commit doesn't touch. Those moved by up to ±20 ms between runs because the host was shared with other work.

Postgres 15: SQL time, page / count ms (generic plans, warm)

Schema owned by the picked domain Before After
5k tables 45 / 47 0.6 / 14
50k tables 46 / 61 3.8 / 34
200k tables 52 / 168 5.9 / 69

Correctness

  • Same rows: the exact matched table ids are identical before and after, across 10 pick × schema combinations. These include tables that have both a selected and a non-selected domain.
  • UserDAOTest (real Postgres 15 and MySQL 8) adds that mixed-domain case.
  • Integration tests: DomainIsolationIT and MultiDomainHasDomainIT pass 12/12 on Postgres and 12/12 on MySQL.
  • Unit tests: 171 pass. The build gate passed.

Known cost, not changed here

A large schema where none of the tables are in the picked domain still has to check every table to find out the page is empty. That's about 100 ms at 50k tables and about 30 ms at 5k (13 ms with no pick). The count for this case is fast, so skipping the page query when the count is 0 would remove it. That's a change to the shared list path and has to stay correct when the count is served from cache, so it should be a separate change.

ListFilter picks the MySQL or Postgres form of the domain-access check from
DatasourceConfig, which only the server initialises. The test never set it, so
the MySQL container ran the Postgres anti-join and the MySQL OR form was never
exercised. Point DatasourceConfig at the engine under test; breaking only the
MySQL form now fails the three MySQL access cases and none of the Postgres ones.
The eviction ran in deleteChildren through evictNowAndAfterCommit, but the
delete path opens no post-commit scope, so both evictions ran immediately,
before cleanup() removed and committed the users' DEFAULTS_TO rows. A
concurrent read in that gap could re-cache the deleted selection.

Evict from DomainRepository.beginDeleteLifecycle instead: the affected users
(the domain and its sub-domains, one listSubtreeIds query) are found before
anything is deleted, and evicted when the lifecycle closes, after cleanup()
commits. The deleted-selection IT now also covers a sub-domain selection.
sonika-shah and others added 5 commits October 13, 2026 15:04
Queries inherit their domain from their table at read time and have no
domain relationship row, so the strict membership match emptied
/v1/queries (e.g. the table page's Queries count badge) whenever a
domain was selected.
Each navbar domain switch was versioned and emitted entityUpdated events to alerts, webhooks and the feed.
It is now stored like lastLoginTime: the selection is saved without a version bump or change event.
…ter needs it

Lists naming a parent loaded it on every call with a domain selected, even when the
filter didn't apply (e.g. ingestion pipelines listed by service).
- DataQuality "TestCase filters": make the navbar pick as an isolated admin
  instead of the shared admin, so the saved pick can't narrow concurrent specs.
- Glossary, DataProductAndSubdomains, DomainFilterQueryFilter: wait for the
  PATCH and the reload after a navbar pick before interacting.
- Tasks/DomainFiltering: arm the task-count waiter after the save and match the
  expected domain param, so a leftover count request can't satisfy it.
- domain utils: fail fast on a non-ok defaultDomain save; bound the reload wait.
- Add a useSwitchActiveDomain unit test (save, clear, failed save, no user).
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Playwright impact map auto-refreshed

This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.

- source entries: 922 → 922
- 0 added, 0 removed, 3 changed spec-list

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/playwright/utils/domain.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/isolatedDomainUser.ts
  openmetadata-ui/src/main/resources/ui/src/components/NavBar/NavBar.tsx

What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.

What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit:

python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit  # or a separate commit

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

❌ UI Checkstyle Failed

❌ Bundle Runtime Check

A route chunk loads but one of its chunks still exports undefined: a chunking change broke module initialisation. Run yarn build && yarn bundle:runtime locally.

🔍 ESLint findings in this PR's files — 0 error(s), 34 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), 34 warning(s) across 9 changed file(s).

Count Rule
29 react-hooks/exhaustive-deps
3 openmetadata-imports/no-lower-layer-page-imports
2 openmetadata-imports/no-circular-imports
All findings
Location Rule Message
🟡 src/components/Auth/AuthProviders/AuthProvider.tsx:344:9 react-hooks/exhaustive-deps The 'onLoginHandler' function makes the dependencies of useMemo Hook (at line 1206) change on every render. Move it inside the useMemo callback. Alternatively,
🟡 src/components/Auth/AuthProviders/AuthProvider.tsx:462:6 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'navigate', 'setApplicationLoading', 'setCurrentUser', and 'setIsAuthenticated'. Either include them or remove
🟡 src/components/Auth/AuthProviders/AuthProvider.tsx:548:9 react-hooks/exhaustive-deps The 'resetUserDetails' function makes the dependencies of useMemo Hook (at line 1206) change on every render. To fix this, wrap the definition of 'resetUserDeta
🟡 src/components/Auth/AuthProviders/AuthProvider.tsx:794:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'handleRefreshFailed', 'handleStoreProtectedRedirectPath', 'setIsAuthenticated', and 'signOutAfterRefreshFailure'
🟡 src/components/Auth/AuthProviders/AuthProvider.tsx:796:9 react-hooks/exhaustive-deps The 'handleFailedLogin' function makes the dependencies of useMemo Hook (at line 1206) change on every render. Move it inside the useMemo callback. Alternativel
🟡 src/components/Auth/AuthProviders/AuthProvider.tsx:859:5 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'authConfig?.provider', 'handledVerifiedUser', 'navigate', and 'resetUserDetails'. Either include them or remov
🟡 src/components/Auth/AuthProviders/AuthProvider.tsx:909:9 react-hooks/exhaustive-deps The 'initializeAxiosInterceptors' function makes the dependencies of useMemo Hook (at line 1206) change on every render. To fix this, wrap the definition of 'in
🟡 src/components/Auth/AuthProviders/AuthProvider.tsx:1195:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'fetchAuthConfig'. Either include it or remove the dependency array.
🟡 src/components/DataProducts/DataProductsDetailsPage/DataProductsDetailsPage.component.tsx:890:6 react-hooks/exhaustive-deps React Hook useMemo has missing dependencies: 'getEntityFeedCount', 'isVersionsView', and 'openAssetDrawer'. Either include them or remove the dependency array.
🟡 src/components/DataProducts/DataProductsDetailsPage/DataProductsDetailsPage.component.tsx:928:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'fetchActiveAnnouncement', 'fetchActivityCount', 'fetchDataProductAssets', 'fetchDataProductContract', and 'fetch
🟡 src/components/DataProducts/DataProductsDetailsPage/DataProductsDetailsPage.component.tsx:941:5 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'tabs'. Either include it or remove the dependency array.
🟡 src/components/DataProducts/DataProductsDetailsPage/DataProductsDetailsPage.component.tsx:941:6 react-hooks/exhaustive-deps React Hook useMemo has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.
🟡 src/components/DataProducts/DataProductsDetailsPage/DataProductsDetailsPage.component.tsx:983:6 react-hooks/exhaustive-deps React Hook useMemo has missing dependencies: 'handleTabChange' and 't'. Either include them or remove the dependency array.
🟡 src/components/Glossary/GlossaryHeader/GlossaryHeader.component.tsx:590:6 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'isGlossary', 'onAddGlossaryTerm', and 'selectedData'. Either include them or remove the dependency array. If '
🟡 src/components/Glossary/GlossaryHeader/GlossaryHeader.component.tsx:670:6 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'showModal'. Either include it or remove the dependency array.
🟡 src/components/Glossary/GlossaryHeader/GlossaryHeader.component.tsx:729:6 react-hooks/exhaustive-deps React Hook useMemo has missing dependencies: 'handleAddGlossaryTermClick' and 't'. Either include them or remove the dependency array.
🟡 src/components/Glossary/GlossaryHeader/GlossaryHeader.component.tsx:771:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'handleBreadcrumb'. Either include it or remove the dependency array.
🟡 src/components/Glossary/GlossaryHeader/GlossaryHeader.component.tsx:790:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'fetchCurrentGlossaryInfo' and 'isVersionView'. Either include them or remove the dependency array.
🟡 src/components/NavBar/NavBar.tsx:213:5 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'activeTab' and 'hasMentionNotification'. Either include them or remove the dependency array.
🟡 src/components/NavBar/NavBar.tsx:368:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'location.pathname'. Either include it or remove the dependency array.
🟡 src/components/NavBar/NavBar.tsx:458:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'showBrowserNotification'. Either include it or remove the dependency array.
🟡 src/components/NavBar/NavBar.tsx:462:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'fetchOMVersion'. Either include it or remove the dependency array.
🟡 src/components/NavBar/NavBar.tsx:481:5 react-hooks/exhaustive-deps React Hook useMemo has an unnecessary dependency: 't'. Either exclude it or remove the dependency array.
🟡 src/components/Settings/Services/Services.tsx:219:5 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'handlePagingChange' and 't'. Either include them or remove the dependency array.
🟡 src/components/Settings/Services/Services.tsx:242:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'handlePageChange'. Either include it or remove the dependency array.
🟡 src/components/Settings/Services/Services.tsx:449:5 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'getServiceLogoElement'. Either include it or remove the dependency array.
🟡 src/components/Settings/Services/Services.tsx:526:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'handlePageChange'. Either include it or remove the dependency array.
🟡 src/components/Settings/Services/Services.tsx:545:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'getServiceDetails'. Either include it or remove the dependency array.
🟡 src/hoc/withDomainFilter.tsx:20: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/interface/search.interface.ts:15: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/interface/search.interface.ts:69: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/interface/search.interface.ts:70: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/pages/Glossary/GlossaryLeftPanel/GlossaryLeftPanel.component.tsx:90:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'glossaries' and 'selectedKey'. Either include them or remove the dependency array.
🟡 src/utils/DomainFilterUtils.ts:17: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.

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

make ui-checkstyle-changed

@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-14T16:34:28Z)

Blocked the queue: playwright-summary

Failed Playwright tests:

  • Features/SSOConfiguration.spec.ts › should render authReassignRoles as a searchable dropdown and support role selection, removal, and search filtering

@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-15T04:41:53Z)

Blocked the queue: integration-tests-mysql-elasticsearch

@gitar-bot

gitar-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 9 closed / 9 findings

🟡 Medium risk · Persisting defaultDomain and applying it across user-facing list queries could unexpectedly hide assets or distort parent-scoped results across the catalog.

Saves the navbar domain pick to the user as defaultDomain and applies it server-side to list endpoints, with sub-domain and inherited-domain matching, a filter chip, and a notice for out-of-domain assets. Earlier issues were resolved, including DomainOnlyAccessRole enforcement on exclusion checks, persistence and cache eviction of defaultDomain, the failed 'All Domains' clear, the delete-failure cleanup, per-entity dismissal state, ?parent= lookups for directory lists, combined user/team searches, and test-case lists. No open issues found.

✅ 9 closed
✅ Security: Exclusion check bypasses DomainOnlyAccessRole list enforcement

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java:798-801 📄 openmetadata-service/src/main/java/org/openmetadata/service/util/EntityUtil.java:1095-1109
getDomainCondition now returns "" whenever entityType is excluded (user/team/tag/classification/testCase). It does this before looking at domainAccessControl. The restricted branch of addDomainQueryParam sets domainId + domainAccessControl=true but not entityType. Any caller that does pass entityType for one of these types therefore loses RBAC scoping, and a domain-only user sees every row. The navbar exclusion is supposed to be a view preference. It should never override enforcement. Fix: skip the exclusion when domainAccessControl is true, or better, drop the ListFilter check entirely, since DomainNavFilter.shouldApply already gates excluded types at the injection point.

✅ Bug: defaultDomain is never persisted by UserUpdater or evicted from cache

📄 openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectCache.java:51 📄 openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectContext.java:336-338 📄 openmetadata-spec/src/main/resources/json/schema/entity/teams/user.json:123-126
UserRepository.UserUpdater.entitySpecificUpdate has no compareAndUpdate("defaultDomain", ...). So a PATCH that only changes defaultDomain records no change, updateVersion/fieldsChanged() stay false, and the new value is not stored. Also, SubjectCache.invalidateUserContext only runs for personas/defaultPersona. So even when the value does get stored alongside another change, the cached SubjectContext keeps serving the old defaultDomain, and list filtering keeps using the stale domain. There is also no check that the reference is a real domain. Fix: add a recordChange("defaultDomain", ...) update (after validating the ref is a domain), and add defaultDomain to the invalidateUserContext field list.

✅ Edge Case: Failed 'All Domains' clear is reverted after navigate(0) reload

📄 openmetadata-ui/src/main/resources/ui/src/components/NavBar/NavBar.tsx:488-502 📄 openmetadata-ui/src/main/resources/ui/src/hooks/useApplicationStore.ts:80-84
When a user picks "All Domains", updateActiveDomain(undefined) sets activeDomain to DEFAULT_DOMAIN_VALUE and then sends the PATCH that clears /defaultDomain. If that PATCH fails, the catch block swallows the error and navigate(0) reloads the page anyway. On reload, getLoggedInUser still returns the old defaultDomain. syncDomainStoreForUser then sees isDefaultDomainActive && user.defaultDomain and puts the old domain back in the navbar. So the "keep the optimistic navbar state" comment is wrong for clears: the user's choice is quietly undone, and the server keeps filtering by the old domain. A fix: if the persist call fails, don't treat the clear as done. Either revert or show an error before reloading, or record locally that the user cleared the domain so the restore step skips it.

✅ Bug: defaultDomain cleared in finally even when the domain delete fails

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DomainRepository.java:553-562 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/UserRepository.java:265-278
clearDefaultDomainReferences runs inside the finally of deleteChildren, so it also runs when super.deleteChildren throws. In that case the domain subtree still exists, but every user who picked a domain in it loses their persisted defaultDomain anyway. Also, if any per-user patch throws inside the finally, that new exception hides the original delete failure. The fix is to clear only after the cascade succeeds: move the call out of finally to right after super.deleteChildren(...) (or behind a success flag), and keep only the ThreadLocal cleanup and reindex in finally.

✅ Bug: Dismissed state is not keyed to entityId and carries over to other entities

📄 openmetadata-ui/src/main/resources/ui/src/components/common/DomainMismatchAlert/DomainMismatchAlert.component.tsx:54-58
useState(() => isDismissed(entityId)) reads localStorage only on mount. DataAssetsHeader keeps the same component instance when you move between entities of the same type, because React Router does not remount on a param change. So after you dismiss the alert for entity A, it also stays hidden for entity B, even though B was never dismissed. It also misses a dismissal saved for B when B is reached without a remount, and when entityId starts as '' while the asset loads. To fix this, either derive the dismissed flag from the current entityId on every render (keeping a local version counter to force a re-render), or have the parent pass key={entityId} to the component.

...and 4 more closed from earlier reviews

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
test — 44ba8840 Deployed Oct 15, 2026 by sonika-shah via RDF Playwright execution #32406
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.

5 participants