Exploring the idea of generated web rendering engine.
genera docs dump-format.md
28 kB · 545 lines
Markdown
at main

# Dump format The contract between the oracle service, the comparator, and eventually the engine under test. Frozen: changing it requires changing every consumer at once. What the comparison means, explained from zero, is in `docs/geometry-verification.md`. ```mermaid flowchart LR req["request line<br/>(stdin, JSON)"] --> op{"op"} op -- "none: geometry" --> dump["Dump per engine<br/>rects, style, scroll"] op -- "trace" --> trace["Trace per engine<br/>recorded JS observations"] op -- "reflect" --> refl["Reflection dump<br/>attribute + IDL values"] op -- "stackingProbe" --> stack["ids at points,<br/>front to back"] dump --> vote["compare.rs vote<br/>1/60 px tolerance"] trace --> tvote["trace::vote"] refl --> rvote["reflect::vote<br/>exact"] stack --> svote["vote_stacking<br/>exact, unanimous only"] ``` ## Oracle protocol The oracle is a long-lived process speaking newline-delimited JSON on stdio. One JSON object per line in each direction, no pretty-printing, no interleaved text on stdout. Diagnostics go to stderr. Browsers stay open for the process lifetime. Nothing spawns a browser per case. ### Request ```json {"id": "case-0001", "html": "<!doctype html>...", "engines": ["chromium", "firefox", "webkit"]} ``` `engines` is optional; omitted means every engine the service launched. `script` is optional JavaScript run after `html` loads and before the dump walk (`docs/feature-cost-experiment.md`), so DOM tree-mutation ground truth is an ordinary dump. ```json {"id": "case-0002", "html": "<div id=a><span id=b></span></div>", "script": "document.getElementById('a').appendChild(document.createElement('b'));"} ``` ### Response ```json {"id": "case-0001", "dumps": {"chromium": {...}, "firefox": {...}}, "errors": {"webkit": "message"}} ``` `dumps` holds one dump per engine that succeeded. `errors` holds a message per engine that failed, and is omitted when empty. A response always carries the `id` it answers. ### Control `{"id": "...", "op": "ping"}` responds `{"id": "...", "ok": true, "eng…