Files
Meal-Planner/.agent/phase-summaries/three-dinner-planner-routing.md
T
admin 2695ba0232
CI / backend (pytest + alembic) (push) Canceled after 0s
CI / frontend (build) (push) Canceled after 0s
feat(meals): enforce three lower-calorie dinners with media
2026-09-01 10:11:36 -07:00

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.