Repository navigation
test(e2e): fail fast when wrangler dies and upload its logs - #1320
Conversation
Filter Mobile Safari / content-script TypeErrors that unguardedly read
document.querySelector("meta[property='og:type']").content from global
code on the document URL (KODY-CLOUDFLARE-46). Kody never reads og:type
this way; match requires the Safari evaluating wording and a global code
frame.
Post-merge Validate on #1316 failed with Playwright ECONNREFUSED to the local webserver (infra flake; PR CI and pre-push E2E were green). Empty commit to re-run push Validate so production deploy can proceed.
When the Playwright webServer exits mid-suite, remaining tests were burning CI retries on ECONNREFUSED. Probe /health before each test, abort auth retries immediately on connection refused, and upload logs.local/ from the E2E job on failure so the next empty [WebServer] ERROR is diagnosable.
|
Warning Review limit reached
Next review available in: 48 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe E2E suite now checks web-server health before tests, detects connection-refused failures, stops authentication retries after server death, and uploads Wrangler logs when CI fails. ChangesE2E server liveness
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant PlaywrightTest
participant ensureE2eWebServerAlive
participant assertE2eWebServerAlive
participant E2EWebServer
participant LoginFixture
PlaywrightTest->>ensureE2eWebServerAlive: start before each test
ensureE2eWebServerAlive->>assertE2eWebServerAlive: check baseURL
assertE2eWebServerAlive->>E2EWebServer: GET /health
PlaywrightTest->>LoginFixture: authenticate
LoginFixture->>assertE2eWebServerAlive: handle request errors
assertE2eWebServerAlive-->>LoginFixture: throw E2eWebServerDeadError on failure
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🔎 Preview deployed: https://kody-pr-1320.kody-a99.workers.dev Worker: Mocks:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
e2e/web-server-liveness.node.test.ts (1)
56-63: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winTest the refused health probe.
Lines 56-63 pre-latch the module.
assertE2eWebServerAlivetherefore does not callfetch. Add a test wherefetchrejects with anECONNREFUSEDerror. Assert that the helper latches the server state and rejects withE2eWebServerDeadError.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@e2e/web-server-liveness.node.test.ts` around lines 56 - 63, Extend the liveness tests around assertE2eWebServerAlive with a fresh, unlatched server URL and a mocked fetch that rejects with an ECONNREFUSED error. Assert the helper rejects with E2eWebServerDeadError, then verify the server is latched by confirming a subsequent assertE2eWebServerAlive call rejects without invoking fetch again.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@e2e/playwright-utils.ts`:
- Around line 114-146: Update the auth retry loop around the login, signup, and
fallback requests to compute the remaining budget as max(0, deadline -
Date.now()) before each request. Stop retrying immediately when no time remains,
and pass the remaining duration as the request timeout for every
page.request.post and signupOrLoginViaAuth call so no request exceeds the
15-second deadline.
---
Nitpick comments:
In `@e2e/web-server-liveness.node.test.ts`:
- Around line 56-63: Extend the liveness tests around assertE2eWebServerAlive
with a fresh, unlatched server URL and a mocked fetch that rejects with an
ECONNREFUSED error. Assert the helper rejects with E2eWebServerDeadError, then
verify the server is latched by confirming a subsequent assertE2eWebServerAlive
call rejects without invoking fetch again.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0a0c56af-d102-47dc-8cb1-21dc75e49d6f
📒 Files selected for processing (8)
.github/workflows/validate.ymldocs/contributing/end-to-end-testing.mde2e/playwright-utils.tse2e/smoke.spec.tse2e/social-login.spec.tse2e/web-server-liveness.node.test.tse2e/web-server-liveness.tsplaywright.config.ts
Address CodeRabbit feedback: each /auth attempt now uses the leftover retry budget as its Playwright request timeout so the default 30s API timeout cannot overrun the 15s login retry window.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort 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 824c68a. Configure here.
| const loginResponse = await request.post('/auth', { | ||
| data: { email, password, mode: 'login' }, | ||
| headers: { 'Content-Type': 'application/json' }, | ||
| ...requestTimeout, |
There was a problem hiding this comment.
Signup-login path doubles timeout
Medium Severity
signupOrLoginViaAuth applies the same loop remainingMs to both signup and login POSTs. On a 409 signup, the follow-up login can run for another full budget slice, so one retry iteration may exceed the 15s auth deadline the loop is meant to enforce.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 824c68a. Configure here.


Summary
Hardens Playwright against mid-suite Wrangler/workerd exits (the
ECONNREFUSEDflake that blocked deploy after #1316).Changes
e2e/web-server-liveness.tsprobes/healthbefore each test (auto fixture onplaywright-utilstest). Connection refused latches the suite and throwsE2eWebServerDeadErrorwith a clear message. Auth login retries abort immediately on refused connections instead of polling for 15s.🎭 E2Ejob failure, CI uploadslogs.local/ase2e-wrangler-logsso the next empty[WebServer] ERRORis diagnosable.testso they get the liveness check. Playwright ignores*.node.test.tsso the helper unit tests stay Vitest-only.No restart supervisor — if wrangler dies, we surface it and keep the logs.
Risk
Low / composes — test harness + CI artifact only.
System recap — composes existing primitives (low risk)
Mode: recap · Base:
main· Head: this branchClassification: composes — Playwright harness and Validate workflow only; no runtime primitives changed.
Primitives touched
None. Diff is under
e2e/,playwright.config.ts,.github/workflows/, and docs.System map
E2E job still starts Wrangler via Playwright
webServer; this PR only fails fast when that process dies and preserves its logs.Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).
Summary by CodeRabbit
Bug Fixes
Testing
Documentation
Chores