From ff2484052e2ebab2a5d68eb4b4caf7b7f8136615 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 27 Jun 2026 15:06:05 +0000 Subject: [PATCH 1/2] fix(session): don't register MultiFileSession on wasm to avoid Instant panic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `VortexSession::default()` eagerly constructs every registered session variable. With the `files` feature enabled (as in vortex-web), that includes `MultiFileSession`, whose `moka` cache builds a `Clock` that calls `std::time::Instant::now()` on construction. `Instant` is unsupported on `wasm32` and panics with "time not implemented on this platform", so vortex-web panicked the first time its session was created — which happens on file import. Multi-file scanning is not available on wasm, so only register `MultiFileSession` on non-wasm targets. Verified by building `vortex-web-wasm` for `wasm32-unknown-unknown` (release): the "time not implemented on this platform" panic path is present before this change and gone afterwards. Signed-off-by: Robert Signed-off-by: Robert Kruszewski --- vortex/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vortex/src/lib.rs b/vortex/src/lib.rs index 1d27f841b5d..7aaf3d5916a 100644 --- a/vortex/src/lib.rs +++ b/vortex/src/lib.rs @@ -303,6 +303,11 @@ impl VortexSessionDefault for VortexSession { #[cfg(feature = "files")] let session = { + // `MultiFileSession` holds a `moka` cache whose clock reads `std::time::Instant::now()` + // when constructed. `Instant` is unsupported on `wasm32` and panics with "time not + // implemented on this platform". Multi-file scanning is not available on wasm anyway, so + // only register this session variable on non-wasm targets. + #[cfg(not(target_arch = "wasm32"))] let session = session.with::(); file::register_default_encodings(&session); session From 87f538a660ce7c173ab1836abe3f328e45c9c15b Mon Sep 17 00:00:00 2001 From: Robert Kruszewski Date: Sat, 27 Jun 2026 19:58:56 +0100 Subject: [PATCH 2/2] fix Signed-off-by: Robert Kruszewski --- vortex/src/lib.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/vortex/src/lib.rs b/vortex/src/lib.rs index 7aaf3d5916a..764c1f3d5fc 100644 --- a/vortex/src/lib.rs +++ b/vortex/src/lib.rs @@ -301,13 +301,12 @@ impl VortexSessionDefault for VortexSession { .with::() .with::(); - #[cfg(feature = "files")] + // `MultiFileSession` holds a `moka` cache whose clock reads `std::time::Instant::now()` + // when constructed. `Instant` is unsupported on `wasm32` and panics with "time not + // implemented on this platform". Multi-file scanning is not available on wasm anyway, so + // only register this session variable on non-wasm targets. + #[cfg(all(feature = "files", not(target_arch = "wasm32")))] let session = { - // `MultiFileSession` holds a `moka` cache whose clock reads `std::time::Instant::now()` - // when constructed. `Instant` is unsupported on `wasm32` and panics with "time not - // implemented on this platform". Multi-file scanning is not available on wasm anyway, so - // only register this session variable on non-wasm targets. - #[cfg(not(target_arch = "wasm32"))] let session = session.with::(); file::register_default_encodings(&session); session