feat(NODE-1955): SMTP: More observability, add notifications handler etc#95
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the SMTP inbound stack with richer observability by introducing notification hooks, tracking protocol/message errors in session metadata, and updating the delivery agent interface to receive session context.
Changes:
- Add
ReceivesNotifications,MessageError, andProtocolErrorto emit message/session/protocol events and track last protocol error. - Thread
SessionMetathrough delivery and notification paths; update SMTP session logic to record/report protocol errors. - Move inbound SMTP tests into a dedicated
tests.rsmodule and expand tests to cover notifications.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
ic-bn-lib/src/smtp/mod.rs |
Adds notification trait + structured error enums; changes delivery trait to accept SessionMeta. |
ic-bn-lib/src/smtp/inbound/mod.rs |
Introduces SessionMeta, tracks message_id/last_error, and adds notification plumbing (set_error). |
ic-bn-lib/src/smtp/inbound/session.rs |
Records protocol errors, emits message notifications (success/failure), and uses stable message_id per transaction. |
ic-bn-lib/src/smtp/inbound/manager.rs |
Adds session-finish notifications and refactors TLS handling/handshake error reporting. |
ic-bn-lib/src/smtp/inbound/ehlo.rs |
Emits ProtocolError for EHLO validation failures. |
ic-bn-lib/src/smtp/inbound/mail_from.rs |
Emits ProtocolError for MAIL FROM sequencing/validation/SPF/reverse-IP failures. |
ic-bn-lib/src/smtp/inbound/rcpt_to.rs |
Emits ProtocolError for RCPT TO sequencing/validation/resolution failures. |
ic-bn-lib/src/smtp/inbound/tests.rs |
New extracted inbound SMTP test module; adds notification handler coverage. |
ic-bn-lib/src/smtp/ic/delivery_agent.rs |
Updates IC delivery agent to accept SessionMeta and adjusts logging/tests. |
ic-bn-lib/src/lib.rs |
Re-exports rcgen. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
frankdavid
approved these changes
Jun 1, 2026
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.
ReceivesNotificationstrait)ProtocolError)tests.rs