From ce49fe5187f1986f8e0a08f4318ead4833dbf5fa Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Thu, 27 Aug 2026 11:32:50 +0000 Subject: [PATCH 1/7] dev server: keep out-of-root watched paths alive across bundles When a bundled file's display path is not a substring of its absolute path (a file outside the project root, shown as ../x/dep.ts), Path::dupe_alloc put the absolute path in the per-bundle arena. bundle_v2 registers that slice with the file watcher without copying, and the dev server frees the arena when the bundle finishes, so the next fs event read freed memory on the watcher thread. Intern the absolute path in FilenameStore like every other branch and keep only the per-build display path in the arena. Also strip the trailing separator from the dev server root: after process.chdir() the cached top-level directory ends with '/', which tripped the assertion in DevServer::relative_path when a bundle failure was reported. --- src/resolver/lib.rs | 36 +++++++++++-------------- src/runtime/bake/DevServer.rs | 9 ++++--- test/bake/bake-harness.ts | 10 +++++-- test/bake/dev/html.test.ts | 34 +++++++++++++++++++++++ test/js/bun/http/bun-serve-html.test.ts | 20 ++++++++++++++ 5 files changed, 84 insertions(+), 25 deletions(-) diff --git a/src/resolver/lib.rs b/src/resolver/lib.rs index 9e5c9c02fef2..46fcee4b4326 100644 --- a/src/resolver/lib.rs +++ b/src/resolver/lib.rs @@ -486,9 +486,9 @@ pub mod fs { /// `bun_string`). Import this trait to call `.loader()` / `.dupe_alloc()` /// on a `Path`. pub trait PathResolverExt<'a> { - /// Intern `text`/`pretty` into the process-lifetime `FilenameStore`, - /// falling back to `alloc` (the per-build bundle arena) for the - /// disjoint-`text`/`pretty` case — see the impl for why. + /// Intern `text` (and `pretty`, when it is a sub-string of `text`) into + /// the process-lifetime `FilenameStore`; a disjoint `pretty` goes in + /// `alloc` (the per-build bundle arena) — see the impl for why. fn dupe_alloc(&self, alloc: &bun_alloc::MimallocArena) -> crate::CrateResult>; fn dupe_alloc_fix_pretty( @@ -582,25 +582,21 @@ pub mod fs { p.pretty = &text[offset..][..self.pretty.len()]; p } else { - // Disjoint `text`/`pretty`. Allocate one combined - // `text\0pretty\0` buffer from the per-build arena (NOT the - // process-lifetime `FilenameStore`): `pretty` here is a - // freshly-relativized display path recomputed every build, so - // interning it permanently would leak one copy per - // `Bun.build()` call. The arena is reset per build; every path - // that escapes to JS is copied into an owned buffer first. - let text_len = self.text.len(); - let buf: &mut [u8] = - alloc.alloc_slice_fill_copy(text_len + self.pretty.len() + 2, 0u8); - buf[..text_len].copy_from_slice(self.text); - buf[text_len + 1..text_len + 1 + self.pretty.len()] - .copy_from_slice(self.pretty); + // Disjoint `text`/`pretty` (e.g. a file outside + // `top_level_dir`, whose `pretty` starts with `../`). + // `text` is interned like every other branch: the file + // watcher stores it without copying and outlives the + // per-build arena. Only `pretty` — a display path recomputed + // every build — goes in the arena, so repeated `Bun.build()` + // calls don't grow `FilenameStore` by it. + let text = FilenameStore::instance().append_slice(self.text)?; + let pretty: &mut [u8] = alloc.alloc_slice_copy(self.pretty); // SAFETY: arena memory lives for the whole bundle pass; the // consuming `Path` (graph/import-record) never outlives it. - let buf: &'static [u8] = - unsafe { core::slice::from_raw_parts(buf.as_ptr(), buf.len()) }; - let mut p = Path::<'static>::init(&buf[..text_len]); - p.pretty = &buf[text_len + 1..text_len + 1 + self.pretty.len()]; + let pretty: &'static [u8] = + unsafe { core::slice::from_raw_parts(pretty.as_ptr(), pretty.len()) }; + let mut p = Path::<'static>::init(text); + p.pretty = pretty; p }; new_path.namespace = dupe_namespace(self.namespace)?; diff --git a/src/runtime/bake/DevServer.rs b/src/runtime/bake/DevServer.rs index 8c362b91d4df..a87e9921fc46 100644 --- a/src/runtime/bake/DevServer.rs +++ b/src/runtime/bake/DevServer.rs @@ -492,7 +492,12 @@ pub(crate) fn init(options: Options) -> JsResult> { // exactly once before `assume_init()` below. unsafe { w!(magic, Magic::Valid); - w!(root, Box::from(options.root.as_bytes())); + w!( + root, + Box::from(paths::string_paths::without_trailing_slash_windows_path( + options.root.as_bytes() + )) + ); w!(vm, bun_ptr::BackRef::new(options.vm)); w!(vm_handle, options.vm.handle()); w!(server, None); @@ -6002,8 +6007,6 @@ impl DevServer { relative_path_buf: &'a mut PathBuffer, path: &'a [u8], ) -> &'a [u8] { - debug_assert!(self.root[self.root.len() - 1] != b'/'); - if !paths::is_absolute(path) { return path; } diff --git a/test/bake/bake-harness.ts b/test/bake/bake-harness.ts index ac25e7db68be..df3335261457 100644 --- a/test/bake/bake-harness.ts +++ b/test/bake/bake-harness.ts @@ -127,6 +127,12 @@ export interface DevServerTest { * Avoid if possible, this is to reproduce specific bugs. */ mainDir?: string; + /** + * Working directory of the dev server process, relative to the test root. + * `Bun.serve` HTML routes use this as the project root, so files outside of + * it get `../` relative paths. + */ + cwd?: string; skip?: ("win32" | "darwin" | "linux" | "ci")[]; /** @@ -2080,8 +2086,8 @@ function testImpl( }; await using devProcess = Bun.spawn({ - cwd: root, - cmd: [process.execPath, "./harness_start.ts"], + cwd: path.join(root, options.cwd ?? "."), + cmd: [process.execPath, path.join(root, "harness_start.ts")], env: mergeWindowEnvs([ bunEnv, { diff --git a/test/bake/dev/html.test.ts b/test/bake/dev/html.test.ts index c79ed5d0222a..a835a75a31e5 100644 --- a/test/bake/dev/html.test.ts +++ b/test/bake/dev/html.test.ts @@ -370,3 +370,37 @@ devTest("error report endpoint blanks stray non-text bytes in reported frames", await dev.fetch("/").expect.toInclude("

Frame Bytes

"); }, }); +devTest("editing a file imported from outside the project root hot-reloads", { + files: { + "web/index.html": emptyHtmlFile({ + scripts: ["index.ts"], + }), + "web/index.ts": ` + import { value } from "../outside/dep"; + console.log(value); + import.meta.hot.accept(); + `, + "outside/dep.ts": ` + export const value = "one"; + `, + }, + cwd: "web", + async test(dev) { + await using c = await dev.client("/"); + await c.expectMessage("one"); + await dev.write( + "outside/dep.ts", + ` + export const value = "two"; + `, + ); + await c.expectMessage("two"); + await dev.write( + "outside/dep.ts", + ` + export const value = "three"; + `, + ); + await c.expectMessage("three"); + }, +}); diff --git a/test/js/bun/http/bun-serve-html.test.ts b/test/js/bun/http/bun-serve-html.test.ts index d54976324d45..5081dd386d14 100644 --- a/test/js/bun/http/bun-serve-html.test.ts +++ b/test/js/bun/http/bun-serve-html.test.ts @@ -1095,6 +1095,26 @@ test.concurrent("server.reload() while an html route's first bundle is still in }); }); +// process.chdir() leaves the cached top-level directory with a trailing slash, +// which the dev server then used as its root when reporting a bundle failure. +test.concurrent("dev server started after process.chdir() reports bundle failures", async () => { + using dir = tempDir("bun-serve-html-chdir", { + "app/index.html": ``, + "app/app.ts": `import { nope } from "./does-not-exist";\nconsole.log(nope);`, + "serve.ts": /*ts*/ ` + import html from "./app/index.html"; + process.chdir(import.meta.dir + "/app"); + const server = Bun.serve({ port: 0, development: true, routes: { "/": html } }); + const res = await fetch(server.url); + console.log(JSON.stringify({ status: res.status })); + server.stop(true); + `, + }); + const { stdout, stderr, exitCode } = await runServeFixture(dir); + expect(stderr).toContain(`Could not resolve: "./does-not-exist"`); + expect({ stdout, exitCode }, stderr).toEqual({ stdout: JSON.stringify({ status: 500 }), exitCode: 0 }); +}); + test("wildcard static routes", async () => { await using dir = tempDir("bun-serve-html-error-handling", { "index.html": /*html*/ ` From 8fbe23c056118631d0962e292cdb4094c2b5da0b Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Thu, 27 Aug 2026 11:41:34 +0000 Subject: [PATCH 2/7] test: assert stdout before exit code --- test/js/bun/http/bun-serve-html.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/js/bun/http/bun-serve-html.test.ts b/test/js/bun/http/bun-serve-html.test.ts index 5081dd386d14..b4363831dab9 100644 --- a/test/js/bun/http/bun-serve-html.test.ts +++ b/test/js/bun/http/bun-serve-html.test.ts @@ -1112,7 +1112,8 @@ test.concurrent("dev server started after process.chdir() reports bundle failure }); const { stdout, stderr, exitCode } = await runServeFixture(dir); expect(stderr).toContain(`Could not resolve: "./does-not-exist"`); - expect({ stdout, exitCode }, stderr).toEqual({ stdout: JSON.stringify({ status: 500 }), exitCode: 0 }); + expect(stdout, stderr).toBe(JSON.stringify({ status: 500 })); + expect(exitCode).toBe(0); }); test("wildcard static routes", async () => { From d1877359d1df5c9a57e3c0d58ab7aeca1e0fd0a5 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Thu, 27 Aug 2026 11:58:11 +0000 Subject: [PATCH 3/7] dupe_alloc: reuse an already-interned text instead of re-appending it (BSSStringList::as_interned) --- src/bun_alloc/lib.rs | 11 +++++++++++ src/resolver/lib.rs | 17 ++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/bun_alloc/lib.rs b/src/bun_alloc/lib.rs index 288aab179dff..58db86bb3749 100644 --- a/src/bun_alloc/lib.rs +++ b/src/bun_alloc/lib.rs @@ -2016,6 +2016,17 @@ impl BSSStringList Option<&'static [u8]> { + if !self.exists(value) { + return None; + } + // SAFETY: `exists` proved `value` lies inside `backing_buf`, which is + // never freed or moved (process-lifetime singleton) and whose written + // prefix is immutable once appended. + Some(unsafe { core::slice::from_raw_parts(value.as_ptr(), value.len()) }) + } + /// Append `value` and return a mutable slice over the freshly-reserved bytes. /// /// Takes `*mut Self` (not `&mut self`) so callers can pass the raw diff --git a/src/resolver/lib.rs b/src/resolver/lib.rs index 46fcee4b4326..63a54511943d 100644 --- a/src/resolver/lib.rs +++ b/src/resolver/lib.rs @@ -122,6 +122,12 @@ pub mod fs { // SAFETY: see `append_slice`. unsafe { &*$backing() }.exists(value) } + /// `value` with the store's lifetime, if it already points into the store. + #[inline] + pub fn as_interned(&self, value: &[u8]) -> Option<&'static [u8]> { + // SAFETY: see `append_slice`; the singleton is `'static`. + unsafe { &*$backing() }.as_interned(value) + } } }; } @@ -574,10 +580,16 @@ pub mod fs { if is_interned(self.text) && is_interned(self.pretty) { return return_self_static(); } + // `text` may already be interned from an earlier pass over this + // file (only `pretty` is per-build); reuse it instead of growing + // the append-only store. + let text = match FilenameStore::instance().as_interned(self.text) { + Some(text) => text, + None => FilenameStore::instance().append_slice(self.text)?, + }; let mut new_path = if let Some(offset) = bun_core::strings::index_of(self.text, self.pretty) { - // `text` contains `pretty`; intern `text` once and re-slice. - let text = FilenameStore::instance().append_slice(self.text)?; + // `text` contains `pretty`; re-slice the interned copy. let mut p = Path::<'static>::init(text); p.pretty = &text[offset..][..self.pretty.len()]; p @@ -589,7 +601,6 @@ pub mod fs { // per-build arena. Only `pretty` — a display path recomputed // every build — goes in the arena, so repeated `Bun.build()` // calls don't grow `FilenameStore` by it. - let text = FilenameStore::instance().append_slice(self.text)?; let pretty: &mut [u8] = alloc.alloc_slice_copy(self.pretty); // SAFETY: arena memory lives for the whole bundle pass; the // consuming `Path` (graph/import-record) never outlives it. From 79f546ad981a4f02c96d5ce94d3b581934a9756a Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Thu, 27 Aug 2026 12:18:12 +0000 Subject: [PATCH 4/7] dupe_alloc: look up the interned text in DirnameStore as well The resolver caches file abs paths in DirnameStore, so checking only FilenameStore never matched and text was re-appended on every rebuild. --- src/resolver/lib.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/resolver/lib.rs b/src/resolver/lib.rs index 63a54511943d..0dd8710123cd 100644 --- a/src/resolver/lib.rs +++ b/src/resolver/lib.rs @@ -580,10 +580,14 @@ pub mod fs { if is_interned(self.text) && is_interned(self.pretty) { return return_self_static(); } - // `text` may already be interned from an earlier pass over this - // file (only `pretty` is per-build); reuse it instead of growing - // the append-only store. - let text = match FilenameStore::instance().as_interned(self.text) { + // `text` is normally already interned (the resolver caches file + // abs paths in `DirnameStore`; an earlier pass may have put it in + // `FilenameStore`); only `pretty` is per-build. Reuse it instead + // of growing the append-only store on every rebuild. + let text = match DirnameStore::instance() + .as_interned(self.text) + .or_else(|| FilenameStore::instance().as_interned(self.text)) + { Some(text) => text, None => FilenameStore::instance().append_slice(self.text)?, }; From 9942ba537f480b849b6da4b1bf9a6105de786b0a Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Thu, 27 Aug 2026 12:39:36 +0000 Subject: [PATCH 5/7] dupe_alloc: keep non-interned text and namespace in the bundle arena; watcher copies non-interned paths The disjoint text/pretty branch also covers plugin modules in a non-file namespace, whose text and namespace are per-build boxes. Interning text there grew FilenameStore on every Bun.build(). Go back to the per-build arena for a text (and namespace) the resolver has not already interned, and have bundle_v2 hand the watcher an owned copy of any source path that is not interned, since BSSStringList::exists only covers the fixed backing buffer and a path that spilled to an overflow allocation reads as not interned. DevServer::init normalizes the root once and uses it for the router and FileSystem::init as well. --- src/bundler/bundle_v2.rs | 26 ++++---- src/resolver/lib.rs | 79 +++++++++++++++---------- src/runtime/bake/DevServer.rs | 13 ++-- test/js/bun/http/bun-serve-html.test.ts | 5 +- 4 files changed, 72 insertions(+), 51 deletions(-) diff --git a/src/bundler/bundle_v2.rs b/src/bundler/bundle_v2.rs index d7f720687be8..4d09a612fcd3 100644 --- a/src/bundler/bundle_v2.rs +++ b/src/bundler/bundle_v2.rs @@ -7154,18 +7154,24 @@ pub mod bv2_impl { .path .text; if this.should_add_watcher(source_path) { - // const generic `CLONE_FILE_PATH = isWindows` - // matches `cfg!(windows)` at compile time. - let _ = this - .bun_watcher_mut() - .unwrap() - .add_file::<{ cfg!(windows) }>( - parse_result.watcher_data.fd, + let fd = parse_result.watcher_data.fd; + let dir_fd = parse_result.watcher_data.dir_fd; + let hash = bun_wyhash::hash(source_path) as u32; + let bun_watcher = this.bun_watcher_mut().unwrap(); + // The watcher keeps the path past this bundle; borrow it + // only when it is interned for the process lifetime + // (`dupe_alloc` leaves other paths in the bundle arena). + let _ = if Fs::as_interned_path(source_path).is_some() { + bun_watcher.add_file::<{ cfg!(windows) }>( + fd, source_path, - bun_wyhash::hash(source_path) as u32, - parse_result.watcher_data.dir_fd, + hash, + dir_fd, None, - ); + ) + } else { + bun_watcher.add_file::(fd, source_path, hash, dir_fd, None) + }; } } } diff --git a/src/resolver/lib.rs b/src/resolver/lib.rs index 0dd8710123cd..a0beaf4a5355 100644 --- a/src/resolver/lib.rs +++ b/src/resolver/lib.rs @@ -476,6 +476,17 @@ pub mod fs { // `bun_wyhash`, `bun_options_types`) remain here as an extension trait. pub use bun_paths::fs::{Path, PathName}; + /// `value` with the stores' lifetime, if it already points into the + /// process-lifetime `DirnameStore` or `FilenameStore`. Only their fixed + /// backing buffers are checked; a path that spilled into an overflow + /// allocation reads as not interned. + #[inline] + pub fn as_interned_path(value: &[u8]) -> Option<&'static [u8]> { + DirnameStore::instance() + .as_interned(value) + .or_else(|| FilenameStore::instance().as_interned(value)) + } + /// Intern a `Path.namespace` for `dupe_alloc`. The common `file`/empty /// namespace is a static literal (no allocation); anything else is interned /// into the process-lifetime `FilenameStore`. @@ -492,9 +503,11 @@ pub mod fs { /// `bun_string`). Import this trait to call `.loader()` / `.dupe_alloc()` /// on a `Path`. pub trait PathResolverExt<'a> { - /// Intern `text` (and `pretty`, when it is a sub-string of `text`) into - /// the process-lifetime `FilenameStore`; a disjoint `pretty` goes in - /// `alloc` (the per-build bundle arena) — see the impl for why. + /// Intern `text`/`pretty` into the process-lifetime `FilenameStore` + /// (reusing an already-interned `text`); when `pretty` is not a + /// sub-string of `text`, `pretty` and any not-yet-interned + /// `text`/`namespace` go in `alloc` (the per-build bundle arena) + /// instead. See the impl for why. fn dupe_alloc(&self, alloc: &bun_alloc::MimallocArena) -> crate::CrateResult>; fn dupe_alloc_fix_pretty( @@ -520,9 +533,7 @@ pub mod fs { &self, alloc: &bun_alloc::MimallocArena, ) -> crate::CrateResult> { - let is_interned = |slice: &[u8]| { - FilenameStore::instance().exists(slice) || DirnameStore::instance().exists(slice) - }; + let is_interned = |slice: &[u8]| as_interned_path(slice).is_some(); // Returning `self` unchanged widens `text`/`pretty`/`namespace` to // `'static`; the caller has already proven `text`/`pretty` are // interned, so assert `namespace` is too (static literal or store- @@ -580,39 +591,43 @@ pub mod fs { if is_interned(self.text) && is_interned(self.pretty) { return return_self_static(); } - // `text` is normally already interned (the resolver caches file - // abs paths in `DirnameStore`; an earlier pass may have put it in - // `FilenameStore`); only `pretty` is per-build. Reuse it instead - // of growing the append-only store on every rebuild. - let text = match DirnameStore::instance() - .as_interned(self.text) - .or_else(|| FilenameStore::instance().as_interned(self.text)) - { - Some(text) => text, - None => FilenameStore::instance().append_slice(self.text)?, - }; let mut new_path = if let Some(offset) = bun_core::strings::index_of(self.text, self.pretty) { // `text` contains `pretty`; re-slice the interned copy. + let text = match as_interned_path(self.text) { + Some(text) => text, + None => FilenameStore::instance().append_slice(self.text)?, + }; let mut p = Path::<'static>::init(text); p.pretty = &text[offset..][..self.pretty.len()]; p } else { - // Disjoint `text`/`pretty` (e.g. a file outside - // `top_level_dir`, whose `pretty` starts with `../`). - // `text` is interned like every other branch: the file - // watcher stores it without copying and outlives the - // per-build arena. Only `pretty` — a display path recomputed - // every build — goes in the arena, so repeated `Bun.build()` - // calls don't grow `FilenameStore` by it. - let pretty: &mut [u8] = alloc.alloc_slice_copy(self.pretty); - // SAFETY: arena memory lives for the whole bundle pass; the - // consuming `Path` (graph/import-record) never outlives it. - let pretty: &'static [u8] = - unsafe { core::slice::from_raw_parts(pretty.as_ptr(), pretty.len()) }; - let mut p = Path::<'static>::init(text); - p.pretty = pretty; - p + // Disjoint `text`/`pretty`: a file outside `top_level_dir` + // (`pretty` starts with `../`) or a plugin module in a + // non-`file` namespace (`pretty` is `:`). `pretty` is + // recomputed every build, and so are `text`/`namespace` unless + // the resolver already interned them, so they go in the + // per-build arena rather than growing the append-only stores + // on every `Bun.build()`. Holders that outlive the bundle (the + // file watcher) copy. + let arena_z = |s: &[u8]| -> &'static [u8] { + let buf: &mut [u8] = alloc.alloc_slice_fill_copy(s.len() + 1, 0u8); + buf[..s.len()].copy_from_slice(s); + // SAFETY: arena memory lives for the whole bundle pass; the + // consuming `Path` (graph/import-record) never outlives it. + unsafe { core::slice::from_raw_parts(buf.as_ptr(), s.len()) } + }; + let mut p = Path::<'static>::init( + as_interned_path(self.text).unwrap_or_else(|| arena_z(self.text)), + ); + p.pretty = arena_z(self.pretty); + p.namespace = match self.namespace { + b"" | b"file" => b"file", + ns => as_interned_path(ns).unwrap_or_else(|| arena_z(ns)), + }; + p.is_symlink = self.is_symlink; + p.is_disabled = self.is_disabled; + return Ok(p); }; new_path.namespace = dupe_namespace(self.namespace)?; new_path.is_symlink = self.is_symlink; diff --git a/src/runtime/bake/DevServer.rs b/src/runtime/bake/DevServer.rs index a87e9921fc46..7cf930b20e72 100644 --- a/src/runtime/bake/DevServer.rs +++ b/src/runtime/bake/DevServer.rs @@ -478,6 +478,8 @@ pub(crate) fn init(options: Options) -> JsResult> { let mut dev_uninit: Box> = Box::new(MaybeUninit::uninit()); let p: *mut DevServer = dev_uninit.as_mut_ptr(); + let root = paths::string_paths::without_trailing_slash_windows_path(options.root.as_bytes()); + /// `addr_of_mut!((*p).$field).write($value)` — writes a single field of the /// partially-initialized `DevServer` without materializing `&mut DevServer`. macro_rules! w { @@ -492,12 +494,7 @@ pub(crate) fn init(options: Options) -> JsResult> { // exactly once before `assume_init()` below. unsafe { w!(magic, Magic::Valid); - w!( - root, - Box::from(paths::string_paths::without_trailing_slash_windows_path( - options.root.as_bytes() - )) - ); + w!(root, Box::from(root)); w!(vm, bun_ptr::BackRef::new(options.vm)); w!(vm_handle, options.vm.handle()); w!(server, None); @@ -579,7 +576,7 @@ pub(crate) fn init(options: Options) -> JsResult> { w!( router, FrameworkRouter { - root: Box::from(options.root.as_bytes()), + root: Box::from(root), types: Box::new([]), routes: Vec::new(), static_routes: Default::default(), @@ -595,7 +592,7 @@ pub(crate) fn init(options: Options) -> JsResult> { // FileSystem is a process-lifetime singleton; `init` interns the path into // the `DirnameStore` (process-lifetime arena) so no caller-side leak is // needed for the `'static` it stores. - let _fs = match bun_resolver::fs::FileSystem::init(Some(options.root.as_bytes())) { + let _fs = match bun_resolver::fs::FileSystem::init(Some(root)) { Ok(fs) => fs, Err(err) => return Err(global.throw_error(err, generic_action)), }; diff --git a/test/js/bun/http/bun-serve-html.test.ts b/test/js/bun/http/bun-serve-html.test.ts index b4363831dab9..3b9d66175c7c 100644 --- a/test/js/bun/http/bun-serve-html.test.ts +++ b/test/js/bun/http/bun-serve-html.test.ts @@ -1096,7 +1096,10 @@ test.concurrent("server.reload() while an html route's first bundle is still in }); // process.chdir() leaves the cached top-level directory with a trailing slash, -// which the dev server then used as its root when reporting a bundle failure. +// which the dev server then used as its root. Reporting a bundle failure +// relativizes the failing file against that root and hit a debug assertion +// (abort, exit code 134). Release builds compile the assertion out and produce +// the same relative path either way, so this only fails on a debug build. test.concurrent("dev server started after process.chdir() reports bundle failures", async () => { using dir = tempDir("bun-serve-html-chdir", { "app/index.html": ``, From 7d66de8496302820e8b3cd749a58e8c8614ddc8f Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Thu, 27 Aug 2026 12:48:13 +0000 Subject: [PATCH 6/7] as_interned: state why no &mut alias can exist for the returned bytes --- src/bun_alloc/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bun_alloc/lib.rs b/src/bun_alloc/lib.rs index 58db86bb3749..86cb45d1d1e9 100644 --- a/src/bun_alloc/lib.rs +++ b/src/bun_alloc/lib.rs @@ -2022,8 +2022,10 @@ impl BSSStringList Date: Thu, 27 Aug 2026 13:06:55 +0000 Subject: [PATCH 7/7] test: skip the out-of-root hot-reload case on Windows (not watched there) --- test/bake/dev/html.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/bake/dev/html.test.ts b/test/bake/dev/html.test.ts index a835a75a31e5..fd25b0a84801 100644 --- a/test/bake/dev/html.test.ts +++ b/test/bake/dev/html.test.ts @@ -371,6 +371,8 @@ devTest("error report endpoint blanks stray non-text bytes in reported frames", }, }); devTest("editing a file imported from outside the project root hot-reloads", { + // The Windows watcher does not watch files outside the project directory. + skip: ["win32"], files: { "web/index.html": emptyHtmlFile({ scripts: ["index.ts"],