Table of Contents

The presentation plan

An answer about a mailbox is rarely a paragraph. A comparison wants a table, a course of events wants dates in order, a question about people wants people. The presentation plan is the contract that lets a run say which of those an answer is, in a form a client draws with ordinary typed UI and never evaluates.

This page describes the contract as it stands: what a plan holds, what its parts mean, how a client that is behind the service reads one, how a citation in it is followed to the mail behind it, and what is deliberately not in it. How a run decides which blocks a plan holds is the Discover run; how the client draws one is not described here, because what a block looks like is the client's rather than the contract's.

Two properties the contract is built around

It is closed. A plan holds blocks drawn from a catalogue of eleven types and nothing else. No part of it is markup, a template, an expression, or a reference to code, and adding a twelfth block type is a change to PresentationBlockType that a reviewer reads rather than a string a model chose. That is what makes generative presentation safe here: the flexibility is in which blocks a run composes and what it puts in them, and the drawing is typed UI a client already has.

It is versioned apart from the application. A deployment and a client are updated separately — a client installed on somebody's own machine most obviously, but equally a page cached in a browser — so a client will meet a plan written by a service ahead of it. The plan carries a schema version, and every block carries the version of its own type, so such a client can draw the blocks it recognizes, say what it cannot, and keep the rest of the run. Without both, the only safe answer to one unfamiliar block would be to discard the whole thing.

Neither number is the application's version. The plan's schema version moves when the shape of the plan itself moves — a type joining the catalogue among it, because that changes which blocks a plan may hold; a block type's version moves when that block's own shape does, and for no other reason. A release that changes neither leaves both where they are.

A block's version is written from the catalogue rather than supplied by whatever composed the plan, so nothing can stamp a revision it did not write, and it is checked again on the way in: reading a plan whose block claims a revision this build does not implement is refused rather than read as though it were the revision this build knows. Degrading such a block instead of refusing the plan is a decision for a reader that has chosen to make it, and a reader making it takes the number out of the JSON rather than binding it to a catalogue of its own.

What a plan holds

Part What it is
schemaVersion Which revision of this contract the plan was written against.
blocks The blocks, in the order they are read. At least one, and at most twenty.
citations Every source the blocks rest on, declared once each and named by an identifier local to the plan.
coverage What the run read, one entry per account its scope reached. At most thirty-two.
limitations What the run knows about its own reach, as values from a closed set. Empty where it reached everything.

A plan whose blocks name a citation it does not declare is refused when it is composed and again when it is read, which is the one way a citation contract fails without anybody noticing. A plan whose blocks rest on a source it declares as unreadable is refused for the same reason — see § A source that could not be read.

What the run drew on

A client reads a synchronized copy, so which mailboxes an answer was composed from and how current each of them was is part of the answer rather than a footnote under it. An account nobody has reconciled since yesterday means the answer may be missing what arrived since, and that may be the whole reason it is wrong.

Each coverage entry names one account by MailFathom's own generated identifier — no host, no user name, no address, because how a deployment reaches a mailbox is the operator's business rather than a property of an answer — beside how current the local copy of it was, and the two ends of the mail the run actually drew on from it.

Two things about it are decided rather than incidental. The accounts are the scope's rather than the passages': an account that was read and answered nothing is reported with its freshness and with no dates, because an account that yielded nothing is not an account that was skipped, and its staleness may be why it yielded nothing. And the dates bound what the run drew on rather than what the mailbox holds, so a reader can see that an answer about a decade of correspondence rested on three weeks of it.

The eleven block types

Each block carries the evidence behind it — see § What the correspondence does for a block — beside the data below.

Block Used when What it carries
answer one synthesized answer the text, and how far it is worth trusting beyond its sources
evidenceList the messages themselves are the point per entry: one source, the part worth reading, a relevance, and how current the copy was
timeline the question is about change over time per entry: when, what happened, what it happened to, and its sources
factTable amounts, terms, or versions are compared columns from a closed catalogue, and one cell per column per row, each with its sources
people the question is about people or organizations per entry: a name, an address where there is one, where they stand, when they were last in contact, and sources
threadState where a conversation stands is wanted participants, plus what was agreed, what is open, and what somebody undertook
attachmentGallery files are being looked for per entry: the citation, the name, the declared media type, the size, and whether it can be opened
draft the result is text to be sent recipients, subject, body, and what has become of it locally
eventProposal a date is to be put on the person's calendar a title, when it begins, when it ends where it states an end, and whether it is a whole day
taskProposal something is to be owed a title, and the day it is due where it states one
suggestedAction there is a sensible next step which step, why, what it would change, and whether it must be confirmed

Four of the eleven offer the reader something to do, and the catalogue says which: draft, eventProposal, taskProposal, and suggestedAction carry controls where a surface draws them with any, while the other seven are read. A Discover run's answer is drawn read-only throughout, so nothing there acts on the distinction; the Agent's record does, writing a block the person can answer as a proposal it can then record an outcome against, and everything else as a reading.

