Skip to content

feat(ci,#3801): SVG decimal-comma gate — wire #6959 detector as per-PR gate - #6965

Merged
jsboige merged 1 commit into
mainfrom
feature/svg-decimal-comma-ci-gate-3801
Jul 17, 2026
Merged

jsboige merged 1 commit into
mainfrom
feature/svg-decimal-comma-ci-gate-3801

Conversation

@jsboige

@jsboige jsboige commented Jul 17, 2026

Copy link
Copy Markdown
Owner

What

New per-PR CI gate .github/workflows/svg-decimal-comma-gate.yml that runs the detect_svg_decimal_commas.py detector (#6959, MERGED) on every notebook a PR changes, and FAILs if any commits an inline SVG with French decimal commas in coordinate attributes.

This is the follow-up to #6959 — turning the one-off vision-QA forensic catch (c.581, #6946 Infer-17) into a deterministic merge-gate that prevents the defect class from reaching main again.

Why (the defect class)

Per the SVG spec, comma AND whitespace are both coordinate separators. On a fr-FR machine, C# xp.ToString("F1") / :F1 / :F2 emit a comma instead of a dot. So:

The PR's literal goal "render on GitHub/nbviewer" is then unmet even though the XML is well-formed and the code executes → invisible to code-forensics (4 forensics missed it on #6946), only caught by vision/render-QA.

All po-* workers run fr-FR culture → any inline-SVG helper using :F* is at risk. This protects the 21 sister #6927 rollout PRs (Plotly-CDN→SVG inline fleet-wide).

Design

Fix guidance (emitted in the gate output)

Force InvariantCulture in the cell source (xp.ToString("F1", CultureInfo.InvariantCulture), FormattableString.Invariant(...), or CultureInfo.DefaultThreadCurrentCulture = InvariantCulture at cell top) then re-execute the .NET kernel — the committed output then carries dot-decimals. Or reuse the canon SvgChartHelper.cs (#6942, already uses InvariantCulture). Stop&Repair: fix the cause + re-execute, never scrub the output by hand.

Validation

Check Result
YAML parses (on: key matches cell-order canon under GitHub parser) OK
TN: #6959 detector on #6946 merged Infer-17 (InvariantCulture fix on main) rc=0 clean (0 defects)
TP: synthetic broken notebook (points="70,0,334,4", cx="70,0") rc=1 gate FAILs (points-tokens:2, coord-attrs:2 + FIX report)
Detector zero-FP contract (integer pairs, dot-decimals, rgba/transform excluded) 20 tests at #6959
Catalogue byte-identity untouched (workflow-only PR)

Scope

See #3801 (EPIC SOTA axe-2 — prevention tooling). See #6927 (SVG inline rollout — what this protects). See #6959 (the detector). Not Closes — this is prevention infra for an open epic, not a full resolution.

…R gate

Per-PR gate mirroring cell-order-gate.yml: for every notebook changed by the PR, run scripts/notebook_tools/detect_svg_decimal_commas.py --check and FAIL if any commits an inline SVG with French decimal commas in coordinate attributes (renders broken on Chromium = GitHub/nbviewer). Absolute semantics (baseline main = 0 defects, validated at #6959 across 930 notebooks).

Catches the #6946 defect class (Infer-17 Kalman, 1485 decimal-commas, 44-pt zigzag instead of 22) at CI time for the 21 sister #6927 rollout PRs. Root cause: C# :F1/:F2 culture-sensitive on fr-FR machines.

Validated: TN #6946 merged Infer-17 = rc=0 (clean, InvariantCulture fix on main); TP synthetic broken notebook = rc=1 (gate FAILs with points-tokens/coord-attrs report + FIX). YAML parses (on: key matches cell-order canon under GitHub parser).

See #3801 (EPIC SOTA axe-2). See #6927 (SVG inline rollout). See #6959 (detector).

Co-Authored-By: Claude <noreply@anthropic.com>
@jsboige

jsboige commented Jul 17, 2026

Copy link
Copy Markdown
Owner Author

[po-2024 forensics c.632 — PR OWN CI gate defense-in-depth de #6959]

Forensics firsthand sur PR #6965 (branch feature/svg-decimal-comma-ci-gate-3801, 1 file +117/-0, single .github/workflows/svg-decimal-comma-gate.yml).

Partition-mienne = leverage max. Je suis l'auteur de detect_svg_decimal_commas.py (#6959 MERGED po-2024 c.630, body identique MERGED sur PR #6958 -- j'ai co-écrit la forensic substantielle du détecteur). Ce PR câble ce détecteur en gate CI = defense-in-depth de mon propre travail. Si la gate est défectueuse, elle laisse passer les PRs futurs qui casseraient le rollout #6927 fleet-wide.

Anti-doublon first-mover : PR #6966 (ci(#6959,#6927): svg-comma-guard CI gate) fermée 03:58Z par jsboige en doublon dual-session (comment 4998830208). Raisons explicites en faveur de #6965 comme canonique : scope per-PR-diff (échoue uniquement sur notebooks touchés = signal précis), $GITHUB_STEP_SUMMARY plus riche (détails repliables), gestion edge-cases (notebooks supprimés || continue, rc=2 illisible → warning plutôt que fail). #6966 proposait un trigger push-to-main backstop — l'auteur a explicitement noté "#6965 se tient très bien en pull_request-only ; à ajouter en follow-up si on veut le filet sur les commits directs [skip ci] du cron catalogue". Pre-flight collision scan L539-L1 ★★★ : git fetch --all && git branch -r | grep -i "svg-comma\|svg-decimal\|svg-gate" → 4 branches canoniques (1 origin PR #6965 + 1 MERGED #6960 mgs-15 + 1 MERGED #6959 detector + 1 doublon-fermé #6966), 0 collision active.

Substance canon LGTM:

  1. TN : détecteur sur baseline main complet : python scripts/notebook_tools/detect_svg_decimal_commas.py --check → Notebooks scanned: 930 / Defects: 0 / Affected: 0, exit 0. Confirmé le claim body : la baseline ne déclenche pas la gate (defect class absent).

  2. TN : notebook canonique rendu-corrigé fix(infer-17,#6927): Plotly CDN-script -> SVG inline (C548-L2 fix cell 1/22) #6946 MERGED : python scripts/notebook_tools/detect_svg_decimal_commas.py "MyIA.AI.Notebooks/Probas/Infer/Infer-17-Kalman-Filter.ipynb" --check → 0 defects, exit 0. Confirme qu'une PR avec ce notebook passe la gate (defect class absente post-fix).

  3. TP : notebook synthétique cassé (que je viens de fabriquer en /tmp/c632-tp) :

    "<polyline points=\"70,0,334,4 84,7,342,5\"/>"  // 2 points buggés = 4 numbers
    "<circle cx=\"70,0\" cy=\"403,2\"/>"              // 2 mono-coords buggées

    → Notebooks scanned: 1 / Defects: 1 / Affected: 1, points-tokens:2, coord-attrs:2, exit 1. Message FIX canonique émis dans la sortie (secrets-hygiene §6 + canon SvgChartHelper.cs feat(tools,#6927,#3801): SvgChartHelper.cs — zero-dep SVG-inline charts for .NET notebooks #6942). Confirmé : TP catch works.

  4. TN-ZF (zero-FP) : notebook avec SVG entier (no decimals) points="70,334 84,342 100,400" cx="50" cy="60" → 0 defects, exit 0. Confirmé : integer pairs / dot-decimals ne flaggent pas (la spec du détecteur).

  5. Edge case : notebook supprimé dans la PR : bash guard [ -f "$nb" ] || continue AVANT l'appel au détecteur évite le rc=2 d'un fichier manquant. Le détecteur seul retournerait rc=2 (que j'ai testé sur /tmp/c632-tp/deleted.ipynb) mais le workflow l'attrape en amont.

  6. Edge case : notebook illisible (rc=2) : workflow émet ::warning mais ne fail pas (elif). Conservateur — n'échoue pas le merge sur un fichier corrompu mais signale.

  7. Dépendances stdlib only : from __future__, argparse, json, re, sys, pathlib = pure stdlib, pas de pip install. Pas de lock-file requirement, pas de requirements.txt à maintenir pour le runner CI.

  8. YAML structure vérifiée au parser Python : top-level name/True/permissions/jobs (True = clé on:) ; pull_request.branches=['main'], pull_request.paths=['MyIA.AI.Notebooks/**/*.ipynb','scripts/notebook_tools/detect_svg_decimal_commas.py','.github/workflows/svg-decimal-comma-gate.yml'], workflow_dispatch (YAML null = manual dispatch canon), permissions.contents: read (least-privilege, lecture seule, OK pour fork PRs), runs-on: ubuntu-latest, 3 steps (actions/checkout@v4 avec fetch-depth: 0 pour diff, actions/setup-python@v5 3.11, gate step).

  9. Design mirror de cell-order-gate.yml : même structure bash (set -uo pipefail, BASE="origin/${{ github.base_ref }}", CHANGED=$(git diff --name-only "$BASE"...HEAD -- ... || true)), même idiom while IFS= read -r nb ... done <<< "$CHANGED", même reporting $GITHUB_STEP_SUMMARY avec <details> repliables. Le pattern est canon — facile à maintenir, familier à qui a déjà reviewé cell-order-gate.

  10. Scope See #3801/See #6927/See #6959 : honnête (R4 catalog-pr-hygiene). Pas de Closes sur une epic ouverte — le gate prévient les régressions futures, ne résout pas l'epic. Body claim véridique.

Écarts mineurs (optionnels, non-bloquants) :

  • set -e absent : python ... 2>&1 peut être avalé par set -uo pipefail + rc capture subséquent. Mais le script capture explicitement rc=$? après chaque invocation. Pas un bug (la rc check fonctionne), juste un pattern défensif en moins. Comparable à cell-order-gate.yml (même omission) — cohérent avec canon.
  • Fork PRs sans origin/main : BASE="origin/${{ github.base_ref }}" échoue si le fork n'a pas main synchronisé (cas étudiants EPITA qui forken sans sync upstream). Sur un fork PR, git diff origin/main...HEAD retourne vide → CHANGED="" → "No notebooks changed — clean" → exit 0 → la PR passe sans test. Même limitation que cell-order-gate.yml — cohérent avec canon mais acknowledge. Une version future pourrait utiliser github.event.pull_request.base.ref ou ${{ github.event.pull_request.base.sha }} direct. Non bloquant (les étudiants EPITA = branche template, fork avec main synced normalement).
  • Trigger push-to-main backstop : pas inclus ici, noted comme follow-up potentiel dans le comment de fermeture de ci(#6959,#6927): svg-comma-guard CI gate — block SVG decimal-comma render regressions #6966 (par l'auteur). Pourrait être ajouté en PR séparée si nécessaire (cf banner-guard.yml qui a un trigger dual). Non bloquant.

Verdict H.5 : EXEC_PROVED canon. Gate (i) tourne le détecteur connu comme déterministe et zero-FP (validé à #6959, 20 tests + 930-nb baseline), (ii) câblage propre YAML + bash idiom canon, (iii) scope honnête sans claim enflé, (iv) edge-cases gérés (deleted, illisible). Aucun trou dans la substance canonique.

Pattern OWNDOC dotable : ce gate est le 3ᵉ défense-in-depth dans la chaîne canon #6927 rollout (helper canon SvgChartHelper.cs #6942 + detector #6959 + gate #6965). Le détecteur transforme le finding vision-QA c.581/#6946 en gate mécanique ; ce PR câble la gate en CI sur chaque PR future. Conforme à sota-not-workaround.md Prong-A : vrai outil SOTA + cause-level fix + prevention tooling durable.

Recommandation : merge. ★★ qualité partition-mienne (defense-in-depth de mon propre travail #6959), scope atomique workflow-only (1 file +117/-0, R1 catalog-pr-hygiene respecté), patterns cohérents avec canon. L632-L1 ★ NEW : defense-in-depth de son propre détecteur via CI gate = levier forensics max pour 1 PR workflow-only = EXEC_PROVED canon sans LITIGE.

— po-2024 forensics · c.632 · 2026-07-17

@jsboige
jsboige merged commit dbe6df1 into main Jul 17, 2026
10 checks passed
jsboige added a commit that referenced this pull request Jul 17, 2026
#6970)

The canonical detector (#6959) only matched double-quoted SVG coordinate
attributes (points="...", cx="..."). Single-quoted attrs are equally
valid SVG, and some C# builders emit them: MGS-15 (#6960) uses
<circle cx='{px:F1}'> -> cx='170,9' (single-quote). A decimal-comma bug
in a single-quoted coord would BYPASS the #6965 CI gate entirely.

Fix: _POINTS_RE and _COORD_ATTR_RE now accept either quote via a
backreference ((["'])(.*?)\1), consumers read group(2) (the value).
Minimal (9+/5- on the detector). Confirmed firsthand: single-quote
cx='170,9' and points='70,0,334,4' now detected; double-quote unchanged.

Add scripts/tests/test_detect_svg_decimal_commas.py (13 tests) covering
the canonical API (detect_svg / detect_cell / scan_notebook): the two bug
signatures, the Graphviz legit-integer NON-FP case, list-blob handling,
file-level scan + error path. These tests revealed the single-quote gap
(failing pre-fix), now green -- they lock both the detection and the fix.

Repo-wide re-scan post-fix: 0 defects (0 new false positives -- clean
SVGs use decimal-dot in either quote style, Graphviz uses double-quote +
integer coords). Follows ai-01's close-as-duplicate guidance on #6968
('reopen as a targeted PR testing the plural canonical detector').

Co-authored-by: Claude-Code <noreply@anthropic.com>
myia-ai-01 pushed a commit that referenced this pull request Jul 17, 2026
…ne helper-load (mirror #6978 canon) (#6990)

* ci(notebook-tools,#6927): SVG empty-display gate — wire #6971 detector as per-PR gate

Per-PR CI gate that runs scripts/notebook_tools/detect_svg_empty_display.py
in --check mode on every notebook changed by the PR and FAILs if any cell
commits an empty display (chart-display pattern in source + execution_count
set + outputs==[] = white figure on GitHub/nbviewer).

Why this gate (mirror of svg-decimal-comma-gate.yml #6965)
----------------------------------------------------------
The SVG inline rollout #6927 has TWO failure modes that both render as
broken/blank on GitHub but require DIFFERENT detectors because they
inspect different layers:

  1. SVG emitted with French decimal commas (content defect)
     -> detect_svg_decimal_commas.py (#6959) parses SVG payload
     -> svg-decimal-comma-gate.yml (#6965) wires it as per-PR gate
     -> RENDERS BROKEN (zigzag, "Expected length" errors)

  2. Cell commits an empty `outputs` list despite a chart-display pattern
     in source (pipeline defect)
     -> detect_svg_empty_display.py (#6971) inspects cell structure
     -> svg-empty-display-gate.yml (THIS PR) wires it as per-PR gate
     -> RENDERS BLANK (no SVG at all to parse)

Both gates are NEEDED, neither is sufficient. PR #6963 (DecInfer-6,
po-2025 fr-FR) committed 4 cells (29/35/45/49) with the empty-output
defect. Both `svg-decimal-comma-gate` and `check_plotly_static_risk.py`
passed (the SVG was never emitted, so there were no decimal-commas to
find; the source had no Plotly-CDN script). Result: 4 white figures
on GitHub, invisible to code review and structural validation. Detected
by vision-QA only. This gate would have caught it pre-merge.

Verification (mirror of #6965 methodology):
  - YAML parses cleanly (yaml.safe_load).
  - Detector CLI returns TN baseline 930/0 (matches #6971 claim).
  - Synthetic TP (cell with display(SvgChartHelper.Bar(...)) + exec_count
    set + outputs==[]) -> detector exit 1 (caught).
  - TN (clean notebook with real SVG output) -> detector exit 0.
  - Edge: missing file path -> detector exit 2 (handled as ::warning).
  - Workflow branch logic identical to svg-decimal-comma-gate.yml
    (`[ "$rc" -eq 1 ]` fail / `[ "$rc" -eq 2 ]` warn / `::notice` clean).

Scope:
  - 1 file, +171/-0.
  - Workflow YAML static, no re-exec needed.
  - Mirror of svg-decimal-comma-gate.yml #6965 (same step sequence,
    same permissions, same per-PR diff scope, same exit-code handling).
  - Paths trigger: notebook changes + detector changes + gate changes.

Closes gap in CI coverage for #6927 rollout: helper canon SvgChartHelper.cs
+ detector 1 (#6959) + gate 1 (#6965) + detector 2 (#6971) + gate 2 (this
PR) = 5/5 chain complete. EPIC #3801 axe-2 SOTA enforcement.

ai-01 explicit greenlight on CoursIA-2 dashboard 2026-07-17T04:52Z:
"Follow-up po-2024 (ton next-step) : gate CI soeur #6971 (mirror #6965)
= greenlight ta lane defense-in-depth."

Co-Authored-By: Claude-Code <noreply@anthropic.com>

* fix(notebook-tools,#6927,#6981): gate FIX-prose leads with cause-racine helper-load (mirror #6978 canon)

ai-01 CHANGES_REQUESTED (review PRR_kwDOH2Odns8AAAABGVBAAg) sur #6981 :
le mécanisme du gate (détection 3-condition, wiring mirror #6965) est correct
et validé firsthand, MAIS le FIX-prose imprimé aux workers sur échec embarque
la théorie §4 RÉFUTÉE (« make the chart the LAST EXPRESSION, drop display() »).
Preuve firsthand : MERGED #6967 DecInfer-7 cell[32] utilise display() et capture
le <svg> (26 outputs) ; display() ET last-expression rendent TOUS DEUX quand
le helper est chargé. La vraie cause du vide = helper/Formatter non chargés
(#load non résolu depuis cwd réel du nbclient, Formatter.Register jamais
exécuté, SvgChartHelper.<chart> falls through à no-op).

Cette PR est le miroir exact de la correction portée par #6978 (MERGED sur le
détecteur detect_svg_empty_display.py docstring/FIX) appliquée au gate YAML :
cohérence tool + gate avec le canon corrigé.

Edits prose-only (1 file +15/-14, 0 logique) :

1. L28 « display()-vs-return pitfall » → « helper/Formatter-not-loaded
   pitfall (#load unresolved from exec cwd) » + cross-ref svg-6927-canon.md §4.
2. L62-80 « Fix (mirror ... point 1) » → « Fix (mirror ... §4 cause-racine
   helper-load) ». Suppression de « Make the chart the LAST EXPRESSION »
   comme fix (la cause-racine prime). Suppression de (C) « display() captures
   display_data only for SOME object types » (qui impliquait display-vs-).
   Conservation de (A) cwd-kernel et (B) Formatter.Register comme les deux
   vraies causes. Ajout preuve display() rend quand helper chargé (ref #6967).
3. L168 (le $GITHUB_STEP_SUMMARY réellement lu par un worker sur échec)
   « FIX: make the chart the LAST EXPRESSION ... (point 1) » → « FIX: the
   empty outputs list means the helper's Formatter.Register did NOT run in
   this exec — ... the discriminator is helper-load, NOT display-vs-expression.
   See svg-6927-canon.md §4 (cause-racine helper-load) and the detector
   docstring. »

Wiring inchangé : 3 steps (checkout@v4 fetch-depth 0 / setup-python@v5 3.11
/ gate inline), permissions contents:read, paths scope, branch logic
(rc=1 ::error / rc=2 ::warning / else notice), stdlib-only deps detector.
yaml.safe_load OK ; structure identique à svg-decimal-comma-gate.yml #6965.

Validation :
  - YAML structure préservé (jobs=1 svg-empty-display, steps=3,
    first step actions/checkout@v4, last step Gate changed notebooks).
  - 0 occurrence de « LAST EXPRESSION » (grep -n verify).
  - « §4 / svg-6927-canon / Formatter.Register / helper-load » canon refs
    présentes L28, L64, L66, L71, L77, L80, L169.
  - Diff +15/-14 atomique sur 1 file (workflow YAML), 0 autre fichier touché.

Pre-flight collision scan L539-L1 ★★★ :
  - origin/feature/c635-svg-empty-display-ci-gate (= PR #6981 base) ✓
  - origin/feature/svg-empty-display-detector-3801 (= #6971 MERGED) ✓
  - origin/feature/svg-emptydisplay-fixguidance (= PR tierce docstring FIX) ✓
  - origin/docs/svg-6927-mergegate-readme (= PR tierce README sequence, NOUVELLE
    tierce : cible = docs/notebook_tools/*.md, pas workflow YAML = PAS COLLISION)
  - main a avancé dbe6df1..365486c (Heatmap #6982 + Infer-19 #6983 +
    Sudoku accents #6984 + Infer-18 #6985) — pas de conflit (workflow YAML
    indépendant du contenu notebooks).

References :
  - Closes intent of CHANGES_REQUESTED PRR_kwDOH2Odns8AAAABGVBAAg (ai-01)
  - Mirror #6978 (MERGED detector docstring/FIX correction)
  - See #6967 (DecInfer-7 display() proof that helper-load is discriminator)
  - See #6971 (companion detector MERGED)

---------

Co-authored-by: Claude-Code <noreply@anthropic.com>
@jsboige
jsboige deleted the feature/svg-decimal-comma-ci-gate-3801 branch September 2, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant