Skip to content

fix(core,mcp): Bugbot follow-ups from the shared search parser - #1534

Merged
BYK merged 2 commits into
mainfrom
fix/search-syntax-bugbot-followups
Oct 17, 2026
Merged

BYK merged 2 commits into
mainfrom
fix/search-syntax-bugbot-followups

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Follow-ups to the Cursor Bugbot review on #1532.

MCP regex scanner missed canonical array keys

Sentry's grammar (array_includes_tag_key) writes array membership on an explicit tag inside the brackets: tags[k[*],array]. REGEX_FILTER_KEY_SOURCE in mcp-core/.../search-events/utils.ts only accepted tags[k,array][*], which the grammar doesn't parse. So searchFilterOccurrences skipped canonical array-includes regex filters, and isSemanticFilterDowngrade couldn't tell when one was rewritten into a wildcard or full-text match.

The key pattern now takes [*] inside the brackets, matching the grammar and the CLI's REGEX_FILTER_KEY_SOURCE. New tests cover tags[k[*],array]://^a b// rewritten to tags[k[*],array]:*a* and to message:"*a b*"; both fail without the fix.

Aggregate size filters skipped the key check

predicateFilter checked argument types for AGGREGATE_DURATION, AGGREGATE_DATE and AGGREGATE_PERCENTAGE, but let AGGREGATE_SIZE match any aggregate whose value looked like a size. It now requires a size-key argument, like the others. A new test fails without the fix.

Behavior change: with the default config, sizeKeys is empty, so avg(x):>1kb no longer parses as a typed filter and falls back to free text. avg(span.duration):>1s already works this way, because span.duration isn't a default duration key. Callers that know their size fields should pass sizeKeys. CLI and MCP don't set any key sets today.

This diverges from the frontend, whose searchSyntax/parser.tsx predicateFilter has the same fall-through. It's noted in #1533 so it can be fixed upstream or settled when the frontend switches to the shared package.

Checks

  • toolkit-core: 332 tests pass
  • CLI search-query: 122 tests pass
  • mcp-core: 1823 tests pass
  • oxlint, oxfmt and toolkit-core tsc are clean

via byk.

--

View Junior Session [Sentry]

Sentry's grammar puts array membership on an explicit tag inside the
brackets (tags[k[*],array]), but REGEX_FILTER_KEY_SOURCE only accepted
tags[k,array][*]. searchFilterOccurrences missed canonical array-includes
regex filters, so isSemanticFilterDowngrade couldn't see them being
rewritten into wildcards or full-text.

Follow-up to Cursor Bugbot review on #1532.

Co-Authored-By: Burak Yigit Kaya <burak.kaya@sentry.io>
@vercel

vercel Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Oct 17, 2026 12:54am UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Oct 17, 2026
@BYK

BYK commented Oct 17, 2026

Copy link
Copy Markdown
Member

Not changed: aggregate size filters skip key checks

Well if this is a bug upstream, let's fix it here and note it in #1533

predicateFilter checked argument types for aggregate duration, date,
and percentage filters but let AGGREGATE_SIZE match any aggregate whose
value looked like a size. Check for a size-key argument like the others.

This diverges from the frontend's predicateFilter, which has the same
fall-through; tracked in #1533.
@sentry-junior

sentry-junior Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Done in a96b664. AGGREGATE_SIZE now requires a size-key argument, like the other typed aggregates, and a new test covers it (it fails without the fix). I noted the divergence from the frontend in #1533 (comment) and updated the PR description, including the behavior change: with the default empty sizeKeys, avg(x):>1kb now falls back to free text.

@BYK
BYK enabled auto-merge (squash) October 17, 2026 01:03
@sentry-junior sentry-junior Bot changed the title fix(mcp): Match tags[k[*],array] keys in the regex downgrade scanner fix(core,mcp): Bugbot follow-ups from the shared search parser Oct 17, 2026
@sentry-junior

sentry-junior Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Correction to my comment above: the link to the #1533 note is broken. The note is here: #1533 (comment). The PR title and description are now updated to cover both fixes.

@BYK
BYK merged commit 7cb18d0 into main Oct 17, 2026
38 checks passed
@BYK
BYK deleted the fix/search-syntax-bugbot-followups branch October 17, 2026 01:06

This branch was successfully deployed

1 active and 1 inactive deployments
Preview — a96b6644 Deployed Oct 17, 2026 by vercel[bot]
Actions — a96b6644 Deployed Oct 17, 2026 by sentry-junior[bot] via eval #1325
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant