feat(nutrition): meals belong to the person who logged them

- meals.user_id (v1 databases gain it on open, DEFAULT '' keeps their meals
  the single user's); insert_meal, get_meals_between and delete_meal take
  the person, and delete only removes that person's meal.
- turn_state.set_user / ToolContext.user_id carry the asker; logMeal,
  fetchMeals and deleteMeal use it. The v2 brain sets it for each reply.
- Tests: two people never see or delete each other's meals, no user is v1's
  single user, and a v1 database opens with its meals kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-11 13:32:36 +09:00
parent b3dcd12ec9
commit 3dbf1e8c56
13 changed files with 193 additions and 19 deletions

View File

@@ -35,7 +35,7 @@ class TestDeleteMealTool:
assert isinstance(result, ToolExecutionResult)
assert result.success is True
assert "Meal deleted" in result.reply_text
self.context.db.delete_meal.assert_called_once_with(123)
self.context.db.delete_meal.assert_called_once_with(123, user_id="")
def test_run_failure(self):
"""Test meal deletion failure."""