Repository navigation
Conversation
size-limit report 📦
|
a8d6d9c to
83fab7a
Compare
5a08efb to
dc00794
Compare
b188ce7 to
a064fc9
Compare
a064fc9 to
3d541db
Compare
3d541db to
0fa7920
Compare
0fa7920 to
136bc99
Compare
136bc99 to
4c8dc91
Compare
4c8dc91 to
52e9455
Compare
Lms24
left a comment
There was a problem hiding this comment.
m: I'd prefer keeping one transaction test that asserts on the respective web vital being added as a measurement to the pageload span.
| // A plain (non-streamed) `beforeSendSpan` operates on the v1 `SpanJSON`. INP is sent as a v2 span, | ||
| // so this verifies the static callback still runs and its changes are carried into the v2 span. | ||
| beforeSendSpan: Sentry.withStaticSpan(span => { | ||
| if (span.op === 'ui.interaction.click') { | ||
| span.description = 'scrubbed'; | ||
| span.data['custom.attribute'] = 'from-before-send-span'; |
There was a problem hiding this comment.
m: I think we should keep this test as "static", since the main objective here is asserting that the INP span goes through beforeSendSpan in the v1 format when span streaming is disabled.
So once we remove transactions, this test can be dropped
| 'records connection RTT on pageload and navigation spans', | ||
| async ({ getLocalTestUrl, page, browserName }) => { | ||
| sentryTest.skip(shouldSkipTracingTest() || browserName !== 'chromium'); | ||
| const url = await getLocalTestUrl({ testDir: __dirname }); | ||
| await page.goto(url); | ||
|
|
||
| const pageloadRequest = envelopeRequestParser(await pageloadRequestPromise) as Event; | ||
|
|
||
| const navigationRequestPromise = waitForTransactionRequest( | ||
| page, | ||
| event => event.contexts?.trace?.op === 'navigation', | ||
| ); | ||
| await page.goto(`${url}#foo`); | ||
|
|
||
| const navigationRequest = envelopeRequestParser(await navigationRequestPromise) as Event; | ||
|
|
||
| expect(pageloadRequest.contexts?.trace?.op).toBe('pageload'); | ||
| expect(navigationRequest.contexts?.trace?.op).toBe('navigation'); | ||
| const [pageload] = await waitForStreamedSpanAndTraceHeaderOnUrl(page, url); | ||
| const [navigation] = await waitForStreamedSpanAndTraceHeaderOnUrl(page, `${url}#foo`); | ||
|
|
||
| expect(pageloadRequest.measurements?.['connection.rtt']?.value).toBeDefined(); | ||
| expect(navigationRequest.measurements?.['connection.rtt']).toBeUndefined(); | ||
| expect(pageload.attributes[NETWORK_CONNECTION_RTT]).toEqual({ type: 'integer', value: 0 }); | ||
| expect(navigation.attributes[NETWORK_CONNECTION_RTT]).toEqual(pageload.attributes[NETWORK_CONNECTION_RTT]); | ||
| expect(navigation.attributes[BROWSER_WEB_VITAL_FCP_VALUE]).toBeUndefined(); | ||
| expect(navigation.attributes[BROWSER_WEB_VITAL_TTFB_VALUE]).toBeUndefined(); |
There was a problem hiding this comment.
hmm actually not sure if sending connction.rtt on navigation spans is an SDK bug or expected behaviour now? probably worth looking into. if it's a bug, I'm also fine with merging the test as-is and fixing it in a follow-up.
There was a problem hiding this comment.
sentry-javascript/packages/browser-utils/src/performance/entries.ts
Lines 526 to 534 in d489a08
so from this it looks like this is expected now
| expect(streamSpan.end_timestamp).toBeGreaterThan(streamSpan.start_timestamp); | ||
| expect(streamSpan.parent_span_id).toBe(requestSpan.parent_span_id); | ||
| expect(streamSpan.trace_id).toBe(requestSpan.trace_id); | ||
| expect(streamSpan.end_timestamp).toBeGreaterThanOrEqual(streamSpan.start_timestamp); |
There was a problem hiding this comment.
l: any reason this assertion got weaker?
| expect(streamSpan.end_timestamp).toBeGreaterThanOrEqual(streamSpan.start_timestamp); | |
| expect(streamSpan.end_timestamp).toBeGreaterThan(streamSpan.start_timestamp); |
| }); | ||
|
|
||
| expect(requestSpan?.data).not.toHaveProperty('url.fragment'); | ||
| expect(requestSpan?.attributes).not.toHaveProperty('url.fragment'); |
There was a problem hiding this comment.
m: TIL that this check actually asserts that attributes.url.fragment doesn't exist, instead of attributes['url.fragment']. I had no idea 😬
Turns out the correct syntax here is
| expect(requestSpan?.attributes).not.toHaveProperty('url.fragment'); | |
| expect(requestSpan?.attributes).not.toHaveProperty(['url.fragment']); |
Would be amazing if you could go over our tests and check for this pattern. I'm pretty sure we use this more often. But of course as a follow up!
EDIT: Looks like this is "just" a playwright thing. Vitest asserts on the whole key.
There was a problem hiding this comment.
oof, good catch. only one more nuxt test was affected, fixed it here: 811c410#diff-6ef19271481ee7f31290d28e413d8ff6213b9251009cc4f01c140bfddf3eb80d
0949ba8 to
811c410
Compare
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: OpenAI ChatGPT <codex@openai.com>
Co-Authored-By: OpenAI ChatGPT <codex@openai.com>
2beb4b0 to
a063aeb
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a063aeb. Configure here.
Co-Authored-By: OpenAI ChatGPT <codex@openai.com>
| if (!interactionSelector) { | ||
| // Older interactions may no longer be buffered. A requested click must be observed, | ||
| // otherwise hiding would silently lose the INP value the caller is testing. | ||
| fallback = setTimeout(done, 1000); | ||
| } |
There was a problem hiding this comment.
Bug: The hidePage function can hang indefinitely when an interactionSelector is provided, as there's no fallback timeout if the expected performance entry isn't found.
Severity: MEDIUM
Suggested Fix
Add a fallback timeout within the page.evaluate call, for example by racing the existing promise with a setTimeout. This will ensure the test fails with a clear error message instead of hanging when the performance entry is not found.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: dev-packages/browser-integration-tests/utils/helpers.ts#L605-L609
Potential issue: When `hidePage` is called with an `interactionSelector`, it waits for a
corresponding 'click' `PerformanceEventTiming` entry. However, if this entry is not
found (e.g., due to buffer eviction on a loaded CI machine), the Promise within
`page.evaluate()` never resolves. Because `page.evaluate()` lacks a built-in timeout,
the test will hang until the global test timeout is reached (e.g., 30 seconds),
resulting in a generic and unhelpful "Test timeout exceeded" error instead of a clear
failure message. This makes debugging flaky tests difficult.

Exercise request instrumentation, web vitals, interactions, and user timing with default span streaming. Retain the existing transaction counterparts for fetch, XHR, resource timing, and TTFB as explicitly pinned
*-staticsuites so the migration preserves coverage of both lifecycles. Check RTT as a span attribute on pageload and navigation.Fixes #24143