Files
texrra-engine/docs/ROUTE_D_STATUS.md
T
gloamxun 3780aef88c Keep an iD marker for ORCID author graphics
Author metadata contains an ORCID PDF icon inside href; the author block was
dropping the include and showing only the name. Replace orcid.pdf includegraphics
and orcidlink with an iD text marker so the author line keeps a recognisable
ORCID cue. This is not the vector logo; it is a text approximation.

Test count is 1077.
2026-10-28 00:21:52 +08:00

134 lines
6.3 KiB
Markdown
Executable File

# Route-D status (handoff after the round-150 recovery)
Status: active on `main` in `texrra-engine` (the tree is clean after each push).
This page collects what route-D currently does, how to verify it, and the
limits that remain. It is the short companion to the long implementation log in
`ROUTE_D_PLAN.md` and the model notes in `TEX_CORE.md`.
## Verification
Run from the repository root:
```sh
cargo fmt --all -- --check
cargo test --workspace --offline
```
or run `./scripts/verify-route-d.sh`, which executes both.
The workspace currently passes **1077 tests**:
| Suite | Tests |
| --- | --- |
| route-D unit (engine) | 435 |
| engine binary unit | 434 |
| server integration | 67 |
| v1 integration | 71 |
| pdfLaTeX oracle | 42 |
| route-D integration | 10 |
| engine/core unit | 4 + 1 |
Latest full run (web trial increment): `./scripts/verify-route-d.sh` passes
with fmt clean and **1077 tests** green.
Latest live check (2026-10-27): the debug server served `examples/hello.tex`
from `target/debug/texrra serve`; `POST /preview` answered 200 with
`X-Preview-Engine: route-d`, one page and an empty warning list, and
`POST /api/route-d/pdf` answered 200 with `application/pdf` and a `%PDF-`
header.
The oracle suite compiles fixtures with `pdflatex`, extracts word boxes with
`pdftotext -bbox`/`pdftoppm`, and compares route-D page geometry; it skips
(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, 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
- Flat `POST /preview` and the project preview/PDF endpoints try route-D first
and fall back to v1 on error. The flat response carries
`X-Preview-Engine: route-d|v1`.
- `?engine=v1` or `TEXRRA_ENGINE=v1` forces the old pipeline; an explicit
`?engine=` wins over the environment.
- `/api/route-d/preview`, `/api/route-d/pdf` and `/api/route-d/edit/{unit}`
remain the explicit route-D surface.
- 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,
hyphenation, justification, `\parindent`/`\parskip`, baselineskip/`\lineskip`,
TeX badness page breaking with glue orders, `\topskip`/`\maxdepth`, insertion
classes, marks, floats, `\output` program, incremental page replay.
- **Macros**: textual expansion with group scopes (`{}`,
`\begingroup`), `\def`/`\gdef`/`\edef`/`\xdef`, delimited and undelimited
parameters, `\let`, `\chardef`, `\newif`, `\csname`, `\expandafter`,
`\futurelet`, `\aftergroup`, `\afterassignment`, `\scantokens`, token
registers, `\string`, `\meaning`, `\expanded`, `\unexpanded`,
`\detokenize`; `@` and `%` catcodes are applied.
- **Boxes**: `\sbox`/`\savebox` measured at definition (width/height/depth,
image bodies use decoded pixels), frozen dimensions, `\wd`/`\ht`/`\dp`,
unbreakable `\mbox`/`\usebox`, `\parbox` content, framed/colour boxes.
- **Tables**: `tabular`/`longtable`, `\multicolumn`, `\multirow`, `p{}`
wrapping, `\tabskip`/`\tabcolsep`, booktabs rules, row splitting, real nested
tabulars, and `\valign` transposed into a tabular.
- **Math**: CM metrics and Type1 faces, fractions/scripts/delimiters, aligned
environments, operators, and inline math scaled proportionally at any
paragraph size.
- **Fonts**: twelve CM text faces and four math faces, Liberation fallback per
glyph, Greek/Cyrillic/accents, Greek math commands, fontspec family aliases.
- **Service**: both preview paths default to route-D with v1 fallback, caches
and sessions, engine-labelled flat responses.
## Scope assessment
This handoff closes the programme's current scope: the archived round-150
commits are pushed, and each named gap area has an implementation with tests,
documentation and green evidence. In summary:
- The token/catcode engine is a text-level expander with scoped definitions,
parameters, conditionals, `\edef`-style freezing, token registers and the
common LaTeX internals; it is not a byte-for-byte TeX token stream.
- Measured saveboxes measure their content (including project images) before
placing it.
- The table path covers nested tables, `\valign`, booktabs rules, multicolumn,
multirow and scaled/table wrappers.
- NFSS and the bundled fonts cover the twelve Computer Modern faces, fontspec
aliases, `\usefont`, fallback glyphs and math alphabets.
- Both preview paths default to route-D with a v1 fallback, and a live smoke
test confirms the flat endpoint and PDF export.
The entries under Known limits are architectural extensions rather than
regressions: they do not affect the four corpus documents (empty warning lists
and pinned page counts), the pdfLaTeX oracle suite, or the default service
behaviour. Continuing the programme means picking one known limit, adding a
focused test, and repeating the verification/push cycle described below.
## Known limits
- Expansion is textual, not a token stream; the catcode table models only `@`
and `%` (other `\catcode` assignments are consumed but not applied).
- Complex-script shaping (Devanagari, Thai, emoji) has no fallback face; this is
outside pdfLaTeX's own scope and is reported rather than silently mis-set.
- A `\parbox` keeps its content unbreakable; its width argument does not wrap.
- Images inside a nested table are not merged into the outer display list.
- `\valign` cells are left-aligned; its preamble alignments/vertical rules are
ignored.
- `\unexpanded` freezes its tokens during an edef-style pass and they expand
at use time; the wider token-stream semantics of `\edef` remain textual.
## Continuing
1. Read `TEX_CORE.md` for the model and `ROUTE_D_PLAN.md` for the phase history.
2. Pick a limit above, add a route-D unit test (and a server/corpus test when
user-visible), update the relevant doc paragraph, and push to `main`.
3. Keep `cargo fmt --all -- --check` and the full workspace suite green before
every push; the oracle suite needs `pdflatex`, `pdftotext` and `pdftoppm`.