# Task H.5: PDF Mapping Audit & Visual Parity

## Files Added

- `scripts/pdf-audit-utils.ts`
- `scripts/audit-pdf-template-inventory.ts`
- `scripts/audit-pdf-mapping-coverage.ts`
- `scripts/audit-pdf-runtime-payload.ts`
- `scripts/generate-pdf-audit-report.ts`
- `docs/implementation/pdf-parity-checklist.md`
- `docs/business/pdf-mapping-registry.md`
- `docs/adr/0013-pdf-visual-parity-strategy.md`
- `docs/implementation/task-h5-pdf-mapping-audit-visual-parity.md`

## Files Modified

- `package.json`
- `scripts/seed-task-h1-fixture.js`

## Audit Coverage

- template inventory audit scans active template versions, schema field names, table fields, dynamic topic fields, duplicates, missing mappings, and orphan mappings
- mapping coverage audit compares placeholder tokens with DB mappings and table-column metadata
- runtime payload audit inspects resolved `documentData`, `templateInput`, and `pdfme.topic_inputs`
- report generator writes JSON and Markdown summary artifacts for regression review

## Fixture Strategy

- `seed-task-h1-fixture.js` now also provisions `QT-H5-AUDIT`
- the audit fixture is intended to carry richer topic/item/party coverage than the original H.1 smoke dataset

## Remaining Risks

- approved snapshot parity remains a warning when the target quotation has never generated an approved PDF artifact
- the audit suite validates business payload parity, not pixel-perfect PDF screenshots
- manual review is still needed when template designers move static labels or brand blocks

## H.5.3 Follow-up

- template JSON revisions now flow through a dedicated version-remap step instead of patching `1.0` in place
- static labels such as `tel_label`, `email_label`, `att_label`, `project_label`, and `site_label` are now runtime-mapped rather than tolerated as blank designer placeholders
- deleted fields from the previous version, notably `exclusion_data` and `exclusion_label`, are explicitly classified and removed from the active mapping set
