# HTML Quality Probe

These checks are diagnostic and non-gating. A `needs-review` status means the generated artifacts found a likely conversion-quality issue, not that artifact generation failed.

- Status: `needs-review`
- Source PDF: [../source.pdf](../source.pdf)
- Generated HTML: [../semantic-continuous/index.html](../semantic-continuous/index.html)
- Sample notes: Employment eligibility form with structured fields, embedded images, vector line work, and links. Categories: government-form, forms, vector-heavy, links. Canonical source: https://www.uscis.gov/i-9
- Text reference: `pdfbox-net-run-fallback`
- Pages analyzed: 4

## Page Summary

| Page | Status | Source words | HTML words | Token coverage | Long HTML tokens | Foreground delta | Severe color delta | Text/object overlaps |
| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| 1 | `needs-review` | 638 | 964 | 0.995 | 0 | 0.02 | 0.24 | 33 |
| 2 | `needs-review` | 691 | 648 | 0.933 | 0 | 0.069 | 1 | 0 |
| 3 | `needs-review` | 391 | 711 | 0.992 | 0 | 0.076 | 0.018 | 36 |
| 4 | `needs-review` | 626 | 783 | 0.994 | 0 | 0.028 | 0.241 | 88 |

## Issue Categories

| Category | Status | Evidence |
| --- | --- | --- |
| Text reconstruction and word boundaries | `needs-review` | 3 page(s) need review; worst token coverage is 0.933 on page 2, with 0 high-confidence adjacent-word join(s). |
| Page geometry and text-run structure | `needs-review` | 0 page dimension check(s) and 1 text-run count check(s) need review; max run-count delta is 178. |
| Text wrapping around images and vector objects | `needs-review` | 0 text/image overlap(s) and 157 text/vector overlap(s) were found. |
| Visual foreground parity | `needs-review` | Max foreground delta is 0.076; max source-only foreground ratio is 0.342; max HTML-only foreground ratio is 0.255. |
| Visual color parity | `needs-review` | Max mean CIE Lab color delta is 30.271; max severe color-delta ratio is 1; minimum compared page-pixel ratio is 0. |
| Source fixture expectations (manual review) | `needs-review` | Captured 2 source-authored acceptance statement(s) across 2 page(s); compare them with the visual evidence before treating the fixture as passed. |
| Probe setup and tool availability | `passed` | The browser probe and available renderers ran. |

## Fixture Expectations

These source-authored statements describe the intended appearance and make the corresponding visual diffs easier to interpret.

- Page 2:
  - All documents containing an expiration date must be unexpired.
- Page 3:
  - Instructions: This supplement must be completed by any preparer and/or translator who assists an employee in completing Section 1

## Current Limitations

- Text reconstruction did not preserve all word boundaries or reading order on the affected page(s).
- Continuous semantic HTML is evaluated as reflowed content; it may not preserve the original PDF page height, per-glyph run count, or exact page-local geometry.
- Large vector overlays are not semantically attached to nearby content; review whether these are decorative backgrounds, table rules, clipping masks, or true text/object collisions.
- The visual probe compared at least one page using only the overlapping crop because renderer/browser pixel dimensions differed beyond the probe tolerance.
- Perceptual color differences exceed the severe-corruption threshold on at least one page; inspect the color heatmap for incorrect fills, opacity, blending, or color-space conversion.
- The HTML contains additional foreground pixels compared with the PDF render on at least one page, which often means duplicated glyphs, fallback text, or unmodeled object masks.

## Findings

- Page 1, `text-run-count`: The browser DOM contains 132 text runs, but the extracted layout contains 140.
- Page 1, `word-boundaries`: Rendered HTML text appears to have lost word boundaries or token coverage.
- Page 1, `text-vector-overlap`: 33 text run(s) overlap large rendered vector boxes.
- Page 1, `visual-color-difference`: PDF and browser colors differ severely across a material share of stable foreground interiors.
- Page 2, `visual-foreground-mask`: PDF render and browser page screenshot have different pixel dimensions; foreground masks were compared across the overlapping region only.
- Page 2, `visual-color-difference`: PDF render and browser page screenshot have different pixel dimensions; color was compared across stable foreground interiors in the overlapping region only.
- Page 3, `word-boundaries`: Rendered HTML text appears to have lost word boundaries or token coverage.
- Page 3, `text-vector-overlap`: 36 text run(s) overlap large rendered vector boxes.
- Page 4, `word-boundaries`: Rendered HTML text appears to have lost word boundaries or token coverage.
- Page 4, `text-vector-overlap`: 88 text run(s) overlap large rendered vector boxes.
- Page 4, `visual-color-difference`: PDF and browser colors differ severely across a material share of stable foreground interiors.

## Artifacts

- [page-1-html.png](page-1-html.png)
- [page-1-source.png](page-1-source.png)
- [page-1-diff.png](page-1-diff.png)
- [page-1-color-heatmap.png](page-1-color-heatmap.png)
- [page-1-visual-report.html](page-1-visual-report.html)
- [page-2-html.png](page-2-html.png)
- [page-2-source.png](page-2-source.png)
- [page-2-diff.png](page-2-diff.png)
- [page-2-color-heatmap.png](page-2-color-heatmap.png)
- [page-2-visual-report.html](page-2-visual-report.html)
- [page-3-html.png](page-3-html.png)
- [page-3-source.png](page-3-source.png)
- [page-3-diff.png](page-3-diff.png)
- [page-3-color-heatmap.png](page-3-color-heatmap.png)
- [page-3-visual-report.html](page-3-visual-report.html)
- [page-4-html.png](page-4-html.png)
- [page-4-source.png](page-4-source.png)
- [page-4-diff.png](page-4-diff.png)
- [page-4-color-heatmap.png](page-4-color-heatmap.png)
- [page-4-visual-report.html](page-4-visual-report.html)
