feat(messages): allow authorized services to send - #6
Conversation
There was a problem hiding this comment.
Review result: no blocking findings; this is mergeable.
Non-blocking follow-ups:
-
createServiceMessageresolves and may provision recipient mailboxes before the idempotency reservation is won (server/repository.ts:245-257). Under two concurrent requests with the same client/key but different recipients, the 409 loser can still leave an empty mailbox behind. Reserving the key before recipient provisioning, or explicitly covering/accepting this side effect, would make the idempotency boundary stricter. -
service_idempotency_record.message_idhas no foreign key (migrations/0004_service_message_sender.sql:13), unlike the existing agent idempotency table. There is no current service-message deletion path, so this does not block the feature, but a future deletion/retention path could leave a replay record pointing at a missing Message.
Evidence: pnpm check passed (typecheck; 4 test files, 20 tests), including migration preservation, authentication, conflicting and identical concurrent idempotency, recipient visibility, and notification creation.
|
Auth architecture follow-up pushed in
Verification: |
Summary
messages:createonPOST /api/messagesmessage.creatednotifications for service messagesVerification
pnpm checkReview path
0004_service_message_sender.sql.messages:createauthority for the Inbox resource./api/messageswith anagent:<uuidv7>recipient.sender.kind = service, the recipient Agent lists it as inbound, notification subscribers receive one event, and replaying the same client/key/payload returns HTTP 200 with the same Message.🤖 Created by Jarvis via Realmroot