M8: zoom previews: scan system fonts before the zoom-preview tests render (#2230)

pans_and_edits_get_no_preview_and_build_on_the_kept_image failed in full lib runs with "a pan after a previewed zoom renders strips only: Full". The render kept from the zoom is stale once the global font generation changes (retained.rs prepare: last.fonts == layout_generation()), and the once-per-process system font scan that many other tests start bumps it (fontdb.rs scan_system_fonts -> clear_layout_cache). When that scan landed between the test's zoom and its pan, the pan redrew in full instead of patching. Unrelated to the clock or the threshold. document() now runs scan_system_fonts() first (a concurrent caller waits for the scan), so the generation is settled before any render. Test-only change; the shipped staleness check is intended behaviour.

Stress, full lib binary with 16 test threads: 3 of 6 runs failed before, 0 of 25 after.


Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Trevor BrownandClaude Sonnet 5.5 authored and GitHub committed 2026-11-11 15:02:45 +01:00
1 parent 0f08269067
commit 401f449729
1 file changed
+5 -1
@@ -23,8 +23,12 @@ use crate::render_worker::{
Done, Inline, Job, PREVIEW_AFTER_MS, PREVIEW_FACTOR, Refined, Renders, SETTLE_MS, Worker, better, coarse_view, preview_with, render_now,
};
/// A page of ellipses with a rectangle on top; the session and the rectangle.
/// A page of ellipses with a rectangle on top; the session and the rectangle. The system fonts are
/// scanned first (once per process, and a concurrent caller waits for it): the scan another test
/// starts bumps the global font generation, and a render kept from before it is stale, so a pan
/// or an edit meanwhile would redraw in full instead of patching.
fn document() -> (Session, NodeId) {
figcraft_text::scan_system_fonts();
let mut s = Session::new();
for k in 0..12 {
let k = f64::from(k);