Skip to content

audit F45 [robustness]: WorkerCache uses Instant::now() (native-only) in willow-client lib crate #545

@intendednull

Description

@intendednull

File: crates/client/src/worker_cache.rs:49, 61
Severity: robustness
Obvious? no

willow-client is required to build for wasm32-unknown-unknown (per CLAUDE.md dependency graph and dual-target rules). std::time::Instant compiles on WASM but its monotonic source uses Performance.now() only when configured; without wasm-bindgen's instant-flavored crate or feature gating, this is a documented trip-hazard.

There is no #[cfg(target_arch = "wasm32")] guard, and the function is not behind a feature flag — relies on whatever transitive Cargo features the consumer brings in.

Fix: gate the WorkerCache TTL eviction with #[cfg(not(target_arch = "wasm32"))], or replace Instant::now() with a portable monotonic source (web_time::Instant or HLC-derived timestamp).


Filed by /general-audit @ b901575 (2026-05-02). master: #513.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions