Skip to content

fix(mindmap): restore Fallacies click-to-define interactivity, 8 langs (#820) - #822

Merged
jsboige merged 1 commit into
masterfrom
fix/fallacy-mindmap-node-injection
Jul 16, 2026
Merged

fix(mindmap): restore Fallacies click-to-define interactivity, 8 langs (#820)#822
jsboige merged 1 commit into
masterfrom
fix/fallacy-mindmap-node-injection

Conversation

@jsboige

@jsboige jsboige commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Restores the click-to-define interactivity on the Fallacies mind-maps (all 8 languages). Every Fallacies_<lang>.content.svg (and its integrated HTML) shipped with 0 class="node" — clicking a node did nothing. Virtues worked; Fallacies did not.

Closes #820.

Root cause

FallacyMindMapDocumentConfig.ProcessSvgFilesAsync had been split into two overloads. The public one called the internal one without passing the mind-map items, and the internal overload then substituted an empty List<IMindMapItem>() (a leftover "simplification for the test"). So UpdateSvgWithItems always received 0 itemsCollectPossibleSvgNodes([])"No SVG nodes to disambiguate"0 nodes injected.

Compounding fact: the normal Mindmapper pipeline sources the text-as-path canonical Fallacies_<lang>.svg (<text/> self-closing, 0 matchable text), so even with items it would match nothing. The text-bearing content.svg (1408 titles, from #565) is the correct injection source.

Virtues was unaffected because VirtueMindMapDocumentConfig passes real items directly.

Fix

  1. Bug fix — pass the real items through the public→internal overload; keep a test-compat item-less overload (delegates with an empty list) so SvgPostProcessingTests' approved snapshot stays byte-identical.
  2. Standalone regen — new --regen-fallacy-mindmap-nodes entry-point + public RegenerateInteractiveContentSvgAsync. It injects localized node attributes directly into the existing text-bearing content.svg (per-language via DoReflectionTranslate, exactly how the pipeline localizes Virtues) and regenerates the integrated + external HTML. Standalone on purpose: it never runs the normal pipeline (which would re-derive content.svg from the text-as-path canonical and destroy every node title) and never invokes FreeMind.

Regenerated artifacts (8 langs)

content.svg + integrated .html now carry 1397–1408 class="node" (was 0). Diff is purely additive on each <g> (adds id/class/family/subfamily/subsubfamily/description/example/link/depth/familyclass); node-title text preserved. Localization intact (ru Cyrillic, ar/fa Arabic, zh CJK). The 5–11 unmatched per language are the known-fragile duplicate-title disambiguation cases (CLAUDE.md Known Fragile Area #1), not a regression.

lang nodes lang nodes
fr 1403 es 1406
en 1404 ar 1399
ru 1405 fa 1397
pt 1408 zh 1401

Verification (ai-01, Playwright)

  • fr: 1403 nodes; click → overlay appears (display:none→visible); family Argument fallacieux; description "Votre discours vise à tromper votre auditoire."
  • ru: 1405 nodes; click → overlay appears; family Софизмы (ложные аргументы) (Cyrillic); description "Своим высказыванием вы стремитесь ввести аудиторию в заблуждение." — full localization parity with Virtues.
  • Tests: 626 pass / 0 fail / 5 skip.

Reproduce

dotnet run --project "Generation/Converters/Argumentum.AssetConverter/Argumentum.AssetConverter.csproj" -- --regen-fallacy-mindmap-nodes

🤖 Generated with Claude Code

…ty, 8 langs (#820)

Root cause (#820): FallacyMindMapDocumentConfig.ProcessSvgFilesAsync was split
into two overloads and the public one called the internal one WITHOUT the
mind-map items; the internal overload then substituted an empty
List<IMindMapItem> ("simplification for the test"), so UpdateSvgWithItems always
received 0 items and injected 0 class="node". Compounded by the normal pipeline
sourcing the text-as-path canonical Fallacies_<lang>.svg (0 matchable text).
Result: every Fallacies_<lang>.content.svg shipped with 0 nodes and the
integrated HTML had no click-to-define overlay (Virtues worked because it passes
real items directly).

Fix:
- Pass the real items through the public->internal overload; keep a test-compat
  item-less overload delegating with an empty list so SvgPostProcessingTests'
  approved snapshot stays unchanged.
- Add a standalone --regen-fallacy-mindmap-nodes entry-point + public
  RegenerateInteractiveContentSvgAsync that injects LOCALIZED node attributes
  directly into the EXISTING text-bearing content.svg (per-language via
  DoReflectionTranslate) and regenerates the integrated + external HTML.
  Standalone on purpose: never runs the normal Mindmapper pipeline (which would
  re-derive content.svg from the text-as-path canonical and lose every node
  title), and no FreeMind.

Regenerated artifacts (8 langs): content.svg + integrated .html now carry
1397-1408 class="node" (was 0). Localization intact (ru Cyrillic, ar/fa Arabic,
zh CJK). The 5-11 unmatched/lang are the known-fragile duplicate-title
disambiguation cases (CLAUDE.md Known Fragile Area #1), not a regression.

Verified (ai-01 Playwright): fr 1403 nodes + overlay populates FR; ru 1405 nodes
+ overlay populates Cyrillic (family "Софизмы (ложные аргументы)", localized
description) - parity with working Virtues.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jsboige
jsboige merged commit 927b5c4 into master Jul 16, 2026
2 checks passed
@jsboige
jsboige deleted the fix/fallacy-mindmap-node-injection branch July 16, 2026 23:12
jsboige added a commit that referenced this pull request Jul 18, 2026
* fix(mindmap): restore svg-pan-zoom v3.6.2 navigation + regenerate 16 HTML wrappers (#825)

User-visible regression (jsboige dispatch #825): 'SVG displayed in browser,
no fluid navigation, no zoom icons' on the Fallacies mindmap HTML viewers.

Root cause: PRs #271-274/#312 replaced the Golden Master (eb83d11, April
2024) svg-pan-zoom v3.6.2 + Hammer.JS v2.0.8 bundle with a custom
'transform: scale()' approach on the mindmap div container. That paradigm
doesn't provide:
- pinch-to-zoom (touch gestures)
- pan via drag (no transform tracking)
- mouse wheel zoom (registered on wrong element)
- control icons (no svg-pan-zoom-control g)
- the Golden Master accessibility (keyboard zoom keys +/-)

The custom code worked at first glance but left users without a usable
navigation. jsboige's 'plus de nav fluide ni icônes de zoom' is the
exact symptom.

Fix:
- included.html (inline SVG in #mindmap div):
  svgPanZoom('#mindmap svg') with inline bundle
- external.html (SVG via <object> tag):
  svgPanZoom('#svgObject') — svg-pan-zoom v3.6.2 traverses
  object.contentDocument internally via getSvg()

The full ~60 KB minified bundle (svg-pan-zoom + Hammer.JS) is inlined
in each template for offline standalone use (no CDN dependency).

Invariants preserved (MindMapHtmlWrapperTests 9/9 PASS):
- [SVGCONTENT] placeholder in included.html
- [SVGPATH] placeholder in external.html
- No [SVGCONTENT] leak into external.html
- class="node" attributes (click-to-define #822) untouched — 1403 nodes
  with link/family/description/example attributes confirmed via Playwright

Validated:
- MindMapHtmlWrapperTests 9/9 PASS
- Full test suite 626 PASS / 0 FAIL / 5 SKIP
- Playwright headless verify on Fallacies_fr.html:
  * window.svgPanZoom defined: TRUE
  * #svg-pan-zoom-controls rendered (zoom in / reset / zoom out)
  * No JS errors / warnings
  * Interactive zoom in (3 clicks): viewport CTM 0.0418 -> 0.0557
  * Interactive zoom out (2 clicks): viewport CTM 0.0418 -> 0.0346
  * Reset: viewport CTM returns to 0.0418
- --regen-fallacy-mindmap-nodes regenerated 16 HTML (8 langs × 2 templates)
- All regenerated HTML contain 'svgPanZoom', 'svg-pan-zoom v3.6.2', and
  zero occurrences of the buggy 'mindmapContainer.style.transform' or
  'mindmapContainer.addEventListener' / 'let isPanning' patterns

Also removes Cards/Fallacies/Mindmaps/{included,external}.html.bak
stragglers (596/594 lines) from an earlier Edit backup cycle.

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

* fix(tests): migrate MindmapWrapperTests to svg-pan-zoom v3.6.2 CTM paradigm

The 3 Included_Wrapper_* tests were querying #mindmap.style.transform (the
buggy paradigm removed by the svg-pan-zoom bundle restore). With v3.6.2,
zoom state lives in the CTM of the <g class="svg-pan-zoom_viewport">
element (.a = scale factor).

Changes:
- Included_Wrapper_Wheel_Zoom_Changes_Transform: query .svg-pan-zoom_viewport
  CTM.a before/after #svg-pan-zoom-zoom-in / -out clicks; assert monotonic
  increase / decrease instead of brittle CSS regex matches.
- Included_Wrapper_Keyboard_Zoom_Still_Works: confirm the 3 control icons
  (#svg-pan-zoom-zoom-in / -out / -reset-pan-zoom) are in DOM (proves bundle
  init ran), then assert reset returns CTM.a to initial value within 0.001.
- Included_Wrapper_Zoom_Clamped_To_Min_Max: clamp invariants on CTM.a
  (positive at min, bounded at max), without hardcoding the exact minZoom
  ratio (config-dependent on SVG/container size).

All 3 tests verified PASS against the regenerated included.html template that
ships svg-pan-zoom bundle + Hammer.JS (commit 543268e).

Closes: #825 (test greenkeeping)

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

* fix(mindmap): regenerate 16 Virtues HTML wrappers from svg-pan-zoom-restored templates (#826 follow-up)

ai-01 verdict (msg-20260717T225808-0wm2no, HIGH):
- Fallacies 16 HTML wrappers: PASS (svgPanZoom + click-to-define restored)
- Virtues 12 HTML wrappers: HOLD — the --regen-fallacy-mindmap-nodes pass only
  re-ran FallacyMindMapCreatorConfig, not VirtueMindMapCreatorConfig. Templates
  (Cards/Fallacies/Mindmaps/{included,external}.html) were already corrected in
  the same branch, but VirtuesMindMapDocumentConfig still pointed at them
  without being re-run, so the 12 Argumentation_Virtues_<lang>{,_ext}.html kept
  the buggy mindmapContainer.style.transform=scale() paradigm.

Fix:
- New --regen-virtue-mindmap-html entry point in Program.cs (mirrors the
  --regen-fallacy-mindmap-nodes structure, but skips the node-attribute
  injection since Virtues content.svg is already correct). Aborts loudly if
  the templates do not contain the svg-pan-zoom v3.6.2 bundle header.
- 16 HTML wrappers regenerated from local Cards/Fallacies/Mindmaps/{included,
  external}.html (already restored on this branch).

Verification on the 16 generated files (8 langs × 2 templates):
- svgPanZoom count: 2 per file (init + reference)
- mindmapContainer.style.transform count: 0 per file (buggy paradigm eliminated)
- let isPanning count: 0 per file (residual buggy code eliminated)
- svg-pan-zoom-controls: 1 per file (zoom icons rendered)

Regression:
- Argumentum.AssetConverter.Tests (Mindmap filter): 92/92 PASS (1 skip = Freeplane absent)
- Argumentum.AssetConverter.VisualTests (3 Updated_Mindmap tests): 3/3 PASS
- dotnet build: 0 warning / 0 error (CS+NU+xUnit)
- 0 secret in diff (grep -iE api.?key|token|secret|password|sk-... = 0 match)

Same branch fix/mindmap-svg-pan-zoom-restore; no new PR.
Awaiting ai-01 re-verdict on Virtues (fr + ar + zh) before merge + web1 redeploy of 28 files.

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

---------

Co-authored-by: po-2023 <po-2023@argumentum.local>
Co-authored-by: Claude <noreply@anthropic.com>
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.

Mindmap Fallacies — restaurer l'interactivité perdue (0 node cliquable vs 1408 en prod 2024)

1 participant