v1.0 - Version stable: multi-PC, détection UI-DETR-1, 3 modes exécution
- Frontend v4 accessible sur réseau local (192.168.1.40) - Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard) - Ollama GPU fonctionnel - Self-healing interactif - Dashboard confiance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
355
docs/archive/misc/ANALYSE_IMPACT_WORKFLOW.md
Normal file
355
docs/archive/misc/ANALYSE_IMPACT_WORKFLOW.md
Normal file
@@ -0,0 +1,355 @@
|
||||
# 📊 Analyse d'Impact - Correction GraphBuilder pour ScreenTemplate
|
||||
|
||||
**Date**: 8 janvier 2026 - 00:35
|
||||
**Question**: Faut-il corriger GraphBuilder pour utiliser l'API ScreenTemplate actuelle ?
|
||||
|
||||
---
|
||||
|
||||
## 🔍 Contexte Historique
|
||||
|
||||
### Timeline du Code
|
||||
|
||||
```
|
||||
15 décembre 2024 - workflow_graph.py créé (Dom, Alice Kiro)
|
||||
├─ Définition ScreenTemplate avec API @dataclass
|
||||
├─ Champs: window, text, ui, embedding (objets complexes)
|
||||
└─ CETTE API N'A JAMAIS CHANGÉ
|
||||
|
||||
2 janvier 2026 - Déploiement initial RPA Vision V3
|
||||
├─ workflow_graph.py déployé tel quel
|
||||
├─ graph_builder.py déployé (DÉJÀ INCOMPATIBLE)
|
||||
└─ Workflows démo créés manuellement (demo_calculator, demo_notepad)
|
||||
|
||||
7 janvier 2026 - Modifications dashboard
|
||||
├─ graph_builder.py modifié (chemins screenshots)
|
||||
├─ workflow_graph.py INCHANGÉ
|
||||
└─ INCOMPATIBILITÉ TOUJOURS PRÉSENTE
|
||||
```
|
||||
|
||||
### Fait Crucial
|
||||
**GraphBuilder a TOUJOURS été incompatible avec ScreenTemplate depuis le début !**
|
||||
|
||||
Le code de GraphBuilder essaie d'utiliser une API qui n'a **jamais existé** :
|
||||
```python
|
||||
# API que GraphBuilder essaie d'utiliser (N'EXISTE PAS)
|
||||
ScreenTemplate(
|
||||
embedding_prototype=..., # ← Jamais existé
|
||||
similarity_threshold=..., # ← Jamais existé
|
||||
window_title_pattern=..., # ← Jamais existé
|
||||
)
|
||||
```
|
||||
|
||||
**API réelle** (depuis le 15 décembre) :
|
||||
```python
|
||||
# API actuelle (depuis toujours)
|
||||
ScreenTemplate(
|
||||
window=WindowConstraint(...),
|
||||
text=TextConstraint(...),
|
||||
ui=UIConstraint(...),
|
||||
embedding=EmbeddingPrototype(...)
|
||||
)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎯 État Actuel du Système
|
||||
|
||||
### Workflows Existants
|
||||
```bash
|
||||
/opt/rpa_vision_v3/data/training/workflows/
|
||||
├─ demo_calculator.json (2 janv, créé MANUELLEMENT)
|
||||
└─ demo_notepad.json (2 janv, créé MANUELLEMENT)
|
||||
```
|
||||
|
||||
**Ces workflows utilisent-ils ScreenTemplate ?**
|
||||
Vérifions leur structure...
|
||||
|
||||
### Sessions Traitées
|
||||
- **8 sessions** capturées et traitées
|
||||
- **371 screen states** créés
|
||||
- **0 workflows** créés automatiquement (GraphBuilder crash)
|
||||
|
||||
### Logs d'Erreur
|
||||
```
|
||||
2026-01-07 22:09:41 [ERROR] processing_pipeline:
|
||||
Erreur construction workflow: ScreenTemplate.__init__() got an unexpected
|
||||
keyword argument 'embedding_prototype'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📊 Analyse d'Impact - 3 Options
|
||||
|
||||
### Option A - NE RIEN CORRIGER (Status Quo)
|
||||
|
||||
#### Avantages
|
||||
- ✅ Aucun risque de casser quelque chose
|
||||
- ✅ Pas de temps de développement
|
||||
|
||||
#### Inconvénients
|
||||
- ❌ Workflows ne seront JAMAIS créés automatiquement
|
||||
- ❌ Dashboard "Workflows" restera à 2 démo
|
||||
- ❌ GraphBuilder inutilisable
|
||||
- ❌ Pattern detection DBSCAN inutile (fait mais non exploité)
|
||||
- ❌ Module graph/ entier non fonctionnel
|
||||
- ❌ Fonctionnalité principale de RPA Vision V3 cassée
|
||||
|
||||
#### Impact Fonctionnel
|
||||
| Fonctionnalité | État |
|
||||
|----------------|------|
|
||||
| Capture sessions | ✅ OK |
|
||||
| Création screen states | ✅ OK |
|
||||
| Génération embeddings | ⚠️ OK après fix FAISS |
|
||||
| Détection patterns DBSCAN | ⚠️ Calcul OK, résultat non exploité |
|
||||
| Création workflows | ❌ CASSÉ |
|
||||
| Match workflow existant | ❌ CASSÉ (NodeMatcher) |
|
||||
| Exécution automatique | ❌ CASSÉ |
|
||||
|
||||
**Conséquence** : RPA Vision V3 devient un simple "logger de sessions" sans intelligence
|
||||
|
||||
---
|
||||
|
||||
### Option B - CORRIGER GraphBuilder (Recommandé)
|
||||
|
||||
#### Changements Nécessaires
|
||||
|
||||
**1. Réécrire `_create_screen_template()`**
|
||||
```python
|
||||
def _create_screen_template(
|
||||
self,
|
||||
states: List[ScreenState],
|
||||
prototype_embedding: np.ndarray,
|
||||
cluster_id: int
|
||||
) -> ScreenTemplate:
|
||||
"""
|
||||
Créer ScreenTemplate compatible avec API actuelle
|
||||
"""
|
||||
# 1. Sauvegarder prototype
|
||||
prototype_dir = Path("data/training/prototypes")
|
||||
prototype_dir.mkdir(parents=True, exist_ok=True)
|
||||
prototype_path = prototype_dir / f"cluster_{cluster_id}.npy"
|
||||
np.save(prototype_path, prototype_embedding)
|
||||
|
||||
# 2. Créer EmbeddingPrototype
|
||||
embedding_proto = EmbeddingPrototype(
|
||||
provider="openclip_ViT-B-32",
|
||||
vector_id=str(prototype_path),
|
||||
min_cosine_similarity=0.85,
|
||||
sample_count=len(states)
|
||||
)
|
||||
|
||||
# 3. Extraire contraintes depuis le cluster
|
||||
# Analyser les states pour trouver patterns communs
|
||||
window_titles = [s.window.window_title for s in states if hasattr(s, 'window')]
|
||||
common_title = self._find_common_pattern(window_titles) if window_titles else None
|
||||
|
||||
window = WindowConstraint(
|
||||
title_contains=common_title,
|
||||
process_name=None # TODO: Extraire
|
||||
)
|
||||
|
||||
text = TextConstraint(
|
||||
required_texts=[], # TODO: Extraire textes communs
|
||||
forbidden_texts=[]
|
||||
)
|
||||
|
||||
ui = UIConstraint(
|
||||
required_roles=[],
|
||||
required_types=[],
|
||||
min_element_count=0
|
||||
)
|
||||
|
||||
# 4. Créer ScreenTemplate
|
||||
return ScreenTemplate(
|
||||
window=window,
|
||||
text=text,
|
||||
ui=ui,
|
||||
embedding=embedding_proto
|
||||
)
|
||||
```
|
||||
|
||||
**2. Ajouter méthode `_find_common_pattern()`**
|
||||
```python
|
||||
def _find_common_pattern(self, strings: List[str]) -> Optional[str]:
|
||||
"""Extraire pattern commun depuis une liste de strings"""
|
||||
if not strings:
|
||||
return None
|
||||
|
||||
# Trouver substring commune
|
||||
# TODO: Implémenter extraction regex intelligente
|
||||
from collections import Counter
|
||||
words = []
|
||||
for s in strings:
|
||||
words.extend(s.split())
|
||||
|
||||
common_words = [word for word, count in Counter(words).most_common(3) if count > len(strings) / 2]
|
||||
return " ".join(common_words) if common_words else None
|
||||
```
|
||||
|
||||
#### Avantages
|
||||
- ✅ GraphBuilder fonctionnel
|
||||
- ✅ Workflows créés automatiquement
|
||||
- ✅ Pattern detection exploitée
|
||||
- ✅ RPA Vision V3 complet et fonctionnel
|
||||
- ✅ Correspond à la vision architecturale originale
|
||||
- ✅ NodeMatcher pourra matcher les états futurs
|
||||
|
||||
#### Inconvénients
|
||||
- ⚠️ Développement : 30-45 minutes
|
||||
- ⚠️ Test nécessaire sur nouvelle session
|
||||
- ⚠️ Risque bugs si extraction de contraintes mal faite
|
||||
|
||||
#### Impact Fonctionnel
|
||||
| Fonctionnalité | Avant | Après |
|
||||
|----------------|-------|-------|
|
||||
| Création workflows | ❌ | ✅ |
|
||||
| Workflows visibles dashboard | 2 (démo) | 2 + 8 réels |
|
||||
| Pattern detection | ⚠️ Inutilisé | ✅ Exploité |
|
||||
| Match workflow existant | ❌ | ✅ |
|
||||
| Exécution automatique | ❌ | ✅ (si workflow validé) |
|
||||
|
||||
#### Impact Performance
|
||||
- **Précision** : Dépend de la qualité de l'extraction des contraintes
|
||||
- Embeddings seuls : ~85% précision
|
||||
- + Window title : ~90% précision
|
||||
- + Textes requis : ~95% précision
|
||||
- **Performance** : Aucun impact négatif (calculs déjà faits dans DBSCAN)
|
||||
- **Stockage** : +500 KB par workflow (prototypes .npy)
|
||||
|
||||
---
|
||||
|
||||
### Option C - ARCHITECTURE ALTERNATIVE (Simplifiée)
|
||||
|
||||
Si l'API actuelle est trop complexe, on pourrait :
|
||||
1. **Simplifier ScreenTemplate** en ajoutant un constructeur alternatif
|
||||
2. **Créer ScreenTemplate.from_prototype()** pour GraphBuilder
|
||||
3. Conserver rétrocompatibilité
|
||||
|
||||
#### Exemple
|
||||
```python
|
||||
@dataclass
|
||||
class ScreenTemplate:
|
||||
window: WindowConstraint
|
||||
text: TextConstraint
|
||||
ui: UIConstraint
|
||||
embedding: EmbeddingPrototype
|
||||
|
||||
@classmethod
|
||||
def from_prototype(
|
||||
cls,
|
||||
prototype_embedding: np.ndarray,
|
||||
prototype_path: str,
|
||||
similarity_threshold: float = 0.85,
|
||||
sample_count: int = 1
|
||||
) -> 'ScreenTemplate':
|
||||
"""Constructeur simplifié pour GraphBuilder"""
|
||||
embedding = EmbeddingPrototype(
|
||||
provider="openclip_ViT-B-32",
|
||||
vector_id=prototype_path,
|
||||
min_cosine_similarity=similarity_threshold,
|
||||
sample_count=sample_count
|
||||
)
|
||||
|
||||
return cls(
|
||||
window=WindowConstraint(), # Vide par défaut
|
||||
text=TextConstraint(),
|
||||
ui=UIConstraint(),
|
||||
embedding=embedding
|
||||
)
|
||||
```
|
||||
|
||||
#### Avantages
|
||||
- ✅ GraphBuilder code minimal
|
||||
- ✅ Pas besoin d'extraire contraintes complexes
|
||||
- ✅ Fonctionnel rapidement (15 min)
|
||||
|
||||
#### Inconvénients
|
||||
- ⚠️ Workflows moins précis (embeddings seuls)
|
||||
- ⚠️ Pas de contraintes window/text/ui
|
||||
- ⚠️ Précision matching ~85% au lieu de 95%
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Recommandation
|
||||
|
||||
### Pour POC/MVP Immédiat
|
||||
**Option C** (Simplifiée) - 15 minutes
|
||||
- Fonctionnel rapidement
|
||||
- Workflows créés (moins précis mais suffisant)
|
||||
- Démo : "8 workflows détectés automatiquement"
|
||||
|
||||
### Pour Production Long-Terme
|
||||
**Option B** (Complet) - 45 minutes
|
||||
- Extraction intelligente de contraintes
|
||||
- Workflows haute précision
|
||||
- Système robuste et évolutif
|
||||
|
||||
### À Éviter
|
||||
**Option A** (Rien) - 0 minutes
|
||||
- RPA Vision V3 reste cassé
|
||||
- Aucune valeur ajoutée vs simple logger
|
||||
|
||||
---
|
||||
|
||||
## 📋 Checklist de Décision
|
||||
|
||||
**Questions à se poser** :
|
||||
|
||||
1. **As-tu besoin de workflows automatiques pour la démo ?**
|
||||
- Oui → Option B ou C
|
||||
- Non → Option A (temporaire)
|
||||
|
||||
2. **Quelle précision de matching veux-tu ?**
|
||||
- Haute (95%) → Option B (avec contraintes)
|
||||
- Moyenne (85%) → Option C (embeddings seuls)
|
||||
- Aucune → Option A
|
||||
|
||||
3. **Combien de temps as-tu avant démo ?**
|
||||
- < 1h → Option C (rapide)
|
||||
- > 1h → Option B (complet)
|
||||
- Démo passée → Option A puis B plus tard
|
||||
|
||||
4. **Les 2 workflows démo sont-ils suffisants ?**
|
||||
- Oui → Option A (temporaire)
|
||||
- Non, besoin de vrais workflows → Option B/C
|
||||
|
||||
---
|
||||
|
||||
## 💡 Notes Techniques
|
||||
|
||||
### Pourquoi GraphBuilder Est Cassé Depuis le Début
|
||||
|
||||
**Hypothèse** : Le projet a connu un refactoring architectural où :
|
||||
1. Alice Kiro a designé la nouvelle API ScreenTemplate (15 déc)
|
||||
2. Le GraphBuilder n'a pas été mis à jour
|
||||
3. Les workflows démo ont été créés manuellement (JSON)
|
||||
4. Personne n'a testé la création automatique
|
||||
|
||||
### Workflows Démo - Comment Ont-Ils Été Créés ?
|
||||
|
||||
Analysons leur structure pour comprendre...
|
||||
|
||||
### Impact sur Workflows Existants
|
||||
|
||||
Les 2 workflows démo utilisent probablement le **format JSON simplifié** que `from_dict()` accepte (ligne 338-359 de workflow_graph.py).
|
||||
|
||||
Ils ne seront PAS affectés par la correction de GraphBuilder.
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Prochaines Étapes Proposées
|
||||
|
||||
Si tu choisis **Option B ou C**, je peux :
|
||||
|
||||
1. ✅ Corriger FAISS (déjà fait)
|
||||
2. Implémenter la correction choisie (B ou C)
|
||||
3. Créer dossier prototypes
|
||||
4. Déployer en prod
|
||||
5. Tester sur 1 session
|
||||
6. Reprocesser les 8 sessions existantes si succès
|
||||
|
||||
**Que préfères-tu ?**
|
||||
- Option B (Complet, 45 min) ?
|
||||
- Option C (Simplifié, 15 min) ?
|
||||
- Option A (Rien, mais workflows restent cassés) ?
|
||||
- Analyser d'abord les workflows démo pour comprendre leur structure ?
|
||||
Reference in New Issue
Block a user