Table of Contents

Class MailEnrichmentPass

Namespace
MailFathom.Application.Emails.Enrichment
Assembly
MailFathom.Application.dll

Derives what the account's newly cut mail is about, which dates it names, and what it asks of its reader, once per message, and writes all three down.

public sealed class MailEnrichmentPass
Inheritance
MailEnrichmentPass
Inherited Members

Remarks

The proposed tasks come out of the same derivation as the marks and cost nothing beyond it: one call answers what a message is about and what it asks of the person who received it, so reading mail into somebody's task list is not a second unattended thing a deployment spends on and has no ceiling of its own. A deployment that has not turned enrichment on proposes nothing, for the same reason it derives nothing.

The last stage of the arrival pipeline, behind the cut, and behind it because a mark cites passages: a message derived before it was cut would have nothing to rest its evidence on. Everything the earlier stages settle is settled by the time this runs — the classification gate has admitted the message, the user's rules have finished with it, and it is not still on its way out of the folder it is sitting in.

A step of the account's synchronization run rather than a schedule of its own, for the reason every other pass is: that run already has per-account isolation, a slot count, a jittered backoff, and a failure path that defers the account instead of the process, and only one pass per account is ever in flight because of it.

It needs no cursor. A message leaves the selection by being derived from, so an interrupted pass repeats nothing and skips nothing, and what one pass's bound leaves behind is the next run's. That is also the whole of how an existing mailbox is backfilled: a deployment that turns enrichment on drains its stored mail over successive runs, MaximumEmailsPerPass at a time, and the report says at every step how far it has got and whether more remains. No sweep of its own exists, because there is no mail the account run does not reach — an account that has stopped synchronizing has stopped receiving the mail a derivation would be owed for.

Derivations are made one after another and the first withheld one ends the pass. Both follow from what a derivation costs: it is a provider call, the endpoint's concurrency limiter admits a few invocations at a time and rejects the rest outright rather than queueing them, and every reason a derivation is withheld — an operator who has not turned it on, a spent allowance, an unreachable provider — outlives one message. Asking again per remaining message would buy the same answer while the account run waits.

Reading the dates a message names runs here too, on a deployment that turned it on, because it wants exactly what this pass already selected: the subject, the arrival instant, and the opening passages of mail that has been cut and settled. Running it as a pass of its own would mean a second selection over the same rows and a second record of which messages it had reached, and would make proposing events a second category of unattended spend rather than one more thing derived from a message this run already pays to read. It is admitted against the same period ceilings and counted by the same ledgers, so it declares no bound of its own.

The two are committed together and a withheld reading ends the pass exactly as a withheld derivation does. That costs the one derivation already paid for on the message the withholding landed on, which is the honest price of the alternative being worse: a commit carrying the enrichment alone takes the message out of the selection forever, and the dates it named would never be offered to anybody.

Constructors

MailEnrichmentPass(IStoredEmailEnrichmentStore, IEmailEnricher, MailCalendarProposals, IMailAccountLanguages, MailDerivedTaskProposals, SensitiveContentEgressGuard, OptimisticConcurrencyRetryPolicy, TimeProvider)

Initializes the pass from the state it walks and the two readings it asks.

Fields

MaximumEmailsPerPass

How many messages one pass derives from.

MaximumPassagesPerEmail

How many of a message's leading passages one derivation reads.

Methods

RunAsync(MailAccountId, CancellationToken)

Takes one bounded pass over the account's mail awaiting a derivation.