Repository navigation
update_custom_food: stop trusting defaultMeasureId; require measure_id when ambiguous - #8
Merged
Merged
Conversation
…d when ambiguous Live probes showed defaultMeasureId is the measure logged last, not the food's serving: logging a two-measure custom food by "g" moved its default to "g". update_custom_food then edited that measure, so calories=130 meant 130 kcal per gram, and serving_grams=250 resized "g" itself, which rescaled every gram-logged diary entry (a 100 g entry read back as 10,000 g). - The serving is the food's only measure, or the new measure_id argument when it has several; ambiguity is refused, listing the measures. - A "g" or "oz" measure is never renamed or resized. - _default_measure and _only_measure are replaced by _custom_food_serving. - get_food_details documents what default_measure_id really is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- update_custom_food refuses serving_name "g"/"oz", which would otherwise create a weight-unit measure the tool can then never fix. - get_food_details no longer returns default_measure_id: it is just the last-logged measure, so exposing it invites the same mistake. - Tool Args no longer say "default serving"; old test names renamed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
defaultMeasureIdisn't the serving: live, it follows the last-logged measure. Logging acup+gcustom food bygmoved the default tog, and logging bycupmoved it back.update_custom_foodthen editedg:calories=130stored 13,000 kcal/100 g;serving_grams=250resizedg, and every gram-logged entry was rescaled (100 g turned into 10,000 g).Fix
measure_idwhen there are several. Ambiguous or unknown measure ids are refused, and so ismeasure_idwithout an edit.gandozmeasures can't be renamed or resized._default_measureand_only_measureare replaced by_custom_food_serving.update_recipealready ignored the default.Verification
g, 0 and stale ids.measure_id=cupworked, and resizinggwas refused. The ZZ test foods were retired, and the test day 2027-03-24 was emptied.🤖 Generated with Claude Code