Skip to content

fix(core/loader): Handle non-mapping YAML input gracefully - #43

Open
sentry[bot] wants to merge 1 commit into
devfrom
seer/fix/loader-yaml-type-error
Open

fix(core/loader): Handle non-mapping YAML input gracefully#43
sentry[bot] wants to merge 1 commit into
devfrom
seer/fix/loader-yaml-type-error

Conversation

@sentry

@sentry sentry Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Replaced NurseSchedulingData(**data) with NurseSchedulingData.model_validate(data) in core/nurse_scheduling/loader.py.

This change addresses a TypeError that occurred when a user uploaded a YAML file whose root element was not a mapping (e.g., a scalar string). The previous implementation would attempt to unpack a string using **data, leading to a TypeError.

By using Pydantic's model_validate(data), the system now correctly handles non-mapping inputs by raising a ValidationError, providing a more robust and user-friendly error message instead of a low-level Python TypeError.

Fixes NURSE-SCHEDULING-5

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.57%. Comparing base (06926ee) to head (9ea032e).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##              dev      #43   +/-   ##
=======================================
  Coverage   91.57%   91.57%           
=======================================
  Files          77       77           
  Lines        5220     5220           
  Branches      704      704           
=======================================
  Hits         4780     4780           
  Misses        293      293           
  Partials      147      147           
Flag Coverage Δ
core 94.05% <100.00%> (ø)
core-macos 94.05% <100.00%> (ø)
core-windows 94.05% <100.00%> (ø)
web-frontend 88.75% <ø> (ø)
web-frontend-macos 88.75% <ø> (ø)
web-frontend-windows 88.75% <ø> (ø)

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

Files with missing lines Coverage Δ
core/nurse_scheduling/loader.py 100.00% <100.00%> (ø)
🚀 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