Implement MCP Refactor Milestone 1: First-class meal plan database entities#74
Implement MCP Refactor Milestone 1: First-class meal plan database entities#74
Conversation
…tities - Add migration 009_activate_meal_plans.up.sql with enhanced schema * New enums: meal_plan_status, meal_slot * Rebuilt meal_plans table with week boundaries, status, version * Rebuilt meal_plan_items with day_index, meal_snapshot JSONB * Added triggers, indexes, and constraints for data integrity - Update protobuf definitions with new messages: * MealPlan, MealPlanItem, MealPlanSummary * MealPlanStatus and MealSlot enums * Regenerated Go bindings - Implement new repository layer with CRUD operations: * InsertMealPlan, GetMealPlanByID, GetMealPlanByWeek * ListMealPlansInRange, UpdateMealPlanStatus, UpsertMealPlanItems * Full transaction support and JSON marshaling for meal snapshots - Update gRPC server to use new meal plan entities * Maintains backward compatibility with WeeklyMealPlan format * Smart conversion between new and legacy formats * Automatic persistence of meal plans to database - Update e2e test scripts for new schema (day_index, meal_snapshot) - Add comprehensive test suite: * Migration tests for database schema validation * Repository tests covering all CRUD operations and edge cases * JSON round-trip testing and error handling - Update documentation for new schema and API patterns Key architectural shift: Meal plans are now first-class database entities rather than workflow state, enabling direct manipulation via stateless MCP tools. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
|
@codex fix the issues raised in comments |
|
To use Codex here, create an environment for this repo. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
| err := db.QueryRowContext(ctx, planQuery, id).Scan( | ||
| &plan.Id, | ||
| &plan.WeekStartDate, | ||
| &plan.WeekEndDate, |
There was a problem hiding this comment.
Scan timestamps into proto fields causes runtime failure
The query scans week_start_date and week_end_date directly into *timestamppb.Timestamp fields (&plan.WeekStartDate, &plan.WeekEndDate). Protobuf timestamp structs do not implement sql.Scanner, so this call raises sql: Scan error … unsupported Scan, storing driver.Value type time.Time into type **timestamppb.Timestamp, preventing any meal plan from being retrieved. Scan into time.Time variables and convert with timestamppb.New instead, as you already do for created_at/updated_at. The same pattern repeats in GetMealPlanByWeek and ListMealPlansInRange.
Useful? React with 👍 / 👎.
Add migration 009_activate_meal_plans.up.sql with enhanced schema
Update protobuf definitions with new messages:
Implement new repository layer with CRUD operations:
Update gRPC server to use new meal plan entities
Update e2e test scripts for new schema (day_index, meal_snapshot)
Add comprehensive test suite:
Update documentation for new schema and API patterns
Key architectural shift: Meal plans are now first-class database entities rather than workflow state, enabling direct manipulation via stateless MCP tools.
🤖 Generated with Claude Code