feat(tools): add the font-coverage gate (RIG-3603) - #1208
Open
rigel-mintaka wants to merge 1 commit into
Open
Conversation
T8 retires the Unifont fallback pin from the e2e font set (`tools/toolchain/chromium-e2e-env.nix`). That is only safe once nothing in `apps/ui/src` renders a character the two branded faces lack, and until now the check for that was an eyeball pass over a hand-written census. The census has been wrong twice: it classified characters as safe prose by appearance, and `⟨`/`⟩`/`⌗` turned out to be absent from Space Mono while `−` and `→`, both assumed to need conversion, turned out to be present. The gate parses the `cmap` of `SpaceMono-Regular.ttf` and `DepartureMono-Regular.otf` (format 4 and format 12, TrueType and CFF), scans `apps/ui/src` for non-ASCII characters in rendered positions, and reports the ones neither face covers. Comments are stripped line-preservingly and string- aware, so a `//` inside a literal is not mistaken for a comment and a finding's reported line number survives the strip. The covered set is Space Mono's cmap alone, not the union of both faces. `--rigel-display` (Departure Mono) is used by exactly one rule (`apps/ui/src/app.css:444`); everything else resolves `--rigel-mono`, so a character present only in the display face still falls through to the pinned fallback at a body-text site. Departure is loaded, counted and plausibility-checked — it proves the format-12 parse path — but findings clear against Space Mono. That is deliberately conservative: at the single display site the gate can over-report, never under-report, so it cannot green a site that still needs the fallback. It runs in WARN mode (reports, exits 0) because 8 characters are uncovered today; `FONT_COVERAGE_GATE=error` exits non-zero, and T8 flips the default. A gate that cannot tell a clean tree from one it never read is worse than none, so a missing or unparseable font face exits 2 in both modes rather than reporting zero findings. Registered in `.moon/workspace.yml`: moon discovers projects only from that map, and an unregistered tool never runs. Verified: 15 unit tests pass; injecting a naive line-deleting comment strip reddens 2 of them, so the line-number assertion discriminates. Against the live tree the gate reports 24 findings over 8 distinct codepoints (`▸ ■ ⟩ ⟨ ⎇ ⌗ ➜ ▪`), matching an independent cmap measurement; warn exits 0, error exits 1, a missing font exits 2, a truncated font exits 2.
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
rigel-mintaka
marked this pull request as ready for review
September 13, 2026 20:10
|
Compass engineering docs preview: https://compass-ux-3603-font-coverag.compass-eng-docs.pages.dev Deployed from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
T8 retires the Unifont fallback pin from the e2e font set
(
tools/toolchain/chromium-e2e-env.nix). That is only safe once nothing inapps/ui/srcrenders a character the two branded faces lack, and until now thecheck for that was an eyeball pass over a hand-written census. The census has
been wrong twice: it classified characters as safe prose by appearance, and
⟨/⟩/⌗turned out to be absent from Space Mono while−and→, bothassumed to need conversion, turned out to be present.
The gate parses the
cmapofSpaceMono-Regular.ttfandDepartureMono-Regular.otf(format 4 and format 12, TrueType and CFF), scansapps/ui/srcfor non-ASCII characters in rendered positions, and reports theones neither face covers. Comments are stripped line-preservingly and string-
aware, so a
//inside a literal is not mistaken for a comment and a finding'sreported line number survives the strip.
The covered set is Space Mono's cmap alone, not the union of both faces.
--rigel-display(Departure Mono) is used by exactly one rule(
apps/ui/src/app.css:444); everything else resolves--rigel-mono, so acharacter present only in the display face still falls through to the pinned
fallback at a body-text site. Departure is loaded, counted and
plausibility-checked — it proves the format-12 parse path — but findings clear
against Space Mono. That is deliberately conservative: at the single display
site the gate can over-report, never under-report, so it cannot green a site
that still needs the fallback.
It runs in WARN mode (reports, exits 0) because 8 characters are uncovered
today;
FONT_COVERAGE_GATE=errorexits non-zero, and T8 flips the default. Agate that cannot tell a clean tree from one it never read is worse than none, so
a missing or unparseable font face exits 2 in both modes rather than reporting
zero findings.
Registered in
.moon/workspace.yml: moon discovers projects only from that map,and an unregistered tool never runs.
Verified: 15 unit tests pass; injecting a naive line-deleting comment strip
reddens 2 of them, so the line-number assertion discriminates. Against the live
tree the gate reports 24 findings over 8 distinct codepoints (
▸ ■ ⟩ ⟨ ⎇ ⌗ ➜ ▪),matching an independent cmap measurement; warn exits 0, error exits 1, a missing
font exits 2, a truncated font exits 2.