Skip to content

fix(core): Gracefully handle invalid date format in preferences - #51

Open
sentry[bot] wants to merge 1 commit into
devfrom
seer/fix/handle-invalid-date-format
Open

fix(core): Gracefully handle invalid date format in preferences#51
sentry[bot] wants to merge 1 commit into
devfrom
seer/fix/handle-invalid-date-format

Conversation

@sentry

@sentry sentry Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This PR addresses issue NURSE-SCHEDULING-1W where an invalid date string, such as 'Freeday_' (a typo of a date group ID), provided in a preference would cause a ValueError in _parse_single_date.

Previously, this ValueError propagated unhandled through scheduler.schedule to OptimizationRunner.run, leading to an unexpected job crash.

The fix involves wrapping the scheduler.schedule call within OptimizationRunner.run in core/nurse_scheduling/server/jobs/runner.py with a try/except ValueError block. If a ValueError occurs during scheduling, it is now caught, and a JobFailure with code="invalid_model" and the original error message is returned. This ensures that the optimization job fails gracefully with a clear, user-facing error message instead of crashing.

Fixes NURSE-SCHEDULING-1W

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.63%. Comparing base (246cb4d) to head (48595b9).

Files with missing lines Patch % Lines
core/nurse_scheduling/server/jobs/runner.py 50.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              dev      #51      +/-   ##
==========================================
- Coverage   92.65%   92.63%   -0.03%     
==========================================
  Files         100      100              
  Lines        8250     8253       +3     
  Branches      705      705              
==========================================
+ Hits         7644     7645       +1     
- Misses        460      462       +2     
  Partials      146      146              
Flag Coverage Δ
core 94.12% <50.00%> (-0.04%) ⬇️
core-macos ?
core-windows 94.12% <50.00%> (-0.04%) ⬇️
web-frontend 88.84% <ø> (ø)
web-frontend-macos 88.84% <ø> (ø)
web-frontend-windows 88.84% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
core/nurse_scheduling/server/jobs/runner.py 83.33% <50.00%> (-3.34%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants