Skip to content

fix(i18n): RU Fallacies title overflow via lang-ru CSS class (#316) - #353

Closed
jsboige wants to merge 1 commit into
masterfrom
feat/fallacies-ru-title-overflow
Closed

fix(i18n): RU Fallacies title overflow via lang-ru CSS class (#316)#353
jsboige wants to merge 1 commit into
masterfrom
feat/fallacies-ru-title-overflow

Conversation

@jsboige

@jsboige jsboige commented May 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Russian Fallacies card titles overflow the card edge because Cyrillic
runs ~15-20% wider than Latin. Worst cases clip mid-word off the card
(e.g. НЕЙРОЛИНГВИСТИЧЕСКОЕ ПРОГРАММИРОВАНИЕ on both Tarot and A0/Web
faces). The FR golden master ("PROGRAMMATION NEUROLINGUISTIQUE") and PT
("PROGRAMAÇÃO NEUROLINGUÍSTICA") render fine — this is RU-specific.

Closes part of #316 (RU cards). See scope note below.

Approach — Option A (RU-only, FR golden master untouched)

The localization layer already runs StaticConversions (string replaces
on the mustache template, per destination language) after the field-name
swaps. This PR rides that hook:

  1. AssetConverterConfig.cs — add a StaticConversions entry to the
    Fallacies CardSetLocalization that injects a lang-ru marker class
    onto the card body wrapper for ru only:
    <div class="body"> -> <div class="body lang-ru">.
    DoStaticConversions is a no-op for fr/en/pt (no entry), so their
    mustache is byte-for-byte untouched.

  2. Argumentum_Fallacies_Face_fr.json / Face_Web_fr.json — add inert
    .lang-ru .title rules that only engage when the class is present:

    • font-size reduction: 2.2em -> 1.9em (Tarot), 3.5em -> 3.0em (Web), ~-14%
    • overflow-wrap: break-word so extreme single Cyrillic words break to a
      new line instead of clipping off-card.

    Face_2_fr / Face_3_fr (1.1em titles) are left alone — they don't overflow.

  3. Tests — 6 regression assertions in FallaciesLocalizationTests:
    lang-ru is injected for ru only (fr/en/pt unchanged), and the
    large-title templates carry the matching .lang-ru .title CSS.

Scope notes

  • RU cards only. PT Fallacies cards were visually verified against the
    worst-case titles — Latin script is similar to FR widths, no overflow. Mind-map SVG
    overflow (also mentioned in fix(css): Cyrillic title overflow in RU/PT mind maps and cards (v1.0.0 blocker) #316) is a separate artifact and out of scope here.
  • Requires a pipeline regen for ru to take effect (the class injection
    happens at harvest/localization time).

Validation status

Generated with Claude Code

@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.

RU title overflow fix: lang-ru CSS class injected on card body for Cyrillic (15-20% wider than Latin). EN/PT/FR untouched. Test + template CSS rules guard regression. Clean.

@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.

[Hermes] — COMMENT_WITH_CONCERNS\n\nRisk: LOW (CSS + static conversion for i18n fix)\n\nChecklist:\n1. Security scan: CLEAN\n2. Cross-repo impact: None\n3. Tests: 2 theory methods — injection + template guard\n\nConcerns:\n- — rebase onto main before approval.\n- Font-size reduction 3.5em → 3.0em for : consider verifying this doesn't underflow on short Cyrillic titles (2-3 words).

@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.

[Hermes] — COMMENT_WITH_CONCERNS

Risk: LOW (CSS + static conversion for i18n fix)

Checklist:

  • Security scan: CLEAN
  • Cross-repo impact: None
  • Tests: 2 theory methods — injection + template guard

Concerns:

  • mergeable: CONFLICTING — rebase onto main before approval.
  • Font-size reduction 3.5em to 3.0em for .lang-ru .title: consider verifying this does not underflow on short Cyrillic titles (2-3 words).

Cyrillic Fallacies titles run ~15-20% wider than Latin equivalents and clip
off-card on tarot/web formats. Inject a `lang-ru` marker class on the card
body wrapper for RU only via StaticConversions, and ship inert
`.lang-ru .title { font-size: ...; overflow-wrap: break-word }` rules in
the overflow-prone templates (Face_fr 1.9em, Face_Web_fr 3.0em).

FR/EN/PT mustache stays byte-for-byte untouched (no StaticConversion
entry → DoStaticConversions is a no-op for those languages).

Surgical reconstruction on top of master (branch was 35 commits behind).
Build green; 6 new regression tests pass + 11 prior pass = 17/17.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jsboige
jsboige force-pushed the feat/fallacies-ru-title-overflow branch from e409fc1 to b743da0 Compare May 29, 2026 16:53

@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.

[Hermes] — APPROVED

SHA reviewed: b743da0 (HEAD, changed from previously reviewed e409fc1)

Security scan

✅ CLEAN — no hardcoded credentials.

CI status

✅ All checks pass (GitGuardian, Debug build, Release build).

Previous concerns status (from review on e409fc1)

# Concern Status
1 mergeable: CONFLICTING ✅ Fixed — PR is now MERGEABLE (surgical reconstruction on top of master)
2 Font-size reduction 3.5em→3.0em for .lang-ru .title ✅ Acceptable — Cyrillic titles are 15-20% wider than Latin, 3.0em is proportional. overflow-wrap: break-word escape hatch guards edge cases.

Review

Surgical reconstruction of RU title overflow fix. StaticConversions injects lang-ru body class for RU only; CSS rules are inert for EN/PT/FR. 6 new regression tests guard injection + template CSS presence. 17/17 tests pass. Architecture is clean and minimal.

APPROVE — all prior concerns resolved, clean fix with proper test coverage.

@jsboige
jsboige marked this pull request as draft May 29, 2026 17:43
@jsboige

jsboige commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

Disposition coordinateur (jsboige 2026-05-29) : HOLD → Option B

Mise en attente. La fix RU overflow passera par Option B (auto-shrink JS dans CardPen), conforme à la décision actée #303 (Option A −14% = NO-GO, Option B prioritaire).

Cette PR applique une réduction de police −14% (2.2em→1.9em Tarot, 3.5em→3.0em Web), scopée RU-only via la classe lang-ru — c'est la variante backup "A2", pas Option B. Son propre body porte déjà "Do not merge before the visual gate".

Conservée (pas close) car réutilisable :

  • les 6 tests de régression FallaciesLocalizationTests (injection lang-ru ru-only, CSS .lang-ru .title) restent valides quelle que soit l'option retenue ;
  • le hook StaticConversions d'injection de classe lang-ru est indépendant du mécanisme de shrink → réutilisable par Option B (auto-shrink ciblé sur .lang-ru).

Repassée en draft. Réévaluation après implémentation Option B + gate visuel ai-01 (Playwright RU sur pires titres) lors de la prochaine régénération.

🤖 ai-01 coordinator

@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.

[Hermes] — APPROVED\n\nClean i18n fix. The three-part approach is well thought out:\n1. CSS .lang-ru .title rules reduce font-size and add overflow-wrap for Cyrillic titles\n2. StaticConversion injects lang-ru body class for RU only (EN/FR/PT untouched)\n3. Comprehensive unit tests verify both the injection and template CSS guards\n\nNo concerns. Merge when CI passes.

@jsboige

jsboige commented May 31, 2026

Copy link
Copy Markdown
Contributor Author

Fermée comme superseded par #400.

Conformément à la disposition coordinateur (jsboige, 2026‑05‑29 : « HOLD → Option B (auto‑shrink JS dans CardPen) », décision actée #303), le débordement de titre RU (#316) est désormais corrigé côté CardPen par auto‑shrink JS plutôt que par cette classe CSS lang-ru (-14%, scope RU‑only).

Pourquoi Option B :

  • Indépendant de la langue et du gabarit — agit sur tout titre qui déborde (RU, mais aussi tout futur libellé long), pas seulement le cyrillique.
  • No‑op sur les titres qui tiennent — les titres latins ne sont pas réduits.
  • Un seul point d'ancrage (frame.js, avant la capture domtoimage), aucune retouche de gabarit JSON.

Validé visuellement (Playwright) : RU rogné → entièrement lisible ; latin intact. Détails et tableau de mesures dans #400.

La branche feat/fallacies-ru-title-overflow peut être supprimée.

@jsboige jsboige closed this May 31, 2026
jsboige added a commit that referenced this pull request May 31, 2026
… (#400)

Long non-breaking titles — notably RU Cyrillic compounds such as
"НЕЙРОЛИНГВИСТИЧЕСКОЕ ПРОГРАММИРОВАНИЕ" — overflowed the .title box and
were clipped mid-word, because the inner `.title > div` uses
`overflow-wrap: normal`. This implements Option B from #303/#353
(auto-shrink JS), chosen over a RU-only CSS class so the fix is
language- and template-agnostic.

frame.js now runs autoFitCardTitles() on each <card> in generateImages(),
right after font preload and before the domtoimage capture. For each
`.title` it binary-searches the largest font-size that fits horizontally
(floor 8px). Titles that already fit are left untouched (no-op), so
non-overflowing Latin titles are unaffected.

Validated via Playwright on the real Fallacies face template + CSS:
- "AD HOMINEM" (Latin):                          84.5px unchanged (no-op)
- "НЕЙРОЛИНГВИСТИЧЕСКОЕ ПРОГРАММИРОВАНИЕ": 84.5 -> 39.1px, now fits
- "ПСЕВДОНАУЧНОСТЬ":                       84.5 -> 51.7px, now fits

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@jsboige
jsboige deleted the feat/fallacies-ru-title-overflow branch June 1, 2026 21:45
jsboige added a commit that referenced this pull request Jun 3, 2026
…idation dossier (#433)

§2bis updated post-recalibration (#431 merged e9600c0). Replaces the stale
pre-recalibration caveat (2834, global 65/85 thresholds, "po-2024 follow-up
pending") with the fresh per-CardSet × per-detector breakdown from the
recalibrated run (2026-06-03, 3905 imgs):

- Construction-signature table: each detector flags by card construction, not
  defect. White-bg cards (Rules/Scenarii) → WhiteBand+blank-ratio ~96% noise;
  colored-bg (Fallacies-Web/Virtues) → blank-ratio clean, bottom-sat the signal.
  Only discriminant detector = bottom-sat, read per-CardSet.
- #188 headline: WhiteBand clean on colored cards (Fallacies-Web 0, Virtues 37
  scattered singletons, no 8-lang cluster) → no white-band regression on the
  cards #188 affected.
- True exception list (bottom-sat): Rules rules_23 = #250 FIX 2 (proposed);
  Scenarii ~7 dense cards saturating ~43% uniformly across all 8 langs =
  card-intrinsic, NOT translation (new eye point); Virtues zh/ru/es/pt
  length-overflow cluster = #316/#353 family (PR #400 RU auto-shrink).

Binary summary stays non-discriminant (3219/3905) — value is the per-CardSet
exception filter, not the binary verdict.

Co-authored-by: Claude Opus 4.8 <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