1.1 KiB
Three-Dinner Planner Routing
Root cause was two user-facing bypasses around the canonical planner: Dashboard bulk generation called the random seven-day fill-empty-slots endpoint, and LLM generation inserted up to seven picks before alphabetic fallback.
Added session-authenticated POST /api/meal-plans/generate and routed Dashboard bulk generation through it. The endpoint derives family ownership from the signed session, replaces only an empty same-week shell, and returns 409 for populated plans. LLM picks are now limited to three unique dinners and are accepted only through the canonical planner; infeasible picks fall back to full canonical selection. Planner config and API schemas enforce set_size == 3.
Regression coverage proves exact dinner days 1/3/5, ACTIVE and calorie eligibility, invalid persisted override fallback, session auth, populated-plan preservation, empty-plan replacement, and LLM schedule limits. Verification passed: 11 focused backend tests on disposable PostgreSQL, 11 frontend tests, TypeScript/Vite build, Python compilation, and scoped diff checks. Remote test resources were removed.