# MailglassInbound v0.2.0 - Table of Contents

Inbound routing contract package for mailglass

## Pages

- Overview
  - [MailglassInbound](readme.md)

- Contract
  - [API Stability — mailglass_inbound](api_stability.md)

- Guides
  - [Postmark Ingress](postmark_ingress.md)
  - [SendGrid Ingress](sendgrid_ingress.md)

- Inbound Guides
  - [mailglass_inbound Installation Guide](inbound-install.md)
  - [mailglass_inbound Testing Guide](inbound-testing.md)
  - [mailglass_inbound Operator Guide](inbound-operator.md)
  - [Mailgun Ingress](inbound-mailgun.md)
  - [SES Inbound](inbound-ses.md)
  - [Inbound Routing Debug Guide](inbound-routing-debug.md)

## Modules

- [MailglassInbound.Config](MailglassInbound.Config.md): Validated configuration accessor for the `:mailglass_inbound` app env (D-49-02).
- [MailglassInbound.InboundMessage.Signals](MailglassInbound.InboundMessage.Signals.md): Framework-derived, read-only signals about an inbound message.
- [MailglassInbound.InboundRecords](MailglassInbound.InboundRecords.md): Package-local persistence boundary for canonical inbound rows, raw evidence,
and execution lineage.

- [MailglassInbound.InboundRecords.ExecutionRun](MailglassInbound.InboundRecords.ExecutionRun.md): Append-only execution lineage row shared by fresh ingress and replay.
- [MailglassInbound.InboundRecords.InboundEvidence](MailglassInbound.InboundRecords.InboundEvidence.md): Raw evidence row linked to one canonical inbound record.
- [MailglassInbound.InboundRecords.InboundRecord](MailglassInbound.InboundRecords.InboundRecord.md): Canonical normalized inbound row.
- [MailglassInbound.InboundRecords.ReplayRun](MailglassInbound.InboundRecords.ReplayRun.md): Append-only replay execution history row.
- [MailglassInbound.Internal.Doctor](MailglassInbound.Internal.Doctor.md): DNS-free pre-deploy config check runner for `mix mailglass.inbound.doctor`
(IOPS-01, MIME-03). All checks are pure reflection — no DB, no DNS, no network
— so the doctor is fast, offline, and CI-friendly (D-49-06).
- [MailglassInbound.Internal.Prune](MailglassInbound.Internal.Prune.md): Oban-independent batched retention sweep for inbound tables (IOPS-03,
D-49-25..30). This is the workhorse: `mix mailglass.inbound.prune` and the
optional `MailglassInbound.Prune.Worker` cron both call `prune/0`.
- [MailglassInbound.MIME](MailglassInbound.MIME.md): Standalone, never-raising RFC 5322 MIME parser.
- [MailglassInbound.Operator.Formatter](MailglassInbound.Operator.Formatter.md): Shared human and JSON renderers for inbound operator results (D-49-04).
- [MailglassInbound.OptionalDeps.ExAwsS3](MailglassInbound.OptionalDeps.ExAwsS3.md): Gateway for the optional `ex_aws` / `ex_aws_s3` dependencies
(`{:ex_aws, "~> 2.7"}` + `{:ex_aws_s3, "~> 2.5"}`).
- [MailglassInbound.OptionalDeps.Oban](MailglassInbound.OptionalDeps.Oban.md): Gateway for the optional Oban dependency (`{:oban, "~> 2.21"}`).
- [MailglassInbound.Prune.Worker](MailglassInbound.Prune.Worker.md): Optional Oban cron worker that runs the inbound retention sweep (IOPS-03,
D-49-28). The batched workhorse lives in `MailglassInbound.Internal.Prune`;
this worker's `perform/1` just delegates to `prune/0`.
- [MailglassInbound.PubSub.Topics](MailglassInbound.PubSub.Topics.md): Typed topic builder for `mailglass_inbound` PubSub broadcasts (TELE-07, D-45-07).
- [MailglassInbound.RateLimiter](MailglassInbound.RateLimiter.md): Inbound-local multi-bucket ETS token-bucket rate limiter (IOPS-04, D-49-11).
- [MailglassInbound.RateLimiter.TableOwner](MailglassInbound.RateLimiter.TableOwner.md): Init-and-idle GenServer owning the `:mailglass_inbound_rate_limit` ETS table
(cloned from `Mailglass.RateLimiter.TableOwner`, D-22 crash semantics). Owns
nothing beyond ETS table creation — no `handle_call/3`, `handle_cast/2`, or
`handle_info/2`. Hot-path reads/writes happen directly from caller processes
via `:ets.update_counter/4` — NO GenServer mailbox serialization.
- [MailglassInbound.Repo](MailglassInbound.Repo.md): Thin facade over the host-configured repo for `mailglass_inbound`.
- [MailglassInbound.Schema](MailglassInbound.Schema.md): Stamps `mailglass_inbound` schema conventions onto internal persistence modules.
- [MailglassInbound.Telemetry](MailglassInbound.Telemetry.md): The single span surface for `mailglass_inbound` (D-45-01).

