Add shim cleanup tracker for future import migration
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
70
.claude/rules/shim-cleanup.md
Normal file
70
.claude/rules/shim-cleanup.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# Shim Cleanup Tracker
|
||||
|
||||
**Status:** Shims aktiv — Consumer-Imports noch auf alten Pfaden
|
||||
**Erstellt:** 2026-04-25
|
||||
**Ziel:** Shims schrittweise loeschen sobald Consumer auf neue Pfade aktualisiert sind
|
||||
|
||||
## Was sind Shims?
|
||||
|
||||
Beim Restructuring wurden Dateien in Packages verschoben (z.B. `cv_layout.py` → `ocr/layout/layout.py`). Am alten Pfad bleibt ein 4-Zeilen Redirect:
|
||||
|
||||
```python
|
||||
# cv_layout.py (shim)
|
||||
import importlib as _importlib
|
||||
import sys as _sys
|
||||
_sys.modules[__name__] = _importlib.import_module("ocr.layout.layout")
|
||||
```
|
||||
|
||||
Damit brechen keine bestehenden `from cv_layout import ...` Imports.
|
||||
|
||||
## Cleanup-Prozess (pro Shim)
|
||||
|
||||
1. `grep -rn "from <old_module> import\|import <old_module>" --include="*.py"` — finde alle Consumer
|
||||
2. Consumer-Imports auf neuen Pfad aktualisieren (z.B. `from ocr.layout.layout import ...`)
|
||||
3. Shim-Datei loeschen
|
||||
4. Tests ausfuehren
|
||||
|
||||
## Shim-Inventar
|
||||
|
||||
### klausur-service/backend/ (171 Shims)
|
||||
|
||||
| Gruppe | Anzahl | Alter Pfad | Neuer Pfad |
|
||||
|--------|--------|------------|------------|
|
||||
| cv_* (OCR Core) | 47 | `cv_layout.py` etc. | `ocr/layout/layout.py` etc. |
|
||||
| ocr_pipeline_* | 30 | `ocr_pipeline_api.py` etc. | `ocr/pipeline/api.py` etc. |
|
||||
| ocr_labeling_* | 5 | `ocr_labeling_api.py` etc. | `ocr/labeling/api.py` etc. |
|
||||
| ocr related | 11 | `page_crop.py` etc. | `ocr/pipeline/page_crop.py` etc. |
|
||||
| grid_* | 16 | `grid_build_core.py` etc. | `grid/build/core.py` etc. |
|
||||
| vocab_* | 10 | `vocab_worksheet_api.py` etc. | `vocab/worksheet/api.py` etc. |
|
||||
| korrektur | 11 | `eh_templates.py` etc. | `korrektur/eh_templates.py` etc. |
|
||||
| zeugnis_* | 10 | `zeugnis_api.py` etc. | `zeugnis/api.py` etc. |
|
||||
| admin_* | 4 | `admin_api.py` etc. | `admin/api.py` etc. |
|
||||
| compliance/rbac | 8 | `rbac.py` etc. | `compliance/rbac.py` etc. |
|
||||
| worksheet/nru | 9 | `worksheet_editor_api.py` etc. | `worksheet/editor_api.py` etc. |
|
||||
| training_* | 6 | `training_api.py` etc. | `training/api.py` etc. |
|
||||
| metrics_* | 4 | `metrics_db.py` etc. | `metrics/db.py` etc. |
|
||||
|
||||
### backend-lehrer/ (43 Shims)
|
||||
|
||||
| Gruppe | Anzahl | Alter Pfad | Neuer Pfad |
|
||||
|--------|--------|------------|------------|
|
||||
| abitur_docs_* | 3 | `abitur_docs_api.py` etc. | `abitur/api.py` etc. |
|
||||
| correction_* | 4 | `correction_api.py` etc. | `correction/api.py` etc. |
|
||||
| messenger_* | 5 | `messenger_api.py` etc. | `messenger/api.py` etc. |
|
||||
| recording_* | 6 | `recording_api.py` etc. | `recording/api.py` etc. |
|
||||
| unit_* + learning_* | 13 | `unit_api.py` etc. | `units/api.py` etc. |
|
||||
| teacher_dashboard_* | 3 | `teacher_dashboard_api.py` etc. | `dashboard/api.py` etc. |
|
||||
| game_* | 5 | `game_api.py` etc. | `game/api.py` etc. |
|
||||
| letters/certificates | 4 | `letters_api.py` etc. | `letters/api.py` etc. |
|
||||
|
||||
## Prioritaet
|
||||
|
||||
1. **Hoch:** Shims die von `main.py` importiert werden (Router-Registrierung)
|
||||
2. **Mittel:** Shims die von anderen Modulen importiert werden
|
||||
3. **Niedrig:** Shims die nur von Tests importiert werden
|
||||
|
||||
## Wann loeschen?
|
||||
|
||||
- Bei der naechsten groesseren Aenderung an einem Modul → gleich die Consumer-Imports mit aktualisieren
|
||||
- Oder als dedizierte Cleanup-Session wenn alle Tests gruen sind
|
||||
- NICHT alle auf einmal — Modul fuer Modul vorgehen
|
||||
Reference in New Issue
Block a user