Repository navigation
Show Context Center AI Context personas as a paginated table with users, entities, token budget and freshness - #35432
Conversation
Replace the persona cards with a table of users, rules, entities, context budget used (estimated tokens), freshness and an Enabled toggle. Add GET /v1/personas/aiContext/status, an admin-only endpoint that pages like GET /v1/personas and reads each persona's cached context without compiling it, so the table never triggers document generation. Fix GET /v1/personas?fields=users returning no users: list endpoints fill fields through bulk fetchers and PersonaRepository had none for users. Let the Playwright persona helper page through the table to find a persona, and add a spec for the table flows.
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
❌ PR checklist incompleteThis 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 |
🔄 Playwright impact map auto-refreshedThis PR touched specs or UI source that changed the source→spec routing map. I regenerated 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 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 |
|
| Count | Rule |
|---|---|
| 1 | openmetadata-imports/no-lower-layer-page-imports |
All findings
| Location | Rule | Message | |
|---|---|---|---|
| 🟡 | src/utils/PersonaAIContextUtils.ts:36: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-changedPage clicks wrote only the page number to the URL, so a reload or browser Back restored page N while fetching page 1. The cursor is now saved with the page and the table fetches whatever cursor the URL holds. Move PersonaContextStatus from a Java record and a hand-written TS interface to type/personaContextStatus.json, so both are generated, and record the endpoint contract in a decision record.
#35348 resized Button and ButtonUtility to the Figma icon spec without updating the visual-regression baselines, so every PR fails the same seven snapshots (header buttons, the domain picker and page actions shrink, shifting the content around them). Replace them with the screenshots CI captured in the pinned Playwright container.
…ui-convert # Conflicts: # openmetadata-ui/src/main/resources/ui/playwright/e2e/VisualRegression/__snapshots__/aiModePages.spec.ts-snapshots/ai-explore.png # openmetadata-ui/src/main/resources/ui/playwright/e2e/VisualRegression/__snapshots__/metricList.spec.ts-snapshots/metric-list-narrow.png # openmetadata-ui/src/main/resources/ui/playwright/e2e/VisualRegression/__snapshots__/staticPages.spec.ts-snapshots/glossary.png # openmetadata-ui/src/main/resources/ui/playwright/e2e/VisualRegression/__snapshots__/staticPages.spec.ts-snapshots/landing-page-sidebar-collapsed.png # openmetadata-ui/src/main/resources/ui/playwright/e2e/VisualRegression/__snapshots__/staticPages.spec.ts-snapshots/landing-page.png # openmetadata-ui/src/main/resources/ui/playwright/e2e/VisualRegression/__snapshots__/staticPages.spec.ts-snapshots/settings.png # openmetadata-ui/src/main/resources/ui/playwright/e2e/VisualRegression/__snapshots__/staticPages.spec.ts-snapshots/users.png
🚦 Removed from the merge queue —
|
…ui-convert # Conflicts: # .github/playwright/impact-map.generated.json
🚦 Removed from the merge queue —
|
…s API The status endpoint rebuilt its paging with ResultList(data, before, after, total), which Base64-encodes the cursors it is given. The cursors from listInternal are already encoded, so every before/after it returned was double-encoded and paged to an empty result. Reuse the persona page's Paging as is, and assert in the IT that both APIs return the same cursor and that the next page is not empty.
Code Review ✅ Approved 2 closed / 2 findings🟡 Medium risk · The new admin toggle persists persona AI-context enablement, so an unintended change could alter context available in persona-driven responses. Turns the Context Center AI Context persona list into a paginated table showing users, entities, token budget and freshness per persona, backed by a new admin-only ✅ 2 closed✅ Bug: Page number survives in URL but cursor doesn't, so Back shows page 1
✅ Quality: New aiContext/status REST contract has no decision record
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
|



Describe your changes:
Fixes 7469
The Context Center › AI Context page listed personas as cards showing only name, description and rule count. It is now a paginated table showing, for each persona: users, rules, entities included, context budget used, freshness, and an Enabled toggle. Admins can see at a glance which personas have context and how much of the budget it uses.
Most of these columns are not in the persona list response. Fetching the compiled document per row would compile every persona on page load, so this adds one paginated, read-only status endpoint that reads the context cache.
It also fixes a bug:
GET /v1/personas?fields=usersalways returned no users, because list endpoints fill fields through bulk fetchers andPersonaRepositoryhad none forusers.Type of change:
High-level design:
Backend
GET /v1/personas/aiContext/status?limit=&before=&after=(admin-only) returnsResultList<PersonaContextStatus>:personaId,cacheState,lastGeneratedAt,entitiesIncluded,tokensEst,lastError.GET /v1/personas(samelistInternal, same filter), so one cursor returns the status of the same personas as the list page.PersonaContextCache.snapshot()(local cache, then Redis) and never compiles. A persona with nothing cached reportsSTALEwith zero counts.tokensEstuses the same chars ÷ 4 estimate as the document endpoint (sharedtokensEstimatehelper);entitiesIncludedis shared with the document response too.PersonaRepository: registers a bulkusersfield fetcher (same pattern asTeamRepository.fetchAndSetUsers).Frontend (
ContextCenterAIContextPage.tsx)Tablereplaces the cards. Each page fetches personas (fields=users,contextDefinition) and status in parallel with the same cursor, viausePaging+PaginationCardWithControls. Non-admins skip the status call (0 entities,—budget/freshness, disabled toggle).FeaturedIconwith the user icon, display name, name.characterBudget ÷ 4; the bar keeps a minimum visible sliver so a small document doesn't look like an empty loading bar.getPersonaContextFreshnessinPersonaAIContextUtils.ts: Not configured (no rules), Fresh · time, Stale · time, Not generated, Generating, Failed.updatePersonaAIContext(same payload as the persona detail page), updates immediately, reverts with a toast on failure.Alternatives rejected:
/aiContext/documentper row (compiles on a cache miss);/aiContextper row (one request per persona).Notes
openPersonaAIContext(shared by the AI Context specs) now pages through the table to find a persona, since a test persona can land past page one.Tests:
Use cases covered
GET /v1/personas?fields=usersreturns assigned users.Unit tests
ContextCenterAIContextPage.test.tsx: column rendering, non-admin, toggle save and revert, row navigation, empty state, paginationPersonaAIContextUtils.test.ts: every branch ofgetPersonaContextFreshnessBackend integration tests
PersonaAIContextIT: status is admin-only; reports FRESH with tokens and generation time after the document is built; pages with the same cursor and total asGET /personasPersonaResourceIT.post_personaWithUsers_200_OK: the list endpoint returns persona usersPlaywright (UI) tests
PersonaAIContextList.spec.ts: row opens the persona, toggle persists to the backend, non-admin is read-only, pagination uses the same cursor for both requests.github/playwright/impact-map.jsonPersonaAIContext*.spec.tssuites (45/45 passed)Local Playwright run: 5 specs × 3 repeats,
chromium. Only the authsetupproject ran first;entity-data-setupwas skipped with--no-deps.No failures, flakes or retries.
New spec, 4 repeats per test:
Manual testing performed
/aiContext/status, and paged through the table.UI screen recording:
Screenshots
Admin — page 1: users, rules, entities, token budget, freshness and Enabled toggle per persona
Admin — page 2: cursor pagination (Page 2 of 3, 15 records per page)
Non-admin (Data Consumer): read-only; cache status isn't requested, so entities show 0, budget and freshness show —, and toggles are disabled
Checklist:
Fixes <issue-number>: <short explanation>