Skip to content

fix(trace-waterfall): Add cycle protections#106888

Merged
nsdeschenes merged 9 commits intomasterfrom
nd/fix-trace-waterfall-add-cycle-protections
Jan 26, 2026
Merged

fix(trace-waterfall): Add cycle protections#106888
nsdeschenes merged 9 commits intomasterfrom
nd/fix-trace-waterfall-add-cycle-protections

Conversation

@nsdeschenes
Copy link
Contributor

@nsdeschenes nsdeschenes commented Jan 23, 2026

This PR makes some changes to the trace tree to add in protection for potential cycles potentially leading infinite loops.

Ticket: EXP-707

Why cycles might happen

Cycles in trace data can occur from:

  • Corrupted span data where parent_span_id references create circular dependencies (e.g., span A → B → C → A)
  • Duplicate event IDs causing multiple spans to be treated as the same node
  • Data ingestion edge cases that incorrectly link spans

What the UI does when cycles are detected

Location Behavior
Tree construction (traceTree.tsx) Skips duplicate event_id nodes, logs to Sentry
Span tree (transactionNode.tsx) Detects ancestor cycles, attaches cyclic spans to transaction root
Traversal methods (baseNode.tsx) Uses visited Set to skip already-seen nodes
Autogroup segments (parentAutogroupNode.tsx) Breaks out of loop, renders partial segments

In all cases, the UI renders safely with the non-cyclic portion of the tree rather than crashing or hanging.

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 23, 2026
@nsdeschenes
Copy link
Contributor Author

@sentry review
@cursor review

@nsdeschenes
Copy link
Contributor Author

@cursor review

Copy link
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.

✅ Bugbot reviewed your changes and found no new issues!

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

@linear
Copy link

linear bot commented Jan 26, 2026

Copy link
Member

@gggritso gggritso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, nice work! The PR could use a more detailed description though. Covering why cycles might happen, and what the UI does in case of cycles would be helpful. Actually adding some of that context to the code would be helpful, too.

@nsdeschenes nsdeschenes force-pushed the nd/fix-trace-waterfall-add-cycle-protections branch from 7ba965e to 63a6ee9 Compare January 26, 2026 17:27
@nsdeschenes nsdeschenes merged commit 3dec232 into master Jan 26, 2026
53 checks passed
@nsdeschenes nsdeschenes deleted the nd/fix-trace-waterfall-add-cycle-protections branch January 26, 2026 19:29
dashed pushed a commit that referenced this pull request Jan 26, 2026
This PR makes some changes to the trace tree to add in protection for
potential cycles potentially leading infinite loops.

In all cases, the UI renders safely with the non-cyclic portion of the
tree rather than crashing or hanging.

Ticket: EXP-707
JonasBa pushed a commit that referenced this pull request Jan 27, 2026
This PR makes some changes to the trace tree to add in protection for
potential cycles potentially leading infinite loops.

In all cases, the UI renders safely with the non-cyclic portion of the
tree rather than crashing or hanging.

Ticket: EXP-707
priscilawebdev pushed a commit that referenced this pull request Feb 2, 2026
This PR makes some changes to the trace tree to add in protection for
potential cycles potentially leading infinite loops.

In all cases, the UI renders safely with the non-cyclic portion of the
tree rather than crashing or hanging.

Ticket: EXP-707
@github-actions github-actions bot locked and limited conversation to collaborators Feb 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants