crbench//

← all cases

Span tree minimap and secondary panel

Tier 2 medium typescript · local · real merged PR from getsentry/sentry #21336

Ground-truth defects

d1 · correctness · low
The span bar position is computed with a CSS clamp: `left: clamp(0%, ${toPercent(bounds.left || 0)}, calc(100% - 1px))`. clamp floors the value at 0%, but when the view is zoomed via the minimap a span that starts before the visible window has a legitimately negative left; flooring it to 0% mis-positions the bar. The fix uses min(...) (no lower bound) so negative offsets render correctly.
d2 · correctness · high
In `src/sentry/utils/samples.py`, `measurements.update(measurement_markers)` is placed INSIDE the `for key, entry in measurements.items()` loop, mutating the dict that is being iterated. Adding the new `mark.*` keys mid-iteration raises `RuntimeError: dictionary changed size during iteration`, breaking `load_data` for any transaction that carries measurements. The fix dedents the update to run once after the loop.

The change under review

diff (truncated — full diff)
diff --git a/src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsManager.tsx b/src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsManager.tsx
new file mode 100644
index 00000000000000..91414c6f289329
--- /dev/null
+++ b/src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsManager.tsx
@@ -0,0 +1,55 @@
+import React from 'react';
+
+export type MeasurementsManagerChildrenProps = {
+  hoveringMeasurement: (measurementName: string) => void;
+  notHovering: () => void;
+  currentHoveredMeasurement: string | undefined;
+};
+
+const MeasurementsManagerContext = React.createContext<MeasurementsManagerChildrenProps>({
+  hoveringMeasurement: () => {},
+  notHovering: () => {},
+  currentHoveredMeasurement: undefined,
+});
+
+type Props = {
+  children: React.ReactNode;
+};
+
+type State = {
+  currentHoveredMeasurement: string | undefined;
+};
+
+export class Provider extends React.Component<Props, State> {
+  state: State = {
+    currentHoveredMeasurement: undefined,
+  };
+
+  hoveringMeasurement = (measurementName: string) => {
+    this.setState({
+      currentHoveredMeasurement: measurementName,
+    });
+  };
+
+  notHovering = () => {
+    this.setState({
+      currentHoveredMeasurement: undefined,
+    });
+  };
+
+  render() {
+    const childrenProps = {
+      hoveringMeasurement: this.hoveringMeasurement,
+      notHovering: this.notHovering,
+      currentHoveredMeasurement: this.state.currentHoveredMeasurement,
+    };
+
+    return (
+      <MeasurementsManagerContext.Provider value={childrenProps}>
+        {this.props.children}
+      </MeasurementsManagerContext.Provider>
+    );
+  }
+}
+
+export const Consumer = MeasurementsManagerContext.Consumer;
diff --git a/src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx b/src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx
new file mode 100644
index 00000000000000..562bde06fc4d6f
--- /dev/null
+++ b/src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx
@@ -0,0 +1,168 @@
+import React from 'react';
+import styled from '@emotion/styled';
+
+import {SentryTransactionEvent} from 'app/types';
+import {defined} from 'app/utils';
+import {
+  WEB_VITAL_ACRONYMS,
+  LONG_WEB_VITAL_NAMES,
+} from 'app/views/performance/transactionVitals/constants';
+import Tooltip from 'app/components/tooltip';
+
+import {
+  getMeasurements,
+  toPercent,
+  getMeasurementBounds,
+  SpanBoundsType,
+  SpanGeneratedBoundsType,
+} from './utils';
+import * as MeasurementsManager from './measurementsManager';
+
+type Props = {
+  event: SentryTransactionEvent;
+  generateBounds: (bounds: SpanBoundsType) => SpanGeneratedBoundsType;
+  dividerPosition: number;
+};
+class MeasurementsPanel extends React.PureComponent<Props> {
+  render() {
+    const {event, generateBounds, dividerPosition} = this.props;
+
+    const measurements = getMeasurements(event);
+
+    return (
+      <Container
+        style={{
+          // the width of this component is shrunk to compensate for half of the width of the divider line
+          width: `calc(${toPercent(1 - dividerPosition)} - 0.5px)`,
+        }}
+      >
+        {Array.from(measurements).map(([timestamp, names]) => {
+          const bounds = getMeasurementBounds(timestamp, generateBounds);
+
+          const shouldDisplay = defined(bounds.left) && defined(bounds.width);
+
+          if (!shouldDisplay) {
+            return null;
+          }
+
+          const hoverMeasurementName = names.join('');
+
+          // generate vertical marker label
+          const acronyms = names.map(name => WEB_VITAL_ACRONYMS[name]);
+          const lastAcronym = acronyms.pop() as string;
+          const label = acronyms.length
+            ? `${acronyms.join(', ')} & ${lastAcronym}`
+            : lastAcronym;
+
+          // generate tooltip labe;l
+          const longNames = names.map(name => LONG_WEB_VITAL_NAMES[name]);
+          const lastName = longNames.pop() as string;
+          const tooltipLabel = longNames.length
+            ? `${longNames.join(', ')} & ${lastName}`
+            : lastName;
+
+          return (
+            <MeasurementsManager.Consumer key={String(timestamp)}>
+              {({hoveringMeasurement, notHovering}) => {
+                return (
+                  <LabelContainer
+                    key={label}
+                    label={label}
+                    tooltipLabel={tooltipLabel}
+                    left={toPercent(bounds.left || 0)}
+                    onMouseLeave={() => {
+                      notHovering();
+                    }}
+                    onMouseOver={() => {
+                      hoveringMeasurement(hoverMeasurementName);
+                    }}
+                  />
+                );
+              }}
+            </MeasurementsManager.Consumer>
+          );
+        })}
+      </Container>
+    );
+  }
+}
+
+const Container = styled('div')`
+  position: relative;
+  overflow: hidden;
+
+  height: 20px;
+`;
+
+const StyledLabelContainer = styled('div')`
+  position: absolute;
+  top: 0;
+  height: 100%;
+  user-select: none;
+`;
+
+const Label = styled('div')`
+  transform: translateX(-50%);
+  font-size: ${p => p.theme.fontSizeExtraSmall};
+`;
+
+export default MeasurementsPanel;
+
+type LabelContainerProps = {
+  left: string;
+  label: string;
+  tooltipLabel: string;
+  onMouseLeave: () => void;
+  onMouseOver: () => void;
+};
+
+type LabelContainerState = {
+  width: number;
+};
+
+class LabelContainer extends React.Component<LabelContainerProps> {
+  state: LabelContainerState = {
+    width: 1,
+  };
+
+  componentDidMount() {
+    const {current} = this.elementDOMRef;
+    if (current) {
+      // eslint-disable-next-line react/no-did-mount-set-state
+      this.setState({
+        width: current.clientWidth,
+      });
+    }
+  }
+
+  elementDOMRef = React.createRef<HTMLDivElement>();
+
+  render() {
+    const {left, onMouseLeave, onMouseOver, label, tooltipLabel} = this.props;
+
+    return (
+      <StyledLabelContainer
+        ref={this.elementDOMRef}
+        style={{
+          left: `clamp(calc(0.5 * ${this.state.width}px), ${left}, calc(100% - 0.5 * ${this.state.width}px))`,
+        }}
+        onMouseLeave={() => {
+          onMouseLeave();
+        }}
+        onMouseOver={() => {
+          onMouseOver();
+        }}
+      >
+        <Label>
+          <Tooltip
+            title={tooltipLabel}
+            position="top"
+            containerDisplayMode="inline-block"
+          >
+            {label}
+          </Tooltip>
+        </Label>
+      </StyledLabelContainer>
+    );
+  }
+}
diff --git a/src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx b/src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx
index 9614a70d139b44..c0b5f22faadfe3 100644
--- a/src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx
+++ b/src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx
@@ -16,6 +16,7 @@ import {
   toPercent,
   SpanBoundsType,
   SpanGeneratedBoundsType,
+  SpanViewBoundsType,
   getHumanDuration,
   getSpanID,
   getSpanOperation,
@@ -24,6 +25,8 @@ import {
   isOrphanTreeDepth,
   isEventFromBrowserJavaScriptSDK,
   durationlessBrowserOps,
+  getMeasurements,
+  getMeasurementBounds,
 } from './utils';
 import {ParsedTraceType, ProcessedSpanType, TreeDepthType} from './types';
 import {
@@ -31,9 +34,16 @@ import {
   MINIMAP_SPAN_BAR_HEIGHT,
   NUM_OF_SPANS_FIT_IN_MINI_MAP,
 } from './header';
-import {SPAN_ROW_HEIGHT, SpanRow, zIndex, getHatchPattern} from './styles';
+import {
+  SPAN_ROW_HEIGHT,
+  SPAN_ROW_PADDING,
+  SpanRow,
+  zIndex,
+  getHatchPattern,
+} from './styles';
 import * as DividerHandlerManager from './dividerHandlerManager';
 import * as CursorGuideHandler from './cursorGuideHandler';
+import * as MeasurementsManager from './measurementsManager';
 import SpanDetail from './spanDetail';
 
 // TODO: maybe use babel-plugin-preval
@@ -275,12 +285,7 @@ class SpanBar extends React.Component<SpanBarProps, SpanBarState> {
     );
   }
 
-  getBounds(): {
-    warning: undefined | string;
-    left: undefined | number;
-    width: undefined | number;
-    isSpanVisibleInView: boolean;
-  } {
+  getBounds(): SpanViewBoundsType {
     const {event, span, generateBounds} = this.props;
 
     const bounds = generateBounds({
@@ -345,6 +350,56 @@ class SpanBar extends React.Component<SpanBarProps, SpanBarState> {
     }
   }
 
+  renderMeasurements() {
+    const {organization, event, generateBounds} = this.props;
+
+    if (!organization.features.includes('measurements') || this.state.showDetail) {
+      return null;
+    }
+
+    const measurements = getMeasurements(event);
+
+    return (
+      <React.Fragment>
+        {Array.from(measurements).map(([timestamp, names]) => {
+          const bounds = getMeasurementBounds(timestamp, generateBounds);
+
+          const shouldDisplay = defined(bounds.left) && defined(bounds.width);
+
+          if (!shouldDisplay) {
+            return null;
+          }
+
+          const measurementName = names.join('');
+
+          return (
+            <MeasurementsManager.Consumer key={String(timestamp)}>
+              {({hoveringMeasurement, notHovering, currentHoveredMeasurement}) => {
+                return (
+                  <MeasurementMarker
+                    hovering={currentHoveredMeasurement === measurementName}
+                    style={{
+                      left: `clamp(0%, ${toPercent(bounds.left || 0)}, calc(100% - 1px))`,
+                    }}
+                    onMouseEnter={() => {
+                      hoveringMeasurement(measurementName);
+                    }}
+                    onMouseLeave={() => {
+                      notHovering();
+                    }}
+                    onMouseOver={() => {
+                      hoveringMeasurement(measurementName);
+                    }}
+                  />
+                );
+              }}
+            </MeasurementsManager.Consumer>
+          );
+        })}
+      </React.Fragment>
+    );
+  }
+
   renderSpanTreeConnector({hasToggler}: {hasToggler: boolean}) {
     const {
       isLast,
@@ -788,7 +843,7 @@ class SpanBar extends React.Component<SpanBarProps, SpanBarState> {
               spanBarHatch={!!spanBarHatch}
               style={{
                 backgroundColor: spanBarColour,
-                left: toPercent(bounds.left || 0),
+                left: `clamp(0%, ${toPercent(bounds.left || 0)}, calc(100% - 1px))`,
                 width: toPercent(bounds.width || 0),
               }}
             >
@@ -802,6 +857,7 @@ class SpanBar extends React.Component<SpanBarProps, SpanBarState> {
               </DurationPill>
             </SpanBarRectangle>
           )}
+          {this.renderMeasurements()}
           {this.renderCursorGuide()}
         </SpanRowCell>
         {!this.state.showDetail && (
@@ -862,7 +918,6 @@ type SpanRowCellProps = OmitHtmlDivProps<{
 
 export const SpanRowCell = styled('div')<SpanRowCellProps>`
   position: relative;
-  padding: ${space(0.5)} 1px;
   height: 100%;
   overflow: hidden;
   background-color: ${p => getBackgroundColor(p)};
@@ -1101,15 +1156,41 @@ const DurationPill = styled('div')<{
 `;
 
 export const SpanBarRectangle = styled('div')<{spanBarHatch: boolean}>`
-  position: relative;
-  height: 100%;
+  position: absolute;
+  height: ${SPAN_ROW_HEIGHT - 2 * SPAN_ROW_PADDING}px;
+  top: ${SPAN_ROW_PADDING}px;
+  left: 0;
   min-width: 1px;
   user-select: none;
   transition: border-color 0.15s ease-in-out;
-  border-right: 1px solid rgba(0, 0, 0, 0);
   ${p => getHatchPattern(p, '#dedae3', '#f4f2f7')}
 `;
 
+const MeasurementMarker = styled('div')<{hovering: boolean}>`
+  position: absolute;
+  top: 0;
+  height: ${SPAN_ROW_HEIGHT}px;
+  width: 1px;
+  user-select: none;
+  background-color: ${p => p.theme.gray800};
+
+  transition: opacity 125ms ease-in-out;
+  z-index: ${zIndex.dividerLine};
+
+  /* enhanced hit-box */
+  &:after {
+    content: '';
+    z-index: -1;
+    position: absolute;
+    left: -2px;
+    top: 0;
+    width: 9px;
+    height: 100%;
+  }
+
+  opacity: ${({hovering}) => (hovering ? '1' : '0.25')};
+`;
+
 const StyledIconWarning = styled(IconWarning)`
   margin-left: ${space(0.25)};
   margin-bottom: ${space(0.25)};
diff --git a/src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx b/src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx
index 4ecdfae2b4ec06..dfad9343aa82d2 100644
--- a/src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx
+++ b/src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx
@@ -26,6 +26,7 @@ import {
   isGapSpan,
   isOrphanSpan,
   isEventFromBrowserJavaScriptSDK,
+  toPercent,
 } from './utils';
 import {DragManagerChildrenProps} from './dragManager';
 import SpanGroup from './spanGroup';
@@ -33,6 +34,8 @@ import {SpanRowMessage} from './styles';
 import * as DividerHandlerManager from './dividerHandlerManager';
 import {FilterSpans} from './traceView';
 import {ActiveOperationFilter} from './filter';
+import MeasurementsPanel from './measurementsPanel';
+import * as MeasurementsManager from './measurementsManager';
 
 type RenderedSpanTree = {
   spanTree: JSX.Element | null;
@@ -331,17 +334,23 @@ class SpanTree extends React.Component<PropType> {
     };
   };
 
-  renderRootSpan = (): RenderedSpanTree => {
+  generateBounds() {
     const {dragProps, trace} = this.props;
 
-    const rootSpan: RawSpanType = generateRootSpan(trace);
-
-    const generateBounds = boundsGenerator({
+    return boundsGenerator({
       traceStartTimestamp: trace.traceStartTimestamp,
       traceEndTimestamp: trace.traceEndTimestamp,
       viewStart: dragProps.viewWindowStart,
       viewEnd: dragProps.viewWindowEnd,
     });
+  }
+
+  renderRootSpan = (): RenderedSpanTree => {
+    const {trace} = this.props;
+
+    const rootSpan: RawSpanType = generateRootSpan(trace);
+
+    const generateBounds = this.generateBounds();
 
     return this.renderSpan({
       isRoot: true,
@@ -358,6 +367,48 @@ class SpanTree extends React.Component<PropType> {
     });
   };
 
+  renderSecondaryPanel() {
+    const {organization, event} = this.props;
+
+    if (!organization.features.includes('measurements')) {
+      return null;
+    }
+
+    const hasMeasurements = Object.keys(event.measurements ?? {}).length > 0;
+
+    // only display the secondary header if there are any measurements
+    if (!hasMeasurements) {
+      return null;
+    }
+
+    return (
+      <DividerHandlerManager.Consumer>
+        {(
+          dividerHandlerChildrenProps: DividerHandlerManager.DividerHandlerManagerChildrenProps
+        ) => {
+          const {dividerPosition} = dividerHandlerChildrenProps;
+
+          return (
+            <SecondaryHeader>
+              <div
+                style={{
+                  // the width of this component is shrunk to compensate for half of the width of the divider line
+                  width: `calc(${toPercent(dividerPosition)} - 0.5px)`,
+                }}
+              />
+              <DividerSpacer />
+              <MeasurementsPanel
+                event={event}

Leaderboard for this case

medium · 5 of 9 bots fully caught it (56% solve rate) · 72% avg coverage.

#BotResultCaughtCoverageFindingsFalse alarms
1 Claude Code (Opus 5.5) solved 2/2 100.0% 5 0
2 Cubic solved 2/2 100.0% 7 0
3 cursor solved 2/2 100.0% 3 0
4 Drape (Deep Review) solved 2/2 100.0% 6 0
5 Mjolnir (Opus 5.5) solved 2/2 100.0% 4 0
6 Drape (Review) partial 1/2 80.0% 5 0
7 greptile partial 1/2 80.0% 4 0
8 Mjolnir (Sonnet 5.5) partial 1/2 80.0% 3 0
9 qodo miss 0/2 0.0% 0 0

Bot results

Claude Code (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✓ off by one
d2 high ✓ exact
valid · matches d2 · impact high
valid · matches d1 · impact low
valid · impact low
The only display check is `defined(bounds.left) && defined(bounds.width)`, and isSpanVisibleInView is never used. When the user zooms in, a marker whose timestamp is outside the window gets a left value below 0 or above 1. The clamp then pins it to the edge of the row, and the panel labels are clamped the same way, so the marker looks like it happened at the edge. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
getMeasurements keeps every `mark.*` key, but the label lookup tables only hold known vital slugs. An unknown mark therefore gets an undefined label and tooltip. A single unknown mark renders as an empty label. When it shares a timestamp with other marks, the template string produces the literal text "undefined". [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
Joining with no separator can make two different name groups produce the same hover key. With the known vital slugs no collision happens, but any arbitrary `mark.*` name is accepted, so a collision is possible in principle. That makes this low impact. [grounded: diff] [consensus 3/3: valid=3]
raw comments (5)
src/sentry/utils/samples.py:212
`measurements.update(measurement_markers)` runs inside `for key, entry in measurements.items()`. On Python 3, which this repo supports (3.6), `items()` is a live view, so adding the `mark.*` keys while iterating raises `RuntimeError: dictionary changed size during iteration`. Any `load_data()` call for a transaction sample with fp/fcp/lcp/fid measurements (for example the bundled transaction.json) will crash. The update also runs on every iteration. It should run once, after the loop finishes, or the loop should iterate over `list(measurements.items())`.
src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:846
The span bar's `left` is now `clamp(0%, left, 100% - 1px)` but `width` is unchanged. When the view is zoomed and a span starts before the view window (negative left), the bar is moved to 0% yet keeps its full width, so it reaches further right than its real end time. Spans that start after the window are pinned at the right edge instead of being hidden. Before this change, a negative left with `overflow: hidden` drew the bar correctly.
src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:382
Measurement markers ignore `bounds.isSpanVisibleInView` and clamp `left` to [0%, 100%-1px]. When a user zooms into a sub-range of the trace, markers whose timestamps fall outside the window are drawn at the left or right edge as if they happened there, which misleads the user. The header labels in measurementsPanel have the same problem, since they are also clamped.
src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:50
Any `mark.*` measurement is rendered, but labels come from `WEB_VITAL_ACRONYMS` and `LONG_WEB_VITAL_NAMES`, which only contain known web vitals. A custom or unknown mark (for example `mark.foo`) gets an `undefined` label and tooltip, so the header shows the text "undefined".
src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:48
The hover key is built with `names.join('')`, which has no separator. Different groups of names can produce the same string (for example ['fc','p'] and ['f','cp']), so hovering one marker would highlight the wrong ones. A separator should be used, or the timestamp itself as the key.
Cubic · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✓ off by one
d2 high ✓ exact
valid · matches d2 · impact high
valid · impact low
getMeasurements accepts any `mark.*` key, but the acronym and long-name maps only cover the seven web-vital slugs. There is no fallback or guard, so an unknown mark name renders as 'undefined' in the label and tooltip. [grounded: diff] [consensus 5/5: valid=5]
valid · impact low
compare/spanDetail.tsx uses the shared SpanBarRectangle inside a 16px SpanBarContainer. Its inline style sets position absolute and height 16px but not `top`, so the new 4px `top` shifts the bar down and it overflows the container. [grounded: diff] [consensus 5/5: valid=5]
valid · matches d1 · impact low
minor
This is a refactoring and duplication suggestion. It does not claim any current misbehaviour. [consensus 5/5: minor=5]
minor
This is a duplication and refactoring suggestion. Both copies compute the same key today, so nothing is broken now. [consensus 5/5: minor=5]
valid · impact low
The gate counts all measurement keys, but MeasurementsPanel only renders `mark.*` entries. An event with only lcp/fcp-style measurements therefore shows an empty secondary header. [grounded: diff] [consensus 5/5: valid=5]
raw comments (8)
src/sentry/utils/samples.py:212
<!-- cubic:v=03398ce4-c9b8-428f-a6fe-f05e8276abac --> <!-- cubic:review-run=06689e7d-6cdf-5488-a3fe-d72ca4a0588e --> <!-- metadata:{"confidence":9} --> P1: `measurements.update(measurement_markers)` is indented inside the `for` loop, so it mutates `measurements` while `measurements.items()` is being iterated. On Python 3 this raises `RuntimeError: dictionary changed size during iteration` as soon as a transaction sample with `fp`/`fcp`/`lcp`/`fid` is loaded (starter event on project creation, Test Configuration, `bin/load-mocks`, acceptance tests). Dedent the `update` so it runs once after the loop. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/sentry/utils/samples.py, line 212: <comment>`measurements.update(measurement_markers)` is indented inside the `for` loop, so it mutates `measurements` while `measurements.items()` is being iterated. On Python 3 this raises `RuntimeError: dictionary changed size during iteration` as soon as a transaction sample with `fp`/`fcp`/`lcp`/`fid` is loaded (starter event on project creation, Test Configuration, `bin/load-mocks`, acceptance tests). Dedent the `update` so it runs once after the loop.</comment> <file context> @@ -200,6 +200,17 @@ def load_data( + measurement_markers["mark.{}".format(key)] = { + "value": data["start_timestamp"] + entry["value"] / 1000 + } + measurements.update(measurement_markers) + data["platform"] = platform </file context> ``` </details> ```suggestion measurements.update(measurement_markers) ```
src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:61
<!-- cubic:v=ab2decd0-09e3-4c08-908c-272047801a34 --> <!-- cubic:review-run=06689e7d-6cdf-5488-a3fe-d72ca4a0588e --> <!-- metadata:{"confidence":6} --> P2: A `mark.*` measurement whose name is not one of the seven web vitals makes both map lookups return `undefined`, so the label and tooltip render literal 'undefined' (e.g. 'undefined & LCP'). `realUserMonitoring.tsx:57` guards the same lookups with `hasOwnProperty`; this panel does not. Fall back to the raw name in both maps (`WEB_VITAL_ACRONYMS[name] ?? name`), or skip unknown names. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx, line 51: <comment>A `mark.*` measurement whose name is not one of the seven web vitals makes both map lookups return `undefined`, so the label and tooltip render literal 'undefined' (e.g. 'undefined & LCP'). `realUserMonitoring.tsx:57` guards the same lookups with `hasOwnProperty`; this panel does not. Fall back to the raw name in both maps (`WEB_VITAL_ACRONYMS[name] ?? name`), or skip unknown names.</comment> <file context> @@ -0,0 +1,168 @@ + const hoverMeasurementName = names.join(''); + + // generate vertical marker label + const acronyms = names.map(name => WEB_VITAL_ACRONYMS[name]); + const lastAcronym = acronyms.pop() as string; + const label = acronyms.length </file context> ``` </details> ```suggestion const acronyms = names.map(name => WEB_VITAL_ACRONYMS[name] ?? name); const lastAcronym = acronyms.pop() as string; const label = acronyms.length ? `${acronyms.join(', ')} & ${lastAcronym}` : lastAcronym; // generate tooltip label const longNames = names.map(name => LONG_WEB_VITAL_NAMES[name] ?? name); const lastName = longNames.pop() as string; const tooltipLabel = longNames.length ? `${longNames.join(', ')} & ${lastName}` : lastName; ```
src/sentry/static/sentry/app/views/performance/compare/styles.tsx:11
<!-- cubic:v=fbbfb6c0-a88f-458e-8c5d-33e8aa42d273 --> <!-- cubic:review-run=06689e7d-6cdf-5488-a3fe-d72ca4a0588e --> <!-- metadata:{"confidence":6} --> P2: The added `top: ${SPAN_ROW_PADDING}px` on the shared SpanBarRectangle also applies to the usage in compare/spanDetail.tsx, where the bar is absolutely positioned at height 16px inside SpanBarContainer, which is only 16px tall. The bar is now pushed down 4px and overflows the container by 4px, whereas before (height: 100%, no top) it filled the container exactly. Override `top: 0` in spanDetail.tsx's inline style or size that container to 24px so the bars stay inside. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/sentry/static/sentry/app/views/performance/compare/styles.tsx, line 11: <comment>The added `top: ${SPAN_ROW_PADDING}px` on the shared SpanBarRectangle also applies to the usage in compare/spanDetail.tsx, where the bar is absolutely positioned at height 16px inside SpanBarContainer, which is only 16px tall. The bar is now pushed down 4px and overflows the container by 4px, whereas before (height: 100%, no top) it filled the container exactly. Override `top: 0` in spanDetail.tsx's inline style or size that container to 24px so the bars stay inside.</comment> <file context> @@ -1,8 +1,14 @@ position: relative; - height: 100%; + height: ${SPAN_ROW_HEIGHT - 2 * SPAN_ROW_PADDING}px; + top: ${SPAN_ROW_PADDING}px; min-width: 1px; user-select: none; </file context> ``` </details>
src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:382
<!-- cubic:v=ae68fbb0-45b3-4866-8977-9f78712ddbcb --> <!-- cubic:review-run=06689e7d-6cdf-5488-a3fe-d72ca4a0588e --> <!-- metadata:{"confidence":7} --> P2: When a span starts before the visible view window, `bounds.left` is negative and the new clamp moves the bar's left edge to 0% while `width` stays `bounds.width`. The bar's right edge becomes `0 + width` instead of the true `left + width`, so it renders longer than the span actually is. Keep the visible width consistent with the clamped left, e.g. clamp the left and subtract the clipped portion from the width. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx, line 382: <comment>When a span starts before the visible view window, `bounds.left` is negative and the new clamp moves the bar's left edge to 0% while `width` stays `bounds.width`. The bar's right edge becomes `0 + width` instead of the true `left + width`, so it renders longer than the span actually is. Keep the visible width consistent with the clamped left, e.g. clamp the left and subtract the clipped portion from the width.</comment> <file context> @@ -345,6 +350,56 @@ class SpanBar extends React.Component<SpanBarProps, SpanBarState> { + <MeasurementMarker + hovering={currentHoveredMeasurement === measurementName} + style={{ + left: `clamp(0%, ${toPercent(bounds.left || 0)}, calc(100% - 1px))`, + }} + onMouseEnter={() => { </file context> ``` </details>
src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:652
<!-- cubic:v=501874e3-4a65-418d-b120-1ada698bf98d --> <!-- cubic:review-run=06689e7d-6cdf-5488-a3fe-d72ca4a0588e --> <!-- metadata:{"confidence":5} --> P3: getMeasurementBounds repeats the five-case switch from spanBar.tsx getBounds(), producing the same left/width for every bounds type and only dropping the warning text. Extract the shared left/width mapping into one helper used by both call sites so the two copies cannot drift when SpanGeneratedBoundsType changes. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx, line 652: <comment>getMeasurementBounds repeats the five-case switch from spanBar.tsx getBounds(), producing the same left/width for every bounds type and only dropping the warning text. Extract the shared left/width mapping into one helper used by both call sites so the two copies cannot drift when SpanGeneratedBoundsType changes.</comment> <file context> @@ -609,3 +616,85 @@ export function isEventFromBrowserJavaScriptSDK(event: SentryTransactionEvent): + return mergedMeasurements; +} + +export function getMeasurementBounds( + timestamp: number, + generateBounds: (bounds: SpanBoundsType) => SpanGeneratedBoundsType </file context> ``` </details>
src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:48
<!-- cubic:v=c0567d94-4af6-4131-aff1-712c7626c06a --> <!-- cubic:review-run=06689e7d-6cdf-5488-a3fe-d72ca4a0588e --> <!-- metadata:{"confidence":7} --> P3: This render loop and the `names.join('')` hover key duplicate `spanBar.tsx:363-400`; the two markers highlight together only while both files compute the same key. Extract the measurement iteration and the hover-key helper into `./utils` and use it in both places. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx, line 48: <comment>This render loop and the `names.join('')` hover key duplicate `spanBar.tsx:363-400`; the two markers highlight together only while both files compute the same key. Extract the measurement iteration and the hover-key helper into `./utils` and use it in both places.</comment> <file context> @@ -0,0 +1,168 @@ + return null; + } + + const hoverMeasurementName = names.join(''); + + // generate vertical marker label </file context> ``` </details>
src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx:377
<!-- cubic:v=ca8d6791-5869-4c2d-ae42-ac2ceb1f415b --> <!-- cubic:review-run=06689e7d-6cdf-5488-a3fe-d72ca4a0588e --> <!-- metadata:{"confidence":5} --> P3: This gate counts every measurement key, but the panel only renders `mark.*` measurements, so a transaction with only non-mark measurements (e.g. `lcp`, `fcp`) shows an empty 20px gray `SecondaryHeader` with no markers. Gate on mark-prefixed measurements instead. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx, line 377: <comment>This gate counts every measurement key, but the panel only renders `mark.*` measurements, so a transaction with only non-mark measurements (e.g. `lcp`, `fcp`) shows an empty 20px gray `SecondaryHeader` with no markers. Gate on mark-prefixed measurements instead.</comment> <file context> @@ -358,6 +367,48 @@ class SpanTree extends React.Component<PropType> { + return null; + } + + const hasMeasurements = Object.keys(event.measurements ?? {}).length > 0; + + // only display the secondary header if there are any measurements </file context> ``` </details> ```suggestion const hasMeasurements = Object.keys(event.measurements ?? {}).some(name => name.startsWith('mark.') ); ```
PR-level
<!-- cubic:review-summary:start --> **7 issues found** across 14 files <!-- cubic:review-summary:end --> <details> <summary>Prompt for AI agents (unresolved issues)</summary> ```text Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately. <file name="src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx"> <violation number="1" location="src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:652"> P3: getMeasurementBounds repeats the five-case switch from spanBar.tsx getBounds(), producing the same left/width for every bounds type and only dropping the warning text. Extract the shared left/width mapping into one helper used by both call sites so the two copies cannot drift when SpanGeneratedBoundsType changes.</violation> </file> <file name="src/sentry/utils/samples.py"> <violation number="1" location="src/sentry/utils/samples.py:212"> P1: `measurements.update(measurement_markers)` is indented inside the `for` loop, so it mutates `measurements` while `measurements.items()` is being iterated. On Python 3 this raises `RuntimeError: dictionary changed size during iteration` as soon as a transaction sample with `fp`/`fcp`/`lcp`/`fid` is loaded (starter event on project creation, Test Configuration, `bin/load-mocks`, acceptance tests). Dedent the `update` so it runs once after the loop.</violation> </file> <file name="src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx"> <violation number="1" location="src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:48"> P3: This render loop and the `names.join('')` hover key duplicate `spanBar.tsx:363-400`; the two markers highlight together only while both files compute the same key. Extract the measurement iteration and the hover-key helper into `./utils` and use it in both places.</violation> <violation number="2" location="src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:51"> P2: A `mark.*` measurement whose name is not one of the seven web vitals makes both map lookups return `undefined`, so the label and tooltip render literal 'undefined' (e.g. 'undefined & LCP'). `realUserMonitoring.tsx:57` guards the same lookups with `hasOwnProperty`; this panel does not. Fall back to the raw name in both maps (`WEB_VITAL_ACRONYMS[name] ?? name`), or skip unknown names.</violation> </file> <file name="src/sentry/static/sentry/app/views/performance/compare/styles.tsx"> <violation number="1" location="src/sentry/static/sentry/app/views/performance/compare/styles.tsx:11"> P2: The added `top: ${SPAN_ROW_PADDING}px` on the shared SpanBarRectangle also applies to the usage in compare/spanDetail.tsx, where the bar is absolutely positioned at height 16px inside SpanBarContainer, which is only 16px tall. The bar is now pushed down 4px and overflows the container by 4px, whereas before (height: 100%, no top) it filled the container exactly. Override `top: 0` in spanDetail.tsx's inline style or size that container to 24px so the bars stay inside.</violation> </file> <file name="src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx"> <violation number="1" location="src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx:377"> P3: This gate counts every measurement key, but the panel only renders `mark.*` measurements, so a transaction with only non-mark measurements (e.g. `lcp`, `fcp`) shows an empty 20px gray `SecondaryHeader` with no markers. Gate on mark-prefixed measurements instead.</violation> </file> <file name="src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx"> <violation number="1" location="src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:382"> P2: When a span starts before the visible view window, `bounds.left` is negative and the new clamp moves the bar's left edge to 0% while `width` stays `bounds.width`. The bar's right edge becomes `0 + width` instead of the true `left + width`, so it renders longer than the span actually is. Keep the visible width consistent with the clamped left, e.g. clamp the left and subtract the clipped portion from the width.</violation> </file> ``` </details> <sub>Reply with feedback, questions, or to request a fix.<br /><br />[Re-trigger cubic](https://www.cubic.dev/action/re-review/pr/drape-io/crbench-cubic-2026-09/72/ai_pr_review_github_delivery_1b90c1a766b7fd094aa61bcec0cc5ed8e70accc1f6941d09aec3b86e0eda61f3?returnTo=https%3A%2F%2Fgithub.com%2Fdrape-io%2Fcrbench-cubic-2026-09%2Fpull%2F72)</sub> <!-- cubic:review-post:ai_pr_review_github_delivery_1b90c1a766b7fd094aa61bcec0cc5ed8e70accc1f6941d09aec3b86e0eda61f3:a3fd091e234a4c49dc678511290a25d69a5e5784:06689e7d-6cdf-5488-a3fe-d72ca4a0588e -->
cursor · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✓ wrong severity
d2 high ✓ off by one
valid · matches d1 · impact low
valid · impact low
Both renderMeasurements and MeasurementsPanel display a marker whenever left and width are defined, without checking isSpanVisibleInView. When the user zooms, getMeasurementBounds can return a start below 0 or above 1. The CSS clamp then pins the marker or label to the edge of the view instead of hiding it, so overflow:hidden does not hide it either. [grounded: diff] [consensus 5/5: valid=5]
valid · matches d2 · impact high
raw comments (4)
src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:846
### Span bars distort when zoomed **High Severity** <!-- DESCRIPTION START --> Clamping `left` to a minimum of `0%` without shrinking `width` misplaces span bars that start before the current view. Overflow previously clipped the off-screen portion; now those bars start at the left edge and look longer than they are, so zoomed waterfall timing is wrong. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: 671ebcc3-4b13-4594-a66b-251f8d323fbd --> <!-- LOCATIONS START src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx#L845-L846 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjZhYjNjMmU1LWZjN2YtNDE5ZC04MTQ5LTI5OGIxMmVjZTFmNyIsImVuY3J5cHRpb25LZXkiOiIyemVaaktaQm84cGhWYWtNWEN1c0E2WERndXFCRFZOT05MRDZ2SnJtT0V3IiwiYnJhbmNoIjoidDItc2VudHJ5LTIxMzM2IiwicmVwb093bmVyIjoiZHJhcGUtaW8iLCJyZXBvTmFtZSI6ImNyYmVuY2gtY3Vyc29yLTIwMjYtMDkiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjZhYjNjMmU1LWZjN2YtNDE5ZC04MTQ5LTI5OGIxMmVjZTFmNyIsImVuY3J5cHRpb25LZXkiOiIyemVaaktaQm84cGhWYWtNWEN1c0E2WERndXFCRFZOT05MRDZ2SnJtT0V3IiwiYnJhbmNoIjoidDItc2VudHJ5LTIxMzM2IiwicmVwb093bmVyIjoiZHJhcGUtaW8iLCJyZXBvTmFtZSI6ImNyYmVuY2gtY3Vyc29yLTIwMjYtMDkiLCJwck51bWJlciI6NzQsImNvbW1pdFNoYSI6ImYwY2M3ZGQ2MDY4NzUxZDEwMDkyYjBkYzg3N2IwNDI3ODFkODQzNDgiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f0cc7dd6068751d10092b0dc877b042781d84348. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:382
### Out-of-view markers stay on screen **Medium Severity** <!-- DESCRIPTION START --> Measurement markers and labels are shown whenever `left` and `width` are defined, and they ignore `isSpanVisibleInView`. Combined with CSS `clamp`, marks outside the zoomed window stick to the left or right edge instead of hiding, so the waterfall and header labels no longer match the visible time range. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: 203ba32d-718d-47ea-8a36-cb5934941c9e --> <!-- LOCATIONS START src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx#L366-L382 src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx#L41-L72 LOCATIONS END --> <details> <summary>Additional Locations (1)</summary> - [`src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx#L41-L72`](https://github.com/drape-io/crbench-cursor-2026-09/blob/f0cc7dd6068751d10092b0dc877b042781d84348/src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx#L41-L72) </details> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjY3ZjI3YzI0LWY1YmMtNDIyZC04NDAyLTQ5ZmI5YWFmNWJkYiIsImVuY3J5cHRpb25LZXkiOiJyTnVJZ1NucnFkVU12X0FlTldhZDNTRjd6MGczMS1wVW5STUZ1cHpuU2VRIiwiYnJhbmNoIjoidDItc2VudHJ5LTIxMzM2IiwicmVwb093bmVyIjoiZHJhcGUtaW8iLCJyZXBvTmFtZSI6ImNyYmVuY2gtY3Vyc29yLTIwMjYtMDkiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjY3ZjI3YzI0LWY1YmMtNDIyZC04NDAyLTQ5ZmI5YWFmNWJkYiIsImVuY3J5cHRpb25LZXkiOiJyTnVJZ1NucnFkVU12X0FlTldhZDNTRjd6MGczMS1wVW5STUZ1cHpuU2VRIiwiYnJhbmNoIjoidDItc2VudHJ5LTIxMzM2IiwicmVwb093bmVyIjoiZHJhcGUtaW8iLCJyZXBvTmFtZSI6ImNyYmVuY2gtY3Vyc29yLTIwMjYtMDkiLCJwck51bWJlciI6NzQsImNvbW1pdFNoYSI6ImYwY2M3ZGQ2MDY4NzUxZDEwMDkyYjBkYzg3N2IwNDI3ODFkODQzNDgiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f0cc7dd6068751d10092b0dc877b042781d84348. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
src/sentry/utils/samples.py:212
### Dict updated while iterating **Medium Severity** <!-- DESCRIPTION START --> `measurements.update(measurement_markers)` sits inside the `for` loop that iterates `measurements.items()`. The separate `measurement_markers` dict is there so the original mapping is not mutated during iteration, but the update still runs on every pass. On Python 3 this raises `RuntimeError` and sample transaction generation fails. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: 077a5fb7-da3d-44bc-82a9-73900d6c8804 --> <!-- LOCATIONS START src/sentry/utils/samples.py#L206-L212 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90Ojc0NzdlN2YwLWY2YmUtNGI0Yi1hZDI5LTk2NDdlNGY2MDllOCIsImVuY3J5cHRpb25LZXkiOiJYRjVoYVhsbEpURU1vU2FNVFJTX3hFRVl2UkJINkViVVFTZzZqY2VMN3VzIiwiYnJhbmNoIjoidDItc2VudHJ5LTIxMzM2IiwicmVwb093bmVyIjoiZHJhcGUtaW8iLCJyZXBvTmFtZSI6ImNyYmVuY2gtY3Vyc29yLTIwMjYtMDkiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90Ojc0NzdlN2YwLWY2YmUtNGI0Yi1hZDI5LTk2NDdlNGY2MDllOCIsImVuY3J5cHRpb25LZXkiOiJYRjVoYVhsbEpURU1vU2FNVFJTX3hFRVl2UkJINkViVVFTZzZqY2VMN3VzIiwiYnJhbmNoIjoidDItc2VudHJ5LTIxMzM2IiwicmVwb093bmVyIjoiZHJhcGUtaW8iLCJyZXBvTmFtZSI6ImNyYmVuY2gtY3Vyc29yLTIwMjYtMDkiLCJwck51bWJlciI6NzQsImNvbW1pdFNoYSI6ImYwY2M3ZGQ2MDY4NzUxZDEwMDkyYjBkYzg3N2IwNDI3ODFkODQzNDgiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f0cc7dd6068751d10092b0dc877b042781d84348. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
PR-level
<!-- BUGBOT_REVIEW --> Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues. <!-- BUGBOT_FIX_ALL --> <a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTozOThmYzcwZC0yNWU2LTRkYTUtYjk1MC1kMjBhYzJlOWI3ZDYiLCJlbmNyeXB0aW9uS2V5IjoieHYzY3FyTEZqV09xMUFGWTN2MW9RX29saDJQd2VJYzFFV1dQQnczOXhTTSIsImJyYW5jaCI6InQyLXNlbnRyeS0yMTMzNiIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <!-- /BUGBOT_FIX_ALL --> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN --> <sup>❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).</sup> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END --> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f0cc7dd6068751d10092b0dc877b042781d84348. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
Drape (Deep Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✓ off by one
d2 high ✓ exact
valid · impact low
The only check is that left and width are defined, and isSpanVisibleInView is never consulted. When zoomed in, a mark outside the window has left < 0 or > 1, and the clamp pins its marker to the row edge, so it shows on every row. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
MeasurementsPanel never checks isSpanVisibleInView. The LabelContainer clamp forces labels for marks outside the window to the panel edges, so they look like they are inside the view. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d2 · impact high
valid · impact low
getMeasurements keeps every key that starts with 'mark.', with no filter for known slugs. Any slug not in WEB_VITAL_DETAILS gets undefined from the lookups, so the label and tooltip read 'undefined'. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d1 · impact low
valid · impact low
The shared compare SpanBarRectangle now has top: 4px. spanDetail's SpanBars sets position absolute and height 16px inline but never overrides top, so the bars sit 4px low in their 16px container. [grounded: diff] [consensus 3/3: valid=3]
raw comments (6)
src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:383
**Off-screen vital markers stuck to row edges** `renderMeasurements` never checks `isSpanVisibleInView`, and it clamps `left` to 0%..100%. When zoomed in, a marker whose time is outside the window is drawn at the left or right edge of every row. Skip markers when `bounds.isSpanVisibleInView` is false. ``` src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:367 const shouldDisplay = defined(bounds.left) && defined(bounds.width); src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:369 if (!shouldDisplay) { src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:370 return null; src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:371 } src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:217 const isSpanVisibleInView = end > 0 && start < 1; src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:219 switch (timestampStatus) { src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:220 case TimestampStatus.Equal: { src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:221 return { src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:222 type: 'TIMESTAMPS_EQUAL', src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:223 start, ```
src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:42
**Off-screen vital labels shown at panel edges** The panel shows a label whenever left/width are defined and never checks `isSpanVisibleInView`. When zoomed in, labels for marks outside the window get clamped to the panel's edges, which makes them look like they're inside it. Return null when `bounds.isSpanVisibleInView` is false. ``` src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:40 const bounds = getMeasurementBounds(timestamp, generateBounds); src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:42 const shouldDisplay = defined(bounds.left) && defined(bounds.width); src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:44 if (!shouldDisplay) { src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:45 return null; src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:220 case TimestampStatus.Equal: { src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:221 return { src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:222 type: 'TIMESTAMPS_EQUAL', src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:223 start, src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:224 width: 1, src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:225 // a span bar is visible even if they're at the extreme ends of the view selection. ```
src/sentry/utils/samples.py:212
**Sample transaction loading crashes on Python 3** `measurements.update(...)` sits inside the loop over `measurements.items()`, so the dict gains `mark.*` keys while it is being iterated. On Python 3 this raises "dictionary changed size during iteration" as soon as `fp` has been handled. Move `measurements.update(measurement_markers)` out of the for loop, after it. ``` src/sentry/utils/samples.py:203 measurements = data.get("measurements") src/sentry/utils/samples.py:205 if measurements: src/sentry/utils/samples.py:206 measurement_markers = {} src/sentry/utils/samples.py:207 for key, entry in measurements.items(): src/sentry/utils/samples.py:208 if key in ["fp", "fcp", "lcp", "fid"]: src/sentry/utils/samples.py:209 measurement_markers["mark.{}".format(key)] = { src/sentry/utils/samples.py:210 "value": data["start_timestamp"] + entry["value"] / 1000 src/sentry/utils/samples.py:211 } src/sentry/utils/samples.py:212 measurements.update(measurement_markers) src/sentry/data/samples/transaction.json:175 "fp": { ```
src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:51
**Custom marks labelled "undefined"** A `mark.*` key that is not a known web-vital slug (e.g. `mark.foo`) has no entry in WEB_VITAL_ACRONYMS or LONG_WEB_VITAL_NAMES, so its marker label and tooltip read "undefined". Fall back to the raw mark name when the lookup misses. ``` src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:51 const acronyms = names.map(name => WEB_VITAL_ACRONYMS[name]); src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:52 const lastAcronym = acronyms.pop() as string; src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:53 const label = acronyms.length src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:54 ? `${acronyms.join(', ')} & ${lastAcronym}` src/sentry/static/sentry/app/views/performance/transactionVitals/constants.tsx:96 export const WEB_VITAL_ACRONYMS = Object.fromEntries( src/sentry/static/sentry/app/views/performance/transactionVitals/constants.tsx:97 Object.values(WEB_VITAL_DETAILS).map(value => { src/sentry/static/sentry/app/views/performance/transactionVitals/constants.tsx:98 return [value.slug, value.acronym]; src/sentry/static/sentry/app/views/performance/transactionVitals/constants.tsx:99 }) src/sentry/static/sentry/app/views/performance/transactionVitals/constants.tsx:100 ); ```
src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:846
**Zoomed-in span bars extend past their real end** When zoomed in, a span that starts before the view window gets a negative `left`. The clamp pins it to 0% but keeps the full `width`, so the bar ends too late. Don't clamp span-bar `left` (overflow is already hidden), or subtract the clamped amount from `width`. ``` src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:846 left: `clamp(0%, ${toPercent(bounds.left || 0)}, calc(100% - 1px))`, src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:214 const start = (startTimestamp - viewStartTimestamp) / viewDuration; src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:215 const end = (endTimestamp - viewStartTimestamp) / viewDuration; ```
src/sentry/static/sentry/app/views/performance/compare/styles.tsx:11
**Comparison detail bars shifted down 4px** The shared `SpanBarRectangle` now has a 4px `top` offset. The span detail view places it absolutely inside a 16px container and overrides only height, so its bars sit 4px low and spill out of the container. Override `top: 0` in spanDetail, or put the offset only on the row bar. ``` src/sentry/static/sentry/app/views/performance/compare/styles.tsx:10 height: ${SPAN_ROW_HEIGHT - 2 * SPAN_ROW_PADDING}px; src/sentry/static/sentry/app/views/performance/compare/styles.tsx:11 top: ${SPAN_ROW_PADDING}px; src/sentry/static/sentry/app/views/performance/compare/spanDetail.tsx:268 const SpanBarContainer = styled('div')` src/sentry/static/sentry/app/views/performance/compare/spanDetail.tsx:269 position: relative; src/sentry/static/sentry/app/views/performance/compare/spanDetail.tsx:270 height: 16px; src/sentry/static/sentry/app/views/performance/compare/spanDetail.tsx:271 margin-top: ${space(3)}; src/sentry/static/sentry/app/views/performance/compare/spanDetail.tsx:272 margin-bottom: ${space(2)}; src/sentry/static/sentry/app/views/performance/compare/spanDetail.tsx:273 `; ```
Drape (Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✗ —
d2 high ✓ exact
valid · impact low
getMeasurements keeps every key that starts with 'mark.', but the acronym and long-name maps only contain the web-vital slugs. Any other mark name therefore gets an undefined label and tooltip. [grounded: tree src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx] [consensus 3/3: valid=3]
valid · impact low
The shared SpanBarRectangle now has top: 4px. compare/spanDetail.tsx uses it with an inline position: absolute and does not override top, so its bars move 4px down inside the 16px container. [grounded: tree src/sentry/static/sentry/app/views/performance/compare/styles.tsx] [consensus 3/3: valid=3]
valid · impact low
The header is shown when any measurement key exists, but markers only come from 'mark.*' keys. An event with only fp/fcp values renders an empty 20px header. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d2 · impact high
valid · impact low
Clicking a hovered marker bubbles up to SpanRowCell's onClick, which sets showDetail. The marker then unmounts without onMouseLeave firing, so currentHoveredMeasurement stays set in the provider. [grounded: diff] [consensus 3/3: valid=3]
raw comments (5)
src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:41
**Unknown `mark.*` measurements get undefined labels** `getMeasurements` keeps every `mark.*` key, but labels come from `WEB_VITAL_ACRONYMS[name]` and `LONG_WEB_VITAL_NAMES[name]`, which only know the web vitals. A mark with another name gives an undefined label and tooltip. Skip names not in the acronym map, or fall back to the raw name. ``` src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:40 const bounds = getMeasurementBounds(timestamp, generateBounds); src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:42 const shouldDisplay = defined(bounds.left) && defined(bounds.width); src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:44 if (!shouldDisplay) { src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:45 return null; src/sentry/static/sentry/app/views/performance/transactionVitals/constants.tsx:89 // translate known short form names into their long forms src/sentry/static/sentry/app/views/performance/transactionVitals/constants.tsx:90 export const LONG_WEB_VITAL_NAMES = Object.fromEntries( src/sentry/static/sentry/app/views/performance/transactionVitals/constants.tsx:91 Object.values(WEB_VITAL_DETAILS).map(value => { src/sentry/static/sentry/app/views/performance/transactionVitals/constants.tsx:92 return [value.slug, value.name]; src/sentry/static/sentry/app/views/performance/transactionVitals/constants.tsx:93 }) src/sentry/static/sentry/app/views/performance/transactionVitals/constants.tsx:94 ); ```
src/sentry/static/sentry/app/views/performance/compare/styles.tsx:10
**Compare span detail bars shifted down 4px** The shared compare `SpanBarRectangle` now sets `top: SPAN_ROW_PADDING`. `SpanBars` in compare/spanDetail.tsx also uses it with `position: absolute` inside a 16px-high container, so those bars get pushed 4px down. Put the top offset on `ComparisonSpanBarRectangle` in compare/spanBar.tsx, or override `top: 0` in spanDetail. ``` src/sentry/static/sentry/app/views/performance/compare/styles.tsx:8 export const SpanBarRectangle = styled('div')` src/sentry/static/sentry/app/views/performance/compare/styles.tsx:9 position: relative; src/sentry/static/sentry/app/views/performance/compare/styles.tsx:10 height: ${SPAN_ROW_HEIGHT - 2 * SPAN_ROW_PADDING}px; src/sentry/static/sentry/app/views/performance/compare/styles.tsx:11 top: ${SPAN_ROW_PADDING}px; src/sentry/static/sentry/app/views/performance/compare/spanDetail.tsx:268 const SpanBarContainer = styled('div')` src/sentry/static/sentry/app/views/performance/compare/spanDetail.tsx:269 position: relative; src/sentry/static/sentry/app/views/performance/compare/spanDetail.tsx:270 height: 16px; src/sentry/static/sentry/app/views/performance/compare/spanDetail.tsx:271 margin-top: ${space(3)}; src/sentry/static/sentry/app/views/performance/compare/spanDetail.tsx:272 margin-bottom: ${space(2)}; src/sentry/static/sentry/app/views/performance/compare/spanDetail.tsx:273 `; ```
src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx:377
**Empty header shown when no mark measurements** `renderSecondaryPanel` treats any key in `event.measurements` as a reason to show the header, but only `mark.*` keys produce markers. An event with only fp/fcp/lcp values gets an empty gray 20px strip. Use `getMeasurements(event).size > 0` for the check. ``` src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx:377 const hasMeasurements = Object.keys(event.measurements ?? {}).length > 0; src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx:379 // only display the secondary header if there are any measurements src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx:380 if (!hasMeasurements) { src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx:381 return null; src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:625 const measurements = Object.keys(event.measurements) src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx:626 .filter(name => name.startsWith('mark.')) ```
src/sentry/utils/samples.py:212
**Dict mutated while iterating measurements** `measurements.update(measurement_markers)` runs inside the `for ... in measurements.items()` loop. After the first matching key (e.g. `fp`) adds `mark.fp`, the next iteration raises `RuntimeError: dictionary changed size during iteration`. Move the `measurements.update(measurement_markers)` call after the loop (and iterate over a copy or build markers separately). ``` src/sentry/utils/samples.py:203 measurements = data.get("measurements") src/sentry/utils/samples.py:205 if measurements: src/sentry/utils/samples.py:206 measurement_markers = {} src/sentry/utils/samples.py:207 for key, entry in measurements.items(): ```
src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:354
**Measurement hover highlight can get stuck** `renderMeasurements` returns null once `showDetail` is true, so a hovered `MeasurementMarker` is unmounted when its row is clicked open. `onMouseLeave` then never fires and `notHovering()` is never called. Call notHovering() when the detail is toggled open, or keep the markers mounted and hide them with CSS. ``` src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:353 renderMeasurements() { src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:354 const {organization, event, generateBounds} = this.props; src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:356 if (!organization.features.includes('measurements') || this.state.showDetail) { src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:357 return null; ```
greptile · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✗ —
d2 high ✓ exact
valid · matches d2 · impact high
valid · impact medium
shouldDisplay only checks that left and width are defined. A marker outside the zoomed view gets left < 0 or > 1, and clamp() then pins it to the visible edge (the label in MeasurementsPanel is clamped the same way), so it shows at a false position. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
getMeasurements accepts every mark.* key, but WEB_VITAL_ACRONYMS and LONG_WEB_VITAL_NAMES only contain Web Vital slugs. Any other mark name looks up undefined, so its label and tooltip render as undefined. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
The header is shown when the event has any measurement, but MeasurementsPanel only draws mark.* entries. An event with only plain values like lcp gets an empty 20px header. [grounded: diff] [consensus 3/3: valid=3]
raw comments (5)
src/sentry/utils/samples.py:212
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> `measurements.update()` changes `measurements` while the loop is walking that same dict. The transaction fixture contains `fp`, so this adds `mark.fp` and Python raises `RuntimeError: dictionary changed size during iteration`. Build `measurement_markers` in the loop, then update `measurements` once after the loop.
src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:45
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> This check ignores `bounds.isSpanVisibleInView`. When the user zooms past a marker, `getMeasurementBounds()` still gives it a defined `left`, and the later CSS `clamp()` moves it onto the nearest visible edge. Require `isSpanVisibleInView` here and in `SpanBar.renderMeasurements()`.
src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:59
<a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> `getMeasurements()` accepts every `mark.*` key, but these maps only contain known Web Vitals. A custom mark such as `mark.checkout` therefore renders an `undefined` label and tooltip. Filter to known marker names or fall back to the mark name. Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx:380
<a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> This tests for any measurement, while `MeasurementsPanel` only uses `mark.*` entries. Transactions can contain ordinary values such as `lcp` without marker entries, so they get an empty 20px header above the span tree. Check `getMeasurements(event).size` before rendering the header.
PR-level
<h3>Greptile Summary</h3> The transaction span view now shows browser performance measurements directly on the trace timeline. It adds shared hover behavior, readable measurement labels, and sample data so people can connect web vitals to spans. - Adds measurement labels and markers to transaction traces. - Shares web-vital names and acronyms across performance views. - Adjusts span-row geometry and sample data for the new timeline markers. <h3>Confidence Score: 3/5</h3> This PR is not safe to merge because transaction sample generation crashes and zoomed timelines show markers at false positions. `load_data()` changes a dict during iteration. Marker views also ignore the bounds visibility flag. The remaining findings affect marker labels and extra page space. **Files Needing Attention:** `src/sentry/utils/samples.py`, `measurementsPanel.tsx`, `spanBar.tsx`, and `spanTree.tsx`. <details><summary><h3>Important Files Changed</h3></summary> | Filename | Overview | |----------|----------| | src/sentry/utils/samples.py | `load_data()` now derives Web Vital markers, but it changes `measurements` during iteration and crashes for the transaction sample. | | src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx | Adds marker labels and hover links. It keeps off-screen markers visible and cannot label custom `mark.*` entries. | | src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx | Adds the marker header and shared hover provider. The header also appears when an event has no marker entries. | | src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx | Adds marker lines to each span row and updates row spacing. Its marker guard also ignores `isSpanVisibleInView`. | | src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx | Adds marker extraction and converts marker timestamps through `boundsGenerator()`. The helpers return the visibility flag needed by callers. | </details> <details open><summary><h3>Sequence Diagram</h3></summary> ```mermaid sequenceDiagram participant Caller participant Samples as load_data participant EventAPI as Event API participant Page as Event details page participant Tree as SpanTree participant Bounds as boundsGenerator participant Panel as MeasurementsPanel participant Rows as SpanBar rows participant Hover as MeasurementsManager Caller->>Samples: Request transaction sample Samples->>Samples: Set 3-second start and span times Samples->>Samples: Add mark entries during measurement loop alt Dict size changes Samples-->>Caller: Raise RuntimeError else Event comes from API EventAPI-->>Page: Return transaction and measurements Page->>Tree: Render trace and view window Tree->>Bounds: Create bounds function Tree->>Panel: Render marker labels loop Each visible span row Tree->>Rows: Render span and marker lines Rows->>Bounds: Place timestamps end Panel->>Hover: Set hovered marker name Hover-->>Rows: Highlight matching marker lines end ``` </details> <!-- greptile_other_comments_section --> <sub>Reviews (1): Last reviewed commit: ["Update src/sentry/static/sentry/app/comp..."](https://github.com/drape-io/crbench-greptile-2026-09/commit/e7492b7bff76087e6494b6e8b52926383f8f0b31) | [Re-trigger Greptile](https://app.greptile.com/api/retrigger?id=64284803)</sub>
Mjolnir (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✓ off by one
d2 high ✓ exact
valid · matches d2 · impact high
valid · matches d1 · impact low
valid · impact low
getMeasurementBounds returns a defined left for every timestamp, including ones outside the view window. renderMeasurements and MeasurementsPanel check only that left/width are defined and ignore isSpanVisibleInView, so clamp() draws out-of-window markers at the row edges. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
The update call is indented inside the `for key, entry in measurements.items()` loop. On Python 3 (which setup.py supports in experimental mode), items() is a live view, so adding mark.fp after the first item raises RuntimeError on the next step of the loop. [grounded: diff] [consensus 3/3: valid=3]
raw comments (4)
src/sentry/utils/samples.py:871
[P1] Dict mutated while it is being iterated in `load_data` `measurements.update(measurement_markers)` sits inside the `for key, entry in measurements.items()` loop, so it changes `measurements` while the loop is still reading it. Under Python 3, the first matching key (e.g. `fp`) adds `mark.fp`, and the next iteration raises `RuntimeError: dictionary changed size during iteration`. Both `transaction.json` and `javascript-transaction.json` contain `fp`/`fcp`/`lcp`/`fid` measurements, so `load_data("transaction")` and the tests and fixtures that use it would crash. Under Python 2, `items()` returns a list, so it works there only by accident. The `update` call should be moved out of the loop (dedented one level).
src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:846
[P2] Clamping `left` shifts span bars that start before the zoomed view window When the user zooms in with the minimap, a span that starts before the view window but ends inside it has a negative `bounds.left`. Before this change the bar started off-screen and `overflow: hidden` cut off the hidden part. Now `clamp(0%, left, …)` pins `left` at 0% but keeps the full `width`. For example, `left=-50%` and `width=70%` now draws from 0% to 70% instead of 0% to 20%, so the bar no longer matches the span's real end time on the timeline.
src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx:367
[P2] Measurement markers outside the view window are pinned to the edges instead of hidden `renderMeasurements` (and the same logic in `measurementsPanel.tsx`, lines 107-113 and 139) only checks that `bounds.left`/`bounds.width` are defined and ignores `isSpanVisibleInView`. A measurement before or after the zoomed window gets a `left` below 0 or above 1, and `clamp(0%, …, calc(100% - 1px))` draws it at the left or right edge of every row, with an FCP/LCP label in the header. When zoomed in, users therefore see vital markers at times where those events did not happen.
PR-level
[P1] `load_data` changes the measurements dict while looping over it src/sentry/utils/samples.py:871-877 `measurements.update(measurement_markers)` is indented inside the `for key, entry in measurements.items():` loop, so it adds `mark.*` keys to the dict while the loop is still running. This breaks on Python 3, which `setup.py` lists as supported (3.6). The bundled `transaction.json` and `javascript-transaction.json` samples both list `fp` first among their measurements. After that first item, `mark.fp` gets added, and the next step of the loop raises `RuntimeError: dictionary changed size during iteration`. As a result, `load_data(...)` fails on Python 3 for any transaction sample with measurements, including the acceptance tests and sample-event generation that depend on it. It only works on Python 2 because `.items()` returns a copy there. The `update` call needs to come after the loop.
Mjolnir (Sonnet 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✗ —
d2 high ✓ exact
valid · impact medium
The update call sits inside the `for key, entry in measurements.items()` loop. On Python 3, adding `mark.*` keys while iterating raises RuntimeError. On Python 2, `items()` returns a list copy, so it does not, and the codebase still had Python 2 compatibility at this point. It is still a real bug for Python 3 runs, and the keys get re-added on every pass. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
getMeasurements keeps every `mark.` key, but the acronym and long-name maps only cover known vitals. Any other name maps to undefined, so the label and tooltip show 'undefined' or come out empty. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d2 · impact high
raw comments (3)
src/sentry/utils/samples.py:207
[P2] Dict mutated while iterating in sample measurement generation measurements.update(measurement_markers)` is indented inside `for key, entry in measurements.items()`, so the first `fp`/`fcp`/`lcp`/`fid` key adds `mark.*` keys to `measurements` during iteration. On Python 3 the next iteration raises `RuntimeError: dictionary changed size during iteration`, and `load_data` fails for any transaction sample with those measurements. The marks are also re-added on each pass. The `update` call needs to run after the loop, and the acceptance tests that use this sample data would hit the error
src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx:118
[P3] Unknown `mark.*` measurement names render as "undefined" labels getMeasurements` keeps every `mark.‹anything›` key from `event.measurements`. The panel then looks each name up in `WEB_VITAL_ACRONYMS` and `LONG_WEB_VITAL_NAMES`, which only cover known vitals. For an event with, say, `mark.custom`, `acronyms` and `longNames` contain `undefined`, so the label and tooltip show "undefined". If all names are unknown, `lastAcronym` is `undefined` and the label is empty. Filtering to names present in those maps would avoid this. The impact depends on events carrying non-vital `mark.*` measurements
src/sentry/utils/samples.py:872
[P1] Dict mutated while iterating in load_data measurements.update(measurement_markers)` is inside the `for key, entry in measurements.items()` loop. When a measurement named fp, fcp, lcp or fid is present, the first update adds a `mark.*` key to the dict being iterated. Python then raises `RuntimeError: dictionary changed size during iteration` on the next iteration step, even if that key was the last one. Any transaction sample payload with web-vital measurements will crash `load_data`. That includes the performance acceptance tests and sample-data generation. The `update` call should be dedented to run after the loop, or the loop should iterate over a copy of the items
qodo · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✗ —
d2 high ✗ —
raw comments (2)
PR-level
<h3>Qodo is busy working</h3> Check back in a few minutes. Qodo's code review agents are on it. <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <img src="https://www.qodo.ai/wp-content/uploads/2026/01/anteater-looking-at-ants-01-transparent-bg-croped-ezgif.com-optimize-1.gif" width="30%">
PR-level
<h3>PR Summary by Qodo</h3> Show Web Vital markers in transaction span waterfalls <code>✨ Enhancement</code> <code>🧪 Tests</code> <code>🕐 20-40 Minutes</code> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <details> <summary>AI Description</summary> <dl> <dd> <br/> ><pre> >• Shows feature-gated Web Vital markers and labels across transaction span waterfalls. >• Synchronizes hover emphasis between measurement headers and timeline markers. >• Extends sample transaction data and shared vital metadata for marker rendering. ></pre> </dd> </dl> </details> <details> <summary>Diagram</summary> <dl> <dd> <br/> ```mermaid graph TD EVENT["Transaction Event"] --> UTILS["Measurement Utils"] --> TREE["Span Tree"] TREE --> PANEL["Measurement Header"] --> HOVER["Hover Context"] --> MARKERS["Span Markers"] TREE --> ROWS["Span Rows"] --> MARKERS UTILS --> PANEL ``` </dd> </dl> </details> <details> <summary>High-Level Assessment</summary> <dl> <dd> <br/> >The following are alternative approaches to this PR: <details> <summary><b>1. Single waterfall overlay</b></summary> <dl> <dd> - ➕ Renders one marker per measurement instead of one per span row - ➕ Centralizes positioning and hover hit-testing - ➖ Requires careful alignment with scrolling, filtering, expanded details, and row clipping - ➖ May complicate marker layering around nested span content </dd> </dl> </details> <details> <summary><b>2. Prop-driven hover state</b></summary> <dl> <dd> - ➕ Makes ownership and data flow explicit in SpanTree - ➕ Avoids introducing another React context - ➖ Requires callbacks and state to be threaded through recursive span components - ➖ Increases coupling between measurement UI and span-tree rendering </dd> </dl> </details> >**Recommendation:** The shared context and existing bounds generator are appropriate for this scoped enhancement because they synchronize independently rendered labels and recursive rows without extensive prop plumbing. Retain this approach, but consider a single overlay if large traces show measurable DOM or rendering overhead from duplicating every marker across every row. </dd> </dl> </details> <details> <summary> Files changed (14) <code> +536 / -40 </code> </summary> <dl> <dd> <br/> <details> <summary>Enhancement (8) <code> +511 / -21 </code></summary> <dl> <dd> <details> <summary>measurementsManager.tsx<code>Add shared measurement hover context</code> <code>+55/-0</code></summary> <br/> >Add shared measurement hover context > ><pre> >• Introduces a provider and consumer that track the currently hovered measurement and expose handlers for entering and leaving measurement markers. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/68/files#diff-faf145d519527cf9eb1cd53934f64f67448d1e02423fb35075e012bcb0b1e2a3'>src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsManager.tsx</a> </details> <details> <summary>measurementsPanel.tsx<code>Render labeled measurement timeline header</code> <code>+168/-0</code></summary> <br/> >Render labeled measurement timeline header > ><pre> >• Adds a secondary timeline panel that positions Web Vital acronym labels using trace bounds. Labels remain within the visible panel, expose full names through tooltips, and publish hover state. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/68/files#diff-ab1a071601ae5d57b1dc3ca5cc38139e2385676730bf84b6da07559171a4df69'>src/sentry/static/sentry/app/components/events/interfaces/spans/measurementsPanel.tsx</a> </details> <details> <summary>spanBar.tsx<code>Draw synchronized measurement markers on span rows</code> <code>+93/-12</code></summary> <br/> >Draw synchronized measurement markers on span rows > ><pre> >• Renders feature-gated measurement lines on span rows and highlights the marker matching the shared hover state. It also converts span rectangles to padded absolute positioning and clamps their left edge within the timeline. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/68/files#diff-3673d45d0f84ccf827cc7b09adaf27789c0a0e3614dbec490244ec279b57d4cb'>src/sentry/static/sentry/app/components/events/interfaces/spans/spanBar.tsx</a> </details> <details> <summary>spanTree.tsx<code>Integrate measurement header and hover provider</code> <code>+73/-8</code></summary> <br/> >Integrate measurement header and hover provider > ><pre> >• Extracts reusable bounds generation and adds a feature-gated secondary measurement header. Wraps the header and trace rows in the measurement provider so their hover behavior remains synchronized. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/68/files#diff-271a61584f3d04b7d203ad2a4ad9f32776d0b139042b805f7cee61413e6bb501'>src/sentry/static/sentry/app/components/events/interfaces/spans/spanTree.tsx</a> </details> <details> <summary>utils.tsx<code>Add measurement grouping and bounds utilities</code> <code>+89/-0</code></summary> <br/> >Add measurement grouping and bounds utilities > ><pre> >• Adds a common view-bounds type, extracts &#x27;mark.*&#x27; measurements, and groups marks sharing a timestamp. Converts zero-duration measurement timestamps into positions compatible with the existing trace bounds generator. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/68/files#diff-0106a185ce034a2c713fb2146575ee9f9d95097c2654487099a590cd773d9cbb'>src/sentry/static/sentry/app/components/events/interfaces/spans/utils.tsx</a> </details> <details> <summary>constants.tsx<code>Centralize Web Vital acronyms and names</code> <code>+20/-0</code></summary> <br/> >Centralize Web Vital acronyms and names > ><pre> >• Adds acronyms to every Web Vital definition and exports slug-indexed maps for long names and acronyms. These maps support both existing RUM cards and the new timeline labels. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/68/files#diff-92775a89830687c99f8ee60d9e2acb932a0af9fe2b5b84fa71f42ab6126859df'>src/sentry/static/sentry/app/views/performance/transactionVitals/constants.tsx</a> </details> <details> <summary>types.tsx<code>Require acronyms in Web Vital metadata</code> <code>+1/-0</code></summary> <br/> >Require acronyms in Web Vital metadata > ><pre> >• Extends the &#x27;Vital&#x27; type with the acronym needed by compact timeline labels. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/68/files#diff-45f994f62c08c4b4eea1826b1a751022303dfc7fa8b82d7b6efe0ed9632f0eab'>src/sentry/static/sentry/app/views/performance/transactionVitals/types.tsx</a> </details> <details> <summary>samples.py<code>Generate timestamped marks for sample transactions</code> <code>+12/-1</code></summary> <br/> >Generate timestamped marks for sample transactions > ><pre> >• Changes the default sample transaction duration from two to three seconds. It also derives absolute &#x27;mark.*&#x27; timestamps for supported Web Vital measurements so sample traces can render markers. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/68/files#diff-c48f8b39a2b9c71d663c2608f8c55e8842e2e9ea9f42f3416727b07927163508'>src/sentry/utils/samples.py</a> </details> </dd> </dl> </details> <details> <summary>Refactor (4) <code> +18 / -15 </code></summary> <dl> <dd> <details> <summary>styles.tsx<code>Define shared span-row padding</code> <code>+1/-0</code></summary> <br/> >Define shared span-row padding > ><pre> >• Exports a common padding constant used to vertically align span rectangles and comparison labels. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/68/files#diff-5ac6309f644655c5265a4035f0c069f193e76010aa4ddfbf09f4400e72dcdc7a'>src/sentry/static/sentry/app/components/events/interfaces/spans/styles.tsx</a> </details> <details> <summary>realUserMonitoring.tsx<code>Reuse shared Web Vital long names</code> <code>+6/-10</code></summary> <br/> >Reuse shared Web Vital long names > ><pre> >• Replaces locally derived measurement names with the centralized Web Vital long-name lookup. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/68/files#diff-b1e12e9322bb283b02bfb7dd5f47d58a73c1ea5e7b5fe7d5219c1bdebf2e1cfa'>src/sentry/static/sentry/app/components/events/realUserMonitoring.tsx</a> </details> <details> <summary>spanBar.tsx<code>Align comparison bars with shared row padding</code> <code>+4/-4</code></summary> <br/> >Align comparison bars with shared row padding > ><pre> >• Removes obsolete horizontal width compensation and vertically aligns comparison labels using the shared span-row dimensions. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/68/files#diff-84e9557e253994d1426609f2d360e3842fb127732c86511981f4fbec133b5551'>src/sentry/static/sentry/app/views/performance/compare/spanBar.tsx</a> </details> <details> <summary>styles.tsx<code>Apply shared padding to comparison rectangles</code> <code>+7/-1</code></summary> <br/> >Apply shared padding to comparison rectangles > ><pre> >• Sizes and positions comparison span rectangles using the common row height and padding constants. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/68/files#diff-340b4c8bd5c59d9042bdb524eee29ef940f5aa7873825f7c933e3ad30ecd366f'>src/sentry/static/sentry/app/views/performance/compare/styles.tsx</a> </details> </dd> </dl> </details> <details> <summary>Tests (2) <code> +7 / -4 </code></summary> <dl> <dd> <details> <summary>test_performance_summary.py<code>Enable measurements across performance acceptance tests</code> <code>+6/-3</code></summary> <br/> >Enable measurements across performance acceptance tests > ><pre> >• Adds the measurements feature to the shared feature set and removes duplicate per-test feature activation. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/68/files#diff-1e63d9513c17b37b3e2b90e8ae9acdb3851a17554ce2727558e479845c468f72'>tests/acceptance/test_performance_summary.py</a> </details> <details> <summary>test_organization_tagkey_values.py<code>Update expected sample transaction duration</code> <code>+1/-1</code></summary> <br/> >Update expected sample transaction duration > ><pre> >• Adjusts the expected transaction duration from 2000 to 3000 milliseconds to match the revised sample fixture window. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/68/files#diff-0daf7b5c8c49dd1de5c650c0ab927b3d25a999082914d9167f50769a6e5086cc'>tests/snuba/api/endpoints/test_organization_tagkey_values.py</a> </details> </dd> </dl> </details> </dd> </dl> </details>