From 0210844522eb04cb0d28d2673562c24406f0c233 Mon Sep 17 00:00:00 2001 From: Lars Date: Fri, 20 Mar 2026 12:25:31 +0100 Subject: [PATCH] docs: CRITICAL - document missing feature enforcement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ⚠️ MAJOR GAP IDENTIFIED: Feature limits don't work! - Admin UI exists to configure limits - But actual enforcement (check_feature_access) is NOT called in endpoints - Users can exceed limits, use disabled features Backend TODO (CRITICAL): - Add feature checks to insights.py (AI analysis) - Add feature checks to exportdata.py, importdata.py - Add feature checks to nutrition.py, activity.py (imports) - Add feature checks to photos.py, data entry endpoints Frontend TODO (UX): - Implement useFeatureAccess() hook - Create component - Hide disabled features - Show limit counters & upgrade prompts Estimated work: 2-3 hours Co-Authored-By: Claude Opus 4.6 --- CLAUDE.md | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 821e92b..d7007ab 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -103,7 +103,7 @@ mitai-jinkendo/ **Core Features (Backend):** - ✅ DB-Schema (11 neue Tabellen, Feature-Registry Pattern) -- ✅ Feature-Access Middleware (check_feature_access, increment_feature_usage) +- ⚠️ Feature-Access Middleware (existiert, aber wird NICHT in Endpoints aufgerufen - siehe KRITISCH unten!) - ✅ Flexibles Tier-System (free/basic/premium/selfhosted) - Admin-editierbar via API - ✅ **Coupon-System** (3 Typen: single_use, period, wellpass) - ✅ Coupon-Stacking-Logik (Pause + Resume bei Wellpass-Override) @@ -125,6 +125,43 @@ mitai-jinkendo/ - 🔲 Trial-System UI (Countdown-Banner, auto-start nach E-Mail-Verifikation) - 🔲 App-Settings Admin-Panel (globale Konfiguration: trial_days, allow_registration, etc.) +**⚠️ KRITISCH: Feature-Enforcement fehlt noch! (März 2026)** + +**Problem:** Admin-UI zum Konfigurieren existiert, aber die eigentliche Prüfung/Durchsetzung fehlt! +- User kann Limits überschreiten (KI-Analysen, Export, etc.) +- Deaktivierte Features sind trotzdem nutzbar +- Feature-Middleware existiert aber wird NICHT aufgerufen + +**Backend TODO (KRITISCH):** +- 🔲 **insights.py** - Feature-Checks für KI-Analysen einbauen + ```python + @router.post('/run/{slug}') + def run_analysis(slug: str, session = Depends(require_auth)): + profile_id = session['profile_id'] + # TODO: check_feature_access(profile_id, 'ai_calls', action='use') + # TODO: increment_feature_usage(profile_id, 'ai_calls') + ``` +- 🔲 **exportdata.py** - Feature-Check für Export (CSV/JSON/ZIP) +- 🔲 **importdata.py** - Feature-Check für Import +- 🔲 **nutrition.py** - Feature-Check für FDDB-Import +- 🔲 **activity.py** - Feature-Check für Apple Health Import +- 🔲 **photos.py** - Feature-Check für Progress-Fotos +- 🔲 **weight.py, circumference.py, caliper.py** - Entry-Limits prüfen + +**Frontend TODO (wichtig für UX):** +- 🔲 `useFeatureAccess()` Hook implementieren + ```javascript + const { canUse, remaining, limit } = useFeatureAccess('ai_calls') + ``` +- 🔲 `` Komponente erstellen +- 🔲 Feature-Gates in Analysis-Seite (KI-Button ausblenden wenn limit=0) +- 🔲 Feature-Gates in Settings (Export-Buttons) +- 🔲 Feature-Gates in Import-Funktionen +- 🔲 Limit-Anzeige ("3/10 KI-Analysen verbleibend") +- 🔲 Upgrade-Prompt bei Limit erreicht + +**Geschätzte Arbeit:** 2-3 Stunden (Backend 60%, Frontend 40%) + **E-Mail Templates (v9c):** - 🔲 Registrierung + E-Mail-Verifizierung - 🔲 Einladungslink