Repository navigation
Document how diary entries count by measure type; warn against type switches - #12
Merged
Merged
Conversation
Verified live: a diary entry is stored as a count of its measure; its grams are count x value for Weight measures and count x 100 for Atomic ones. Foods made by create_custom_food (Weight serving + server g) log correctly by either measure. Switching a logged measure's type rescales its entries by value/100, so the recipe-ingredient refusal now warns against that fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
Switching Colin's milk food's only measure (`g`) from `Atomic` to `Weight` dropped its diary entries to 1/100 of their grams. This PR records the server's actual rule so nobody repeats that, and makes the recipe-ingredient refusal warn against it.
The server's rule (verified live on ZZ foods, 2027-03-30, Oct 13 2026)
A diary entry is stored as a count of its measure. Its grams are:
Logging always sends grams, and the count is derived with the same rule, so fresh entries are always right. Measured with the server's day totals (400 kcal/100 g food):
Editing a measure re-reads existing entries:
So PR #11's foods (Weight serving + server `g`) are diary-correct; no code fix is needed. The client never changes a measure's type.
Changes
Tests
`uv run pytest -q`: 830 passed. ruff check/format clean.
🤖 Generated with Claude Code