Skip to content

da_build: check PDF templates for PDF/UA-1 accessibility - #95

Open
nonprofittechy wants to merge 6 commits into
mainfrom
da-build-check-pdf-templates
Open

da_build: check PDF templates for PDF/UA-1 accessibility#95
nonprofittechy wants to merge 6 commits into
mainfrom
da-build-check-pdf-templates

Conversation

@nonprofittechy

Copy link
Copy Markdown
Member

Runs veraPDF over the PDF templates users receive and reports failures as GitHub annotations plus a job summary, with per-rule severity classification so metadata-only findings do not read like real blockers.

Input, matching the DOCX one exactly

pdf-validation-mode: off | warning | error   # default: warning
pdf-strict:          true | false            # default: false

pdf-strict keeps tab-order and form-annotation rules off by default, since AL forms are usually flattened before users see them.

Naming the format rather than the tool (pdf- not verapdf-) keeps the input stable if veraPDF is ever swapped out, and makes it read the same as docx-validation-mode in #94.

Scoped to templates

Only docassemble/*/data/templates is scanned. An earlier rglob over the whole repository swept in PDFs that are not output documents — reference material in data/static, ALKiln fixtures in data/sources, and other packages' templates from a local .venv — and reported them as this repo's failures. Over the local AL checkouts that narrows the scanned set from 272 PDFs to 96.

Note on history

This supersedes add-pac-to-build, which was 24 commits behind and predated the uv migration — merging it would have reverted uv and the env-var input handling that fixed the command-injection issue. Rebuilt on current main.

Runs veraPDF over the PDF templates users receive and reports failures as
GitHub annotations plus a job summary, with per-rule severity classification
so metadata-only findings do not read like real blockers.

pdf-validation-mode: off|warning|error mirrors docx-validation-mode exactly.
It defaults to warning, so adopting the check annotates a build rather than
breaking it. pdf-strict keeps tab-order and form-annotation rules off by
default, since AL forms are usually flattened before users see them.

Only docassemble/*/data/templates is scanned. An earlier rglob over the whole
repository swept in PDFs that are not output documents -- reference material
in data/static, ALKiln fixtures in data/sources, and other packages'
templates from a local .venv -- and reported them as this repo's failures.
Over the local AL checkouts that narrows the scanned set from 272 to 96.

Rebased onto main so it keeps the uv migration and the env-var input
handling rather than reverting to the old pip-based steps.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new checker has a reliability bug (unhandled veraPDF timeout) and a user-facing configuration mismatch in the job summary text.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a new PDF accessibility validation step to the da_build composite action by running veraPDF (PDF/UA-1) against Assembly Line PDF templates and reporting results via GitHub annotations and the job summary, with severity bucketing and an optional strict mode for form/tab-order rules.

Changes:

  • Introduces check_pdf_accessibility.py to locate template PDFs, run veraPDF, parse XML output, classify rule severities, and emit annotations + a Markdown job summary.
  • Extends da_build/action.yml with pdf-validation-mode and pdf-strict inputs, installs veraPDF when enabled, and runs the new checker.
File summaries
File Description
da_build/check_pdf_accessibility.py Implements PDF discovery, veraPDF execution, XML parsing, severity classification, annotations, and job summary rendering.
da_build/action.yml Adds inputs and workflow steps to install veraPDF and run the PDF accessibility checker (with opt-out).
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread da_build/check_pdf_accessibility.py
Comment thread da_build/check_pdf_accessibility.py
@nonprofittechy

Copy link
Copy Markdown
Member Author

Working on resolving conflicts; will mark ready soon

@nonprofittechy
nonprofittechy marked this pull request as ready for review September 1, 2026 15:49
@nonprofittechy
nonprofittechy requested a lite review from Copilot September 1, 2026 15:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are correctness and security gaps in the veraPDF integration (version enforcement/exit-code handling and unverified installer download) that should be addressed before relying on this in CI.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread da_build/action.yml Outdated
Comment thread da_build/action.yml
Comment thread da_build/check_pdf_accessibility.py
@nonprofittechy

Copy link
Copy Markdown
Member Author

Verdict

The findings are valid as PDF/UA-1 conformance findings, but the corpus shows they are not yet a practical pass/fail
gate.

  • Scanned 104 PDFs across 20 repositories, totaling 287 pages.
  • 103 were noncompliant; 1 passed.
  • No veraPDF exceptions or parser failures.
  • 103 were AcroForms; 56 reported Tagged: no, while 47 tagged PDFs still had other failures.
  • qpdf found no hard structural errors; 8 files had warnings-only.

The strongest findings are genuine accessibility defects:

Finding PDFs affected Assessment
Content not tagged or marked as Artifact (7.1.3) 90 Strong finding; directly affects reading order and screen-reader access
Missing structure tree (7.1.11) 59 Strong finding
MarkInfo.Marked is false (6.2.1) 56 Strong finding; indicates the document is not tagged
Form fields lack accessible names (7.18.1.3) 63 Strong finding; affects identification of form controls
Missing Unicode mappings (7.21.7.1) 29 Strong potential screen-reader and text-extraction impact
Missing embedded fonts (7.21.4.1.1) 41 Valid PDF/UA defect; user impact may vary
Missing language for page text (7.2.34) 53 Valid advisory finding, but potentially noisy because it applies to many text runs
Missing document title display preference (7.1.10) 69 Useful advisory metadata finding, not a core accessibility blocker
Incomplete CIDSet font metadata (7.21.4.2.2) 48 Valid technical PDF/UA warning with limited direct user impact
Missing PDF/UA identification metadata (5.1) 93 Administrative finding; should remain informational

The warning classifications are sensible, but language checks are noisy: missing language metadata affected 53 PDFs
and generated 16,554 rule occurrences. Those should remain warnings, not failures.

Strict mode made no difference to pass/fail status for this corpus because every failing file already had an
independent failure. It would, however, add substantial noise: widget/form findings appeared in 100 files and tab-
order findings in 84. Keeping strict mode off by default is justified.

Scope assessment

The path filter in da_build/check_pdf_accessibility.py:188 is mostly correct. Of 126 non-hidden, non-virtualenv PDFs
found under ~/docassemble-*, it scanned 104 and excluded 22 test, static, source, or build artifacts.

There are still likely scope-noise candidates inside data/templates, especially:

  • AssemblyLine test fixture (/home/quinten/docassemble-AssemblyLine/docassemble/AssemblyLine/data/templates/
    test_aldocument_pdf_1.pdf)

  • ALKilnSetup simple.pdf (/home/quinten/docassemble-ALKilnSetup/docassemble/ALKilnSetup/data/templates/simple.pdf)

  • ALWeaver test PDFs (/home/quinten/docassemble-ALWeaver/docassemble/ALWeaver/data/templates/test_pdf.pdf)

These are plausibly test fixtures rather than user-facing templates and may warrant relocation or an exclusion
mechanism.

Recommended follow-ups

  1. Keep the default mode as warning; enabling error globally would fail nearly every existing package.

  2. Explicitly add the two observed but unmapped rules, 7.21.7.2 and 7.21.8.1, to RULE_SEVERITY (da_build/
    check_pdf_accessibility.py:25). They currently fail conservatively via the fallback at line 155.

  3. Decide whether test fixtures belong in data/templates; otherwise move or exclude them.

  4. Consider making veraPDF installation failure fatal when pdf-validation-mode: error; the current install step is
    continue-on-error (da_build/action.yml:173).

No repository files were changed; the existing untracked URL report was preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants