Skip to content

feat(seer): Scaffold Night Shift settings section#113696

Closed
chromy wants to merge 9 commits intochromy/2026-04-21-nightshift-settings-backendfrom
chromy/2026-04-21-nightshift-settings
Closed

feat(seer): Scaffold Night Shift settings section#113696
chromy wants to merge 9 commits intochromy/2026-04-21-nightshift-settings-backendfrom
chromy/2026-04-21-nightshift-settings

Conversation

@chromy
Copy link
Copy Markdown
Contributor

@chromy chromy commented Apr 22, 2026

No description provided.

JonasBa and others added 7 commits April 22, 2026 09:32
…ame) (#113626)

Update settings pages to better colocate filters alongside the
components they are controlling or rendering

Fix DE-1182

---------

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Jonas <JonasBa@users.noreply.github.com>
ref STREAM-882

## Summary
- Bump taskbroker-client minimum version from 0.1.8 to 0.1.9
- Add `<1` upper bound to exclude erroneous version 26.5.0 which has
wrong version scheme colliding with calver (May 2026 = 26.5.x)

## Test plan
- CI should pass with the new dependency constraint

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
\`sentry.models.group.GroupStatus\` is a plain class whose members are
ints (\`RESOLVED = 1\`, \`IGNORED = 2\`, etc.) — not an enum. Callers of
the functions below all pass ints, and the in-function \`==\`
comparisons (\`group_status == GroupStatus.RESOLVED\`) are int-vs-int.
But the parameters were annotated as \`GroupStatus\`, i.e. \"instance of
GroupStatus\", which is never what the callers pass.

Under \`strict_equality = true\` the comparisons become semantically
unreachable (instance-of-class never equals int). Stricter mypy reports
them as \`[unreachable]\`.

Change the annotations to \`int\` to match actual usage:

- \`fetch_alert_threshold\`
- \`fetch_resolve_threshold\`
- \`AlertContext.from_workflow_engine_models\`
- \`MetricAlertNotificationMessageBuilder.build_alert_context\`

No runtime behavior change. Prep for the mypy 1.20 upgrade (#113419).
Safe under 1.19.1.


Agent transcript:
https://claudescope.sentry.dev/share/wKKwnZeeYc-V3zQbolQDCON52n93vyqkCmPrIs_kbnI
Needed to be somewhat careful to avoid cycles, since we're deleting both
ways.

Fixes ISWF-2506.
Also addresses a root cause of ISWF-2302.
…#113627)

This is a step towards allowing us to cache disabled Detectors, which
can make our cache useful in more contexts (such as for Uptime).
…#113616)

Fix the `get_metric_metadata` RPC handler to use `count(value)` instead
of zero-arg `count()` in its tracemetrics query.

The `tracemetrics` dataset parser requires `count()` to take an
attribute argument. Zero-arg `count()` parse-fails at the events layer
with `status=400 body={'detail': 'Invalid number of arguments for count,
was expecting 1 arguments', 'code': 'parse_error'}`. Every call to this
handler since it was merged in #113462 has been returning
`events_query_failed` — the Seer assisted-query metrics agent has never
once received real candidates from this tool and has been silently
falling back to `get_field_values` probes instead.

The bug wasn't caught because the existing tests mocked
`sentry.api.client` wholesale and never exercised the real parser. This
PR also adds `TestGetMetricMetadataIntegration`, which persists real
`TraceItem`s and hits the handler end-to-end via `TraceMetricsTestCase`
— this is the shape of test that would have caught the original bug, and
will catch future regressions in the aggregate-function shape.

While here, the `ApiError` catch block now attaches `status_code` and a
500-char body prefix to its `logger.exception` extras so future flakes
are debuggable from logs without a new deploy cycle.

Reproduction (before this PR, on prod):

```
POST /api/0/organizations/1/seer-rpc/get_metric_metadata/
{"args": {"org_id": 1, "project_ids": [1], "name_substrings": ["storage.put.size"], "stats_period": "7d", "limit": 20}}
```

returns `{"candidates": [], "has_more": false, "error":
"events_query_failed"}` on every substring, 25/25 tries. After this PR
the same request returns populated candidates.

Refs #113462

Co-authored-by: Claude Opus 4.7 (1M context) <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 22, 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.

chromy added 2 commits April 22, 2026 17:56
Add a new "Night Shift" section to the project-level Autofix settings page
with an enable toggle, a model picker, and a "Run Now" button. None of the
controls are wired to the backend yet — this is UI scaffolding so later
changes can layer on persistence and the real test-run action without
re-laying out the page.

The section is gated behind the organizations:seer-night-shift feature
flag (exposed to the UI in 93556ac) via the Feature component.

Co-Authored-By: Claude <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/q8-tQCv6rVXlowTzKrlbB_WsXutoe8wfi0_7ZgOwZIU
@chromy chromy force-pushed the chromy/2026-04-21-nightshift-settings branch from 13a3280 to 5c4f959 Compare April 22, 2026 16:56
@chromy chromy changed the base branch from master to chromy/2026-04-21-nightshift-settings-backend April 22, 2026 16:57
@chromy chromy closed this Apr 22, 2026
@chromy chromy deleted the chromy/2026-04-21-nightshift-settings branch April 22, 2026 17:02
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.

7 participants