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

Toggle to call Form526ConfirmationEmailJob in poll_form526_pdf #19478

Merged
merged 12 commits into from
Nov 19, 2024

Conversation

mchae-nava
Copy link
Contributor

@mchae-nava mchae-nava commented Nov 15, 2024

Note: Delete the description statements, complete each step. None are optional, but can be justified as to why they cannot be completed as written. Provide known gaps to testing that may raise the risk of merging to production.

Summary

  • *This work is behind a feature toggle (flipper): YES

  • (Summarize the changes that have been made to the platform)
    Add a feature toggle to call Form526ConfirmationEmailJob in our polling job

  • (If bug, how to reproduce)

  • (What is the solution, why is this the solution?)

  • (Which team do you work for, does your team own the maintenance of this component?)

  • (If introducing a flipper, what is the success criteria being targeted?)
    Control the availability of the new Received email so that Veterans do not experience a degraded or otherwise non-functional submission experience. A received email exists today, so it’s important that we maintain this

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?

submission: #{submission_id} from poll_form526_pdf")
params = submission.personalization_parameters(first_name)
Form526ConfirmationEmailJob.perform_async(params)
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks great! Just wondering what you think about pulling lines 100-106 out into a send_received_email method?

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'll do this as well with some fixes, once I'm able to

tommasina-va
tommasina-va previously approved these changes Nov 15, 2024
Copy link
Contributor

@tommasina-va tommasina-va left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@aurora-a-k-a-lightning aurora-a-k-a-lightning left a comment

Choose a reason for hiding this comment

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

the feature looks good. just a comment about the testing strategy

subject { create(:form526_submission, :with_multiple_succesful_jobs) }

before do
Flipper.enable(:disability_526_call_received_email_from_polling)
Copy link
Contributor

Choose a reason for hiding this comment

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

feature flags in the test environment are automatically enabled.
did we mean to disable at the start, enable here, then disable in an after clause for the next tests to isolate these unit tests?
that's the usual pattern we follow.
and that may be why the tests are failing. i haven't looked at the details, but that seems like a solid guess 🤣

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, actually I think you're right! Will try it out and make the adjustment


context 'with disability_526_call_received_email_from_polling enabled' do
before do
Flipper.enable(:disability_526_call_received_email_from_polling)
Copy link
Contributor

Choose a reason for hiding this comment

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

same for this

@mchae-nava
Copy link
Contributor Author

@rmtolmach It seems the change is causing some flakiness with other tests we have that don't mock the Flipper call. In the interest of getting this feature toggle shipped, can we merge it with the previous changes, and I can make a follow-up ticket for my team to resolve the rest of the tests?

In the short term, this shouldn't cause any issues as my team is the only one that will be toggling and working with this flag

Copy link
Contributor

@aurora-a-k-a-lightning aurora-a-k-a-lightning left a comment

Choose a reason for hiding this comment

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

i think we can fix this easily. give it a whirl!

@@ -1282,7 +1282,17 @@ def expect_no_max_cfi_logged(diagnostic_code)
context 'with submission confirmation email when successful job statuses' do
subject { create(:form526_submission, :with_multiple_succesful_jobs) }

it 'returns one job triggered' do
it 'does not trigger job when disability_526_call_received_email_from_polling enabled' do
allow(Flipper).to receive(:enabled?).with(:disability_526_call_received_email_from_polling,
Copy link
Contributor

Choose a reason for hiding this comment

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

hey Mark, the tests are now failing because someone added a Flipper called saved_claim_schema_validation_disable which is called in this call chain, i'm guessing when the form526 submission record is created on line 1283, which requires a saved_claim.

all we have to do is add this line above where we're calling the Flipper mock.

allow(Flipper).to receive(:enabled?).with(:saved_claim_schema_validation_disable).and_return(false)

i think that should work.
be sure to pull latest from master as that flag looks pretty new!

end

it 'returns one job triggered when disability_526_call_received_email_from_polling disabled' do
allow(Flipper).to receive(:enabled?).with(:disability_526_call_received_email_from_polling,
Copy link
Contributor

Choose a reason for hiding this comment

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

here too!

allow(Flipper).to receive(:enabled?).with(:saved_claim_schema_validation_disable).and_return(false)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I'll put the same thoughts I had in our channel here, but the implications of having more and more mocked flags needing to reference each other in order to prevent flakiness concerns me, especially when these threads are owned by different teams. We could certainly solve this for our team's unit tests, but @rmtolmach maybe this is worth revisiting later?

Anyways, I've made the changes for the short term, hopefully that's the only dependency for now

Copy link
Contributor

Choose a reason for hiding this comment

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

hm, that is odd. I'll bring that up with the backend CoP

@va-vfs-bot va-vfs-bot temporarily deployed to dbex/96485-received-email-feature-toggle/main/main November 19, 2024 09:26 Inactive
Copy link
Contributor

@rmtolmach rmtolmach left a comment

Choose a reason for hiding this comment

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

👍 specs passing

Copy link

Backend-review-group approval confirmed.

@mchae-nava mchae-nava merged commit eb2a354 into master Nov 19, 2024
40 of 41 checks passed
@mchae-nava mchae-nava deleted the dbex/96485-received-email-feature-toggle branch November 19, 2024 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants