Skip to content

feat(tools): add the font-coverage gate (RIG-3603) - #1208

Open
rigel-mintaka wants to merge 1 commit into
mainfrom
compass-ux/3603-font-coverage-gate
Open

feat(tools): add the font-coverage gate (RIG-3603)#1208
rigel-mintaka wants to merge 1 commit into
mainfrom
compass-ux/3603-font-coverage-gate

Conversation

@rigel-mintaka

Copy link
Copy Markdown
Contributor

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.

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

linear-code Bot commented Sep 13, 2026

Copy link
Copy Markdown

RIG-3603

@trunk-io

trunk-io Bot commented Sep 13, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

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
rigel-mintaka marked this pull request as ready for review September 13, 2026 20:10
@github-actions

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-ux-3603-font-coverag.compass-eng-docs.pages.dev

Deployed from compass-ux/3603-font-coverage-gate at bb59651.

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.

1 participant