feat(meals): enforce three lower-calorie dinners with media
CI / backend (pytest + alembic) (push) Canceled after 0s
CI / frontend (build) (push) Canceled after 0s

This commit is contained in:
2026-09-01 10:11:36 -07:00
parent 7838c49721
commit 2695ba0232
85 changed files with 8103 additions and 795 deletions
+42
View File
@@ -0,0 +1,42 @@
# Lower-Calorie Recipe Catalog
## Goal
Keep every app-owned starter recipe at an estimated 500 kcal or less per serving through credible ingredient changes, and durably quarantine the separate Wikibooks Rigatoni recipe.
## Phase 1: Catalog And Loader
- [x] Recalculate all 50 recipes from their ingredient quantities and document assumptions for meats and packaged foods.
- [x] Reduce fats, cheese, starches, or fatty meat in affected recipes without shrinking stated servings or weakening food-safety instructions.
- [x] Enforce the 500-kcal ceiling in bundled-catalog validation and test the real JSON.
- [x] Add an explicit atomic update mode that preserves Recipe and MealPlanItem IDs, rejects incomplete catalogs, and rolls back on failure.
- [x] Make operator-quarantined catalog findings survive future catalog audit runs.
## Phase 2: Verification And Production
- [x] Run offline and disposable-PostgreSQL update, rollback, concurrency, and history-preservation tests.
- [x] Back up production and dry-run the in-place update.
- [x] Update all 50 bundled recipes atomically and quarantine the exact approved Rigatoni row with an operator finding.
- [x] Verify 50 active bundled recipes, zero active recipes above 500 kcal, preserved historical references, and healthy backend/scheduler.
## Done When
- [x] Ingredient quantities and displayed calorie estimates agree with the lower-calorie formulations.
- [x] Existing recipe IDs and historical meal-plan links are preserved.
- [x] Rigatoni remains quarantined even after a catalog audit.
## Notes
- Calorie values remain estimates, not medical nutrition claims.
- Do not lower values without changing the underlying formulation when needed.
## Phase 1 Verification
- Real v2 catalog: 50 recipes, estimated range 310-500 kcal per serving, zero above 500.
- Offline tests: 9 passed.
- Disposable PostgreSQL tests: 34 passed; database dropped.
- Compilation and scoped diff checks passed.
- Final review found no P1/P2 issues.
## Phase 2 Verification
- Verified backup: `backups/pre_lower_calorie_catalog_20260828T004802Z.dump` (4.4 MB, valid `pg_restore --list`).
- Production update validated 50 recipes, created no recipes, and updated 29 drifted rows atomically.
- Post-update dry-run reports zero pending creates or updates.
- All 50 bundled recipes are active at an estimated 310-500 kcal per serving.
- Bundled Recipe ID hash, all 790 MealPlanItem rows, and 4 bundled historical references are unchanged.
- Rigatoni is quarantined with the exact operator finding; its approved staging link remains and a future audit simulation preserves quarantine.
- Backend is healthy and scheduler is running.