Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate document attachments at time of upload #19532

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

danlim715
Copy link
Contributor

Summary

  • This work is behind a feature toggle (flipper): NO
  • Added benefits intake PDF validation logic for all attachment to run at the time of upload. This change should help catch PDF validation failures before application submission and mitigate failures downstream.
  • Pension benefits team to own this work.

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?

@danlim715 danlim715 added NOT_YET Don't merge this PR w/o the authors permission pension-benefits Used for PRs that impact Pensions labels Nov 20, 2024
Copy link

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: lib/claim_documents/monitor.rb

Copy link

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: lib/claim_documents/monitor.rb

@danlim715 danlim715 force-pushed the zsf/validate-evidence-at-upload branch from 4fa46a2 to 207c8df Compare November 22, 2024 01:41
Copy link

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: lib/claim_documents/monitor.rb

@va-vfs-bot va-vfs-bot temporarily deployed to zsf/validate-evidence-at-upload/main/main November 25, 2024 14:37 Inactive
Copy link

github-actions bot commented Dec 2, 2024

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: lib/claim_documents/monitor.rb

@danlim715 danlim715 removed the NOT_YET Don't merge this PR w/o the authors permission label Dec 2, 2024
Copy link

github-actions bot commented Dec 2, 2024

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: spec/controllers/v0/claim_documents_controller_spec.rb

@danlim715 danlim715 force-pushed the zsf/validate-evidence-at-upload branch from 73a4969 to 90b62ce Compare December 2, 2024 15:39
Copy link

github-actions bot commented Dec 2, 2024

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: spec/lib/claim_documents/monitor_spec.rb

@danlim715 danlim715 force-pushed the zsf/validate-evidence-at-upload branch from 90b62ce to f6e2287 Compare December 2, 2024 15:46
@va-vfs-bot va-vfs-bot temporarily deployed to zsf/validate-evidence-at-upload/main/main December 2, 2024 15:46 Inactive
Copy link

github-actions bot commented Dec 2, 2024

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: spec/lib/claim_documents/monitor_spec.rb

@danlim715 danlim715 force-pushed the zsf/validate-evidence-at-upload branch from f6e2287 to afbc386 Compare December 2, 2024 15:48
Copy link

github-actions bot commented Dec 2, 2024

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: spec/lib/claim_documents/monitor_spec.rb

@danlim715 danlim715 force-pushed the zsf/validate-evidence-at-upload branch from afbc386 to ecd15ee Compare December 2, 2024 15:49
@va-vfs-bot va-vfs-bot temporarily deployed to zsf/validate-evidence-at-upload/main/main December 2, 2024 16:03 Inactive
@danlim715 danlim715 force-pushed the zsf/validate-evidence-at-upload branch from ecd15ee to bc56c8b Compare December 2, 2024 16:06
@va-vfs-bot va-vfs-bot temporarily deployed to zsf/validate-evidence-at-upload/main/main December 2, 2024 16:21 Inactive
Copy link
Contributor

@TaiWilkin TaiWilkin left a comment

Choose a reason for hiding this comment

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

Looks like some tests are failing, and one question


def track_document_upload_failed(form_id, attachment_id, current_user, e)
StatsD.increment("#{DOCUMENT_STATS_KEY}.failure", tags: ["form_id: #{form_id}"])
log_silent_failure({ form_id: form_id, attachment_id: attachment_id }, current_user&.user_account_uuid)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a silent failure? It notifies the user synchronously, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this would be considered a silent failure, since submission failures due to attachment failures aren't properly being logged. And no, the similar log_silent_failure_avoided function is the one that sends the email to the user when the parameter email_confirmed: true is passed.

Copy link

github-actions bot commented Dec 3, 2024

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: spec/support/vcr_cassettes/uploads/validate_document.yml

Copy link

github-actions bot commented Dec 3, 2024

1 Warning
⚠️ This PR changes 229 LoC (not counting whitespace/newlines).

In order to ensure each PR receives the proper attention it deserves, we recommend not exceeding
200. Expect some delays getting reviews.

File Summary

Files

  • .github/CODEOWNERS (+4/-0)

  • app/controllers/v0/claim_documents_controller.rb (+40/-9)

  • app/models/persistent_attachment.rb (+1/-0)

  • config/features.yml (+4/-0)

  • lib/claim_documents/monitor.rb (+25/-0)

  • spec/controllers/v0/claim_documents_controller_spec.rb (+63/-0)

  • spec/lib/claim_documents/monitor_spec.rb (+45/-0)

  • spec/requests/swagger_spec.rb (+20/-18)

    Note: We exclude files matching the following when considering PR size:

    *.csv, *.json, *.tsv, *.txt, *.md, Gemfile.lock, app/swagger, modules/mobile/docs, spec/fixtures/, spec/support/vcr_cassettes/, modules/mobile/spec/support/vcr_cassettes/, db/seeds, modules/vaos/app/docs, modules/meb_api/app/docs, modules/appeals_api/app/swagger/, *.bru, *.pdf
    

Big PRs are difficult to review, often become stale, and cause delays.

Generated by 🚫 Danger

@danlim715 danlim715 force-pushed the zsf/validate-evidence-at-upload branch from 3af220b to b09b70c Compare December 3, 2024 21:51
@va-vfs-bot va-vfs-bot temporarily deployed to zsf/validate-evidence-at-upload/main/main December 3, 2024 22:12 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lint-failure pension-benefits Used for PRs that impact Pensions test-failure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants