Yolk SDK
Connectors

Email conformance

Experimental port-level conformance cases for the generic EmailClient, for tests and hand-run practice-mailbox checks.

Generic email actions are documented in the connectors package guide and the integrations reference. This page lists the experimental conformance cases only.

Conformance cases

Experimental. For tests and hand-run checks against a practice mailbox.

Yolk never speaks IMAP, POP3, or SMTP: generic email goes through the host-provided EmailClient port. @yolk-sdk/connectors/email/conformance exports port-level cases for @yolk-sdk/conformance/runner that run the real connector email actions over that port, plus CredentialResolver and EmailConformanceConfig seeds. The claims are as currently understood; none is observed live yet, and the fixtures are synthetic PortFixtures.

Case idSafetySeedsClaim (as currently understood)
email.imap.list-and-get-headersreadimapHost, unreadMessageIdget_message returns the id and headers including Date and From (and a matching Message-ID); listing again still shows the message unread (BODY.PEEK)
email.imap.filtered-list-no-fallbackreadimapHost, unreadMessageIdAn isRead: false list calls listMessagesFiltered once and listMessages never; against a legacy-host shim without it, the list fails validation_failed with no call
email.imap.draft-drafts-discoverywrite-reversibleimapHost, draftsFolderA folder-less draft lands in the \Drafts SPECIAL-USE mailbox (not a fallback name) with a draftId that reads it back; \Draft itself is checked by hand
email.imap.set-read-and-flagwrite-reversibleimapHost, unreadMessageIdset_read and set_flag each change exactly one flag, visible through get_message; the restore puts both back
email.imap.trash-untrash-to-inboxwrite-reversibleimapHost, draftsFolder, trashFolderTrash moves the case's draft to the discovered \Trash mailbox with a new id; untrash restores it to INBOX (not the Drafts mailbox) with another new id
email.imap.move-destination-idswrite-reversibleimapHost, draftsFolder, moveDestinationFolderA move returns the destination id, which resolves there; the stale source id answers message_not_found (any other failure fails the case)
email.pop3.rejects-folders-drafts-mutationsreadpop3HostPOP3 folders, filters, drafts, and every mutation (single-message, labels, the six batch actions, and delete_permanently) fail validation_failed with no port call and no credential resolution; a plain list reaches listMessages once
email.smtp.sent-copy-statuseswrite-irreversibleimapHost, smtpHost, recipient, sentFolderDefault saving sends an IMAP sentCopy and reports saved in the \Sent mailbox; saveToSentItems: false reports skipped; a missing Sent folder reports failed, still accepted
email.smtp.legacy-host-sent-copywrite-irreversibleimapHost, smtpHost, recipientBehind a legacy-host shim (no sentCopy in or out), the action synthesizes unsupported (saving requested) or skipped (disabled), never saved
email.smtp.acceptance-not-deliverywrite-irreversibleimapHost, smtpHost, undeliverableRecipientSMTP accepts a submission to an undeliverable address; the output claims submission only (accepted, submissionId, sentCopy, warning), never delivery

The move case relies on one host-port convention, exported as emailMessageNotFoundCode: EmailClient.getMessage for an id that addresses no message in the folder answers ActionResult.failure with code message_not_found. Authentication, throttling, or server failures prove nothing about absence, so they fail the case.

EmailConformanceConfig holds the seeds; a missing seed fails the case with a precondition: mismatch before any port call. Use a practice mailbox whose \Drafts mailbox is not literally named Drafts, so discovery differs from a hard-coded fallback. Credentials bind through emailConformanceIntegration (credential refs email.conformance.incoming and email.conformance.smtp).

Write cases never touch seeded messages except the flag case, which restores the seeded flags. Draft, trash, and move cases create their own yolk-conformance draft, track its location across moves, and permanently delete it again through email.delete_permanently, also after a failed claim or an interruption. A failed removal fails the case with EmailConformanceRestoreFailed; remove the draft by hand if it still exists. The three send cases send real mail (to the practice mailbox itself, or to the seeded undeliverable address) and run live only when started by id.

For tests, emailClientLayerFromBackend turns any plain-JSON backend { call(method, request) } into the EmailClient layer. makeEmailReplayBackend(fixtures) returns { backend, ledger }, so pass its backend (and keep the ledger to check which fixtures answered):

import {
  emailClientLayerFromBackend,
  emailConformanceFixtures,
  makeEmailReplayBackend
} from '@yolk-sdk/connectors/email/conformance'

const replay = makeEmailReplayBackend(emailConformanceFixtures)
const emailLayer = emailClientLayerFromBackend(replay.backend)

The fixture-driven fake in @yolk-sdk/emulators/email is itself a backend: pass it directly (emailClientLayerFromBackend(makeEmailEmulator())). Neither is a production adapter. Live verification needs a host EmailClient implementation connected to a practice mailbox; no live probe ships in the repository. See Conformance APIs for the fixture type.

On this page