From code audit, frontend/src/components/MealList.jsx:
- Duplicate (~L168-183) inserts components with
calories, protein_g, carbs_g, fat_g, fiber_g but meal_components only has NOT NULL base_* columns (backend/migrations/005_meal_tracking.sql:68-72). PostgREST rejects the insert, result unchecked → duplicated meal is is_compound=true with zero components.
- Edit/save (~L603-614, L666-671, L696-715) never reads
error from component updates; meal update has no else branch, form stays open silently.
- Replace (
handleReplaceSimpleMeal ~L567-581) ignores the update error and updates local state anyway.
fetchMeals (~L53-58) crashes if user is null.
Fix: map duplicate to base_* columns and check error; surface an inline error on every failed Supabase call; only update local state after success; guard user.
Acceptance: tests for duplicate mapping + error surfacing; existing MealList-related tests green.
From code audit,
frontend/src/components/MealList.jsx:calories, protein_g, carbs_g, fat_g, fiber_gbutmeal_componentsonly has NOT NULLbase_*columns (backend/migrations/005_meal_tracking.sql:68-72). PostgREST rejects the insert, result unchecked → duplicated meal isis_compound=truewith zero components.errorfrom component updates; meal update has no else branch, form stays open silently.handleReplaceSimpleMeal~L567-581) ignores the update error and updates local state anyway.fetchMeals(~L53-58) crashes ifuseris null.Fix: map duplicate to
base_*columns and checkerror; surface an inline error on every failed Supabase call; only update local state after success; guarduser.Acceptance: tests for duplicate mapping + error surfacing; existing MealList-related tests green.