Repository navigation
chore(e2e): automatic per-checkout port isolation — hash the checkout path, no setup required - #712
Merged
Merged
Conversation
… path, no setup required 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).
commit: |
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
#711 added
RANGO_E2E_PORT_OFFSET, but an opt-in knob has a bootstrapping flaw: the sessions that need port isolation are precisely the ones that don't know another clone is running e2e. Requiring prior knowledge means the default is still silently wrong in the multi-clone case — the exact case that burned #705's verification.Change
The offset is now derived automatically from a hash of the checkout's absolute path.
checkoutPortOffset()lives in@shared/e2e(both suites already depend on it) and resolves the path from its own file location — the workspace symlink resolves to the real per-clone path — so every importer in the same clone derives the identical value by construction:packages/rangojs-router/playwright.config.ts(dev/preview + host ports)packages/rangojs-router/e2e/host-routing.test.ts(builds absolute URLs — imports the same function, replacing the old keep-in-sync comment contract)tests/cloudflare-basic/playwright.config.tsProperties:
reuseExistingServerstill reuses your own serversRANGO_E2E_PORT_OFFSETstill overrides;0forces the canonical basesAGENTS.mdgotcha rewritten: read actual ports from playwright's webServer output; never hardcode ports in cleanup commands. Stale:5188-style comments inhelper.ts/consumer-testing-harness.test.tsupdated to name the base + offset.Test plan
0/400honored;CI=1→ 0.host-routing --project=host5 passed against derived 31096/31097 — proves config/test-file port agreement live (the one spot the old design kept in sync by comment).Notes
process.cwd()(invocation-dependent) or per-file__dirnamemath (drifts on file moves).