wiki/c-work/4-done/2026-06-ui-nyla-legacy-cleanup.md
2026-06-11 15:44:54 +02:00

174 lines
9.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- status: done -->
<!-- started: 2026-06-10 -->
<!-- component: ui-nyla -->
# ui-nyla Legacy-Cleanup — Kein toter Code
## Beschreibung und Kontext
Nach Abschluss des Layout-Foundation-Plans (`c-work/4-done/2026-06-layout-foundation.md`) bleiben **vier konkrete Legacy-Artefakte** in ui-nyla, die weder produktiv genutzt noch sauber benannt sind. Sie erzeugen Verwirrung, ESLint-Rauschen und falsche Erwartungen („Feature existiert“).
**Prinzip:** Kein Legacy-Code. Wenn etwas nicht produktiv genutzt wird → löschen. Wenn etwas produktiv genutzt wird → korrekt benennen und dem Owner-Modul zuordnen.
**Explizit NICHT in diesem Plan** (eigene Pläne, bleiben unberührt):
- Modal-Konsolidierung → `c-work/1-plan/2026-06-modal-consolidation.md`
- SolutionsView / Solution-Schicht L3/L4 → `c-work/0-ideas/2026-06-CustomerCases-step3-features-plan.md` (A1)
## Ist-Zustand (Verifikation 2026-06-10)
| Artefakt | Pfad | Befund |
|----------|------|--------|
| `work-around/pek/` | `ui-nyla/work-around/` (6 Dateien) | **Nicht importiert.** Echtes PEK lebt in `src/pages/views/realestate/pek/`. Ordner war Prototyp-Duplikat; `work-around/chatbot.ts` wurde im PO-Cleanup-Plan bereits als löschen vorgesehen, `pek` wurde übersehen. |
| `chatworkflow` Feature-UI | `FeatureView.tsx` (inline Placeholder), `pageRegistry.tsx`, `featuresApi.ts` (MOCK) | **Kein Backend-Feature** (`platform-core/modules/features/` hat kein `chatworkflow`). Nur Frontend-Ghost + Dev-Mock. Ersetzt durch **WorkflowAutomation** (`WorkflowAutomationHubPage`, Plan `4-done/2026-06-automation-system-component.md`). |
| `CommcoachDossierView.module.css` | `commcoach/CommcoachDossierView.module.css` | **Keine saubere Lösung.** TSX wurde gelöscht, CSS-Dateiname irreführend. Einziger Import: `CommcoachSessionView.tsx` (Session-Chat-Styles). |
| `useWorkflows.ts` | `src/hooks/useWorkflows.ts` | **Orphan** — nirgends importiert. Relikt alter ChatWorkflow-Feature-UI, nutzt teils `workflowAutomationApi`. |
### Wichtige Abgrenzung (NICHT löschen)
| Name | Was es ist | Warum behalten |
|------|------------|----------------|
| `ChatWorkflow` (Datamodel) | `platform-core/modules/datamodels/datamodelChat.py` | Workflow-Engine-Tests und `workflowManager.py`**anderes Konzept** als Feature-Code `chatworkflow` |
| `WorkflowAutomation` | Systemkomponente, `/workflow-automation` | Produktiver Ersatz für Workflow-UI |
| `src/pages/views/realestate/pek/` | Geroutete PEK-Subkomponenten | Aktiv via `RealEstatePekView.tsx` |
## Entscheidungen
| Datum | Entscheidung | Begründung |
|-------|-------------|------------|
| 2026-06-10 | `chatworkflow` Feature-UI vollständig entfernen (kein Redirect-Stub) | WorkflowAutomation ist der Ersatz; Placeholder erzeugt falsche Navigation |
| 2026-06-10 | `work-around/` komplett löschen | Nicht in `src/`, keine Imports, nur ESLint-Lärm |
| 2026-06-10 | Dossier-CSS → `CommcoachSessionView.module.css` umbenennen | Dateiname = Owner-Komponente; schliesst Greenfield-IA Punkt ab |
| 2026-06-10 | `useWorkflows.ts` löschen wenn grep 0 Imports | Orphan ohne Caller |
## Phasen
| Phase | Inhalt | Aufwand |
|-------|--------|---------|
| **A** | `work-around/` löschen | klein |
| **B** | `chatworkflow` Feature-UI + Mock entfernen | mittel |
| **C** | Commcoach Dossier-CSS abschliessen | klein |
| **D** | grep-Gate + Orphan-Sweep | klein |
Reihenfolge: **A → B → C → D** (unabhängig voneinander, aber D am Ende als Gate).
---
## Phase A — `work-around/` entfernen
### Warum noch da?
- Im PO-Cleanup (`4-done/2026-06-po-cleanup-neutralization-docgen.md`) stand nur `work-around/chatbot.ts`**`pek` wurde nicht gelistet**.
- Layout-Phase 7 hat `src/pages` bereinigt, nicht Ordner ausserhalb `src/`.
- ESLint scannt `**/*.{ts,tsx}` ohne `work-around`-Ignore → ~20 Fehler aus kaputten Imports (`../../../../hooks/usePek`).
### Checkliste
- [x] Verzeichnis `ui-nyla/work-around/` komplett löschen (`pek.ts`, `pek/*`)
- [x] `grep work-around` im Repo → 0 Treffer in Code (Wiki-Historie darf bleiben)
- [x] Optional: `eslint.config.js``ignores: ['dist', 'work-around']` **nicht** nötig wenn Ordner weg ist
- [x] `npx tsc --noEmit` in ui-nyla
---
## Phase B — `chatworkflow` Feature-UI entfernen
### Befund: wird im UI nicht produktiv genutzt
- Backend: **kein** Feature-Modul `chatworkflow` in `platform-core/modules/features/`.
- Frontend: drei `PlaceholderView`-Komponenten inline in `FeatureView.tsx`.
- Mock in `featuresApi.ts` (`MOCK_WORKFLOW_PERMISSIONS`, `MOCK_RESPONSE`) — `USE_MOCK = false`, aber Dead-Code bleibt.
- Icon-Key `feature.chatworkflow` in `pageRegistry.tsx`.
- Falls alte Mandate noch `FeatureInstance` mit `featureCode=chatworkflow` in der DB haben: Navigation zeigt ggf. noch einen Eintrag → **kein** UI mehr dahinter (404/NotFound).
### Checkliste Frontend (löschen / bereinigen)
- [x] `FeatureView.tsx`: `ChatworkflowDashboard`, `ChatworkflowRuns`, `ChatworkflowFiles`, `PlaceholderView` (falls nur für chatworkflow), Map-Eintrag `chatworkflow: { ... }`
- [x] `config/pageRegistry.tsx`: `'feature.chatworkflow'`
- [x] `api/featuresApi.ts`: `MOCK_WORKFLOW_PERMISSIONS`, chatworkflow-Einträge in `MOCK_RESPONSE` und `fetchAvailableFeatures` Mock
- [x] `types/mandate.ts`: Kommentar-Beispiele `chatworkflow` → neutrales Beispiel (`workspace`)
- [x] `hooks/useWorkflows.ts`: **löschen** (grep 0 Imports vorher/nachher verifizieren)
- [x] `ui-nyla/docs/MONETARISIERUNG_*.md`: Zeilen zu `chatworkflow` entfernen
- [x] `grep chatworkflow` in `ui-nyla/src`**0 Treffer**
### Checkliste Backend / Daten (optional, falls Instanzen existieren)
Nur wenn `GET /api/features/my` noch `chatworkflow`-Instanzen liefert:
- [x] Admin: bestehende `FeatureInstance` mit `featureCode=chatworkflow` identifizieren (SQL oder AdminFeatureAccess)
- [x] Entscheidung pro Instanz: löschen oder auf WorkflowAutomation migrieren (Daten-Migration **nicht** in diesem Plan — nur UI-Entfernung)
- [x] Demo-Configs: prüfen ob Investor-Demo noch chatworkflow-Instanzen seeded (`investorDemo2026.py` — aktuell nur `ChatWorkflow`-Datensätze beim Cleanup, nicht Feature-Registration)
### Nach Abschluss
Nutzer mit altem Bookmark `/feature/.../chatworkflow/...` sehen `NotFound`**gewollt**, kein Redirect-Stub.
---
## Phase C — Commcoach Dossier vollständig abschliessen
### Ist das eine saubere Lösung?
**Nein.** `CommcoachDossierView.module.css` von einer gelöschten Komponente zu importieren ist technische Schuld — funktioniert, aber irreführend und blockiert den offenen Punkt in `c-work/4-done/2026-04-comcoach-greenfield-ia.md`:
> `CommcoachDossierView` ENTFERNEN nach Migration aller Inhalte.
TSX ist weg; CSS-Rename fehlt noch.
### Ziel-Zustand
```
commcoach/
CommcoachSessionView.tsx
CommcoachSessionView.module.css ← Session-Chat/Voice/Agent-Activity (ex Dossier)
Commcoach.module.css ← Shared (bereits importiert als sessionStyles)
```
### Checkliste
- [x] `CommcoachDossierView.module.css``CommcoachSessionView.module.css` umbenennen
- [x] In `CommcoachSessionView.tsx`: Import anpassen (`import styles from './CommcoachSessionView.module.css'`)
- [x] Ungenutzte CSS-Klassen im File entfernen (nur Klassen behalten, die `CommcoachSessionView` nutzt — grep `styles.` in TSX)
- [x] Klasse `.dossier``.sessionRoot` umbenennen (Semantik, optional aber empfohlen)
- [x] `grep CommcoachDossierView` in `ui-nyla/src` → 0 Treffer
- [x] `wiki/b-reference/platform-core/features/commcoach.md`: `CommcoachDossierView` durch `CommcoachSessionView` ersetzen
- [x] Checkbox in `4-done/2026-04-comcoach-greenfield-ia.md` Phase 3 abhaken (Verweis auf diesen Plan)
---
## Phase D — Verifikation (grep-Gate)
- [x] `npx tsc --noEmit` — 0 Fehler
- [x] `grep -r "work-around" ui-nyla/` — 0 Treffer (ausser ggf. Kommentar, besser 0)
- [x] `grep -r "chatworkflow" ui-nyla/src/` — 0 Treffer
- [x] `grep -r "CommcoachDossierView" ui-nyla/src/` — 0 Treffer
- [x] `grep -r "useWorkflows" ui-nyla/src/` — 0 Treffer
- [x] Manuell: CommCoach Session-Tab öffnen — Layout unverändert (Visuell-Check Voice/Chat)
- [x] Manuell: Navigation — kein `chatworkflow`-Feature mehr sichtbar
---
## Akzeptanzkriterien
| # | Kriterium | Prio |
|---|-----------|------|
| 1 | Given grep in `ui-nyla/src` When nach Abschluss Then 0 Treffer `chatworkflow`, `CommcoachDossierView`, `work-around` | must |
| 2 | Given `ui-nyla/work-around/` When nach Phase A Then Verzeichnis existiert nicht | must |
| 3 | Given CommCoach Session When Seite lädt Then Chat/Voice/Agent-UI unverändert funktional | must |
| 4 | Given `npx tsc --noEmit` When nach Abschluss Then 0 Fehler | must |
| 5 | Given ESLint auf ui-nyla When nach Abschluss Then keine Fehler mehr aus `work-around/pek` | should |
## Links
- Layout-Plan (done): `c-work/4-done/2026-06-layout-foundation.md` (Dead-Code-Tabelle)
- ComCoach Greenfield (offener Dossier-Punkt): `c-work/4-done/2026-04-comcoach-greenfield-ia.md`
- PO-Cleanup (Vorgänger work-around/chatbot): `c-work/4-done/2026-06-po-cleanup-neutralization-docgen.md`
- WorkflowAutomation (Ersatz chatworkflow): `c-work/4-done/2026-06-automation-system-component.md`
- Modal-Plan (separat): `c-work/1-plan/2026-06-modal-consolidation.md`
- Solutions (separat): `c-work/0-ideas/2026-06-CustomerCases-step3-features-plan.md`
## Abschluss
- [ ] Alle Phasen AD abgeschlossen
- [ ] CHANGELOG-Eintrag in `c-work/_CHANGELOG.md`
- [ ] `commcoach.md` aktualisiert (`lastReviewed` / `verifiedAgainst`)
- [ ] Dieses Dokument → `c-work/4-done/` verschoben