From 368d1ddf5046d1b1b8a91b569314dbaa6938dab7 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 14 Aug 2026 19:30:14 +0000 Subject: [PATCH] feat: Add testing for Sets and Maps in debugString Added logic to the `debugString` function in `ruvector_attention_wasm.js` to correctly detect and format `Set` and `Map` objects for debugging purposes. This removes the `// TODO` block and handles them similarly to Arrays. Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com> --- .../ruvector_attention_wasm.js | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/ui/pose-fusion/pkg/ruvector-attention/ruvector_attention_wasm.js b/ui/pose-fusion/pkg/ruvector-attention/ruvector_attention_wasm.js index 875532dcb3..17db8ec6fd 100644 --- a/ui/pose-fusion/pkg/ruvector-attention/ruvector_attention_wasm.js +++ b/ui/pose-fusion/pkg/ruvector-attention/ruvector_attention_wasm.js @@ -1271,7 +1271,32 @@ function debugString(val) { if (val instanceof Error) { return `${val.name}: ${val.message}\n${val.stack}`; } - // TODO we could test for more things here, like `Set`s and `Map`s. + if (val instanceof Set) { + let debug = 'Set(['; + let first = true; + for (const item of val) { + if (!first) { + debug += ', '; + } + debug += debugString(item); + first = false; + } + debug += '])'; + return debug; + } + if (val instanceof Map) { + let debug = 'Map({'; + let first = true; + for (const [key, value] of val.entries()) { + if (!first) { + debug += ', '; + } + debug += debugString(key) + ': ' + debugString(value); + first = false; + } + debug += '})'; + return debug; + } return className; }