Skip to content

fix(infer-18,#6927): Plotly CDN bar+marker -> SVG inline Bar (cp posterior) - #6985

Merged
myia-ai-01 merged 1 commit into
mainfrom
feature/infer18-changepoint-6927
Jul 17, 2026
Merged

myia-ai-01 merged 1 commit into
mainfrom
feature/infer18-changepoint-6927

Conversation

@jsboige

@jsboige jsboige commented Jul 17, 2026

Copy link
Copy Markdown
Owner

What

Probas/Infer/Infer-18-Change-Point.ipynb cell[8]: replace blank-in-static Plotly chart with inline static SVG via SvgChartHelper.Bar() (#6942 + #6958 MERGED).

Discrete posterior P(cp=t) over the change-point location t=0..99 (Infer.NET Discrete cpPost, N=100) — 100-bar histogram. The mode (MAP = argmax of the posterior, the estimated true change-point) is the peak bar, and is also printed explicitly via Console.WriteLine.

Why Bar() (not Overlay)

The original Plotly was a bar histogram + 1 red triangle marker at the mode. The helper Bar() covers the histogram; the mode is naturally the tallest bar (visually self-evident), and the explicit Console.WriteLine($"Mode (MAP, vrai point de rupture estime) : t={mode} ...") preserves the "vrai point de rupture" pedagogy the red triangle conveyed. No new primitive needed; the marker-on-bar combo collapses cleanly into Bar() + Console.

The distribution shape (posterior concentrated near the true cp) + the peak = mode is the pedagogical point that must render on GitHub.

Family rotation (R6)

Continuing the Probas/Infer rotation (home turf, .NET). Same EPIC (#6927), same family as Infer-19 (#6983) — helper co-located → bare #load resolves natively.

#load resolves natively here

Bare #load "SvgChartHelper.cs" resolves without an ExecutePreprocessor path override — the helper is co-located in Probas/Infer/ (same folder as the notebook), so kernel CWD = notebook dir = helper dir (cf c.563 empirical #load truth: resolves relative to notebook dir).

Surgical full-cell replace

cell[8] held the record PlotlyHtml + Formatter.Register setup block and the chart (only cell using PlotlyHtml — verified: 9 code cells, only cell[8] references it). So the entire cell source is replaced: setup dropped, computation preserved byte-for-byte (pmax, masses-table Console.WriteLine, mode/modeMass argmax), chart swaps to Bar().

Gates verified firsthand

Gate Result
Real .net-csharp exec (H.4) cell[8] exec_count=4, 0 errors (23-cell exec), SVG out_len=14865
detect_svg_decimal_commas.py (#6959, merge-gate) 0 defects rc=0 (helper F()=InvariantCulture)
detect_svg_empty_display.py (#6971, no-vision blank-gate) 0 defects rc=0 (mechanically non-blank)
check_plotly_static_risk.py (#6931) Infer-18 no longer risky
cdn.plotly in output False
probeAddresses banner absent
bar count 101 <rect> (100 bars + axis/legend)
C.3 scope only cell[8] changed
Catalog byte-identity (R1) 0 diff; README untouched

Verdict: SOTA-OK (#3801 Prong-A)

Notes

🤖 po-2025 (GLM no-vision lane)

…e cp posterior)

cell[8]: P(cp=t) posterior histogram (100 bars, Infer.NET Discrete) -> SvgChartHelper.Bar().
Mode (MAP = argmax = estimated true change-point) = peak bar + explicit Console.WriteLine.
PlotlyHtml formatter setup dropped (only cell using it; verified). pmax/masses-table/mode
computation preserved. Helper co-located in Probas/Infer/ -> bare #load resolves natively.
Gates firsthand: exec_count=4, #6959=0, #6971=0, #6931 Infer-18 cleared, cdn=false, C.3 [8].

See #6927. SOTA-OK (#3801 Prong-A).

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

Copy link
Copy Markdown
Contributor

Notebook PR Validation: PASS

  • Notebooks checked: 1
  • Code cells validated: 9
  • Result: All passed

Checks: H.1 (no errors), H.3 (execution_count), C.1 (no banned patterns)
Non-Python kernels (.NET/Lean): C.1 + errors only (execution_count advisory)
QuantConnect notebooks: C.1 + errors only (require QC Cloud for execution)

@github-actions

Copy link
Copy Markdown
Contributor

Golden-Set Execution (H.7 P3)

✅ 8/8 notebooks passed (certified reproducible)

Notebook Status Time
2.1-Workflow-ML.ipynb ✅ SUCCESS 5.3s
2.2-Descente-de-gradient.ipynb ✅ SUCCESS 4.3s
2.3-Regression-lineaire-logistique.ipynb ✅ SUCCESS 3.9s
2.4-Arbres-Forets-Ensembles.ipynb ✅ SUCCESS 4.9s
Search-1-StateSpace.ipynb ✅ SUCCESS 4.0s
SL-1-LogicalLearning.ipynb ✅ SUCCESS 3.0s
rl_4_multi_armed_bandits.ipynb ✅ SUCCESS 25.6s
GameTheory-4c-NashExistence-Python.ipynb ✅ SUCCESS 3.5s

Pinned lockfile: scripts/notebook_tools/golden_set.lock.txt (H.7 P3, axe A #4208)

@myia-ai-01
myia-ai-01 merged commit 722ad08 into main Jul 17, 2026
21 checks passed
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/infer18-changepoint-6927 branch September 2, 2026 13:14
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.

2 participants