Mirror HDX-4376 implicit→body fallback in MCP query tools and alert templates

Open Beginner friendly
#2,355 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
typescript

Research direction

Review #2354 and the existing _ChartConfigSchema plumbing first. Then inspect the listed files under packages/api/src/mcp/tools/query and packages/api/src/tasks/checkAlerts, tracing how each builds ChartConfigWithDateRange. Done means every listed log-source callsite passes bodyExpression alongside implicitColumnExpression, while trace sources remain unchanged.

Written by the indexing model from the issue text.

Description

Follow-up to #2354 (HDX-4376), which added a bare-text Lucene search fallback from `implicitColumnExpression` to `bodyExpression` on log sources.

The UI flow is fixed. For consistency, the same fallback needs to be threaded through backend paths that build their own `ChartConfigWithDateRange` from a source:

  • `packages/api/src/mcp/tools/query/helpers.ts` (search MCP tool + raw-SQL tile macros)
  • `packages/api/src/mcp/tools/query/runEventPatterns.ts` (event-patterns sample + count configs)
  • `packages/api/src/mcp/tools/query/eventDeltas.ts` (event-deltas sample config)
  • `packages/api/src/tasks/checkAlerts/index.ts` (`computeAliasWithClauses`)
  • `packages/api/src/tasks/checkAlerts/template.ts` (sample-log query in alert template rendering)

For each: when the source is a log source, pull `source.bodyExpression` alongside `source.implicitColumnExpression` and pass both to the chart config. Trace sources stay unchanged.

The schema change in #2354 already added `bodyExpression` to `_ChartConfigSchema` and `RawSqlChartConfigSchema`, so this is purely callsite-level plumbing.

No test coverage gap to backfill: `CustomSchemaSQLSerializerV2` itself is tested in common-utils. The callsites just need to thread the field through.

Effort: ~30 minutes, single-package (api) change.

Dominant language
TypeScript
Stars
9.9k
Forks
471
Avg merge
2d 4h
Merged PRs (30d)
117

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hyperdxio/hyperdx

All issues in hyperdxio/hyperdx

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.