Repository navigation
Fixes 34861: Resolve glossary and metric concept context - #34863
Conversation
Keep glossary definitions on their columns and resolve bounded concept context through REST and MCP. Refs #34861 Refs open-metadata/ai-platform#1586
- 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.
… 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.
🔄 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 |
✅ Generated Sources Auto-UpdatedThe generated TypeScript types ( |
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
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.
Code Review ✅ Approved 2 closed / 2 findings🔴 High risk · The new concept-context APIs expose profiles, samples, and saved-query SQL under permission checks, so authorization mistakes could leak sensitive catalog data. Adds glossary and metric concept context to entity responses and the new ✅ 2 closed✅ Performance: Concept resolution loads every candidate table, with no upper bound
✅ Performance: Column glossary terms are fetched separately for every column
OptionsDisplay: 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 |
❌ UI Checkstyle Failed❌ Bundle Runtime CheckA route chunk loads but one of its chunks still exports Fix locally (fast - only checks files changed in this branch): make ui-checkstyle-changed |
|
|
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|



Describe your changes:
Fixes #34861
Agents can now resolve glossary terms and metrics to definitions, exact asset/column bindings, profiles, samples, related metrics, and saved-query evidence through entity context and the new
get_concept_contextMCP tool.OpenMetadata portion of open-metadata/ai-platform#1586; ai-platform clients, SQL prompt integration, and benchmarks remain in that repository.
Example response
Glossary term
Finance.Revenue(synonyms, one ontology attribute) tagged on columnamount_centsof tablewarehouse.analytics.sales.orders, which has a table profile (1,200 rows), a column profile and five stored sample rows. Captured from a local server built from this branch:GET /api/v1/glossaryTerms/name/Finance.Revenue/context?format=json(the MCPget_concept_contextJSON output is identical)Same request without
format=json(Markdown, the MCP default)Bindings on non-table assets carry the asset (and field) only; from the same live run, with service names shortened:
Type of change:
High-level design:
AIContextBuildercomposes a catalog boundary, a conservative Calcite identifier resolver, and a concept Markdown renderer, sharing the REST/MCP authorization and existing profile/sample masking paths.ConceptContext,ConceptBinding, andConceptEvidence; regenerated Java/Python models and checked-in TypeScript typesChildFieldResolverAPPLIED_TOassets of any type, with unambiguous expression columns resolved on tabular assets (table, dashboard data model, container, worksheet); context memories that share the metric'sAPPLIED_TOedge are evidence, not bindingsrowCountand the bound column's profile (both gated byVIEW_DATA_PROFILE) plus stored samples (VIEW_SAMPLE_DATA+ PII masking); bindings without samples omitsampleValuestruncatedColumn glossary definitions now live at
assetContext.table.columns[].glossaryTermsinstead of the flattened envelope list, so consumers must read that field; metricgeneric.definitionandsourceAssetsremain available, and no database migration is needed because these schemas describe responses only.Tests:
Use cases covered
rowCounton asset- and column-level bindings, absent withoutVIEW_DATA_PROFILEUnit tests
openmetadata-service/src/test/java/org/openmetadata/service/aicontext/AIContextBuilderTest.java,AIContextMarkdownTest.java,AIContextFinderTest.javaConceptContextBuilderTest.java,ConceptContextCatalogTest.java,ConceptContextMarkdownTest.javaopenmetadata-mcp/src/test/java/org/openmetadata/mcp/tools/GetConceptContextToolTest.javaConceptContextITcombined):AIContextBuilder,AIContextFinder,AIContextMarkdown, andDefaultToolContext: 100% (coverage scope is the changed lines, not their entire existing classes)Backend integration tests
ConceptContextIT18,AIContextRestIT9,AIContextMcpIT6)openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/mcp/ConceptContextIT.javaAIContextRestIT,AIContextMcpITIngestion integration tests
Playwright (UI) tests
Manual testing performed
rowCount, samples and PII masking; deny rules for view, profile and sample access; saved-query evidence (approved vs draft memories, excerpts, deletion); JSON/Markdown and REST/MCP parity; MCP and REST error pathsmake generate, isolated TypeScript validation, UI checkstyle, Spotless, pre-commit, andgit diff --checkpassedUI screen recording / screenshots:
Not applicable — no rendered UI changes
Checklist:
CONTRIBUTING.mdFixes <issue-number>: <short explanation>Fixes #34861Backward-Incompatible-Changelabel for the column glossary placement changeCollate worker configuration companion: https://github.com/open-metadata/openmetadata-collate/pull/7498; the ai-platform client and SQL integration merged in https://github.com/open-metadata/ai-platform/pull/1696.