fix: accept numeric zero for RangeThreshold min/max (#681) - #715
Open
sankalpsthakur wants to merge 1 commit into
Open
fix: accept numeric zero for RangeThreshold min/max (#681)#715sankalpsthakur wants to merge 1 commit into
sankalpsthakur wants to merge 1 commit into
Conversation
RangeThreshold (and greater/lesser thresholds) must treat only None as missing for required float fields. Use identity checks so 0 / 0.0 remain valid bounds, and add regression tests covering construction, sanitize/deserialize, and create_check request bodies with min=0. Closes influxdata#681
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #715 +/- ##
==========================================
+ Coverage 90.38% 90.41% +0.02%
==========================================
Files 40 40
Lines 3546 3546
==========================================
+ Hits 3205 3206 +1
+ Misses 341 340 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #681
Proposed Changes
RangeThreshold.min/max(and greater/lesservalue) are required floats. Validation must use identity checks againstNoneso numeric zero (0/0.0) is a valid bound — not treated as “missing” the way a truthiness check (if not min) would.This change:
is Noneonly; zero andwithin=Falsestay valid).RangeThreshold(..., min=0, max=10, within=True)), serialization/create_checkrequest bodies, and deserialize ofmin: 0.Checklist
pytest tests/test_Thresholds.py::ThresholdZeroValueTestcompletes successfullyAI/LLM disclosure