Skip to content

Implement MCP Refactor Milestone 1: First-class meal plan database entities#74

Open
carterbs wants to merge 12 commits intomainfrom
claude/mcp-refactor-011CTxdFY7nNU1g6DEgJemdL
Open

Implement MCP Refactor Milestone 1: First-class meal plan database entities#74
carterbs wants to merge 12 commits intomainfrom
claude/mcp-refactor-011CTxdFY7nNU1g6DEgJemdL

Conversation

@carterbs
Copy link
Copy Markdown
Owner

  • 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

…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>
@carterbs
Copy link
Copy Markdown
Owner Author

@codex review

cursor[bot]

This comment was marked as outdated.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 👍.

Comment thread meal-service/grpc_server.go Outdated
@carterbs
Copy link
Copy Markdown
Owner Author

@codex fix the issues raised in comments

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@carterbs
Copy link
Copy Markdown
Owner Author

@codex review

cursor[bot]

This comment was marked as outdated.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 👍.

Comment thread meal-service/models/mealplan_sql.go Outdated
Comment on lines +126 to +129
err := db.QueryRowContext(ctx, planQuery, id).Scan(
&plan.Id,
&plan.WeekStartDate,
&plan.WeekEndDate,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants