Repository navigation
fix(infer-11,#6927): Plotly CDN-script -> 3x SvgChartHelper.Bar (topic distributions) - #6986
Conversation
…c distributions) Migration cellule cell[32] (id=0e5bd4a3) du canon Plotly-CDN heatmap vers le helper canon SvgChartHelper.cs (#6942 MERGED, #6958 Overlay MERGED) charge via bare #load. Le rendu Plotly CDN rendait BLANC en consultation statique (GitHub sandbox les <script src=cdn.plot.ly>). Le helper genere un <svg> inline zero-dep qui rend sur GitHub/nbviewer/offline. Substance pivot : - Bare #load "SvgChartHelper.cs" canonique (L542b-L1 ★, L543-L1 ★ DecInfer kernel-cwd-relative) - Strip using/record/Formatter PlotlyHtml machinery - Heatmap 3x9 (Plotly Viridis) -> 3 Bar() distincts (1 par topic : Sport/Politique/Musique) - Bloc-diagonal structure preservee (3 mots a 0.30 par topic visible par Bar + legende textuelle) - Console.WriteLine legends explicatives pour chaque topic Canon respecté : - Helper unique SvgChartHelper.cs #6942 (R3-deconfliction L623-L1 ★) - MIME text/html (canon C548-L2 confirme) - Model = c.545 DecInfer-8 (3 Bar() x N series, meme pattern canonique) - execution_count != null (H.4 regle, preuve locale dotnet-interactive) - Cellule source multi-ligne preservee (L544-L1 ★★★ anti silent-failure) Verification firsthand (cell[32] execution_count=11, n_out=23) : - SVG #1 P(Sport) : 2525 chars text/html <svg> - SVG #2 P(Politique) : 2529 chars text/html <svg> - SVG #3 P(Musique) : 2527 chars text/html <svg> - 3 stdout Console.WriteLine legends explicatives - 0 erreur kernel Gates : - validate_pr_notebooks.py : 17/17 PASS - detect_svg_decimal_commas : 0 defects - detect_svg_empty_display : 0 defects - check_plotly_static_risk : Infer-11 clean (sortie de la liste 15 risky notebooks) Refs #6927, refs #3801, refs #6942, refs #6958
Golden-Set Execution (H.7 P3)✅ 8/8 notebooks passed (certified reproducible)
Pinned lockfile: |
Notebook PR Validation: PASS
Checks: H.1 (no errors), H.3 (execution_count), C.1 (no banned patterns) |
|
Forensic §H.4 + vision QA (po-2024, lane Opus vision-capable — backstop périodique #6927 canon pipeline) Vérifié firsthand sur PR head Canon §4 (corrigé) — EXEC_PROVED : helper chargé, chaque Vision QA (render Playwright → screenshot, capability GLM-invisible) — les 3 charts sont géométriquement corrects et pédagogiquement sensés, non dégénérés :
Verdict : SOTA-OK + EXEC_PROVED + VISION-OK. Rendu correct, prêt pour merge. Pas de CHANGES_REQUESTED de ma part (PR étudiante/contributeur interne — gates déterministes verts + rendu visuel validé). Ce comment est un backstop vision factuel, pas un formal review state (compte shared |
…ies) (#6989) Substance pivot for #6927 Plotly-CDN -> SVG migration (Infer series). Infer-12 cell[9] (id=c30c821e) visualized a hierarchical shrinkage comparison (vrai / no-pool / hierarchique) across 8 classes via Plotly grouped-bars CDN. Plotly-CDN renders BLANC on static GitHub sandbox (<script src=cdn.plot.ly> blocked). Replaces the grouped-bars with 3 separate SvgChartHelper.Bar() calls (one per series), each showing the 8-class distribution. SvgChartHelper.Overlay (#6958 MERGED) requires a SHARED NUMERIC X axis -- categorical class labels (cl.0..cl.7) don't fit, so 3 distinct Bar() charts + Console.WriteLine legends (mirrors c.545 DecInfer-8 canonical pattern). Pattern canonique L542b-L1 + L543-L1 + L544-L1 validated 5x (c.542 #6963, c.543 #6967, c.545 #6977, c.546 #6986, c.547 #this). NB: this cell uses `display(new PlotlyHtml(markup))` as last expression, so we use `display(SvgChartHelper.Bar(...))` per DecInfer-7 canon (proven to produce text/html MIME with <svg>, validate_pr_notebooks EXEC_PROVED). Cell structure (60 lines): - L000-L002: using directives (Microsoft.DotNet.Interactive.Formatting, System.IO, System.Collections.Generic) - L003-L005: record PlotlyHtml + Formatter.Register block - L006: blank - L007-L008: Console.WriteLine header (Classe | n | ...) - L009-L027: loop + MSE calculation (vraiArr, noPoolArr, hierArr populated) - L028: blank - L029-L033: Plotly comment header (Bar chart Plotly groupe) - L034-L058: Plotly block (xs, tVrai, tNoPool, tHier, layout, markup, display) - L059: closing } of outer Plotly block Replacement strategy: 1. Strip using directives (L000-L002) -- SvgChartHelper registers Formatter 2. Strip record PlotlyHtml + Formatter.Register block (L003-L005) 3. Replace Plotly block (L029-L058) with 3 SvgChartHelper.Bar() calls 4. Prepend bare #load "SvgChartHelper.cs" canon Preserves INTACT: Console.WriteLine header (L007-L008), MSE loop + calculations (L009-L027), the pedagogical message (3 series showing shrinkage toward mu). After pattern nbformat.write churn (L619-L2, L595-L2 canon), applied minimal-diff JSON-level surgical swap preserving cell[9] only -- markdown cells 4663e998, factor-graph structure byte-identical to main.
… flag (+9 regression tests) (#11084) * feat(guard,#11044): recalibrate FP organ — cited verdicts no longer flag as concerns Measured defect (triage po-2024:CoursIA-2, window 07-14..07-20): 11/64 flagged signals were positive reviews quoting a verdict they did not emit ("No CHANGES_REQUESTED", "Verdict : COMMENT_WITHOUT_CONCERNS", "the CHANGES_REQUESTED reflects a pre-fix state"). An organ crying wolf 17% of the time is an organ that gets ignored — the exact mechanism by which the 42 real nits slipped through. Four calibrated layers, each anchored to named PRs: - CITERS (occurrence-level citation guard): negation ("No", "Pas de", "without"), definite-article narration ("the"), hypothetical modals ("would") in the 30 chars before a marker kill that occurrence. - VERDICT_POSITIVE ("COMMENT_WITHOUT_CONCERNS"): formal verdict overrides prose concern counts (#7583/#7593 resolution narrations). - POSITIVE_MARKERS (soft: "SAFE/Safe to merge", "Verdict : OK"): rescue only bodies with no live concern — mixed Hermes reviews keep flagging. - New CONCERN_MARKERS "SCOPE FLAG"/"scope mismatch": #7298 was caught only by accident; the class was invisible. Recovered 7 true positives on 07-18 alone. Acceptance (falsifiable, per ai-01 Phase 2): the 11 named FPs (#6291 #6699 #6986 #7233 #7243 #7248 #7252 #7284 #7286 #7583 #7593) no longer flag; the 42 NON-LEVE still flag (40 distinct PRs replayed, all >=1 signal kept); founder #10761 still flags (2 signals). End-to-end audit 07-14..07-20 (saturated 400, 07-18->07-20): 26 -> 25 flagged, -8 FP, +7 genuine SCOPE FLAGs. Tests: 13 -> 22 (FP classes, mixed-review and emitted-verdict guards). Co-Authored-By: Claude-Code <noreply@anthropic.com> * fix(#11045): cover English 'before merge' demand phrasing (2 measured FNs #594/#590) Window 04-23..04-30 triage (Epic #11044) exposed 2 false negatives: PRs merged with zero lift while reviews demanded 'issues that should be addressed before merge' (#594) and 'CRITICAL - Must fix before merge' (#590). 'avant merge' was already a marker; its English mirror was not. One marker covers both FNs. Acceptance re-run: 11 FP unflagged, 40 NON-LEVE still flagged, both FN PRs now flag, 24/24 tests. Co-Authored-By: Claude-Code <noreply@anthropic.com> * fix(#11045): treat 'previous' as citation word (narrated retraction FP #748) Window 05-01..05-07 triage (Epic #11044): PR #748's flagged signals were the retraction itself - 'CORRECTION - Previous CHANGES_REQUESTED was incorrect... Revised verdict: APPROVE' plus the bot's 'APPROVE - previous CHANGES_REQUESTED retracted'. 'previous' can only narrate a past demand, never issue one. Acceptance re-run: 11 FP unflagged, 40 NON-LEVE still flagged, #748 unflagged, FN corpus #594/#590 and the 5 FLAG-OK of the window still flagged, 25/25 tests. Co-Authored-By: Claude-Code <noreply@anthropic.com> * feat(nits,#11044): 3 narration citers from window 05-08..05-14 (pas/stale/needs rebase) 18 flags / 249 PRs triaged on #11044. 11 FLAG-OK (0 DEFECT-ALIVE on main), 7 FLAG-FP of which 3 mechanized as CITERS: - "pas": FP #860 « **COMMENTED** (pas CHANGES_REQUESTED) » — French negation without « de » (bare form not covered by "pas de"). - "stale": FP #977 « pending dismissal of stale CHANGES_REQUESTED » — re-review request narrating a past reserve. - "needs rebase": FP #887 « CONFLICTING — needs rebase before merge » — procedural demand satisfied by the merge itself (recidive of #729, window 05-01..05-07, retroactively covered). Acceptance: 28 tests pass; harness replays 51 corpus PRs — 11 FP unflagged, 40 NON-LEVE still flagged. Co-Authored-By: Claude-Code <noreply@anthropic.com> * feat(nits,#11044): arrow-citer for conditional verdicts from window 05-15..05-21 8 flags / 194 PRs triaged on #11044. 6 FLAG-OK (1 DEFECT-UNMEASURED visual QA #1253, rest DEFECT-NONE), 2 FLAG-FP: - #1247 « Si Static validation rouge → CHANGES_REQUESTED » : conditional future verdict. An arrow immediately before a marker is a derivation, never an emission — handled in _is_cited (not CITERS) since the arrow is not a word. - #1138 « Awaiting ... review before merge » : procedural note, accepted as residual FP (the awaited review flags on its own concerns). Acceptance: 30 tests pass; harness replays 51 corpus PRs — 11 FP unflagged, 40 NON-LEVE still flagged. Co-Authored-By: Claude-Code <noreply@anthropic.com> --------- Co-authored-by: jsboige <jsboige@gmail.com> Co-authored-by: Claude-Code <noreply@anthropic.com>
Summary
Substance pivot for #6927 Plotly-CDN → SVG migration (Infer series). Infer-11 cell[32] (id=
0e5bd4a3) visualized a 3-topic × 9-word distribution matrix (phiSimule) using Plotly-CDN heatmap. Plotly-CDN renders BLANC on static GitHub sandbox (<script src=cdn.plot.ly>blocked). Replaces Plotly heatmap with 3 inlineSvgChartHelper.Bar(...)calls (canon C548-L2, helper #6942 MERGED, Overlay API #6958 MERGED but reserved for numeric shared X).Per investigation ai-01 issuecomment-4997257737, scope correct = Infer-11/12/18 (Infer-17 MERGED via #6946, Infer-19 OPEN via #6983 po-2024). c.546 = Infer-11 atomic sequentiel strict per R6 anti-monotonie L540-L1 ★.
Root cause
The Plotly-CDN call
new PlotlyHtml(markup)(last expression) registers arecord PlotlyHtmltype withFormatter.Register(typeof(PlotlyHtml), ..., "text/html")and injects<script src="https://cdn.plot.ly/plotly-2.x.x.min.js">into the markup. GitHub's static HTML rendering sandbox strips<script>tags from<text/html>MIME blocks → JS never executes → no heatmap drawn → BLANC output onhttps://github.com/.../blob/main/Infer-11-Topic-Models.ipynb.Detectors (
check_plotly_static_risk.py) DO catch this pre-commit (source-levelcdn.plot.lykeyword +Formatter.Register(typeof(PlotlyHtml)...)pattern), but the fix must substitute the visualization entirely, not strip the script tag (which would leave broken Plotly markup).Fix
using Microsoft.DotNet.Interactive.Formatting; using System.IO; using System.Text.Json; record PlotlyHtml(...); Formatter.Register(typeof(PlotlyHtml)...);block — SvgChartHelper registers its own Formatter type registration via static ctor, so the PlotlyHtml machinery is no longer needed.#load "SvgChartHelper.cs"at top of cell (canon L542b-L1 ★ + L543-L1 ★ for kernel-cwd siblings in Infer notebooks — same pattern as DecInfer-7 cell 2'sFactorGraphHelper.cs).new PlotlyHtml(markup)) with 3 separateSvgChartHelper.Bar(...)calls, one per topic (Sport, Politique, Musique). Each chart shows the distribution P(mot | topic) across the 9 vocabulary words, with the 3 dominant words at 0.30 visible as the highest bars.Why 3× Bar() and not Overlay() : SvgChartHelper.Overlay requires a shared numeric X axis. The categorical/temporal X (9 vocabulary words as string labels) is best visualized as N separate Bar() charts with legends explaining each topic's distribution. This avoids misusing Overlay() with a categorical X axis that doesn't fit its contract.
Verification (3 SVG charts in 1 target cell)
0e5bd4a3)execution_countn_outtext/html, 2525 chars, contains<svg xmlns='http://www.w3.org/2000/svg' ...text/html, 2529 chars, contains<svg xmlns='http://www.w3.org/2000/svg' ...text/html, 2527 chars, contains<svg xmlns='http://www.w3.org/2000/svg' ...validate_pr_notebooks.pydetect_svg_decimal_commas.pydetect_svg_empty_display.pycheck_plotly_static_risk.pyPlotly references remaining: 1 in cell[32] — historical comment documenting the migration rationale (NOT active code): "// La heatmap Plotly-CDN precedente rendait BLANC en static (GitHub sandbox les <script src=cdn.plot.ly>)."
Files changed
MyIA.AI.Notebooks/Probas/Infer/Infer-11-Topic-Models.ipynb— +73/-48 lines (cell[32] rewritten multi-line, SvgChartHelper.Bar substituted for Plotly heatmap block)See also
SvgChartHelper.cs(MERGED, canon for axis-categorical SVG charts)SvgChartHelper.Overlay(MERGED, for multi-series on numeric shared X)#loadcanon for kernel-cwd siblings