Allow partial optimization for over-capacity routes - #229
Conversation
Let route managers continue with a clearly labeled warning while VROOM selects the feasible deliveries. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the new warning token aligned with the frontend formatter output. Co-authored-by: Cursor <cursoragent@cursor.com>
Make error and warning intent explicit without duplicating dialog behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the edit page aligned with the frontend formatter output. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Review: solid direction, one correctness bug worth fixing before merge The warn-instead-of-block approach is the right call here, and the One bug I'd want fixed before merging:
Suggestion: reset this flag at the start of every fresh "Optimize" click (not just the two dismiss paths), or better, move its lifecycle into the hook itself so it resets alongside everything else Smaller items, non-blocking:
|
Keep Optimize Anyway approval in the optimize hook for a single attempt, open the depot overlay without starting the solver, and clear stale approval on dismiss or failed runs. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Hey @markboenigk, Nice catch on the edge case where if the optimization fails, the popup no longer appears again, I didn't see that when I was first implementing it. I went ahead and addressed that by putting the |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance across 5 independent review passes (CLAUDE.md audit, bug scan, git history, prior PR comment history, code comment compliance). One candidate issue was investigated and ruled out as low-impact: the Based on this review, the PR appears ready to merge. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Summary
Route managers can continue optimization when total delivery quantity exceeds available vehicle capacity. A warning dialog offers Optimize Anyway, then the shared depot prompt, so VROOM can build a feasible partial route without treating the case as a hard error.
Motivation
Blocking the entire optimization forces operators to manually guess which deliveries to remove before they can obtain a usable route. The solver already supports partial assignment, so the interface should let users make that choice explicitly. Approval for that choice must also stay scoped to a single attempt so a failed solve cannot silently skip the warning later.
Changes
useOptimizeso Optimize Anyway only approves and opens the depot overlay; the solver starts on depot save.--edit-btn-warningonto:rootwith the other button tokens.Validation
npm --prefix app/ui run lintnpm --prefix app/ui run typechecknpm --prefix app/ui run testRisk
The solver can leave deliveries unassigned when capacity or other constraints prevent scheduling them. The warning sets that expectation, but the current results view lists assigned stops only and does not enumerate the omitted deliveries.
Rollout and Recovery
No migration or configuration change is required. Verify an over-capacity route shows the warning, use Optimize Anyway to reach the depot prompt, then confirm a partial route is created; also confirm a failed solve shows the capacity warning again on the next Optimize. Revert this PR to restore the blocking behavior and prior popup name if needed.