Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: remove notifications experiment #14869

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

Merged
merged 8 commits into from
Oct 1, 2024
Merged

Conversation

dannykopping
Copy link
Contributor

@dannykopping dannykopping commented Sep 30, 2024

Notifications have proved stable in the mainline release of v2.15, and in preparation for v2.16 we're moving this to stable.

Note:

Assuming a config which relies on the defaults for notifications settings, customers will now start seeing logs like this (assuming they don't have an open SMTP server on localhost):

[API] 2024-09-30 09:44:44.695 [warn]  notifications.manager.notifier: message dispatch failed  notifier_id=4991afe2-66e2-4d89-835b-d737141cfec5  msg_id=eeaae4b1-70de-4e89-9d11-6f83ecb8bce2  method=smtp  attempt=1 ...
[API] error= SMTP client creation:
[API] github.com/coder/coder/v2/coderd/notifications/dispatch.(*SMTPHandler).dispatch.func1
[API] /Users/danny/Code/coder/coder/coderd/notifications/dispatch/smtp.go:128
[API] - establish plain connection to server:
[API] github.com/coder/coder/v2/coderd/notifications/dispatch.(*SMTPHandler).client
[API] /Users/danny/Code/coder/coder/coderd/notifications/dispatch/smtp.go:323
[API] - dial tcp [::1]:587: connect: connection refused

This occurs because the default notification method is set as smtp in CODER_NOTIFICATIONS_METHOD, and other defaults are configured (CODER_NOTIFICATIONS_EMAIL_SMARTHOST and CODER_NOTIFICATIONS_EMAIL_HELLO).

This is not harmful, but it is avoidable. We'd have to remove the default values for CODER_NOTIFICATIONS_EMAIL_SMARTHOST and CODER_NOTIFICATIONS_EMAIL_HELLO, and detect their absence, and log a warning with a link to the docs.

Effectively it amounts to the same thing, but it's a little more user-friendly.

The challenge with this approach, though, is it might remove some actually useful default values for customers. We could cover this in release notes, but it weakens our backwards-compatibility posture. It's not strictly a break, but it could cause unintended behaviour if operators blindly upgrade without reading the notes (everybody reads the release notes, right? RIGHT?) and they rely on these defaults.

I think a good middleground could be to mention the docs in the above error log. Then, when we implement #14644, we remove the default SMTP values and set a none method by default.


In retrospect I should've tried to find a way to not define any defaults here, but we live and learn.

@stirby
Copy link
Collaborator

stirby commented Sep 30, 2024

@dannykopping thanks for calling out that note. We should ship as is and revisit this before the next release.

I'd opt to keep the defaults with a note in the docs rather than introduce friction in backward compatibility. To improve visibility, I can link to this PR in the release notes for 2.16.0.

We get a lot of negative feedback on the difficulty of reverting upgrades, and it'd be unfortunate for a downgrade to override their settings.

Can we merge this ASAP so I can pull it into the release branch? Just whenever you all are online. (cc @mtojek)

@dannykopping dannykopping marked this pull request as ready for review October 1, 2024 09:07
@@ -49,7 +49,7 @@ func NewReportGenerator(ctx context.Context, logger slog.Logger, db database.Sto
return nil
}

err = reportFailedWorkspaceBuilds(ctx, logger, db, enqueuer, clk)
err = reportFailedWorkspaceBuilds(ctx, logger, tx, enqueuer, clk)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Passing the main db object through caused a deadlock; we need to pass the transaction-scoped db object instead.

@dannykopping dannykopping force-pushed the dk/notification-stable branch from 593c5a0 to 0107ad1 Compare October 1, 2024 10:04
@dannykopping
Copy link
Contributor Author

I've added the beta badge:

image

image

@dannykopping dannykopping force-pushed the dk/notification-stable branch from 5bffd26 to 0aa6d7b Compare October 1, 2024 10:34
@@ -148,11 +148,12 @@ const DeploymentSettingsNavigation: FC<DeploymentSettingsNavigationProps> = ({
Users
</SidebarNavSubItem>
)}
{experiments.includes("notifications") && (
<Stack direction={"row"} alignItems={"center"} css={{ gap: 0 }}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: When passing string values directly you can pass the value directly without the brackets:

direction="row"

@BrunoQuaresma
Copy link
Collaborator

I tried to QA this locally, but I don't see the option in the sidebar when starting the server without any experiments set. Is it expected? I'm not sure how we are handling beta features tho.

Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

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

UI and code look good! 👍

@dannykopping dannykopping enabled auto-merge (squash) October 1, 2024 13:26
Signed-off-by: Danny Kopping <[email protected]>
@dannykopping dannykopping merged commit 11f7b1b into main Oct 1, 2024
28 of 29 checks passed
@dannykopping dannykopping deleted the dk/notification-stable branch October 1, 2024 13:43
stirby pushed a commit that referenced this pull request Oct 1, 2024
Notifications have proved stable in the [mainline release of
v2.15](https://github.com/coder/coder/releases/tag/v2.15.0), and in
preparation for v2.16 we're moving this to stable.

(cherry picked from commit 11f7b1b)
stirby added a commit that referenced this pull request Oct 1, 2024
- [x] #14869
- [x] #14778
- [x] #14883

Addition to resolve flake: 
- [x] #14875

---------

Co-authored-by: Danny Kopping <[email protected]>
Co-authored-by: Garrett Delfosse <[email protected]>
Co-authored-by: Ben Potter <[email protected]>
Co-authored-by: Spike Curtis <[email protected]>
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.

4 participants