Skip to content

render-pipeline tests: partial-font controls stop reading the environment (8 failures -> 3) - #202

Merged
GoKubar merged 1 commit into
mainfrom
agent/linux-primary/hermetic-font-controls
Sep 13, 2026
Merged

GoKubar merged 1 commit into
mainfrom
agent/linux-primary/hermetic-font-controls

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Draft while main is frozen for the v0.1.2 release run. Merge order: this PR first, then #CI (--no-fail-fast). Merging --no-fail-fast alone shows 8 render-pipeline failures; with this in, it shows 3.

The bug: a control test that stopped being a control

Five render-pipeline tests are controls. They assert a face or a metric file is absent and that the pipeline degrades the documented way. They built their font set with FontSet::with_default_dirs / FontSet::new — both of which read FLASHTEX_FONT_DIRS / FLASHTEX_TFM_DIRS.

So when 93fb3219 widened CI's metric env to lm:ec:amsfonts — correctly; that is what fixed enumitem_keys_oracle — the controls saw the very thing they assert is missing:

test assertion what CI's env did
missing_required_metrics_are_a_blocking_diagnostic_not_a_silent_fallback assert!(fonts.required_metrics().is_err()) (metrics_provenance.rs:61) the TFMs resolved from the exported trees
mathbb_paints_from_new_computer_modern_when_bundled "… without NewCM" → LatinModernMath-Regular got NewCMMath-Regular
mathcal_sets_at_cmsy_metrics_… same same
varnothing_sets_at_msbm_width_… same same
cm_less_symbols_are_painted_from_latin_modern_math ℤℵ is one LM Math run NewCM took ℤ, so the run split

These tests were wrong, not the engine. This is the durable fix #187 named, not a narrowing of CI's env.

NewCMMath-Regular.otf ships in apps/mac/Fonts beside the Latin Modern faces, so the contaminating face cannot be excluded by dropping a directory. common::stage_faces_without stages links to the real faces in a per-test temp dir, omitting the named ones; ControlDir::font_set pairs them with explicit metric dirs through FontSet::with_dirs. The bundled half of each NewCM test adds the face back through extra, so both halves still measure exactly what they always did.

Two further non-hermetic spots fixed while here, both previously passing for a reason they did not intend: missing_required_metrics_… now names an empty metric list rather than inheriting FLASHTEX_TFM_DIRS, and a_flat_bundle_directory_… names the flat directory as its own metric directory rather than being satisfiable from the ambient texmf trees.

tests/ only — no product code is touched.

Verification

TeX Live 2025 as oracle only, never in the product path. Bundled apps/mac/Fonts, explicit FLASHTEX_TFM_DIRS = public/lm:jknappen/ec:public/amsfonts/symbols. No committed oracle data regenerated.

The point of the change is invariance, so it is measured under two environments:

env math_symbols + metrics_provenance
CI's widened metric env (lm:ec:amsfonts) 15/15 pass
pre-93fb3219 narrow env (public/lm alone) 15/15 pass

Before this PR those same tests flipped with the environment. They no longer read it.

gate result
render-pipeline full suite, --no-fail-fast 186 passing; failing set 8 → 3
remaining 3 font_family_fixtures_match_pdflatex, footnotes_against_pdflatex, page_frame_against_pdflatex — the pre-existing missing sans/slanted/caps tier, untouched by this PR
amsmath corpus 59/59 within 0.5 bp
real-world corpus HW1 3 pages, HW2 3 pages, 0 overfull, 0 errors
font diagnostics zero across all 10 corpus fixtures

Implementation-Agent: kabir-claude (linux-primary / NixOS)

…ment

Five tests are *controls*: they assert that a face or a metric file is
ABSENT and that the pipeline then degrades the documented way. They built
their font set with `FontSet::with_default_dirs` / `FontSet::new`, both of
which read `FLASHTEX_FONT_DIRS` / `FLASHTEX_TFM_DIRS`. So the moment CI
exported a real font environment (93fb321 widened it to lm:ec:amsfonts,
correctly -- it is what fixed `enumitem_keys_oracle`), the control stopped
being a control: the very thing it asserts is missing resolved, and the
test failed for a reason that has nothing to do with the engine.

  tests/metrics_provenance.rs:61  assert!(fonts.required_metrics().is_err())
  tests/math_symbols.rs           mathbb / mathcal / varnothing / cm_less_symbols
                                  ("... without NewCM": expected
                                  LatinModernMath-Regular, got NewCMMath-Regular)

`NewCMMath-Regular.otf` ships in `apps/mac/Fonts` beside the Latin Modern
faces, so the contaminating face cannot be excluded by dropping a whole
directory. `common::stage_faces_without` stages links to the real faces in
a per-test temp directory, omitting the named ones, and `ControlDir::font_set`
pairs them with explicit metric directories via `FontSet::with_dirs`. The
bundled half of each NewCM test adds the face back through `extra`, so both
halves still measure what they always did.

Two further non-hermetic spots fixed while here, both previously passing for
a reason they did not intend: `missing_required_metrics_...` now names an
empty metric list instead of inheriting `FLASHTEX_TFM_DIRS`, and
`a_flat_bundle_directory_...` names the flat directory as its own metric
directory instead of being satisfiable from the ambient texmf trees.

No product code is touched -- the diff is `tests/` only.

Evidence (TeX Live 2025 as oracle only; bundled apps/mac/Fonts; explicit
FLASHTEX_TFM_DIRS = public/lm:jknappen/ec:public/amsfonts/symbols):

- The five tests, which flipped with the environment before, are now
  identical under CI's widened metric env AND under the pre-93fb3219 narrow
  env (public/lm alone): 15/15 pass in both. That invariance is the point.
- `crates/render-pipeline` full suite with `--no-fail-fast`: 186 passing,
  failing set 8 -> 3. The remaining three (`font_family_fixtures_match_pdflatex`,
  `footnotes_against_pdflatex`, `page_frame_against_pdflatex`) are the
  pre-existing missing sans/slanted/caps tier, unchanged by this PR.
- amsmath corpus 59/59 within 0.5 bp; real-world corpus HW1 3 pages / HW2
  3 pages, 0 overfull, 0 errors; ZERO font diagnostics across all 10 fixtures.

Implementation-Agent: kabir-claude (linux-primary / NixOS)
Commit-Executor: kabir-claude (direct git, observed Cursor usage limit)

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
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