Skip to content

Bun.file: make exists()/size/lastModified reflect the current filesystem state - #33659

Open
robobun wants to merge 20 commits into
mainfrom
farm/1db7f535/bunfile-stat-cache
Open

Bun.file: make exists()/size/lastModified reflect the current filesystem state#33659
robobun wants to merge 20 commits into
mainfrom
farm/1db7f535/bunfile-stat-cache

get_size: do not cache 0 when stat fails

f085a78
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 28, 2026 in 23m 56s

Code review found 1 important issue

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

Details

Severity Count
🔴 Important 1
🟡 Nit 0
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/runtime/webcore/Blob.rs:2257-2265 get_size seekable arm's self.size.set(available) still poisons later reads (shrink→grow)

Annotations

Check failure on line 2265 in src/runtime/webcore/Blob.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

get_size seekable arm's self.size.set(available) still poisons later reads (shrink→grow)

The seekable arm's `self.size.set(available)` at line 2264 is the sibling of the stat-failed `set(0)` you dropped in f085a78 — same read-poisoning, but via *truncate* instead of *unlink*: **exists → `.size` → `truncateSync(p, 0)` → `.size` → recreate → `.text()`** now returns `""` (pre-PR it returned the recreated content). `resolve_file_stat` on a truncated regular file yields `seekable=Some(true), max_size=0`, so this arm caches `self.size = 0`, and `do_read_file` gets `max_length = 0`. The ne