- Stable
  - [MailglassInbound](MailglassInbound.md): Public contract root for the `mailglass_inbound` sibling package.
  - [MailglassInbound.InboundMessage](MailglassInbound.InboundMessage.md): Canonical normalized inbound message passed to routing and mailbox code.
  - [MailglassInbound.Ingress.CachingBodyReader](MailglassInbound.Ingress.CachingBodyReader.md): Package-local `Plug.Parsers` body reader for inbound provider verification.
  - [MailglassInbound.Ingress.Plug](MailglassInbound.Ingress.Plug.md): Public inbound ingress plug for `mailglass_inbound`.
  - [MailglassInbound.Mailbox](MailglassInbound.Mailbox.md): Behaviour for adopter-defined inbound mailboxes.
  - [MailglassInbound.Router](MailglassInbound.Router.md): Thin router DSL for compiling inbound mailbox routes into pure route data.

- Testing
  - [MailglassInbound.Fixtures](MailglassInbound.Fixtures.md): Code-built inbound payload fixtures for adopter tests (ITEST-07).
  - [MailglassInbound.MailboxCase](MailglassInbound.MailboxCase.md): The shipped `ExUnit.CaseTemplate` adopters `use` to test inbound mailboxes
(ITEST-05) — the inbound analog of outbound's `Mailglass.MailerCase`, and the
keystone that ties the inbound Testing helpers together.
  - [MailglassInbound.Test.Ingress](MailglassInbound.Test.Ingress.md): The inbound test driver (ITEST-06): drives the **real** synchronous
persist + route + execute write path and captures the outcome in the
current test process's mailbox.
  - [MailglassInbound.TestAssertions](MailglassInbound.TestAssertions.md): Inbound test assertions (ITEST-01..04) — the inbound mirror of
`Mailglass.TestAssertions`.

- Internal
  - [MailglassInbound.OptionalDeps](MailglassInbound.OptionalDeps.md): Namespace for package-local optional dependency gateway modules.

- Exceptions
  - [MailglassInbound.MIMEError](MailglassInbound.MIMEError.md): Structured error for raw RFC 5322 MIME parse failures (`MailglassInbound.MIME`).
  - [MailglassInbound.S3FetchError](MailglassInbound.S3FetchError.md): Structured error for AWS SES inbound S3-object fetch failures.
  - [MailglassInbound.SignatureError](MailglassInbound.SignatureError.md): Structured, **no-recovery** error for inbound provider signature failures
(Mailgun HMAC, AWS SES SNS X.509, and SNS `SubscribeURL` trust-policy checks).

## Mix Tasks

- [mix mailglass.inbound.doctor](Mix.Tasks.Mailglass.Inbound.Doctor.md): Run DNS-free pre-deploy configuration checks for inbound mail (IOPS-01).
- [mix mailglass.inbound.prune](Mix.Tasks.Mailglass.Inbound.Prune.md): Manually run the inbound retention sweep (IOPS-03).
- [mix mailglass.inbound.replay](Mix.Tasks.Mailglass.Inbound.Replay.md): Replay previously-received inbound records through their mailboxes (IOPS-02).

