Repository navigation
Fixes #34394: Isolate context memory lifecycle statuses - #34785
Conversation
New memories must await processing before they ground agent responses. Keep approved edits trusted until explicitly requeued. BREAKING CHANGE: memory creation without entityStatus starts Unprocessed instead of Approved. Trusted producers can still set Approved explicitly. Existing statuses and PUT requests that omit the stage are preserved. Fixes #34710
Match the overview to the Memories page default status filter. Approve cited fixtures and keep higher-use pending memories excluded. Seed and clean dashboard fixtures so navigation works independently.
Give memories their own generated enum and validate lifecycle policies against their schemas. Resolve discovery, filters and workflow writes using the target entity vocabulary. BREAKING CHANGE: EntityInterface requires a status enum type parameter. Regenerate Java clients and parameterize custom implementations.
Code Review 👍 Approved with suggestions 0 closed / 1 findings🔴 High risk · The generic status contract breaks Java clients while changing memory lifecycle behavior. Isolates context memory lifecycle to a separate 💡 Performance: Status autocomplete re-fetches lifecycle discovery on every keystroke📄 openmetadata-ui/src/main/resources/ui/src/utils/governance/lifecycle/LifecycleStatus.utils.ts:58-72 📄 openmetadata-ui/src/main/resources/ui/src/utils/AdvancedSearchClassBase.ts:1079-1081 📄 openmetadata-ui/src/main/resources/ui/src/utils/JSONLogicSearchClassBase.ts:705-711
Memoise the discovery promise per autocomplete instance and drop it if it fails🤖 Prompt for agentsOptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
✅ Generated Sources Auto-UpdatedThe generated TypeScript types ( |
|
Main moved ContextMemory.entityStatus to ContextMemoryStatus (#34785), so the approved-memory check in ConceptContextBuilder no longer compiled after merging main.
…ta#34863) * feat(ai): resolve concept context bindings Keep glossary definitions on their columns and resolve bounded concept context through REST and MCP. Refs open-metadata#34861 Refs open-metadata/ai-platform#1586 * feat(ai): bind concepts to every data asset and report table row counts - Glossary bindings now search the data-asset alias instead of the table index, excluding column, glossary term, tag and article documents, and resolve field-level bindings through ChildFieldResolver (data model and container columns, topic/API schema fields, search index fields, ML features, pipeline tasks). - Metric expressions resolve SQL identifiers against any column-bearing asset (table, dashboard data model, container, worksheet). - Context memories attached to a metric share its APPLIED_TO edge; they are no longer reported as bindings or counted in totals. - ConceptBinding.rowCount carries the bound table's latest profiled row count, gated by VIEW_DATA_PROFILE like the column profile. Markdown renders it in a "Bound Profiles" table; counts print as integers. - Bindings without stored samples omit sampleValues instead of returning []. - ConceptContextIT covers non-table bindings, memory evidence vs bindings, nested and asset-level bindings, per-asset caps, alias/ambiguity resolution, related metrics, draft evidence and long-query excerpts, Markdown sections, MCP errors and row counts. * fix(ai): bound concept candidate scan, match structured column paths, scope alias handling to ORDER BY - Stop scanning concept candidates after 500 assets; mark the context truncated and treat totals as lower bounds. A capped metric scan resolves no columns, since unscanned assets could make them ambiguous. - Compare SQL identifier components against structured field paths so a quoted "amount.cents" column and a nested amount.cents field stay distinct. - Only ORDER BY resolves bare names to projection aliases; WHERE, GROUP BY and HAVING keep the input column binding. * chore(playwright): auto-refresh impact-map.generated.json * Update generated TypeScript types and dereferenced schemas * fix(ai): use ContextMemoryStatus for concept evidence memories Main moved ContextMemory.entityStatus to ContextMemoryStatus (open-metadata#34785), so the approved-memory check in ConceptContextBuilder no longer compiled after merging main. * perf(ai): resolve each column glossary term once per table context Load and authorize each distinct column glossary term once instead of once per column. Each column still gets its own KnowledgeItem, because the knowledge budget trims items in place. * fix(ai): address concept context review findings - Mask PII.Sensitive saved-query SQL in concept evidence the same way the query listing does (owners and tags are now loaded for the decision). - Keep column and nested-column glossary terms in the attached-knowledge batch; only the single-asset envelope is limited to asset-level terms. - Attach stored profiles and samples to top-level columns only, so a nested amount.cents field no longer borrows a top-level "amount.cents" column's values. - Bind columns named in JOIN ... ON predicates. * fix(ai): match concept tags by filter, not query text A glossary term's context found its tagged assets with the query `** AND (tags.tagFQN:"<fqn>")` on the data-asset alias. The data-asset query builder also runs that text through a multi_match over every search field, so a long FQN overflowed OpenSearch's 1024-clause limit: 20 of 24 shards failed and the context returned 500 (GlossaryTermResourceIT.get_entityAiContext_200_OK in the postgres-opensearch merge-queue lane; Elasticsearch allows more clauses). Match the tag with a term filter under a match-all query, so the clause count no longer depends on the FQN. tagSearchRequest now takes the entity types to exclude, so Mode B's glossary routing gets the same fix. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Main now builds the generic list and count conditions through ListFilter.getConditionForEntity(table) (#34785). Use the same entry point in the task search overrides so their page and the count can't drift apart.
…ty (open-metadata#34819) * feat(api): search tasks about an entity and filter mentions by entity The entity Activity feed lists the tasks about one entity through GET /v1/tasks?aboutEntity=…, which had no search, and its Mentions view needs the mentions about that entity only. - GET /v1/tasks takes `q`, the same task search the scoped task lists use (name, displayName, payload reason, about displayName / FQN). The five `q` parameters share one description constant. - GET /v1/activity/mentions takes an optional `entityLink`; it matches the entity the way /v1/activity/about does (aboutFqnHash of the link's entity) and is authorized like /about. The mention subquery, domain filter and ordering are shared constants across the four MySQL/Postgres variants. * feat(api): list an entity's field conversations with includeFields * fix(api): an empty mentions entityLink means none; cover its authorization * perf(tasks): filter before sorting when a task list has a free-text search A free-text `q` can't narrow rows through an index, so the name-ordered page walked task_entity_name_index and checked every task until it filled a page. With `q`, the task list now selects rows through the other filters (e.g. aboutEntity) and sorts only those: MySQL ignores the name index, Postgres materializes the matches first. Postgres also gets a text_pattern_ops index on task_entity.aboutfqnhash: the plain btree can't serve the aboutEntity `LIKE 'hash.%'` prefix under a non-C collation, so every aboutEntity list and count seq-scanned the table. EXPLAIN ANALYZE on 1M tasks (page query, old -> new): - MySQL, service-level aboutEntity + q: ~27s -> ~0.3s; one table + q: ~1ms -> <0.1ms - Postgres, one table + q: ~900ms -> 0.2ms; service + q: ~380ms -> ~110ms - q with no other filter: ~25s/12s -> one full pass (~7s/2s); no index can serve it * fix(tasks): build the search page's condition with getConditionForEntity Main now builds the generic list and count conditions through ListFilter.getConditionForEntity(table) (open-metadata#34785). Use the same entry point in the task search overrides so their page and the count can't drift apart. * style: spotless --------- Co-authored-by: sonika-shah <58761340+sonika-shah@users.noreply.github.com>



Describe your changes:
Fixes #34394
Give context memories their own generated
ContextMemoryStatusenum, includingSupersededandInvalidated, following the revised lifecycle design. Other entities retain the sharedEntityStatusvocabulary. The initial memory lifecycle PR, #34717, has merged; this follow-up is based on currentmain.Type of change:
High-level design:
entity/context/contextMemoryStatus.jsonand reference it from both the memory and create-memory schemas. RetainUnprocessedand legacyDeprecated/Rejectedvalues for stored memories and version history.SupersededandInvalidatedare absent fromtype/status.json.EntityInterface<S extends Enum<S>>generic. Generated memories implementEntityInterface<ContextMemoryStatus>; existing entities keepEntityInterface<EntityStatus>. Most of the 619 changed files are the one-time generic migration and generated models, including shared status-description regeneration.EntityLifecycle<S>and a policy-providedEntityStatusAdapter<S>at common repository boundaries. Validate that each graph covers exactly its generated schema vocabulary and that its adapter matches the entity's declared enum.ContextMemoryStatus. Retirement requires a reason; supersession additionally requires a live, readable successor and rejects self-references and cycles. Restoration clears stale successor/reason metadata. Ordinary search, grounding, and ontology proposals continue to requireApprovedmemories.Compatibility and migration: Java clients/plugins implementing or consuming
EntityInterfacemust rebuild with the generic contract; memory callers must useContextMemoryStatus. Regenerate Java, Python, and TypeScript models together. Existing supported memory wire values and stored JSON remain readable, so no database migration is required.In Reviewremains a general-entity status and is not a memory lifecycle stage.Tests:
Use cases covered
Unit tests
mvn -B -pl openmetadata-service install -Dtest='ContextMemory*Test,EntityLifecycleTest,EntityStatusAdapterTest,EntityFieldUtilsTest,ListFilterTest,Recipient*Test,*MessageDecoratorTest,SubscriptionUtilTest,SearchDocFieldValidationTest,SearchIndexTest,SearchIndexPrefetchTest'.mvn -B -pl openmetadata-service jacoco:prepare-agent test jacoco:report -Dtest='ContextMemoryLifecycleTest,ContextMemoryRepositoryTest,EntityLifecycleTest,EntityStatusAdapterTest,EntityFieldUtilsTest,ListFilterTest' -Djacoco.append=false.openmetadata-service/src/test/java/org/openmetadata/service/:governance/EntityStatusAdapterTest.java,governance/EntityLifecycleTest.java,jdbi3/ContextMemoryLifecycleTest.java,jdbi3/ContextMemoryRepositoryTest.java,jdbi3/ListFilterTest.java,util/EntityFieldUtilsTest.java, and the memory schema/transition/visibility regressions underresources/context/andsearch/.EntityStatusAdapter97.3%,EntityLifecycle90.2%,ContextMemoryLifecycle94.5%,EntityFieldUtils91.5%. The 90% whole-class target is not met by large existing classes:ContextMemoryRepository13.2% andListFilter51.8% in this focused unit run; real REST tests cover their lifecycle/filter behavior.25832d9ec89. After the autocomplete fix, 108 passed in 3 status/search suites, plus 4 workflow-form tests passed. Commands from the UI root:yarn test src/utils/governance/lifecycle/LifecycleStatus.utils.test.ts src/utils/AdvancedSearchClassBase.test.ts src/utils/JSONLogicSearchClassBase.test.ts --watchAll=false --runInBand --coverage --collectCoverageFrom=src/utils/governance/lifecycle/LifecycleStatus.utils.ts, andyarn test src/components/WorkflowDefinitions/WorkflowBuilder/forms/SetActionForm.test.tsx --watchAll=false --runInBand.LifecycleStatus.utils.tshas 100% line coverage. Previously measured whole-component coverage for the existingSetActionFormis 62.2%; its new status loading, failure, race, and invalid-save behavior is exercised through real UI components.-Djunit.version=5.11.4for an existing SDK JUnit/Platform mismatch; no dependency files were changed for that workaround.Backend integration tests
mvn -B -pl openmetadata-integration-tests test -Dtest='ContextMemoryIT,ContextMemoryAnchorIT,ContextMemoryLifecycleIT,OntologyChangeSetIT,McpContextMemoryVisibilityIT,EntityLifecycleStagesIT' -DdatabaseType=postgres -DdatabaseImage=postgres:15 -DsearchType=elasticsearch -DsearchImage=docker.elastic.co/elasticsearch/elasticsearch:9.3.0(fixed JUnit parallelism of 4, maximum pool size 8).openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/{ContextMemoryIT,ContextMemoryAnchorIT,ContextMemoryLifecycleIT,EntityLifecycleStagesIT}.java, plusOntologyChangeSetIT.javaandmcp/McpContextMemoryVisibilityIT.java.Ingestion integration tests
In Review, and exclusion of memory-only retirement values from the shared enum.Playwright (UI) tests
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ContextCenterMemoryLifecycle.spec.ts.Focused lifecycle run: 4 passed, 0 failed, 0 skipped, 0 retries on
8fe51588022, using Chromium, the current Vite UI, and an isolated PostgreSQL/Elasticsearch-backed server. A separate browser capture scenario also passed and produced the recording below.The branch-wide
make playwright_affectedplan selects 414 specs, including broad shared infrastructure and generated-model impacts. That full selection was not run locally. The focused memory spec was run throughmake playwright_affected_runwith a local config; the wrapper could not write its results block because the overridden JSON reporter emitted to stdout. The actual browser result is four passes. Full mapped-suite verification remains outstanding for the merge queue.Manual testing performed
Inspected the browser captures after the automated flows. Reproduction steps:
SupersededwithsupersededByand a reason, and the invalidated guidance toInvalidatedwith a reason.Static checks and known limitations
UI screen recording / screenshots:
The recording is stored on a separate branch for review artifacts and embedded below; it adds no binary file to this PR's code diff.
Checklist:
Fixes <issue-number>: <short explanation>.Fixes #34394above.Backward-Incompatible-Changelabel.