Skip to content

test(cloudflare): Skip retries for expected failures - #22991

Open
JPeer264 wants to merge 1 commit into
developfrom
jp/faster-tests
Open

test(cloudflare): Skip retries for expected failures#22991
JPeer264 wants to merge 1 commit into
developfrom
jp/faster-tests

Conversation

@JPeer264

@JPeer264 JPeer264 commented Aug 4, 2026

Copy link
Copy Markdown
Member

This adds the expectError flag, for tests which are expected to fail, e.g. tracing/headers had a runtime of 5seconds which trimmed it down to 500ms with that flag (as it retried 3 times - even if it shouldn't had to)

It also seemed that we didn't cover unhandled DO or schedule errors in the integration suite, so I added them here too

Avoid retrying intentional worker failures, which only repeats exceptions and slows tests. Add Durable Object and scheduled-handler error coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@JPeer264 JPeer264 self-assigned this Aug 4, 2026
@JPeer264
JPeer264 requested a review from a team as a code owner August 4, 2026 09:43
@JPeer264
JPeer264 requested review from andreiborza and mydea and removed request for a team August 4, 2026 09:43

try {
const res = await fetchWithRetry(url, { headers, method, body });
const res = await fetchWithRetry(url, { headers, method, body }, expectError ? { maxRetries: 1 } : {});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: When expectError: true and maxRetries: 1 are used, a connection error during startup is silently suppressed, causing tests to hang and time out.
Severity: MEDIUM

Suggested Fix

When expectError: true, the test runner should still retry on transient connection errors (e.g., ECONNREFUSED) but should stop retrying once it successfully receives any response from the worker, including the expected error response. This will prevent connection failures from being silently swallowed while correctly handling expected application-level errors. Alternatively, only use maxRetries: 1 after verifying the worker is truly accepting connections.

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/cloudflare-integration-tests/runner.ts#L441

Potential issue: When a test is configured with `expectError: true` and `maxRetries: 1`,
a race condition during wrangler startup can cause a connection error. The `makeRequest`
function's `catch` block silently suppresses this specific type of error, preventing the
request from ever reaching the worker. Because the worker is never hit, the Sentry
envelope the test is waiting for is never generated. This causes the test to hang until
it eventually fails due to a timeout, creating a flaky test condition that obscures the
root cause of the failure.

Also affects:

  • dev-packages/cloudflare-integration-tests/runner.ts:84~88

Did we get this right? 👍 / 👎 to inform future reviews.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 29.91 kB - -
@sentry/browser - with treeshaking flags 28.12 kB - -
@sentry/browser (incl. Tracing) 47.36 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.36 kB - -
@sentry/browser (incl. Tracing, Profiling) 52.13 kB - -
@sentry/browser (incl. Tracing, Replay) 86.7 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.13 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 91.41 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 104.05 kB - -
@sentry/browser (incl. Feedback) 47.22 kB - -
@sentry/browser (incl. sendFeedback) 34.76 kB - -
@sentry/browser (incl. FeedbackAsync) 39.87 kB - -
@sentry/browser (incl. Metrics) 30.99 kB - -
@sentry/browser (incl. Logs) 31.22 kB - -
@sentry/browser (incl. Metrics & Logs) 31.9 kB - -
@sentry/react 31.73 kB - -
@sentry/react (incl. Tracing) 49.61 kB - -
@sentry/vue 34.98 kB - -
@sentry/vue (incl. Tracing) 49.34 kB - -
@sentry/svelte 29.94 kB - -
CDN Bundle 32.01 kB - -
CDN Bundle (incl. Tracing) 47.72 kB - -
CDN Bundle (incl. Logs, Metrics) 33.55 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.08 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 72.9 kB - -
CDN Bundle (incl. Tracing, Replay) 85.35 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.65 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.14 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.46 kB - -
CDN Bundle - uncompressed 95.52 kB - -
CDN Bundle (incl. Tracing) - uncompressed 143.1 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.23 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 147.08 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 224.99 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 262.36 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 266.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 276.07 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 280.02 kB - -
@sentry/nextjs (client) 52.21 kB - -
@sentry/sveltekit (client) 47.81 kB - -
@sentry/core/server 80.01 kB - -
@sentry/core/browser 51.97 kB - -
@sentry/node 120.89 kB - -
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 84.26 kB -0.01% -1 B 🔽
@sentry/aws-serverless 92.94 kB - -
@sentry/cloudflare (withSentry) - minified 219.37 kB - -
@sentry/cloudflare (withSentry) 540.47 kB - -

View base workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants