Calculate plans on the server over a WebSocket #320

Closed
opened 2026-10-28 19:03:58 +01:00 by nessar · 0 comments
Owner

Parent

#319

What to build

When the person presses Calculate, the calculation runs on the VacOptimizer server instead of on their device, and the app behaves as it does today: progress, Cancel with the best valid plan retained, the stable plan explanation, the explanation of an incomplete calculation, and counterfactual date analysis of a displayed leave placement.

The server carries the existing planner worker protocol over a same-origin WebSocket, one socket per worker job. It runs the unchanged planner worker for each socket and terminates it when the socket closes. The client keeps fixing the calculation's Europe/Paris calendar date. If the socket cannot open within a short connect timeout (about 5 seconds), or the server closes it before sending any message, the device calculates locally without notice. A connection lost mid-calculation is an incomplete calculation with the best valid plan already received, without an automatic retry.

This ticket has no queue, no per-IP limit and no build check: every socket starts a calculation immediately.

Acceptance criteria

  • For every benchmark scenario, a calculation over a real socket gives the same planning outcome, stable plan explanation and final state as the local engine for the same request.
  • Cancel during a server calculation gives an incomplete calculation with the best valid plan found so far, and the server worker stops.
  • Counterfactual date analysis and the incomplete-calculation explanation work after a server calculation.
  • Each of these leads to a local calculation that replays the messages posted so far, including an early cancel: a socket that cannot open, one that does not open before the connect timeout, and one the server closes before any message. Calculate still works under ng serve, which has no backend.
  • A connection lost after the first server message gives an incomplete calculation with the retained valid plan, without a retry.
  • The production build and container image ship the planner worker, so the deployed server calculates.
  • Static file serving behaves as before.
  • The README architecture section and the benchmark README, which currently says the benchmark "adds no solver or backend dependency", describe server planning.

Blocked by

None — can start immediately.

## Parent #319 ## What to build When the person presses Calculate, the calculation runs on the VacOptimizer server instead of on their device, and the app behaves as it does today: progress, Cancel with the best valid plan retained, the stable plan explanation, the explanation of an incomplete calculation, and counterfactual date analysis of a displayed leave placement. The server carries the existing planner worker protocol over a same-origin WebSocket, one socket per worker job. It runs the unchanged planner worker for each socket and terminates it when the socket closes. The client keeps fixing the calculation's Europe/Paris calendar date. If the socket cannot open within a short connect timeout (about 5 seconds), or the server closes it before sending any message, the device calculates locally without notice. A connection lost mid-calculation is an incomplete calculation with the best valid plan already received, without an automatic retry. This ticket has no queue, no per-IP limit and no build check: every socket starts a calculation immediately. ## Acceptance criteria - [ ] For every benchmark scenario, a calculation over a real socket gives the same planning outcome, stable plan explanation and final state as the local engine for the same request. - [ ] Cancel during a server calculation gives an incomplete calculation with the best valid plan found so far, and the server worker stops. - [ ] Counterfactual date analysis and the incomplete-calculation explanation work after a server calculation. - [ ] Each of these leads to a local calculation that replays the messages posted so far, including an early cancel: a socket that cannot open, one that does not open before the connect timeout, and one the server closes before any message. Calculate still works under `ng serve`, which has no backend. - [ ] A connection lost after the first server message gives an incomplete calculation with the retained valid plan, without a retry. - [ ] The production build and container image ship the planner worker, so the deployed server calculates. - [ ] Static file serving behaves as before. - [ ] The README architecture section and the benchmark README, which currently says the benchmark "adds no solver or backend dependency", describe server planning. ## Blocked by None — can start immediately.
nessar added the ready-for-agent label 2026-10-28 19:03:58 +01:00
nessar added a new dependency 2026-10-28 19:04:31 +01:00
nessar added a new dependency 2026-10-28 19:04:31 +01:00
nessar added a new dependency 2026-10-28 19:04:31 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: nessar/vac-optimizer#320