feat(aicontext): enrich /context with type enums, profile detail, and service identity#30456
feat(aicontext): enrich /context with type enums, profile detail, and service identity#30456pmbrull wants to merge 4 commits into
Conversation
Enrich the /context payload so the ai-platform Analytics Agent can drop its separate schema and tableProfile/latest calls (open-metadata/ai-platform#930): - fieldContext.dataTypeEnum: raw ColumnDataType name for programmatic type branching (dataType keeps the display form) - columnProfileSummary: uniqueProportion, mean, median, and the cardinalityDistribution (reusing the generated class, now a named definition in table.json) - observability: profileSample + profileSampleType so callers can sample-gate the column stats - top-level name, service ref, and populated serviceType so query execution has the service identity without re-fetching the entity Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
❌ 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 |
|
Consumer-side PR: open-metadata/ai-platform#931 (drops the redundant schema + profile calls in the Analytics Agent once this lands). |
✅ TypeScript Types Auto-UpdatedThe generated TypeScript types have been automatically updated based on JSON schema changes in this PR. |
Review follow-up: populateProfile mixed profile-level metadata with per-column summary construction; hoist the latter into toColumnProfileSummary and map columns via a stream. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Review follow-up in 06702e6: extracted the per-column summary construction out of |
Code Review ✅ Approved 1 resolved / 1 findingsRefactors the AI context builder to extract per-column summary logic and enriches /context responses with service identity, raw data type enums, and detailed profiling metrics. No issues found. ✅ 1 resolved✅ Quality: populateProfile exceeds method-size / column-mapping could be extracted
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|
✅ Playwright Results — workflow succeededValidated commit ✅ 738 passed · ❌ 0 failed · 🟡 2 flaky · ⏭️ 5 skipped · 🧰 0 lifecycle flaky PerformanceBlocking 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) 54m 29s ⏱️ Max setup 3m 18s · max shard execution 19m 43s · max shard-job elapsed before upload 23m 21s · reporting 5s 🌐 196.50 requests/attempt · 2.54 app boots/UI scenario · 12.60% common-shard skew Optimization targets still in progress:
🟡 2 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
|



Describe your changes
Enriches the AI
/contextendpoint so the ai-platform Analytics Agent can stop making its separate schema (getEntityByFqn) andtableProfile/latestcalls — closing the gaps identified in open-metadata/ai-platform#930.Schema (
aiContext.json) — every addition is directly consumed by the agent, nothing speculative:fieldContext.dataTypeEnum— rawColumnDataTypename (e.g.BIGINT) for programmatic type branching;dataTypekeeps carrying the display form (e.g.bigint(20)). This was the only schema-call gap.columnProfileSummary.uniqueProportion / mean / median / cardinalityDistribution— the exact profile signals the agent's per-column stats builder consumes (PK detection, numeric ranges, exact/sampled value lists).cardinalityDistributionreuses the existing generated class: the inline object intable.jsonis hoisted to a named definition with an explicitjavaTypematching the class it already generated, so Java/Kotlin consumers see no change.observability.profileSample / profileSampleType— sample coverage metadata, needed to gate "Exact values" labels on full-dataset profiles.name,service(entity reference) and populatedserviceType— query execution needs the service id/name for provenance (workbench links, chart follow-ups) without re-fetching the entity.Deliberately not added: sample data, valuesCount, or opt-in "give me all" flags — the agent consumes none of them, and the added fields are small enough that the default payload stays lean. The markdown rendering is unchanged; only the JSON projection carries the new fields.
Note on permissions:
/contextrequiresVIEW_ALL, which subsumesVIEW_DATA_PROFILE, so embedding the profile does not widen access.Companion PR (consumer side): open-metadata/ai-platform — linked in comments once opened.
Type of change
Checklist
AIContextBuilderTest)🤖 Generated with Claude Code
Greptile Summary
Enriches AI asset context responses with service identity, raw column types, and detailed profile metadata.
Confidence Score: 5/5
The PR appears safe to merge because no blocking failure eligible for this follow-up review remains.
No blocking failure remains.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Consumer as AI/MCP Consumer participant Context as /context Endpoint participant Builder as AIContextBuilder participant Profile as Table Profile Repository Consumer->>Context: Request asset context Context->>Builder: Build context for entity Builder->>Profile: Load latest table profile Profile-->>Builder: Sampling and column statistics Builder-->>Context: Enriched AIContext Context-->>Consumer: Identity, schema, and profile detailsReviews (4): Last reviewed commit: "Merge branch 'main' into pmbrull/la-paz" | Re-trigger Greptile
Context used: