seam: worker solve handler must dispatch by mode to engine/modes/* #93
Labels
No labels
in-progress
in-review
ready-for-agent
seam-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
patrick/Polaris#93
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
worker/handlers/solve.py(T-E,docs/12-implementation-plan.mdT-E row) calls the genericpolaris.engine.solve.solve()for everysolvetask, regardless ofSolveTaskPayload.mode. There is no dispatch by mode.PH5.3 (issue #35,
feature/engine-manual-mode) addspolaris.engine.modes.manual.solve_manual(snapshot, ManualScope)— the real implementation of themanualre-plan mode, including the pass-through behaviour that keeps a re-optimised plan_version a complete picture of the horizon (out-of-scope crew-days carried forward unchanged, not silently dropped from the new version).POST /plans/versions/{id}/reoptimisealready enqueues asolvetask withmode=manualand a narrowedscope_shift_ids/horizon_start/horizon_end, so out-of-scope shifts are still excluded from the model today (viabuild_snapshot's existing, mode-agnostic narrowing) — but because the worker never callssolve_manual, the resulting plan_version does not get the pass-through rows for other crews' untouched confirmed work on the same dates. Publishing such a version would supersede those crews' assignments (per-date, not per-crew, perpublish_version) with nothing in the new version to replace them.The same gap will recur for
eventmode (PH5.2,engine/modes/event.py) andoverridemode (PH3.3/PH5.4,engine/modes/override.py) once those land — none of them will actually run through the worker either without this change.Proposed fix
worker/handlers/solve.pydispatches bytask_payload.modeto the matchingpolaris.engine.modes.*entry point (falling back to the genericpolaris.engine.solve.solve()fordaily, which has no mode-specific module) instead of unconditionally calling the generic engine.Why a seam request instead of widening PH5.3
worker/handlers/solve.pyis owned by T-E (docs/12-implementation-plan.md:domain/planning/**, worker/handlers/{solve,validate}.py, ...), not by PH5.3's row (engine/modes/manual.py,api/routers/plans/reoptimise.py). PerCLAUDE.md: "If a ticket turns out to need a change outside its scope, open a seam request issue that blocks it, instead of widening the ticket."Acceptance criteria
worker/handlers/solve.pydispatchessolvetasks topolaris.engine.modes.manual.solve_manualwhenmode=manual(and todaily's genericsolve()otherwise, untilevent/overridemodules exist)manual-modesolvetask run through the worker end-to-end produces a plan_version whose assignments include pass-through rows for out-of-scope crew-daysBlocks