Repository navigation
test(inspector): decode file URLs in HTTP contract fixtures - #6010
Conversation
miguel-heygen
left a comment
There was a problem hiding this comment.
Thanks for this, and for the very clear repro in the description. The change is correct and I reproduced the premise locally: new URL("file:///Users/x/my%20dir/pkg/").pathname keeps the %20, while fileURLToPath on the same URL gives /Users/x/my dir/pkg/. All three filesystem boundaries in the file are converted and none is left behind.
Worth adding to the description: fileURLToPath fixes a second thing on Windows, not just the percent encoding. There, .pathname yields a leading slash in front of the drive letter (/C:/my dir/a.ts), which is not a path Windows accepts either. So the conversion is the right call even for a checkout with no spaces in it.
One thing a few lines over: packages/inspector/tests/transport.ts:6 has the same new URL("../src/server.ts", import.meta.url).pathname for the script it hands to bun run. It is not a vitest file, which is why your suite run stayed green, but anyone using the live harness from a path with a space hits the same failure with no hint that the path was encoded. If you are happy to, converting it in this PR closes the package in one go.
Two things before this can merge, neither of them yours to fix in code. The branch is 141 commits behind main and will want a rebase, and at the current head only the Graphite mergeability check and the WIP check have run, so a maintainer needs to approve the workflow run for a fork PR before there is a real green.
jrusso1020
left a comment
There was a problem hiding this comment.
Approving. This is a correct, test-only fix.
I checked main: packages/inspector/tests/httpContract.test.ts still builds the subprocess cwd and the symlink target from new URL(...).pathname at lines 14, 125 and 127, which keeps %20 and other percent-encoding. fileURLToPath() is the right decode at each filesystem boundary, and those are all three sites in this file. No other open PR touches this file.
One optional follow-up in the same package: packages/inspector/tests/transport.ts line 6 has the same .pathname pattern. It is a manual script (the README runs it by hand), not part of the vitest suite, so it does not block this.
Need: yes, the suite fails in a checkout path with spaces · Size: ok · Reuse: uses Node's fileURLToPath, nothing else to reuse · Simpler: already minimal
— Rames
|
Thanks, @shuaiyafei. This one is approved, and it'll go into the merge queue once these are sorted:
Once it's green and signed, we'll queue it at your new head. If you push code changes beyond a rebase, we'll take another look first. — Rames |
|
This is approved and every Windows lane passes. One step left: please rebase onto current main. The required |
Head branch was pushed to by a user without write access
c2ab3ff to
f75ea1d
Compare
jrusso1020
left a comment
There was a problem hiding this comment.
Re-approving after the rebase: the patch is unchanged from the version approved on 10-24.
Pull request was closed
What
Decode the file URLs used as subprocess working directories and the symlink target in the Inspector HTTP contract tests.
Why
In a checkout containing spaces,
URL.pathnamekeeps%20in the directory name. The subprocess cannot start in that nonexistent directory, and three HTTP contract cases time out withspawn bun ENOENT. The symlink target has the same encoding problem.Related work
Refs #5863. Related path conversion PRs: #5542, #5543 and #5660. Their file lists do not include
packages/inspector/tests/httpContract.test.ts.How
Use Node's
fileURLToPath()at all three filesystem boundaries in this fixture.Test plan
The path reproduction was run on macOS arm64; native Windows was not run.
AI assistance: Codex.
Rebase update — October 28, 2026
Rebased onto
mainat8b1f88b3, as requested. The approved patch's added and removed lines are unchanged. The new head isf75ea1d1, with a GitHub-verified signature.Fresh local validation for this rebased tree:
packages/inspector/tests/httpContract.test.ts: 4 tests pass, from a checkout path containing spaces and Chinese characters.git diff --checkpass.The earlier validation section describes the pre-rebase revision. Upstream CI and Windows results must be checked at the new head.
At this update, the fork workflow runs are awaiting maintainer approval. Auto-merge is currently disabled; GitHub returned
FORBIDDENwhen the author account attempted to restore it, so a maintainer needs to re-enable it.