fix: vérification par nom d'APPLICATION, pas par titre exact

Compare 'Bloc-notes' (après le –) au lieu du titre complet.
'blocnote.txt – Bloc-notes' et 'voiture.txt – Bloc-notes'
sont la même app → pré-vérif et post-vérif passent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dom
2026-04-05 09:16:48 +02:00
parent 2486e43def
commit 6d4ff4f215

View File

@@ -236,8 +236,23 @@ class ActionExecutorV1:
from ..window_info_crossplatform import get_active_window_info
current_info = get_active_window_info()
current_title = current_info.get("title", "")
# Comparer les titres (partiel — le titre peut varier légèrement)
if expected_title.lower() not in current_title.lower() and current_title.lower() not in expected_title.lower():
# Comparer sur le nom de l'APPLICATION (après le /-)
# "blocnote.txt Bloc-notes" et "voiture.txt Bloc-notes"
# sont la même app, seul le fichier change
def _app_name(title):
for sep in [" ", " - ", ""]:
if sep in title:
return title.split(sep)[-1].strip().lower()
return title.strip().lower()
current_app = _app_name(current_title)
expected_app = _app_name(expected_title)
title_match = (
current_app == expected_app
or expected_title.lower() in current_title.lower()
or current_title.lower() in expected_title.lower()
)
if not title_match:
logger.warning(
f"PRÉ-VÉRIF ÉCHOUÉE : attendu '{expected_title}', "
f"actuel '{current_title}' — STOP"
@@ -369,7 +384,10 @@ class ActionExecutorV1:
elapsed_wait += poll_interval
post_info = get_active_window_info()
post_title = post_info.get("title", "")
if (expected_after.lower() in post_title.lower()
post_app = _app_name(post_title)
expected_app_after = _app_name(expected_after)
if (post_app == expected_app_after
or expected_after.lower() in post_title.lower()
or post_title.lower() in expected_after.lower()):
matched = True
break