Add configurable food plan recipe suggestions (backend)#611
Merged
Conversation
Adds a heuristic, per-household-tunable suggestion engine for the food
plan:
- Pure FoodPlanSuggestionScorer scoring household recipes by rotation
(time since last planned), favorites (overall frequency), seasonality
(same time of year in prior years, circular over the year boundary)
and seasonal tag rules, with a hard variety exclusion window that
also counts already-planned future days. Reasons accompany each
suggestion ("Last planned 5 weeks ago", "Not planned yet", ...).
- SeasonalTagRule entity: household-editable keyword -> months rules
(exact or prefix match, per-rule boost). Danish/English defaults
(vinter/sommer/jul/påske, ...) are seeded lazily on first use.
- FoodPlanSettings gains suggestion tuning columns (weights, exclusion
window, rotation saturation, seasonality window) so households can
personalise the engine, e.g. a 13-day window for two-week planning.
- New endpoints: GET /api/food-plan/suggestions, CRUD under
/api/food-plan/seasonal-tags; PUT /settings accepts tuning fields.
- Scorer/handler unit tests and endpoint integration tests.
EF migration is generated by the update-ef-migrations workflow.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VqPVqQxEakFXLEpY5VLLBQ
Re-triggers API client generation now that the EF migration is on the branch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VqPVqQxEakFXLEpY5VLLBQ
- Day dialog: when the meal input is empty, show ranked suggestions from GET /api/food-plan/suggestions with the primary reason under each recipe and a plus button for one-tap adding. Typing switches back to the existing type-ahead. Households without recipes get a hint linking to /recipes. - Day cards: empty upcoming days show a dashed "Suggest meal" chip; opening such a day starts directly in the ranked suggestions list. - Settings: new "Suggestions" section with the six tuning values (weights and windows, incl. exclusion window for 1-2 week planning) plus reset-to-defaults, and a "Seasonal tags" section for managing keyword -> months boost rules with a month-chip picker. - Hooks: useFoodPlanSuggestions + seasonal tag rule CRUD hooks over the regenerated Kiota client; entry mutations invalidate cached suggestions so the exclusion window reacts immediately. - Jest coverage for the new UI and Playwright visual snapshots (day dialog suggestions, settings sections). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VqPVqQxEakFXLEpY5VLLBQ
The calendar renders two Thursdays; .first() matched the past one (Jan 9), which does not auto-open ranked suggestions, so the wait for the dropdown timed out. Target the upcoming day via its full "torsdag, i morgen" aria-label instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VqPVqQxEakFXLEpY5VLLBQ
Also re-triggers PR checks on a tip that contains the regenerated visual snapshot baselines, since the snapshot bot commit is excluded from CI and does not rerun the PR checks itself. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VqPVqQxEakFXLEpY5VLLBQ
53f6b42 to
899a573
Compare
Two functional tests against the live stack: - suggestions include a newly created recipe (API membership check, since the dropdown only shows the top 5) and the dialog's plus button adds the top suggestion as an entry in one tap - planning a recipe today removes it from tomorrow's suggestions (variety exclusion window), asserted via API and in the dropdown Adds a shared authenticated apiRequest page helper (also replaces the inline settings fetch in the week-navigation test) and page-object helpers for today's/relative day rows. Test data uses timestamped names and is cleaned up via UI or API afterwards. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VqPVqQxEakFXLEpY5VLLBQ
|
|
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.



Adds a heuristic, per-household-tunable suggestion engine for the food
plan:
(time since last planned), favorites (overall frequency), seasonality
(same time of year in prior years, circular over the year boundary)
and seasonal tag rules, with a hard variety exclusion window that
also counts already-planned future days. Reasons accompany each
suggestion ("Last planned 5 weeks ago", "Not planned yet", ...).
(exact or prefix match, per-rule boost). Danish/English defaults
(vinter/sommer/jul/påske, ...) are seeded lazily on first use.
window, rotation saturation, seasonality window) so households can
personalise the engine, e.g. a 13-day window for two-week planning.
/api/food-plan/seasonal-tags; PUT /settings accepts tuning fields.
EF migration is generated by the update-ef-migrations workflow.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01VqPVqQxEakFXLEpY5VLLBQ