Skip to content

feat(personas): add server-side persona search endpoint#30469

Open
harsh-vador wants to merge 3 commits into
mainfrom
add-persona-search
Open

feat(personas): add server-side persona search endpoint#30469
harsh-vador wants to merge 3 commits into
mainfrom
add-persona-search

Conversation

@harsh-vador

@harsh-vador harsh-vador commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Describe your changes:

Adds a server-side search endpoint for personas, mirroring the existing GET /roles/search.

Why

The persona picker (assign personas to a user) had no way to search server-side — clients fetch a page of personas and filter locally, which silently misses personas beyond the fetched page once a deployment has many. Roles and domains already have server-side search; personas did not.

Changes

  • BackendPersonaResource: new GET /v1/personas/search?q=&fields=&limit=&offset=&include=. Thin wrapper over the shared searchInternal (DB nameFilter LIKE on name/displayName), identical shape to RoleResource.search.
  • UI RESTPersonaAPI.searchPersonas(query, limit)GET /personas/search.
  • Tests
    • PersonaResourceIT.test_searchPersonasEndpoint: name + displayName matches, name ordering, case-insensitivity, empty-result, offset pagination (no dupes), empty-query fallback, deleted-persona exclusion. Mirrors RoleResourceIT.
    • PersonaAPI.test.ts: asserts the endpoint/params and that an empty query drops q.

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

High-level design:

N/A — small change.

Tests:

Use cases covered

Unit tests

Backend integration tests

Ingestion integration tests

Playwright (UI) tests

Manual testing performed

UI screen recording / screenshots:

Not applicable.

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: I updated the migration scripts or explained why it is not needed.
  • For UI changes: I attached a screen recording and/or screenshots above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

Greptile Summary

Adds server-side persona search and integrates it into the persona picker.

  • Adds a paginated /v1/personas/search backend endpoint.
  • Adds the corresponding UI REST client and server-backed picker search.
  • Preserves persona selections across search result changes.
  • Adds backend integration, frontend unit, and Playwright coverage.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failures remain.

Important Files Changed

Filename Overview
openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/PersonaResource.java Adds a validated, paginated persona search endpoint using the shared entity-resource search implementation.
openmetadata-ui/src/main/resources/ui/src/rest/PersonaAPI.ts Adds the typed REST helper used to query the persona search endpoint.
openmetadata-ui/src/main/resources/ui/src/components/MyData/Persona/PersonaSelectableList/PersonaSelectableList.component.tsx Switches dynamic persona filtering to debounced server search while preserving selections across result pages.
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/PersonaResourceIT.java Covers matching, ordering, case handling, pagination, empty queries, and deletion behavior for the endpoint.
openmetadata-ui/src/main/resources/ui/src/components/MyData/Persona/PersonaSelectableList/PersonaSelectableList.component.test.tsx Covers initial loading, remote and local search paths, and selection retention across queries.

Sequence Diagram

sequenceDiagram
  participant User
  participant Picker as PersonaSelectableList
  participant Client as PersonaAPI
  participant Service as PersonaResource
  participant DB as Persona Repository
  User->>Picker: Enter search text
  Picker->>Client: searchPersonas(query, limit)
  Client->>Service: GET /v1/personas/search
  Service->>DB: searchInternal(name/displayName)
  DB-->>Service: Paginated personas
  Service-->>Client: "ResultList<Persona>"
  Client-->>Picker: Persona[]
  Picker-->>User: Matching options
Loading

Reviews (3): Last reviewed commit: "address comments" | Re-trigger Greptile

Context used:

@harsh-vador harsh-vador self-assigned this Jul 24, 2026
@harsh-vador
harsh-vador requested review from a team as code owners July 24, 2026 12:21
@harsh-vador harsh-vador added safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check labels Jul 24, 2026
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 65%
65.69% (76806/116919) 49.52% (46031/92951) 50.79% (13904/27374)

@gitar-bot

gitar-bot Bot commented Jul 24, 2026

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

Adds a server-side persona search endpoint and integrates it into the UI persona picker, addressing issues with multi-select state loss, race conditions from out-of-order responses, and case-sensitive local filtering.

