fix(notify): make notification tests, delivery passes, and queued alerts reliable - #829
Merged
Merged
Conversation
…rts reliable
The global notification test now sends one message per destination. The
legacy SHA-256 alias of each deployment URL still routes outbox rows created
before opaque IDs, but it no longer adds a second test send.
An enabled web-managed destination that is locked by a missing, replaced,
or unreadable key now fails the global test with
ErrManagedNotificationLocked. `edgewatch notify test` prints the tested,
failed, and locked counts, exits non-zero, and audits status=failed. The
console test returns 503 notification_key_unavailable instead of
{"sent":0}. Paused destinations and an empty configuration still pass.
The daemon's 90-second delivery pass window now bounds only claiming and
dispatch (Notifier.DrainWithin). Sends already in flight finish under the
daemon context and their own provider timeout, so a slow but healthy
provider is no longer killed, charged a deferral, and delayed 30 minutes.
Undispatched claims are still released without using a retry budget, and
shutdown still cancels in-flight sends.
Schema 49 adds managed_notifications.credential_revision. It records the
revision that last changed a destination's credentials. When an alert's
event transaction commits, a managed destination captured at an earlier
revision is queued under the current revision if its credentials have not
changed since, so a rename no longer drops the alert. A credential change or
deletion still discards the intent and now records it as
notifications.pending_discarded. Existing rows start with their current
revision.
The default notification.key path is now derived from the normalized
database file (Store.FilePath) instead of the DSN. A file: URI database no
longer creates the key under the working directory. DefaultKeyPath accepts
every DSN form, and memory databases have no key path.
Closes #776
Closes #777
Closes #778
Closes #779
Closes #780
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.
What changes
edgewatch notify test. The legacy SHA-256 alias of a deployment URL still routes outbox rows created before opaque IDs, but it no longer adds a second test send.ErrManagedNotificationLocked. The error names the destination ID and lock reason, never its URL.edgewatch notify testprints{"tested","failed","locked"}, exits non-zero and recordsoperation=global status=failed.POST /api/v1/notifications/testreturns 503notification_key_unavailableinstead of 200{"sent":0}. The success response shape is unchanged.Notifier.DrainWithin) now only stops new claims and dispatch.managed_notifications.credential_revisionrecords the revision that last changed a destination's credentials. When the alert's event transaction commits:notifications.pending_discarded.notification.keyfollows the database file. The default key path now comes from the normalized database file (Store.FilePath). Adatabase: file:…URI no longer creates the key under the working directory.DefaultKeyPathaccepts every DSN form, and memory databases have no key path.notify testoutput and exit status;Why
notify.Newderived the key path from the raw DSN. Afile:URI therefore produced a relativefile:/…path under the process working directory.Validation
go test -race -count=1passes forinternal/notify,internal/store,internal/app,internal/webandcmd/edgewatch.go vet ./...,gofmtand the pinned golangci-lint (--new-from-rev=origin/main) are clean../scripts/check-schema-docs.shreports schema 49.managed_notificationsdefinition.Compatibility
edgewatch notify testnow prints a JSON summary and exits non-zero in that case.Closes #776
Closes #777
Closes #778
Closes #779
Closes #780