Skip to content

fix(bench): load benchmark sources as file URLs so they run on Windows - #27621

Merged
OrcaWin merged 2 commits into
mainfrom
OrcaWin/bench-windows-dynamic-imports
Oct 12, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
OrcaWin/bench-windows-dynamic-imports

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15 $\color{#cf222e}{\Huge{\mathbf{−}}}$​10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5

ELI5

Two of Orca's speed tests crashed on Windows before measuring anything. They now run.

What Changed

bench:session-write-hot-path and bench:agent-inspection-cadence load TypeScript sources with await import(path.join(...)). On Windows that path starts with C:\, which Node reads as a URL scheme, so both exited with ERR_UNSUPPORTED_ESM_URL_SCHEME. They now pass pathToFileURL(...).href. The fish mode-2031 trace script had the same pattern and gets the same fix.

Why

A file URL is the form Node requires for dynamic import on Windows, and it's what other benchmarks in the repo already use. Without these benchmarks, Windows performance fixes can't be measured.

This is @paoValle's fix from #25237, cherry-picked with authorship kept. They closed that PR only to cut down their open PRs, not because anything was wrong with it. The only addition is an oxfmt re-wrap of one line.

Linked Issue

Refs #25235: this fixes the import crash. The idle-CPU part is in a separate PR.

Visual Proof

N/A: these are command-line benchmark scripts with no UI.

Testing

On Windows 11:

  • Before (main): both commands exit 1 with ERR_UNSUPPORTED_ESM_URL_SCHEME.

  • After: both exit 0 and print their tables, e.g. scrollback scan 15.7 ms → 2.9 ms, and 8 panes 84 → 32 inspections.

  • oxlint, oxfmt --check and check:code-quality:changed are clean.

  • The fish script was only syntax-checked, because its harness needs a POSIX shell.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below: these are benchmark scripts; running them is the test.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered: pathToFileURL is correct on every platform

paoValle and others added 2 commits October 11, 2026 15:36
`await import(path.join(ROOT, '...ts'))` hands Node a bare Windows path
(`C:\...`), which the ESM loader rejects as an unsupported URL scheme
("Received protocol 'c:'"). The two benchmarks that load production
modules this way crashed on Windows before running a single scenario,
while working on macOS and Linux where an absolute path is a valid
specifier.

Wrap each computed specifier in `pathToFileURL(...).href`, the form the
other benchmark scripts already use for the same purpose.

Verified on Windows: bench:session-write-hot-path and
bench:agent-inspection-cadence now run and print their measurement
tables. The fish mode-2031 trace capture resolves its import too, but its
harness targets macOS/Linux shells and cannot complete on Windows.

Fixes #25235
@coderabbitai

coderabbitai Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8a41dc3c-db7e-4855-bf1d-22be563bf755

📥 Commits

Reviewing files that changed from the base of the PR and between b022406 and e386b69.


📒 Files selected for processing (3)
  • config/scripts/agent-inspection-cadence-batching-benchmark.mjs
  • config/scripts/session-write-hot-path-benchmark.mjs
  • tests/tools/fish-mode2031-repro/capture-fish-mode2031-trace.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.



📝 Walkthrough

Walkthrough

Three scripts now convert local source-file paths to file URLs before dynamically importing local modules. The benchmark scenarios and capture-count logic are unchanged. The trace harness keeps its node-pty import unchanged.


Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to e386b

The reported Windows import failure is addressed by passing file URLs to the dynamic imports. The supplied context identifies no remaining merge-blocking risk.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the main change: using file URLs for benchmark imports to fix Windows execution.
Description check Passed The description is mostly complete. It explains the problem, change, rationale, linked issue, testing, and cross-platform impact. Some template sections, including Review, Agent skill upstream boundar…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@OrcaWin
OrcaWin merged commit bb12a8a into main Oct 12, 2026
29 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