Skip to content

fix(search): warn once with the final rewritten query - #1624

Merged
betegon merged 2 commits into
fix/search-numeric-project-idfrom
fix/search-rewrite-warn-final
Sep 22, 2026
Merged

betegon merged 2 commits into
fix/search-numeric-project-idfrom
fix/search-rewrite-warn-final

Conversation

@betegon

@betegon betegon commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-up to #1621. sanitizeQuery warned Running query: after the numeric project: rewrite, then again after OR/AND. Combined input logged an intermediate that never ran.

All rewrites now finish first. One warning: reasons on the first line, Running query: on the second, quoting the query that is actually sent. Same for a failed OR: no Running query: before the ValidationError.

Stacked on #1621 — merge that first.

Before / after

sentry issue list --json -q "project:123 OR project:456"

Before — two warnings, first one is a lie:

⚠ `project` is the slug; numeric ids use project_id. Rewrote numeric project: filters. Running query: "project_id:123 OR project_id:456"
⚠ Rewrote OR using in-list syntax: key:[val1,val2]. Running query: "project_id:[123,456]"

After — one warning, final query on its own line:

⚠ `project` is the slug; numeric ids use project_id. Rewrote numeric project: filters. Rewrote OR using in-list syntax: key:[val1,val2].
  Running query: "project_id:[123,456]"

Test plan

  • project:123 OR project:456 → project_id:[123,456], one warn, Running query: on the second line
  • project:123 AND is:unresolved → project_id:123 is:unresolved, same shape
  • level:error OR assigned:me throws with no Running query:
  • From packages/cli: pnpm exec vitest run test/lib/search-query.test.ts test/lib/search-query.warn.test.ts

sanitizeQuery used to log Running query: after the numeric project
rewrite, then again after OR/AND. Combined input like project:123 OR
project:456 warned with an intermediate that never ran. Collect notes
and emit a single warning after every rewrite succeeds.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel
vercel Bot temporarily deployed to Preview – sentry-local September 22, 2026 14:28 Inactive
@vercel

vercel Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
cli Ready Ready Preview Sep 22, 2026 4:10pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Sep 22, 2026 4:10pm UTC

Request Review

@BYK

BYK commented Sep 22, 2026

Copy link
Copy Markdown
Member

I'd still split this into two where the "rewrote the query" part appears as a separate line

The rewrite reasons and the query that actually runs are different
things to scan. Keep one warn() so consola still prints a single ⚠,
but break Running query: onto the next line.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel
vercel Bot temporarily deployed to Preview – sentry-local September 22, 2026 16:09 Inactive
@betegon

betegon commented Sep 22, 2026

Copy link
Copy Markdown
Member Author

Done — still one log.warn (one ⚠), with Running query: on the next line so the string that actually runs is easy to copy.

⚠ `project` is the slug; numeric ids use project_id. Rewrote numeric project: filters. Rewrote OR using in-list syntax: key:[val1,val2].
  Running query: "project_id:[123,456]"

@betegon
betegon marked this pull request as ready for review September 22, 2026 16:14
@github-actions github-actions Bot added the risk: low PR risk score: low label Sep 22, 2026
@betegon
betegon merged commit 7fab5dc into fix/search-numeric-project-id Sep 22, 2026
31 checks passed
@betegon
betegon deleted the fix/search-rewrite-warn-final branch September 22, 2026 16:23

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – cli — 39fcfc7a Deployed Sep 22, 2026 by vercel[bot]
Preview – sentry-local — 39fcfc7a Deployed Sep 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants