Skip to content

Conversation

@costacalvin
Copy link

@costacalvin costacalvin commented Dec 5, 2025

Summary

Fixed a bug where in progress forms remained even after the veteran successfully submits their form.

  • This work is behind a feature toggle (flipper):YES (form_2680_enabled)
  • This PR updates the form controllers to clear/delete in progress forms after successful claim creation.
  • Root Cause: Our form controllers did not include clear_saved_form method to delete any in progress forms.
  • Solution: Added clear_saved_form(claim.form_id) method to each form controller after claim creation.
  • Team: Benefits Intake Optimization (BIO) - Aquia. Yes, our team owns maintenance of this component.
  • (If introducing a flipper, what is the success criteria being targeted?)

Related issue(s)

Testing done

  • New code is covered by unit tests
  • When veteran would submit their form, they would still see the form as in progress.
  • Enable the form_2680_enabled flipper
  • If this work is behind a flipper:
    • Tests need to be written for both the flipper on and flipper off scenarios. Docs.

Screenshots

Before:
image

After:

What areas of the site does it impact?

This PR affects Form 21-0779, Form 21p-530a, and Form 21-4192 create endpoints and Form 21-2680 download_pdf endpoint.

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?

@costacalvin costacalvin self-assigned this Dec 5, 2025
@costacalvin costacalvin added benefits-optimization Benefits Intake Optimization (BIO) teams benefits-optimization-aquia Benefits Intake Optimization (BIO) - Aquia 21-4192 21P-530a 21-0779 21-2680 labels Dec 5, 2025
@costacalvin costacalvin marked this pull request as ready for review December 5, 2025 20:47
Copilot AI review requested due to automatic review settings December 5, 2025 20:47
@costacalvin costacalvin requested review from a team as code owners December 5, 2025 20:47
Copy link
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 fixes a bug where in-progress forms were not being deleted after successful form submissions, leaving orphaned data in the database. The fix adds clear_saved_form(claim.form_id) calls to four form controllers after successful claim creation or PDF generation.

  • Added in-progress form cleanup to Form 21-0779, 21P-530A, 21-4192, and 21-2680 controllers
  • Implemented comprehensive test coverage verifying forms are deleted on success but preserved on failure
  • Maintains proper error handling to ensure cleanup only occurs after successful operations

Reviewed changes

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

Show a summary per file
File Description
app/controllers/v0/form21p530a_controller.rb Added clear_saved_form call after successful claim creation in the create action
app/controllers/v0/form214192_controller.rb Added clear_saved_form call after successful claim creation in the create action
app/controllers/v0/form212680_controller.rb Added clear_saved_form call after successful PDF generation in the download_pdf action
app/controllers/v0/form210779_controller.rb Added clear_saved_form call after successful claim creation in the create action
spec/controllers/v0/form21p530a_controller_spec.rb Added tests verifying InProgressForm cleanup on success and preservation on failure
spec/controllers/v0/form214192_controller_spec.rb Added tests verifying InProgressForm cleanup on success and preservation on failure
spec/controllers/v0/form212680_controller_spec.rb Added tests verifying InProgressForm cleanup on success and preservation on failure
spec/controllers/v0/form210779_controller_spec.rb Added tests verifying InProgressForm cleanup on success and preservation on failure

@costacalvin costacalvin changed the title in progress forms get deleted on successful claim creation. BIO - in progress forms get deleted on successful claim creation. Dec 5, 2025
@costacalvin costacalvin changed the title BIO - in progress forms get deleted on successful claim creation. (BIO) In Progress forms get deleted on successful claim creation. Dec 8, 2025
Copy link
Contributor

@annaswims annaswims left a comment

Choose a reason for hiding this comment

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

Looks great!

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

Labels

21-0779 21-2680 21-4192 21P-530a benefits-optimization Benefits Intake Optimization (BIO) teams benefits-optimization-aquia Benefits Intake Optimization (BIO) - Aquia

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants