You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(guard,#11962): detect_ascii_flowchart.py --json warning-flood casse la sortie JSON sur scope large #15171
scripts/notebook_tools/detect_ascii_flowchart.py --json MyIA.AI.Notebooks/ (scope global) produit une sortie non parseable : json.loads rate avec JSONDecodeError: Expecting value: line 1 column 1 (char 0).
Cause : warnings nbformatDuplicateCellId: Non-unique cell id '' detected. Corrected to 'XXXXX' émis sur stderr via warnings.warn. En capture pipe (... | python -c "json.loads(sys.stdin.read())"), le buffer interleaves stderr+stdout sur Windows → le { initial du JSON se retrouve précédé de lignes de warning.
python scripts/notebook_tools/detect_ascii_flowchart.py --json MyIA.AI.Notebooks/ (corpus global) → JSONDecodeError (les warnings DuplicateCellId s'accumulent avant que le { initial atteigne le parser)
Acceptance
detect_ascii_flowchart.py --json MyIA.AI.Notebooks/ rend une sortie strictement parseable (json.loads exit 0), quelque soit le volume de warnings nbformat générés sur le scope.
Aucun warning parasite dans stdout en mode --json.
Comportement inchangé en mode texte (sortie stdout verbeuse).
Tests : ajouter un test unitaire qui scanne un scope multi-dossier (≥3 sous-arbres) et vérifie json.loads() exit 0 sur la sortie.
Fix candidat
importioimportcontextlibimportwarnings# En tête du script, autour de nbformat.validate(nb) ou de la lecture notebook :withcontextlib.redirect_stderr(io.StringIO()):
nb=nbformat.read(path, as_version=4)
# OUwarnings.filterwarnings('ignore', category=UserWarning, module='nbformat')
Cause racine reproduite firsthand puis fixee a la source : nbformat emet DuplicateCellId (nbformat.warnings.DuplicateCellId, classe Warning — PAS UserWarning) a la lecture des notebooks a ids de cellules non-uniques. filterwarnings('ignore', module='^nbformat') autour de nbformat.read neutralise la categorie ; la detection est inchangee, la garde par-fichier #12097 intacte. Acceptance 4/4 : --json strictement parseable (scope multi-sous-arbres + scan reel corpus 1239 fichiers), aucun warning dans stdout, mode texte inchange, test unitaire ajoute (2 tests : json.loads exit 0 via stderr=STDOUT + absence de residu). 27 passed sur la suite du module (25 preexistants + 2). Fix annexe #12811 (encoding explicite sur le subprocess du test corpus baseline). Closes #15171.
Activity
jsboige commentedon Sep 8, 2026
[CLAIMED] #15171 — myia-po-2026:CoursIA — 2026-09-08T07:2xZ — fix(guard,#11962): redirect_stderr/filterwarnings nbformat pour que --json sur scope global rende une sortie strictement parseable (json.loads exit 0), warnings hors stdout en mode --json, comportement texte inchangé, + test unitaire multi-sous-arbres. Grain: MED/guard -- prev: MED/tooling #15092.
jsboige commentedon Sep 8, 2026
Livraison : PR #15179 (grain MED/guard, lane myia-po-2026:CoursIA, prev MED/notebook-python #15071).
Cause racine reproduite firsthand puis fixee a la source : nbformat emet DuplicateCellId (nbformat.warnings.DuplicateCellId, classe Warning — PAS UserWarning) a la lecture des notebooks a ids de cellules non-uniques. filterwarnings('ignore', module='^nbformat') autour de nbformat.read neutralise la categorie ; la detection est inchangee, la garde par-fichier #12097 intacte. Acceptance 4/4 : --json strictement parseable (scope multi-sous-arbres + scan reel corpus 1239 fichiers), aucun warning dans stdout, mode texte inchange, test unitaire ajoute (2 tests : json.loads exit 0 via stderr=STDOUT + absence de residu). 27 passed sur la suite du module (25 preexistants + 2). Fix annexe #12811 (encoding explicite sur le subprocess du test corpus baseline). Closes #15171.
fix(guard,#15171): detect_ascii_flowchart --json strictement parseabl…