Skip to content

chore(event formatter): add llmFormat to endpoint#119545

Open
shayna-ch wants to merge 8 commits into
shayna-ch/formatterfrom
shayna-ch/format-endpoint
Open

chore(event formatter): add llmFormat to endpoint#119545
shayna-ch wants to merge 8 commits into
shayna-ch/formatterfrom
shayna-ch/format-endpoint

Conversation

@shayna-ch

@shayna-ch shayna-ch commented Jul 13, 2026

Copy link
Copy Markdown
Member

to be merged after #119250

Adds a reusable FormattableResponseMixin that lets an endpoint return LLM-ready formatted output. When a request passes ?llmFormat=markdown (or xml), the endpoint includes a new formatted: {format, content} field in its JSON response, rendered by the shared formatter. Existing response fields are unchanged. Wires this into the group event details endpoint and the autofix endpoint (group_ai_autofix).

No behavioral change on merge. behind the issues.standardized-markdown-for-llm option. Rollout will happen gradually via feature flag.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 13, 2026
@shayna-ch
shayna-ch changed the base branch from master to shayna-ch/formatter July 13, 2026 18:28
@sentry

sentry Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
0 0 0 0 451 0 ✅ Unchanged

⚙️ sentry-frontend Snapshot Settings

@shayna-ch
shayna-ch force-pushed the shayna-ch/format-endpoint branch from 3de3acb to 298ba91 Compare July 14, 2026 16:25
@shayna-ch
shayna-ch force-pushed the shayna-ch/format-endpoint branch from 298ba91 to 9e901db Compare July 14, 2026 16:40
@shayna-ch

Copy link
Copy Markdown
Member Author

bugbot run

Comment thread src/sentry/issues/formatting/autofix.py
Hardcoded markdown bold in _solution leaked into xml llmFormat output.
Use fmt.field so markdown and xml both get format-appropriate step lines.

Co-authored-by: Shayna Chambless <shayna-ch@users.noreply.github.com>
NotRequired is ignored under from __future__ import annotations, so
OpenAPI treated `formatted` as required and example validation failed.
Use total=False TypedDict mixins instead, and cast the event details
response so mypy accepts the annotated return type.

Co-authored-by: Shayna Chambless <shayna-ch@users.noreply.github.com>
@shayna-ch

Copy link
Copy Markdown
Member Author

bugbot run

@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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 83226f9. Configure here.

@shayna-ch
shayna-ch marked this pull request as ready for review July 20, 2026 18:36
@shayna-ch
shayna-ch requested review from a team as code owners July 20, 2026 18:36
@shayna-ch
shayna-ch marked this pull request as draft July 20, 2026 19:32
@shayna-ch
shayna-ch marked this pull request as ready for review July 20, 2026 19:34
return response

try:
content = adapter(response.data, fmt)

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.

related to #119250 (comment), we seem to have to include a lot of formatting logic because we take in Anys from endpoints. since endpoints (and data, in general) are typed, we can probably remove a lot of it by using the type system. for example, group_event_details returns an GroupEventDetailsResponse, which is fully typed. thus, you wouldn't need to do any defensive checks if you typed format_event_response to take some GroupEventDetailsResponse-like object. similar case to the group_ai_autofix endpoint, though we should probably just add the appropriate types on that endpoint

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants