feat: feature enforcement imports (#37/#38) and Universal CSV validation (#71)
Activity and nutrition legacy CSV imports enforce tier limits with UsageBadge UI; Universal CSV gets mapping validation on copy/import, format-check parity, and structured error_details. version: 0.9u module: activity 1.2.1, nutrition 1.0.3, csv_import 0.4.0 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
532e17c4cd
commit
79ec249bc3
27 files changed
+690
-95
No files matched your search
@@ -197,7 +197,7 @@ Phasen sind **sequentiell** wo „Abhängigkeit“ steht; Teile können parallel
|
||||
|
||||
**Erledigt:** Phase A — [`ACTIVITY_SCALAR_KANON_TABLE.md`](./ACTIVITY_SCALAR_KANON_TABLE.md).
|
||||
|
||||
**Aktuell:** Phase B fortsetzen (weitere Consumer prüfen: Export, Import-Vorschau, ggf. zukünftige Chart-Metriken aus EAV), dann **Phase C** (Schreibpfad), dann **Phase D** (Composite-MVP).
|
||||
**Aktuell:** Phase B abgeschlossen (Consumer-Audit 2026-04-16). **Phase C** Schreibpfad entschlackt (Sync abgestellt, Orchestrator als SSoT; Review 2026-04-16 + Regression `test_activity_insert_sql.py`). Nächster Schritt: **Phase D** (Composite-MVP).
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -46,10 +46,12 @@ Dieses Dokument ist **normativ für Agenten**, die ein neues Import-Zielmodul an
|
||||
|
||||
---
|
||||
|
||||
## 4. Bekannte Einschränkungen (Follow-up in Gitea)
|
||||
## 4. Validierung & Dry-Run (Stand 2026-07-23, Gitea #71)
|
||||
|
||||
- Admin **„Format prüfen“** kann `import_row_processing` derzeit weglassen; volle Parität mit dem gespeicherten Template erst beim Speichern / echten Import.
|
||||
- Nutzer-Mappings (Copy aus Systemvorlage) laufen nicht automatisch durch **`validate_csv_template`** – Tracking: **Gitea #71** (http://192.168.2.144:3000/Lars/mitai-jinkendo/issues/71).
|
||||
- Admin **„Format prüfen“** sendet dieselbe `import_row_processing`-Spec wie Speichern (`AdminCsvTemplateEditorPage` → `POST /api/admin/csv-templates/validate`).
|
||||
- **Profil-Mappings:** `POST /api/csv/mappings/{id}/copy` und `POST /api/csv/import` prüfen vor dem Schreiben mit **`validate_csv_template`** (HTTP 422 bei Fehlern).
|
||||
- **Diagnose:** `GET /api/csv/mappings/{id}/validate` — Strukturprüfung ohne Import.
|
||||
- **Nutzer-UI:** `UniversalCsvImportPage` zeigt `error_details` mit Zeile, `code` und `hint` (`CsvImportErrorDetails`).
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
**Automatischer Audit (Code + Playwright, 2026-07-23)**
|
||||
|
||||
Ziele-System ist im Repo umgesetzt:
|
||||
- Backend: `backend/routers/goals.py`, Focus Areas, Goal Types, Progress
|
||||
- Frontend: `frontend/src/pages/GoalsPage.jsx`, Nav `/goals` in `config/appNav.js`
|
||||
- Spec: `docs/issues/issue-50-phase-0a-goal-system.md`
|
||||
|
||||
Playwright auf dev.mitai.jinkendo.de: `/goals` rendert ohne Fehler.
|
||||
|
||||
Verbleibende KI-Goal-Erweiterungen ggf. als neues Issue.
|
||||
@@ -0,0 +1,9 @@
|
||||
**Automatischer Audit (Code, 2026-07-23)**
|
||||
|
||||
Deprecated Tabelle `subscriptions` ist aus dem aktiven Schema entfernt:
|
||||
- Kein Treffer in `backend/schema.sql`, `backend/migrations/`, Backend-Python
|
||||
- Membership nutzt `access_grants`, `tier_limits`, etc. (Migration v9c)
|
||||
|
||||
Doku-Hinweis deprecated: `.claude/docs/technical/DATABASE.md`
|
||||
|
||||
Optional Prod-Check: `\dt subscriptions` — sollte leer/nicht vorhanden sein.
|
||||
@@ -0,0 +1,8 @@
|
||||
**Automatischer Audit (Code, 2026-07-23)**
|
||||
|
||||
Bug behoben: JSONB-Insert für `abilities`/`profile` nutzt `psycopg2.extras.Json()`.
|
||||
|
||||
- Fix-Commit: `2977050` — wrap abilities dict with Json() for JSONB insert
|
||||
- Aktuell: `backend/routers/admin_training_types.py` (`create_training_type`, Zeilen 111–112)
|
||||
|
||||
Admin-UI: `frontend/src/pages/AdminTrainingTypesPage.jsx`
|
||||
@@ -0,0 +1,23 @@
|
||||
**Umsetzung 2026-07-23 (nach Architektur-Abgleich)**
|
||||
|
||||
## Architektur-Check vor Implementierung
|
||||
|
||||
- **Phase C (Schreibpfad):** laut `ACTIVITY_PRODUCTION_ARCHITECTURE_AND_PHASES.md` bereits erledigt (Sync abgestellt, Orchestrator als SSoT, keine Aufrufer von `sync_column_backed_session_metrics`). Keine Doppel-Implementierung.
|
||||
- **Feature-ID:** Issue-Vorgabe `activity_entries` (nicht separates `activity_import`) — konsistent mit `create_activity` und Universal-CSV-Modul-Check in `csv_import.py`.
|
||||
- **Legacy-Endpoint bleibt:** Frontend nutzt weiterhin `POST /api/activity/import-csv` (`ActivityPage` Apple-Health-Panel); Universal-Pfad ist parallel (ARCH §8.2).
|
||||
|
||||
## Änderungen
|
||||
|
||||
**Backend** (`routers/activity.py`):
|
||||
- `check_feature_access(pid, "activity_entries")` vor Legacy-Import
|
||||
- HTTP 403 bei Limit (wie `nutrition/import-csv`)
|
||||
- `increment_feature_usage` pro neu eingefügter Zeile (`inserted`)
|
||||
|
||||
**Frontend** (`ActivityPage.jsx` ImportPanel):
|
||||
- `UsageBadge` am Import-Titel
|
||||
- Drop-Zone deaktiviert bei Limit
|
||||
- Usage-Reload nach Import
|
||||
|
||||
**Tests:** `tests/test_activity_import_feature_enforcement.py` (403 + Increment)
|
||||
|
||||
Regression INSERT-SQL: `tests/test_activity_insert_sql.py` (grün)
|
||||
@@ -0,0 +1,22 @@
|
||||
**Umsetzung 2026-07-23 (UI-Teil; Backend war bereits erledigt)**
|
||||
|
||||
## Ist-Zustand vorher
|
||||
|
||||
- Backend: `POST /api/nutrition/import-csv` mit `check_feature_access('nutrition_entries')` und HTTP 403 — **bereits implementiert**
|
||||
- Frontend: FDDB-Import ohne Usage-Anzeige, Drop-Zone blieb bei Limit klickbar
|
||||
|
||||
## Änderungen
|
||||
|
||||
**Frontend** (`NutritionPage.jsx`, ImportPanel):
|
||||
- `getFeatureUsage()` → `nutrition_entries`
|
||||
- `UsageBadge` am Import-Titel
|
||||
- Drop-Zone und Paste-Import deaktiviert bei Limit
|
||||
- Usage-Reload nach erfolgreichem Import
|
||||
|
||||
Analog zu Activity #37 (geschlossen 2026-07-23).
|
||||
|
||||
**Playwright:** `tests/issue-audit.spec.js` — Badge am FDDB-Panel
|
||||
|
||||
## Hinweis
|
||||
|
||||
Universal-CSV (`/api/csv-import/import`) prüft zusätzlich `data_import` — Legacy FDDB-Pfad folgt dem Nutrition-Muster (nur `nutrition_entries`), konsistent mit Architektur §8.2.
|
||||
@@ -0,0 +1,7 @@
|
||||
**Automatischer Audit (Code + Playwright, 2026-07-23)**
|
||||
|
||||
Logout-Button im Mobile-Header neben Avatar implementiert:
|
||||
- `frontend/src/App.jsx` — Button mit `title="Abmelden"`, Icon `LogOut`
|
||||
- Zusätzlich Desktop: `frontend/src/components/DesktopSidebar.jsx`
|
||||
|
||||
Playwright auf dev.mitai.jinkendo.de: Button sichtbar und klickbar.
|
||||
@@ -0,0 +1,5 @@
|
||||
**Duplikat — geschlossen im Rahmen Issue-Audit 2026-07-23**
|
||||
|
||||
Inhalt identisch mit **#42** (Enhanced Debug/Prompt Analysis UI).
|
||||
|
||||
Teilumsetzung existiert bereits (`Analysis.jsx` Experten-Modus, `WorkflowDebugPanel`). Weiterverfolgung unter #42.
|
||||
@@ -0,0 +1,5 @@
|
||||
**Duplikat — geschlossen im Rahmen Issue-Audit 2026-07-23**
|
||||
|
||||
Inhalt identisch mit **#55** (Placeholder Registry: UNRESOLVED & TO_VERIFY Metadaten).
|
||||
|
||||
Bitte weiterverfolgen unter #55.
|
||||
@@ -0,0 +1,5 @@
|
||||
**Duplikat — geschlossen im Rahmen Issue-Audit 2026-07-23**
|
||||
|
||||
Inhalt identisch mit **#56** (Body Cluster — Restarbeiten & Metadaten-Verifizierung).
|
||||
|
||||
Bitte weiterverfolgen unter #56.
|
||||
@@ -0,0 +1,5 @@
|
||||
**Duplikat — geschlossen im Rahmen Issue-Audit 2026-07-23**
|
||||
|
||||
Inhalt identisch mit **#56** (Body Cluster — Restarbeiten & Metadaten-Verifizierung).
|
||||
|
||||
Bitte weiterverfolgen unter #56.
|
||||
@@ -0,0 +1,9 @@
|
||||
**Automatischer Audit (Code + Playwright, 2026-07-23)**
|
||||
|
||||
Nutzer-konfigurierbares Dashboard umgesetzt:
|
||||
- Migration `039_dashboard_layout.sql` — `profiles.dashboard_layout`
|
||||
- API: `backend/routers/app_dashboard.py` — GET/PUT/reset `/api/app/dashboard-layout`
|
||||
- Frontend: `DashboardConfigurePage.jsx`, Widget-Registry `registerDashboardWidgets.js`
|
||||
- Tests: `test_dashboard_layout_schema.py`, `test_widget_catalog.py`
|
||||
|
||||
Playwright: `/settings/dashboard-layout` erreichbar, Widget/Layout-UI sichtbar.
|
||||
@@ -0,0 +1,9 @@
|
||||
**Automatischer Audit (Code, 2026-07-23)**
|
||||
|
||||
Feature-Gate-Zuordnung aus Admin/DB implementiert:
|
||||
- Migration `041_widget_feature_requirements.sql`
|
||||
- Logik: `backend/widget_feature_requirements_db.py`, `dashboard_widget_entitlements.py`
|
||||
- Admin-UI: `AdminWidgetFeatureAssignmentsPage.jsx`, Route `/admin/widget-features`
|
||||
- Changelog: `backend/version.py` (Admin Widgets × Features)
|
||||
|
||||
Hardcodierter Katalog wird durch DB-Overrides ergänzt (Hybrid-Modell).
|
||||
@@ -0,0 +1,20 @@
|
||||
**Implementierung abgeschlossen (2026-07-24)**
|
||||
|
||||
### 1. Admin „Format prüfen“ inkl. `import_row_processing`
|
||||
- `AdminCsvTemplateEditorPage`: `resolveEditorImportRowProcessing()` — dieselbe Spec wie beim Speichern
|
||||
- Dry-Run/Format-Check nutzt konsistente Vorlage inkl. Aggregation (`group_by` / `aggregates`)
|
||||
|
||||
### 2. Profil-Mappings validieren
|
||||
- `csv_import.py`: `_validate_mapping_config` / `_ensure_mapping_valid` bei **Copy** und **Import**
|
||||
- Neuer Endpoint: `GET /api/csv/mappings/{id}/validate`
|
||||
- `api.js`: `validateCsvMapping()`; `formatFastApiDetail` für verschachtelte Validierungsfehler
|
||||
|
||||
### 3. Nutzer-UI: strukturierte Fehler
|
||||
- Neue Komponente `CsvImportErrorDetails.jsx` (Zeile, code, hint)
|
||||
- `UniversalCsvImportPage` zeigt `error_details` statt JSON-Dump
|
||||
|
||||
### Tests & Doku
|
||||
- `backend/tests/test_csv_mapping_validation.py` — pytest grün
|
||||
- Agent-Guide: `.claude/docs/technical/UNIVERSAL_CSV_IMPORT_AGENT_GUIDE.md` §4 aktualisiert
|
||||
|
||||
**Betroffene Dateien:** `backend/routers/csv_import.py`, `frontend/src/pages/AdminCsvTemplateEditorPage.jsx`, `frontend/src/pages/UniversalCsvImportPage.jsx`, `frontend/src/components/CsvImportErrorDetails.jsx`, `frontend/src/utils/api.js`
|
||||
Reference in new issue
Block a user