Fix #746: Correct inverted type 2 normal restoral conditions - #796
Fix #746: Correct inverted type 2 normal restoral conditions#796bmfmancini wants to merge 2 commits into
Conversation
The type 2 (time-based) restoral logic in thold_check_threshold() used '<' instead of '>=' for the fail count comparisons: - Warning restoral: $warning_failures < $warning_trigger - Alert restoral: $failures < $trigger This inversion caused restorals to fire for thresholds that were never triggered (count below trigger), while silently suppressing restorals for thresholds that were actually triggered (count at or above trigger). Changed '<' to '>=' for both comparisons, matching the correct pattern used in the type 0 restoral logic which checks: $thold_data['thold_warning_fail_count'] >= $warning_trigger
somethingwithproof
left a comment
There was a problem hiding this comment.
The inverted restoral comparisons appear to be the intended fix, but this branch includes the three unrelated #789 threshold_value edits and has no behavioral coverage. Please isolate the two restoral-condition changes, add Cacti-Composer/Pest cases for never-triggered, warning-triggered, and alert-triggered type-2 thresholds returning to normal, and add the CHANGELOG entry. The integration matrix is red.
|
All four checks fail before this plugin loads because the branch’s older workflow tests unpinned Cacti develop, which crashes in core with an undefined __() call. Maintainer edits are disabled, so I cannot apply the pinned-Cacti and bounded-retry workflow fix. Please enable maintainer edits or update/rebase the branch. |
Summary
Fixes #746
In
thold_functions.php, the type 2 (time-based) normal restoral logic inthold_check_threshold()(lines ~3443 and ~3512) used<instead of>=for the fail count comparisons:Impact
The
<vs>=inversion caused:Fix
Changed
<to>=for both$warning_failuresand$failurescomparisons in the type 2 restoral block:This matches the correct pattern used in the type 0 restoral logic (line ~2685), which checks:
Testing
php -l thold_functions.php— no syntax errors.