Skip to content

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

Merged
harsh-vador merged 8 commits into
mainfrom
add-persona-search
Aug 5, 2026
Merged

harsh-vador merged 8 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

  • Backend — PersonaResource: 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 REST — PersonaAPI.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 a server-side persona search flow and integrates it into the persona picker.

  • Adds the /v1/personas/search backend endpoint with offset pagination.
  • Adds the UI REST helper and debounced picker search.
  • Preserves selected personas across changing search result sets.
  • Adds backend integration, component, REST-client, and Playwright coverage.

Confidence Score: 4/5

This PR is not yet safe to merge because persona searches with more than 50 matches still leave later matches unreachable.

The UI always requests offset zero and discards paging metadata, so the server-side search integration does not fully resolve the large-deployment picker failure.

Files Needing Attention: openmetadata-ui/src/main/resources/ui/src/components/MyData/Persona/PersonaSelectableList/PersonaSelectableList.component.tsx; openmetadata-ui/src/main/resources/ui/src/rest/PersonaAPI.ts

Important Files Changed

Filename Overview
openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/PersonaResource.java Adds a paginated persona search endpoint backed by the shared entity search implementation.
openmetadata-ui/src/main/resources/ui/src/rest/PersonaAPI.ts Adds the search client but fixes every request at offset zero and removes pagination metadata from the return value.
openmetadata-ui/src/main/resources/ui/src/components/MyData/Persona/PersonaSelectableList/PersonaSelectableList.component.tsx Wires debounced server search and cross-query selection preservation, but exposes only the first 50 matching personas.
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/PersonaResourceIT.java Covers matching, ordering, case handling, offset 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, server search, local filtering, and preserving selections across queries.

Sequence Diagram

sequenceDiagram
  participant User
  participant Picker as Persona picker
  participant Client as PersonaAPI
  participant Service as PersonaResource
  User->>Picker: Enter search query
  Picker->>Client: searchPersonas(query, 50)
  Client->>Service: "GET /personas/search?q=...&limit=50&offset=0"
  Service-->>Client: data + paging
  Client-->>Picker: first-page data only
  Picker-->>User: Render matching options
Loading

Reviews (8): Last reviewed commit: "Merge branch 'main' into add-persona-sea..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

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%
66.03% (77663/117606) 49.98% (46832/93701) 51.19% (14095/27532)

@github-actions

github-actions Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit d78fa8cf71458d6047c924a22fde232e8fdbe5e7 in Playwright run 30691246472, attempt 1.

✅ 770 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 3 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 11s

⏱️ Max setup 2m 56s · max shard execution 18m 27s · max shard-job elapsed before upload 21m 34s · reporting 5s

🌐 195.13 requests/attempt · 2.51 app boots/UI scenario · 19.42% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 19.42% (convergence target: at most 15%).
  • Application boot ratio was 2.51 per UI scenario (1988 boots / 793 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 147 0 0 3 0 0
✅ Shard chromium-02 148 0 0 0 0 0
✅ Shard chromium-03 182 0 0 0 0 0
✅ Shard chromium-04 142 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 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

📦 Download artifacts

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

@harsh-vador harsh-vador added UI UI specific issues backend labels Jul 30, 2026
…esource

persona_entity has no `deleted` column, so `/personas/search` cannot honour
an `include` param. Declaring it meant searchInternal had to overwrite it to
Include.ALL, which made `?include=deleted` silently return every persona and
put a Persona-specific branch in the base class every entity resource
inherits.

Drop the param and pass `new ListFilter(null)` instead, which is what
PersonaResource.list already does and which emits identical SQL: a null
include falls through getIncludeCondition to an empty predicate.

Reverts the shared EntityResource branch and the ListFilter.setInclude
mutator, restoring include to constructor-only.
@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — ESLint report could not be read — see the job log.

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.

No machine-readable report was produced.


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

make ui-checkstyle-changed

)
: personaList;
} else if (searchText) {
const results = await searchPersonas(searchText, PAGE_SIZE_LARGE);

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 Search truncates matching personas

When a query matches more than 50 personas, this call retrieves only the first page while searchPersonas fixes the offset at zero and discards the response's paging metadata, causing later matching personas to remain impossible to select.

Knowledge Base Used: OpenMetadata React UI

@sonarqubecloud

sonarqubecloud Bot commented Aug 1, 2026

Copy link
Copy Markdown

@sonarqubecloud

sonarqubecloud Bot commented Aug 1, 2026

Copy link
Copy Markdown

@gitar-bot

gitar-bot Bot commented Aug 5, 2026

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

Adds a server-side persona search endpoint along with UI client integration and tests, addressing the multi-select selection loss, out-of-order response handling, and case-sensitive filtering findings.

✅ 4 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.

✅ Quality: Undocumented new ListFilter(null) obscures no-soft-delete intent

📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/PersonaResource.java:139-146
Passing new ListFilter(null) sets include = null, which makes getIncludeCondition return an empty string so no deleted = FALSE predicate is emitted — the intentional handling for personas, which don't support soft delete (supportsSoftDelete is false when the entity has no deleted field). This intent is not obvious at the call site and a future reader may 'fix' it back to new ListFilter(Include.NON_DELETED), which would emit a filter on a non-existent column. Add a brief comment explaining why null is passed (persona repo has no soft-delete/deleted column).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants