Skip to content

fix: handle Windows UNC file URLs (#744) - #760

Merged
Brooooooklyn merged 43 commits into
mainfrom
fix/unc-file-urls
Sep 14, 2026
Merged

Brooooooklyn merged 43 commits into
mainfrom
fix/unc-file-urls

Conversation

@Brooooooklyn

@Brooooooklyn Brooooooklyn commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #744. Windows UNC paths (\\server\share\…) round trip through file: URLs with the server name in the authority (file://server/share/…, the form pathToFileURL produces), instead of failing resolution or generating file://///server/….

  • file_url_to_path (Windows): file://server/share/… maps its authority back to a leading \\server\…, with percent-decoding applied to both the host and the path; file://localhost/… maps to no authority, matching fileURLToPath; the file:///C:/… drive form is unchanged.
  • path_to_file_url (Windows): a \\ or // prefix makes the first component the UNC authority — percent-encoded — and everything else keeps the file:///C:/… form, matching pathToFileURL.
  • create_resolve now treats every file:// specifier as an absolute path, UNC form included.
  • Pathname encoding: the UNC path is percent-encoded the way the file: URL path setter encodes it (/ separators stay, everything outside the unreserved set becomes %XX), with query/fragment appended verbatim — a literal % in a file name can no longer be read back as an escape, and # can no longer start a fragment. Found by an adversarial review of this branch. (The same pre-existing gap for drive-letter paths is left untouched here, as it predates this change and is not part of Windows UNC file URLs are not resolved or generated correctly #744.)
  • IDNA hosts: pathToFileURL writes a non-ASCII server name as an xn-- punycode authority and fileURLToPath maps it back through IDNA to-Unicode, so incoming URLs now punycode-decode xn-- labels (RFC 3492, decode-only, no new dependency). A # in a file name is safe: oxc_resolver's fragment-as-path fallback resolves the full path before treating it as a fragment (pinned by a hash#name.ts fixture).
  • The Windows rules live in a #[cfg(any(windows, test))] module: production builds on other platforms compile none of the UNC code, while cargo test exercises the full matrix on every platform. Also adds the missing rlib crate type so cargo test can link unit tests at all.
  • Adds a cargo test step to the CI lint job (previously only clippy ran).

Tests

  • 13 Rust unit tests covering the drive and UNC forms in both directions, percent-decoding of host and path, percent-encoding of URL-significant characters (%, #, space, non-ASCII) with a full round trip, the localhost authority, malformed escapes copied verbatim, invalid UTF-8 rejected, and non-file: URLs rejected.
  • packages/integrate-vitest/__tests__/unc-paths.spec.ts: a drive-letter fixture cannot catch this bug (file:///C:/… matches the old prefix both ways), so the spec stands up a real share on the runner itself (net share, reached as \\%COMPUTERNAME%\OXCNODEUNC) and runs a TypeScript module through a UNC file: URL, a relative import from a UNC parent, a UNC CLI entry point, and a file whose name contains a literal %. The fixture's tsconfig.json asks for useDefineForClassFields: false, so the expected setter output also proves tsconfig discovery works through UNC paths. The spec self-skips when the share cannot be created (no admin rights, Server service stopped).

Verified locally: cargo test (11 passed), cargo clippy --all-targets --all-features -- -D warnings clean, cargo fmt --check clean, pnpm lint clean, and the full pnpm test integration suite (74 passed, UNC spec skipped on macOS as designed).

Closes #744


Note

Medium Risk
Changes Windows ESM resolve/load URL↔path conversion on a security-sensitive boundary; scope is Windows-only with extensive Rust and integration tests, but regressions would affect UNC and unusual file URL spellings.

Overview
Fixes Windows UNC handling so \\server\share\… matches Node’s pathToFileURL / fileURLToPath form (file://server/share/…) instead of mis-parsing the authority or emitting broken URLs like file://///server/….

A new windows_file_url module (Windows production + cross-platform unit tests) implements bidirectional conversion with percent-encoding, IDNA host handling, localhost drive paths, and URL-parser edge cases. create_resolve now treats any case-insensitive file:// specifier as absolute (including UNC), strips tab/newline only for file-URL classification on Windows, escapes # in paths for the resolver while preserving query/fragment as module identity, and builds resolved URLs via path_to_file_url on Windows.

Build/test plumbing adds rlib so cargo test can link the crate, pulls idna for UTS #46 host canonicalization, runs cargo test --all-features in CI, and adds Vitest specs that use a loopback net share when admin rights allow (otherwise skipped).

Reviewed by Cursor Bugbot for commit 4c31f97. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_92354e5b-1172-410b-9940-3ced2f054f29)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-14T08:14:17.664913Z be3eb16 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 453efe10eb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib.rs Resolved
@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_6cdd6789-154c-49ca-a44d-b86a749bb58f)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d3c3c8a6e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib.rs Resolved
@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_abf293ba-3dc2-4001-8d21-f4fbc00e3fff)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f66c74b846

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib.rs Resolved
Brooooooklyn and others added 5 commits September 13, 2026 23:53
A literal % in a file name was emitted verbatim into the generated
file:// URL, so Node read it as an escape and loaded the wrong module
(or threw URIError for an unmatched %). Found by adversarial review.
A bare absolute path works on POSIX only; on Windows the drive letter
parses as a URL scheme and Node exits with ERR_UNSUPPORTED_ESM_URL_SCHEME
before the hooks register.
@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_7867df07-bb2b-4c70-8450-01083a0e323d)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 61a81ea2bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

pathToFileURL writes a non-ASCII server name as an xn-- punycode
authority; fileURLToPath maps it back through IDNA to-Unicode. Match
that on the way in or a Node-produced URL names a host nobody has.
Also pin the resolver fragment-as-path fallback with a '#'-named
fixture: percent-decoding before resolve is safe because
oxc_resolver retries the full path before treating it as a fragment.
@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_f5721624-a8ef-4da3-b1fc-acf8956ce38a)

If net share succeeded but the reachability probe failed, the old
cleanup kept the share while deleting its directory; the fixed share
name then made every later run skip silently.
@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_e2b95cef-f749-4d6d-902b-30f913d83311)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a51a2c7d80

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib.rs Resolved
The label loop re-assembled multi-label hosts without their '.'
separators, turning xn--mserver-v2a.example.com into
mýserverexamplecom.
@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_43679119-766d-46e9-addb-16c5f190d450)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c3b7966727

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib.rs Resolved
The module outgrew its inline spot in lib.rs; the tests move with it.
@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_9d51810f-7ee4-4660-88df-75ff8d95ae57)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a0b148b8e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/windows_file_url.rs Resolved
fileURLToPath rejects %5C/%2F in the pathname with
ERR_INVALID_FILE_URL_PATH, and pathToFileURL ignores the \\?\UNC\ and
\\?\ extended-length prefixes. Reject the escapes before decoding and
strip the prefixes before building the URL, verified against Node v24's
Windows code paths via options.windows.
@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_6b6474bb-b5a6-458c-8ad7-0d47dbfd34bb)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7d37130c21

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/windows_file_url.rs Resolved
Comment thread src/windows_file_url.rs Resolved
The query/fragment is not part of the filesystem path: split it off
before the separator checks and pass it through raw, so file://…?key=%2F
stops failing. The authority now rejects escapes that decode to
forbidden host code points (%20, %5C, %2F, a malformed %) the way
Node's URL parser does, while allowed escapes such as %C3%BD still
resolve to the Unicode server name.
@cursor

cursor Bot commented Sep 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_487afe50-5ec6-4d56-94c8-4037c78cf83b)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71b676e17b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib.rs Resolved
The rewrite ran before classification and mutated every specifier:
no\tde:fs became node:fs (an unrelated builtin) and lo\tdash became
lodash. The cleaned spelling now feeds only the file-URL check and
conversion; every other branch sees the original specifier.
@cursor

cursor Bot commented Sep 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_b0efe443-2780-437c-819a-4bfb3d1915d2)

The block scope dropped the borrow before file_specifier could use it;
this only failed to compile on Windows, where the cfg(windows) branch
exists.
@cursor

cursor Bot commented Sep 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_06c2ba6f-e35e-4ff1-9808-e211d2fcb792)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8a069afd4f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/windows_file_url.rs Resolved
The URL parser normalizes C| to C: before processing dot segments, so
file://server/C|/../share/app.js is \server\C:\share\app.js; the
normalizer now recognizes the pipe spelling as a drive prefix and
folds a kept drive segment to its colon form.
@cursor

cursor Bot commented Sep 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_52ebf991-fc69-45e8-877a-2294828338ca)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5475227af0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/windows_file_url.rs Resolved
Take idna for exact Node parity on Unicode authorities: fullwidth and
compatibility characters fold to their ASCII forms (localhost
is localhost, ℡ is tel) and valid xn-- labels decode, while invalid
hosts stay literal the way Node is lenient about them. The dependency
is Windows-only in production builds and a dev-dependency so the
module's tests link everywhere; the hand-rolled punycode decoder is
gone.
@cursor

cursor Bot commented Sep 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_3e0838ad-f2d1-47b2-92fc-71e857d1310f)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 72cd128b55

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/windows_file_url.rs Resolved
Comment thread src/windows_file_url.rs Resolved
Comment thread src/windows_file_url.rs Resolved
…e drives

The parser canonicalizes the authority before anything else: fullwidth
127.1 is IPv4 127.0.0.1 and 256.1 is rejected. The
forbidden-character check now also runs on the mapped host, so %
mapping to % is rejected. A leading C| drive folds even without dot
segments, while a pipe in a later segment stays literal.
@cursor

cursor Bot commented Sep 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_1ae86883-0849-4e19-ae05-5172c16398fc)

@cursor

cursor Bot commented Sep 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_ee1c2e07-83d0-4b6c-9c91-6bff371e3922)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 47b78e140a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/windows_file_url.rs Resolved
The lenient fallback kept every mapping failure, so a zero-width joiner
or a lone soft hyphen (mapping to an empty host) produced a UNC path
Node rejects. Only undecodable xn-- labels keep their literal spelling,
matching Node; everything else failing to map is rejected.
@cursor

cursor Bot commented Sep 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_15646ce3-0f3e-4c75-801a-de7f26e35b74)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e107e1599

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/windows_file_url.rs Resolved
Comment thread src/windows_file_url.rs Resolved
Whole-host fallback let any xn-- label keep an unrelated invalid label
literal, and label[..4] panicked when byte four split a UTF-8 character.
UTS #46 now runs per label: undecodable xn-- labels keep their spelling,
other failures reject the host, and the prefix check is byte-based.
@cursor

cursor Bot commented Sep 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_39a4bb5f-f18b-4363-b751-3c9688e1c6c3)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be3eb16faa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/windows_file_url.rs Resolved
An xn-- label whose payload carries disallowed characters (a zero-width
joiner inside the label itself) is rejected by Node, not kept; the
literal fallback now requires the payload to validate as an ordinary
label, which still covers xn--!!!, xn--a, xn--abc-, and xn--1.
@cursor

cursor Bot commented Sep 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_471c5ee8-0110-4342-be54-ec061e7ef400)

