docs: track design docs, plans, audits, coordination infrastructure, handoffs
- 21 docs/*.md: audits, design notes, deployment plans, checklists, memos - Coordination: ROLES, runbooks (DGX reboot, Lea live), patches, registre, syntheses, systemd, QG template - Handoffs: 6 Codex handoff documents + README + template
This commit is contained in:
263
docs/PLAN_MENAGE_CODE_MORT_2026-06-23.md
Normal file
263
docs/PLAN_MENAGE_CODE_MORT_2026-06-23.md
Normal file
@@ -0,0 +1,263 @@
|
||||
# Plan de ménage code mort — 2026-06-23
|
||||
|
||||
- `Auteur`: Qwen (audit read-only)
|
||||
- `Date`: 2026-06-23
|
||||
- `Statut`: plan — **aucune exécution sans GO Dom**
|
||||
- `Méthode`: existing-first (graphify-out/ + grep imports), vérification wiring runtime
|
||||
|
||||
---
|
||||
|
||||
## Synthèse
|
||||
|
||||
| Zone | Fichiers Python | A (WIRED) | B (ORPHELIN) | C (MORT) | Lignes C estimées |
|
||||
|------|----------------|-----------|-------------|----------|-------------------|
|
||||
| core/ | 226 | ~70 (31%) | ~75 (33%) | ~22 (10%) | ~800 |
|
||||
| agent_v0/server_v1/ | 26 | 21 | 1 | 4 | ~510 |
|
||||
| agent_v0/agent_v1/ | 44 | 36 | 2 | 6 | ~290 |
|
||||
| server/ | 8 | 4 | 2 | 2 | ~300 |
|
||||
| scripts/ | ~40 | 3 | 0 | ~37 | ~2500 |
|
||||
| deploy/ | 10+ | 3 | 5 | 2 | ~100 |
|
||||
| root | 4 | 1 | 2 | 1 | ~80 |
|
||||
| **Total** | ~360 | ~138 | ~84 | ~74 | **~4580** |
|
||||
|
||||
**~20% du codebase est MORT confirmé (catégorie C), ~23% est ORPHELIN/projection (B).**
|
||||
Les zones les plus chargées : `core/analytics/` (13/17 orphelins), `core/cognition/` (4/5 morts), `core/extraction/` (4/5 morts), `scripts/` (37/40 morts).
|
||||
|
||||
---
|
||||
|
||||
## NE PAS TOUCHER (runtime démo + systemd DGX + installateur)
|
||||
|
||||
- `agent_v0/server_v1/api_stream.py` (7747 lignes) — serveur principal runtime
|
||||
- `agent_v0/server_v1/stream_processor.py` (6085 lignes) — orchestrateur central
|
||||
- `agent_v0/server_v1/resolve_engine.py` — résolution anchors OCR/VLM
|
||||
- `agent_v0/server_v1/replay_engine.py` — replay actions
|
||||
- `agent_v0/agent_v1/core/executor.py` — exécuteur agent Windows
|
||||
- `visual_workflow_builder/backend/app.py` — VWB backend
|
||||
- `web_dashboard/app.py` — dashboard
|
||||
- `server/api_upload.py` — upload API (loopback DGX)
|
||||
- Tous les services systemd DGX (rpa-vision-v3-*.service, ollama, rpa-vllm-grounder)
|
||||
- `deploy/installer/` (Lea.iss, config_template.txt, build_installer.sh)
|
||||
- `deploy/lea_package/` (config.txt, requirements_agent.txt)
|
||||
- Chemin démo `Urgence_aiva_demo` end-to-end
|
||||
|
||||
---
|
||||
|
||||
## Inventaire par zone — catégorie C (MORT confirmé)
|
||||
|
||||
### core/ — MORT (22 fichiers, ~800 lignes)
|
||||
|
||||
| Fichier | Lignes | Preuve mort | Doublon de ? |
|
||||
|---------|--------|-------------|-------------|
|
||||
| `cognition/precondition.py` | ~50 | Zero imports | — |
|
||||
| `cognition/scene_expected.py` | ~50 | Zero imports | — |
|
||||
| `cognition/trace.py` | ~80 | Zero imports | — |
|
||||
| `cognition/vram_orchestrator.py` | ~100 | Zero imports (sauf __init__ test) | gpu/device_policy.py |
|
||||
| `extraction/data_store.py` | ~80 | Zero imports | — |
|
||||
| `extraction/extraction_engine.py` | ~120 | Zero imports (sauf __init__ try/except) | field_extractor.py |
|
||||
| `extraction/iteration_controller.py` | ~60 | Zero imports | — |
|
||||
| `extraction/schema.py` | ~40 | Zero imports | — |
|
||||
| `execution/spatial_index.py` | ~60 | Zero imports | — |
|
||||
| `execution/target_memory.py` | ~80 | Zero imports | learning/target_memory_store.py |
|
||||
| `execution/workflow_runner.py` | ~200 | Zero imports (sauf __init__.py) | dag_executor.py |
|
||||
| `interfaces/action_executor_interface.py` | ~40 | Tests only | — |
|
||||
| `interfaces/error_handler_interface.py` | ~30 | Tests only | — |
|
||||
| `interfaces/target_resolver_interface.py` | ~30 | Tests only | — |
|
||||
| `graph/simple_state.py` | ~40 | Zero imports | — |
|
||||
| `grounding/server.py` | ~500 | **SUPPRIMÉ** (n'existe plus) | — |
|
||||
| `detection/seeclick_adapter.py` | ~300 | Zero runtime imports, __init__ fallback mort | — |
|
||||
| `supervision/circuit_breaker.py` | ~40 | Zero imports, doublon system/circuit_breaker | system/circuit_breaker |
|
||||
| `supervision/supervisor.py` | ~200 | Zero imports, docstrings mentionnent modules jamais wired | — |
|
||||
| `gpu/clip_manager.py` | ~60 | Zero imports | embedding/clip_embedder |
|
||||
| `gpu/ollama_manager.py` | ~80 | Zero imports | detection/ollama_client |
|
||||
| `auth/manage_vault.py` | ~40 | Zero imports | auth/credential_vault |
|
||||
|
||||
### agent_v0/ — MORT (10 fichiers, ~800 lignes)
|
||||
|
||||
| Fichier | Lignes | Preuve mort | Doublon de ? |
|
||||
|---------|--------|-------------|-------------|
|
||||
| `server_v1/vm_controller.py` | 143 | Importé uniquement par visual_wait (mort) | — |
|
||||
| `server_v1/visual_wait.py` | 54 | Importé uniquement par vm_controller (mort) | — |
|
||||
| `server_v1/workflow_replay.py` | 256 | Zero imports, projection jamais intégrée | replay_engine.py |
|
||||
| `agent_v1/window_info.py` | 55 | Zero imports | window_info_crossplatform.py |
|
||||
| `agent_v1/tools/test_lea_pause_flow.py` | ~60 | Script debug standalone | — |
|
||||
| `agent_v1/tools/test_lea_toast.py` | ~80 | Script debug standalone | — |
|
||||
| `agent_v1/ui/_test_paused_toast.py` | ~40 | Script debug standalone | — |
|
||||
| `agent_v1/monitoring/__init__.py` | 0 | Stub vide jamais développé | — |
|
||||
| `agent_v0/config.py` | 58 | Zero imports | agent_v1/config.py |
|
||||
| `agent_v0/setup_v1.sh` | 30 | Vestige, requirements.txt absent | — |
|
||||
|
||||
### server/ — MORT (2 fichiers, ~300 lignes)
|
||||
|
||||
| Fichier | Lignes | Preuve mort | Doublon de ? |
|
||||
|---------|--------|-------------|-------------|
|
||||
| `server/api_upload_dev_8001.py` | ~150 | Pas dans services.conf, dev-only | api_upload.py |
|
||||
| `server/api_upload_dev_8002.py` | ~150 | Pas dans services.conf, dev-only | api_upload.py |
|
||||
|
||||
### scripts/ — MORT (~37 fichiers, ~2500 lignes)
|
||||
|
||||
| Fichier pattern | Count | Preuve mort | Notes |
|
||||
|----------------|-------|-------------|-------|
|
||||
| `demo_*_*_vwb_*_*.py` (dated) | ~12 | Scripts debug Jan 2026, jamais appelés par runtime | Vestiges développement VWB propriétés |
|
||||
| `diagnostic_*_*.py` (dated) | ~6 | Scripts debug Jan 2026 | Diagnostic palette/catalogue |
|
||||
| `test_*_vwb_*_*.py` (dated) | ~10 | Scripts test standalone Jan 2026 | Tests ad-hoc palette/propriétés |
|
||||
| `implementer_*.py`, `implementation_*.py` | ~2 | Scripts debug Jan 2026 | Implémentation propriétés |
|
||||
| `creer_sauvegarde_vwb_*.py` | 1 | Script debug | Sauvegarde ad-hoc |
|
||||
| `analyse_cas_undefined_*.py` | 1 | Script debug | Analyse ad-hoc |
|
||||
| `start_vwb_backend_*.py` (4 variants) | 4 | Doublons de `start_vwb_backend.py` | Versions ultra_stable, thread_safe, final, catalogue_complet |
|
||||
| `start_system_complet_*.sh` | 1 | Script dated | Remplacé par systemd |
|
||||
| `start_vwb_complete_*.sh` (2) | 2 | Scripts dated | Remplacé par systemd |
|
||||
|
||||
**scripts/ WIRED (3)** : `record_and_build.py` (A), `bench_t2a_dryrun.py` (A), `backup_vwb_and_audit.sh` (A)
|
||||
|
||||
### deploy/ — MORT (2 fichiers)
|
||||
|
||||
| Fichier | Preuve mort | Doublon de ? |
|
||||
|---------|-------------|-------------|
|
||||
| `deploy/configs/config_dev_windows.txt` | Config dev, pas utilisé par installateur | config_template.txt |
|
||||
| `agent_v0/setup_v1.sh` | Vestige, requirements.txt absent | — |
|
||||
|
||||
### root — MORT (1 fichier)
|
||||
|
||||
| Fichier | Preuve mort |
|
||||
|---------|-------------|
|
||||
| `mcp_rpa_vision.py` | MCP server jamais importé/callé par runtime ou systemd |
|
||||
|
||||
---
|
||||
|
||||
## Inventaire par zone — catégorie B (ORPHELIN/projection)
|
||||
|
||||
### core/ — ORPHELIN (~45+30 borderline, principalement analytics/ et healing/strategies/)
|
||||
|
||||
| Zone | Fichiers | Preuve orphelin | Projection plausible ? |
|
||||
|------|---------|-----------------|----------------------|
|
||||
| `analytics/` (13 orphelins) | metrics_collector, anomaly_detector, insight_generator, performance_analyzer, success_rate_calculator, archive_storage, timeseries_store, query_engine, report_generator, analytics_api, dashboard_manager, realtime_analytics, resource_collector | Test-only ou zero imports | ✅ Analytics = fonctionnalité produit future (dashboard insights) |
|
||||
| `healing/strategies/` (5) | base_strategy, format_transformation, semantic_variants, spatial_fallback, timing_adaptation | Test-only via `test_self_healing.py` | ✅ Self-healing = produit prévu |
|
||||
| `cognition/working_memory.py` (1) | Intra-core lazy import seulement | ✅ Cognition = produit futur |
|
||||
| `detection/owl_detector.py` (1) | Importé par agent_chat/autonomous_planner seulement | ✅ OWL = grounder alternatif |
|
||||
| `detection/roi_optimizer.py`, `spatial_analyzer.py` | Test-only | ✅ Optimisation ROI future |
|
||||
| `grounding/smart_resize.py` | Test-only, jamais importé runtime | ✅ Resize intelligent utile |
|
||||
| `gpu/vram_monitor.py` | Zero imports | ✅ GPU monitoring utile |
|
||||
| `monitoring/automation_scheduler.py` | __init__ try/except | ✅ Automation scheduling |
|
||||
| `security/flask_security.py`, `input_validator.py`, `ip_allowlist.py`, `rate_limiter.py`, `audit_log.py` | __init__ exports mais jamais importés directement | ✅ Sécurité = P0 produit |
|
||||
| `precision/` (5 fichiers) | Test-only | ✅ Metrics/precision utile |
|
||||
| `system/artifact_retention.py` | __init__ export, jamais utilisé runtime | ✅ Rétention utile |
|
||||
|
||||
### agent_v0/ — ORPHELIN
|
||||
|
||||
| Fichier | Preuve | Projection ? |
|
||||
|---------|--------|-------------|
|
||||
| `server_v1/session_worker.py` | Commentaires seulement, pas importé | ✅ Background session processing |
|
||||
| `agent_v1/core/anchor_catalog.py` + `anchor_relative.py` | Importé par tests seulement | ✅ Anchor resolution future |
|
||||
| `deploy_windows.py` | Script packaging manuel | ✅ Packaging Windows |
|
||||
| `deploy/windows_client/` (23 fichiers) | Copie déployée sur Windows, pas importée depuis repo Linux | ✅ = package agent Windows |
|
||||
|
||||
### server/ — ORPHELIN
|
||||
|
||||
| Fichier | Preuve | Projection ? |
|
||||
|---------|--------|-------------|
|
||||
| `server/processing_pipeline.py` | Importé par api_upload seulement | ✅ Pipeline processing |
|
||||
| `server/processing_queue.py` | Importé par api_upload seulement | ✅ Queue processing |
|
||||
| `server/storage_encrypted.py` | Importé par api_upload seulement | ✅ Encrypted storage |
|
||||
| `server/worker_daemon.py` | Importé par api_upload seulement | ✅ Worker daemon |
|
||||
|
||||
### root — ORPHELIN
|
||||
|
||||
| Fichier | Preuve | Projection ? |
|
||||
|---------|--------|-------------|
|
||||
| `monitoring_server.py` | Optional dans services.conf (5003), pas déployé DGX | ✅ Monitoring utile |
|
||||
| `run_gui.py` | Script standalone GUI launcher | ✅ GUI dev tool |
|
||||
| `cli.py` | CLI entry point, importé par core modules | ✅ CLI utile |
|
||||
|
||||
### deploy/ — ORPHELIN
|
||||
|
||||
| Fichier | Preuve | Projection ? |
|
||||
|---------|--------|-------------|
|
||||
| `deploy/dgx/vm_launch.sh` + `vm_stop.sh` | Scripts QEMU VM DGX | ✅ VM management |
|
||||
| `deploy/configs/config_pc_fixe_lan.txt` + `config_tim_pauline.txt` + `config_vm_lan.txt` | Configs déployées manuellement | ✅ Déploiement multi-site |
|
||||
| `deploy/windows-rdp-launcher/` | Scripts RDP | ✅ Remote access |
|
||||
| `deploy/hyperv_glpi_ubuntu24/` | Script HyperV | ✅ VM creation |
|
||||
|
||||
---
|
||||
|
||||
## Quick wins sûrs (C évident, zéro risque)
|
||||
|
||||
| # | Fichier | Lignes | Risque | Action |
|
||||
|---|---------|--------|--------|--------|
|
||||
| 1 | `core/interfaces/` (3 fichiers) | ~100 | Zéro | Supprimer — jamais importé runtime |
|
||||
| 2 | `core/cognition/` (4 morts: precondition, scene_expected, trace, vram_orchestrator) | ~280 | Zéro | Supprimer — zero imports |
|
||||
| 3 | `core/extraction/` (4 morts: data_store, engine, controller, schema) | ~300 | Zéro | Supprimer — field_extractor seul wired |
|
||||
| 4 | `core/supervision/` (2: circuit_breaker doublon, supervisor jamais wired) | ~240 | Zéro | Supprimer — doublons |
|
||||
| 5 | `core/detection/seeclick_adapter.py` | ~300 | Zéro | Supprimer — fallback mort |
|
||||
| 6 | `server_v1/vm_controller.py` + `visual_wait.py` | ~200 | Zéro | Supprimer pair — jamais importé |
|
||||
| 7 | `agent_v1/window_info.py` | 55 | Zéro | Supprimer doublon |
|
||||
| 8 | `agent_v0/config.py` | 58 | Zéro | Supprimer doublon |
|
||||
| 9 | `scripts/ dated Jan 2026` (~37) | ~2500 | Zéro | Supprimer — vestiges dev |
|
||||
| 10 | `server/api_upload_dev_8001.py` + `api_upload_dev_8002.py` | ~300 | Faible | Supprimer dev-only |
|
||||
|
||||
**Total quick wins** : ~10 actions, ~4133 lignes supprimées, zéro risque runtime
|
||||
|
||||
---
|
||||
|
||||
## Zones à risque (à instruire avant GO)
|
||||
|
||||
| Zone | Risque | Pourquoi |
|
||||
|------|--------|----------|
|
||||
| `core/analytics/` (13 orphelins) | Moyen | Projection produit plausible — supprimer = perdre design analytics |
|
||||
| `core/healing/strategies/` (5) | Moyen | Self-healing = produit prévu — test-only mais intention future |
|
||||
| `core/grounding/infigui_server.py` + `infigui_worker.py` | Moyen | Server jamais lancé mais worker existe — dépendance circulaire mort |
|
||||
| `core/security/` (5 orphelins) | Moyen | Sécurité P0 produit — supprimer = perdre auth/rate-limiting design |
|
||||
| `core/gpu/` (3 morts: vram_monitor, clip_manager, ollama_manager) | Faible | GPU monitoring plausible mais doublon vérifié |
|
||||
|
||||
---
|
||||
|
||||
## Proposition de réorganisation
|
||||
|
||||
**Pas de réorganisation proposée à ce stade.** Le ménage C suffira à dégraisser ~4500 lignes. Les B (projections) resteront en place avec documentation `# PROJECTION: <raison>` pour les distinguer du code wired.
|
||||
|
||||
**Après ménage C**, réorganisation possible :
|
||||
- `scripts/` dated → archiver dans `scripts/archive/` ou supprimer
|
||||
- `core/interfaces/` mort → supprimer (remplacé par protocols Python si besoin)
|
||||
- `deploy/configs/` → consolider dans `deploy/installer/config_template.txt`
|
||||
|
||||
---
|
||||
|
||||
## Plan d'exécution par lots (chirurgie itérative supervisée)
|
||||
|
||||
**Chaque lot = petit, testable (≤ 2 min), QG entre chaque, GO Dom requis.**
|
||||
|
||||
| Lot | Action | Lignes | Test QG | Risque |
|
||||
|-----|--------|--------|---------|--------|
|
||||
| **L1** | Supprimer `core/interfaces/` (3 fichiers) | ~100 | `pytest tests/ -k "not e2e"` | Zéro |
|
||||
| **L2** | Supprimer `core/cognition/` morts (4 fichiers) | ~280 | pytest | Zéro |
|
||||
| **L3** | Supprimer `core/extraction/` morts (4 fichiers) | ~300 | pytest | Zéro |
|
||||
| **L4** | Supprimer `core/supervision/` (2 fichiers) | ~240 | pytest | Zéro |
|
||||
| **L5** | Supprimer `core/detection/seeclick_adapter.py` | ~300 | pytest + vérifier __init__.py fallback | Zéro |
|
||||
| **L6** | Supprimer `server_v1/vm_controller.py` + `visual_wait.py` | ~200 | pytest | Zéro |
|
||||
| **L7** | Supprimer `agent_v1/window_info.py` + `agent_v0/config.py` + `setup_v1.sh` | ~140 | pytest | Zéro |
|
||||
| **L8** | Nettoyer __init__.py exports morts dans core/ | ~50 lignes | pytest + import check | Faible |
|
||||
| **L9** | Supprimer `scripts/` dated Jan 2026 (~37 fichiers) | ~2500 | pytest (aucun script dans test path) | Zéro |
|
||||
| **L10** | Supprimer `server/api_upload_dev_8001/8002.py` | ~300 | pytest + vérifier services.conf | Faible |
|
||||
| **L11** | Supprimer `core/gpu/` morts (3 fichiers) | ~200 | pytest | Faible |
|
||||
| **L12** | Supprimer `core/auth/manage_vault.py` + `execution/workflow_runner.py` | ~240 | pytest | Faible |
|
||||
|
||||
**Total** : 12 lots, ~4580 lignes, risque zéro à faible. Chaque lot précédé de GO Dom + QG post-lot.
|
||||
|
||||
---
|
||||
|
||||
## Liste NE PAS TOUCHER
|
||||
|
||||
- Runtime démo `Urgence_aiva_demo` (VWB → backend → agent_v1 → Léa → Easily)
|
||||
- Services systemd DGX (10 services actifs)
|
||||
- Installateur clinique (`deploy/installer/`, `deploy/lea_package/`)
|
||||
- `api_stream.py` (7747 lignes, serveur principal)
|
||||
- `stream_processor.py` (6085 lignes, orchestrateur)
|
||||
- `resolve_engine.py` (résolution anchors)
|
||||
- `replay_engine.py` (replay actions)
|
||||
- `learned_workflow_bridge.py` (pont VWB ↔ core)
|
||||
- `core/competences/` (verdicts, promotions, persist, catalog — wired)
|
||||
- `core/federation/` (GlobalFAISSIndex, LearningPack — wired)
|
||||
- `core/embedding/` (clip, faiss, state, fusion — wired)
|
||||
- `core/execution/` (observe_reason_act, target_resolver, input_handler — wired)
|
||||
- `core/healing/healing_engine.py` + `execution_integration.py` — wired
|
||||
- `core/analytics/analytics_system.py` + `screen_change_detector.py` — wired
|
||||
- `core/workflow/` (semantic_matcher, variable_manager, execution_plan, shadow_observer — wired)
|
||||
Reference in New Issue
Block a user