Four of them are worth a note.

A fact table's columns come from a catalogue rather than from the producer, and a column carries no heading. A heading is words in somebody's language and the client is localized, so a producer that shipped the word "Amount" would have shipped an English screen to a Polish reader. What a column does carry is the kind of value its cells hold, which is how a client decides alignment. A cell the correspondence says nothing about carries no value at all, which is a different thing from a cell somebody left blank.

A draft is a proposal and never an act. Its local status can say that it was composed, saved into the user's drafts, or queued in the outbox, and the set deliberately holds no member meaning sent: sending is something a person does afterwards, through the surface that governs sending.

An event or a task proposal is a type of its own only because its object has to be seen and corrected before it is approved — an hour read out of a message, a day something is owed by. Anything whose whole content fits in one line stays a suggested action. Neither carries who is invited or what would announce it: an event here is the person's own record rather than an invitation, and a reminder is measured from the person's own day, which a run cannot know. Where a proposal cites a message, it cites one the run actually read; a proposal resting on nothing it read is Unsupported rather than resting on an identifier a model supplied.

A suggested action names a step from a closed set, so a plan cannot propose something nobody wrote a control for. It says what taking the step would change, and an action that sends mail is refused unless it also asks to be confirmed — nothing here can recall a message that has left the deployment.

What the correspondence does for a block

Every block carries what the correspondence does for it, and the combination is checked rather than trusted.

  • Support is one of four verdicts, and the constructor holds each to what gives it meaning:

    Verdict What it says What the block must carry
    Supported the correspondence backs what the block states, from sources known to be current at least one citation, over a freshness that is not behind
    Unsupported nothing the run found backs it no citation at all, because a source that backed it would make it supported
    Conflicting the sources disagree with each other at least two citations, and both sides of the disagreement
    Stale it is backed, and the local copy behind it is known to be behind the mail server at least one citation, over a freshness that says so
  • Citations are the identifiers the plan declares, in the order they are worth reading.

  • Conflicting claims are the sides of a disagreement, and only a conflicting block carries any. Each side says what that part of the correspondence says and names the sources saying it — a side nothing backs is not a side of a disagreement — and every source a side names is one the block itself rests on.

  • Freshness says whether the local copy behind the block was current, was known to be behind the mail server, or was never established, and carries when that was established for the first two.

That is what lets a plan be honest about the states a run reaches routinely over years of mail: a fact nothing backs, a fact read from a copy that is behind, and two sources that disagree. Each is worse as prose inside an answer than as a value a client draws differently, and the third is worst of all resolved silently into one figure — a supplier who quoted twice has two figures, and an answer naming one has answered a question nobody asked.

Stale is a verdict rather than a second axis beside the freshness, deliberately. The two invite different acts — a reader told a fact is unbacked asks somewhere else, and one told the mailbox is behind reconciles it — and a producer free to state Supported over a copy it also called behind would be free to state the flattering half alone.

Confidence, where a block reports one, is defined rather than taken on trust. An answer block carries a band — high, moderate, or low — and what a model reported is capped by what its own sources allow: an unsupported answer is low whatever the model said, and a conflicting or stale one cannot be high. A band nothing can be read out of is read as moderate, so a malformed answer never arrives more confident than a well-formed one. What the bands mean is fixed by the composition and not by the model: high is the sources settling the question and the answer restating them, moderate is a step of inference somebody may want to check, and low is the best reading of partial sources.

What a citation resolves to

A citation resolves to one of exactly three things, and each of them is somewhere a reader can be taken:

  • an email, for a fact that rests on the message as such;
  • a fragment, one persisted passage of a message, for a fact taken from a particular part of a long one;
  • an attachment, named by the message and the attachment's position within it, which is the same pair the download route is addressed with.

Each names the email by its local identity rather than by its remote occurrence, because a citation is followed inside this deployment and an occurrence moves when a folder is renamed or a mailbox is rebuilt.

A citation also says two things about the source itself rather than about where it is.

Written, or depicted

A source is Written where somebody wrote it — a message body, a quoted passage, a document's own text — and Depicted where it is this deployment's description of a picture rather than words anybody typed. ADR 0030 makes a depicted source corroborating rather than a headline, and that ranking has to survive the journey to a screen: a fact resting on a described photograph of an invoice rests on a machine's account of what an image shows, and presenting it like a quotation is how an answer quietly promotes a guess.

It sits on the citation rather than on the fact, so a block resting on depicted sources alone is worked out from the citations it names rather than stated as a second value that could come to disagree with them.

A source that could not be read

A source that exists, is named on a message, and yielded nothing is a different situation from a mailbox that holds nothing on the subject, and the difference decides what somebody does next: an encrypted contract is opened with a password, a scan is read by a person, and an empty mailbox is a question asked somewhere else. So a citation may carry a reason it could not be read — encrypted, corrupt, a format nothing here reads, too large, no text found, not attempted, or a reading that failed and may succeed later.