@Brooooooklyn
Brooooooklyn merged commit 116cbcd into main Sep 14, 2026
54 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/unc-file-urls branch September 14, 2026 08:34
Brooooooklyn added a commit that referenced this pull request Nov 7, 2026
<!-- claude-projects-attribution: {"github_login":"Brooooooklyn"} -->
_Requested by **Brooklyn** · [project
thread](https://claude.ai/code/project/chan_018s9RxRdtH424j2EhXdzV3N?thread=cmsg_018s9RxRdtH424j2EhXdzV3NQxbeR8Pt7qaqSQwoq9rEFo)_

<!-- routine:prune-tests:subset-file-url-tests -->

Before: four one-line file URL tests from #760
(`windows_drive_url_parses`, `windows_drive_path_generates`,
`windows_unc_url_parses_to_unc_path`,
`non_windows_behavior_is_unchanged`) each checked a strict subset of
what another test in the same module checks. No regression fails one of
them without also failing a stronger test.

After: those four tests are gone. Only `#[cfg(test)]` modules in
`src/lib.rs` and `src/windows_file_url.rs` change.

How: each removal was defended by mutating the product code with the
most realistic regression it could catch, running `cargo test
--all-features --lib`, and reverting.

Note: the CI job "Test WASI target" (step "Test bindings") already fails
on `main`, since `ffa98c1` (#901, 2026-11-01). It will fail here too;
this PR does not touch it.

### Totals

- Files touched: 2, test modules only.
- Cases deleted: **4 of 698** (Rust lib 57, Vitest 599, integrate-module
20, integrate-module-bundler 22). After: 694.
- Cases folded: 0.
- Net lines: **−25** (+0 / −25).
- Runtime saved: under 1 ms (each removed case reports `<0.000s`).

### Removals

1. **`windows_drive_url_parses`** (`file:///C:/a/b.ts` → `C:/a/b.ts`).
Keeping the leading `/` in the drive form also fails
`windows_scheme_is_case_insensitive`,
`windows_query_and_fragment_are_not_part_of_the_path`,
`windows_dot_segments_are_normalized` and
`windows_drive_path_is_percent_encoded`.
2. **`windows_drive_path_generates`** (`C:\a\b.ts` →
`file:///C:/a/b.ts`). Not converting backslashes also fails
`windows_drive_path_is_percent_encoded` and
`windows_verbatim_prefix_is_ignored`; converting only the first one also
fails `windows_drive_path_is_percent_encoded`, whose `c:\a:b\x.ts` row
covers the same path.
3. **`windows_unc_url_parses_to_unc_path`** (a three-segment UNC URL).
Converting only the first separator, the one thing its depth adds, also
fails `windows_unc_url_decodes_escapes`, `windows_mapping_interactions`
and `windows_dot_segments_are_normalized`.
4. **`non_windows_behavior_is_unchanged`** (POSIX `file_url_to_path` for
a plain and a `%20` path). It was added with the fix for #744, Windows
URL rules leaking into POSIX paths. That bug's regression (POSIX
`file_url_to_path` calling `windows_file_url::url_to_path`) also fails
`posix_file_url_round_trips`,
`watch_report_urls_are_encoded_and_absolute_only` and
`diagnostics_render_location_and_code_frame`. Dropping `'0'` from
`hex_digit`, skipping decoding, and breaking the no-`%` fast path each
also fail other tests (5, 3 and `posix_file_url_round_trips`).

### Kept after defense

- `windows_escaped_unc_path_round_trips`: its decode-back half is the
only UNC-form check of `%25`.

### Case counts

| suite | before | after | delta |
|---|---|---|---|
| `src/windows_file_url.rs` tests | 32 | 29 | −3 |
| `src/lib.rs` tests | 25 | 24 | −1 |
| integrate-vitest, integrate-module, integrate-module-bundler | 641 |
641 | 0 |

0 failures before and after.

### What ran and what did not

- At `ffa98c1`: all three JS suites against a debug addon, and `cargo
test --all-features` with `--report-time`.
- On this branch: `cargo test --all-features --lib` (53 passed), `cargo
fmt --check`, `cargo clippy --all-targets --all-features -- -D warnings`
and `git diff --check`, all clean.
- Not run: the 3 `loader_context` tests under `--no-default-features`,
Windows, the WASI build and the bench. The JS suites were not re-run
after the change, which touches only `#[cfg(test)]` code.

Open pull requests: neither open PR (#903, #894) touches a test file.

Ages: all four tests were added on 2026-09-14 in #760 and are unchanged
since. None is in a permission or security suite.

To revert: `git revert 53ef6d7`.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01PxVsmvB9xfZKfVnUonY8kf)_

Co-authored-by: Claude <[email protected]>
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.

Windows UNC file URLs are not resolved or generated correctly

1 participant