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

Add email notification of BSA job status #2368

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

weiminyu
Copy link
Collaborator

@weiminyu weiminyu commented Mar 13, 2024

This change is Reviewable

Copy link
Collaborator

@jianglai jianglai left a comment

Choose a reason for hiding this comment

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

Reviewed 10 of 10 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @sarahcaseybot and @weiminyu)


core/src/main/java/google/registry/bsa/BsaEmailSender.java line 24 at r1 (raw file):

/** Sends BSA-related email notifications. */
class BsaEmailSender {

I wonder if it is worth it to have a sender class just as a simple wrapper around GmailClient. It seems you could just easily inject the GmailClient and the recipient address at sites where you need to send emails. Why bother with another layer of indirection where potential bugs could be introduced (and needs to be separately tested)?


core/src/main/java/google/registry/bsa/UploadBsaUnavailableDomainsAction.java line 129 at r1 (raw file):

      boolean isGcsSuccess = uploadToGcs(unavailableDomains, runTime);
      boolean isBsaSuccess = uploadToBsa(unavailableDomains, runTime);
      if (isBsaSuccess && isGcsSuccess) {

In general, do we want to send emails for successful conditions? Wouldn't that result in a lot of emails that people just ignore and in the end may cause actual failure emails to be missed as well?


core/src/test/java/google/registry/bsa/UploadBsaUnavailableDomainsActionTest.java line 108 at r1 (raw file):

    assertThat(blockList).doesNotContain("not-blocked.tld");

    // This test currently fails in the upload-to-bsa step.

I don't understand what this means. Should it fail in some other steps? What is expected?

Copy link
Collaborator Author

@weiminyu weiminyu left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @jianglai and @sarahcaseybot)


core/src/main/java/google/registry/bsa/BsaEmailSender.java line 24 at r1 (raw file):

Previously, jianglai (Lai Jiang) wrote…

I wonder if it is worth it to have a sender class just as a simple wrapper around GmailClient. It seems you could just easily inject the GmailClient and the recipient address at sites where you need to send emails. Why bother with another layer of indirection where potential bugs could be introduced (and needs to be separately tested)?

A sender class can serve two purposes:

  1. It manages the recipient addresses so that the caller doesn't have to worry about. Granted, we have only one recipient right now but it doesn't hurt.
  2. It can decorate the message body with action-wide boiler-plates.

It's a bit easier to write tests too, without having to create EmailMessage in every test.

The GmailClient code path is covered in some tests.


core/src/main/java/google/registry/bsa/UploadBsaUnavailableDomainsAction.java line 129 at r1 (raw file):

Previously, jianglai (Lai Jiang) wrote…

In general, do we want to send emails for successful conditions? Wouldn't that result in a lot of emails that people just ignore and in the end may cause actual failure emails to be missed as well?

I think yes. We want to know they have run, at least initially.

People can also filter out the successful notifications easily.


core/src/test/java/google/registry/bsa/UploadBsaUnavailableDomainsActionTest.java line 108 at r1 (raw file):

Previously, jianglai (Lai Jiang) wrote…

I don't understand what this means. Should it fail in some other steps? What is expected?

Ben needs to fix the test. See todo below.

Copy link
Collaborator

@jianglai jianglai left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @sarahcaseybot)

@weiminyu weiminyu added this pull request to the merge queue Mar 13, 2024
Merged via the queue into google:master with commit 9af0068 Mar 13, 2024
9 checks passed
@weiminyu weiminyu deleted the add-bsa-email branch March 13, 2024 20:11
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.

2 participants