Skip to content

fix(logger): #630 escape Spectre markup on all console paths + non-throwing render fallback - #655

Merged
jsboige merged 1 commit into
masterfrom
fix/630-logger-markup-escape
Jul 3, 2026
Merged

fix(logger): #630 escape Spectre markup on all console paths + non-throwing render fallback#655
jsboige merged 1 commit into
masterfrom
fix/630-logger-markup-escape

Conversation

@jsboige

@jsboige jsboige commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Problème (#630)

Quand un harvest set échoue, le marqueur [HARVEST-FAILURE] injecté par la résilience per-set #614 est rendu par Logger.Log(..., MessageType.Problem). Ce chemin passait le message non-escapé à AnsiConsole.MarkupLine → le StyleParser de Spectre interprète [HARVEST-FAILURE] comme un token de style → InvalidOperationException levée depuis le catch de la résilience → le run entier meurt au lieu de dégrader gracieusement. Le filet #614 était donc court-circuité par son propre message d'échec.

L'audit du Logger a montré que le bug est une asymétrie : le chemin Info/Warning/Success escape déjà (Markup.Escape), mais Problem, Title (Rule) et Instructions/Explanations (Panel — le ctor Panel(string) parse aussi le markup) ne le faisaient pas. Les handlers internes du logger interpolaient aussi ex.Message/LogFile sans escape.

Fix (les deux options du body de l'issue, complémentaires)

  1. Escape systématique : Markup.Escape(message) sur les 3 chemins manquants + sur ex.Message/LogFile des handlers internes. Le marqueur [HARVEST-FAILURE] s'affiche désormais littéralement (greppable).
  2. Ceinture non-throwing : le rendu console est enveloppé d'un try/catch avec fallback plain-text (AnsiConsole.WriteLine, sans parsing markup) — aucun échec de rendu ne peut plus se propager hors de Logger.Log, quelle que soit une future régression d'escape. Le garde-fou ArgumentOutOfRangeException (enum invalide) est préservé via un exception filter.

Le fichier log (File.AppendAllText) écrivait déjà le texte brut — non affecté.

Tests

LoggerMarkupSafetyTests (10 tests, console routée vers un StringWriter via IAnsiConsole custom) :

Contre-vérification : contre l'ancien code (stash du fix), 5/10 échouent — exactement les 5 chemins non-escapés ; les chemins déjà sûrs passent. Les tests pinnent donc réellement le fix.

Suite complète : 566 pass / 1 known-fail (OWLSharp round-trip #133, pré-existant) / 5 skip. 0 warning introduit.

Impact

Closes #630. Relates #613, #614.

🤖 Coordinator ai-01

…rowing render fallback

A message containing square brackets (e.g. the [HARVEST-FAILURE] marker emitted
by the #614 per-set resilience path) was fed unescaped to AnsiConsole markup
rendering on the Problem, Title and Panel paths. Spectre's StyleParser threw
InvalidOperationException from inside the resilience catch block, killing the
whole run instead of degrading gracefully.

- Markup.Escape(message) on Problem, Title (Rule) and Instructions/Explanations
  (Panel) paths, matching the already-escaped Info/Warning/Success path.
- Escape ex.Message/LogFile in the logger's internal error handlers too.
- Belt: wrap console rendering in try/catch with a plain-text fallback so no
  rendering failure can ever propagate out of Logger.Log (the #614 resilience
  guarantee). ArgumentOutOfRangeException guard preserved via exception filter.
- Regression tests (LoggerMarkupSafetyTests, 10 tests): verified 5/10 fail
  against the old code (the 5 unescaped paths), 10/10 pass with the fix.
  Full suite: 566 pass / 1 known-fail (OWLSharp #133) / 5 skip.

Closes #630.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jsboige
jsboige merged commit cb98905 into master Jul 3, 2026
3 checks passed
@jsboige
jsboige deleted the fix/630-logger-markup-escape branch July 3, 2026 00:49
jsboige added a commit that referenced this pull request Jul 3, 2026
…EN+FR) (#659)

Consolidated release-notes draft for the v0.9.0 GitHub Release, building on the
po-2023 draft (docs/RELEASE-NOTES-v0.9.0.md) and reflecting the post-bundle-v3
work not yet captured there:

Highlights:
- 8 languages x 10 documents, print-ready (bundle v3, 80 PDFs, PNG-300-lossless)
- Print & Play free + complete: Standard (full game) + Light (sample + Virtues
  families overview, depth<=2, #645/#648-650)
- Print-ready CMYK + SWOP OutputIntent via --pdf-cmyk Ghostscript post-pass
  (#632/#652)
- Rules i18n cleanup (#633->#640), 0 HIGH residual + committed anti-FP scanner

Notable fixes since dossier #591: harvest deadlock (#651), Logger hardening
(#630/#655), Scenarii 6.1.3 title (#653), GSheet Rules sync (#642).

Known limitations: SVG mind maps potentially stale (#636), OWL round-trip
#133, DNN CVEs (separate ops milestone).

EN + FR (impersonal). NOT published - draft docs only, jsboige validates and
pastes into the GitHub Release. Test count flagged as dashboard-baseline
(reported, not empirically re-verified) per [[test-counter-empirical-dotnet-test]].

Base ca5db81.

Co-authored-by: Your <your.email@example.com>
Co-authored-by: Claude-Code <noreply@anthropic.com>
jsboige added a commit that referenced this pull request Jul 4, 2026
…tability fixes) (#134) (#689)

The v0.9.0 entry predating bundle v3 missed the print-production and
late-cycle stability work. This refresh brings it in line with master
`21e2c666`, cross-checked against the release-validation dossier v4
(docs/RELEASE-VALIDATION-v0.9.0.md §3.3) and dashboard decisions #26-69.

Added:
- "Print Production (CMYK & Print&Play)" section: Ghostscript post-process
  (#632), `--pdf-cmyk` entry-point (#652), bundle v3 = 80 PDFs DeviceCMYK +
  SWOP OutputIntent (6.18 GB RGB -> 5.30 GB CMYK), P&P Standard/Light
  (#645/#648-650, 64 -> 80 PDFs), GS timeout 180->900s (#670)
- "OWL Ontology (Bilingual EN/FR)" section: Fallacies OWL 5.07 MB (#634
  regen), Virtues OWL (#592/#499 Phase 2), honest scope note (EN+FR only,
  not 8-lang)
- "Fixed - Pipeline Stability (Jun-Jul 2026)" section: harvest deadlock
  #651, serial retry #613/#676, logger Spectre #630/#655, CMYK oxymore,
  Johnny 6.1.3 #653, Rules i18n refonte #640, CSV hygiene #579/#581/#584,
  OWL staleness #634

Corrected (code=truth):
- Magick.NET 14.13.1 -> 14.14.0 (verified in .csproj)
- Test count 548 -> 578 pass / 1 known-fail #133 / 5 skip / 584 total
  (empirical `dotnet test` on Argumentum.AssetConverter.Tests, 2026-07-04,
  .NET 9). Previous counts in docs (548/549/570) were all stale

No existing content regressed; all prior sections preserved.

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

fix(harvest): spectre [HARVEST-FAILURE] interprété comme markup couleur → InvalidOperationException fatale (tue #614)

1 participant