Commit 3219f31
authored
fix: temperature filter panics when bounds not configured (#175)
## Problem
The `filter_temperature` function in the temperature WASM operator
panics when `temperature_lower_bound` and `temperature_upper_bound` are
not provided via `moduleConfigurations`. The complex graph YAML
(`graph-complex.yaml`) does not include these parameters, so deploying
the complex graph example causes the temperature filter to crash on
every message with:
```
Lower bound not initialized
```
This means the complex graph never produces temperature statistics in
its output (humidity and object detection work fine).
## Fix
Two changes (belt and suspenders):
1. **Code fix** (`temperature/src/lib.rs`): Use sensible defaults
(`-40°C` lower, `3422°C` upper / melting point of tungsten) instead of
panicking. Logs which defaults are in use.
2. **Graph fix** (`graph-complex.yaml`): Add `temperature_lower_bound`
and `temperature_upper_bound` to `moduleConfigurations` so the
parameters are discoverable and configurable.
## Testing
- Built and verified with `cargo build --target wasm32-wasip2 --release`
(Rust 1.87)
- Also verified with `wasm32-wasip1` target
- Discovered during end-to-end documentation validation of the WASM data
flow graph docs on a live AIO k3s cluster1 parent 425f9c8 commit 3219f31
File tree
2 files changed
+31
-11
lines changed- samples/wasm
- operators/temperature/src
2 files changed
+31
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
294 | 297 | | |
295 | 298 | | |
296 | 299 | | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
| 314 | + | |
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
334 | 340 | | |
335 | 341 | | |
336 | 342 | | |
337 | 343 | | |
338 | 344 | | |
339 | | - | |
| 345 | + | |
340 | 346 | | |
341 | 347 | | |
342 | 348 | | |
| |||
356 | 362 | | |
357 | 363 | | |
358 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
359 | 371 | | |
360 | 372 | | |
361 | 373 | | |
| |||
386 | 398 | | |
387 | 399 | | |
388 | 400 | | |
389 | | - | |
390 | | - | |
| 401 | + | |
| 402 | + | |
391 | 403 | | |
392 | 404 | | |
393 | 405 | | |
| |||
402 | 414 | | |
403 | 415 | | |
404 | 416 | | |
405 | | - | |
| 417 | + | |
406 | 418 | | |
407 | 419 | | |
408 | 420 | | |
| |||
0 commit comments