Add route-D web contract and experiment matrix
Route-D preview JSON now reports durationMs on the flat, project and edit paths, and project preview/PDF responses carry X-Preview-Engine (route-d or v1), including cache hits and silent fallback. The server tests assert the headers, the duration field and both PDF engines. docs/WEB_ROUTE_D_EXPERIMENT.md records the audit verdict, the initial contract probe, the supported/gap matrix, the three-project trial plan and the prioritised backlog; ROUTE_D_STATUS.md links to it and the test counts move to 1063.
This commit is contained in:
1 parent
c49afbdecb
commit
1058122388
7 files changed
+190
-20
No files matched your search
@@ -51,7 +51,7 @@ floats (`\floatsep`, `\textfloatsep`, `\intextsep`, `\topfraction`,
|
||||
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`; flat `/preview` and project previews now
|
||||
prefer route-D with a v1 fallback). 1062 workspace tests are green and no oracle
|
||||
prefer route-D with a v1 fallback). 1063 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.
|
||||
|
||||
@@ -16,13 +16,13 @@ cargo test --workspace --offline
|
||||
|
||||
or run `./scripts/verify-route-d.sh`, which executes both.
|
||||
|
||||
The workspace currently passes **1062 tests**:
|
||||
The workspace currently passes **1063 tests**:
|
||||
|
||||
| Suite | Tests |
|
||||
| --- | --- |
|
||||
| route-D unit (engine) | 442 |
|
||||
| engine binary unit | 429 |
|
||||
| server integration | 63 |
|
||||
| server integration | 64 |
|
||||
| v1 integration | 71 |
|
||||
| pdfLaTeX oracle | 42 |
|
||||
| route-D integration | 10 |
|
||||
@@ -58,6 +58,9 @@ documents reports 0 warnings and under 1.5 s per preview.
|
||||
- Geometry-less documents default to Letter (pdfLaTeX's default), not the old
|
||||
v1 A4 default.
|
||||
|
||||
The web experiment matrix, contract findings and trial plan live in
|
||||
`docs/WEB_ROUTE_D_EXPERIMENT.md`.
|
||||
|
||||
## Implemented areas
|
||||
|
||||
- **Paragraphs/pages**: Knuth-Plass breaking with prefix-sum candidates,
|
||||
|
||||
+2
-2
@@ -370,7 +370,7 @@ Math coverage includes fractions/roots, scripts, `\left...\right` with body-scal
|
||||
|
||||
Paragraph units carry a `ParagraphFont`; `Unit::paragraph_with_face` and `Unit::paragraph_with_style_and_face` select Roman, bold, italic, mono, or sans. The corresponding Computer Modern TFM (`cmr10`, `cmbx10`, `cmti10`, `cmbxti10`, `cmtt10`, `cmss10`, `cmssbx10`, `cmssi10`, `cmcsc10`) supplies advances, kerns, ligatures, and italic correction for layout, the display list selects the matching face, and the PDF writes Computer Modern Type1 outlines for each built-in face (`cmr10`/`cmbx10`/`cmti10`/`cmbxti10`/`cmtt10`/`cmss10`/`cmssbx10`/`cmssi10`/`cmcsc10`, plus `cmmi10` for mathematical italic letters, `cmsy10` for math symbols and `cmex10` for big operators), falling back to Liberation subsets only for characters the Type1 encodings cannot address; those fallback glyphs keep their Unicode text under PDF extraction, so accented and Greek words round-trip; Type1 faces carry a ToUnicode CMap built from the requested characters, so glyphs whose names are ambiguous in the Adobe Glyph List (capital Omega, which would otherwise extract as U+2126) keep their intended code points. `Engine::edit` preserves the face when reflowing an edited paragraph.
|
||||
|
||||
The crate currently has 437 unit tests plus ten route-D integration tests and forty-two oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 1062 tests (442 route-D unit, 429 engine binary unit, 10 route-D integration, 42 oracle, 71 v1 integration, 63 server, 4 engine unit, 1 core unit), with none ignored. The flat `/preview` endpoint and the project preview/PDF endpoints now try route-D first and fall back to v1 on error (`?engine=v1` or `TEXRRA_ENGINE=v1` forces v1; the flat response carries `X-Preview-Engine`, naming the engine used). A geometry-less project now defaults to Letter, matching pdfLaTeX, where the old v1 path used A4.
|
||||
The crate currently has 437 unit tests plus ten route-D integration tests and forty-two oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 1063 tests (442 route-D unit, 429 engine binary unit, 10 route-D integration, 42 oracle, 71 v1 integration, 64 server, 4 engine unit, 1 core unit), with none ignored. The flat `/preview` endpoint and the project preview/PDF endpoints now try route-D first and fall back to v1 on error (`?engine=v1` or `TEXRRA_ENGINE=v1` forces v1; the flat response carries `X-Preview-Engine`, naming the engine used). A geometry-less project now defaults to Letter, matching pdfLaTeX, where the old v1 path used A4.
|
||||
|
||||
### M0 incremental demo
|
||||
|
||||
@@ -524,7 +524,7 @@ deliberately open rather than approximated:
|
||||
|
||||
## Limits and remaining gaps
|
||||
|
||||
The suite currently stands at 1062 passing tests, with the workspace clean.
|
||||
The suite currently stands at 1063 passing tests, with the workspace clean.
|
||||
Route-D serves both flat `/preview` and project preview/PDF requests by default
|
||||
(automatic v1 fallback; `?engine=v1` or `TEXRRA_ENGINE=v1` opts out). The
|
||||
objective's areas are implemented to the limits below; complex-script shaping is
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
# Route-D web experiment
|
||||
|
||||
Status: contract fixes landed, curated trial pending.
|
||||
Baseline: engine `c49afbd`, web `24c9593`; 2026-10-27.
|
||||
|
||||
## Verdict
|
||||
|
||||
Route-D is ready for a **controlled web experiment** on the supported article
|
||||
subset, not for silently replacing v1 on arbitrary projects. The core typesetter
|
||||
passes its workspace suite, corpus and pdfLaTeX oracle evidence; the project/web
|
||||
contract needed the fixes recorded below. Real-paper gaps are listed with
|
||||
priorities at the end.
|
||||
|
||||
## Initial contract probe (before the fixes)
|
||||
|
||||
`texrra serve` with a real project and:
|
||||
|
||||
- `POST /api/projects/{id}/preview?engine=route-d`
|
||||
- 200, `status: ok`, one page, empty `warnings`
|
||||
- **no `durationMs`**
|
||||
- **no `X-Preview-Engine`**
|
||||
- Preview without an engine query: same route-D response, same missing fields.
|
||||
- `?engine=v1`: 200, has `durationMs`, **no `X-Preview-Engine`**.
|
||||
- Route-D PDF: 200 `application/pdf`, **no `X-Preview-Engine`**.
|
||||
|
||||
Web `app.js` assumed `durationMs` on every successful preview, so route-D
|
||||
previews reached the status line with `undefined`. The engine toggle also
|
||||
assumed the server default was v1: its "v1" state sent no query parameter, which
|
||||
now means route-D.
|
||||
|
||||
## Contract changes in this increment
|
||||
|
||||
- Route-D preview JSON now carries `durationMs` (flat, project and edit paths).
|
||||
- Project preview/PDF responses carry `X-Preview-Engine: route-d|v1`, including
|
||||
cache hits and silent fallback to v1.
|
||||
- The web engine state is an explicit `route-d | v1` value, defaulting to
|
||||
route-d, with migration from the old boolean localStorage key.
|
||||
- Both preview and PDF always send an explicit `?engine=...` query.
|
||||
- The web status line tolerates a missing duration, shows the warning count and
|
||||
engine fallback, and exposes warning details in the status tooltip.
|
||||
- PDF export notices when the response came from a fallback engine.
|
||||
|
||||
## Feature matrix for web projects
|
||||
|
||||
| Area | Route-D | Evidence / impact |
|
||||
| --- | --- | --- |
|
||||
| Article/report basics: title, sections, lists, TOC, page numbers | Supported | corpus and 1063-test suite |
|
||||
| Inline/display math, equations, tags, cleveref | Supported | math tests, oracle fixtures |
|
||||
| Floats, captions, tables, booktabs | Supported | table/math tests, corpus |
|
||||
| PNG/JPEG/BMP `\includegraphics` | Supported | project image tests |
|
||||
| PDF/SVG/EPS figures | **Not supported** | undecodable images become placeholder rules |
|
||||
| Inline `thebibliography` + `\cite` | Supported | citation tests |
|
||||
| `.bib` + BibTeX/biblatex data | **Not supported** | `\bibliography` is consumed without running BibTeX; unknown keys print `[?]` |
|
||||
| Local `.cls`/`.sty`/`\input` | Supported | project class/package tests |
|
||||
| Arbitrary package code, TikZ/pgf | **Not supported** | text/class subset only |
|
||||
| Two-column / `multicols` | Flattened | wrappers consumed; no column layout |
|
||||
| fontspec/system fonts | Partial | family names map to the bundled CM/Liberation faces; external fonts not loaded |
|
||||
| Complex scripts | **Not supported** | no shaping fallback; outside pdfLaTeX's own scope |
|
||||
| Footnotes, marks, running heads | Partial | marks are document-level, not per-page |
|
||||
| `\parbox` wrapping | Partial | width argument does not wrap |
|
||||
| Nested-table images, `\valign` alignments | Not supported/partial | documented engine limits |
|
||||
| Token stream/catcodes beyond `@`/`%` | Partial | textual expander, not a TeX token stream |
|
||||
|
||||
## Curated trial (next)
|
||||
|
||||
1. `article-basic`: title, sections, PNG figure, table, math, references,
|
||||
inline bibliography.
|
||||
2. `arxiv-template`: the checked-in `fixtures/arxiv-template` with local
|
||||
class/style/input files, images and inline bibliography.
|
||||
3. `unicode-mixed`: accents, Greek math, colors, TOC + footnotes.
|
||||
|
||||
For each project record page count, warnings, preview/PDF duration, PDF magic
|
||||
and any fallback. Any project that needs `.bib`, vector figures or arbitrary
|
||||
packages must be marked as a v1 fallback case, not a silent failure.
|
||||
|
||||
## Backlog after the trial
|
||||
|
||||
- **P0**: `.bib`/BibTeX citation data; PDF/vector figure support; capability and
|
||||
warning UI; project-level trial coverage.
|
||||
- **P1**: two-column/multicols layout; fontspec/system-font loading; common
|
||||
TikZ/package execution; longtable page splitting.
|
||||
- **P2**: full catcode/token stream; nested-table images; per-page marks;
|
||||
`\parbox` wrapping; `\valign` alignments; complex-script shaping.
|
||||
|
||||
## Verification
|
||||
|
||||
```sh
|
||||
./scripts/verify-route-d.sh
|
||||
```
|
||||
|
||||
The contract tests are in `tests/server.rs`: project previews must report
|
||||
route-d/v1 and `durationMs`, and route-D/v1 PDFs must carry the engine header.
|
||||
|
||||
Post-fix live probe of the same project: route-D preview returned 200 with
|
||||
`X-Preview-Engine: route-d`, `durationMs: 28.874`, one page and empty warnings;
|
||||
`?engine=v1` returned `X-Preview-Engine: v1` and `durationMs: 824.35`; the
|
||||
route-D PDF returned `X-Preview-Engine: route-d` and `%PDF-`.
|
||||
Reference in new issue
Block a user