Skip to content

feat(font-system): attach docfonts verdict evidence to font reports#3672

Merged
caio-pizzol merged 1 commit into
mainfrom
caio-pizzol/verdict-aware-reporting
Jun 6, 2026
Merged

feat(font-system): attach docfonts verdict evidence to font reports#3672
caio-pizzol merged 1 commit into
mainfrom
caio-pizzol/verdict-aware-reporting

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

A font report row's reason (bundled_substitute / category_fallback) tells you SuperDoc substituted, not how faithful the substitute is - so a consumer can't tell Calibri -> Carlito (metric_safe, a clean clone) from Cambria -> Caladea (visual_only, qualified by the Bold Italic grave accent). This adds the docfonts verdict to the report so that distinction is visible.

New optional evidence field on FontResolutionRecord, populated ONLY when SuperDoc actually rendered the recommended substitute (bundled_substitute / category_fallback):

  • evidenceId, policyAction, verdict, lineBreakSafe, and glyphExceptions.
  • Family report (buildFontReport): the row's top-level worst-face verdict and all glyph exceptions.
  • Face report (buildFaceReport): the per-face verdict (faceVerdicts[slot] ?? verdict) and only that slot's glyph exceptions - Cambria Regular reads metric_safe with no Bold-Italic exception; Bold Italic reads visual_only and carries it.
  • Sourced from the local SUBSTITUTION_EVIDENCE; local types only, so @docfonts/fallbacks never leaks into the emitted .d.ts (the discipline substitution-evidence.ts already documents).

Additive and behavior-preserving: reason / missing / loadStatus are unchanged. Per the agreed scope, only rendered substitutes get evidence - as_requested / custom_mapping / registered_face / fallback_face_absent carry none (an advisory/recommendation surface is a separate future field, since this one can't say "docfonts recommends X but it didn't render").

Review: check report.ts evidence sourcing + the face-slot filtering; the new tests in report.test.ts pin Calibri (metric_safe), Calibri Light (category_fallback/visual_only), Cambria family (visual_only + exceptions), Cambria Regular (metric_safe, no stray exception), Cambria Bold Italic (visual_only + its exception), and no-evidence for the four non-substitute reasons. Per repo rule I did not run the suite locally - CI is the gate; I checked that no other test asserts full substitute report rows (resolver tests assert resolver output, the integration tests assert names/config).

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 21856fa785

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread shared/font-system/src/report.ts Outdated
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

A report row's reason (bundled_substitute / category_fallback) says SuperDoc
substituted, not how faithful it is - so a consumer can't tell Calibri ->
Carlito (metric_safe) from Cambria -> Caladea (visual_only). Add an optional
evidence field, present ONLY when SuperDoc rendered the recommended substitute.

The projection is docfonts': bump @docfonts/fallbacks to 0.4.0 and read it off
the resolved fallback instead of re-deriving locally:

- buildFontReport copies it from getRenderableFallback (top-level verdict, all
  glyph exceptions).
- buildFaceReport copies it from getRenderableFallbackForFace (per-face verdict,
  only that face's exceptions) - so Cambria Regular reads metric_safe with no
  Bold-Italic exception, Bold Italic reads visual_only and carries it.
- Fields copied into SuperDoc's LOCAL ResolvedFontEvidence (evidenceId,
  policyAction, verdict, lineBreakSafe, glyphExceptions), so @docfonts/fallbacks
  never leaks into the emitted .d.ts.

Additive and behavior-preserving: reason / missing / loadStatus unchanged;
as_requested / custom_mapping / registered_face / fallback_face_absent carry no
evidence.
@caio-pizzol caio-pizzol force-pushed the caio-pizzol/verdict-aware-reporting branch from 21856fa to e101be3 Compare June 6, 2026 01:57
@caio-pizzol caio-pizzol merged commit 8ade7db into main Jun 6, 2026
66 checks passed
@caio-pizzol caio-pizzol deleted the caio-pizzol/verdict-aware-reporting branch June 6, 2026 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants