Repository navigation
Viewer
Role. report.html: one self-contained file that shows the results, works offline from file://, and loads nothing from the network. Module viewer, package internal/viewer.
-
In: a
Summary, and the screenshots, referenced by their relative paths in the bundle (never inlined: bundles reach hundreds of MB). -
Out:
<bundle>/report.html, written atomically (Write).omnisnap report <bundle>re-renders it fromsummary.json.
Render fills template.html with three embedded files: style.css, the summary as a JSON data island, and app.js. encoding/json escapes <, > and &, so no page text can close the script tag, and app.js inserts every string with textContent; links are only made from http(s) URLs, so a page URL can never become a javascript: link. There is no framework: plain ES2020. Elements are built with its h helper, which skips null children; the native append does not (it would print null), so nothing that can be null is passed to it directly.
What app.js draws:
- The summary table: pages × engines (and hosts, for a merged bundle), with status, Report and Info counts, match rate and warnings.
- Per result: two panes, baseline and engine, with synced proportional scrolling (a programmatic scroll marks its pane, so the partner does not echo it back); a numbered box on both screenshots for every cause; clicking a cause highlights it and scrolls both panes to it.
-
The causes: Report first, then Info collapsed in a
<details>; per cause the title, ×count (with its other instances), consequence chips, selector, delta, the KB explanation and fix, the evidence (mechanism and its verified fix, consensus, perception events, ink against the noise floor, intent), and the score. - Dynamic regions shaded on both panes; warnings above the panes; the design-intent list; the DOM-audit findings of both captures.
-
Merged bundles: a host selector that filters the table and the results; its choice is kept in
localStorage, so#rNanchors keep working. -
Theme: light and dark follow
prefers-color-scheme, with a toggle. -
Keyboard:
jandk(and Home and End) move between result sections; Enter or Space on a cause selects it.
-
viewer_test.go: the data island is escaped, XSS markers render as text, the report is self-contained (no external URL), no inline event handlers, audit findings rendered, a 50-page report's size and speed, a merged report's host selector and groups. -
render_browsers_test.go(browserstag), in Chrome: the report renders with no stray text over the screenshots or under the summary, clicking a cause scrolls both panes, the host filter works, a 50-page report stays fast. Fixtures intestdata/viewer.
-
The viewer does not read
findings.json.SPEC-bundle-schema.mdsays the per-pagefindings.jsonholds the full evidence "which the viewer reads". The viewer renders only the summary's data island, with the compact evidence;findings.jsonis written for other consumers and is not loaded (a page opened fromfile://could not fetch it anyway). -
Keyboard keys. The spec names ↑/↓ and Enter for moving between causes; the code uses
j/k, Home and End between result sections, and Enter or Space on a focused cause.
-
internal/viewer/viewer.go:RenderandWrite
This wiki is published from docs/internals/ on main. Edits made here are overwritten on the next publish: change the pages there, in a pull request. The specs are normative; where a page and a spec disagree, the page says what the code does.
Start
Contracts
Capture side
Analysis side
Output
Quality