Skip to content

fix: WasmMinCut Node.js panic from std::time (fixes #267)#268

Open
ruvnet wants to merge 1 commit intomainfrom
fix/wasm-mincut-time-panic-267
Open

fix: WasmMinCut Node.js panic from std::time (fixes #267)#268
ruvnet wants to merge 1 commit intomainfrom
fix/wasm-mincut-time-panic-267

Conversation

@ruvnet
Copy link
Owner

@ruvnet ruvnet commented Mar 18, 2026

Summary

Changes

  • New: crates/ruvector-mincut/src/time_compat.rs - PortableInstant/PortableTimestamp
  • Updated: algorithm/mod.rs, canonical/mod.rs, certificate/audit.rs, certificate/mod.rs, optimization/wasm_batch.rs, subpolynomial/mod.rs

Test plan

  • WASM build passes (cargo check --target wasm32-unknown-unknown)
  • wasm-pack build succeeds
  • Node.js smoke test passes (WasmMinCut.fromEdges, insertEdge work)
  • WasmLocalKCut still works (regression test)

🤖 Generated with claude-flow

The WASM build was panicking in Node.js because std::time::Instant
is not supported on wasm32-unknown-unknown target. This fix:

- Adds time_compat module with PortableInstant/PortableTimestamp
- Uses monotonic counter in WASM mode (sufficient for ordering/stats)
- Uses std::time::Instant on native platforms (accurate timing)
- Updates algorithm, canonical, certificate, optimization, subpolynomial modules

The fix uses conditional compilation via the existing `wasm` feature flag.

Closes #267

Co-Authored-By: claude-flow <ruv@ruv.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WasmMinCut panics in Node.js: std::time::SystemTime not supported in wasm32-unknown-unknown

1 participant