Skip to content

feat(explorer): Add Code Mode toggle to Explorer UI#112882

Draft
azulus wants to merge 3 commits intomasterfrom
jstanley/explorer-code-mode-toggle
Draft

feat(explorer): Add Code Mode toggle to Explorer UI#112882
azulus wants to merge 3 commits intomasterfrom
jstanley/explorer-code-mode-toggle

Conversation

@azulus
Copy link
Copy Markdown
Member

@azulus azulus commented Apr 13, 2026

Summary

  • Adds a CM (Code Mode) toggle to the Explorer top bar, next to the existing CE toggle
  • Only visible when user has seer-explorer-code-mode-tools feature flag
  • Frontend sends override_code_mode_enable in POST body
  • Backend uses it to enable/disable code mode tools (only overrides if flag is already enabled — can't bypass the flag)

Test plan

  • Verify toggle appears only when feature-flagged
  • Verify toggling CM off suppresses code mode tools in Explorer responses
  • Verify CE toggle still works independently

🤖 Generated with Claude Code

Add a CM (Code Mode) toggle to the Explorer top bar, following the same
pattern as the CE (Context Engine) toggle. The toggle is only visible
when the user is feature-flagged into code mode tools
(seer-explorer-code-mode-tools). The frontend sends
override_code_mode_enable in the request body; the backend uses it to
override the feature flag check (only if the flag is already enabled).

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Apr 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

The CM toggle checks organization.features on the frontend, but the
flag had api_expose=False so it was never sent to the client.

Co-Authored-By: Claude <noreply@anthropic.com>
Code mode is opt-in per session — user must explicitly toggle CM on.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Backend Test Failures

Failures on 03d7cf9 in this run:

tests/snuba/api/endpoints/test_organization_events_timeseries_spans.py::OrganizationEventsStatsSpansMetricsEndpointTest::test_handle_nans_from_snuba_top_nlog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/snuba/api/endpoints/test_organization_events_timeseries_spans.py:212: in test_handle_nans_from_snuba_top_n
    assert timeseries["values"] == build_expected_timeseries(
E   AssertionError: assert [{'confidence...ne, ...}, ...] == [{'confidence...Y>, ...}, ...]
E     
E     At index 6 diff: {'timestamp': 1776038400000, 'value': 2.0, 'incomplete': True, 'incompleteReason': 'INCOMPLETE_BUCKET', 'sampleCount': 1, 'sampleRate': 1.0, 'confidence': 'low'} != {'incomplete': False, 'timestamp': 1776038400000.0, 'value': 2, 'sampleCount': <ANY>, 'sampleRate': <ANY>, 'confidence': <ANY>}
E     
E     Full diff:
E       [
E           {
E     -         'confidence': <ANY>,
E     ?                       -- ^^
E     +         'confidence': None,
E     ?                        ^^^
E               'incomplete': False,
E     -         'sampleCount': <ANY>,
E     ?                        ^^^^^
E     +         'sampleCount': 0,
E     ?                        ^
E     -         'sampleRate': <ANY>,
E     ?                       -- ^^
E     +         'sampleRate': None,
E     ?                        ^^^
E     -         'timestamp': 1775520000000.0,
E     ?                                   --
E     +         'timestamp': 1775520000000,
E     -         'value': 0,
E     +         'value': 0.0,
E     ?                  ++
E           },
E           {
E     -         'confidence': <ANY>,
E     ?                       -- ^^
E     +         'confidence': None,
E     ?                        ^^^
E               'incomplete': False,
E     -         'sampleCount': <ANY>,
E     ?                        ^^^^^
E     +         'sampleCount': 0,
E     ?                        ^
E     -         'sampleRate': <ANY>,
E     ?                       -- ^^
E     +         'sampleRate': None,
E     ?                        ^^^
E     -         'timestamp': 1775606400000.0,
E     ?                                   --
E     +         'timestamp': 1775606400000,
E     -         'value': 0,
E     +         'value': 0.0,
E     ?                  ++
... (111 more lines)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant