Repository navigation
Say when an emailed error was reopened, and let apps build the subject - #109
Merged
fractaledmind merged 4 commits intoOct 16, 2026
Merged
Conversation
With email_every_occurrence off, the occurrence that reopens a resolved error is emailed with the same subject as a brand-new error, so a fix that didn't hold is indistinguishable from a new problem until the email is opened. The occurrence knows it reopened its error, but the mailer job loads it afresh, so the reason is passed to the mailer as an optional argument.
The occurrence's reason for being emailed now reaches a proc, along with the error and the occurrence, so an app can word the subject itself: a different label for a reopened error, or marking the 100th occurrence when every occurrence is emailed. The default proc is the existing subject, with "(reopened)" for an error that occurred again after being resolved.
Whatever reason an app passes to error_occurred already reaches email_subject. Saying so lets an app build resolved or rate-spike emails on the lifecycle notifications and still word their subjects in one place.
namolnad
marked this pull request as ready for review
October 13, 2026 16:47
# Conflicts: # CHANGELOG.md # test/mailers/solid_errors/error_mailer_test.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Say when an emailed error was reopened, and let apps build the subject
I know
email_subjectmay be a niche request, and I'd understand if it's more than you want to take on. The "(reopened)" fix at the start stands on its own (see below).With
email_every_occurrence = false, Solid Errors emails an error's first occurrence and the occurrence that reopens a resolved error. Both emails get the same subject (🔥 TimeoutError), so a fix that didn't hold looks the same as a brand-new problem until you open the email. The subject is usually where you decide how urgent an email is.What changes
By default: a reopened error's email now says so:
🔥 TimeoutError (reopened). Every other subject is unchanged.email_subject: a new setting. Set it to a proc to build the subject yourself. The proc gets the error, the occurrence, andreason::createdor:reopenedwhen the occurrence opened its error,nilfor any other occurrence.email_subject_prefixis still added in front of what it returns.That covers wording, emoji, and with
email_every_occurrence = truethings like marking the 100th occurrence. Counting up to the occurrence's id, as above, gives the same number however late the mail job runs.Emails for an app's own events. With the lifecycle notifications from #107, an app can send the error email for events Solid Errors doesn't email about itself. Examples are an error being resolved, or one occurring more often than usual (a rate spike). Whatever reason the app passes to
error_occurredreaches the proc, so those emails get their own subjects too:This is why
reasonis documented as open-ended. Solid Errors itself only ever passes:created,:reopenedornil.How
The occurrence already knows whether it opened its error (
opens_error). That attribute isn't persisted, though, anddeliver_laterloads the occurrence again by GlobalID, so the mailer would never see it. The occurrence now passes it to the mailer as an optional second argument, and the mailer hands it to the proc:error_occurred(occurrence)still works unchanged, so apps that call the mailer directly or override it are unaffected.If the setting is more than you want
The "(reopened)" fix doesn't depend on the proc. If you'd rather not take on
email_subject, I'm happy to cut this back to just the default subject change.Tests
:reopened.:resolved, reaches the proc.:reopened. This test fails without the change toOccurrence.