Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Debugging AcroForm warnings#26321

Merged
RachalCassity merged 8 commits intomasterfrom
rcassity-debug-AcroForm-warnings
Feb 4, 2026
Merged

Debugging AcroForm warnings#26321
RachalCassity merged 8 commits intomasterfrom
rcassity-debug-AcroForm-warnings

Conversation

@RachalCassity
Copy link
Copy Markdown
Member

@RachalCassity RachalCassity commented Feb 3, 2026

Keep your PR as a Draft until it's ready for Platform review. A PR is ready for Platform review when it has a teammate approval and tests, linting, and settings checks pass CI. See these tips on how to avoid common delays in getting your PR merged.

Summary

This PR adds opt-in debug logging around AcroForm PDF processing to surface problematic or unsupported fields encountered at runtime. While investigating staging behavior after recent changes, we observed hundreds of repeated warnings related to AcroForm fields (e.g., Btn fields without appearance streams). These logs were difficult to trace back to specific templates or fields.

The goal of this PR is to make these issues actionable and traceable without impacting normal production log volume.


What’s happening today

In staging, we are seeing repeated warnings such as:

  • WARNING: AcroForm field 'Btn' with no AP not implemented
  • Radio = FALSE, Pushbutton = FALSE

These warnings:

  • Fire for every request that touches affected PDF templates
  • Do not indicate which specific fields are problematic
  • Are difficult to correlate to specific PDF templates or form fields
  • Create noise that can mask real issues

What this PR changes

  • Introduces a feature-flagged debug mode (acroform_debug_logs)

  • When enabled, logs:

    • PDF template path
    • Missing or problematic AcroForm fields
    • Field type and full field name (when available)
  • Keeps existing behavior unchanged when the flag is disabled

  • Avoids throwing errors or changing PDF generation behavior

This keeps production safe while allowing deeper inspection in staging or during investigations. Pods will shutdown after these warnings. The warnings are not causing the pod to shutdown, assuming there is a job or service causing memory leaks to due PDF failures.


Why this matters

  • Helps identify PDF templates that need remediation
  • Makes AcroForm warnings traceable instead of noisy
  • Reduces the need for manual PDF inspection
  • Prevents repeated staging investigations with no clear owner or next step

This PR is intentionally diagnostic, not a behavioral change.


How to test

  1. Enable the feature flag:

    Flipper.enable(:acroform_debug_logs)
  2. Trigger PDF generation for affected forms

  3. Confirm logs now include:

    • Template path
    • List of problematic fields (if any)
  4. Disable the flag and confirm logging returns to baseline behavior


Scope / Risk

  • Low risk
  • Logging only
  • Feature-flagged
  • No changes to PDF output or request behavior

Related issue(s)

Testing done

  • New code is covered by unit tests
  • Describe what the old behavior was prior to the change
  • Describe the steps required to verify your changes are working as expected. Exclusively stating 'Specs run' is NOT acceptable as appropriate testing
  • If this work is behind a flipper:
    • Tests need to be written for both the flipper on and flipper off scenarios. Docs.
    • What is the testing plan for rolling out the feature?

Screenshots

Note: Optional

What areas of the site does it impact?

(Describe what parts of the site are impacted andifcode touched other areas)

Acceptance criteria

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No error nor warning in the console.
  • Events are being sent to the appropriate logging solution
  • Documentation has been updated (link to documentation)
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Feature/bug has a monitor built into Datadog (if applicable)
  • If app impacted requires authentication, did you login to a local build and verify all authenticated routes work as expected
  • I added a screenshot of the developed feature

Requested Feedback

(OPTIONAL)What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?

@RachalCassity RachalCassity marked this pull request as ready for review February 3, 2026 22:49
@RachalCassity RachalCassity requested review from a team as code owners February 3, 2026 22:49
Copilot AI review requested due to automatic review settings February 3, 2026 22:49
@RachalCassity RachalCassity changed the title Debugging AcroForm errors Debugging AcroForm warnings Feb 3, 2026
doc = HexaPDF::Document.open(pdf_path)
field = doc.acro_form&.field_by_name(SIGNATURE_FIELD_NAME)
form = doc.acro_form
raise 'No AcroForm found in PDF template.' if form.nil?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe we could put this inside the flipper since it is changing behavior?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Let me revert that change

jweissman
jweissman previously approved these changes Feb 3, 2026
Copy link
Copy Markdown
Contributor

@jweissman jweissman left a comment

Choose a reason for hiding this comment

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

