Skip to content

fix(memo): #443 Mémo Back grid — language-invariant 7×3×3 grouping - #449

Merged
jsboige merged 1 commit into
masterfrom
fix/memo-back-grid-443
Jun 10, 2026
Merged

fix(memo): #443 Mémo Back grid — language-invariant 7×3×3 grouping#449
jsboige merged 1 commit into
masterfrom
fix/memo-back-grid-443

Conversation

@jsboige

@jsboige jsboige commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Problème

La carte Mémo Back ne respectait plus la grille spécifiée 7 rangées (familles) × 3 colonnes (sous-familles) × 3 lignes (sous-sous-familles) — « ça saute aux yeux » (jsboige, #443). La grille s'effondrait (Tricherie : 0 sous-famille ; Erreur math/raisonnement : 1).

Cause racine

Le template groupait la grille par marqueurs de coïncidence de nom ({{#ifCond Famille "==" text_fr}} …), qui ne se déclenchaient que sur les lignes dont text_fr coïncidait par hasard avec leur propre label de niveau. Les campagnes de renommage FR #351 (×27) et #308 (×13) ont changé text_fr → les coïncidences ont disparu → les familles ont collapse.

La donnée taxonomique est correcte (7×3×3 parfait dans le sous-ensemble injecté carte∈{1,2}, 176 lignes) ; seul le regroupement du template était cassé. Lane ai-01 = template, pas CSV.

Correctif

  • Generation/CardPen/js/main.js — 3 helpers Handlebars « control-break » qui lisent les colonnes taxonomiques invariantes par langue (Sous-Famille / Soussousfamille, présentes dans chaque ligne quelle que soit la langue de rendu). Ils ne portent aucun token de colonne, donc le localiseur (CardSetLocalization.FormatField ajoute }}) ne peut pas corrompre l'appel :
    • ifFamilyHeader = Sous-Famille=='' && Soussousfamille==''
    • ifSubfamilyHeader= Sous-Famille!='' && Soussousfamille==''
    • ifLeafFirst = Soussousfamille!='' sur première occurrence (rupture de contrôle)
  • Cards/Memo/Argumentum_Memo_Back_fr.json — bascule les 3 conditions de coïncidence vers les nouveaux helpers (les tokens d'affichage {{Famille}}/{{Sous-Famille}}/{{Soussousfamille}} restent → localisation préservée) ; corrige la colorPalette (itère le rowset, 1 swatch par famille-racine — auparavant indices fixes 0/25/…/150 qui dupliquaient Influence et omettaient Obstruction).

Template unique partagé → le correctif se propage aux 8 langues.

Validation (axe GÉOMÉTRIE, pas seulement texte)

Sur la donnée réellement injectée (taxonomy WHERE carte∈{1,2}, 176 lignes) :

  1. Node + Handlebars vendored → 7 familles / 21 sous-familles / 63 feuilles ✅
  2. Render template OLD → prouve la régression (10/53, Tricherie=0) ✅
  3. Moteur CardPen LIVE (Playwright) → DOM 7×3×3 (chaque famille = 3 sous-familles × 9 feuilles) + palette 7 couleurs distinctes (Obstruction rouge présent, pas de doublon Influence) + screenshot vu
Famille Sous-familles Feuilles
Insuffisance 3 9
Influence 3 9
Erreur mathématique 3 9
Erreur de raisonnement 3 9
Abus de langage 3 9
Tricherie 3 9
Obstruction 3 9

Notes de déploiement

  • Release (GitHub Pages) : static.yml redéploie CardPen au merge → helpers main.js disponibles automatiquement ; template tiré depuis raw-master.
  • Debug (IIS argumentum.myia.io) : nécessite un redéploiement de CardPen sur l'IIS pour que main.js à jour soit servi lors d'un harvest Debug (handoff po-2023).
  • Régénération du deck Mémo requise pour matérialiser les PNG corrigés dans tous les langages.

Refs #443

…uping

The Mémo Back card collapsed from the spec 7×3×3 taxonomy grid (7 families ×
3 sub-families × 3 sub-sub-families) to an irregular shape. Root cause: the
template grouped the grid via name-coincidence markers
({{#ifCond Famille "==" text_fr}} …) that fired only on rows whose text_fr
happened to equal their own level label. FR rename campaigns (#351 ×27,
#308 ×13) changed text_fr → the coincidences vanished → families collapsed
(Tricherie sub-families = 0, Erreur math/raisonnement = 1, …). The taxonomy
DATA is correct; only the template's grouping was broken.

Fix (lane ai-01 = TEMPLATE, data is fine):
- CardPen main.js: add 3 control-break helpers reading the language-invariant
  FR taxonomy columns (Sous-Famille / Soussousfamille), present in every row
  regardless of render language. They carry NO column token, so the localizer
  (CardSetLocalization.FormatField appends "}}") cannot corrupt the helper call:
    ifFamilyHeader   = Sous-Famille=='' && Soussousfamille==''
    ifSubfamilyHeader= Sous-Famille!=''  && Soussousfamille==''
    ifLeafFirst      = Soussousfamille!='' on first occurrence (control-break)
- Argumentum_Memo_Back_fr.json: swap the 3 name-coincidence conditions for the
  new helpers (display tokens {{Famille}}/{{Sous-Famille}}/{{Soussousfamille}}
  unchanged → localization preserved); fix colorPalette to iterate the rowset
  and emit one swatch per family-root (was fixed indices 0/25/50/…/150, which
  duplicated Influence and omitted Obstruction).

Single shared template → fix propagates to all 8 languages.

Validated three ways on the real injected data (taxonomy WHERE carte∈{1,2},
176 rows): (1) Node + vendored Handlebars → 7 families / 21 sub-families /
63 leaves; (2) OLD-template render proving the regression (10/53, Tricherie=0);
(3) LIVE CardPen engine (Playwright) → 7×3×3 DOM + 7 distinct palette colors
(Obstruction red present, no Influence duplicate) + viewed screenshot.

Refs #443

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

@clusterManager-Myia clusterManager-Myia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[NanoClaw]

Clean, well-scoped fix. The root cause analysis is solid.

Logic verification (7x3x3 grouping)

The three helpers form a correct control-break pattern over the language-invariant FR taxonomy columns:

  • ifFamilyHeader — sf=="" && ssf=="" → 7 root rows. Correct.
  • ifSubfamilyHeader — sf!="" && ssf=="" → 21 subfamily headers. Correct.
  • ifLeafFirst(rows, index) — ssf!="" && ssf !== prev_ssf → 63 leaf first-occurrences. Correct.

Language-invariance — valid. Helpers read structural FR taxonomy keys (always present), not rendered text. No column tokens inside helper calls, so the localizer cannot corrupt them. Shared template propagates to all 8 languages.

colorPalette fix — correct. Old hardcoded indices (0/25/50/75/100/125/150) assumed uniform distribution but 176/7 = 25.14, causing drift that duplicated Influence and skipped Obstruction. New approach emits one swatch per ifFamilyHeader (7 iterations, 7 families). Right fix.

Minor note: ifLeafFirst takes ../rowset @index as positional params — works correctly but worth documenting the arg order dependency in main.js. Not a blocker.

No secrets, no regressions. LGTM.

@jsboige
jsboige merged commit 1fd4aa0 into master Jun 10, 2026
3 checks passed
@jsboige
jsboige deleted the fix/memo-back-grid-443 branch June 10, 2026 10:54
jsboige added a commit that referenced this pull request Jun 12, 2026
…-break (#455)

#449 ("language-invariant control-break grouping") replaced the old
`{{#ifCond Famille "==" text_fr}}` family selector with control-break
helpers ({{#ifFamilyHeader}}/{{#ifSubfamilyHeader}}). Six regression
tests still asserted the removed `Famille "=="` / `text_fr ` tokens and
failed on master (verified: template now has 0 ifCond, 1 control-break).
The geometry is correct (8/8 languages PASS visual re-check, RU 7x3x3),
so this was stale test debt, not a localization regression.

Replace the stale grouping-selector assertions in both Memo_Back theory
tests with assertions that the language-invariant control-break helpers
survive translation — same concern (grouping integrity post-translation),
new mechanism. Display-token, FR-token-absence, Famille_camelCase and
subtitle assertions are unchanged. Updated the historical Bug 2 comment
and the test docstring to reflect the #449 supersession.

.Tests suite: 155/155 pass (was 6 failing).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
jsboige pushed a commit that referenced this pull request Jun 12, 2026
…cascade

Without these computed properties, ~93% of AR/FA/ZH mindmap nodes
would have empty links (CSV link_ar/fa/zh coverage is 6-7%).
The fallback cascade matches the existing pattern: own lang → EN → FR.

Also restores FallaciesLocalizationTests.cs to master (control-break
helpers from #449), reversing an erroneous test regression in PR #454.

Co-Authored-By: Claude <noreply@anthropic.com>
jsboige added a commit that referenced this pull request Jun 12, 2026
…454)

* feat(i18n): add AR/FA/ZH language support for MindMap generation (#134 8-lang scope)

- Add AR/FA/ZH properties + CsvHelper mappings to Fallacy.cs entity
  (FamilyAr/Fa/Zh, SubfamilyAr/Fa/Zh, TextAr/Fa/Zh, DescAr/Fa/Zh,
  ExampleAr/Fa/Zh, LinkAr/Fa/Zh)
- Extend MindMapLocalization StaticConversions in AssetConverterConfig.cs
  to cover AR/FA/ZH for text, desc, example, link, and family hierarchy
- Add ES/AR/FA/ZH to FallacyMindMapCreatorConfig Translations list
- Add ES/AR/FA/ZH to VirtueMindMapCreatorConfig Translations list
- Update TaxonomyValidationTests _supportedLanguages from 4 to 8

CSV data for AR/FA/ZH has been 100% complete since PRs #432/#434/#443.
CardSets (PDFs) already support 8 languages via FrontFieldConversions.
This change extends MindMap SVG generation to the same 8-language scope.

Build: 0 errors, 15 warnings (pre-existing)
Tests: 149 pass, 6 fail (pre-existing, unrelated), 5 skip

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

* fix(i18n): add Link{Es,Ar,Fa,Zh}Fallback properties for MindMap link cascade

Without these computed properties, ~93% of AR/FA/ZH mindmap nodes
would have empty links (CSV link_ar/fa/zh coverage is 6-7%).
The fallback cascade matches the existing pattern: own lang → EN → FR.

Also restores FallaciesLocalizationTests.cs to master (control-break
helpers from #449), reversing an erroneous test regression in PR #454.

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

---------

Co-authored-by: Your <your.email@example.com>
Co-authored-by: Claude Opus 4.6 <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.

2 participants