A jsonpath condition with a negative array index (e.g. [BODY].data[-1]
or [BODY][-1]) reached array[arrayIndex] with a negative index because
the len(array) > arrayIndex bounds checks are satisfied by any negative
value, causing a 'runtime error: index out of range [-1]' panic. Since
condition evaluation runs in the watchdog with no recover(), this would
crash the process.
Guard against negative indices alongside the existing strconv.Atoi error
check so an out-of-range negative index returns nil (treated as an
invalid path) instead of panicking. Adds tests for negative indices on
keyed arrays, root arrays, and negative-index-followed-by-key.
Made by an AI agent (Claude Code, model Claude Opus 4.8).
Co-authored-by: TwiN <twin@linux.com>
* docs: Don't include Pushover in alerting provider examples
* fix(condition): Partially support numbers with floating point
Fixes#433
Does not add support for decimal numbers, but it converts float64 to int64.
The reason why I'm not just using float64 instead of int64 is because float64 does not support all the numbers that int64 supports, which means this would be a breaking change. Instead, this change at least supports the non-decimal part of floating point numbers.
This is an improvement over the current implementation, as right now, numbers with decimals are just converted to 0 when compared using a non-equal operator