Pin the corpus page counts

The corpus guard only checked that each document produced at least one page.
It now asserts the exact counts (hello 1, boxes 1, compat 1, arXiv template 2)
alongside the empty warnings array, so a layout regression that drops or adds a
page fails the server test even when no warning is emitted.

The status document's verification paragraph mentions the exact-count check.
This commit is contained in:
gloamxun committed 2026-10-27 03:02:30 +08:00
1 parent 7fbcb326d5
commit e8f7e37cf7
2 files changed
+14 -6

No files matched your search

+3 -3
View File
@@ -31,9 +31,9 @@ The oracle suite compiles fixtures with `pdflatex`, extracts word boxes with
(saying so) when the TeX tools are absent. The server suite includes
`corpus_documents_preview_without_warnings`, which previews
`examples/hello.tex`, `examples/boxes.tex`, `examples/compat.tex` and
`fixtures/arxiv-template/template.tex` and asserts 200, at least one page and an
empty `warnings` array for each. A manual sweep of the same four documents
reports 0 warnings, 1/1/1/2 pages and under 1.5 s per preview.
`fixtures/arxiv-template/template.tex` and asserts 200, the expected page count
(1/1/1/2) and an empty `warnings` array for each. A manual sweep of the same four
documents reports 0 warnings and under 1.5 s per preview.
## Service defaults
+11 -3
View File
@@ -2366,9 +2366,17 @@ fn corpus_documents_preview_without_warnings() {
let value: Value = serde_json::from_slice(&response.body).expect("preview JSON");
let warnings = value["warnings"].as_array().cloned().unwrap_or_default();
assert!(warnings.is_empty(), "{relative}: {warnings:?}");
assert!(
value["pageCount"].as_u64().unwrap_or(0) >= 1,
"{relative}: no pages"
let expected_pages = match relative {
"examples/hello.tex" => 1,
"examples/boxes.tex" => 1,
"examples/compat.tex" => 1,
"fixtures/arxiv-template/template.tex" => 2,
other => panic!("unexpected corpus document {other}"),
};
assert_eq!(
value["pageCount"].as_u64(),
Some(expected_pages),
"{relative}: wrong page count"
);
}
}