Skip to content

test(inspector): decode file URLs in HTTP contract fixtures - #6010

Merged
jrusso1020 merged 1 commit into
heygen-com:mainfrom
shuaiyafei:fix/inspector-test-file-urls
Nov 11, 2026
Merged

jrusso1020 merged 1 commit into
heygen-com:mainfrom
shuaiyafei:fix/inspector-test-file-urls

Conversation

@shuaiyafei

@shuaiyafei shuaiyafei commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

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.pathname keeps %20 in the directory name. The subprocess cannot start in that nonexistent directory, and three HTTP contract cases time out with spawn 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

  • Built the workspace, then ran the unchanged HTTP test file: 4 passed in a normal checkout path.
  • Moved the same built worktree to a path containing a space: 3 failed, 1 passed. With the conversion, 4 passed.
  • Inspector's full suite: 48 passed, both in the space-containing path and after moving it to a path containing spaces and Chinese characters.
  • Inspector typecheck, changed-file oxlint/oxfmt, and the full repository pre-commit and commit-msg hooks passed.

The path reproduction was run on macOS arm64; native Windows was not run.

  • Existing tests updated and executed
  • Checkout-path reproduction performed
  • Comment rules reviewed

AI assistance: Codex.

Rebase update — October 28, 2026

Rebased onto main at 8b1f88b3, as requested. The approved patch's added and removed lines are unchanged. The new head is f75ea1d1, with a GitHub-verified signature.

Fresh local validation for this rebased tree:

  • Full workspace build passes.
  • packages/inspector/tests/httpContract.test.ts: 4 tests pass, from a checkout path containing spaces and Chinese characters.
  • Full pre-commit and commit-msg checks pass, including lint, formatting, core/Studio/scripts typechecks, Fallow, tracked-artifact and size gates. Comment checks and git diff --check pass.

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 FORBIDDEN when the author account attempted to restore it, so a maintainer needs to re-enable it.

@miguel-heygen miguel-heygen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

@jrusso1020

Copy link
Copy Markdown
Collaborator

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

@miguel-heygen

Copy link
Copy Markdown
Collaborator

This is approved and every Windows lane passes. One step left: please rebase onto current main. The required Test check fails only in Test (support), on the packed-manifest install that is fixed on main, so a fresh run on a rebased branch should be green; we will queue it then.

auto-merge was automatically disabled October 28, 2026 03:22

Head branch was pushed to by a user without write access

@shuaiyafei
shuaiyafei force-pushed the fix/inspector-test-file-urls branch from c2ab3ff to f75ea1d Compare October 28, 2026 03:22

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-approving after the rebase: the patch is unchanged from the version approved on 10-24.

@jrusso1020
jrusso1020 enabled auto-merge November 10, 2026 23:21
@jrusso1020 jrusso1020 closed this Nov 10, 2026
auto-merge was automatically disabled November 10, 2026 23:22

Pull request was closed

@jrusso1020 jrusso1020 reopened this Nov 10, 2026
@jrusso1020
jrusso1020 added this pull request to the merge queue Nov 10, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 10, 2026
@jrusso1020
jrusso1020 added this pull request to the merge queue Nov 10, 2026
Merged via the queue into heygen-com:main with commit e7a323a Nov 11, 2026
133 of 180 checks passed
@miguel-heygen miguel-heygen mentioned this pull request Nov 11, 2026
3 of 4 tasks
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.

3 participants