Repository navigation
Conversation
The valid_from/valid_to check compared the input against a naive UTC "now". A plain date for today (what the frontend sends) became midnight and was rejected as being in the past, and a timezone-aware datetime raised a TypeError (500). Compare local calendar dates instead, treating naive values as local time, which matches the error message and the availability exception check. Fixes ohcnetwork#3773
The check is now date-based, so the two "starts in the past" tests use yesterday instead of 30 minutes ago.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughSchedule creation now validates ChangesSchedule date validation
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The date validation change is ready to merge after normal checks; no remaining issue was identified. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Same-day and timezone-aware schedules can now be created, while the existing facility-scoped permission check remains in place. No new security vulnerability was established, but the intended timezone authority for every facility has not been confirmed. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Proposed Changes
ScheduleCreateSpec.validate_datesnow compares local calendar dates instead of comparing against a naive UTC "now". I treat values without a timezone (like the plain date the frontend sends) as local time.valid_from/valid_tono longer cause a 500.Associated Issue
Fixes #3773
The frontend lets users pick today and sends it as
YYYY-MM-DD. That parsed to midnight, which is earlier than the current UTC time, so the request was rejected. Aware datetimes hitTypeError: can't compare offset-naive and offset-aware datetimes. Comparingtimezone.localdate(value)withtimezone.localdate(care_now())fixes both.Merge Checklist
/docsI ran
test_schedule_api,test_booking_apiandtest_token_apilocally and all 141 pass. Without the fix, the two new tests fail: one gets a 400 and the other aTypeError.I used Claude to help track this down and write the tests; I reviewed the change and ran everything locally.
Only PR's with test cases included and passing lint and test pipelines will be reviewed
@ohcnetwork/care-backend-maintainers @ohcnetwork/care-backend-admins
Summary by CodeRabbit