fix(mcp): resolve attribute scope and explain empty results - #1227
Confidence 3/5 · No issues found
🟡 Confidence 3/5 · needs attention
quality 98/100 · 1 note · tests partial · risk medium · 3/3 new units observable
Warning
This review ended early; what follows is what it established.
Resolves attribute_key to span or resource scope across query_data/search_traces, teaches traces and metrics a resource-attribute group-by, adds an environment filter and service-scoped wrappers to explore_attributes, and adds "did you mean" hints on empty results. The new pipe params are all consumed downstream. One test file, packages/query-engine/src/ch/queries/metrics.test.ts, was not read.
normalizeGroupByacceptsquery_data's group-by spellings increate-dashboardsearch_tracesgains anenvironmentfilter and resource-attribute key resolutionserviceScopedAttributeKeysQuery/serviceScopedAttributeValuesQuerybackexplore_attributeswith a service- Empty results return
emptyHintswith close matches for service, environment and attribute key
Still open from earlier reviews
- 🔵 Note · F2 ·
softhides every hint-lookup failure with no signal ·apps/ai/src/mcp/lib/empty-result-hints.ts:78
What was checked
resource_filter_key/resource_filter_value,deployment_envandresource_attribute_filtersare consumed atpipe-dispatch.ts:223,:231,:829explore-attributes.ts:100,141already forwardsservice_name, so the service-scoped pipe branches are reachableerrors_by_typeconsumers readdeployment_envs(pipe-dispatch.ts:486), matching thefind-errorshint params
Observability coverage: 3 of 3 changes observable
| Change | Kind | Observable | Evidence |
|---|---|---|---|
| query_data attribute-scope resolution | outbound warehouse query | yes | Effect.fn span in attribute-scope.ts; queries via exploreAttributeKeys/WarehouseExecutor |
| emptyResultHints lookups | outbound warehouse query | yes | Effect.withSpan("McpTool.emptyResultHints") in empty-result-hints.ts |
| search_traces environment filter | inbound param + warehouse query | yes | deployment_env consumed at pipe-dispatch.ts:223 and :829 |
Files not reviewed (1)
The review ended before it read these diffs, so nothing above vouches for them.
packages/query-engine/src/ch/queries/metrics.test.ts
6bbb4ea · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.