The members are the granularity a reader acts on rather than the granularity extraction records. Reading an attachment's text and describing an image each publish a longer set of their own, several of them about a provider or a ceiling an operator set, and a client drawing one of those beside a fact would be drawing the deployment's own configuration into somebody's answer.

No block may rest on such a source. A fact drawn from a source nobody could read is a fact drawn from exactly the nothing the state exists to report, so the plan refuses it. What the state is for is the shape beside it: an unsupported answer, the source declared with its reason, and the run's limitations saying sources were unavailable — which is a plan saying "the contract is there, it is encrypted, and this is why the question is unanswered".

How a citation is followed

One route follows all three, POST /api/client/citations/resolution, and it takes the citation target the plan published unchanged. Three things about it are properties of the contract rather than of that route:

  • Resolution is scoped to what the caller may read, because a plan is a thing to be shown to somebody. Every message is read through the use case the reading pane reads one with, so a citation composed to name mail outside the caller's scope reads nothing and is reported as a private source — which is a state a client draws rather than an error, and the same answer mail this deployment does not hold receives. Separating the two would take a read outside that scope, whose answer would say whether somebody else's message exists.
  • A citation outlives a re-cut of the mail it points at. Chunking derives a message's passages again whenever its stored reading changes, so a passage identifier can go while the message it was cut from stays. That is why a fragment target carries both: the resolution of a passage that is no longer there is the message with the place reported unresolvable, never the nearest remaining passage, which would be evidence for a fact it was not drawn from.
  • A resolution carries enough to draw the source in place — the passage with the offsets it was cut from, the message it belongs to, and its dates — so checking a fact is reading a sentence rather than opening a document and searching it. The offsets are what make the reference verifiable: the same span of the same extracted text returns exactly that passage.

How a plan cannot become code

The contract holds this by construction rather than by review.

  • The block hierarchy is closed by a private protected constructor, so nothing outside the assembly that declares it can bring a block into being from data. What C# leaves reachable is the copy constructor every non-sealed record has, which the language requires to be protected; a type derived through it can only copy a block the contract already composed, carries that block's catalogue type, and is refused by the serializer as a type the contract never declared.
  • Every free text in the contract is a PresentationText, which refuses a value that opens and closes as a tag — the shape a model returning XAML, HTML, or SVG produces — refuses control characters, and is bounded in length. It deliberately does not sanitize prose that merely mentions an angle bracket: mail quoted from a developer's inbox contains one, and the client draws the value into a typed text element rather than into a parser.
  • Everything else is a number, a timestamp, an identity, or a value from a closed set. There is no member anywhere in the contract whose meaning is "render this". An address is the one of those whose validity is a domain rule rather than this contract's, and that rule is about the shape of an address rather than its length, so the length is bounded here as well.

Those rules hold for a plan read off the wire exactly as for one composed in process, because deserialization goes through the same constructors. Where a rule is a length, the arriving token is measured before anything decodes it, so a value nothing here could accept is refused rather than built first and refused after.

The form on the wire

A plan is serialized by its own source-generated serializer, PresentationPlanJsonContext. Property names are camel case, values from a closed set are written as their names rather than as ordinals, and each block carries type — the catalogue identity — and version. An identity is what a client keys its renderers by, so it survives a rename of the C# member; an ordinal would silently change meaning the first time a set were reordered.

Identities that this deployment already publishes elsewhere are written the way it publishes them: an email as the UUID the client API names one by, an address as the message wrote it, without the comparison form used internally for grouping.

The whole contract — both version numbers, every block identity, every column, every bound, and the JSON schema each part serializes as — is recorded in backend/tests/PublicSurfaces.UnitTests/presentation-plan-contract.json, which a test holds each build against. A diff there is a change to a published contract and belongs in the release's changelog. It is not yet part of the generated OpenAPI document, because that document is derived from the endpoints the host maps and no route serves a plan yet; the route that streams a run is what will put it there.

A plan is mail

Everything in a plan comes from somebody's correspondence: its texts are quoted or summarized mail, its people are real people, and its citations name messages in a mailbox. It is sensitive throughout and is classified that way by default — it belongs in a response to whoever asked the question and nowhere else, never in a log line, a span attribute, or an exception message. The bounds above are part of that too: they cap how much of a mailbox one answer can carry out of the deployment at all.

What is deliberately not here

  • Producing a plan. What a run retrieves and which blocks it composes is the Discover run.
  • Rendering one. The client's canvas and its block renderers are separate work again.
  • What a run spent. Cost, cancellation, and the events a run streams are properties of the run rather than of the plan it produced. What a run reports about each, and what a person is told when a spend ceiling refuses one, is decided in ADR 0022.