lgtm and seems safe to enable (although maybe we could put the new raise inside the flipper for now to make sure we don't conflate our debugging with introducing a new issue?)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds opt-in debug logging for AcroForm PDF processing to help diagnose problematic PDF fields that generate warnings in staging. The feature is controlled by the acroform_debug_logs feature flag and aims to make AcroForm warnings traceable by logging template paths and identifying fields missing appearance streams.

Changes:

  • Added feature flag acroform_debug_logs to enable debug logging for AcroForm processing
  • Implemented logging in 5 PDF processing modules to log template paths when the flag is enabled
  • Added field inspection logic in one module to detect and log problematic fields (missing AP on Btn fields)

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
config/features.yml Adds the acroform_debug_logs feature flag configuration
lib/pdf_fill/filler.rb Adds template path logging in fill_form_with_hexapdf when flag is enabled
modules/survivors_benefits/lib/survivors_benefits/pdf_fill/va21p534ez.rb Adds template path logging in signature_overlay_coordinates_for when flag is enabled
modules/medical_expense_reports/lib/medical_expense_reports/pdf_fill/va21p8416.rb Adds template path logging and problematic field detection in signature_overlay_coordinates when flag is enabled
modules/increase_compensation/lib/increase_compensation/pdf_stamper.rb Adds template path logging in signature_overlay_coordinates and changes form field key from 'statementOfTruthSignature' to 'statement_of_truth_signature'
modules/decision_reviews/lib/decision_reviews/pdf_template_stamper.rb Adds template path logging in fill_and_write_pdf when flag is enabled

Comment thread modules/survivors_benefits/lib/survivors_benefits/pdf_fill/va21p534ez.rb Outdated
Comment on lines +158 to +160
if Flipper.enabled?(:acroform_debug_logs)
Rails.logger.info("SurivorsBenefits::PdfFill::Va21p534ez HexaPDF template: #{pdf_path}")
end
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

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

The new logging behavior when the acroform_debug_logs feature flag is enabled lacks test coverage. The existing tests for signature_overlay_coordinates stub the method, which means the new logging code is not exercised. Add tests that verify the logging behavior both when the flag is enabled and disabled, following the pattern established in the codebase for feature flag testing.

Copilot uses AI. Check for mistakes.
Comment thread modules/medical_expense_reports/lib/medical_expense_reports/pdf_fill/va21p8416.rb Outdated
Comment on lines +47 to +49
if Flipper.enabled?(:acroform_debug_logs)
Rails.logger.info("IncreaseCompensation::PdfStamper HexaPDF template: #{pdf_path}")
end
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

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

The new logging behavior when the acroform_debug_logs feature flag is enabled lacks test coverage. The minimal existing tests for PdfStamper don't exercise the signature_overlay_coordinates method. Add tests that verify the logging behavior both when the flag is enabled and disabled, following the pattern established in the codebase for feature flag testing.

Copilot uses AI. Check for mistakes.
Comment on lines +67 to +69
if Flipper.enabled?(:acroform_debug_logs)
Rails.logger.info("DecisionReviews::PdfTemplateStamper #{@template_path}")
end
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

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

The new logging behavior when the acroform_debug_logs feature flag is enabled lacks test coverage. The existing tests for PdfTemplateStamper don't verify this logging behavior. Add tests that verify the logging occurs when the flag is enabled and doesn't occur when disabled, following the pattern established in the codebase for feature flag testing.

Copilot uses AI. Check for mistakes.
Comment thread lib/pdf_fill/filler.rb
#

def fill_form_with_hexapdf(template_path, output_path, hash_data)
Rails.logger.info("PdfFill::Filler HexaPDF template: #{template_path}") if Flipper.enabled?(:acroform_debug_logs)
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

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

The new logging behavior when the acroform_debug_logs feature flag is enabled lacks test coverage. The existing tests for fill_form_with_hexapdf don't verify this logging behavior. Add tests that verify the logging occurs when the flag is enabled and doesn't occur when disabled, following the pattern established in the codebase for feature flag testing.

Copilot uses AI. Check for mistakes.
Comment thread modules/medical_expense_reports/lib/medical_expense_reports/pdf_fill/va21p8416.rb Outdated
Comment thread modules/increase_compensation/lib/increase_compensation/pdf_stamper.rb Outdated
@RachalCassity RachalCassity enabled auto-merge (squash) February 4, 2026 00:11
@RachalCassity RachalCassity merged commit b04743c into master Feb 4, 2026
42 checks passed
@RachalCassity RachalCassity deleted the rcassity-debug-AcroForm-warnings branch February 4, 2026 14:21
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.

3 participants