Skip to content

Revamp configurable persona AI context - #29973

Merged
anuj-kumary merged 13 commits into
mainfrom
persona-ai-context
Jul 13, 2026
Merged

anuj-kumary merged 13 commits into
mainfrom
persona-ai-context

Conversation

@anuj-kumary

@anuj-kumary anuj-kumary commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #29826

Screen.Recording.2026-07-13.at.5.15.35.PM.mov
Screen.Recording.2026-07-13.at.1.51.07.PM.mov
Screenshot 2026-07-13 at 10 25 00 AM

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.

Summary by Gitar

  • Persona AI Context UI overhaul:
    • Replaced legacy Ant Design components with ui-core-components and Untitledui icons across PersonaAIContext and ContextRuleEditor.
    • Modernized ContextRuleCard and ContextPreviewModal with updated layouts, badges, and status indicators.
  • Version history & restoration:
    • Added VersionHistoryDrawer to track and visualize changes to the Persona AI context definition.
    • Implemented version restoration capability, allowing users to revert to historical definitions via JSON-patch operations.
  • UX & Stability improvements:
    • Added optimistic UI updates for rule creation, editing, and deletion with mutation ID guards to prevent race conditions.
    • Updated PersonaDetailsPage to improve tab content management and performance.
  • Localization:
    • Added new keys to multiple language bundles to support version history, restore labels, and entity matching descriptions.

This will update automatically on new commits.

Greptile Summary

This PR revamps the Persona AI Context experience. The main changes are:

  • Rebuilt the rule editor, rule cards, preview modal, and settings panel with ui-core components.
  • Added persona AI context version history and restore support.
  • Added optimistic updates and rollback handling for rule and settings changes.
  • Expanded Playwright and unit coverage for the updated flows.
  • Added locale strings for the new labels and messages.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/src/components/Settings/Persona/PersonaAIContext/ContextRuleEditor/ContextRuleEditor.component.tsx Migrates the rule editor to ui-core components and updates knowledge-rule rendering controls.
openmetadata-ui/src/main/resources/ui/src/components/Settings/Persona/PersonaAIContext/PersonaAIContext.component.tsx Redesigns the AI context settings view and adds guarded optimistic updates for settings and rules.
openmetadata-ui/src/main/resources/ui/src/components/Settings/Persona/PersonaAIContext/VersionHistoryDrawer/VersionHistoryDrawer.component.tsx Adds the version history drawer and restore confirmation flow.
openmetadata-ui/src/main/resources/ui/src/utils/PersonaAIContextUtils.ts Adds helpers for explore links, version formatting, version history summaries, and context restore cleanup.
openmetadata-ui/src/main/resources/ui/src/rest/PersonaAPI.ts Adds the persona versions API helper used by the history drawer.

Comments Outside Diff (1)

  1. openmetadata-ui/src/main/resources/ui/src/components/Settings/Persona/PersonaAIContext/ContextRuleEditor/RuleQueryBuilderField.component.tsx, line 45-52 (link)

    P1 Cleared Filter Keeps Old Tree

    When the query builder clears the visible query, updatedTree can be empty and this fallback keeps the previous filterJsonTree. The rule can then save queryFilter: '' with a stale tree, so reopening the editor or rendering the card can show the old condition even though the actual filter was cleared.

Reviews (9): Last reviewed commit: "fix unti test" | Re-trigger Greptile

Context used (3)

  • Context used - CLAUDE.md (source)
  • Context used - openmetadata-ui-core-components/CLAUDE.md (source)
  • Context used - AGENTS.md (source)

@anuj-kumary anuj-kumary self-assigned this Jul 13, 2026
@anuj-kumary
anuj-kumary requested a review from a team as a code owner July 13, 2026 08:44
@anuj-kumary anuj-kumary added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs labels Jul 13, 2026
@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 64%
64.37% (75296/116965) 48.22% (44807/92922) 48.97% (13553/27673)

@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (29 flaky)

✅ 4524 passed · ❌ 0 failed · 🟡 29 flaky · ⏭️ 96 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 423 0 4 16
✅ Shard 2 11 0 0 0
🟡 Shard 3 820 0 10 9
🟡 Shard 4 820 0 1 18
🟡 Shard 5 835 0 5 5
🟡 Shard 6 787 0 1 46
🟡 Shard 7 828 0 8 2
🟡 29 flaky test(s) (passed on retry)
  • Features/CustomizeDetailPage.spec.ts › Domain - customization should work (shard 1, 1 retry)
  • Flow/TestConnectionModal.spec.ts › modal opens with gate card and capability checks sections (shard 1, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: metric (shard 1, 1 retry)
  • Flow/SearchRBAC.spec.ts › a dashboard-scoped user sees dashboards but never tables (shard 1, 1 retry)
  • Features/BulkImportWithDotInName.spec.ts › Full import cycle with dot in service name (shard 3, 1 retry)
  • Features/ContextCenterArchivePage.spec.ts › archive page lazy-loads more rows on scroll within its own scroll container (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article listing search filters, clears, and shows empty state (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article list cards, recently viewed widget, and pagination work (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › clicking a memory row adds ?memory= param to the URL (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › adding a linked asset in edit mode shows entity badge on the row (shard 3, 1 retry)
  • Features/ContextCenterPermission.spec.ts › user with editAll permission can see restore action but not delete action on an archived document, and can restore it (shard 3, 1 retry)
  • Features/ContextCenterPermission.spec.ts › a document archived by a different user can be permanently deleted, via the UI, by a user with Delete permission (shard 3, 1 retry)
  • Features/Glossary/GlossaryCRUDOperations.spec.ts › should create glossary with mutually exclusive enabled (shard 3, 1 retry)
  • Features/Glossary/GlossaryHierarchy.spec.ts › should move term with children to different glossary (shard 3, 1 retry)
  • Features/SearchExport.spec.ts › Export queues a background job and downloads from the jobs tray (shard 4, 1 retry)
  • Flow/AddRoleAndAssignToUser.spec.ts › Verify assigned role to new user (shard 5, 1 retry)
  • Flow/ExploreDiscovery.spec.ts › Should not display soft deleted assets in search suggestions (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Integer (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Should display custom properties for glossaryTerm in right panel (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Time (shard 5, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 6, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should follow Data Consumer role policies for ownerless searchIndex (shard 7, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Glossary Bulk Import Export (shard 7, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Import partial success - some terms pass, some fail (shard 7, 1 retry)
  • Pages/InputOutputPorts.spec.ts › Output ports section collapse/expand (shard 7, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify Impact Analysis service filter selection (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for pipelineService in platform lineage (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for apiService in platform lineage (shard 7, 1 retry)
  • Pages/TestSuite.spec.ts › Logical TestSuite (shard 7, 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

Rohit0301
Rohit0301 previously approved these changes Jul 13, 2026
@sonarqubecloud

Copy link
Copy Markdown

@anuj-kumary
anuj-kumary enabled auto-merge (squash) July 13, 2026 18:15
@anuj-kumary
anuj-kumary merged commit 4070892 into main Jul 13, 2026
64 of 67 checks passed
@anuj-kumary
anuj-kumary deleted the persona-ai-context branch July 13, 2026 19:56
@gitar-bot

gitar-bot Bot commented Jul 13, 2026

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

Revamps the Persona AI Context UI with modern components, version history support, and optimistic state management. All previously identified issues with localization, validation, and data formatting have been addressed.

✅ 6 resolved
✅ Quality: Naive English pluralization of localized entity labels

📄 openmetadata-ui/src/main/resources/ui/src/components/Settings/Persona/PersonaAIContext/ContextRuleCard/ContextRuleCard.component.tsx:154-156 📄 openmetadata-ui/src/main/resources/ui/src/components/Settings/Persona/PersonaAIContext/ContextRuleCard/ContextRuleCard.component.tsx:214-217
In ContextRuleCard.component.tsx the entity label is pluralized by lowercasing and appending a hardcoded s: entity: ${entityLabel.toLowerCase()}s (used for message.persona-context-entity-matched and label.all-entity). entityLabel is a translated string coming from t(PERSONA_CONTEXT_ENTITY_LABEL_KEYS[...]), so this concatenation is applied on top of every one of the 20+ locales, producing grammatically wrong output (e.g. German/French/Arabic labels get an English s suffix, and even English irregulars like 'Glossary' become 'glossarys'). The interpolated translation keys already accept an entity placeholder, so the pluralization should come from a proper plural translation key (i18next _plural / count) rather than string surgery. This conflicts with the repo's 'no string literals, use useTranslation' guidance.

✅ Quality: Version badge shows raw float instead of formatted version

📄 openmetadata-ui/src/main/resources/ui/src/components/Settings/Persona/PersonaAIContext/PersonaAIContext.component.tsx:292-303
The AI-context header badge renders the persona version with the raw number: t('label.version-short', { version: persona.version }) in PersonaAIContext.component.tsx. Everywhere else (VersionHistoryDrawer, buildPersonaContextVersionHistory) the code passes versions through formatPersonaVersion() which does .toFixed(1). Because entity versions are stored as floats incremented by 0.1, the unformatted value can display with floating-point noise (e.g. v1.3000000000000003) and is inconsistent with the drawer's v1.3 labels. Format it with formatPersonaVersion(persona.version) for consistency.

✅ Edge Case: maxAssets can be submitted empty despite being required

📄 openmetadata-ui/src/main/resources/ui/src/components/Settings/Persona/PersonaAIContext/ContextRuleEditor/ContextRuleEditor.component.tsx:572-586 📄 openmetadata-ui/src/main/resources/ui/src/components/Settings/Persona/PersonaAIContext/ContextRuleEditor/ContextRuleEditor.component.tsx:239-252
The maxAssets input was changed to display an empty string when field.value == null (previously it fell back to DEFAULT_PERSONA_CONTEXT_MAX_ASSETS), and the validation rules were reduced to { min: 1 } with no required. The onChange sets the field to undefined when the input is cleared. Because the Field is only visually isRequired (there is no required validation rule) and handleSubmit does not backfill a default, a user can now clear the box and press 'Save Rule', submitting a rule with maxAssets: undefined. This is more likely now that the field renders empty instead of a default. Depending on backend handling this could mean an unbounded/undefined asset cap. Consider adding a required rule or defaulting maxAssets in handleSubmit (e.g. maxAssets: data.maxAssets ?? DEFAULT_PERSONA_CONTEXT_MAX_ASSETS).

✅ Quality: Token estimate loses thousands separators in preview stats

📄 openmetadata-ui/src/main/resources/ui/src/components/Settings/Persona/PersonaAIContext/ContextPreviewModal/ContextPreviewModal.component.tsx:212-214
count: (contextDocument?.tokensEst ?? 0).toLocaleString() was replaced with count: contextDocument?.tokensEst ?? 0. Passing the raw number is correct for i18next pluralization, but the displayed token estimate now loses its thousands separators (e.g. 120000 instead of 120,000), which is inconsistent with how large numbers are formatted elsewhere. If the label displays the value, consider keeping a formatted variant available to the translation string (e.g. pass a separate formatted interpolation value) while still passing the numeric count for pluralization.

✅ Edge Case: Generic-content bold label relies on '. ' split, fragile for i18n

📄 openmetadata-ui/src/main/resources/ui/src/components/Settings/Persona/PersonaAIContext/ContextRuleEditor/ContextRuleEditor.component.tsx:188-197
The new code derives the bold lead-in (genericContentLabel) and body (genericContentBody) by locating the first '. ' (period + space) in the translated message.persona-context-generic-content string. This couples presentation logic to sentence punctuation of the English source string ("Generic content. Added to this persona's context..."). In locales that do not use a period+space to end the first sentence (e.g. CJK languages using '。', or translations that phrase the lead-in differently), indexOf('. ') returns -1, so the entire paragraph is rendered bold as the label and the body is empty — losing the intended visual hierarchy. It can also bold the wrong span if the first '. ' falls at an abbreviation. Consider splitting the label and body into two separate translation keys (e.g. persona-context-generic-content-label and ...-body) so each locale controls the emphasis boundary explicitly, rather than parsing punctuation at runtime.

...and 1 more resolved from earlier reviews

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

This branch was previously deployed

1 inactive deployment
test — fcc088e2 Deployed Jul 13, 2026 by anuj-kumary via playwright-ci-postgresql (3, 7) #56191
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: AI Context Platform for agent-ready asset retrieval

2 participants