feat(gui): câbler l'envoi de la télémétrie d'usage en fin de run
Le module usage_telemetry est maintenant réellement branché : la GUI V6 envoie les statistiques au portail après chaque run (les stats web restaient vides sans cela). - processing_runner : RunSummary porte une liste DocResult (ordinal, page_count via page_count_for, status, duration_ms, extension) — peuplée dans la boucle. Aucun nom/chemin de fichier. - usage_telemetry : report_run_summary(summary, base_url, license_ref, machine_id, session, ...) construit le payload depuis le RunSummary et l'envoie (non bloquant). N'envoie RIEN sans license_ref. Spool JSONL si échec réseau. - tab_usage : _finish() déclenche l'envoi en thread daemon (jamais bloquant pour l'UI ni le run). - app : fournit le reporter à UsageTab avec le contexte licence (base_url du LicenseClient, license_ref via local_status, machine_id, app_version). Tests : RunSummary.documents peuplé (0 chemin) ; report_run_summary (payload correct, réseau KO → spool sans crash, pas d'envoi sans licence) ; _finish appelle le reporter. 252 tests unit OK (0 régression), self-test OK. V5/moteur/app_aivanov intacts, 0 dépendance. Aucun build/push sans GO Dom. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -164,3 +164,26 @@ def test_reglages_labels_renamed_and_profile_readable(ctk_root, tmp_path, monkey
|
||||
tab._open_terms_table()
|
||||
tab.update_idletasks()
|
||||
tab.destroy()
|
||||
|
||||
|
||||
def test_usage_tab_finish_calls_reporter(ctk_root):
|
||||
"""Câblage : la fin de run appelle le reporter de télémétrie (non bloquant)."""
|
||||
import threading
|
||||
|
||||
from gui_v6.processing_runner import RunSummary
|
||||
from gui_v6.tabs.tab_usage import UsageTab
|
||||
|
||||
called = threading.Event()
|
||||
captured = {}
|
||||
|
||||
def reporter(summary):
|
||||
captured["summary"] = summary
|
||||
called.set()
|
||||
|
||||
tab = UsageTab(ctk_root, usage_reporter=reporter)
|
||||
ctk_root.update_idletasks()
|
||||
summary = RunSummary(total=1, succeeded=1)
|
||||
tab._finish(summary)
|
||||
assert called.wait(timeout=3.0) # reporter appelé en thread daemon
|
||||
assert captured["summary"] is summary
|
||||
tab.destroy()
|
||||
|
||||
Reference in New Issue
Block a user