Repository navigation
fix(evals): support cross-drive scaffold imports on Windows - #459
Open
legend91019 wants to merge 1 commit into
Open
legend91019 wants to merge 1 commit into
legend91019 wants to merge 1 commit into
Conversation
NianJiuZst
approved these changes
Oct 17, 2026
NianJiuZst
left a comment
Contributor
There was a problem hiding this comment.
LGTM, approving.
The fix is correct. On Windows, path.relative() gives back an absolute path when the two paths are on different drives. Detecting that with isAbsolute() and falling back to pathToFileURL(targetPath).href produces a valid ESM import. When both paths are on the same drive, the generated specifier is the same relative path as before, so cases scaffolded inside the repo don't change.
What I checked:
- Ran the specifier logic with
path.win32. A cross-drive pair (C:\…\Temp\…→D:\repo\…\fixtures.mjs) gives an absolute result andfile:///D:/repo/evals/browser/lib/fixtures.mjs. A same-drive pair still gives../../../lib/fixtures.mjs. node --test evals/browser/tests/eval.test.mjson this branch: 15/15 pass (Linux, Node 22).- Biome is clean on the changed file, and there are no runtime/product changes.
Non-blocking: CI runs the eval tests only on Ubuntu, so the cross-drive path has no automated test. If we want to guard it, moduleSpecifier could take the path functions as a parameter, so a test can call it with path.win32 and a cross-drive pair. Fine as a follow-up.
Author
|
你是马哥吗 |
This branch has not been deployed
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.
Why
Fixes #458.
On Windows,
path.relative()returns an absolute path when the generated badcase directory and the repository helper are on different drives. The scaffold code treated that result as a relative path and prefixed./, so generated fixtures could not importfixtures.mjs.This is an eval-only path-resolution fix and does not change BrowserSkill runtime behavior.
What changed
pathToFileURL()when the relative result is absolute, which covers cross-drive Windows paths with a valid ESM specifier.Verification
d9a78aebaseline with the repository onD:and%TEMP%onC:, the focused test failed (0 passed, 1 failed); the full browser-eval suite reported22 passed, 1 failed.TEMP/TMPto the repository drive made the same unmodified focused test pass (1/1).v22.22.2focused test:1 passed, 0 failed.23 passed, 0 failed; 10 cases and 19 fixture routes validated.corepack pnpm exec biome check evals/browser/lib/scaffold-case.mjsnode --check evals/browser/lib/scaffold-case.mjsgit diff --checkNo screenshot is included because this is a deterministic Node/Windows path-resolution failure with no UI change. The complete Chinese evidence, independent re-verification, and full before/after code are maintained in the local workflow artifact
D:\Desktop\open_coding\pr_reviews\Tencent__BrowserSkill__dogfood__windows-cross-drive-eval-scaffold.mdand can be provided to maintainers on request.