department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
283 stars 204 forks source link

PDF_Filler temp files need to be unique #95644

Open cloudmagic80 opened 2 weeks ago

cloudmagic80 commented 2 weeks ago

"Due to the growing number of 7959F1 files, our temporary files with the same name can cause conflicts. This could lead to issues if two users try to save a file with the same 7959F1 name simultaneously." If the files are named correctly, we won't see this error:Error: An error occurred while verifying stamp: No such file or directory @ rb_file_s_rename which is caused by conflicting naming, e.g. tmp/vha_10_7959f_1-stamped.pdf or tmp/vha_10_7959f_1.pdf

Old AC: Each application 7959F1 file unique name, like use a SecureRandom.hex. example: generated_form_path = Rails.root.join("tmp/#{name}-#{SecureRandom.hex}-tmp.pdf").to_s stamped_template_path = Rails.root.join("tmp/#{name}-#{SecureRandom.hex}-stamped.pdf").to_s

New AC: All temporary files must be uniquely named. Need unit test to ensure that the output file for s3 is named correctly: It should not be this format:tmp/vha_10_7959f_1-cf1b6e07204447096d9bf37837c61df7.pdf or thistmp/vha_10_7959f_1-stamped.pdfortmp/vha_10_7959f_1.pdf Correct format is: tmp/0099687f-7e9c-45a9-8865-ac67f0d7ef31_vha_10_7959f_1.pdf for PEGA to process the claims

cloudmagic80 commented 2 weeks ago

https://github.com/department-of-veterans-affairs/vets-api/pull/19060/files

cloudmagic80 commented 1 week ago

Reverting the PR.

cloudmagic80 commented 1 week ago

https://github.com/department-of-veterans-affairs/vets-api/pull/19118

cloudmagic80 commented 1 week ago

This new PR: https://github.com/department-of-veterans-affairs/vets-api/pull/19143/files supersedes the other PRs that came before this one

cloudmagic80 commented 6 days ago

LGTM @stevelong00