Skip to content

fix(profiling): Specific API error copy for flamegraphs and thresholds#114971

Open
JoshuaKGoldberg wants to merge 9 commits into
masterfrom
joshuakgoldberg/fix/profiling-flamegraph-http-error-messages
Open

fix(profiling): Specific API error copy for flamegraphs and thresholds#114971
JoshuaKGoldberg wants to merge 9 commits into
masterfrom
joshuakgoldberg/fix/profiling-flamegraph-http-error-messages

Conversation

@JoshuaKGoldberg
Copy link
Copy Markdown
Member

@JoshuaKGoldberg JoshuaKGoldberg commented May 6, 2026

Profiling surfaces that load flamegraphs or transaction thresholds didn't show specific/tailored text for API errors:

  • The aggregate flamegraph overlay used a placeholder string
  • Single-profile fetch used raw RequestError stringification
  • The threshold settings toast rendered a non-string API payload

This change unifies a bunch of the error copy rendering to prefer, in order:

  1. If a detail property is present, use that
  2. If the status code is a known common one (e.g. 429), render a known message for that
  3. Otherwise go with generic error text as before
Code After Before
429 Screenshot 2026-05-12 at 2 17 59 PM Screenshot 2026-05-12 at 2 19 07 PM
500
With server detail
Screenshot 2026-05-12 at 2 17 59 PM
500
Without server detail
Screenshot 2026-05-12 at 2 17 59 PM

Fixes PRO-41.

Made with Cursor

Aggregate flamegraphs previously passed a literal error string into the
warning overlay, profile fetch failures surfaced raw RequestError text,
and the transaction threshold button could pass non-string responses to
toasts after rate limiting.

Introduce getRequestErrorUserMessage to prefer API detail and map common
HTTP statuses (including 429) to friendly copy, then use it across these
profiling paths.

Refs PRO-41

Co-Authored-By: Cursor Agent <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 6, 2026

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

📊 Type Coverage Diff

Metric Before After Delta
Coverage 93.50% 93.50% ±0%
Typed 135,324 135,332 🟢 +8
Untyped 9,411 9,411 ±0
🔍 1 new type safety issue introduced

Type assertions (as) (1 new)

File Line Detail
static/app/utils/requestError/getRequestErrorUserMessage.tsx 27 as {message?: unknown}detail as {message?: unknown}

This is informational only and does not block the PR.

JoshuaKGoldberg and others added 2 commits May 12, 2026 13:48
When an aggregate flamegraph request errored, both FlamegraphWarnings
(inside AggregateFlamegraph) and the parent RequestStateMessageContainer
rendered absolutely-positioned error overlays. Previously the inner
overlay rendered the literal placeholder string "error" while the outer
rendered "There was an error loading the flamegraph.", which masked the
overlap. Aligning both on getRequestErrorUserMessage made the duplicate
text visible.

Suppress the parent error overlay when the flamegraph visualization is
active, since FlamegraphWarnings already covers that case. The call
tree visualization still falls back to the parent overlay.

Refs PRO-41
Co-Authored-By: Cursor Agent <noreply@cursor.com>

Co-authored-by: Cursor <cursoragent@cursor.com>
@JoshuaKGoldberg JoshuaKGoldberg changed the title fix(profiling): Improve API error copy for flamegraphs and thresholds fix(profiling): Specific API error copy for flamegraphs and thresholds May 12, 2026
JoshuaKGoldberg and others added 6 commits May 12, 2026 14:27
… overlays

When the API returned a `detail` for a failed aggregate flamegraph
request, the overlay rendered only that detail (e.g. "Some specific
detail."), with no surrounding indication that it was an error. Add an
"Error loading flamegraph" heading above the message in both the inner
FlamegraphWarnings overlay and the parent RequestStateMessageContainer
(call tree view), so the framing matches the previous behavior while
still surfacing the server-provided detail.

Refs PRO-41
Co-Authored-By: Cursor Agent <noreply@cursor.com>

Co-authored-by: Cursor <cursoragent@cursor.com>
…erlays

Replace the previously-introduced h4 heading in the flamegraph error
overlays with a `role="alert"` live region. The h4 skipped levels from
the page h1, and an error state shown conditionally on request failure
is better represented as an alert than as part of the document heading
outline. Title text is now rendered with Text bold (no heading
semantics), while the alert role ensures the message is announced to
screen readers when it appears.

Applies to FlamegraphWarnings (inner overlay shared by aggregate,
continuous, and single-profile flamegraphs) and the parent overlays
used by the call tree view in the profiling landing page and the
transaction summary profiling tab.

Refs PRO-41
Co-Authored-By: Cursor Agent <noreply@cursor.com>

Co-authored-by: Cursor <cursoragent@cursor.com>
Increase the vertical gap between the alert title and detail message in
the call-tree parent overlays from xs to md to give the two lines more
visual separation.

Refs PRO-41
Co-Authored-By: Cursor Agent <noreply@cursor.com>

Co-authored-by: Cursor <cursoragent@cursor.com>
Match the md vertical gap used in the call-tree parent overlay so the
alert title and detail message (and other multi-row warning states such
as the empty-data export button and no-frames filter reset) are spaced
consistently inside the flamegraph warning overlay grid.

Refs PRO-41
Co-Authored-By: Cursor Agent <noreply@cursor.com>

Co-authored-by: Cursor <cursoragent@cursor.com>
The single-profile flamegraph "renders a missing profile" test was
asserting on the raw String(err) output ("RequestError: GET …") that
TransactionProfileProvider emitted before profilesProvider switched to
getRequestErrorUserMessage. Assert on the alert title and the 404
mapping copy instead, so the test exercises the same user-facing error
path the UI now renders.

Refs PRO-41
Co-Authored-By: Cursor Agent <noreply@cursor.com>

Co-authored-by: Cursor <cursoragent@cursor.com>
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review May 12, 2026 18:53
@JoshuaKGoldberg JoshuaKGoldberg requested review from a team as code owners May 12, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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