Repository navigation
feat(openregister): build send-at-on-the-messaging-leaf (sweep audit, e-mail channel) - #10534
Open
rubenvdlinde wants to merge 2 commits into
Open
rubenvdlinde wants to merge 2 commits into
rubenvdlinde wants to merge 2 commits into
Conversation
Tasks 2.2 (finished) and 1.1 / 3.2 (the OpenRegister side).
- The sweep writes the send and fail entries on a scheduled message's
bound object (ScheduledMessageAudit): message.sent with the Message-ID,
message.failed with the cause, the attempt and whether it is parked. The
object is read by uuid without a user; an unbound message writes nothing,
and a gone object or a failed write is logged, never failing the sweep.
- E-mail channel: smtp-mail joins the allowed sources and
POST /api/integrations/email/send takes {to, subject, text, html?,
replyTo?} (plus path, sendAt, object), sends now or schedules, answers
400 for a malformed field and 503 with details.cause for a degraded
source. Every message gets a Message-ID (MessageIdMinter), sent as its
header and returned; the provider answers a sent message with it and the
sweep stores the channel's own Message-ID.
Seeding the smtp-mail source is integriq's (where the other sources are
seeded); 3.1 (e2e) and Newman are left.
Assisted-by: ClaudeCode:claude-opus-5-5
Task 1.1 is complete: the smtp-mail source seed is in integriq (ConductionNL/integriq#3632). Assisted-by: ClaudeCode:claude-opus-5-5
This branch has not been deployed
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.
Summary
Third pass of
openspec/changes/send-at-on-the-messaging-leaf. The first two passes are merged, the second in #10455.smtp-mailis an allowed source, andPOST /api/integrations/email/sendsends now or atsendAt. Every message gets a minted Message-ID, which is returned and later stored by the sweep.Changes
lib/Notifications/Service/Notification/ScheduledMessageAudit.php(new) writes two audit entries:message.sent, with the Message-ID;message.failed, with the cause, the attempt number and whether the message is now parked.The sweep runs without a user, so the object is read by uuid with RBAC and multitenancy off. Whether to write an entry is decided only by the stored row: nothing reaches a response. A message with no bound object writes nothing. If the object is gone or the write fails, it is logged and never fails the sweep.
ScheduledMessageSweepcalls the audit after each send and each failure. The audit is a nullable last constructor argument, so existing construction is unchanged. A sent message now stores the Message-ID the channel answered with, falling back to the stored one.MessageDispatchProvider:smtp-mailtoALLOWED_SOURCES;Message-IDheader it left with (messageId);lib/Service/Integration/Providers/MessageIdMinter.php(new) mints<128 random bits as hex@host>. It drops a port, and falls back toopenregister.invalidfor anything that is not a host name, so a crafted Host header cannot inject header text.MessageDispatchController::emailSend()and its routePOST /api/integrations/email/send(#[NoAdminRequired], like the SMS and WhatsApp sends):{to, subject, text, html?, replyTo?}, plus the optionalpath,sendAtandobject;tois one address or a list, each validated;details.causefor a degraded source;messageIdand stores the header;scheduleSend()can now take a composed message instead of readingbodyandheadersfrom the request.tasks.md: 2.2 is ticked. 1.1 and 3.2 get notes on what is built and what is left.scripts/component-map.csv: one row per new lib file.Not in this PR:
smtp-mailsource itself. It is a register fragment in integriq, wherecmcom-smsand the other sources are seeded.Test Coverage
tests/Unit/Controller/MessageDispatchEmailTest.php(14 tests):smtp-mailwith a minted Message-ID that is returned;sendAtis refused.tests/Unit/Service/Integration/Providers/MessageIdMinterTest.php(8 tests): format, port dropped, uniqueness, and fallback for an empty host, an IPv6 literal, header injection, a space and a leading dash.tests/Unit/Notifications/Service/Notification/ScheduledMessageAuditTest.php(5 tests):ScheduledMessageSweepTest(+2): a sent message is audited with the channel's Message-ID, and failures are audited with their outcome.MessageDispatchProviderTest(+2, and the pinned source list now includessmtp-mail): a sent e-mail answers with its Message-ID; an SMS without one, or an e-mail that did not leave, answers as before.MessageIdMinter, 6 of 8 tests fail. Reading the object with RBAC on inScheduledMessageAuditfails its test.Runs (
phpunit-unit-local.xml, main against this branch):Contract, Service/Rules and Settings are OK on both. The existing errors and failures come from this environment (no Nextcloud server) and match main by name.
Not run:
tests/Unit/Architecture, which does not finish here within 280 s, and the whole suite.Quality checklist
composer check:strictwas not run as a whole. On the changed lib files:REQUIRED_APPconstant in the provider, is already on main.lib/**/*.phpclasses have a matching test (MessageIdMinterTest,ScheduledMessageAuditTest).Generated by Claude Code