fix(utils): make getStartEndDates validation guard actually validate#643
Conversation
d908c7c to
28694c3
Compare
|
Updated: in addition to fixing the unsatisfiable guard, |
getStartEndDates had no production callers (referenced only by its own definition and the barrel re-export) and its validation guard was dead code. Rather than fix a dead function, remove it. Its sibling getStartEnd (4 callers) stays in the same file. Surfaced while reviewing the data-utils tests in #528 — the getStartEndDates tests there should be dropped (keep the getStartEnd ones). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
28694c3 to
e6e6034
Compare
|
Changed direction per review: |
need4deed
left a comment
There was a problem hiding this comment.
Approved: remove stray getStartEndDates (no production callers); getStartEnd retained. Source-only, typecheck green.
Surfaced while reviewing the data-utils tests in #528.
getStartEndDates's guard was unsatisfiable:startHour < 0 && startHour > 24can never both hold, so invalid hours never threw. Replaced with the intended check — throw unless0 <= startHour < endHour <= 24.Scope: source-only.
getStartEndDateshas no production callers today (only the unit test in #528), so this is a correctness/hygiene fix with no runtime behavior change for live code, and the happy-path inputs in #528 (start < end, in range) still pass. The throw-path test belongs with the suite in #528, so this PR deliberately doesn't touch the test file (avoids a conflict with #528).Not included:
getStartEnd's map has questionable entries (e.g."17:00-20:00" → 14..17), but it has 4 real callers and some entries look like intentional slot-snapping — correcting it would change live availability parsing, so it needs domain review, not a blind fix. Flagged on #528.🤖 Generated with Claude Code