Skip to content

bundler: canonicalize the asset source directory for [dir] only when string relativization falls outside root - #34558

Open
robobun wants to merge 12 commits into
mainfrom
farm/64ceb064/bundler-asset-dir-windows
Open

bundler: canonicalize the asset source directory for [dir] only when string relativization falls outside root#34558
robobun wants to merge 12 commits into
mainfrom
farm/64ceb064/bundler-asset-dir-windows

[autofix.ci] apply automated fixes

2d96b4a
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 18, 2026 in 11m 53s

Code review found 3 potential issues

Found 1 candidates, confirmed 3. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 3
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/bundler/bundle_v2.rs:4141-4168 Duplicated dir-canonicalization block; extract shared helper

Annotations

Check warning on line 4168 in src/bundler/bundle_v2.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

Duplicated dir-canonicalization block; extract shared helper

This ~30-line `needs(Dir)` → `openat(cwd, …, O::PATH|O::DIRECTORY)` → `get_path` → `normalize_buf` fallback → `relative_alloc(root_dir, …)` block is a near-verbatim copy of `src/bundler/linker_context/computeChunks.rs:636-676` (the PR description says it "mirrors compute_chunks"). REVIEW.md's *one implementation, in the right place* rule suggests extracting a shared helper (e.g. on `options::PathTemplate` or in `bun_paths`) so the two `[dir]` resolution paths can't drift — they already differ: `