Make route-D the default flat preview engine

POST /preview served the v1 pipeline while route-D lived behind /api/route-d
and the project engine switch. Try route_d::preview_json first and keep the v1
compiler as the fallback when route-D rejects the source; ?engine=v1 forces the
old path and the project endpoints are unchanged.

Both paths now answer with an X-Preview-Engine header (route-d or v1) so the
choice is observable, and the server test helper compares header names
case-insensitively because tiny-http lowercases them.

A server test posts a document and checks route-d by default plus v1 when the
query asks for it.
This commit is contained in:
gloamxun committed 2026-10-27 00:27:59 +08:00
1 parent 621a8abb92
commit a56d441513
4 files changed
+59 -11

No files matched your search

+5 -3
View File
@@ -48,7 +48,8 @@ floats (`\floatsep`, `\textfloatsep`, `\intextsep`, `\topfraction`,
`\bottomnumber`, `\totalnumber`), insertion classes (`\skip`, fraction and
absolute limits, splitting), marks, Rust output hook, multi-page PDF, and the
route-D service endpoints (`/api/route-d/preview|pdf|edit`, project preview and
PDF opt-in with `?engine=route-d`). 992 workspace tests are green and no oracle
PDF opt-in with `?engine=route-d`; flat `/preview` now prefers route-D with a v1
fallback). 993 workspace tests are green and no oracle
fixture is ignored. Preview JSON also carries a `warnings` array naming
environments route-D cannot lay out and control words that survived layout, so
unsupported source is reported instead of being silently typeset.
@@ -491,8 +492,9 @@ Each goal keeps `cargo fmt`, `cargo test`, `cargo build --release` green, update
## Handoff (round 150/150)
Route-D currently passes **928** workspace tests and is pushed at `b191f7d`.
The default service path is still v1; route-D is selected with `?engine=route-d`
or `TEXRRA_ENGINE=route-d`. To continue the programme:
The flat `/preview` endpoint now tries route-D first and falls back to v1 (pass
`?engine=v1` to force v1); project previews still select route-D with
`?engine=route-d` or `TEXRRA_ENGINE=route-d`. To continue the programme:
1. Run `cargo fmt --all -- --check` and `cargo test --workspace --offline`
from `engine/` before every change; pdfLaTeX oracles skip automatically when