fix(backend): count night shifts in weekly hour cap - #201
Merged
Merged
Conversation
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.
Objective
Fix weekly worked-hours calculation so night shifts are included in the per-agent weekly cap, then make that cap configurable through
solver.max_weekly_hours.Breaking Change Notice
No API breaking change.
The default weekly cap remains
36h, preserving existing behavior. Schedules that previously exceeded the real weekly worked-hours cap because night shifts were not counted may now correctly become infeasible.Scope
Nuit.solver.max_weekly_hours, expressed in hours, with default36.max_weekly_hoursthrough solver config loading andSolverContext.global_max_gap,period_max_gap)36hcap rejecting2 Jour + 2 Nuit48hcap accepting the same worked weekmax_weekly_hoursValidation
backend/.venv/Scripts/python.exe -m pytest backend/tests/test_constraints.py -qbackend/.venv/Scripts/python.exe -m pytest backend/tests/test_dynamic_solver_config.py backend/tests/test_config_schema.py -q -k "not test_config_json_matches_schema"backend/.venv/Scripts/python.exe -m pytest backend/tests -qResults
10/10.backend/config.json:11 passed, 1 deselected.86 passed, 1 failed.The remaining failure is local-config related and out of scope:
backend/config.jsoncontainsrestriction_types_durations, a key used by another branch but not yet declared in this branch schema.Risks and Mitigations
solver.max_weekly_hours; default remains36h.42h.