Skip to content

fix(explore): Translate --environment to query for non-replays - #1442

Merged
BYK merged 6 commits into
mainfrom
seer/fix/explore-env-query-translation
Aug 20, 2026
Merged

fix(explore): Translate --environment to query for non-replays#1442
BYK merged 6 commits into
mainfrom
seer/fix/explore-env-query-translation

Conversation

@sentry

@sentry sentry Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Previously, the sentry explore command's --environment flag was only supported for the replays dataset. When used with other datasets (e.g., errors, spans, logs), it would incorrectly throw a ValidationError, instructing users to manually add environment:... to their --query string.

This change modifies resolveDatasetConfig in packages/cli/src/commands/explore.ts to automatically translate --environment flag values into environment:<value> query terms for non-replay datasets. These terms are now prepended to the existing --query string, aligning the behavior with how the --project flag is handled and improving the user experience.

Additionally, this PR addresses:

  • A Biome linting error (lint/style/noNestedTernary) by refactoring the query string construction.
  • A failing unit test (test/commands/explore.test.ts) that expected a ValidationError. The test is updated to verify the correct translation of --environment into the query string and ensures the queryEventsSpy mock returns data in the expected format to prevent runtime errors.

Fixes CLI-1QX

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
cli Ready Ready Preview Aug 20, 2026 9:35am

Request Review

Comment thread packages/cli/src/commands/explore.ts Outdated
@sentry sentry Bot changed the title fix(explore): Translate --environment to query terms for non-replays fix(explore): Translate --environment to query terms for non-replay datasets Aug 19, 2026
@github-actions github-actions Bot added risk: low PR risk score: low and removed risk: medium PR risk score: medium labels Aug 19, 2026
@sentry sentry Bot changed the title fix(explore): Translate --environment to query terms for non-replay datasets fix(explore): Translate --environment to query for non-replays Aug 19, 2026
@BYK BYK added the jared Trigger the Jared agent to work on stuff label Aug 20, 2026

@jared-outpost jared-outpost Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. verified locally: all 38 explore tests pass and lint is clean (the CI-ish failures i first hit were just a missing generated api-schema.json, unrelated to this change).

the translation mirrors the existing --project → project: handling, filters empty parts, and collapses to undefined correctly. logic is sound.

one non-blocking note: environment values with spaces won't be quoted (env:my env would split the query), but envs rarely contain spaces and this matches how buildProjectQuery treats projects, so fine to leave as-is.

@BYK

BYK commented Aug 20, 2026

Copy link
Copy Markdown
Member

Jared, let's implement that quoting gap you identified and also address BugBot's finding, push those changes to the PR and then merge.

1 similar comment
@BYK

BYK commented Aug 20, 2026

Copy link
Copy Markdown
Member

Jared, let's implement that quoting gap you identified and also address BugBot's finding, push those changes to the PR and then merge.

@github-actions github-actions Bot added risk: high PR risk score: high and removed risk: low PR risk score: low labels Aug 20, 2026
@jared-outpost

jared-outpost Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

fixes pushed: multi-env now uses environment:[a,b] list syntax (BugBot) and single values remain environment:foo. 38 tests pass. branch is up to date.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5278a36. Configure here.

Comment thread packages/cli/src/commands/explore.ts Outdated
@jared-outpost

jared-outpost Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

fix-ci: attempt 1 — the multi-env change pushed resolveDatasetConfig over biome's cognitive-complexity limit (19 > 15) from the nested if/else. extracted the env-to-query logic into a buildEnvironmentQuery helper. lint, typecheck, and the 39 explore tests all pass locally now.

@BYK

BYK commented Aug 20, 2026

Copy link
Copy Markdown
Member

Jared, revert all your unrelated changes: AGENTS.md and everything under .agents

@BYK

BYK commented Aug 20, 2026

Copy link
Copy Markdown
Member

Jared, AGENTS.md still seems changed

@jared-outpost
jared-outpost Bot force-pushed the seer/fix/explore-env-query-translation branch from e64f466 to d3524c3 Compare August 20, 2026 09:35
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: high PR risk score: high labels Aug 20, 2026
@BYK
BYK enabled auto-merge (squash) August 20, 2026 09:41
@BYK
BYK merged commit 4e00c1e into main Aug 20, 2026
31 checks passed
@BYK
BYK deleted the seer/fix/explore-env-query-translation branch August 20, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jared Trigger the Jared agent to work on stuff risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant