innercontext/backend/tests
Piotr Oleszczyk e3ed0dd3a3 fix(routines): enforce min_interval_hours and minoxidil flag server-side
Two bugs in /routines/suggest where the LLM could override hard constraints:

1. Products with min_interval_hours (e.g. retinol at 72h) were passed to
   the LLM even if used too recently. The LLM reasoned away the constraint
   in at least one observed case. Fix: added _filter_products_by_interval()
   which removes ineligible products before the prompt is built, so they
   don't appear in AVAILABLE PRODUCTS at all.

2. Minoxidil was included in the available products list regardless of the
   include_minoxidil_beard flag. Only the objectives context was gated,
   leaving the product visible to the LLM which would include it based on
   recent usage history. Fix: added include_minoxidil param to
   _get_available_products() and threaded it through suggest_routine and
   suggest_batch.

Also refactored _build_products_context() to accept a pre-supplied
products list instead of calling _get_available_products() internally,
ensuring the tool handler and context text always use the same filtered set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 23:36:15 +01:00
..
__init__.py Initial commit: backend API, data models, and test suite 2026-02-26 15:10:24 +01:00
conftest.py refactor(api): remove MCP server integration and docs references 2026-03-04 12:28:30 +01:00
test_ai_logs.py feat(api): add INCI tool-calling with normalized tool traces 2026-03-04 11:35:19 +01:00
test_health.py feat(repo): expand lab results workflows across backend and frontend 2026-03-05 12:46:49 +01:00
test_inventory.py Initial commit: backend API, data models, and test suite 2026-02-26 15:10:24 +01:00
test_llm_profile_context.py feat(profile): add profile settings and LLM user context 2026-03-05 15:57:21 +01:00
test_product_model.py refactor(products): remove obsolete interaction fields across stack 2026-03-04 12:42:12 +01:00
test_products.py refactor(products): remove usage notes and contraindications fields 2026-03-05 10:11:24 +01:00
test_products_helpers.py feat(backend): include last-used date in product LLM details 2026-03-05 16:48:49 +01:00
test_products_pricing.py feat(backend): move product pricing to async persisted jobs 2026-03-04 22:46:16 +01:00
test_profile.py feat(profile): add profile settings and LLM user context 2026-03-05 15:57:21 +01:00
test_routines.py refactor(backend): consolidate product LLM function tools 2026-03-05 16:44:03 +01:00
test_routines_helpers.py fix(routines): enforce min_interval_hours and minoxidil flag server-side 2026-03-05 23:36:15 +01:00
test_skincare.py feat(profile): add profile settings and LLM user context 2026-03-05 15:57:21 +01:00