Skip to content

fix(evals): escape relative scaffold import URLs - #504

Merged
iuyo5678 merged 1 commit into
Tencent:mainfrom
u7-u7:fix/scaffold-relative-import-urls
Oct 28, 2026
Merged

iuyo5678 merged 1 commit into
Tencent:mainfrom
u7-u7:fix/scaffold-relative-import-urls

Conversation

@u7-u7

@u7-u7 u7-u7 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Problem

The badcase scaffold puts a relative filesystem path directly into an ESM import. If the checkout path contains #, Node treats the remainder as a URL fragment and cannot load fixtures.mjs. A literal %20 is decoded as a space; ? has the same problem on platforms where it is a legal path character. The generated case is unusable even though all files exist.

Change

Encode each relative path component as a URL component while preserving / separators and relative .. segments. Relative imports remain relocatable. The cross-drive Windows file-URL fallback introduced in #459 is unchanged.

Add a regression that copies the actual scaffold/helper modules into checkout directories containing # and literal %20, generates cases outside those directories, then imports and renders each generated fixture. Also cover ? on non-Windows systems.

This is independent of #503: it fixes fixture module resolution, not run IDs or event acceptance. The branch is based directly on current main and does not include #503.

Verification

  • Regression on unchanged main failed with ERR_MODULE_NOT_FOUND (the helper path was truncated at #).
  • node --test evals/browser/tests/*.test.mjs: 26 passed, 0 failed.
  • node evals/browser/cli.mjs validate: 10 cases / 19 fixture routes validated.
  • Biome 2.4.15 check of both changed files: passed, no fixes.
  • git diff --check: clean.
  • Tested on Linux, Node 24.22.1. Windows execution and the Rust/extension suites were not run; no Rust or extension runtime code changed.

AI assistance

Prepared and tested with OpenAI Codex. No human-review attestation is made. Submitted as a draft without requesting reviewers.

@u7-u7
u7-u7 marked this pull request as ready for review October 28, 2026 03:08
@iuyo5678
iuyo5678 merged commit 1e9be11 into Tencent:main Oct 28, 2026
30 of 31 checks passed
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.

2 participants