✅ 3 resolved
Bug: Multi-select loses prior selections after server-side search

📄 openmetadata-ui/src/main/resources/ui/src/components/MyData/Persona/PersonaSelectableList/PersonaSelectableList.component.tsx:187-199 📄 openmetadata-ui/src/main/resources/ui/src/components/MyData/Persona/PersonaSelectableList/PersonaSelectableList.component.tsx:246 📄 openmetadata-ui/src/main/resources/ui/src/components/MyData/Persona/PersonaSelectableList/PersonaSelectableList.component.tsx:255-258 📄 openmetadata-ui/src/main/resources/ui/src/components/MyData/Persona/PersonaSelectableList/PersonaSelectableList.component.tsx:269
handleChange rebuilds currentlySelectedPersonas by filtering the current selectOptions for the FQNs antd reports as selected. With server-side search, selectOptions is now replaced by each search's results (filterOption={false} + onSearch), so any persona selected under a previous query is no longer in selectOptions. In multi-select mode a user who selects 'Analyst' (query 'ana'), then searches 'stew' and selects 'Steward', ends up saving only 'Steward' — the earlier pick is silently dropped even though antd still shows its tag. This causes data loss on persona assignment. Fix by resolving selected values against an accumulated map of all seen personas (and the initial selectedPersonas) rather than only the currently displayed selectOptions.

Bug: Debounced search results can arrive out of order

📄 openmetadata-ui/src/main/resources/ui/src/components/MyData/Persona/PersonaSelectableList/PersonaSelectableList.component.tsx:151-157
handleSearch debounces then awaits searchPersonas, calling setSelectOptions with whatever resolves. Two in-flight requests (e.g. 'a' then 'ab') can resolve out of order, leaving the dropdown showing stale results that don't match the current query text. Guard against this by tracking the latest query (e.g. a ref/request-id) and ignoring responses that are no longer current before calling setSelectOptions.

Bug: Local personaList filter is case-sensitive, unlike server search

📄 openmetadata-ui/src/main/resources/ui/src/components/MyData/Persona/PersonaSelectableList/PersonaSelectableList.component.tsx:118-124
When personaList is provided the filter uses displayName?.includes(searchText)/name?.includes(searchText), which is case-sensitive, whereas the server-side searchPersonas path is case-insensitive (per the backend tests). This makes the picker behave inconsistently depending on whether a personaList is supplied. Lowercase both sides before comparing to match server behavior.

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 👍 / 👎 | Gitar

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

🔴 Playwright Results — workflow failed

Validated commit 7e9939c351603190fe30ef493808d7e8d10868ba in Playwright run 30095061691, attempt 1.

✅ 746 passed · ❌ 1 failed · 🟡 1 flaky · ⏭️ 8 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) 46m 20s

⏱️ Max setup 3m 34s · max shard execution 16m 32s · max shard-job elapsed before upload 19m 35s · reporting 7s

🌐 196.01 requests/attempt · 2.53 app boots/UI scenario · 19.56% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 19.56% (convergence target: at most 15%).
  • Application boot ratio was 2.53 per UI scenario (1952 boots / 773 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
🔴 Shard chromium-01 114 1 0 6 0 0
🟡 Shard chromium-02 143 0 1 0 0 0
✅ Shard chromium-03 121 0 0 0 0 0
✅ Shard chromium-04 106 0 0 0 0 0
✅ Shard chromium-05 124 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 23 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 27 0 0 2 0 0

Genuine Failures (failed on all attempts)

Flow/PersonaFlow.spec.tsSet default persona for team should work properly (shard chromium-01)
Error: �[2mexpect(�[22m�[31mreceived�[39m�[2m).�[22mtoBe�[2m(�[22m�[32mexpected�[39m�[2m) // Object.is equality�[22m  Expected: �[32m200�[39m Received: �[31m500�[39m
🟡 1 flaky test(s) (passed on retry)
  • Pages/CustomProperties.spec.tsShould display custom properties for apiEndpoint in right panel (shard chromium-02, 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

@sonarqubecloud

Copy link
Copy Markdown

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 skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant