You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A time range whose end is earlier than its start on the clock should be treated as crossing midnight regardless of whether the hour digits differ, and only strings that are exactly HH:MM should pass schema validation.
Current Behaviour
Two related defects in the same code path.
Rollover is detected by comparing hours only (if int(end_hour) < int(start_hour) in comparators.py). A range like START: "23:30", END: "23:00" has equal hours, so it takes the same-day branch start <= now <= end, which can never be true. The rule silently never matches.
TIME_RANGE_PATTERN is 2[0-3]:[0-5]\d|[0-1]\d:[0-5]\d with no anchors and is used with re.match. "10:00abc" passes validation. At evaluation time int("00abc") raises, _match_by_action swallows the exception and returns False, so the misconfiguration is invisible.
Code snippet
fromaws_lambda_powertools.utilities.feature_flagsimportFeatureFlags, RuleActionfromaws_lambda_powertools.utilities.feature_flags.schemaimportSchemaValidator# 1. same-hour rollover: never matches, at any time of dayfeatures= {
"late_night": {
"default": False,
"rules": {
"almost all day": {
"when_match": True,
"conditions": [{
"action": RuleAction.SCHEDULE_BETWEEN_TIME_RANGE.value,
"key": "CURRENT_TIME",
"value": {"START": "23:30", "END": "23:00"},
}],
}
},
}
}
# 2. malformed time passes validationSchemaValidator({
"f": {"default": False, "rules": {"r": {"when_match": True, "conditions": [{
"action": RuleAction.SCHEDULE_BETWEEN_TIME_RANGE.value,
"key": "CURRENT_TIME",
"value": {"START": "10:00abc", "END": "12:00"},
}]}}}
}).validate() # no error raised
Possible Solution
Compare full minutes-since-midnight (start_h*60+start_m vs end_h*60+end_m) to decide rollover, and anchor the pattern (^(?:2[0-3]|[01]\d):[0-5]\d$) or use fullmatch.
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Activity
powertools-for-aws-oss-automation commentedon Sep 14, 2026
Warning
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
fix(feature_flags): handle same-hour midnight rollover and reject mal…
github-actions commentedon Sep 15, 2026
This is now released under 3.35.0 version!