Commit e0f5c01
fix: handle fractional day conversion for hour-based detection periods (#914)
When detection_period uses period: hour with small counts (e.g., 2),
the conversion to days produces fractional results (2/24 = 0.083).
Previously, casting to int yielded 0, which then failed validation
because the check used "if not value" (treating 0 as falsy).
Changes:
1. Use ceil() in convert_period to round up fractional days, ensuring
at least 1 day of backfill data when using hourly periods
2. Fix validation logic to check "is none" instead of "not value",
properly distinguishing between missing (None) and zero (0) values
This ensures that configurations like:
detection_period: {period: hour, count: 2}
now correctly convert to 1 day instead of 0, and that explicit
zero values are accepted as valid if provided.
Fixes issue where volume_anomalies test with hourly detection periods
would incorrectly report "Missing mandatory configuration: ['backfill_days']"
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent fc97b29 commit e0f5c01
2 files changed
Lines changed: 2 additions & 2 deletions
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
0 commit comments