Repository navigation
chore(e2e): RANGO_E2E_PORT_OFFSET — per-checkout port isolation for shared Playwright webServers - #711
Merged
Conversation
…he shared Playwright webServers Two clones of this repo running e2e simultaneously collide on the fixed fixture ports (rangojs-router 5188/5189 + host 5296/5297, cloudflare-basic 5198/5199): reuseExistingServer silently runs one checkout's tests against the OTHER checkout's server (wrong code, no error), and each run's cleanup kills the other's servers mid-flight. Bit hard during PR #705 verification. RANGO_E2E_PORT_OFFSET (default 0 — no behavior change) shifts every fixture port uniformly in both configs and in host-routing.test.ts (which builds absolute URLs from the same constants), preserving the deliberate cross-suite port spacing. Documented in AGENTS.md Environment gotchas. Verified: offset 400 boots servers on 5588/5589/5696/5697 and 5599/5598; content-negotiation (router dev, 23 passed) and cache-signal (cf-basic dev) green against the shifted ports; default runs unchanged.
commit: |
Merged
4 tasks done
ivogt
added a commit
that referenced
this pull request
Jul 6, 2026
… path, no setup required (#712) Follow-up to #711: the env var only helps if a session already knows about the multi-clone failure mode — the sessions that need isolation are exactly the ones unaware of each other, so opt-in defends nothing by default. checkoutPortOffset() in @shared/e2e hashes the checkout's absolute path (resolved from the helper's own location through the workspace symlink) into a 0..29800 offset (150 buckets x 200 stride). Every importer in the same clone derives the identical value by construction: both playwright configs and host-routing.test.ts (absolute URLs) import the one function, replacing the keep-in-sync constants. Same clone, same ports across runs, so reuseExistingServer still reuses your own servers; different clones get disjoint blocks with zero setup. RANGO_E2E_PORT_OFFSET remains as explicit override (0 forces the canonical bases); CI pins 0. Verified: this clone derives 25800 — router e2e binds 30988/30989 (+host 31096/31097), cloudflare-basic binds 30999/30998 (same offset, cross-suite spacing preserved); host-routing suite green against the derived ports (config/test agreement); override 0/400 and CI=1 probed; all four local sibling clones hash to distinct offsets (18200/25200/25600/25800).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two clones of this repo running e2e at the same time collide on the fixed fixture ports (rangojs-router
5188/5189+ host5296/5297, cloudflare-basic5198/5199). UnderreuseExistingServer: !CI, the second run silently reuses the FIRST checkout's server — its tests execute against the other checkout's code with no error — and each run's stale-server cleanup kills the other's servers mid-flight (ERR_CONNECTION_REFUSEDwaves). This burned about an hour of phantom-failure chasing during #705 verification, when a parallel agent session in a sibling clone was running the same suites.Change
One knob:
RANGO_E2E_PORT_OFFSET(default0— zero behavior change). It shifts every fixture port uniformly in:packages/rangojs-router/playwright.config.ts(dev/preview + host dev/preview)packages/rangojs-router/e2e/host-routing.test.ts(builds absolute URLs from the same constants — reads the same env so it cannot drift from the config)tests/cloudflare-basic/playwright.config.ts(dev/preview)Uniform shifting preserves the deliberate cross-suite spacing (host 5296/5297 was chosen to avoid cloudflare-basic 5198/5199 — that invariant holds at any offset). All other suites (multi-router, vite-rsc-demo, no-typescript, stress-demo, …) already use dynamic per-test ports (
findPort()) and need nothing.Documented in
AGENTS.md→ Environment gotchas, so agent sessions learn to set it when a sibling clone may be testing.Usage
Test plan
content-negotiation --project=dev23/23 and cloudflare-basiccache-signal --project=devgreen against the shifted ports.Notes