Files
plainleaf/client
Matouš Jan FialkaandGitHub 83bf71a907 [LIQ] Fix: Coerce values to plain numbers in numeric aggregate functions (#1925)
* [LIQ] Fix: Coerce values to plain numbers in numeric aggregate functions

All numeric aggregate iterate functions (`sum`, `product`, `avg`,
`stddev`, variance, covariance, correlation, bitwise, quantile, ...)
used TypeScript as number type assertions which have no effect at
runtime.  When a value was a string (e.g., YAML `rs: '3000.0'`) or
a `LuaTaggedFloat` object JS arithmetic operators like `+=` would
silently perform string concatenation or produce `[object Object]`
nonsense instead of numeric addition.

The fix introduces a small helper wrapping the `coerceToNumber` that
correctly unwraps plain numbers, `LuaTaggedFloat` objects and numeric
strings to plain JS numbers, and applies it at every numeric aggregate
intake point.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

* [LIQ] Fix: Unwrap `LuaTaggedFloat` before passing values iterate function

`executeAggregate` now unwraps `LuaTaggedFloat` boxing before passing
values to any iterate function ensuring user-defined aggregates also
receive plain JS numbers instead of opaque internal objects.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

* Remove forgotten trivial wrapper `aggNum`

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

---------

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-04-07 11:31:28 +02:00
..
2026-03-11 14:28:45 +01:00
2026-03-26 14:03:49 +01:00
2026-04-01 08:44:50 +02:00
2025-09-19 13:23:20 +02:00
2026-03-06 13:57:28 +01:00
2025-09-19 13:23:20 +02:00
2026-03-10 09:42:48 +01:00
2026-03-20 16:10:33 +01:00
2026-03-13 09:24:52 +01:00
2026-03-17 09:57:08 +01:00
2026-04-01 07:59:01 +02:00
2026-03-26 17:54:02 +01:00
2025-09-19 13:23:20 +02:00
2026-03-26 14:19:00 +01:00
2025-09-19 13:23:20 +02:00

SilverBullet-specific code that is shared between server and client