99 lines
4.8 KiB
Markdown
99 lines
4.8 KiB
Markdown
# Route-D web experiment
|
|
|
|
Status: contract fixes landed (engine `1058122` + `2194341`, web `cecad51`),
|
|
curated trial pending.
|
|
Audit 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-`.
|