Skip to content

Add configurable food plan recipe suggestions (backend)#611

Merged
inur93 merged 9 commits into
mainfrom
claude/food-plan-recommendations-5j0cgt
Jul 5, 2026
Merged

Add configurable food plan recipe suggestions (backend)#611
inur93 merged 9 commits into
mainfrom
claude/food-plan-recommendations-5j0cgt

Conversation

@inur93

@inur93 inur93 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

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

claude and others added 8 commits July 5, 2026 13:55
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
@inur93 inur93 force-pushed the claude/food-plan-recommendations-5j0cgt branch from 53f6b42 to 899a573 Compare July 5, 2026 19:04
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
@sonarqubecloud

sonarqubecloud Bot commented Jul 5, 2026

Copy link
Copy Markdown

@sonarqubecloud

sonarqubecloud Bot commented Jul 5, 2026

Copy link
Copy Markdown

@inur93 inur93 merged commit 2f3224d into main Jul 5, 2026
11 checks passed
@inur93 inur93 deleted the claude/food-plan-recommendations-5j0cgt branch July 5, 2026 19:46
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