ROLLBACK: complete removal of broken feature enforcement system
Deploy Development / deploy (push) Successful in 32s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 12s

Reverts all feature enforcement changes (commits 3745ebd, cbad50a, cd4d912, 8415509)
to restore original working functionality.

Issues caused by feature enforcement implementation:
- Export buttons disappeared and never reappeared
- KI analysis counter not incrementing
- New analyses not saving
- Pipeline appearing twice
- Many core features broken

Restored files to working state before enforcement implementation (commit 0210844):
- Backend: auth.py, insights.py, exportdata.py, importdata.py, nutrition.py, activity.py
- Frontend: Analysis.jsx, SettingsPage.jsx, api.js
- Removed: FeatureGate.jsx, useFeatureAccess.js

The original simple AI limit system (ai_enabled, ai_limit_day) is now active again.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 4.6 committed 2026-03-20 15:19:56 +01:00
1 parent 8415509f4c
commit 4fcde4abfb
11 files changed
+125 -376

No files matched your search

+5 -25
View File
@@ -13,7 +13,7 @@ from datetime import datetime
from fastapi import APIRouter, HTTPException, Header, Depends
from db import get_db, get_cursor, r2d
from auth import require_auth, require_admin, check_feature_access, increment_feature_usage
from auth import require_auth, require_admin
from routers.profiles import get_pid
router = APIRouter(prefix="/api", tags=["insights"])
@@ -251,16 +251,7 @@ def delete_ai_insight(scope: str, x_profile_id: Optional[str]=Header(default=Non
async def analyze_with_prompt(slug: str, x_profile_id: Optional[str]=Header(default=None), session: dict=Depends(require_auth)):
"""Run AI analysis with specified prompt template."""
pid = get_pid(x_profile_id)
# Check feature access (v9c feature system)
access = check_feature_access(pid, 'ai_calls')
if not access['allowed']:
if access['reason'] == 'feature_disabled':
raise HTTPException(403, "KI-Analysen sind für dein Tier nicht verfügbar")
elif access['reason'] == 'limit_exceeded':
raise HTTPException(429, f"Monatliches KI-Limit erreicht ({access['limit']} Analysen)")
else:
raise HTTPException(403, f"Zugriff verweigert: {access['reason']}")
check_ai_limit(pid)
# Get prompt template
with get_db() as conn:
@@ -310,8 +301,7 @@ async def analyze_with_prompt(slug: str, x_profile_id: Optional[str]=Header(defa
cur.execute("INSERT INTO ai_insights (id, profile_id, scope, content, created) VALUES (%s,%s,%s,%s,CURRENT_TIMESTAMP)",
(str(uuid.uuid4()), pid, slug, content))
# Increment usage counter (v9c feature system)
increment_feature_usage(pid, 'ai_calls')
inc_ai_usage(pid)
return {"scope": slug, "content": content}
@@ -319,16 +309,7 @@ async def analyze_with_prompt(slug: str, x_profile_id: Optional[str]=Header(defa
async def analyze_pipeline(x_profile_id: Optional[str]=Header(default=None), session: dict=Depends(require_auth)):
"""Run 3-stage pipeline analysis."""
pid = get_pid(x_profile_id)
# Check feature access for pipeline (v9c feature system)
access = check_feature_access(pid, 'ai_pipeline')
if not access['allowed']:
if access['reason'] == 'feature_disabled':
raise HTTPException(403, "KI-Pipeline ist für dein Tier nicht verfügbar")
elif access['reason'] == 'limit_exceeded':
raise HTTPException(429, f"Monatliches Pipeline-Limit erreicht ({access['limit']} Pipelines)")
else:
raise HTTPException(403, f"Zugriff verweigert: {access['reason']}")
check_ai_limit(pid)
data = _get_profile_data(pid)
vars = _prepare_template_vars(data)
@@ -457,8 +438,7 @@ async def analyze_pipeline(x_profile_id: Optional[str]=Header(default=None), ses
cur.execute("INSERT INTO ai_insights (id, profile_id, scope, content, created) VALUES (%s,%s,'gesamt',%s,CURRENT_TIMESTAMP)",
(str(uuid.uuid4()), pid, final_content))
# Increment pipeline usage counter (v9c feature system)
increment_feature_usage(pid, 'ai_pipeline')
inc_ai_usage(pid)
return {"scope": "gesamt", "content": final_content, "stage1": stage1_results}