Planning, displayed-placement counterfactual analysis, and checkpoint explanation use one internal owner for shared worker resource handling and one shared message contract. Workers are released reliably after their job finishes, fails, or is superseded, while users retain the existing responsive calculation, cancellation, explanation, and comparison behavior. This is the lower-priority candidate from the architecture survey.
Acceptance criteria
Consolidate worker creation, handler cleanup, termination, and cancellation registration for the three existing worker job types. Keep job-specific progress, checkpoint recovery, and completion rules explicit and preserve the public planning calculation context.
Share the request and response message contract between the coordinator and worker, including planning, cancellation, counterfactual analysis, and checkpoint explanation. Remove displaced duplicate declarations and cleanup paths; keep the result internal rather than introducing a public worker framework.
Settle affected promises and release workers once on successful delivery, construction failure, message-send failure, runtime error, and supersession. Exercise late messages and repeated cancellation or cleanup without replacing an already accepted outcome.
Preserve outcome delivery before stable explanation delivery. The planning worker finishes after required outcome and explanation data are delivered, without acknowledgement queues. A later explanation failure cannot turn an available outcome into a failed calculation.
Preserve heartbeat-based inactivity monitoring during preparation and planning, stop outcome monitoring when the outcome arrives, and retain unlimited user-triggered calculations plus the existing opt-in technical planning-work budget. Delayed explanation delivery must not invalidate an outcome.
Preserve cooperative user cancellation, the best jointly valid incumbent and its required state, and recovery of its explanation after a worker failure where currently supported. Cancellation does not imply an obligation conflict.
A newer calculation supersedes prior worker work and stale counterfactual results remain ignored. Preserve comparison retry behavior, immutable submitted and final-state snapshots, and fixed unrelated placements. Keep server-side execution and explicit browser worker-unavailable handling consistent with their current contracts.
Retain and adapt the real-worker integration checks and distinct failure/race tests. Verify all three job types release resources, preserve deterministic outcomes and explanation contents, and leave the displayed plan unchanged during hypothetical analysis.
Run the affected coordinator, real-worker, cancellation, explanation, counterfactual, and benchmark-caller correctness checks, then the required static checks and production build. Preserve search breadth, preference priorities, deterministic tie-breaking, and benchmark inputs and assertions.
Integration
Use the shared feature/planning-architecture branch. This ticket is independent of the application calculation-state replacement because it preserves the existing public calculation context. The final combined verification gate is recorded in ticket #275. Full benchmark performance acceptance remains in #78; CI policy, new dependencies, and algorithm optimization are outside this resource-ownership refactor.
Blocked by
None — can start immediately.
## What to build
Planning, displayed-placement counterfactual analysis, and checkpoint explanation use one internal owner for shared worker resource handling and one shared message contract. Workers are released reliably after their job finishes, fails, or is superseded, while users retain the existing responsive calculation, cancellation, explanation, and comparison behavior. This is the lower-priority candidate from the architecture survey.
## Acceptance criteria
- [ ] Consolidate worker creation, handler cleanup, termination, and cancellation registration for the three existing worker job types. Keep job-specific progress, checkpoint recovery, and completion rules explicit and preserve the public planning calculation context.
- [ ] Share the request and response message contract between the coordinator and worker, including planning, cancellation, counterfactual analysis, and checkpoint explanation. Remove displaced duplicate declarations and cleanup paths; keep the result internal rather than introducing a public worker framework.
- [ ] Settle affected promises and release workers once on successful delivery, construction failure, message-send failure, runtime error, and supersession. Exercise late messages and repeated cancellation or cleanup without replacing an already accepted outcome.
- [ ] Preserve outcome delivery before stable explanation delivery. The planning worker finishes after required outcome and explanation data are delivered, without acknowledgement queues. A later explanation failure cannot turn an available outcome into a failed calculation.
- [ ] Preserve heartbeat-based inactivity monitoring during preparation and planning, stop outcome monitoring when the outcome arrives, and retain unlimited user-triggered calculations plus the existing opt-in technical planning-work budget. Delayed explanation delivery must not invalidate an outcome.
- [ ] Preserve cooperative user cancellation, the best jointly valid incumbent and its required state, and recovery of its explanation after a worker failure where currently supported. Cancellation does not imply an obligation conflict.
- [ ] A newer calculation supersedes prior worker work and stale counterfactual results remain ignored. Preserve comparison retry behavior, immutable submitted and final-state snapshots, and fixed unrelated placements. Keep server-side execution and explicit browser worker-unavailable handling consistent with their current contracts.
- [ ] Retain and adapt the real-worker integration checks and distinct failure/race tests. Verify all three job types release resources, preserve deterministic outcomes and explanation contents, and leave the displayed plan unchanged during hypothetical analysis.
- [ ] Run the affected coordinator, real-worker, cancellation, explanation, counterfactual, and benchmark-caller correctness checks, then the required static checks and production build. Preserve search breadth, preference priorities, deterministic tie-breaking, and benchmark inputs and assertions.
## Integration
Use the shared `feature/planning-architecture` branch. This ticket is independent of the application calculation-state replacement because it preserves the existing public calculation context. The final combined verification gate is recorded in ticket [#275](https://gitea.nessar.fr/nessar/vac-optimizer/issues/275). Full benchmark performance acceptance remains in [#78](https://gitea.nessar.fr/nessar/vac-optimizer/issues/78); CI policy, new dependencies, and algorithm optimization are outside this resource-ownership refactor.
## Blocked by
- None — can start immediately.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What to build
Planning, displayed-placement counterfactual analysis, and checkpoint explanation use one internal owner for shared worker resource handling and one shared message contract. Workers are released reliably after their job finishes, fails, or is superseded, while users retain the existing responsive calculation, cancellation, explanation, and comparison behavior. This is the lower-priority candidate from the architecture survey.
Acceptance criteria
Integration
Use the shared
feature/planning-architecturebranch. This ticket is independent of the application calculation-state replacement because it preserves the existing public calculation context. The final combined verification gate is recorded in ticket #275. Full benchmark performance acceptance remains in #78; CI policy, new dependencies, and algorithm optimization are outside this resource-ownership refactor.Blocked by