fix(feature_flags): handle same-hour midnight rollover and reject malformed HH:MM - #8428
Open
dreamorosi wants to merge 1 commit into
Open
fix(feature_flags): handle same-hour midnight rollover and reject malformed HH:MM#8428dreamorosi wants to merge 1 commit into
dreamorosi wants to merge 1 commit into
Conversation
…formed HH:MM SCHEDULE_BETWEEN_TIME_RANGE decided whether a range crossed midnight by comparing hours only, so a range like 23:30 -> 23:00 (equal hours) took the same-day branch and could never match. Compare minutes since midnight instead. TIME_RANGE_PATTERN was unanchored and used with re.match, so values such as "10:00abc" passed schema validation and then failed silently at evaluation time. Anchor the pattern so only exact HH:MM strings validate. Fixes #8423
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #8428 +/- ##
========================================
Coverage 96.65% 96.65%
========================================
Files 296 296
Lines 14767 14769 +2
Branches 1246 1246
========================================
+ Hits 14273 14275 +2
Misses 359 359
Partials 135 135 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dreamorosi
marked this pull request as ready for review
September 3, 2026 16:26
dreamorosi
requested review from
hjgraca and
leandrodamascena
and removed request for
hjgraca
September 3, 2026 16:26
Contributor
|
I'll review this by tomorrow. |
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.



Issue number: closes #8423
Summary
Changes
SCHEDULE_BETWEEN_TIME_RANGEnow treats any range whose end is earlier than its start on the clock as crossing midnight, and schema validation only accepts values that are exactlyHH:MM.Rollover was decided by comparing hours alone, so a range like
START: "23:30", END: "23:00"(equal hours) fell into the same-day branchstart <= now <= end, which can never hold. The comparator now compares minutes since midnight.Separately,
TIME_RANGE_PATTERNwas unanchored and used withre.match, so"10:00abc"validated and then raised insideint()at evaluation time, where_match_by_actionswallows the error and returnsFalse. The pattern is now anchored (^(?:2[0-3]|[01]\d):[0-5]\d$) so the misconfiguration surfaces as aSchemaValidationError.Regression tests cover a same-hour overnight range at a time inside it (10:00) and at the only uncovered gap (23:15), plus malformed
START/ENDstrings with trailing or leading garbage and extra digits. All four new cases fail against the previous code.This also aligns evaluation with the TypeScript port in aws-powertools/powertools-lambda-typescript#5614.
User experience
Before
{"START": "23:30", "END": "23:00"}silently never matched, at any time of day.{"START": "10:00abc", "END": "12:00"}passedSchemaValidator().validate()and then silently evaluated toFalse.After
{"START": "23:30", "END": "23:00"}matches from 23:30 through 23:00 the next day, i.e. everything except 23:00-23:30.{"START": "10:00abc", "END": "12:00"}raisesSchemaValidationError: 'START' and 'END' must be a valid time format, time_format=%H:%M, rule=...at validation time.Existing valid
HH:MMconfigurations are unaffected.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.