Skip to content

feat(trace-waterfall): Render warning icon with count#116566

Open
nsdeschenes wants to merge 19 commits into
masterfrom
nd/fix-tracewaterfall-render-icon-plus-count
Open

feat(trace-waterfall): Render warning icon with count#116566
nsdeschenes wants to merge 19 commits into
masterfrom
nd/fix-tracewaterfall-render-icon-plus-count

Conversation

@nsdeschenes
Copy link
Copy Markdown
Contributor

The goal of this PR is to address an issue where if there we too many warnings in the trace waterfall we would attempt to render all of them in a parent above, example:

Screenshot 2026-06-01 at 08 42 55

This PR makes the change so that we now only render one icon with the count next to it:

Screenshot 2026-06-01 at 09 06 21

nsdeschenes and others added 6 commits June 1, 2026 08:40
Render child-derived trace issues as a single counted indicator while preserving direct issue icons. Limit colored background patterns to direct issues so inherited child issues do not tint parent spans.
Measure grouped issue indicators when computing trace span text placement. This prevents right-side labels from overlapping the wider counted issue pill on narrow spans.
Anchor grouped child issue pills to the span edge when centering would cross the bar boundary. Update trace label placement to reserve the edge-anchored pill width so labels do not overlap the indicator.
Remove the white border from grouped trace issue pills so the indicator blends with the trace bar styling.
Only edge-anchor trace issue icons when centering them would cross the visible trace viewport boundary. Keep icons centered within narrow spans that are fully visible.
Render grouped trace issue counts as additional issues beside the representative icon. This avoids showing one extra issue when the icon already accounts for the first child-derived issue.

Keep trace text placement width calculations aligned with the rendered count and add regression coverage for grouped issue counts.

Co-Authored-By: Codex <noreply@openai.com>
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.60%

nsdeschenes and others added 5 commits June 1, 2026 09:17
When a trace issue icon snaps to the visible viewport edge, the anchor
timestamp could fall outside the span's node_space, producing left
values below 0% or above 100% and drawing the pill off the bar. Clamp
the anchor timestamp back into the span so the pill stays flush within
the bar.

Co-authored-by: Cursor <cursoragent@cursor.com>
Guard against a null node_space once and narrow it to a local binding,
replacing the eleven props.node_space! assertions in TraceIssueIcons.
No behavior change.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
The styled wrapper is only used within trace.tsx, so the export was
flagged by knip as unused. Make it module-private again.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Deduplicates six functions, one interface, and five constants that were
copy-pasted between traceIcons.tsx and virtualizedViewManager.tsx.
Truthiness check would silently skip group rendering if the count were
ever 0. Use !== undefined to guard against that edge case.
Remove export keyword from getMostSevereTraceIssue, getTraceIssueSeverityRank,
and RenderableTraceIssue since they are only used internally within the
module. Fixes knip unused-exports violations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lacement

Compute issue icon edge and anchor timestamp against the physical trace
space instead of the scaled trace view, so icons in zoomed views are not
incorrectly clamped to the visible trace end.

Co-authored-by: Cursor <cursoragent@cursor.com>
nsdeschenes and others added 3 commits June 1, 2026 14:03
Use the shared measured pill width when computing grouped trace issue icon edge clamping. This keeps the rendered pill and duration label collision logic aligned when count text is wider than the old estimate.

Co-Authored-By: Codex <noreply@openai.com>
…ults

Add WeakMap caches to avoid recomputing error and occurrence sets on
every call during trace waterfall rendering. The cache is keyed by
node reference so entries are automatically collected when nodes are
garbage collected.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
…idth

The truthy check on additionalIssueCount skipped getTraceIconGroupWidth
when the count was 0, falling back to the single icon width instead of
measuring the grouped pill. Use an explicit undefined check to correctly
handle the zero case.

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

@cursor cursor Bot left a comment

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 4b6640e. Configure here.

nsdeschenes and others added 3 commits June 1, 2026 14:30
Drop two tests that exercise the same start-clamped code paths as
existing tests: one in traceIcons (identical assertions to the
narrow-span-duration test) and one in virtualizedViewManager (same
clamping logic as the view-edge anchored grouped pill test).

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
getTraceIconBounds anchored edge-clamped icons to the viewport edge,
but TraceIssueIcons clamps the anchor back into the span. When the
span starts inside the viewport, the bounds were too far left, making
the text placement right bound too small and causing duration labels
to overlap the issue pill.

Clamp the anchor to the span bounds so the computed icon hitbox
matches where the icon actually renders.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
These constants are only used internally by getTraceIconGroupWidth
and do not need to be exported.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
@nsdeschenes nsdeschenes marked this pull request as ready for review June 1, 2026 19:17
@nsdeschenes nsdeschenes requested a review from a team as a code owner June 1, 2026 19:17
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